text: /* YeAPF 0.8.57-15 built on 2017-05-18 18:44 (-3 DST) Copyright (C) 2004-2017 Esteban Daniel Dortta - dortta@yahoo.com */
  (function(){window.ystorage||(window.ystorage=function(){var e=[],g={};Object.defineProperty(g,"getItem",{value:function(a){return a?this[a]:null},writable:!1,configurable:!1,enumerable:!1});Object.defineProperty(g,"key",{value:function(a){return e[a]},writable:!1,configurable:!1,enumerable:!1});Object.defineProperty(g,"setItem",{value:function(a,b){a&&(document.cookie=escape(a)+"="+escape(b)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")},writable:!1,configurable:!1,enumerable:!1});Object.defineProperty(g,
  "length",{get:function(){return e.length},configurable:!1,enumerable:!1});Object.defineProperty(g,"removeItem",{value:function(a){a&&(document.cookie=escape(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")},writable:!1,configurable:!1,enumerable:!1});this.get=function(){var a,b;for(b in g)a=e.indexOf(b),-1===a?g.setItem(b,g[b]):e.splice(a,1),delete g[b];for(;0<e.length;e.splice(0,1))g.removeItem(e[0]);for(var c=0,d=document.cookie.split(/\s*;\s*/);c<d.length;c++)a=d[c].split(/\s*=\s*/),1<a.length&&
  (g[b=unescape(a[0])]=unescape(a[1]),e.push(b));return g};this.configurable=!1;this.enumerable=!0}());window.ySingleDb||(console.log("Creating ySingleDb ... "),window.ySingleDb=function(e,g){var a={_list:null,toBinArray:function(a){for(var c=(a||"").length,d=new Uint8Array(c),f=0;f<c;f++)d[f]=a.charCodeAt(f);return d},toBinString:function(a){a=new Uint8Array(a);for(var c=[],d=0;65535*d<a.length;d++)c.push(String.fromCharCode.apply(null,a.subarray(65535*d,65535*(d+1))));return c.join("")},setItem:function(b,
  c,d){b=String(b);c._id=c._id||generateUUID();c._ts_update=(new Date).getTime()/1E3;if(isArray(d)){var f=a.getItem(b);if(!isEmpty(f))for(var h=0;h<d.length;h++)"undefined"!==typeof f[d[h]]&&(c[d[h]]=f[d[h]])}if(c._linked){for(h=0;h<c._linked.length;h++)delete c[c._linked[h]];delete c._linked}for(var e in c)c.hasOwnProperty(e)&&"_"!=e.substr(0,1)&&isArray(c[e])&&(c[e]=JSON.stringify(c[e]));localStorage.setItem(a._dbTag_+"_item_"+b,JSON.stringify(c));-1==a._list.indexOf(b)&&(a._list[a._list.length]=
  b,localStorage.setItem(a._dbTag_+"_list",JSON.stringify(a._list)))},setBinItem:function(b,c,d){a.setItem(b,a.toBinString(c),d)},getItem:function(b){b=String(b);b=localStorage.getItem(a._dbTag_+"_item_"+b);b=JSON.parse(b||"{}");if(!isEmpty(b)&&isArray(a._siblingDB)){var c;b._linked=[];for(var d=0;d<a._siblingDB.length;d++){c=a._siblingDB[d].db.getItem(b[a._siblingDB[d].linkage]);for(var f in c)b._linked=[],c.hasOwnProperty(f)&&"undefined"==typeof b[f]&&(b[f]=c[f],b._linked.push(f))}}return b},getBinItem:function(b){return a.toBinArray(a.getItem(b))},
  getList:function(){return a._list||[]},linkTo:function(b,c){b&&b.getItem?"undefined"==typeof c&&(b=null):b=c=null;if(b){var d={db:b,linkage:c||null};a._siblingDB=a._siblingDB||[];a._siblingDB.push(d)}},filter:function(b,c,d,f){if("function"==typeof b){d=yLexObj(d||!0);d.parse();var h,e=a.getList(),k,g;for(h=0;h<e.length;h++)if(k=a.getItem(e[h]),g=d.solve(k))b(k),f&&(h=e.length+1)}"function"==typeof c&&c()},each:function(b,c,d,f){var e=function(a,b){b=String(b).split(" ");var c=!0,d,f;for(d in b)f=
  trim(b[d]),c=isNumber(f)&&isNumber(a)?c&&parseFloat(f)===parseFloat(a):c&&0<=(""+a).toUpperCase().indexOf(f.toUpperCase());return c},g,k=a.getList(),m,l;for(g=0;g<k.length;g++)if("function"==typeof b){m=a.getItem(k[g]);l="undefined"==typeof d;if(!l)if("string"==typeof d)l=e(m[a.cfg.keyName],d);else if("object"==typeof d){l=!0;for(var n in d)d.hasOwnProperty(n)&&(l="undefined"!==typeof m[n]?l&&e(m[n],d[n]):!1)}l&&(b(m),f&&(g=k.length+1))}"function"==typeof c&&c()},insertData:function(b,c){for(var d in b)b.hasOwnProperty(d)&&
  a.setItem(b[d][a._keyName_],b[d],c)},count:function(b){var c=0;a.each(function(){c++},null,b);return c},extractData:function(b,c){var d=[];a.each(function(a){d[d.length]=a},function(){b(d)},c)},fillList:function(b,c,d,f){c=c||"id";d&&a.cleanList();for(d=0;d<b.length;d++)b[d][c]&&a.setItem(b[d][c],b,f)},removeItem:function(b,c){if(("undefined"!==typeof c?c:1)&&"function"==typeof a.onremove)a.onremove(a.getItem(b));localStorage.removeItem(a._dbTag_+"_item_"+b);var d=a._list.indexOf(String(b));-1<d&&
  (a._list.splice(d,1),localStorage.setItem(a._dbTag_+"_list",JSON.stringify(a._list)))},removeItems:function(b,c){c="undefined"!==typeof c?c:!0;a.extractData(function(b){for(var f in b)b.hasOwnProperty(f)&&a.removeItem(b[f][a._keyName_],c)},b)},eliminateItem:function(b){a.removeItem(b,!1)},eliminateItems:function(b){a.removeItems(b,!1)},cleanList:function(b){b="undefined"!==typeof b?b:!0;var c=[],d=0,f;for(f in a._list)c[d++]=a._list[f];for(d=0;d<c.length;d++)a.removeItem(c[d],b)},blankList:function(){a.cleanList(!1)},
  init:function(b,c){a._dbTag_=b;a._keyName_=c||"_id";console.log("ystorage: creating "+b);a._list=localStorage.getItem(a._dbTag_+"_list");"string"==typeof a._list&&(a._list=JSON&&JSON.parse(a._list)||[]);a._list=a._list||[];return a}};return a.init(e,g)},console.log("ystorage ready!"));window.yServerWatcherObj||(window.yServerWatcherObj=function(e){var g={serverReady:function(a,b){var c=(new Date).getTime();ycomm.crave("sync","ping",null,function(d,f,e){200==d?0<parseInt(e.pong||0)&&(d=(new Date).getTime()-
  c,console.log("Server ready..."),console.log("Wasted time: {0}ms".format(d)),ycomm.wd_interval=4*d,"function"==typeof a&&a()):"function"==typeof b&&b(d,f)})},init:function(){ycomm.setDataLocation(e);g.serverReady(function(){console.log("Server ready!")});return g}};return g.init()});window.yInfoObj||(window.yInfoObj=function(e,g){var a={};if("object"==typeof e&&"string"==typeof e.dbName)return a.cfg={db:ySingleDb(e.dbName,e.keyName),garbage:ySingleDb(e.dbName+"_garbage",e.keyName),dbName:e.dbName,
  keyName:e.keyName,dataModified:0,onrecordcount:null,onprogress:null,oncomplete:null},a.onremove=function(b){b._ts_deletion=(new Date).getTime()/1E3;a.cfg.garbage.setItem(b._id,b);a.cfg.dataModified++},a.isbusy=function(){return a.busy},a.getItem=function(b){return a.cfg.db.getItem(b)},a.setItem=function(b,c,d){a.cfg.dataModified++;return a.cfg.db.setItem(b,c,d)},a.removeItem=function(b){return a.cfg.db.removeItem(b)},a.removeItems=function(b){return a.cfg.db.removeItems(b)},a.eliminateItem=function(b){return a.cfg.db.eliminateItem(b)},
  a.eliminateItems=function(b){return a.cfg.db.eliminateItems(b)},a.cleanList=function(){return a.cfg.db.cleanList()},a.blankList=function(){return a.cfg.db.blankList()},a.linkTo=function(b,c){return a.cfg.db.linkTo(b,c)},a.filter=function(b,c,d,f){return a.cfg.db.filter(b,c,d,f)},a.each=function(b,c,d,f){return a.cfg.db.each(b,c,d,f)},a.paint=a.each,a.count=function(b){return a.cfg.db.count(b)},a.extractData=function(b,c){var d=[];a.each(function(a){d[d.length]=a},function(){b(d)},c)},a.insertData=
  function(b,c){return a.cfg.db.insertData(b,c)},a.cleanCondition=function(){a.cfg.condition={}},a.setCondition=function(b){if("string"==typeof b){b=b.match(/\S+/g);var c,d="";for(c=0;c<b.length;c++)isNumber(b[c])||isOperator(b[c])||(b[c]="%("+b[c]+")"),d+=b[c]+" ";a.cfg.condition={_statement_:d}}else a.cfg.condition=b||{}},a.retrieveFromServer=function(b,c,d){var f=function(){var b={xq_start:a.cfg.xq_start,xq_collectionName:a.cfg.dbName},c=(new Date).getTime();mergeObject(a.cfg.condition,b);ycomm.crave("sync",
  "getDocumentInSequence",b,function(b,d,e){if(0<e.length){a.cfg.interleave.adjustRestTime(c);for(b=0;b<e.length;b++)if(a.setItem(e[b][a.cfg.keyName],e[b]),"function"==typeof a.cfg.onprogress)a.cfg.onprogress(a.cfg.dbName,e[b],a.cfg.xq_start+b);a.cfg.xq_start+=e.length;setTimeout(f,a.cfg.interleave.restTime)}else{if("function"==typeof a.cfg.oncomplete)a.cfg.oncomplete(a.cfg.dbName);a.busy=!1}})};if(a.busy)return console.warn("yInfoObj busy"),!1;a.busy=!0;a.cfg.onrecordcount=b||null;a.cfg.oncomplete=
  c||null;a.cfg.onprogress=d||null;a.server.serverReady(function(){ycomm.crave("sync","getRecordCount",a.cfg.condition,function(b,c,d){d=d||[];d[0]=d[0]||{};if("function"==typeof a.cfg.onrecordcount)a.cfg.onrecordcount(a.cfg.dbName,parseInt(d[0].CC||0));a.cfg.xq_start=0;f()})},function(a,b){console.log("Erro {0} ao tentar acessar o servidor: {1}".format(a,b.message))});return!0},a.templatedData=function(b){var c;if(a.cfg.dataTemplateEmpty)c=b;else{c={};for(var d in a.cfg.dataTemplate)a.cfg.dataTemplate.hasOwnProperty(d)&&
  (c[d]=b[d])}return c},a.sendToServer=function(b,c){if(a.busy)return console.warn("yInfoObj busy"),!1;a.busy=!0;a.cfg.onrecordcount=null;a.cfg.oncomplete=b||null;a.cfg.onprogress=c||null;var d=0;a.server.serverReady(function(){a.each(function(b){var c=a.templatedData(b);b._ts_upload=(new Date(b)).getTime()/1E3;mergeObject(a.cfg.condition,c);ycomm.crave("sync","setDocument",c,function(b,c,e){if(200==b&&"function"==typeof a.cfg.onprogress)a.cfg.onprogress(a.cfg.dbName,e[0],++d)})},function(){if("function"==
  typeof a.cfg.oncomplete)a.cfg.oncomplete(a.cfg.dbName);a.busy=!1},a.cfg.condition)},function(a,b){console.log("Erro {0} ao tentar acessar o servidor: {1}".format(a,b.message))});return!0},a.init=function(b){a.cfg.interleave=yRestTimeControl(500);a.cfg.dataTemplateEmpty="undefined"===typeof b?!0:!1;a.cfg.dataTemplate=b||{};a.cfg.db.onremove=a.onremove;a.server=yServerWatcherObj(restServer);a.cleanCondition();return a},a.init(e.dataTemplate);console.error("Since 0.8.55 the parameters or yInfoObj() has changed to (aDBSpec: {}, aServerSpec: {})");
  alert("Since 0.8.55 the parameters or yInfoObj() has changed to (aDBSpec: {}, aServerSpec: {})")})})();
  