diff --git a/js/editor/Editor.js b/js/editor/Editor.js index e63538fe..e39f94a9 100644 --- a/js/editor/Editor.js +++ b/js/editor/Editor.js @@ -265,13 +265,11 @@ define("webodf/editor/Editor", [ */ self.loadSession = function (sessionId, editorReadyCallback) { initGuiAndDoc("/session/" + sessionId + "/genesis", function () { - // use the nowjs op-router when connected -// opRouter = opRouter || new ops.NowjsOperationRouter(sessionId, memberid, server); - opRouter = opRouter || new ops.PullBoxOperationRouter(sessionId, memberid, server); + // get router and user model + opRouter = opRouter || server.createOperationRouter(sessionId, memberid); session.setOperationRouter(opRouter); -// userModel = userModel || new ops.NowjsUserModel(server); - userModel = userModel || new ops.PullBoxUserModel(server); + userModel = userModel || server.createUserModel(); session.setUserModel(userModel); opRouter.requestReplay(function done() { diff --git a/js/editor/EditorSession.js b/js/editor/EditorSession.js index 57da7fb8..6a10aea7 100644 --- a/js/editor/EditorSession.js +++ b/js/editor/EditorSession.js @@ -1,6 +1,6 @@ /** * @license - * Copyright (C) 2012 KO GmbH + * Copyright (C) 2013 KO GmbH * * @licstart * The JavaScript code in this page is free software: you can redistribute it @@ -44,10 +44,6 @@ define("webodf/editor/EditorSession", [ runtime.loadClass("ops.OdtDocument"); runtime.loadClass("ops.Session"); -// runtime.loadClass("ops.NowjsOperationRouter"); -// runtime.loadClass("ops.NowjsUserModel"); - runtime.loadClass("ops.PullBoxOperationRouter"); - runtime.loadClass("ops.PullBoxUserModel"); runtime.loadClass("odf.OdfCanvas"); runtime.loadClass("gui.CaretFactory"); runtime.loadClass("gui.Caret"); diff --git a/js/editor/SessionListView.js b/js/editor/SessionListView.js index 8c1131c6..66f11dd7 100644 --- a/js/editor/SessionListView.js +++ b/js/editor/SessionListView.js @@ -1,6 +1,6 @@ /** * @license - * Copyright (C) 2012 KO GmbH + * Copyright (C) 2012-2013 KO GmbH * * @licstart * The JavaScript code in this page is free software: you can redistribute it diff --git a/js/editor/boot_editor.js b/js/editor/boot_editor.js index dce905fc..5d029aff 100644 --- a/js/editor/boot_editor.js +++ b/js/editor/boot_editor.js @@ -210,7 +210,10 @@ var webodfEditor = (function () { editorOptions.loadCallback = load; editorOptions.saveCallback = save; - runtime.assert(docUrl, "docUrl needs to be specified"); + if (docUrl === undefined) { + docUrl = guessDocUrl(); + } + runtime.assert(docUrl, "docUrl needs to be specified"); runtime.assert(editorInstance === null, "cannot boot with instanciated editor"); document.getElementById("mainContainer").style.display = ""; @@ -350,13 +353,10 @@ var webodfEditor = (function () { args = args || {}; if (args.collaborative === undefined) { - args.collaborative = "auto"; + args.collaborative = "standalone"; } else { args.collaborative = String(args.collaborative).toLowerCase(); } - if (args.docUrl === undefined) { - args.docUrl = guessDocUrl(); - } if (args.saveCallback) { editorOptions.saveCallback = args.saveCallback; diff --git a/js/webodf-debug.js b/js/webodf-debug.js index 12d5da0a..35a75725 100644 --- a/js/webodf-debug.js +++ b/js/webodf-debug.js @@ -8993,10 +8993,16 @@ ops.Server.prototype.login = function(login, password, successCb, failCb) { @source: http://gitorious.org/webodf/webodf/ */ ops.NowjsServer = function NowjsServer() { - var nowObject; + var self = this, nowObject; this.getNowObject = function() { return nowObject }; + function createOperationRouter(sid, mid) { + return new ops.NowjsOperationRouter(sid, mid, self) + } + function createUserModel() { + return new ops.NowjsUserModel(self) + } this.connect = function(timeout, callback) { var accumulatedWaitingTime = 0; if(nowObject) { @@ -9036,7 +9042,9 @@ ops.NowjsServer = function NowjsServer() { }else { nowObject.login(login, password, successCb, failCb) } - } + }; + this.createOperationRouter = createOperationRouter; + this.createUserModel = createUserModel }; /* @@ -9078,6 +9086,12 @@ ops.PullBoxServer = function PullBoxServer(args) { var self = this, token, base64 = new core.Base64; args = args || {}; args.url = args.url || "/WSER"; + function createOperationRouter(sid, mid) { + return new ops.PullBoxOperationRouter(sid, mid, self) + } + function createUserModel() { + return new ops.PullBoxUserModel(self) + } function call(message, cb) { var xhr = new XMLHttpRequest, byteArrayWriter = new core.ByteArrayWriter("utf8"), data; function handleResult() { @@ -9135,7 +9149,9 @@ ops.PullBoxServer = function PullBoxServer(args) { failCb(responseData) } }) - } + }; + this.createOperationRouter = createOperationRouter; + this.createUserModel = createUserModel }; /* diff --git a/js/webodf.js b/js/webodf.js index b067fad1..f55c57b0 100644 --- a/js/webodf.js +++ b/js/webodf.js @@ -36,80 +36,80 @@ */ var core={},gui={},xmldom={},odf={},ops={}; // Input 1 -function Runtime(){}Runtime.ByteArray=function(h){};Runtime.prototype.getVariable=function(h){};Runtime.prototype.toJson=function(h){};Runtime.prototype.fromJson=function(h){};Runtime.ByteArray.prototype.slice=function(h,l){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(h){};Runtime.prototype.byteArrayFromString=function(h,l){};Runtime.prototype.byteArrayToString=function(h,l){};Runtime.prototype.concatByteArrays=function(h,l){}; -Runtime.prototype.read=function(h,l,f,q){};Runtime.prototype.readFile=function(h,l,f){};Runtime.prototype.readFileSync=function(h,l){};Runtime.prototype.loadXML=function(h,l){};Runtime.prototype.writeFile=function(h,l,f){};Runtime.prototype.isFile=function(h,l){};Runtime.prototype.getFileSize=function(h,l){};Runtime.prototype.deleteFile=function(h,l){};Runtime.prototype.log=function(h,l){};Runtime.prototype.setTimeout=function(h,l){};Runtime.prototype.libraryPaths=function(){}; -Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(h){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(h,l,f){};var IS_COMPILED_CODE=!0; -Runtime.byteArrayToString=function(h,l){function f(g){var a="",e,d=g.length;for(e=0;eb?a+=String.fromCharCode(b):(e+=1,s=g[e],194<=b&&224>b?a+=String.fromCharCode((b&31)<<6|s&63):(e+=1,m=g[e],224<=b&&240>b?a+=String.fromCharCode((b&15)<<12|(s&63)<<6|m&63):(e+=1,k=g[e],240<=b&&245>b&&(b=(b&7)<<18|(s&63)<<12|(m&63)<<6|k&63,b-=65536,a+=String.fromCharCode((b>>10)+55296,(b&1023)+56320))))); -return a}var p;"utf8"===l?p=q(h):("binary"!==l&&this.log("Unsupported encoding: "+l),p=f(h));return p};Runtime.getVariable=function(h){try{return eval(h)}catch(l){}};Runtime.toJson=function(h){return JSON.stringify(h)};Runtime.fromJson=function(h){return JSON.parse(h)};Runtime.getFunctionName=function(h){return void 0===h.name?(h=/function\s+(\w+)/.exec(h))&&h[1]:h.name}; -function BrowserRuntime(h){function l(g,a){var e,d,b;void 0!==a?b=g:a=g;h?(d=h.ownerDocument,b&&(e=d.createElement("span"),e.className=b,e.appendChild(d.createTextNode(b)),h.appendChild(e),h.appendChild(d.createTextNode(" "))),e=d.createElement("span"),0s?(d[m]=s,m+=1):2048>s?(d[m]=192|s>>>6,d[m+1]=128|s&63,m+=2):(d[m]=224|s>>>12&15,d[m+1]=128|s>>>6&63,d[m+2]=128|s&63,m+=3)}else for("binary"!==a&&f.log("unknown encoding: "+a),e=g.length,d=new f.ByteArray(e),b=0;bd.status||0===d.status?e(null):e("Status "+String(d.status)+": "+d.responseText||d.statusText):e("File "+g+" is empty."))}; -a=a.buffer&&!d.sendAsBinary?a.buffer:f.byteArrayToString(a,"binary");try{d.sendAsBinary?d.sendAsBinary(a):d.send(a)}catch(b){f.log("HUH? "+b+" "+a),e(b.message)}};this.deleteFile=function(g,a){delete q[g];var e=new XMLHttpRequest;e.open("DELETE",g,!0);e.onreadystatechange=function(){4===e.readyState&&(200>e.status&&300<=e.status?a(e.responseText):a(null))};e.send(null)};this.loadXML=function(g,a){var e=new XMLHttpRequest;e.open("GET",g,!0);e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange= -function(){4===e.readyState&&(0!==e.status||e.responseText?200===e.status||0===e.status?a(null,e.responseXML):a(e.responseText):a("File "+g+" is empty."))};try{e.send(null)}catch(d){a(d.message)}};this.isFile=function(g,a){f.getFileSize(g,function(e){a(-1!==e)})};this.getFileSize=function(g,a){var e=new XMLHttpRequest;e.open("HEAD",g,!0);e.onreadystatechange=function(){if(4===e.readyState){var d=e.getResponseHeader("Content-Length");d?a(parseInt(d,10)):a(-1)}};e.send(null)};this.log=l;this.assert= -function(g,a,e){if(!g)throw l("alert","ASSERTION FAILED:\n"+a),e&&e(),a;};this.setTimeout=function(g,a){setTimeout(function(){g()},a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(g){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(g){return(new DOMParser).parseFromString(g,"text/xml")};this.exit=function(g){l("Calling exit with code "+String(g)+", but exit() is not implemented.")}; +function Runtime(){}Runtime.ByteArray=function(h){};Runtime.prototype.getVariable=function(h){};Runtime.prototype.toJson=function(h){};Runtime.prototype.fromJson=function(h){};Runtime.ByteArray.prototype.slice=function(h,m){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(h){};Runtime.prototype.byteArrayFromString=function(h,m){};Runtime.prototype.byteArrayToString=function(h,m){};Runtime.prototype.concatByteArrays=function(h,m){}; +Runtime.prototype.read=function(h,m,f,n){};Runtime.prototype.readFile=function(h,m,f){};Runtime.prototype.readFileSync=function(h,m){};Runtime.prototype.loadXML=function(h,m){};Runtime.prototype.writeFile=function(h,m,f){};Runtime.prototype.isFile=function(h,m){};Runtime.prototype.getFileSize=function(h,m){};Runtime.prototype.deleteFile=function(h,m){};Runtime.prototype.log=function(h,m){};Runtime.prototype.setTimeout=function(h,m){};Runtime.prototype.libraryPaths=function(){}; +Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(h){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(h,m,f){};var IS_COMPILED_CODE=!0; +Runtime.byteArrayToString=function(h,m){function f(e){var a="",g,d=e.length;for(g=0;gb?a+=String.fromCharCode(b):(g+=1,r=e[g],194<=b&&224>b?a+=String.fromCharCode((b&31)<<6|r&63):(g+=1,k=e[g],224<=b&&240>b?a+=String.fromCharCode((b&15)<<12|(r&63)<<6|k&63):(g+=1,l=e[g],240<=b&&245>b&&(b=(b&7)<<18|(r&63)<<12|(k&63)<<6|l&63,b-=65536,a+=String.fromCharCode((b>>10)+55296,(b&1023)+56320))))); +return a}var q;"utf8"===m?q=n(h):("binary"!==m&&this.log("Unsupported encoding: "+m),q=f(h));return q};Runtime.getVariable=function(h){try{return eval(h)}catch(m){}};Runtime.toJson=function(h){return JSON.stringify(h)};Runtime.fromJson=function(h){return JSON.parse(h)};Runtime.getFunctionName=function(h){return void 0===h.name?(h=/function\s+(\w+)/.exec(h))&&h[1]:h.name}; +function BrowserRuntime(h){function m(e,a){var g,d,b;void 0!==a?b=e:a=e;h?(d=h.ownerDocument,b&&(g=d.createElement("span"),g.className=b,g.appendChild(d.createTextNode(b)),h.appendChild(g),h.appendChild(d.createTextNode(" "))),g=d.createElement("span"),0r?(d[k]=r,k+=1):2048>r?(d[k]=192|r>>>6,d[k+1]=128|r&63,k+=2):(d[k]=224|r>>>12&15,d[k+1]=128|r>>>6&63,d[k+2]=128|r&63,k+=3)}else for("binary"!==a&&f.log("unknown encoding: "+a),g=e.length,d=new f.ByteArray(g),b=0;bd.status||0===d.status?g(null):g("Status "+String(d.status)+": "+d.responseText||d.statusText):g("File "+e+" is empty."))}; +a=a.buffer&&!d.sendAsBinary?a.buffer:f.byteArrayToString(a,"binary");try{d.sendAsBinary?d.sendAsBinary(a):d.send(a)}catch(b){f.log("HUH? "+b+" "+a),g(b.message)}};this.deleteFile=function(e,a){delete n[e];var g=new XMLHttpRequest;g.open("DELETE",e,!0);g.onreadystatechange=function(){4===g.readyState&&(200>g.status&&300<=g.status?a(g.responseText):a(null))};g.send(null)};this.loadXML=function(e,a){var g=new XMLHttpRequest;g.open("GET",e,!0);g.overrideMimeType&&g.overrideMimeType("text/xml");g.onreadystatechange= +function(){4===g.readyState&&(0!==g.status||g.responseText?200===g.status||0===g.status?a(null,g.responseXML):a(g.responseText):a("File "+e+" is empty."))};try{g.send(null)}catch(d){a(d.message)}};this.isFile=function(e,a){f.getFileSize(e,function(g){a(-1!==g)})};this.getFileSize=function(e,a){var g=new XMLHttpRequest;g.open("HEAD",e,!0);g.onreadystatechange=function(){if(4===g.readyState){var d=g.getResponseHeader("Content-Length");d?a(parseInt(d,10)):a(-1)}};g.send(null)};this.log=m;this.assert= +function(e,a,g){if(!e)throw m("alert","ASSERTION FAILED:\n"+a),g&&g(),a;};this.setTimeout=function(e,a){setTimeout(function(){e()},a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(e){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(e){return(new DOMParser).parseFromString(e,"text/xml")};this.exit=function(e){m("Calling exit with code "+String(e)+", but exit() is not implemented.")}; this.getWindow=function(){return window}} -function NodeJSRuntime(){function h(a,d,b){a=q.resolve(p,a);"binary"!==d?f.readFile(a,d,b):f.readFile(a,null,b)}var l=this,f=require("fs"),q=require("path"),p="",g,a;this.ByteArray=function(a){return new Buffer(a)};this.byteArrayFromArray=function(a){var d=new Buffer(a.length),b,s=a.length;for(b=0;b").implementation} -function RhinoRuntime(){function h(a,e){var d;void 0!==e?d=a:e=a;"alert"===d&&print("\n!!!!! ALERT !!!!!");print(e);"alert"===d&&print("!!!!! ALERT !!!!!")}var l=this,f=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),q,p,g="";f.setValidating(!1);f.setNamespaceAware(!0);f.setExpandEntityReferences(!1);f.setSchema(null);p=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,e){var d=new Packages.java.io.FileReader(e);return new Packages.org.xml.sax.InputSource(d)}});q=f.newDocumentBuilder(); -q.setEntityResolver(p);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a,e){var d=[],b,s=a.length;for(b=0;b").implementation} +function RhinoRuntime(){function h(a,g){var d;void 0!==g?d=a:g=a;"alert"===d&&print("\n!!!!! ALERT !!!!!");print(g);"alert"===d&&print("!!!!! ALERT !!!!!")}var m=this,f=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),n,q,e="";f.setValidating(!1);f.setNamespaceAware(!0);f.setExpandEntityReferences(!1);f.setSchema(null);q=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,g){var d=new Packages.java.io.FileReader(g);return new Packages.org.xml.sax.InputSource(d)}});n=f.newDocumentBuilder(); +n.setEntityResolver(q);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a,g){var d=[],b,e=a.length;for(b=0;b>>18],c+=t[a>>>12&63],c+=t[a>>>6&63],c+=t[a&63];m===n+1?(a=b[m]<<4,c+=t[a>>>6],c+=t[a&63],c+="=="):m===n&&(a=b[m]<<10|b[m+1]<<2,c+=t[a>>>12],c+=t[a>>>6&63],c+=t[a&63],c+="=");return c}function f(b){b=b.replace(/[^A-Za-z0-9+\/]+/g,"");var a=[],c=b.length%4,m,n=b.length,d;for(m=0;m>16,d>>8&255,d&255);a.length-=[0,0,2,1][c];return a}function q(b){var a=[],c,m=b.length,n;for(c=0;cn?a.push(n):2048>n?a.push(192|n>>>6,128|n&63):a.push(224|n>>>12&15,128|n>>>6&63,128|n&63);return a}function p(b){var a=[],c,m=b.length,n,d,k;for(c=0;cn?a.push(n):(c+=1,d=b[c],224>n?a.push((n&31)<<6|d&63):(c+=1,k=b[c],a.push((n&15)<<12|(d&63)<<6|k&63)));return a}function g(b){return l(h(b))} -function a(b){return String.fromCharCode.apply(String,f(b))}function e(b){return p(h(b))}function d(b){b=p(b);for(var a="",c=0;ca?m+=String.fromCharCode(a):(k+=1,n=b.charCodeAt(k)&255,224>a?m+=String.fromCharCode((a&31)<<6|n&63):(k+=1,d=b.charCodeAt(k)&255,m+=String.fromCharCode((a&15)<<12|(n&63)<<6|d&63)));return m}function s(a,c){function m(){var e= -k+n;e>a.length&&(e=a.length);d+=b(a,k,e);k=e;e=k===a.length;c(d,e)&&!e&&runtime.setTimeout(m,0)}var n=1E5,d="",k=0;a.lengtha;a+=1)b.push(65+a);for(a=0;26>a;a+=1)b.push(97+a);for(a= -0;10>a;a+=1)b.push(48+a);b.push(43);b.push(47);return b})();var r=function(b){var a={},c,m;c=0;for(m=b.length;c>>18],c+=u[a>>>12&63],c+=u[a>>>6&63],c+=u[a&63];k===p+1?(a=b[k]<<4,c+=u[a>>>6],c+=u[a&63],c+="=="):k===p&&(a=b[k]<<10|b[k+1]<<2,c+=u[a>>>12],c+=u[a>>>6&63],c+=u[a&63],c+="=");return c}function f(b){b=b.replace(/[^A-Za-z0-9+\/]+/g,"");var a=[],c=b.length%4,k,p=b.length,d;for(k=0;k>16,d>>8&255,d&255);a.length-=[0,0,2,1][c];return a}function n(b){var a=[],c,k=b.length,p;for(c=0;cp?a.push(p):2048>p?a.push(192|p>>>6,128|p&63):a.push(224|p>>>12&15,128|p>>>6&63,128|p&63);return a}function q(b){var a=[],c,k=b.length,p,d,l;for(c=0;cp?a.push(p):(c+=1,d=b[c],224>p?a.push((p&31)<<6|d&63):(c+=1,l=b[c],a.push((p&15)<<12|(d&63)<<6|l&63)));return a}function e(b){return m(h(b))} +function a(b){return String.fromCharCode.apply(String,f(b))}function g(b){return q(h(b))}function d(b){b=q(b);for(var a="",c=0;ca?k+=String.fromCharCode(a):(l+=1,p=b.charCodeAt(l)&255,224>a?k+=String.fromCharCode((a&31)<<6|p&63):(l+=1,d=b.charCodeAt(l)&255,k+=String.fromCharCode((a&15)<<12|(p&63)<<6|d&63)));return k}function r(a,c){function k(){var e= +l+p;e>a.length&&(e=a.length);d+=b(a,l,e);l=e;e=l===a.length;c(d,e)&&!e&&runtime.setTimeout(k,0)}var p=1E5,d="",l=0;a.lengtha;a+=1)b.push(65+a);for(a=0;26>a;a+=1)b.push(97+a);for(a= +0;10>a;a+=1)b.push(48+a);b.push(43);b.push(47);return b})();var t=function(b){var a={},c,k;c=0;for(k=b.length;c>>8):(oa(a&255),oa(a>>>8))},qa=function(){u=(u<<5^c[z+3-1]&255)&8191;w=x[32768+u];x[z&32767]=w;x[32768+u]=z},da=function(b,a){C>16-a?(n|=b<>16-C,C+=a-16):(n|=b<b;b++)c[b]=c[b+32768];H-=32768;z-=32768;y-=32768;for(b=0;8192>b;b++)a=x[32768+b],x[32768+b]=32768<=a?a-32768:0;for(b=0;32768>b;b++)a=x[b],x[b]=32768<=a?a-32768:0;m+=32768}D||(b=Aa(c,z+G,m),0>=b?D=!0:G+=b)},Ba=function(b){var a=T,m=z,n,d=O,k=32506=ca&&(a>>=2);do if(n=b,c[n+d]===g&&c[n+d-1]===r&&c[n]===c[m]&&c[++n]===c[m+1]){m+= -2;n++;do++m;while(c[m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&c[++m]===c[++n]&&md){H=b;d=n;if(258<=n)break;r=c[m+d-1];g=c[m+d]}}while((b=x[b&32767])>k&&0!==--a);return d},la=function(b,a){r[Z++]=a;0===b?U[a].fc++:(b--,U[v[a]+256+1].fc++,W[(256>b?aa[b]:aa[256+(b>>7)])&255].fc++,t[X++]=b,ha|=ja);ja<<=1;0===(Z&7)&&(M[sa++]=ha,ha=0,ja=1);if(2n;n++)c+=W[n].fc* -(5+ka[n]);c>>=3;if(X>=1,c<<=1;while(0<--a);return c>>1},Da=function(b,a){var c=[];c.length=16;var m=0,n;for(n=1;15>=n;n++)m=m+P[n-1]<<1,c[n]=m;for(m=0;m<=a;m++)n=b[m].dl,0!==n&&(b[m].fc=Ca(c[n]++,n))},xa=function(b){var a=b.dyn_tree,c=b.static_tree,m=b.elems,n,d=-1, -k=m;Y=0;E=573;for(n=0;nY;)n=Q[++Y]=2>d?++d:0,a[n].fc=1,$[n]=0,ea--,null!==c&&(ia-=c[n].dl);b.max_code=d;for(n=Y>>1;1<=n;n--)wa(a,n);do n=Q[1],Q[1]=Q[Y--],wa(a,1),c=Q[1],Q[--E]=n,Q[--E]=c,a[k].fc=a[n].fc+a[c].fc,$[k]=$[n]>$[c]+1?$[n]:$[c]+1,a[n].dl=a[c].dl=k,Q[1]=k++,wa(a,1);while(2<=Y);Q[--E]=Q[1];k=b.dyn_tree;n=b.extra_bits;var m=b.extra_base,c=b.max_code,e=b.max_length,r=b.static_tree,x,g,s,f,t=0;for(g=0;15>=g;g++)P[g]=0;k[Q[E]].dl=0;for(b= -E+1;573>b;b++)x=Q[b],g=k[k[x].dl].dl+1,g>e&&(g=e,t++),k[x].dl=g,x>c||(P[g]++,s=0,x>=m&&(s=n[x-m]),f=k[x].fc,ea+=f*(g+s),null!==r&&(ia+=f*(r[x].dl+s)));if(0!==t){do{for(g=e-1;0===P[g];)g--;P[g]--;P[g+1]+=2;P[e]--;t-=2}while(0c||(k[n].dl!==g&&(ea+=(g-k[n].dl)*k[n].fc,k[n].fc=g),x--)}Da(a,d)},Ea=function(b,a){var c,m=-1,n,k=b[0].dl,d=0,e=7,g=4;0===k&&(e=138,g=3);b[a+1].dl=65535;for(c=0;c<=a;c++)n=k,k=b[c+1].dl,++d=d?R[17].fc++:R[18].fc++,d=0,m=n,0===k?(e=138,g=3):n===k?(e=6,g=3):(e=7,g=4))},Fa=function(){8c?aa[c]:aa[256+(c>>7)])&255,fa(e,a),g=ka[e],0!==g&&(c-=L[e],da(c,g))),d>>=1;while(m=k?(fa(17,R),da(k-3,3)):(fa(18,R),da(k-11,7));k=0;m=n;0===d?(e=138,g=3):n===d?(e=6,g=3):(e=7,g=4)}},Ia=function(){var b;for(b=0;286>b;b++)U[b].fc=0;for(b=0;30>b;b++)W[b].fc=0;for(b=0;19>b;b++)R[b].fc=0;U[256].fc=1;ha=Z=X=sa=ea=ia=0;ja=1},ra=function(b){var a,n,m,k;k=z-y;M[sa]=ha;xa(I);xa(B);Ea(U,I.max_code);Ea(W,B.max_code);xa(J);for(m=18;3<=m&&0===R[ya[m]].dl;m--); -ea+=3*(m+1)+14;a=ea+3+7>>3;n=ia+3+7>>3;n<=a&&(a=n);if(k+4<=a&&0<=y)for(da(0+b,3),Fa(),pa(k),pa(~k),m=0;ma.len&&(e=a.len);for(r=0;rs-m&&(e=s-m);for(r=0;rt;t++)for(ga[t]= -f,r=0;r<1<t;t++)for(L[t]=f,r=0;r<1<>=7;30>t;t++)for(L[t]=f<<7,r=0;r<1<=r;r++)P[r]=0;for(r=0;143>=r;)N[r++].dl=8,P[8]++;for(;255>=r;)N[r++].dl=9,P[9]++;for(;279>=r;)N[r++].dl=7,P[7]++;for(;287>=r;)N[r++].dl=8,P[8]++;Da(N,287);for(r=0;30>r;r++)S[r].dl=5,S[r].fc=Ca(r,5);Ia()}for(r=0;8192>r;r++)x[32768+r]=0;ba=na[V].max_lazy;ca=na[V].good_length;T=na[V].max_chain;y=z=0;G=Aa(c,0,65536);if(0>=G)D= -!0,G=0;else{for(D=!1;262>G&&!D;)va();for(r=u=0;2>r;r++)u=(u<<5^c[r]&255)&8191}a=null;m=s=0;3>=V?(O=2,F=0):(F=2,A=0);k=!1}d=!0;if(0===G)return k=!0,0}if((r=Ja(b,e,g))===g)return g;if(k)return r;if(3>=V)for(;0!==G&&null===a;){qa();0!==w&&32506>=z-w&&(F=Ba(w),F>G&&(F=G));if(3<=F)if(t=la(z-H,F-3),G-=F,F<=ba){F--;do z++,qa();while(0!==--F);z++}else z+=F,F=0,u=c[z]&255,u=(u<<5^c[z+1]&255)&8191;else t=la(0,c[z]&255),G--,z++;t&&(ra(0),y=z);for(;262>G&&!D;)va()}else for(;0!==G&&null===a;){qa();O=F;K=H;F=2; -0!==w&&(O=z-w)&&(F=Ba(w),F>G&&(F=G),3===F&&4096G&&!D;)va()}0===G&&(0!==A&&la(0,c[z-1]&255),ra(1),k=!0);return r+Ja(b,r+e,g-r)};this.deflate=function(m,n){var k,f;ma=m;ta=0;"undefined"===String(typeof n)&&(n=6);(k=n)?1>k?k=1:9k;k++)U[k]=new h;W=[];W.length=61;for(k=0;61>k;k++)W[k]=new h;N=[];N.length=288;for(k=0;288>k;k++)N[k]=new h;S=[];S.length=30;for(k=0;30>k;k++)S[k]=new h;R=[];R.length=39;for(k=0;39>k;k++)R[k]=new h;I=new l;B=new l;J=new l;P=[];P.length=16;Q=[];Q.length=573;$=[];$.length=573;v=[];v.length=256;aa=[];aa.length=512;ga=[];ga.length=29;L=[];L.length=30;M=[];M.length=1024}for(var s=Array(1024),q=[];0<(k=La(s,0,s.length));){var u= -[];u.length=k;for(f=0;f>>8):(oa(a&255),oa(a>>>8))},qa=function(){v=(v<<5^c[z+3-1]&255)&8191;x=s[32768+v];s[z&32767]=x;s[32768+v]=z},da=function(b,a){C>16-a?(p|=b<>16-C,C+=a-16):(p|=b<b;b++)c[b]=c[b+32768];H-=32768;z-=32768;y-=32768;for(b=0;8192>b;b++)a=s[32768+b],s[32768+b]=32768<=a?a-32768:0;for(b=0;32768>b;b++)a=s[b],s[b]=32768<=a?a-32768:0;k+=32768}D||(b=Aa(c,z+G,k),0>=b?D=!0:G+=b)},Ba=function(b){var a=T,k=z,p,d=O,l=32506=ca&&(a>>=2);do if(p=b,c[p+d]===g&&c[p+d-1]===t&&c[p]===c[k]&&c[++p]===c[k+1]){k+= +2;p++;do++k;while(c[k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&c[++k]===c[++p]&&kd){H=b;d=p;if(258<=p)break;t=c[k+d-1];g=c[k+d]}}while((b=s[b&32767])>l&&0!==--a);return d},la=function(b,a){t[Z++]=a;0===b?U[a].fc++:(b--,U[w[a]+256+1].fc++,W[(256>b?aa[b]:aa[256+(b>>7)])&255].fc++,u[X++]=b,ha|=ja);ja<<=1;0===(Z&7)&&(L[sa++]=ha,ha=0,ja=1);if(2p;p++)c+=W[p].fc* +(5+ka[p]);c>>=3;if(X>=1,c<<=1;while(0<--a);return c>>1},Da=function(b,a){var c=[];c.length=16;var k=0,p;for(p=1;15>=p;p++)k=k+P[p-1]<<1,c[p]=k;for(k=0;k<=a;k++)p=b[k].dl,0!==p&&(b[k].fc=Ca(c[p]++,p))},xa=function(b){var a=b.dyn_tree,c=b.static_tree,k=b.elems,p,d=-1, +l=k;Y=0;E=573;for(p=0;pY;)p=Q[++Y]=2>d?++d:0,a[p].fc=1,$[p]=0,ea--,null!==c&&(ia-=c[p].dl);b.max_code=d;for(p=Y>>1;1<=p;p--)wa(a,p);do p=Q[1],Q[1]=Q[Y--],wa(a,1),c=Q[1],Q[--E]=p,Q[--E]=c,a[l].fc=a[p].fc+a[c].fc,$[l]=$[p]>$[c]+1?$[p]:$[c]+1,a[p].dl=a[c].dl=l,Q[1]=l++,wa(a,1);while(2<=Y);Q[--E]=Q[1];l=b.dyn_tree;p=b.extra_bits;var k=b.extra_base,c=b.max_code,e=b.max_length,t=b.static_tree,g,s,f,r,u=0;for(s=0;15>=s;s++)P[s]=0;l[Q[E]].dl=0;for(b= +E+1;573>b;b++)g=Q[b],s=l[l[g].dl].dl+1,s>e&&(s=e,u++),l[g].dl=s,g>c||(P[s]++,f=0,g>=k&&(f=p[g-k]),r=l[g].fc,ea+=r*(s+f),null!==t&&(ia+=r*(t[g].dl+f)));if(0!==u){do{for(s=e-1;0===P[s];)s--;P[s]--;P[s+1]+=2;P[e]--;u-=2}while(0c||(l[p].dl!==s&&(ea+=(s-l[p].dl)*l[p].fc,l[p].fc=s),g--)}Da(a,d)},Ea=function(b,a){var c,k=-1,p,l=b[0].dl,d=0,e=7,s=4;0===l&&(e=138,s=3);b[a+1].dl=65535;for(c=0;c<=a;c++)p=l,l=b[c+1].dl,++d=d?R[17].fc++:R[18].fc++,d=0,k=p,0===l?(e=138,s=3):p===l?(e=6,s=3):(e=7,s=4))},Fa=function(){8c?aa[c]:aa[256+(c>>7)])&255,fa(e,a),s=ka[e],0!==s&&(c-=K[e],da(c,s))),d>>=1;while(k=l?(fa(17,R),da(l-3,3)):(fa(18,R),da(l-11,7));l=0;k=p;0===d?(e=138,s=3):p===d?(e=6,s=3):(e=7,s=4)}},Ia=function(){var b;for(b=0;286>b;b++)U[b].fc=0;for(b=0;30>b;b++)W[b].fc=0;for(b=0;19>b;b++)R[b].fc=0;U[256].fc=1;ha=Z=X=sa=ea=ia=0;ja=1},ra=function(b){var a,p,k,l;l=z-y;L[sa]=ha;xa(I);xa(B);Ea(U,I.max_code);Ea(W,B.max_code);xa(J);for(k=18;3<=k&&0===R[ya[k]].dl;k--); +ea+=3*(k+1)+14;a=ea+3+7>>3;p=ia+3+7>>3;p<=a&&(a=p);if(l+4<=a&&0<=y)for(da(0+b,3),Fa(),pa(l),pa(~l),k=0;ka.len&&(s=a.len);for(t=0;tr-k&&(s=r-k);for(t=0;tu;u++)for(ga[u]= +f,g=0;g<1<u;u++)for(K[u]=f,g=0;g<1<>=7;30>u;u++)for(K[u]=f<<7,g=0;g<1<=g;g++)P[g]=0;for(g=0;143>=g;)M[g++].dl=8,P[8]++;for(;255>=g;)M[g++].dl=9,P[9]++;for(;279>=g;)M[g++].dl=7,P[7]++;for(;287>=g;)M[g++].dl=8,P[8]++;Da(M,287);for(g=0;30>g;g++)S[g].dl=5,S[g].fc=Ca(g,5);Ia()}for(g=0;8192>g;g++)s[32768+g]=0;ba=na[V].max_lazy;ca=na[V].good_length;T=na[V].max_chain;y=z=0;G=Aa(c,0,65536);if(0>=G)D= +!0,G=0;else{for(D=!1;262>G&&!D;)va();for(g=v=0;2>g;g++)v=(v<<5^c[g]&255)&8191}a=null;k=r=0;3>=V?(O=2,F=0):(F=2,A=0);l=!1}d=!0;if(0===G)return l=!0,0}if((g=Ja(b,e,t))===t)return t;if(l)return g;if(3>=V)for(;0!==G&&null===a;){qa();0!==x&&32506>=z-x&&(F=Ba(x),F>G&&(F=G));if(3<=F)if(u=la(z-H,F-3),G-=F,F<=ba){F--;do z++,qa();while(0!==--F);z++}else z+=F,F=0,v=c[z]&255,v=(v<<5^c[z+1]&255)&8191;else u=la(0,c[z]&255),G--,z++;u&&(ra(0),y=z);for(;262>G&&!D;)va()}else for(;0!==G&&null===a;){qa();O=F;N=H;F=2; +0!==x&&(O=z-x)&&(F=Ba(x),F>G&&(F=G),3===F&&4096G&&!D;)va()}0===G&&(0!==A&&la(0,c[z-1]&255),ra(1),l=!0);return g+Ja(b,g+e,t-g)};this.deflate=function(k,p){var l,f;ma=k;ta=0;"undefined"===String(typeof p)&&(p=6);(l=p)?1>l?l=1:9l;l++)U[l]=new h;W=[];W.length=61;for(l=0;61>l;l++)W[l]=new h;M=[];M.length=288;for(l=0;288>l;l++)M[l]=new h;S=[];S.length=30;for(l=0;30>l;l++)S[l]=new h;R=[];R.length=39;for(l=0;39>l;l++)R[l]=new h;I=new m;B=new m;J=new m;P=[];P.length=16;Q=[];Q.length=573;$=[];$.length=573;w=[];w.length=256;aa=[];aa.length=512;ga=[];ga.length=29;K=[];K.length=30;L=[];L.length=1024}for(var r=Array(1024),n=[];0<(l=La(r,0,r.length));){var v= +[];v.length=l;for(f=0;f>8&255])};this.appendUInt32LE=function(f){l.appendArray([f&255,f>>8&255,f>>16&255,f>>24&255])};this.appendString=function(q){f=runtime.concatByteArrays(f, -runtime.byteArrayFromString(q,h))};this.getLength=function(){return f.length};this.getByteArray=function(){return f}}; +core.ByteArrayWriter=function(h){var m=this,f=new runtime.ByteArray(0);this.appendByteArrayWriter=function(n){f=runtime.concatByteArrays(f,n.getByteArray())};this.appendByteArray=function(n){f=runtime.concatByteArrays(f,n)};this.appendArray=function(n){f=runtime.concatByteArrays(f,runtime.byteArrayFromArray(n))};this.appendUInt16LE=function(f){m.appendArray([f&255,f>>8&255])};this.appendUInt32LE=function(f){m.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,q,p,g,a,e,d,b,s,m,k,c,t,r,x,n=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],C=[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],y=[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],u=[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],w=[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],K=[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},F=function(){this.n=this.b=this.e=0;this.t=null},O=function(b,a,c,n,m,k){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var d=Array(this.BMAX+1),e,r,g,x,f,t,s,p=Array(this.BMAX+1),q,l,h,u=new F,C=Array(this.BMAX);x=Array(this.N_MAX);var y,w=Array(this.BMAX+1),G,z,D;D=this.root=null;for(f=0;ff&&(k=f);for(G=1<(G-=d[t])){this.status=2;this.m=k;return}if(0>(G-=d[f]))this.status=2,this.m=k;else{d[f]+=G;w[1]=t=0;q=d;l=1;for(h=2;0<--f;)w[h++]=t+=q[l++];q=b;f=l=0;do 0!=(t=q[l++])&&(x[w[t]++]=f);while(++fy+p[1+x];){y+=p[1+x];x++;z=(z=g-y)>k?k:z;if((r=1<<(t=s-y))>b+1)for(r-=b+1,h=s;++te&&y>y-p[x],C[x-1][t].e=u.e,C[x-1][t].b=u.b,C[x-1][t].n=u.n,C[x-1][t].t=u.t)}u.b=s-y;l>=a?u.e=99:q[l]q[l]?16:15,u.n=q[l++]): -(u.e=m[q[l]-c],u.n=n[q[l++]-c]);r=1<>y;t>=1)f^=t;for(f^=t;(f&(1<>=b;a-=b},G=function(a,n,d){var r,f,g;if(0==d)return 0;for(g=0;;){z(c);f=m.list[H(c)];for(r=f.e;16 -r;r++)p[K[r]]=0;c=7;r=new O(p,19,19,null,null,c);if(0!=r.status)return-1;m=r.root;c=r.m;f=x+s;for(d=e=0;dr)p[d++]=e=r;else if(16==r){z(2);r=3+H(2);D(2);if(d+r>f)return-1;for(;0f)return-1;for(;0B;B++)I[B]=8;for(;256>B;B++)I[B]=9;for(;280>B;B++)I[B]=7;for(;288>B;B++)I[B]=8;p=7;B=new O(I,288,257,C,y,p);if(0!=B.status){alert("HufBuild error: "+B.status);N=-1;break b}f=B.root;p=B.m;for(B=0;30>B;B++)I[B]=5;T=5;B=new O(I,30,0,u,w,T);if(1f&&(l=f);for(G=1<(G-=d[u])){this.status=2;this.m=l;return}if(0>(G-=d[f]))this.status=2,this.m=l;else{d[f]+=G;x[1]=u=0;q=d;n=1;for(h=2;0<--f;)x[h++]=u+=q[n++];q=b;f=n=0;do 0!=(u=q[n++])&&(t[x[u]++]=f);while(++fy+m[1+t];){y+=m[1+t];t++;z=(z=g-y)>l?l:z;if((s=1<<(u=r-y))>b+1)for(s-=b+1,h=r;++ue&&y>y-m[t],C[t-1][u].e=v.e,C[t-1][u].b=v.b,C[t-1][u].n=v.n,C[t-1][u].t=v.t)}v.b=r-y;n>=a?v.e=99:q[n]q[n]?16:15,v.n=q[n++]): +(v.e=k[q[n]-c],v.n=p[q[n++]-c]);s=1<>y;u>=1)f^=u;for(f^=u;(f&(1<>=b;a-=b},G=function(a,p,d){var s,e,t;if(0==d)return 0;for(t=0;;){z(c);e=k.list[H(c)];for(s=e.e;16 +s;s++)q[N[s]]=0;c=7;s=new O(q,19,19,null,null,c);if(0!=s.status)return-1;k=s.root;c=s.m;t=f+r;for(d=e=0;ds)q[d++]=e=s;else if(16==s){z(2);s=3+H(2);D(2);if(d+s>t)return-1;for(;0t)return-1;for(;0B;B++)I[B]=8;for(;256>B;B++)I[B]=9;for(;280>B;B++)I[B]=7;for(;288>B;B++)I[B]=8;q=7;B=new O(I,288,257,C,y,q);if(0!=B.status){alert("HufBuild error: "+B.status);M=-1;break b}f=B.root;q=B.m;for(B=0;30>B;B++)I[B]=5;T=5;B=new O(I,30,0,v,x,T);if(1h))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0l))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; +core.LoopWatchDog=function(h,m){var f=Date.now(),n=0;this.check=function(){var q;if(h&&(q=Date.now(),q-f>h))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0m))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; // Input 8 -core.DomUtils=function(){function h(l,f){if(l.nodeType===Node.TEXT_NODE)if(0===l.length)l.parentNode.removeChild(l);else if(f.nodeType===Node.TEXT_NODE)return f.insertData(0,l.data),l.parentNode.removeChild(l),f;return l}this.splitBoundaries=function(l){var f=[],q;0!==l.endOffset&&(l.endContainer.nodeType===Node.TEXT_NODE&&l.endOffset!==l.endContainer.length)&&(f.push(l.endContainer.splitText(l.endOffset)),f.push(l.endContainer));0!==l.startOffset&&(l.startContainer.nodeType===Node.TEXT_NODE&&l.startOffset!== -l.startContainer.length)&&(q=l.startContainer.splitText(l.startOffset),f.push(l.startContainer),f.push(q),l.setStart(q,0));return f};this.normalizeTextNodes=function(l){l&&l.nextSibling&&(l=h(l,l.nextSibling));l&&l.previousSibling&&h(l.previousSibling,l)};this.rangeContainsNode=function(l,f){var q=f.ownerDocument.createRange(),p=f.nodeType===Node.TEXT_NODE?f.length:f.childNodes.length;q.setStart(l.startContainer,l.startOffset);q.setEnd(l.endContainer,l.endOffset);p=0===q.comparePoint(f,0)&&0===q.comparePoint(f, -p);q.detach();return p};this.mergeIntoParent=function(l){for(var f=l.parentNode;l.firstChild;)f.insertBefore(l.firstChild,l);f.removeChild(l);return f};this.getElementsByTagNameNS=function(l,f,q){return Array.prototype.slice.call(l.getElementsByTagNameNS(f,q))}}; +core.DomUtils=function(){function h(m,f){if(m.nodeType===Node.TEXT_NODE)if(0===m.length)m.parentNode.removeChild(m);else if(f.nodeType===Node.TEXT_NODE)return f.insertData(0,m.data),m.parentNode.removeChild(m),f;return m}this.splitBoundaries=function(m){var f=[],n;0!==m.endOffset&&(m.endContainer.nodeType===Node.TEXT_NODE&&m.endOffset!==m.endContainer.length)&&(f.push(m.endContainer.splitText(m.endOffset)),f.push(m.endContainer));0!==m.startOffset&&(m.startContainer.nodeType===Node.TEXT_NODE&&m.startOffset!== +m.startContainer.length)&&(n=m.startContainer.splitText(m.startOffset),f.push(m.startContainer),f.push(n),m.setStart(n,0));return f};this.normalizeTextNodes=function(m){m&&m.nextSibling&&(m=h(m,m.nextSibling));m&&m.previousSibling&&h(m.previousSibling,m)};this.rangeContainsNode=function(m,f){var n=f.ownerDocument.createRange(),q=f.nodeType===Node.TEXT_NODE?f.length:f.childNodes.length;n.setStart(m.startContainer,m.startOffset);n.setEnd(m.endContainer,m.endOffset);q=0===n.comparePoint(f,0)&&0===n.comparePoint(f, +q);n.detach();return q};this.mergeIntoParent=function(m){for(var f=m.parentNode;m.firstChild;)f.insertBefore(m.firstChild,m);f.removeChild(m);return f};this.getElementsByTagNameNS=function(m,f,n){return Array.prototype.slice.call(m.getElementsByTagNameNS(f,n))}}; // Input 9 runtime.loadClass("core.DomUtils"); -core.Cursor=function(h,l){function f(b){b.parentNode&&(e.push(b.previousSibling),e.push(b.nextSibling),b.parentNode.removeChild(b))}function q(b,a,c){if(a.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(a),"putCursorIntoTextNode: invalid container");var d=a.parentNode;runtime.assert(Boolean(d),"putCursorIntoTextNode: container without parent");runtime.assert(0<=c&&c<=a.length,"putCursorIntoTextNode: offset is out of bounds");0===c?d.insertBefore(b,a):(c!==a.length&&a.splitText(c),d.insertBefore(b, -a.nextSibling))}else if(a.nodeType===Node.ELEMENT_NODE){runtime.assert(Boolean(a),"putCursorIntoContainer: invalid container");for(d=a.firstChild;null!==d&&01/k?"-0":String(k),h(b+" should be "+a+". Was "+e+".")):h(b+" should be "+a+" (of type "+typeof a+"). Was "+k+" (of type "+typeof k+").")}var a=0,e;e=function(a,b){var e=Object.keys(a),m=Object.keys(b);e.sort();m.sort();return l(e,m)&&Object.keys(a).every(function(m){var c= -a[m],e=b[m];return p(c,e)?!0:(h(c+" should be "+e+" for key "+m),!1)})};this.areNodesEqual=q;this.shouldBeNull=function(a,b){g(a,b,"null")};this.shouldBeNonNull=function(a,b){var e,m;try{m=eval(b)}catch(k){e=k}e?h(b+" should be non-null. Threw exception "+e):null!==m?runtime.log("pass",b+" is non-null."):h(b+" should be non-null. Was "+m)};this.shouldBe=g;this.countFailedTests=function(){return a}}; -core.UnitTester=function(){function h(f,p){return""+f+""}var l=0,f={};this.runTests=function(q,p,g){function a(c){if(0===c.length)f[e]=s,l+=d.countFailedTests(),p();else{k=c[0];var n=Runtime.getFunctionName(k);runtime.log("Running "+n);t=d.countFailedTests();b.setUp();k(function(){b.tearDown();s[n]=t===d.countFailedTests();a(c.slice(1))})}}var e=Runtime.getFunctionName(q),d=new core.UnitTestRunner,b=new q(d),s={},m,k,c,t,r="BrowserRuntime"=== -runtime.type();if(f.hasOwnProperty(e))runtime.log("Test "+e+" has already run.");else{r?runtime.log("Running "+h(e,'runSuite("'+e+'");')+": "+b.description()+""):runtime.log("Running "+e+": "+b.description);c=b.tests();for(m=0;mRunning "+h(q,'runTest("'+e+'","'+q+'")')+""):runtime.log("Running "+q),t=d.countFailedTests(),b.setUp(),k(),b.tearDown(),s[q]=t===d.countFailedTests()); -a(b.asyncTests())}};this.countFailedTests=function(){return l};this.results=function(){return f}}; +core.UnitTest.provideTestAreaDiv=function(){var h=runtime.getWindow().document,m=h.getElementById("testarea");runtime.assert(!m,'Unclean test environment, found a div with id "testarea".');m=h.createElement("div");m.setAttribute("id","testarea");h.body.appendChild(m);return m}; +core.UnitTest.cleanupTestAreaDiv=function(){var h=runtime.getWindow().document,m=h.getElementById("testarea");runtime.assert(!!m&&m.parentNode===h.body,'Test environment broken, found no div with id "testarea" below body.');h.body.removeChild(m)}; +core.UnitTestRunner=function(){function h(d){a+=1;runtime.log("fail",d)}function m(a,b){var e;try{if(a.length!==b.length)return h("array of length "+a.length+" should be "+b.length+" long"),!1;for(e=0;e1/l?"-0":String(l),h(b+" should be "+a+". Was "+e+".")):h(b+" should be "+a+" (of type "+typeof a+"). Was "+l+" (of type "+typeof l+").")}var a=0,g;g=function(a,b){var e=Object.keys(a),k=Object.keys(b);e.sort();k.sort();return m(e,k)&&Object.keys(a).every(function(k){var c= +a[k],e=b[k];return q(c,e)?!0:(h(c+" should be "+e+" for key "+k),!1)})};this.areNodesEqual=n;this.shouldBeNull=function(a,b){e(a,b,"null")};this.shouldBeNonNull=function(a,b){var e,k;try{k=eval(b)}catch(l){e=l}e?h(b+" should be non-null. Threw exception "+e):null!==k?runtime.log("pass",b+" is non-null."):h(b+" should be non-null. Was "+k)};this.shouldBe=e;this.countFailedTests=function(){return a}}; +core.UnitTester=function(){function h(f,q){return""+f+""}var m=0,f={};this.runTests=function(n,q,e){function a(c){if(0===c.length)f[g]=r,m+=d.countFailedTests(),q();else{l=c[0];var p=Runtime.getFunctionName(l);runtime.log("Running "+p);u=d.countFailedTests();b.setUp();l(function(){b.tearDown();r[p]=u===d.countFailedTests();a(c.slice(1))})}}var g=Runtime.getFunctionName(n),d=new core.UnitTestRunner,b=new n(d),r={},k,l,c,u,t="BrowserRuntime"=== +runtime.type();if(f.hasOwnProperty(g))runtime.log("Test "+g+" has already run.");else{t?runtime.log("Running "+h(g,'runSuite("'+g+'");')+": "+b.description()+""):runtime.log("Running "+g+": "+b.description);c=b.tests();for(k=0;kRunning "+h(n,'runTest("'+g+'","'+n+'")')+""):runtime.log("Running "+n),u=d.countFailedTests(),b.setUp(),l(),b.tearDown(),r[n]=u===d.countFailedTests()); +a(b.asyncTests())}};this.countFailedTests=function(){return m};this.results=function(){return f}}; // Input 12 -core.PositionIterator=function(h,l,f,q){function p(){this.acceptNode=function(b){return b.nodeType===Node.TEXT_NODE&&0===b.length?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function g(b){this.acceptNode=function(a){return a.nodeType===Node.TEXT_NODE&&0===a.length?NodeFilter.FILTER_REJECT:b.acceptNode(a)}}function a(){var a=d.currentNode.nodeType;b=a===Node.TEXT_NODE?d.currentNode.length-1:a===Node.ELEMENT_NODE?1:0}var e=this,d,b,s;this.nextPosition=function(){if(d.currentNode===h)return!1; -if(0===b&&d.currentNode.nodeType===Node.ELEMENT_NODE)null===d.firstChild()&&(b=1);else if(d.currentNode.nodeType===Node.TEXT_NODE&&b+1 "+a.length),runtime.assert(0<=k,"Error in setPosition: "+k+" < 0"),k===a.length&&(b=void 0,d.nextSibling()?b=0:d.parentNode()&&(b=1),runtime.assert(void 0!==b,"Error in setPosition: position not valid.")),!0;c=s(a);k "+a.length),runtime.assert(0<=l,"Error in setPosition: "+l+" < 0"),l===a.length&&(b=void 0,d.nextSibling()?b=0:d.parentNode()&&(b=1),runtime.assert(void 0!==b,"Error in setPosition: position not valid.")),!0;c=r(a);l>>8^k;return c^-1}function q(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 p(a){var b=a.getFullYear();return 1980>b?0:b-1980<< -25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function g(a,b){var c,n,k,r,d,m,e,f=this;this.load=function(b){if(void 0!==f.data)b(null,f.data);else{var c=d+34+n+k+256;c+e>t&&(c=t-e);runtime.read(a,e,c,function(c,n){if(c||null===n)b(c,n);else a:{var k=n,e=new core.ByteArray(k),g=e.readUInt32LE(),t;if(67324752!==g)b("File entry signature is wrong."+g.toString()+" "+k.length.toString(),null);else{e.pos+=22;g=e.readUInt16LE();t=e.readUInt16LE();e.pos+=g+t; -if(r){k=k.slice(e.pos,e.pos+d);if(d!==k.length){b("The amount of compressed bytes read was "+k.length.toString()+" instead of "+d.toString()+" for "+f.filename+" in "+a+".",null);break a}k=x(k,m)}else k=k.slice(e.pos,e.pos+m);m!==k.length?b("The amount of bytes read was "+k.length.toString()+" instead of "+m.toString()+" for "+f.filename+" in "+a+".",null):(f.data=k,b(null,k))}}})}};this.set=function(a,b,c,n){f.filename=a;f.data=b;f.compressed=c;f.date=n};this.error=null;b&&(c=b.readUInt32LE(),33639248!== -c?this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,r=b.readUInt16LE(),this.date=q(b.readUInt32LE()),b.readUInt32LE(),d=b.readUInt32LE(),m=b.readUInt32LE(),n=b.readUInt16LE(),k=b.readUInt16LE(),c=b.readUInt16LE(),b.pos+=8,e=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+n),"utf8"),b.pos+=n+k+c))}function a(a,b){if(22!==a.length)b("Central directory length should be 22.", -n);else{var k=new core.ByteArray(a),d;d=k.readUInt32LE();101010256!==d?b("Central directory signature is wrong: "+d.toString(),n):(d=k.readUInt16LE(),0!==d?b("Zip files with non-zero disk numbers are not supported.",n):(d=k.readUInt16LE(),0!==d?b("Zip files with non-zero disk numbers are not supported.",n):(d=k.readUInt16LE(),r=k.readUInt16LE(),d!==r?b("Number of entries is inconsistent.",n):(d=k.readUInt32LE(),k=k.readUInt16LE(),k=t-22-d,runtime.read(h,k,t-k,function(a,k){if(a||null===k)b(a,n);else a:{var d= -new core.ByteArray(k),m,e;c=[];for(m=0;mt?l("File '"+h+"' cannot be read.",n):runtime.read(h,t-22,22,function(b,c){b||null===l||null===c?l(b,n):a(c,l)})})}; +2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],c,p,l=a.length,d=0,d=0;c=-1;for(p=0;p>>8^d;return c^-1}function n(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 q(a){var b=a.getFullYear();return 1980>b?0:b-1980<< +25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function e(a,b){var c,p,d,l,k,e,g,t=this;this.load=function(b){if(void 0!==t.data)b(null,t.data);else{var c=k+34+p+d+256;c+g>u&&(c=u-g);runtime.read(a,g,c,function(c,p){if(c||null===p)b(c,p);else a:{var d=p,g=new core.ByteArray(d),f=g.readUInt32LE(),u;if(67324752!==f)b("File entry signature is wrong."+f.toString()+" "+d.length.toString(),null);else{g.pos+=22;f=g.readUInt16LE();u=g.readUInt16LE();g.pos+=f+u; +if(l){d=d.slice(g.pos,g.pos+k);if(k!==d.length){b("The amount of compressed bytes read was "+d.length.toString()+" instead of "+k.toString()+" for "+t.filename+" in "+a+".",null);break a}d=s(d,e)}else d=d.slice(g.pos,g.pos+e);e!==d.length?b("The amount of bytes read was "+d.length.toString()+" instead of "+e.toString()+" for "+t.filename+" in "+a+".",null):(t.data=d,b(null,d))}}})}};this.set=function(a,b,c,p){t.filename=a;t.data=b;t.compressed=c;t.date=p};this.error=null;b&&(c=b.readUInt32LE(),33639248!== +c?this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,l=b.readUInt16LE(),this.date=n(b.readUInt32LE()),b.readUInt32LE(),k=b.readUInt32LE(),e=b.readUInt32LE(),p=b.readUInt16LE(),d=b.readUInt16LE(),c=b.readUInt16LE(),b.pos+=8,g=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+p),"utf8"),b.pos+=p+d+c))}function a(a,b){if(22!==a.length)b("Central directory length should be 22.", +p);else{var d=new core.ByteArray(a),l;l=d.readUInt32LE();101010256!==l?b("Central directory signature is wrong: "+l.toString(),p):(l=d.readUInt16LE(),0!==l?b("Zip files with non-zero disk numbers are not supported.",p):(l=d.readUInt16LE(),0!==l?b("Zip files with non-zero disk numbers are not supported.",p):(l=d.readUInt16LE(),t=d.readUInt16LE(),l!==t?b("Number of entries is inconsistent.",p):(l=d.readUInt32LE(),d=d.readUInt16LE(),d=u-22-l,runtime.read(h,d,u-d,function(a,d){if(a||null===d)b(a,p);else a:{var l= +new core.ByteArray(d),k,s;c=[];for(k=0;ku?m("File '"+h+"' cannot be read.",p):runtime.read(h,u-22,22,function(b,c){b||null===m||null===c?m(b,p):a(c,m)})})}; // Input 16 -core.CSSUnits=function(){var h={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(l,f,q){return l*h[q]/h[f]};this.convertMeasure=function(l,f){var q,p;l&&f?(q=parseFloat(l),p=l.replace(q.toString(),""),q=this.convert(q,p,f)):q="";return q.toString()};this.getUnits=function(l){return l.substr(l.length-2,l.length)}}; +core.CSSUnits=function(){var h={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(m,f,n){return m*h[n]/h[f]};this.convertMeasure=function(m,f){var n,q;m&&f?(n=parseFloat(m),q=m.replace(n.toString(),""),n=this.convert(n,q,f)):n="";return n.toString()};this.getUnits=function(m){return m.substr(m.length-2,m.length)}}; // Input 17 xmldom.LSSerializerFilter=function(){}; // Input 18 -"function"!==typeof Object.create&&(Object.create=function(h){var l=function(){};l.prototype=h;return new l}); -xmldom.LSSerializer=function(){function h(f){var g=f||{},a=function(a){var b={},k;for(k in a)a.hasOwnProperty(k)&&(b[a[k]]=k);return b}(f),e=[g],d=[a],b=0;this.push=function(){b+=1;g=e[b]=Object.create(g);a=d[b]=Object.create(a)};this.pop=function(){e[b]=void 0;d[b]=void 0;b-=1;g=e[b];a=d[b]};this.getLocalNamespaceDefinitions=function(){return a};this.getQName=function(b){var d=b.namespaceURI,k=0,c;if(!d)return b.localName;if(c=a[d])return c+":"+b.localName;do{c||!b.prefix?(c="ns"+k,k+=1):c=b.prefix; -if(g[c]===d)break;if(!g[c]){g[c]=d;a[d]=c;break}c=null}while(null===c);return c+":"+b.localName}}function l(f){return f.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function f(p,g){var a="",e=q.filter?q.filter.acceptNode(g):NodeFilter.FILTER_ACCEPT,d;if(e===NodeFilter.FILTER_ACCEPT&&g.nodeType===Node.ELEMENT_NODE){p.push();d=p.getQName(g);var b,s=g.attributes,m,k,c,t="",r;b="<"+d;m=s.length;for(k=0;k")}if(e===NodeFilter.FILTER_ACCEPT||e===NodeFilter.FILTER_SKIP){for(e=g.firstChild;e;)a+=f(p,e),e=e.nextSibling;g.nodeValue&&(a+=l(g.nodeValue))}d&&(a+="",p.pop());return a}var q=this;this.filter=null;this.writeToString=function(p,g){if(!p)return"";var a=new h(g);return f(a,p)}}; +"function"!==typeof Object.create&&(Object.create=function(h){var m=function(){};m.prototype=h;return new m}); +xmldom.LSSerializer=function(){function h(f){var e=f||{},a=function(a){var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[a[d]]=d);return b}(f),g=[e],d=[a],b=0;this.push=function(){b+=1;e=g[b]=Object.create(e);a=d[b]=Object.create(a)};this.pop=function(){g[b]=void 0;d[b]=void 0;b-=1;e=g[b];a=d[b]};this.getLocalNamespaceDefinitions=function(){return a};this.getQName=function(b){var d=b.namespaceURI,l=0,c;if(!d)return b.localName;if(c=a[d])return c+":"+b.localName;do{c||!b.prefix?(c="ns"+l,l+=1):c=b.prefix; +if(e[c]===d)break;if(!e[c]){e[c]=d;a[d]=c;break}c=null}while(null===c);return c+":"+b.localName}}function m(f){return f.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function f(q,e){var a="",g=n.filter?n.filter.acceptNode(e):NodeFilter.FILTER_ACCEPT,d;if(g===NodeFilter.FILTER_ACCEPT&&e.nodeType===Node.ELEMENT_NODE){q.push();d=q.getQName(e);var b,r=e.attributes,k,l,c,u="",t;b="<"+d;k=r.length;for(l=0;l")}if(g===NodeFilter.FILTER_ACCEPT||g===NodeFilter.FILTER_SKIP){for(g=e.firstChild;g;)a+=f(q,g),g=g.nextSibling;e.nodeValue&&(a+=m(e.nodeValue))}d&&(a+="",q.pop());return a}var n=this;this.filter=null;this.writeToString=function(q,e){if(!q)return"";var a=new h(e);return f(a,q)}}; // Input 19 -xmldom.RelaxNGParser=function(){function h(a,d){this.message=function(){d&&(a+=1===d.nodeType?" Element ":" Node ",a+=d.nodeName,d.nodeValue&&(a+=" with value '"+d.nodeValue+"'"),a+=".");return a}}function l(a){if(2>=a.e.length)return a;var d={name:a.name,e:a.e.slice(0,2)};return l({name:a.name,e:[d].concat(a.e.slice(2))})}function f(a){a=a.split(":",2);var d="",m;1===a.length?a=["",a[0]]:d=a[0];for(m in e)e[m]===d&&(a[0]=m);return a}function q(a,d){for(var e=0,k,c,g=a.name;a.e&&e=a.e.length)return a;var d={name:a.name,e:a.e.slice(0,2)};return m({name:a.name,e:[d].concat(a.e.slice(2))})}function f(a){a=a.split(":",2);var d="",k;1===a.length?a=["",a[0]]:d=a[0];for(k in g)g[k]===d&&(a[0]=k);return a}function n(a,d){for(var k=0,l,c,e=a.name;a.e&&k=n.length)return c;0===k&&(k=0);for(var d=n.item(k);d.namespaceURI===b;){k+=1;if(k>=n.length)return c;d=n.item(k)}return d=e(a,c.attDeriv(a,n.item(k)),n,k+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 b="http://www.w3.org/2000/xmlns/",s,m,k,c,t,r,x,n,C,y,u={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return u},startTagOpenDeriv:function(){return u},attDeriv:function(){return u},startTagCloseDeriv:function(){return u},endTagDeriv:function(){return u}},w={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return u},startTagOpenDeriv:function(){return u},attDeriv:function(a,b){return u},startTagCloseDeriv:function(){return w},endTagDeriv:function(){return u}}, -K={type:"text",nullable:!0,hash:"text",textDeriv:function(){return K},startTagOpenDeriv:function(){return u},attDeriv:function(){return u},startTagCloseDeriv:function(){return K},endTagDeriv:function(){return u}},A,F,O;s=q("choice",function(a,b){if(a===u)return b;if(b===u||a===b)return a},function(a,b){var c={},n;p(c,{p1:a,p2:b});b=a=void 0;for(n in c)c.hasOwnProperty(n)&&(void 0===a?a=c[n]:b=void 0===b?c[n]:s(b,c[n]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, -textDeriv:function(c,n){return s(a.textDeriv(c,n),b.textDeriv(c,n))},startTagOpenDeriv:f(function(c){return s(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,n){return s(a.attDeriv(c,n),b.attDeriv(c,n))},startTagCloseDeriv:h(function(){return s(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:h(function(){return s(a.endTagDeriv(),b.endTagDeriv())})}}(a,b)});m=function(a,b,c){return function(){var n={},k=0;return function(d,r){var e=b&&b(d,r),m,f;if(void 0!==e)return e; -e=d.hash||d.toString();m=r.hash||r.toString();e=p.length)return c;0===d&&(d=0);for(var l=p.item(d);l.namespaceURI===b;){d+=1;if(d>=p.length)return c;l=p.item(d)}return l=g(a,c.attDeriv(a,p.item(d)),p,d+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 b="http://www.w3.org/2000/xmlns/",r,k,l,c,u,t,s,p,C,y,v={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return v}},x={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(a,b){return v},startTagCloseDeriv:function(){return x},endTagDeriv:function(){return v}}, +N={type:"text",nullable:!0,hash:"text",textDeriv:function(){return N},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return N},endTagDeriv:function(){return v}},A,F,O;r=n("choice",function(a,b){if(a===v)return b;if(b===v||a===b)return a},function(a,b){var c={},p;q(c,{p1:a,p2:b});b=a=void 0;for(p in c)c.hasOwnProperty(p)&&(void 0===a?a=c[p]:b=void 0===b?c[p]:r(b,c[p]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, +textDeriv:function(c,p){return r(a.textDeriv(c,p),b.textDeriv(c,p))},startTagOpenDeriv:f(function(c){return r(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,p){return r(a.attDeriv(c,p),b.attDeriv(c,p))},startTagCloseDeriv:h(function(){return r(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:h(function(){return r(a.endTagDeriv(),b.endTagDeriv())})}}(a,b)});k=function(a,b,c){return function(){var p={},d=0;return function(l,k){var e=b&&b(l,k),s,g;if(void 0!==e)return e; +e=l.hash||l.toString();s=k.hash||k.toString();eNode.ELEMENT_NODE;){if(b!==Node.COMMENT_NODE&&(b!==Node.TEXT_NODE||!/^\s+$/.test(e.currentNode.nodeValue)))return[new h("Not allowed node of type "+ -b+".")];b=(d=e.nextSibling())?d.nodeType:0}if(!d)return[new h("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(g[d.namespaceURI]+":"+d.localName))return[new h("Found "+d.nodeName+" instead of "+a.names+".",d)];if(e.firstChild()){for(f=l(a.e[1],e,d);e.nextSibling();)if(b=e.currentNode.nodeType,!(e.currentNode&&e.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(e.currentNode.nodeValue)||b===Node.COMMENT_NODE))return[new h("Spurious content.",e.currentNode)];if(e.parentNode()!==d)return[new h("Implementation error.")]}else f= -l(a.e[1],e,d);e.nextSibling();return f}var q,p,g;p=function(a,e,d,b){var g=a.name,m=null;if("text"===g)a:{for(var k=(a=e.currentNode)?a.nodeType:0;a!==d&&3!==k;){if(1===k){m=[new h("Element not allowed here.",a)];break a}k=(a=e.nextSibling())?a.nodeType:0}e.nextSibling();m=null}else if("data"===g)m=null;else if("value"===g)b!==a.text&&(m=[new h("Wrong value, should be '"+a.text+"', not '"+b+"'",d)]);else if("list"===g)m=null;else if("attribute"===g)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+ -a.e.length;g=a.localnames.length;for(m=0;mNode.ELEMENT_NODE;){if(b!==Node.COMMENT_NODE&&(b!==Node.TEXT_NODE||!/^\s+$/.test(g.currentNode.nodeValue)))return[new h("Not allowed node of type "+ +b+".")];b=(d=g.nextSibling())?d.nodeType:0}if(!d)return[new h("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(e[d.namespaceURI]+":"+d.localName))return[new h("Found "+d.nodeName+" instead of "+a.names+".",d)];if(g.firstChild()){for(f=m(a.e[1],g,d);g.nextSibling();)if(b=g.currentNode.nodeType,!(g.currentNode&&g.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(g.currentNode.nodeValue)||b===Node.COMMENT_NODE))return[new h("Spurious content.",g.currentNode)];if(g.parentNode()!==d)return[new h("Implementation error.")]}else f= +m(a.e[1],g,d);g.nextSibling();return f}var n,q,e;q=function(a,e,d,b){var n=a.name,k=null;if("text"===n)a:{for(var l=(a=e.currentNode)?a.nodeType:0;a!==d&&3!==l;){if(1===l){k=[new h("Element not allowed here.",a)];break a}l=(a=e.nextSibling())?a.nodeType:0}e.nextSibling();k=null}else if("data"===n)k=null;else if("value"===n)b!==a.text&&(k=[new h("Wrong value, should be '"+a.text+"', not '"+b+"'",d)]);else if("list"===n)k=null;else if("attribute"===n)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+ +a.e.length;n=a.localnames.length;for(k=0;k=f&&c.push(l(a.substring(b,d)))):"["===a[d]&&(0>=f&&(b=d+1),f+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};b=function(b,d,c){var f,r,g,n;for(f=0;f=s&&c.push(m(a.substring(b,d)))):"["===a[d]&&(0>=s&&(b=d+1),s+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};b=function(b,d,c){var e,f,s,p;for(e=0;e=b.value||"%"===b.unit)?null:b;return b||c(a)};this.parseFoLineHeight=function(a){var b;b=(b=k(a))&&(0>b.value||"%"=== -b.unit)?null:b;return b||c(a)};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument,d=c.createRange(),e=[],k;k=c.createTreeWalker(a.commonAncestorContainer.nodeType===Node.TEXT_NODE?a.commonAncestorContainer.parentNode:a.commonAncestorContainer,NodeFilter.SHOW_ALL,function(c){d.selectNodeContents(c);if(!1===b&&c.nodeType===Node.TEXT_NODE){if(0>=a.compareBoundaryPoints(a.START_TO_START,d)&&0<=a.compareBoundaryPoints(a.END_TO_END,d))return NodeFilter.FILTER_ACCEPT}else if(-1===a.compareBoundaryPoints(a.END_TO_START, -d)&&1===a.compareBoundaryPoints(a.START_TO_END,d))return c.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT},!1);k.currentNode=a.startContainer.previousSibling||a.startContainer.parentNode;for(c=k.nextNode();c;)e.push(c),c=k.nextNode();d.detach();return e}}; +odf.OdfUtils=function(){function h(a){var b=a&&a.localName;return("p"===b||"h"===b)&&a.namespaceURI===u}function m(a){return/^[ \t\r\n]+$/.test(a)}function f(a){var b=a&&a.localName;return("span"===b||"p"===b||"h"===b)&&a.namespaceURI===u}function n(a){var b=a&&a.localName,c,d=!1;b&&(c=a.namespaceURI,c===u?d="s"===b||"tab"===b||"line-break"===b:c===t&&(d="frame"===b&&"as-char"===a.getAttributeNS(u,"anchor-type")));return d}function q(a){for(;null!==a.firstChild&&f(a);)a=a.firstChild;return a}function e(a){for(;null!== +a.lastChild&&f(a);)a=a.lastChild;return a}function a(a){for(;!h(a)&&null===a.previousSibling;)a=a.parentNode;return h(a)?null:e(a.previousSibling)}function g(a){for(;!h(a)&&null===a.nextSibling;)a=a.parentNode;return h(a)?null:q(a.nextSibling)}function d(b){for(var c=!1;b;)if(b.nodeType===Node.TEXT_NODE)if(0===b.length)b=a(b);else return!m(b.data.substr(b.length-1,1));else if(n(b)){c=!0;break}else b=a(b);return c}function b(b){var c=!1;for(b=b&&e(b);b;){if(b.nodeType===Node.TEXT_NODE&&0=b.value||"%"===b.unit)?null:b;return b||c(a)};this.parseFoLineHeight=function(a){var b;b=(b=l(a))&&(0>b.value||"%"=== +b.unit)?null:b;return b||c(a)};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument,d=c.createRange(),e=[],l;l=c.createTreeWalker(a.commonAncestorContainer.nodeType===Node.TEXT_NODE?a.commonAncestorContainer.parentNode:a.commonAncestorContainer,NodeFilter.SHOW_ALL,function(c){d.selectNodeContents(c);if(!1===b&&c.nodeType===Node.TEXT_NODE){if(0>=a.compareBoundaryPoints(a.START_TO_START,d)&&0<=a.compareBoundaryPoints(a.END_TO_END,d))return NodeFilter.FILTER_ACCEPT}else if(-1===a.compareBoundaryPoints(a.END_TO_START, +d)&&1===a.compareBoundaryPoints(a.START_TO_END,d))return c.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT},!1);l.currentNode=a.startContainer.previousSibling||a.startContainer.parentNode;for(c=l.nextNode();c;)e.push(c),c=l.nextNode();d.detach();return e}}; // Input 28 /* @@ -479,11 +479,11 @@ d)&&1===a.compareBoundaryPoints(a.START_TO_END,d))return c.nodeType===Node.TEXT_ @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils"); -odf.TextStyleApplicator=function(h,l,f){function q(a){function b(a,d){return"object"===typeof a&&"object"===typeof d?Object.keys(a).every(function(e){return b(a[e],d[e])}):a===d}this.isStyleApplied=function(c){c=l.getAppliedStylesForElement(c);return b(a,c)}}function p(a){var e={};this.applyStyleToContainer=function(c){var g;g=c.getAttributeNS(d,"style-name");var r=c.ownerDocument;g=g||"";if(!e.hasOwnProperty(g)){var p=g,n=g,q;n?(q=l.getStyleElement(n,"text"),q.parentNode===f?r=q.cloneNode(!0):(r= -r.createElementNS(b,"style:style"),r.setAttributeNS(b,"style:parent-style-name",n),r.setAttributeNS(b,"style:family","text"),r.setAttributeNS(s,"scope","document-content"))):(r=r.createElementNS(b,"style:style"),r.setAttributeNS(b,"style:family","text"),r.setAttributeNS(s,"scope","document-content"));l.updateStyle(r,a,h);f.appendChild(r);e[p]=r}g=e[g].getAttributeNS(b,"name");c.setAttributeNS(d,"text:style-name",g)}}var g,a=new odf.OdfUtils,e=new core.DomUtils,d=odf.Namespaces.textns,b=odf.Namespaces.stylens, -s="urn:webodf:names:scope";this.applyStyle=function(b,k){var c,f,r,l,n;c={};var h;runtime.assert(k&&k["style:text-properties"],"applyStyle without any text properties");c["style:text-properties"]=k["style:text-properties"];l=new p(c);n=new q(c);g=e.splitBoundaries(b);c=a.getTextNodes(b,!1);h={startContainer:b.startContainer,startOffset:b.startOffset,endContainer:b.endContainer,endOffset:b.endOffset};c.forEach(function(b){f=n.isStyleApplied(b);if(!1===f){var c=b.ownerDocument,k=b.parentNode,g,m=b, -p=new core.LoopWatchDog(1E3);a.isParagraph(k)?(c=c.createElementNS(d,"text:span"),k.insertBefore(c,b),g=!1):(b.previousSibling&&!e.rangeContainsNode(h,b.previousSibling)?(c=k.cloneNode(!1),k.parentNode.insertBefore(c,k.nextSibling)):c=k,g=!0);for(;m&&(m===b||e.rangeContainsNode(h,m));)p.check(),k=m.nextSibling,m.parentNode!==c&&c.appendChild(m),m=k;if(m&&g)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);m;)p.check(),k=m.nextSibling,b.appendChild(m),m=k;r=c;l.applyStyleToContainer(r)}}); -g.forEach(e.normalizeTextNodes);g=null}}; +odf.TextStyleApplicator=function(h,m,f){function n(a){function b(a,d){return"object"===typeof a&&"object"===typeof d?Object.keys(a).every(function(e){return b(a[e],d[e])}):a===d}this.isStyleApplied=function(c){c=m.getAppliedStylesForElement(c);return b(a,c)}}function q(a){var e={};this.applyStyleToContainer=function(c){var g;g=c.getAttributeNS(d,"style-name");var n=c.ownerDocument;g=g||"";if(!e.hasOwnProperty(g)){var s=g,p=g,q;p?(q=m.getStyleElement(p,"text"),q.parentNode===f?n=q.cloneNode(!0):(n= +n.createElementNS(b,"style:style"),n.setAttributeNS(b,"style:parent-style-name",p),n.setAttributeNS(b,"style:family","text"),n.setAttributeNS(r,"scope","document-content"))):(n=n.createElementNS(b,"style:style"),n.setAttributeNS(b,"style:family","text"),n.setAttributeNS(r,"scope","document-content"));m.updateStyle(n,a,h);f.appendChild(n);e[s]=n}g=e[g].getAttributeNS(b,"name");c.setAttributeNS(d,"text:style-name",g)}}var e,a=new odf.OdfUtils,g=new core.DomUtils,d=odf.Namespaces.textns,b=odf.Namespaces.stylens, +r="urn:webodf:names:scope";this.applyStyle=function(b,l){var c,f,m,s,p;c={};var h;runtime.assert(l&&l["style:text-properties"],"applyStyle without any text properties");c["style:text-properties"]=l["style:text-properties"];s=new q(c);p=new n(c);e=g.splitBoundaries(b);c=a.getTextNodes(b,!1);h={startContainer:b.startContainer,startOffset:b.startOffset,endContainer:b.endContainer,endOffset:b.endOffset};c.forEach(function(b){f=p.isStyleApplied(b);if(!1===f){var c=b.ownerDocument,e=b.parentNode,l,k=b, +n=new core.LoopWatchDog(1E3);a.isParagraph(e)?(c=c.createElementNS(d,"text:span"),e.insertBefore(c,b),l=!1):(b.previousSibling&&!g.rangeContainsNode(h,b.previousSibling)?(c=e.cloneNode(!1),e.parentNode.insertBefore(c,e.nextSibling)):c=e,l=!0);for(;k&&(k===b||g.rangeContainsNode(h,k));)n.check(),e=k.nextSibling,k.parentNode!==c&&c.appendChild(k),k=e;if(k&&l)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);k;)n.check(),e=k.nextSibling,b.appendChild(k),k=e;m=c;s.applyStyleToContainer(m)}}); +e.forEach(g.normalizeTextNodes);e=null}}; // Input 29 /* @@ -520,47 +520,47 @@ g.forEach(e.normalizeTextNodes);g=null}}; @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils");runtime.loadClass("xmldom.XPath");runtime.loadClass("core.CSSUnits"); -odf.Style2CSS=function(){function h(a){var b={},c,d;if(!a)return b;for(a=a.firstChild;a;){if(d=a.namespaceURI!==t||"style"!==a.localName&&"default-style"!==a.localName?a.namespaceURI===x&&"list-style"===a.localName?"list":a.namespaceURI!==t||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(t,"family"))(c=a.getAttributeNS&&a.getAttributeNS(t,"name"))||(c=""),d=b[d]=b[d]||{},d[c]=a;a=a.nextSibling}return b}function l(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=l(a[c].derivedStyles,b)))return d;return null}function f(a,b,c){var d=b[a],e,k;d&&(e=d.getAttributeNS(t,"parent-style-name"),k=null,e&&(k=l(c,e),!k&&b[e]&&(f(e,b,c),k=b[e],b[e]=null)),k?(k.derivedStyles||(k.derivedStyles={}),k.derivedStyles[a]=d):c[a]=d)}function q(a,b){for(var c in a)a.hasOwnProperty(c)&&(f(c,a,b),a[c]=null)}function p(a,b){var c=y[a],d;if(null===c)return null;d=b?"["+c+'|style-name="'+b+'"]':"["+c+"|style-name]";"presentation"===c&& -(c="draw",d=b?'[presentation|style-name="'+b+'"]':"[presentation|style-name]");return c+"|"+u[a].join(d+","+c+"|")+d}function g(a,b,c){var d=[],e,k;d.push(p(a,b));for(e in c.derivedStyles)if(c.derivedStyles.hasOwnProperty(e))for(k in b=g(a,e,c.derivedStyles[e]),b)b.hasOwnProperty(k)&&d.push(b[k]);return d}function a(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 e(a,b){var c="",d,e;for(d in b)b.hasOwnProperty(d)&& -(d=b[d],e=a.getAttributeNS(d[0],d[1]),d[2]&&e&&(c+=d[2]+":"+e+";"));return c}function d(b){return(b=a(b,t,"text-properties"))?V.parseFoFontSize(b.getAttributeNS(c,"font-size")):null}function b(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d});return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function s(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var e=c.getAttributeNS(x,"level"), -k;c=V.getFirstNonWhitespaceChild(c);c=V.getFirstNonWhitespaceChild(c);var n;c&&(k=c.attributes,n=k["fo:text-indent"]?k["fo:text-indent"].value:void 0,k=k["fo:margin-left"]?k["fo:margin-left"].value:void 0);n||(n="-0.6cm");c="-"===n.charAt(0)?n.substring(1):"-"+n;for(e=e&&parseInt(e,10);1 text|list-item > text|list",e-=1;e=b+" > text|list-item > *:not(text|list):first-child";void 0!==k&&(k=e+"{margin-left:"+k+";}",a.insertRule(k,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+ -d+";";d+="counter-increment:list;";d+="margin-left:"+n+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(f){throw f;}}function m(f,r,p,l){if("list"===r)for(var q=l.firstChild,h,u;q;){if(q.namespaceURI===x)if(h=q,"list-level-style-number"===q.localName){var E=h;u=E.getAttributeNS(t,"num-format");var y=E.getAttributeNS(t,"num-suffix"),v={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},E=E.getAttributeNS(t,"num-prefix")||"",E=v.hasOwnProperty(u)? -E+(" counter(list, "+v[u]+")"):u?E+("'"+u+"';"):E+" ''";y&&(E+=" '"+y+"'");u="content: "+E+";";s(f,p,h,u)}else"list-level-style-image"===q.localName?(u="content: none;",s(f,p,h,u)):"list-level-style-bullet"===q.localName&&(u="content: '"+h.getAttributeNS(x,"bullet-char")+"';",s(f,p,h,u));q=q.nextSibling}else if("page"===r)if(y=h=p="",q=l.getElementsByTagNameNS(t,"page-layout-properties")[0],h=q.parentNode.parentNode.parentNode.masterStyles,y="",p+=e(q,G),u=q.getElementsByTagNameNS(t,"background-image"), -0 text|list-item > text|list",e-=1;e=b+" > text|list-item > *:not(text|list):first-child";void 0!==p&&(p=e+"{margin-left:"+p+";}",a.insertRule(p,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+ +d+";";d+="counter-increment:list;";d+="margin-left:"+l+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(g){throw g;}}function k(f,n,q,m){if("list"===n)for(var t=m.firstChild,h,v;t;){if(t.namespaceURI===s)if(h=t,"list-level-style-number"===t.localName){var E=h;v=E.getAttributeNS(u,"num-format");var y=E.getAttributeNS(u,"num-suffix"),w={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},E=E.getAttributeNS(u,"num-prefix")||"",E=w.hasOwnProperty(v)? +E+(" counter(list, "+w[v]+")"):v?E+("'"+v+"';"):E+" ''";y&&(E+=" '"+y+"'");v="content: "+E+";";r(f,q,h,v)}else"list-level-style-image"===t.localName?(v="content: none;",r(f,q,h,v)):"list-level-style-bullet"===t.localName&&(v="content: '"+h.getAttributeNS(s,"bullet-char")+"';",r(f,q,h,v));t=t.nextSibling}else if("page"===n)if(y=h=q="",t=m.getElementsByTagNameNS(u,"page-layout-properties")[0],h=t.parentNode.parentNode.parentNode.masterStyles,y="",q+=g(t,G),v=t.getElementsByTagNameNS(u,"background-image"), +0c)break;e=e.nextSibling}a.insertBefore(b,e)}}}function p(a){this.OdfContainer=a}function g(a,b,c,d){var e=this;this.size=0;this.type=null;this.name=a;this.container=c;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){null!== -d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);e.url=b;if(e.onchange)e.onchange(e);if(e.onstatereadychange)e.onstatereadychange(e)}))};this.abort=function(){}}function a(a){this.length=0;this.item=function(a){}}var e=new odf.StyleInfo,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",b="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",s="urn:webodf:names:scope",m="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),k=(new Date).getTime()+ -"_webodf_",c=new core.Base64;p.prototype=new function(){};p.prototype.constructor=p;p.namespaceURI=d;p.localName="document";g.prototype.load=function(){};g.prototype.getUrl=function(){return this.data?"data:;base64,"+c.toBase64(this.data):null};odf.OdfContainer=function r(c,n){function m(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?m(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function l(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&& -c.setAttributeNS(s,"scope",b),c=c.nextSibling}function u(a,b){var c=null,d,e,k;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)e=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(k=d.getAttributeNS(s,"scope"))&&k!==b&&c.removeChild(d),d=e;return c}function w(a){var b=J.rootElement.ownerDocument,c;if(a){m(a.documentElement);try{c=b.importNode(a.documentElement,!0)}catch(d){}}return c}function K(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function A(a){Y=null; -J.rootElement=a;a.fontFaceDecls=h(a,d,"font-face-decls");a.styles=h(a,d,"styles");a.automaticStyles=h(a,d,"automatic-styles");a.masterStyles=h(a,d,"master-styles");a.body=h(a,d,"body");a.meta=h(a,d,"meta")}function F(a){a=w(a);var b=J.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===d?(b.fontFaceDecls=h(a,d,"font-face-decls"),q(b,b.fontFaceDecls),b.styles=h(a,d,"styles"),q(b,b.styles),b.automaticStyles=h(a,d,"automatic-styles"),l(b.automaticStyles,"document-styles"),q(b,b.automaticStyles), -b.masterStyles=h(a,d,"master-styles"),q(b,b.masterStyles),e.prefixStyleNames(b.automaticStyles,k,b.masterStyles)):K(r.INVALID)}function O(a){a=w(a);var b,c,e;if(a&&"document-content"===a.localName&&a.namespaceURI===d){b=J.rootElement;c=h(a,d,"font-face-decls");if(b.fontFaceDecls&&c)for(e=c.firstChild;e;)b.fontFaceDecls.appendChild(e),e=c.firstChild;else c&&(b.fontFaceDecls=c,q(b,c));c=h(a,d,"automatic-styles");l(c,"document-content");if(b.automaticStyles&&c)for(e=c.firstChild;e;)b.automaticStyles.appendChild(e), -e=c.firstChild;else c&&(b.automaticStyles=c,q(b,c));b.body=h(a,d,"body");q(b,b.body)}else K(r.INVALID)}function z(a){a=w(a);var b;a&&("document-meta"===a.localName&&a.namespaceURI===d)&&(b=J.rootElement,b.meta=h(a,d,"meta"),q(b,b.meta))}function H(a){a=w(a);var b;a&&("document-settings"===a.localName&&a.namespaceURI===d)&&(b=J.rootElement,b.settings=h(a,d,"settings"),q(b,b.settings))}function D(a){a=w(a);var c;if(a&&"manifest"===a.localName&&a.namespaceURI===b)for(c=J.rootElement,c.manifest=a,a=c.manifest.firstChild;a;)a.nodeType=== -Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===b)&&(Q[a.getAttributeNS(b,"full-path")]=a.getAttributeNS(b,"media-type")),a=a.nextSibling}function G(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],P.loadAsDOM(c,function(b,c){d(c);J.state!==r.INVALID&&G(a)})):K(r.DONE)}function T(a){var b="";odf.Namespaces.forEachPrefix(function(a,c){b+=" xmlns:"+a+'="'+c+'"'});return''}function ba(){var a=new xmldom.LSSerializer, +odf.OdfContainer=function(){function h(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 q(a){this.OdfContainer=a}function e(a,b,c,d){var e=this;this.size=0;this.type=null;this.name=a;this.container=c;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){null!== +d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);e.url=b;if(e.onchange)e.onchange(e);if(e.onstatereadychange)e.onstatereadychange(e)}))};this.abort=function(){}}function a(a){this.length=0;this.item=function(a){}}var g=new odf.StyleInfo,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",b="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",r="urn:webodf:names:scope",k="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),l=(new Date).getTime()+ +"_webodf_",c=new core.Base64;q.prototype=new function(){};q.prototype.constructor=q;q.namespaceURI=d;q.localName="document";e.prototype.load=function(){};e.prototype.getUrl=function(){return this.data?"data:;base64,"+c.toBase64(this.data):null};odf.OdfContainer=function t(c,p){function k(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?k(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function m(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&& +c.setAttributeNS(r,"scope",b),c=c.nextSibling}function v(a,b){var c=null,d,e,l;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)e=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(l=d.getAttributeNS(r,"scope"))&&l!==b&&c.removeChild(d),d=e;return c}function x(a){var b=J.rootElement.ownerDocument,c;if(a){k(a.documentElement);try{c=b.importNode(a.documentElement,!0)}catch(d){}}return c}function N(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function A(a){Y=null; +J.rootElement=a;a.fontFaceDecls=h(a,d,"font-face-decls");a.styles=h(a,d,"styles");a.automaticStyles=h(a,d,"automatic-styles");a.masterStyles=h(a,d,"master-styles");a.body=h(a,d,"body");a.meta=h(a,d,"meta")}function F(a){a=x(a);var b=J.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===d?(b.fontFaceDecls=h(a,d,"font-face-decls"),n(b,b.fontFaceDecls),b.styles=h(a,d,"styles"),n(b,b.styles),b.automaticStyles=h(a,d,"automatic-styles"),m(b.automaticStyles,"document-styles"),n(b,b.automaticStyles), +b.masterStyles=h(a,d,"master-styles"),n(b,b.masterStyles),g.prefixStyleNames(b.automaticStyles,l,b.masterStyles)):N(t.INVALID)}function O(a){a=x(a);var b,c,e;if(a&&"document-content"===a.localName&&a.namespaceURI===d){b=J.rootElement;c=h(a,d,"font-face-decls");if(b.fontFaceDecls&&c)for(e=c.firstChild;e;)b.fontFaceDecls.appendChild(e),e=c.firstChild;else c&&(b.fontFaceDecls=c,n(b,c));c=h(a,d,"automatic-styles");m(c,"document-content");if(b.automaticStyles&&c)for(e=c.firstChild;e;)b.automaticStyles.appendChild(e), +e=c.firstChild;else c&&(b.automaticStyles=c,n(b,c));b.body=h(a,d,"body");n(b,b.body)}else N(t.INVALID)}function z(a){a=x(a);var b;a&&("document-meta"===a.localName&&a.namespaceURI===d)&&(b=J.rootElement,b.meta=h(a,d,"meta"),n(b,b.meta))}function H(a){a=x(a);var b;a&&("document-settings"===a.localName&&a.namespaceURI===d)&&(b=J.rootElement,b.settings=h(a,d,"settings"),n(b,b.settings))}function D(a){a=x(a);var c;if(a&&"manifest"===a.localName&&a.namespaceURI===b)for(c=J.rootElement,c.manifest=a,a=c.manifest.firstChild;a;)a.nodeType=== +Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===b)&&(Q[a.getAttributeNS(b,"full-path")]=a.getAttributeNS(b,"media-type")),a=a.nextSibling}function G(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],P.loadAsDOM(c,function(b,c){d(c);J.state!==t.INVALID&&G(a)})):N(t.DONE)}function T(a){var b="";odf.Namespaces.forEachPrefix(function(a,c){b+=" xmlns:"+a+'="'+c+'"'});return''}function ba(){var a=new xmldom.LSSerializer, b=T("document-meta");a.filter=new f;b+=a.writeToString(J.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function V(a,c){var d=document.createElementNS(b,"manifest:file-entry");d.setAttributeNS(b,"manifest:full-path",a);d.setAttributeNS(b,"manifest:media-type",c);return d}function ca(){var a=runtime.parseXML(''),c=h(a,b,"manifest"),d=new xmldom.LSSerializer,e;for(e in Q)Q.hasOwnProperty(e)&&c.appendChild(V(e, -Q[e]));d.filter=new f;return'\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function U(){var a=new xmldom.LSSerializer,b=T("document-settings");a.filter=new f;b+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap);return b+""}function W(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=u(J.rootElement.automaticStyles,"document-styles"),d=J.rootElement.masterStyles&&J.rootElement.masterStyles.cloneNode(!0), -n=T("document-styles");e.removePrefixFromStyleNames(c,k,d);b.filter=new f(d,c);n+=b.writeToString(J.rootElement.fontFaceDecls,a);n+=b.writeToString(J.rootElement.styles,a);n+=b.writeToString(c,a);n+=b.writeToString(d,a);return n+""}function N(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=u(J.rootElement.automaticStyles,"document-content"),d=T("document-content");b.filter=new f(J.rootElement.body,c);d+=b.writeToString(c,a);d+=b.writeToString(J.rootElement.body, -a);return d+""}function S(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var e=w(c);e&&"document"===e.localName&&e.namespaceURI===d?(A(e),K(r.DONE)):K(r.INVALID)}})}function R(){function a(b,c){var k;c||(c=b);k=document.createElementNS(d,c);e[b]=k;e.appendChild(k)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),e=J.rootElement,k=document.createElementNS(d,"text");b.save("mimetype",c,!1,new Date);a("meta");a("settings"); -a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");e.body.appendChild(k);K(r.DONE);return b}function I(){var a,b=new Date;a=runtime.byteArrayFromString(U(),"utf8");P.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(ba(),"utf8");P.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(W(),"utf8");P.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(N(),"utf8");P.save("content.xml",a,!0,b);a= -runtime.byteArrayFromString(ca(),"utf8");P.save("META-INF/manifest.xml",a,!0,b)}function B(a,b){I();P.writeAs(a,function(a){b(a)})}var J=this,P,Q={},Y;this.onstatereadychange=n;this.parts=this.rootElement=this.state=this.onchange=null;this.setRootElement=A;this.getContentElement=function(){var a;Y||(a=J.rootElement.body,Y=a.getElementsByTagNameNS(d,"text")[0]||a.getElementsByTagNameNS(d,"presentation")[0]||a.getElementsByTagNameNS(d,"spreadsheet")[0]);return Y};this.getDocumentType=function(){var a= -J.getContentElement();return a&&a.localName};this.getPart=function(a){return new g(a,Q[a],J,P)};this.getPartData=function(a,b){P.load(a,b)};this.createByteArray=function(a,b){I();P.createByteArray(a,b)};this.saveAs=B;this.save=function(a){B(c,a)};this.getUrl=function(){return c};this.state=r.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}(p);this.parts=new a(this);P=c?new core.Zip(c,function(a, -b){P=b;a?S(c,function(b){a&&(P.error=a+"\n"+b,K(r.INVALID))}):G([["styles.xml",F],["content.xml",O],["meta.xml",z],["settings.xml",H],["META-INF/manifest.xml",D]])}):R()};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}(); +Q[e]));d.filter=new f;return'\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function U(){var a=new xmldom.LSSerializer,b=T("document-settings");a.filter=new f;b+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap);return b+""}function W(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(J.rootElement.automaticStyles,"document-styles"),d=J.rootElement.masterStyles&&J.rootElement.masterStyles.cloneNode(!0), +e=T("document-styles");g.removePrefixFromStyleNames(c,l,d);b.filter=new f(d,c);e+=b.writeToString(J.rootElement.fontFaceDecls,a);e+=b.writeToString(J.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+""}function M(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(J.rootElement.automaticStyles,"document-content"),d=T("document-content");b.filter=new f(J.rootElement.body,c);d+=b.writeToString(c,a);d+=b.writeToString(J.rootElement.body, +a);return d+""}function S(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var e=x(c);e&&"document"===e.localName&&e.namespaceURI===d?(A(e),N(t.DONE)):N(t.INVALID)}})}function R(){function a(b,c){var l;c||(c=b);l=document.createElementNS(d,c);e[b]=l;e.appendChild(l)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),e=J.rootElement,l=document.createElementNS(d,"text");b.save("mimetype",c,!1,new Date);a("meta");a("settings"); +a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");e.body.appendChild(l);N(t.DONE);return b}function I(){var a,b=new Date;a=runtime.byteArrayFromString(U(),"utf8");P.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(ba(),"utf8");P.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(W(),"utf8");P.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(M(),"utf8");P.save("content.xml",a,!0,b);a= +runtime.byteArrayFromString(ca(),"utf8");P.save("META-INF/manifest.xml",a,!0,b)}function B(a,b){I();P.writeAs(a,function(a){b(a)})}var J=this,P,Q={},Y;this.onstatereadychange=p;this.parts=this.rootElement=this.state=this.onchange=null;this.setRootElement=A;this.getContentElement=function(){var a;Y||(a=J.rootElement.body,Y=a.getElementsByTagNameNS(d,"text")[0]||a.getElementsByTagNameNS(d,"presentation")[0]||a.getElementsByTagNameNS(d,"spreadsheet")[0]);return Y};this.getDocumentType=function(){var a= +J.getContentElement();return a&&a.localName};this.getPart=function(a){return new e(a,Q[a],J,P)};this.getPartData=function(a,b){P.load(a,b)};this.createByteArray=function(a,b){I();P.createByteArray(a,b)};this.saveAs=B;this.save=function(a){B(c,a)};this.getUrl=function(){return c};this.state=t.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}(q);this.parts=new a(this);P=c?new core.Zip(c,function(a, +b){P=b;a?S(c,function(b){a&&(P.error=a+"\n"+b,N(t.INVALID))}):G([["styles.xml",F],["content.xml",O],["meta.xml",z],["settings.xml",H],["META-INF/manifest.xml",D]])}):R()};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 31 /* @@ -597,9 +597,9 @@ b){P=b;a?S(c,function(b){a&&(P.error=a+"\n"+b,K(r.INVALID))}):G([["styles.xml",F @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.OdfContainer"); -odf.FontLoader=function(){function h(f,g,a,e,d){var b,l=0,m;for(m in f)if(f.hasOwnProperty(m)){if(l===a){b=m;break}l+=1}if(!b)return d();g.getPartData(f[b].href,function(k,c){if(k)runtime.log(k);else{var m="@font-face { font-family: '"+(f[b].family||b)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+q.convertUTF8ArrayToBase64(c)+') format("truetype"); }';try{e.insertRule(m,e.cssRules.length)}catch(r){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(r)+"\nRule: "+m)}}h(f, -g,a+1,e,d)})}function l(f,g,a){h(f,g,0,a,function(){})}var f=new xmldom.XPath,q=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(p,g){for(var a=p.rootElement.fontFaceDecls;g.cssRules.length;)g.deleteRule(g.cssRules.length-1);if(a){var e={},d,b,h,m;if(a)for(a=f.getODFElementsWithXPath(a,"style:font-face[svg:font-face-src]",odf.Namespaces.resolvePrefix),d=0;d text|list-item > *:first-child:before {";if(E=A.getAttributeNS(u,"style-name")){A=q[E];B=z.getFirstNonWhitespaceChild(A);A=void 0;if("list-level-style-number"===B.localName){A=B.getAttributeNS(n,"num-format");E=B.getAttributeNS(n,"num-suffix");var H="",H={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"}, -I=void 0,I=B.getAttributeNS(n,"num-prefix")||"",I=H.hasOwnProperty(A)?I+(" counter(list, "+H[A]+")"):A?I+("'"+A+"';"):I+" ''";E&&(I+=" '"+E+"'");A=H="content: "+I+";"}else"list-level-style-image"===B.localName?A="content: none;":"list-level-style-bullet"===B.localName&&(A="content: '"+B.getAttributeNS(u,"bullet-char")+"';");B=A}if(v){for(A=h[v];A;)v=A,A=h[v];L+="counter-increment:"+v+";";B?(B=B.replace("list",v),L+=B):L+="content:counter("+v+");"}else v="",B?(B=B.replace("list",w),L+=B):L+="content: counter("+ -w+");",L+="counter-increment:"+w+";",k.insertRule("text|list#"+w+" {counter-reset:"+w+"}",k.cssRules.length);L+="}";h[w]=v;L&&k.insertRule(L,k.cssRules.length)}m.insertBefore(D,m.firstChild);C();if(!c&&(k=[S],$.hasOwnProperty("statereadychange")))for(m=$.statereadychange,B=0;B text|list-item > *:first-child:before {";if(E=A.getAttributeNS(v,"style-name")){A=h[E];B=z.getFirstNonWhitespaceChild(A);A=void 0;if("list-level-style-number"===B.localName){A=B.getAttributeNS(p,"num-format");E=B.getAttributeNS(p,"num-suffix");var H="",H={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"}, +I=void 0,I=B.getAttributeNS(p,"num-prefix")||"",I=H.hasOwnProperty(A)?I+(" counter(list, "+H[A]+")"):A?I+("'"+A+"';"):I+" ''";E&&(I+=" '"+E+"'");A=H="content: "+I+";"}else"list-level-style-image"===B.localName?A="content: none;":"list-level-style-bullet"===B.localName&&(A="content: '"+B.getAttributeNS(v,"bullet-char")+"';");B=A}if(w){for(A=n[w];A;)w=A,A=n[w];K+="counter-increment:"+w+";";B?(B=B.replace("list",w),K+=B):K+="content:counter("+w+");"}else w="",B?(B=B.replace("list",x),K+=B):K+="content: counter("+ +x+");",K+="counter-increment:"+x+";",g.insertRule("text|list#"+x+" {counter-reset:"+x+"}",g.cssRules.length);K+="}";n[x]=w;K&&g.insertRule(K,g.cssRules.length)}f.insertBefore(D,f.firstChild);C();if(!c&&(g=[S],$.hasOwnProperty("statereadychange")))for(f=$.statereadychange,B=0;Bl?(runtime.log("connection to server timed out."),f("timeout")):(p+=100,runtime.getWindow().setTimeout(q,100)):(runtime.log("connection to collaboration server established."),f("ready"))}var p=0;h||(h=runtime.getVariable("now"),void 0===h&&(h={networkStatus:"unavailable"}), -q())};this.networkStatus=function(){return h?h.networkStatus:"unavailable"};this.login=function(l,f,q,p){h?h.login(l,f,q,p):p("Not connected to server")}}; +ops.NowjsServer=function(){var h=this,m;this.getNowObject=function(){return m};this.connect=function(f,n){function h(){"unavailable"===m.networkStatus?(runtime.log("connection to server unavailable."),n("unavailable")):"ready"!==m.networkStatus?e>f?(runtime.log("connection to server timed out."),n("timeout")):(e+=100,runtime.getWindow().setTimeout(h,100)):(runtime.log("connection to collaboration server established."),n("ready"))}var e=0;m||(m=runtime.getVariable("now"),void 0===m&&(m={networkStatus:"unavailable"}), +h())};this.networkStatus=function(){return m?m.networkStatus:"unavailable"};this.login=function(f,n,h,e){m?m.login(f,n,h,e):e("Not connected to server")};this.createOperationRouter=function(f,n){return new ops.NowjsOperationRouter(f,n,h)};this.createUserModel=function(){return new ops.NowjsUserModel(h)}}; // Input 37 /* @@ -819,9 +819,9 @@ q())};this.networkStatus=function(){return h?h.networkStatus:"unavailable"};this @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.Base64");runtime.loadClass("core.ByteArrayWriter"); -ops.PullBoxServer=function(h){function l(f,a){var e=new XMLHttpRequest,d=new core.ByteArrayWriter("utf8");runtime.log("Sending message to server: "+f);d.appendString(f);d=d.getByteArray();e.open("POST",h.url,!0);e.onreadystatechange=function(){4===e.readyState&&((200>e.status||300<=e.status)&&0===e.status&&runtime.log("Status "+String(e.status)+": "+e.responseText||e.statusText),a(e.responseText))};d=d.buffer&&!e.sendAsBinary?d.buffer:runtime.byteArrayToString(d,"binary");try{e.sendAsBinary?e.sendAsBinary(d): -e.send(d)}catch(b){runtime.log("Problem with calling server: "+b+" "+d),a(b.message)}}var f=this,q,p=new core.Base64;h=h||{};h.url=h.url||"/WSER";this.call=l;this.getBase64=function(){return p};this.getToken=function(){return q};this.connect=function(f,a){a("ready")};this.networkStatus=function(){return"ready"};this.login=function(g,a,e,d){l("login:"+p.toBase64(g)+":"+p.toBase64(a),function(a){var g=runtime.fromJson(a);runtime.log("Login reply: "+a);g.hasOwnProperty("token")?(q=g.token,runtime.log("Caching token: "+ -f.getToken()),e(g)):d(a)})}}; +ops.PullBoxServer=function(h){function m(e,a){var g=new XMLHttpRequest,d=new core.ByteArrayWriter("utf8");runtime.log("Sending message to server: "+e);d.appendString(e);d=d.getByteArray();g.open("POST",h.url,!0);g.onreadystatechange=function(){4===g.readyState&&((200>g.status||300<=g.status)&&0===g.status&&runtime.log("Status "+String(g.status)+": "+g.responseText||g.statusText),a(g.responseText))};d=d.buffer&&!g.sendAsBinary?d.buffer:runtime.byteArrayToString(d,"binary");try{g.sendAsBinary?g.sendAsBinary(d): +g.send(d)}catch(b){runtime.log("Problem with calling server: "+b+" "+d),a(b.message)}}var f=this,n,q=new core.Base64;h=h||{};h.url=h.url||"/WSER";this.call=m;this.getBase64=function(){return q};this.getToken=function(){return n};this.connect=function(e,a){a("ready")};this.networkStatus=function(){return"ready"};this.login=function(e,a,g,d){m("login:"+q.toBase64(e)+":"+q.toBase64(a),function(a){var e=runtime.fromJson(a);runtime.log("Login reply: "+a);e.hasOwnProperty("token")?(n=e.token,runtime.log("Caching token: "+ +f.getToken()),g(e)):d(a)})};this.createOperationRouter=function(e,a){return new ops.PullBoxOperationRouter(e,a,f)};this.createUserModel=function(){return new ops.PullBoxUserModel(f)}}; // Input 38 /* @@ -857,7 +857,7 @@ f.getToken()),e(g)):d(a)})}}; @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.Operation=function(){};ops.Operation.prototype.init=function(h){};ops.Operation.prototype.transform=function(h,l){};ops.Operation.prototype.execute=function(h){};ops.Operation.prototype.spec=function(){}; +ops.Operation=function(){};ops.Operation.prototype.init=function(h){};ops.Operation.prototype.transform=function(h,m){};ops.Operation.prototype.execute=function(h){};ops.Operation.prototype.spec=function(){}; // Input 39 /* @@ -893,7 +893,7 @@ ops.Operation=function(){};ops.Operation.prototype.init=function(h){};ops.Operat @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpAddCursor=function(){var h=this,l,f;this.init=function(h){l=h.memberid;f=h.timestamp};this.transform=function(f,l){return[h]};this.execute=function(f){var h=f.getCursor(l);if(h)return!1;h=new ops.OdtCursor(l,f);f.addCursor(h);f.emit(ops.OdtDocument.signalCursorAdded,h);return!0};this.spec=function(){return{optype:"AddCursor",memberid:l,timestamp:f}}}; +ops.OpAddCursor=function(){var h=this,m,f;this.init=function(n){m=n.memberid;f=n.timestamp};this.transform=function(f,m){return[h]};this.execute=function(f){var h=f.getCursor(m);if(h)return!1;h=new ops.OdtCursor(m,f);f.addCursor(h);f.emit(ops.OdtDocument.signalCursorAdded,h);return!0};this.spec=function(){return{optype:"AddCursor",memberid:m,timestamp:f}}}; // Input 40 /* @@ -930,9 +930,9 @@ ops.OpAddCursor=function(){var h=this,l,f;this.init=function(h){l=h.memberid;f=h @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.OdfUtils"); -ops.OpApplyStyle=function(){function h(a){var d=0<=g?p+g:p,e=a.getIteratorAtPosition(0<=g?p:p+g),d=g?a.getIteratorAtPosition(d):e;a=a.getDOM().createRange();a.setStart(e.container(),e.unfilteredDomOffset());a.setEnd(d.container(),d.unfilteredDomOffset());return a}function l(a){var f=a.commonAncestorContainer,g=[];for(f.nodeType===Node.ELEMENT_NODE&&(g=d.getElementsByTagNameNS(f,"urn:oasis:names:tc:opendocument:xmlns:text:1.0","p").concat(d.getElementsByTagNameNS(f,"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -"h")));f&&!e.isParagraph(f);)f=f.parentNode;f&&g.push(f);return g.filter(function(d){var c=d.nodeType===Node.TEXT_NODE?d.length:d.childNodes.length;return 0>=a.comparePoint(d,0)&&0<=a.comparePoint(d,c)})}var f,q,p,g,a,e=new odf.OdfUtils,d=new core.DomUtils;this.init=function(b){f=b.memberid;q=b.timestamp;p=parseInt(b.position,10);g=parseInt(b.length,10);a=b.info};this.transform=function(a,d){return null};this.execute=function(b){var d=h(b),e=l(d);b.getFormatting().applyStyle(f,d,a);d.detach();b.getOdfCanvas().refreshCSS(); -e.forEach(function(a){b.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:f,timeStamp:q})});return!0};this.spec=function(){return{optype:"ApplyStyle",memberid:f,timestamp:q,position:p,length:g,info:a}}}; +ops.OpApplyStyle=function(){function h(a){var d=0<=e?q+e:q,g=a.getIteratorAtPosition(0<=e?q:q+e),d=e?a.getIteratorAtPosition(d):g;a=a.getDOM().createRange();a.setStart(g.container(),g.unfilteredDomOffset());a.setEnd(d.container(),d.unfilteredDomOffset());return a}function m(a){var e=a.commonAncestorContainer,k=[];for(e.nodeType===Node.ELEMENT_NODE&&(k=d.getElementsByTagNameNS(e,"urn:oasis:names:tc:opendocument:xmlns:text:1.0","p").concat(d.getElementsByTagNameNS(e,"urn:oasis:names:tc:opendocument:xmlns:text:1.0", +"h")));e&&!g.isParagraph(e);)e=e.parentNode;e&&k.push(e);return k.filter(function(d){var c=d.nodeType===Node.TEXT_NODE?d.length:d.childNodes.length;return 0>=a.comparePoint(d,0)&&0<=a.comparePoint(d,c)})}var f,n,q,e,a,g=new odf.OdfUtils,d=new core.DomUtils;this.init=function(b){f=b.memberid;n=b.timestamp;q=parseInt(b.position,10);e=parseInt(b.length,10);a=b.info};this.transform=function(a,d){return null};this.execute=function(b){var d=h(b),e=m(d);b.getFormatting().applyStyle(f,d,a);d.detach();b.getOdfCanvas().refreshCSS(); +e.forEach(function(a){b.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:f,timeStamp:n})});return!0};this.spec=function(){return{optype:"ApplyStyle",memberid:f,timestamp:n,position:q,length:e,info:a}}}; // Input 41 /* @@ -968,7 +968,7 @@ e.forEach(function(a){b.emit(ops.OdtDocument.signalParagraphChanged,{paragraphEl @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpRemoveCursor=function(){var h=this,l,f;this.init=function(h){l=h.memberid;f=h.timestamp};this.transform=function(f,p){var g=f.spec();return"RemoveCursor"===g.optype&&g.memberid===l?[]:[h]};this.execute=function(f){return f.removeCursor(l)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:l,timestamp:f}}}; +ops.OpRemoveCursor=function(){var h=this,m,f;this.init=function(n){m=n.memberid;f=n.timestamp};this.transform=function(f,q){var e=f.spec();return"RemoveCursor"===e.optype&&e.memberid===m?[]:[h]};this.execute=function(f){return f.removeCursor(m)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:m,timestamp:f}}}; // Input 42 /* @@ -1004,15 +1004,15 @@ ops.OpRemoveCursor=function(){var h=this,l,f;this.init=function(h){l=h.memberid; @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpMoveCursor=function(){var h=this,l,f,q,p;this.init=function(g){l=g.memberid;f=g.timestamp;q=parseInt(g.position,10);p=void 0!==g.length?parseInt(g.length,10):0};this.merge=function(g){return"MoveCursor"===g.optype&&g.memberid===l?(q=g.position,p=g.length,f=g.timestamp,!0):!1};this.transform=function(f,a){var e=f.spec(),d=e.optype,b=[h];"RemoveText"===d?e.position+e.length<=q?q-=e.length:e.positionb?-e.countBackwardSteps(-b,d):0;a.move(b);p&&(d=0p?-e.countBackwardSteps(-p,d):0,a.move(d,!0));f.emit(ops.OdtDocument.signalCursorMoved,a);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:l, -timestamp:f,position:q,length:p}}}; +ops.OpMoveCursor=function(){var h=this,m,f,n,q;this.init=function(e){m=e.memberid;f=e.timestamp;n=parseInt(e.position,10);q=void 0!==e.length?parseInt(e.length,10):0};this.merge=function(e){return"MoveCursor"===e.optype&&e.memberid===m?(n=e.position,q=e.length,f=e.timestamp,!0):!1};this.transform=function(e,a){var g=e.spec(),d=g.optype,b=[h];"RemoveText"===d?g.position+g.length<=n?n-=g.length:g.positionb?-g.countBackwardSteps(-b,d):0;a.move(b);q&&(d=0q?-g.countBackwardSteps(-q,d):0,a.move(d,!0));e.emit(ops.OdtDocument.signalCursorMoved,a);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:m, +timestamp:f,position:n,length:q}}}; // Input 43 -ops.OpInsertTable=function(){function h(a,b){var c;if(1===s.length)c=s[0];else if(3===s.length)switch(a){case 0:c=s[0];break;case p-1:c=s[2];break;default:c=s[1]}else c=s[a];if(1===c.length)return c[0];if(3===c.length)switch(b){case 0:return c[0];case g-1:return c[2];default:return c[1]}return c[b]}var l=this,f,q,p,g,a,e,d,b,s;this.init=function(m){f=m.memberid;q=m.timestamp;a=parseInt(m.position,10);p=parseInt(m.initialRows,10);g=parseInt(m.initialColumns,10);e=m.tableName;d=m.tableStyleName;b=m.tableColumnStyleName; -s=m.tableCellStyleMatrix};this.transform=function(b,d){var c=b.spec(),e=c.optype,f=[l];if("InsertTable"===e)f=null;else if("SplitParagraph"===e)if(c.position=a.textNode.length?null:a.textNode.splitText(a.offset));for(a=a.textNode;a!==d;)if(a=a.parentNode,b=a.cloneNode(!1),m){for(h&&b.appendChild(h);m.nextSibling;)b.appendChild(m.nextSibling);a.parentNode.insertBefore(b, -a.nextSibling);m=a;h=b}else a.parentNode.insertBefore(b,a),m=b,h=a;p.isListItem(h)&&(h=h.childNodes[0]);g.fixCursorPositions(l);g.getOdfCanvas().refreshSize();g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:e,memberId:l,timeStamp:f});g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:h,memberId:l,timeStamp:f});return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:l,timestamp:f,position:q}}}; +ops.OpSplitParagraph=function(){var h=this,m,f,n,q=new odf.OdfUtils;this.init=function(e){m=e.memberid;f=e.timestamp;n=parseInt(e.position,10)};this.transform=function(e,a){var g=e.spec(),d=g.optype,b=[h];if("SplitParagraph"===d)if(g.position=a.textNode.length?null:a.textNode.splitText(a.offset));for(a=a.textNode;a!==d;)if(a=a.parentNode,b=a.cloneNode(!1),k){for(h&&b.appendChild(h);k.nextSibling;)b.appendChild(k.nextSibling);a.parentNode.insertBefore(b, +a.nextSibling);k=a;h=b}else a.parentNode.insertBefore(b,a),k=b,h=a;q.isListItem(h)&&(h=h.childNodes[0]);e.fixCursorPositions(m);e.getOdfCanvas().refreshSize();e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:m,timeStamp:f});e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:h,memberId:m,timeStamp:f});return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:m,timestamp:f,position:n}}}; // Input 47 /* @@ -1166,8 +1166,8 @@ a.nextSibling);m=a;h=b}else a.parentNode.insertBefore(b,a),m=b,h=a;p.isListItem( @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpSetParagraphStyle=function(){var h=this,l,f,q,p;this.init=function(g){l=g.memberid;f=g.timestamp;q=g.position;p=g.styleName};this.transform=function(f,a){var e=f.spec();"DeleteParagraphStyle"===e.optype&&e.styleName===p&&(p="");return[h]};this.execute=function(g){var a;if(a=g.getPositionInTextNode(q))if(a=g.getParagraphElement(a.textNode))return""!==p?a.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",p):a.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", -"style-name"),g.getOdfCanvas().refreshSize(),g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,timeStamp:f,memberId:l}),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:l,timestamp:f,position:q,styleName:p}}}; +ops.OpSetParagraphStyle=function(){var h=this,m,f,n,q;this.init=function(e){m=e.memberid;f=e.timestamp;n=e.position;q=e.styleName};this.transform=function(e,a){var g=e.spec();"DeleteParagraphStyle"===g.optype&&g.styleName===q&&(q="");return[h]};this.execute=function(e){var a;if(a=e.getPositionInTextNode(n))if(a=e.getParagraphElement(a.textNode))return""!==q?a.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",q):a.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", +"style-name"),e.getOdfCanvas().refreshSize(),e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,timeStamp:f,memberId:m}),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:m,timestamp:f,position:n,styleName:q}}}; // Input 48 /* @@ -1203,16 +1203,16 @@ ops.OpSetParagraphStyle=function(){var h=this,l,f,q,p;this.init=function(g){l=g. @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpUpdateParagraphStyle=function(){function h(a,b,d){var e,f,g;for(e=0;ea?-1:1;for(a=Math.abs(a);0m?h.previousPosition():h.nextPosition());)if(N.check(),1===g.acceptPosition(h)&&(r+=1,p=h.container(),T=q(p,h.unfilteredDomOffset(),W),T.top!==V)){if(T.top!== -U&&U!==V)break;U=T.top;T=Math.abs(ca-T.left);if(null===s||Ta?(g=c.previousPosition,m=-1):(g=c.nextPosition,m=1);for(h=q(c.container(),c.unfilteredDomOffset(),r);g.call(c);)if(b.acceptPosition(c)===NodeFilter.FILTER_ACCEPT){if(k.getParagraphElement(c.getCurrentNode())!== -d)break;p=q(c.container(),c.unfilteredDomOffset(),r);if(p.bottom!==h.bottom&&(h=p.top>=h.top&&p.bottomh.bottom,!h))break;e+=m;h=p}r.detach();return e}function s(a,b){for(var c=0,d;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(d=b.firstChild;d!==a;)c+=1,d=d.nextSibling;return c}function m(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=f(),e=d.container(),k=d.unfilteredDomOffset(), -g=0,m=new core.LoopWatchDog(1E3);d.setUnfilteredPosition(a,b);a=d.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=d.unfilteredDomOffset();d.setUnfilteredPosition(e,k);var e=a,k=b,h=d.container(),l=d.unfilteredDomOffset();if(e===h)e=l-k;else{var p=e.compareDocumentPosition(h);2===p?p=-1:4===p?p=1:10===p?(k=s(e,h),p=ke)for(;d.nextPosition()&&(m.check(),1===c.acceptPosition(d)&&(g+=1),d.container()!== -a||d.unfilteredDomOffset()!==b););else if(0a?-1:1;for(a=Math.abs(a);0k?h.previousPosition():h.nextPosition());)if(M.check(),1===l.acceptPosition(h)&&(t+=1,q=h.container(),T=n(q,h.unfilteredDomOffset(),W),T.top!==V)){if(T.top!== +U&&U!==V)break;U=T.top;T=Math.abs(ca-T.left);if(null===r||Ta?(g=c.previousPosition,k=-1):(g=c.nextPosition,k=1);for(h=n(c.container(),c.unfilteredDomOffset(),t);g.call(c);)if(b.acceptPosition(c)===NodeFilter.FILTER_ACCEPT){if(l.getParagraphElement(c.getCurrentNode())!== +d)break;q=n(c.container(),c.unfilteredDomOffset(),t);if(q.bottom!==h.bottom&&(h=q.top>=h.top&&q.bottomh.bottom,!h))break;e+=k;h=q}t.detach();return e}function r(a,b){for(var c=0,d;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(d=b.firstChild;d!==a;)c+=1,d=d.nextSibling;return c}function k(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=f(),e=d.container(),g=d.unfilteredDomOffset(), +l=0,k=new core.LoopWatchDog(1E3);d.setUnfilteredPosition(a,b);a=d.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=d.unfilteredDomOffset();d.setUnfilteredPosition(e,g);var e=a,g=b,h=d.container(),m=d.unfilteredDomOffset();if(e===h)e=m-g;else{var n=e.compareDocumentPosition(h);2===n?n=-1:4===n?n=1:10===n?(g=r(e,h),n=ge)for(;d.nextPosition()&&(k.check(),1===c.acceptPosition(d)&&(l+=1),d.container()!== +a||d.unfilteredDomOffset()!==b););else if(0=g&&(e=-q.movePointBackward(-g,a));f.handleUpdate();return e};this.handleUpdate=function(){};this.getStepCounter=function(){return q.getStepCounter()};this.getMemberId=function(){return h};this.getNode=function(){return p.getNode()};this.getAnchorNode=function(){return p.getAnchorNode()};this.getSelectedRange=function(){return p.getSelectedRange()}; -this.getOdtDocument=function(){return l};p=new core.Cursor(l.getDOM(),h);q=new gui.SelectionMover(p,l.getRootNode())}; +ops.OdtCursor=function(h,m){var f=this,n,q;this.removeFromOdtDocument=function(){q.remove()};this.move=function(e,a){var g=0;0=e&&(g=-n.movePointBackward(-e,a));f.handleUpdate();return g};this.handleUpdate=function(){};this.getStepCounter=function(){return n.getStepCounter()};this.getMemberId=function(){return h};this.getNode=function(){return q.getNode()};this.getAnchorNode=function(){return q.getAnchorNode()};this.getSelectedRange=function(){return q.getSelectedRange()}; +this.getOdtDocument=function(){return m};q=new core.Cursor(m.getDOM(),h);n=new gui.SelectionMover(q,m.getRootNode())}; // Input 55 /* @@ -1413,22 +1413,22 @@ this.getOdtDocument=function(){return l};p=new core.Cursor(l.getDOM(),h);q=new g @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.EditInfo=function(h,l){function f(){var f=[],a;for(a in p)p.hasOwnProperty(a)&&f.push({memberid:a,time:p[a].time});f.sort(function(a,d){return a.time-d.time});return f}var q,p={};this.getNode=function(){return q};this.getOdtDocument=function(){return l};this.getEdits=function(){return p};this.getSortedEdits=function(){return f()};this.addEdit=function(f,a){var e,d=f.split("___")[0];if(!p[f])for(e in p)if(p.hasOwnProperty(e)&&e.split("___")[0]===d){delete p[e];break}p[f]={time:a}};this.clearEdits= -function(){p={}};q=l.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");h.insertBefore(q,h.firstChild)}; +ops.EditInfo=function(h,m){function f(){var e=[],a;for(a in q)q.hasOwnProperty(a)&&e.push({memberid:a,time:q[a].time});e.sort(function(a,d){return a.time-d.time});return e}var n,q={};this.getNode=function(){return n};this.getOdtDocument=function(){return m};this.getEdits=function(){return q};this.getSortedEdits=function(){return f()};this.addEdit=function(e,a){var g,d=e.split("___")[0];if(!q[e])for(g in q)if(q.hasOwnProperty(g)&&g.split("___")[0]===d){delete q[g];break}q[e]={time:a}};this.clearEdits= +function(){q={}};n=m.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");h.insertBefore(n,h.firstChild)}; // Input 56 -gui.Avatar=function(h,l){var f=this,q,p,g;this.setColor=function(a){p.style.borderColor=a};this.setImageUrl=function(a){f.isVisible()?p.src=a:g=a};this.isVisible=function(){return"block"===q.style.display};this.show=function(){g&&(p.src=g,g=void 0);q.style.display="block"};this.hide=function(){q.style.display="none"};this.markAsFocussed=function(a){q.className=a?"active":""};(function(){var a=h.ownerDocument,e=a.documentElement.namespaceURI;q=a.createElementNS(e,"div");p=a.createElementNS(e,"img"); -p.width=64;p.height=64;q.appendChild(p);q.style.width="64px";q.style.height="70px";q.style.position="absolute";q.style.top="-80px";q.style.left="-34px";q.style.display=l?"block":"none";h.appendChild(q)})()}; +gui.Avatar=function(h,m){var f=this,n,q,e;this.setColor=function(a){q.style.borderColor=a};this.setImageUrl=function(a){f.isVisible()?q.src=a:e=a};this.isVisible=function(){return"block"===n.style.display};this.show=function(){e&&(q.src=e,e=void 0);n.style.display="block"};this.hide=function(){n.style.display="none"};this.markAsFocussed=function(a){n.className=a?"active":""};(function(){var a=h.ownerDocument,e=a.documentElement.namespaceURI;n=a.createElementNS(e,"div");q=a.createElementNS(e,"img"); +q.width=64;q.height=64;n.appendChild(q);n.style.width="64px";n.style.height="70px";n.style.position="absolute";n.style.top="-80px";n.style.left="-34px";n.style.display=m?"block":"none";h.appendChild(n)})()}; // Input 57 runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); -gui.Caret=function(h,l){function f(){e&&a.parentNode&&!d&&(d=!0,p.style.borderColor="transparent"===p.style.borderColor?b:"transparent",runtime.setTimeout(function(){d=!1;f()},500))}function q(a){var b;if("string"===typeof a){if(""===a)return 0;b=/^(\d+)(\.\d+)?px$/.exec(a);runtime.assert(null!==b,"size ["+a+"] does not have unit px.");return parseFloat(b[1])}return a}var p,g,a,e=!1,d=!1,b="";this.setFocus=function(){e=!0;g.markAsFocussed(!0);f()};this.removeFocus=function(){e=!1;g.markAsFocussed(!1); -p.style.borderColor=b};this.setAvatarImageUrl=function(a){g.setImageUrl(a)};this.setColor=function(a){b!==a&&(b=a,"transparent"!==p.style.borderColor&&(p.style.borderColor=b),g.setColor(b))};this.getCursor=function(){return h};this.getFocusElement=function(){return p};this.toggleHandleVisibility=function(){g.isVisible()?g.hide():g.show()};this.showHandle=function(){g.show()};this.hideHandle=function(){g.hide()};this.ensureVisible=function(){var a,b,d,c,e,f,g,n=h.getOdtDocument().getOdfCanvas().getElement().parentNode; -e=g=p;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{e=e.parentElement;if(!e)break;f=d.getComputedStyle(e,null)}while("block"!==f.display);f=e;e=c=0;if(f&&n){b=!1;do{d=f.offsetParent;for(a=f.parentNode;a!==d;){if(a===n){a=f;var l=n,y=0;b=0;var u=void 0,w=runtime.getWindow();for(runtime.assert(null!==w,"Expected to be run in an environment which has a global window, like a browser.");a&&a!==l;)u=w.getComputedStyle(a, -null),y+=q(u.marginLeft)+q(u.borderLeftWidth)+q(u.paddingLeft),b+=q(u.marginTop)+q(u.borderTopWidth)+q(u.paddingTop),a=a.parentElement;a=y;c+=a;e+=b;b=!0;break}a=a.parentNode}if(b)break;c+=q(f.offsetLeft);e+=q(f.offsetTop);f=d}while(f&&f!==n);d=c;c=e}else c=d=0;d+=g.offsetLeft;c+=g.offsetTop;e=d-5;f=c-5;d=d+g.scrollWidth-1+5;g=c+g.scrollHeight-1+5;fn.scrollTop+n.clientHeight-1&&(n.scrollTop=g-n.clientHeight+1);en.scrollLeft+n.clientWidth- -1&&(n.scrollLeft=d-n.clientWidth+1)};(function(){var b=h.getOdtDocument().getDOM();p=b.createElementNS(b.documentElement.namespaceURI,"span");a=h.getNode();a.appendChild(p);g=new gui.Avatar(a,l)})()}; +gui.Caret=function(h,m){function f(){g&&a.parentNode&&!d&&(d=!0,q.style.borderColor="transparent"===q.style.borderColor?b:"transparent",runtime.setTimeout(function(){d=!1;f()},500))}function n(a){var b;if("string"===typeof a){if(""===a)return 0;b=/^(\d+)(\.\d+)?px$/.exec(a);runtime.assert(null!==b,"size ["+a+"] does not have unit px.");return parseFloat(b[1])}return a}var q,e,a,g=!1,d=!1,b="";this.setFocus=function(){g=!0;e.markAsFocussed(!0);f()};this.removeFocus=function(){g=!1;e.markAsFocussed(!1); +q.style.borderColor=b};this.setAvatarImageUrl=function(a){e.setImageUrl(a)};this.setColor=function(a){b!==a&&(b=a,"transparent"!==q.style.borderColor&&(q.style.borderColor=b),e.setColor(b))};this.getCursor=function(){return h};this.getFocusElement=function(){return q};this.toggleHandleVisibility=function(){e.isVisible()?e.hide():e.show()};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};this.ensureVisible=function(){var a,b,d,c,e,g,f,p=h.getOdtDocument().getOdfCanvas().getElement().parentNode; +e=f=q;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{e=e.parentElement;if(!e)break;g=d.getComputedStyle(e,null)}while("block"!==g.display);g=e;e=c=0;if(g&&p){b=!1;do{d=g.offsetParent;for(a=g.parentNode;a!==d;){if(a===p){a=g;var m=p,y=0;b=0;var v=void 0,x=runtime.getWindow();for(runtime.assert(null!==x,"Expected to be run in an environment which has a global window, like a browser.");a&&a!==m;)v=x.getComputedStyle(a, +null),y+=n(v.marginLeft)+n(v.borderLeftWidth)+n(v.paddingLeft),b+=n(v.marginTop)+n(v.borderTopWidth)+n(v.paddingTop),a=a.parentElement;a=y;c+=a;e+=b;b=!0;break}a=a.parentNode}if(b)break;c+=n(g.offsetLeft);e+=n(g.offsetTop);g=d}while(g&&g!==p);d=c;c=e}else c=d=0;d+=f.offsetLeft;c+=f.offsetTop;e=d-5;g=c-5;d=d+f.scrollWidth-1+5;f=c+f.scrollHeight-1+5;gp.scrollTop+p.clientHeight-1&&(p.scrollTop=f-p.clientHeight+1);ep.scrollLeft+p.clientWidth- +1&&(p.scrollLeft=d-p.clientWidth+1)};(function(){var b=h.getOdtDocument().getDOM();q=b.createElementNS(b.documentElement.namespaceURI,"span");a=h.getNode();a.appendChild(q);e=new gui.Avatar(a,m)})()}; // Input 58 runtime.loadClass("core.EventNotifier"); -gui.ClickHandler=function(){function h(){f=0;q=null}var l,f=0,q=null,p=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(f,a){p.subscribe(f,a)};this.handleMouseUp=function(g){var a=runtime.getWindow();q&&q.x===g.screenX&&q.y===g.screenY?(f+=1,1===f?p.emit(gui.ClickHandler.signalSingleClick,void 0):2===f?p.emit(gui.ClickHandler.signalDoubleClick,void 0):3===f&&(a.clearTimeout(l),p.emit(gui.ClickHandler.signalTripleClick, -void 0),h())):(p.emit(gui.ClickHandler.signalSingleClick,void 0),f=1,q={x:g.screenX,y:g.screenY},a.clearTimeout(l),l=a.setTimeout(h,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); +gui.ClickHandler=function(){function h(){f=0;n=null}var m,f=0,n=null,q=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(e,a){q.subscribe(e,a)};this.handleMouseUp=function(e){var a=runtime.getWindow();n&&n.x===e.screenX&&n.y===e.screenY?(f+=1,1===f?q.emit(gui.ClickHandler.signalSingleClick,void 0):2===f?q.emit(gui.ClickHandler.signalDoubleClick,void 0):3===f&&(a.clearTimeout(m),q.emit(gui.ClickHandler.signalTripleClick, +void 0),h())):(q.emit(gui.ClickHandler.signalSingleClick,void 0),f=1,n={x:e.screenX,y:e.screenY},a.clearTimeout(m),m=a.setTimeout(h,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); // Input 59 /* @@ -1464,32 +1464,32 @@ void 0),h())):(p.emit(gui.ClickHandler.signalSingleClick,void 0),f=1,q={x:g.scre @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.KeyboardHandler=function(){function h(f,g){g||(g=g.None);return f+":"+g}var l=gui.KeyboardHandler.Modifier,f=null,q={};this.setDefault=function(h){f=h};this.bind=function(f,g,a){f=h(f,g);runtime.assert(!1===q.hasOwnProperty(f),"tried to overwrite the callback handler of key combo: "+f);q[f]=a};this.unbind=function(f,g){var a=h(f,g);delete q[a]};this.reset=function(){f=null;q={}};this.handleEvent=function(p){var g=p.keyCode,a=l.None;p.metaKey&&(a|=l.Meta);p.ctrlKey&&(a|=l.Ctrl);p.altKey&&(a|=l.Alt); -p.shiftKey&&(a|=l.Shift);g=h(g,a);g=q[g];a=!1;g?a=g():null!==f&&(a=f(p));a&&(p.preventDefault?p.preventDefault():p.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,Z:90};(function(){return gui.KeyboardHandler})(); +gui.KeyboardHandler=function(){function h(f,e){e||(e=e.None);return f+":"+e}var m=gui.KeyboardHandler.Modifier,f=null,n={};this.setDefault=function(h){f=h};this.bind=function(f,e,a){f=h(f,e);runtime.assert(!1===n.hasOwnProperty(f),"tried to overwrite the callback handler of key combo: "+f);n[f]=a};this.unbind=function(f,e){var a=h(f,e);delete n[a]};this.reset=function(){f=null;n={}};this.handleEvent=function(q){var e=q.keyCode,a=m.None;q.metaKey&&(a|=m.Meta);q.ctrlKey&&(a|=m.Ctrl);q.altKey&&(a|=m.Alt); +q.shiftKey&&(a|=m.Shift);e=h(e,a);e=n[e];a=!1;e?a=e():null!==f&&(a=f(q));a&&(q.preventDefault?q.preventDefault():q.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,Z:90};(function(){return gui.KeyboardHandler})(); // Input 60 -gui.Clipboard=function(){this.setDataFromRange=function(h,l){var f=!0,q,p=h.clipboardData,g=runtime.getWindow(),a,e;!p&&g&&(p=g.clipboardData);p?(g=new XMLSerializer,a=runtime.getDOMImplementation().createDocument("","",null),q=a.importNode(l.cloneContents(),!0),e=a.createElement("span"),e.appendChild(q),a.appendChild(e),q=p.setData("text/plain",l.toString()),f=f&&q,q=p.setData("text/html",g.serializeToString(a)),f=f&&q,h.preventDefault()):f=!1;return f}};(function(){return gui.Clipboard})(); +gui.Clipboard=function(){this.setDataFromRange=function(h,m){var f=!0,n,q=h.clipboardData,e=runtime.getWindow(),a,g;!q&&e&&(q=e.clipboardData);q?(e=new XMLSerializer,a=runtime.getDOMImplementation().createDocument("","",null),n=a.importNode(m.cloneContents(),!0),g=a.createElement("span"),g.appendChild(n),a.appendChild(g),n=q.setData("text/plain",m.toString()),f=f&&n,n=q.setData("text/html",e.serializeToString(a)),f=f&&n,h.preventDefault()):f=!1;return f}};(function(){return gui.Clipboard})(); // Input 61 runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("gui.ClickHandler");runtime.loadClass("gui.KeyboardHandler");runtime.loadClass("gui.Clipboard"); -gui.SessionController=function(){gui.SessionController=function(h,l){function f(a,b,c,d){var e="on"+b,f=!1;a.attachEvent&&(f=a.attachEvent(e,c));!f&&a.addEventListener&&(a.addEventListener(b,c,!1),f=!0);f&&!d||!a.hasOwnProperty(e)||(a[e]=c)}function q(a,b,c){var d="on"+b;a.detachEvent&&a.detachEvent(d,c);a.removeEventListener&&a.removeEventListener(b,c,!1);a[d]===c&&(a[d]=null)}function p(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function g(a,b){var c=new ops.OpMoveCursor;c.init({memberid:l, -position:a,length:b||0});return c}function a(a,b){var c=gui.SelectionMover.createPositionIterator(v.getRootNode()),d=v.getOdfCanvas().getElement(),e;if(e=a){for(;e!==d&&!("urn:webodf:names:cursor"===e.namespaceURI&&"cursor"===e.localName||"urn:webodf:names:editinfo"===e.namespaceURI&&"editinfo"===e.localName);)if(e=e.parentNode,!e)return;e!==d&&a!==e&&(a=e.parentNode,b=Array.prototype.indexOf.call(a.childNodes,e));c.setUnfilteredPosition(a,b);return v.getDistanceFromCursor(l,c.container(),c.unfilteredDomOffset())}} -function e(){var b=runtime.getWindow().getSelection(),c=v.getCursorPosition(l),d;d=a(b.anchorNode,b.anchorOffset);b=a(b.focusNode,b.focusOffset);if(0!==b||0!==d)c=g(c+d,b-d),h.enqueue(c)}function d(){var a=gui.SelectionMover.createPositionIterator(v.getRootNode()),b=v.getCursor(l).getNode(),c=v.getCursorPosition(l),d=/[A-Za-z0-9]/,e=0,f=0,k,n,m;a.setUnfilteredPosition(b,0);if(a.previousPosition()&&(k=a.getCurrentNode(),k.nodeType===Node.TEXT_NODE))for(n=k.data.length-1;0<=n;n-=1)if(m=k.data[n],d.test(m))e-= -1;else break;a.setUnfilteredPosition(b,0);if(a.nextPosition()&&(k=a.getCurrentNode(),k.nodeType===Node.TEXT_NODE))for(n=0;na.length&&(a.position+=a.length,a.length=-a.length);return a}function U(a){var b=new ops.OpRemoveText;b.init({memberid:l,position:a.position,length:a.length});return b}function W(){var a=ca(v.getCursorSelection(l)),b=null;0===a.length?0a.length&&(a.position+=a.length,a.length=-a.length);return a}function U(a){var b=new ops.OpRemoveText;b.init({memberid:m,position:a.position,length:a.length});return b}function W(){var a=ca(w.getCursorSelection(m)),b=null;0===a.length?0m?(f(1,0),e=f(0.5,1E4-m),d=f(0.2,2E4-m)):1E4<=m&&2E4>m?(f(0.5,0),d=f(0.2,2E4-m)):f(0.2,0)};this.getEdits=function(){return h.getEdits()};this.clearEdits=function(){h.clearEdits(); -g.setEdits([]);a.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&a.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return h};this.show=function(){a.style.display="block"};this.hide=function(){q.hideHandle();a.style.display="none"};this.showHandle=function(){g.show()};this.hideHandle=function(){g.hide()};(function(){var b=h.getOdtDocument().getDOM();a=b.createElementNS(b.documentElement.namespaceURI,"div");a.setAttribute("class","editInfoMarker"); -a.onmouseover=function(){q.showHandle()};a.onmouseout=function(){q.hideHandle()};p=h.getNode();p.appendChild(a);g=new gui.EditInfoHandle(p);l||q.hide()})()}; +gui.EditInfoMarker=function(h,m){function f(b,d){return window.setTimeout(function(){a.style.opacity=b},d)}var n=this,q,e,a,g,d;this.addEdit=function(b,m){var k=Date.now()-m;h.addEdit(b,m);e.setEdits(h.getSortedEdits());a.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",b);g&&window.clearTimeout(g);d&&window.clearTimeout(d);1E4>k?(f(1,0),g=f(0.5,1E4-k),d=f(0.2,2E4-k)):1E4<=k&&2E4>k?(f(0.5,0),d=f(0.2,2E4-k)):f(0.2,0)};this.getEdits=function(){return h.getEdits()};this.clearEdits=function(){h.clearEdits(); +e.setEdits([]);a.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&a.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return h};this.show=function(){a.style.display="block"};this.hide=function(){n.hideHandle();a.style.display="none"};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};(function(){var b=h.getOdtDocument().getDOM();a=b.createElementNS(b.documentElement.namespaceURI,"div");a.setAttribute("class","editInfoMarker"); +a.onmouseover=function(){n.showHandle()};a.onmouseout=function(){n.hideHandle()};q=h.getNode();q.appendChild(a);e=new gui.EditInfoHandle(q);m||n.hide()})()}; // Input 72 /* @@ -1731,12 +1731,12 @@ a.onmouseover=function(){q.showHandle()};a.onmouseout=function(){q.hideHandle()} @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoMarker"); -gui.SessionView=function(){return function(h,l,f){function q(a,b,c){c=c.split("___")[0];return a+"."+b+'[editinfo|memberid^="'+c+'"]'}function p(a,b,c){function d(b,c,e){e=q(b,c,a)+e;a:{var f=m.firstChild;for(b=q(b,c,a);f;){if(f.nodeType===Node.TEXT_NODE&&0===f.data.indexOf(b)){b=f;break a}f=f.nextSibling}b=null}b?b.data=e:m.appendChild(document.createTextNode(e))}d("div","editInfoMarker","{ background-color: "+c+"; }");d("span","editInfoColor","{ background-color: "+c+"; }");d("span","editInfoAuthor", -':before { content: "'+b+'"; }')}function g(a){var b,c;for(c in k)k.hasOwnProperty(c)&&(b=k[c],a?b.show():b.hide())}function a(a){var b,c;for(c in s)s.hasOwnProperty(c)&&(b=s[c],a?b.showHandle():b.hideHandle())}function e(a,b){var c=s[a];void 0===b?runtime.log('UserModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),c&&(c.setAvatarImageUrl(b.imageurl),c.setColor(b.color)),p(a,b.fullname,b.color))}function d(a){var b= -f.createCaret(a,t);a=a.getMemberId();var c=l.getUserModel();s[a]=b;e(a,null);c.getUserDetailsAndUpdates(a,e);runtime.log("+++ View here +++ eagerly created an Caret for '"+a+"'! +++")}function b(a){var b=!1,c;delete s[a];for(c in k)if(k.hasOwnProperty(c)&&k[c].getEditInfo().getEdits().hasOwnProperty(a)){b=!0;break}b||l.getUserModel().unsubscribeUserDetailsUpdates(a,e)}var s={},m,k={},c=void 0!==h.editInfoMarkersInitiallyVisible?h.editInfoMarkersInitiallyVisible:!0,t=void 0!==h.caretAvatarsInitiallyVisible? -h.caretAvatarsInitiallyVisible:!0;this.showEditInfoMarkers=function(){c||(c=!0,g(c))};this.hideEditInfoMarkers=function(){c&&(c=!1,g(c))};this.showCaretAvatars=function(){t||(t=!0,a(t))};this.hideCaretAvatars=function(){t&&(t=!1,a(t))};this.getSession=function(){return l};this.getCaret=function(a){return s[a]};(function(){var a=l.getOdtDocument(),e=document.getElementsByTagName("head")[0];a.subscribe(ops.OdtDocument.signalCursorAdded,d);a.subscribe(ops.OdtDocument.signalCursorRemoved,b);a.subscribe(ops.OdtDocument.signalParagraphChanged, -function(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];g?(f=g.getAttributeNS("urn:webodf:names:editinfo","id"),e=k[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,l.getOdtDocument()),e=new gui.EditInfoMarker(e,c),g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],g.setAttributeNS("urn:webodf:names:editinfo","id",f),k[f]=e);e.addEdit(d,new Date(a))});m=document.createElementNS(e.namespaceURI, -"style");m.type="text/css";m.media="screen, print, handheld, projection";m.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));e.appendChild(m)})()}}(); +gui.SessionView=function(){return function(h,m,f){function n(a,b,c){c=c.split("___")[0];return a+"."+b+'[editinfo|memberid^="'+c+'"]'}function q(a,b,c){function d(b,c,e){e=n(b,c,a)+e;a:{var f=k.firstChild;for(b=n(b,c,a);f;){if(f.nodeType===Node.TEXT_NODE&&0===f.data.indexOf(b)){b=f;break a}f=f.nextSibling}b=null}b?b.data=e:k.appendChild(document.createTextNode(e))}d("div","editInfoMarker","{ background-color: "+c+"; }");d("span","editInfoColor","{ background-color: "+c+"; }");d("span","editInfoAuthor", +':before { content: "'+b+'"; }')}function e(a){var b,c;for(c in l)l.hasOwnProperty(c)&&(b=l[c],a?b.show():b.hide())}function a(a){var b,c;for(c in r)r.hasOwnProperty(c)&&(b=r[c],a?b.showHandle():b.hideHandle())}function g(a,b){var c=r[a];void 0===b?runtime.log('UserModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),c&&(c.setAvatarImageUrl(b.imageurl),c.setColor(b.color)),q(a,b.fullname,b.color))}function d(a){var b= +f.createCaret(a,u);a=a.getMemberId();var c=m.getUserModel();r[a]=b;g(a,null);c.getUserDetailsAndUpdates(a,g);runtime.log("+++ View here +++ eagerly created an Caret for '"+a+"'! +++")}function b(a){var b=!1,c;delete r[a];for(c in l)if(l.hasOwnProperty(c)&&l[c].getEditInfo().getEdits().hasOwnProperty(a)){b=!0;break}b||m.getUserModel().unsubscribeUserDetailsUpdates(a,g)}var r={},k,l={},c=void 0!==h.editInfoMarkersInitiallyVisible?h.editInfoMarkersInitiallyVisible:!0,u=void 0!==h.caretAvatarsInitiallyVisible? +h.caretAvatarsInitiallyVisible:!0;this.showEditInfoMarkers=function(){c||(c=!0,e(c))};this.hideEditInfoMarkers=function(){c&&(c=!1,e(c))};this.showCaretAvatars=function(){u||(u=!0,a(u))};this.hideCaretAvatars=function(){u&&(u=!1,a(u))};this.getSession=function(){return m};this.getCaret=function(a){return r[a]};(function(){var a=m.getOdtDocument(),e=document.getElementsByTagName("head")[0];a.subscribe(ops.OdtDocument.signalCursorAdded,d);a.subscribe(ops.OdtDocument.signalCursorRemoved,b);a.subscribe(ops.OdtDocument.signalParagraphChanged, +function(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];g?(f=g.getAttributeNS("urn:webodf:names:editinfo","id"),e=l[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,m.getOdtDocument()),e=new gui.EditInfoMarker(e,c),g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],g.setAttributeNS("urn:webodf:names:editinfo","id",f),l[f]=e);e.addEdit(d,new Date(a))});k=document.createElementNS(e.namespaceURI, +"style");k.type="text/css";k.media="screen, print, handheld, projection";k.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));e.appendChild(k)})()}}(); // Input 73 /* @@ -1772,24 +1772,24 @@ function(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",g=b.g @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -runtime.loadClass("gui.Caret");gui.CaretFactory=function(h){this.createCaret=function(l,f){var q=l.getMemberId(),p=h.getSession().getOdtDocument(),g=p.getOdfCanvas().getElement(),a=new gui.Caret(l,f);q===h.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+q),p.subscribe(ops.OdtDocument.signalParagraphChanged,function(e){e.memberId===q&&a.ensureVisible()}),l.handleUpdate=a.ensureVisible,g.setAttribute("tabindex",0),g.onfocus=a.setFocus,g.onblur=a.removeFocus,g.focus());return a}}; +runtime.loadClass("gui.Caret");gui.CaretFactory=function(h){this.createCaret=function(m,f){var n=m.getMemberId(),q=h.getSession().getOdtDocument(),e=q.getOdfCanvas().getElement(),a=new gui.Caret(m,f);n===h.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+n),q.subscribe(ops.OdtDocument.signalParagraphChanged,function(e){e.memberId===n&&a.ensureVisible()}),m.handleUpdate=a.ensureVisible,e.setAttribute("tabindex",0),e.onfocus=a.setFocus,e.onblur=a.removeFocus,e.focus());return a}}; // Input 74 runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Namespaces"); -gui.PresenterUI=function(){var h=new xmldom.XPath;return function(l){var f=this;f.setInitialSlideMode=function(){f.startSlideMode("single")};f.keyDownHandler=function(h){if(!h.target.isContentEditable&&"input"!==h.target.nodeName)switch(h.keyCode){case 84:f.toggleToolbar();break;case 37:case 8:f.prevSlide();break;case 39:case 32:f.nextSlide();break;case 36:f.firstSlide();break;case 35:f.lastSlide()}};f.root=function(){return f.odf_canvas.odfContainer().rootElement};f.firstSlide=function(){f.slideChange(function(f, -h){return 0})};f.lastSlide=function(){f.slideChange(function(f,h){return h-1})};f.nextSlide=function(){f.slideChange(function(f,h){return f+1f?-1:f-1})};f.slideChange=function(h){var l=f.getPages(f.odf_canvas.odfContainer().rootElement),g=-1,a=0;l.forEach(function(e){e=e[1];e.hasAttribute("slide_current")&&(g=a,e.removeAttribute("slide_current"));a+=1});h=h(g,l.length);-1===h&&(h=g);l[h][1].setAttribute("slide_current","1"); -document.getElementById("pagelist").selectedIndex=h;"cont"===f.slide_mode&&window.scrollBy(0,l[h][1].getBoundingClientRect().top-30)};f.selectSlide=function(h){f.slideChange(function(f,g){return h>=g||0>h?-1:h})};f.scrollIntoContView=function(h){var l=f.getPages(f.odf_canvas.odfContainer().rootElement);0!==l.length&&window.scrollBy(0,l[h][1].getBoundingClientRect().top-30)};f.getPages=function(f){f=f.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var h=[],g;for(g=0;gf?-1:f-1})};f.slideChange=function(h){var m=f.getPages(f.odf_canvas.odfContainer().rootElement),e=-1,a=0;m.forEach(function(f){f=f[1];f.hasAttribute("slide_current")&&(e=a,f.removeAttribute("slide_current"));a+=1});h=h(e,m.length);-1===h&&(h=e);m[h][1].setAttribute("slide_current","1"); +document.getElementById("pagelist").selectedIndex=h;"cont"===f.slide_mode&&window.scrollBy(0,m[h][1].getBoundingClientRect().top-30)};f.selectSlide=function(h){f.slideChange(function(f,e){return h>=e||0>h?-1:h})};f.scrollIntoContView=function(h){var m=f.getPages(f.odf_canvas.odfContainer().rootElement);0!==m.length&&window.scrollBy(0,m[h][1].getBoundingClientRect().top-30)};f.getPages=function(f){f=f.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var h=[],e;for(e=0;e=a.rangeCount||!r)||(a=a.getRangeAt(0),r.setPoint(a.startContainer,a.startOffset))}function g(){var a=h.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();r&&r.node()&&(b=r.node(),c=b.ownerDocument.createRange(), -c.setStart(b,r.position()),c.collapse(!0),a.addRange(c))}function a(a){var b=a.charCode||a.keyCode;if(r=null,r&&37===b)p(),r.stepBackward(),g();else if(16<=b&&20>=b||33<=b&&40>=b)return;q(a)}function e(a){}function d(a){h.ownerDocument.defaultView.getSelection().getRangeAt(0);q(a)}function b(a){for(var c=a.firstChild;c&&c!==a;)c.nodeType===Node.ELEMENT_NODE&&b(c),c=c.nextSibling||c.parentNode;var d,e,f,c=a.attributes;d="";for(f=c.length-1;0<=f;f-=1)e=c.item(f),d=d+" "+e.nodeName+'="'+e.nodeValue+ -'"';a.setAttribute("customns_name",a.nodeName);a.setAttribute("customns_atts",d);c=a.firstChild;for(e=/^\s*$/;c&&c!==a;)d=c,c=c.nextSibling||c.parentNode,d.nodeType===Node.TEXT_NODE&&e.test(d.nodeValue)&&d.parentNode.removeChild(d)}function s(a,b){for(var c=a.firstChild,d,e,f;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(s(c,b),d=c.attributes,f=d.length-1;0<=f;f-=1)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 m(){var a=h.ownerDocument.createElement("style"),b;b={};s(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"+k;a.appendChild(h.ownerDocument.createTextNode(b));l=l.parentNode.replaceChild(a,l)}var k,c,t,r=null;h.id||(h.id="xml"+String(Math.random()).substring(2));c="#"+h.id+" ";k=c+"*,"+c+":visited, "+c+":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"+ -c+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+c+":after {color: blue; content: '';}\n"+c+"{overflow: auto;}\n";(function(b){f(b,"click",d);f(b,"keydown",a);f(b,"keypress",e);f(b,"drop",q);f(b,"dragend",q);f(b,"beforepaste",q);f(b,"paste",q)})(h);this.updateCSS=m;this.setXML=function(a){a=a.documentElement||a;t=a=h.ownerDocument.importNode(a,!0);for(b(a);h.lastChild;)h.removeChild(h.lastChild);h.appendChild(a);m();r=new core.PositionIterator(a)}; -this.getXML=function(){return t}}; +gui.XMLEdit=function(h,m){function f(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function n(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function q(){var a=h.ownerDocument.defaultView.getSelection();!a||(0>=a.rangeCount||!t)||(a=a.getRangeAt(0),t.setPoint(a.startContainer,a.startOffset))}function e(){var a=h.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();t&&t.node()&&(b=t.node(),c=b.ownerDocument.createRange(), +c.setStart(b,t.position()),c.collapse(!0),a.addRange(c))}function a(a){var b=a.charCode||a.keyCode;if(t=null,t&&37===b)q(),t.stepBackward(),e();else if(16<=b&&20>=b||33<=b&&40>=b)return;n(a)}function g(a){}function d(a){h.ownerDocument.defaultView.getSelection().getRangeAt(0);n(a)}function b(a){for(var c=a.firstChild;c&&c!==a;)c.nodeType===Node.ELEMENT_NODE&&b(c),c=c.nextSibling||c.parentNode;var d,e,f,c=a.attributes;d="";for(f=c.length-1;0<=f;f-=1)e=c.item(f),d=d+" "+e.nodeName+'="'+e.nodeValue+ +'"';a.setAttribute("customns_name",a.nodeName);a.setAttribute("customns_atts",d);c=a.firstChild;for(e=/^\s*$/;c&&c!==a;)d=c,c=c.nextSibling||c.parentNode,d.nodeType===Node.TEXT_NODE&&e.test(d.nodeValue)&&d.parentNode.removeChild(d)}function r(a,b){for(var c=a.firstChild,d,e,f;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(r(c,b),d=c.attributes,f=d.length-1;0<=f;f-=1)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 k(){var a=h.ownerDocument.createElement("style"),b;b={};r(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"+l;a.appendChild(h.ownerDocument.createTextNode(b));m=m.parentNode.replaceChild(a,m)}var l,c,u,t=null;h.id||(h.id="xml"+String(Math.random()).substring(2));c="#"+h.id+" ";l=c+"*,"+c+":visited, "+c+":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"+ +c+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+c+":after {color: blue; content: '';}\n"+c+"{overflow: auto;}\n";(function(b){f(b,"click",d);f(b,"keydown",a);f(b,"keypress",g);f(b,"drop",n);f(b,"dragend",n);f(b,"beforepaste",n);f(b,"paste",n)})(h);this.updateCSS=k;this.setXML=function(a){a=a.documentElement||a;u=a=h.ownerDocument.importNode(a,!0);for(b(a);h.lastChild;)h.removeChild(h.lastChild);h.appendChild(a);k();t=new core.PositionIterator(a)}; +this.getXML=function(){return u}}; // Input 76 /* @@ -1825,7 +1825,7 @@ this.getXML=function(){return t}}; @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(h,l){};gui.UndoManager.prototype.unsubscribe=function(h,l){};gui.UndoManager.prototype.setOdtDocument=function(h){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(h){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; +gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(h,m){};gui.UndoManager.prototype.unsubscribe=function(h,m){};gui.UndoManager.prototype.setOdtDocument=function(h){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(h){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; gui.UndoManager.prototype.moveForward=function(h){};gui.UndoManager.prototype.moveBackward=function(h){};gui.UndoManager.prototype.onOperationExecuted=function(h){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";(function(){return gui.UndoManager})(); // Input 77 /* @@ -1862,8 +1862,8 @@ gui.UndoManager.prototype.moveForward=function(h){};gui.UndoManager.prototype.mo @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.UndoStateRules=function(){function h(f){return f.spec().optype}function l(f){switch(h(f)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=h;this.isEditOperation=l;this.isPartOfOperationSet=function(f,q){if(l(f)){if(0===q.length)return!0;var p;if(p=l(q[q.length-1]))a:{p=q.filter(l);var g=h(f),a;b:switch(g){case "RemoveText":case "InsertText":a=!0;break b;default:a=!1}if(a&&g===h(p[0])){if(1===p.length){p=!0;break a}g=p[p.length-2].spec().position; -p=p[p.length-1].spec().position;a=f.spec().position;if(p===a-(p-g)){p=!0;break a}}p=!1}return p}return!0}}; +gui.UndoStateRules=function(){function h(f){return f.spec().optype}function m(f){switch(h(f)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=h;this.isEditOperation=m;this.isPartOfOperationSet=function(f,n){if(m(f)){if(0===n.length)return!0;var q;if(q=m(n[n.length-1]))a:{q=n.filter(m);var e=h(f),a;b:switch(e){case "RemoveText":case "InsertText":a=!0;break b;default:a=!1}if(a&&e===h(q[0])){if(1===q.length){q=!0;break a}e=q[q.length-2].spec().position; +q=q[q.length-1].spec().position;a=f.spec().position;if(q===a-(q-e)){q=!0;break a}}q=!1}return q}return!0}}; // Input 78 /* @@ -1900,10 +1900,10 @@ p=p[p.length-1].spec().position;a=f.spec().position;if(p===a-(p-g)){p=!0;break a @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("gui.UndoManager");runtime.loadClass("gui.UndoStateRules"); -gui.TrivialUndoManager=function(h){function l(){m.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:q.hasUndoStates(),redoAvailable:q.hasRedoStates()})}function f(){d!==g&&d!==b[b.length-1]&&b.push(d)}var q=this,p,g,a,e,d=[],b=[],s=[],m=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged,gui.UndoManager.signalUndoStateCreated,gui.UndoManager.signalUndoStateModified,gui.TrivialUndoManager.signalDocumentRootReplaced]),k=h||new gui.UndoStateRules;this.subscribe=function(a,b){m.subscribe(a, -b)};this.unsubscribe=function(a,b){m.unsubscribe(a,b)};this.hasUndoStates=function(){return 0=e;e+=1)c=a.container(),d=a.unfilteredDomOffset(),c.nodeType===Node.TEXT_NODE&&(" "===c.data[d]&&b.isSignificantWhitespace(c,d))&&g(c,d),a.nextPosition()};this.getParagraphStyleElement=p;this.getParagraphElement=q;this.getParagraphStyleAttributes= -function(a){return(a=p(a))?h.getFormatting().getInheritedStyleAttributes(a):null};this.getPositionInTextNode=function(a,b){var e=gui.SelectionMover.createPositionIterator(l()),f=null,g,h=0,m=null;runtime.assert(0<=a,"position must be >= 0");1===d.acceptPosition(e)?(g=e.container(),g.nodeType===Node.TEXT_NODE&&(f=g,h=0)):a+=1;for(;0=g;g+=1)c=a.container(),d=a.unfilteredDomOffset(),c.nodeType===Node.TEXT_NODE&&(" "===c.data[d]&&b.isSignificantWhitespace(c,d))&&e(c,d),a.nextPosition()};this.getParagraphStyleElement=q;this.getParagraphElement=n;this.getParagraphStyleAttributes= +function(a){return(a=q(a))?h.getFormatting().getInheritedStyleAttributes(a):null};this.getPositionInTextNode=function(a,b){var e=gui.SelectionMover.createPositionIterator(m()),f=null,g,h=0,k=null;runtime.assert(0<=a,"position must be >= 0");1===d.acceptPosition(e)?(g=e.container(),g.nodeType===Node.TEXT_NODE&&(f=g,h=0)):a+=1;for(;0 draw|image:nth-of-type(n+2) {\n display: none;\n}\ntext|list:before {\n display: none;\n content:\"\";\n}\ntext|list {\n counter-reset: list;\n}\ntext|list-item {\n display: block;\n}\ntext|number {\n display:none;\n}\n\ntext|a {\n color: blue;\n text-decoration: underline;\n cursor: pointer;\n}\ntext|note-citation {\n vertical-align: super;\n font-size: smaller;\n}\ntext|note-body {\n display: none;\n}\ntext|note:hover text|note-citation {\n background: #dddddd;\n}\ntext|note:hover text|note-body {\n display: block;\n left:1em;\n max-width: 80%;\n position: absolute;\n background: #ffffaa;\n}\nsvg|title, svg|desc {\n display: none;\n}\nvideo {\n width: 100%;\n height: 100%\n}\n\n/* below set up the cursor */\ncursor|cursor {\n display: inline;\n width: 0px;\n height: 1em;\n /* making the position relative enables the avatar to use\n the cursor as reference for its absolute position */\n position: relative;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n height: 1em;\n border-left: 2px solid black;\n outline: none;\n}\n\ncursor|cursor > div {\n padding: 3px;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n border: none !important;\n border-radius: 5px;\n opacity: 0.3;\n}\n\ncursor|cursor > div > img {\n border-radius: 5px;\n}\n\ncursor|cursor > div.active {\n opacity: 0.8;\n}\n\ncursor|cursor > div:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n";