text: /* YeAPF 0.8.61-221 built on 2019-03-20 19:24 (-3 DST) Copyright (C) 2004-2019 Esteban Daniel Dortta - dortta@yahoo.com */
  (function(){window.ystorage||(window.ystorage=function(){var g=[],l={oStorage:{},getItem:function(a,c){var b=c=c||null;a&&(b=l.oStorage[a]||c);return b},setItem:function(a,c){a&&(l.oStorage[a]=c,document.cookie=escape(a)+"="+escape(c)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")},unsetItem:function(a){"undefined"!==typeof l.oStorage[a]&&delete l.oStorage[a]}};Object.defineProperty(l,"item",{get:l.getItem,set:l.setItem,enumerable:!0});Object.defineProperty(l,"key",{value:function(a){return g[a]},
  writable:!1,configurable:!1,enumerable:!1});Object.defineProperty(l,"length",{get:function(){return g.length},configurable:!1,enumerable:!1});Object.defineProperty(l,"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});l.get=function(){var a,c;for(c in oStorage)a=g.indexOf(c),-1===a?oStorage.setItem(c,oStorage[c]):g.splice(a,1),delete oStorage[c];for(;0<g.length;g.splice(0,1))oStorage.removeItem(g[0]);
  for(var b=0,d=document.cookie.split(/\s*;\s*/);b<d.length;b++)a=d[b].split(/\s*=\s*/),1<a.length&&(oStorage[c=unescape(a[0])]=unescape(a[1]),g.push(c));return oStorage};l.configurable=!1;l.enumerable=!0;return l}());window.ySingleDb||(console.log("Creating ySingleDb ... "),window.ySingleDb=function(g,l){var a={_list:null,toBinArray:function(a){for(var b=(a||"").length,d=new Uint8Array(b),f=0;f<b;f++)d[f]=a.charCodeAt(f);return d},toBinString:function(a){a=new Uint8Array(a);for(var b=[],d=0;65535*
  d<a.length;d++)b.push(String.fromCharCode.apply(null,a.subarray(65535*d,65535*(d+1))));return b.join("")},setItem:function(c,b,d){var f,e,h;c=String(c);b._id=b._id||generateUUID();b._ts_update=(new Date).getTime()/1E3;if(isArray(d)&&(h=a.getItem(c),!isEmpty(h)))for(f=0;f<d.length;f++)"undefined"!==typeof h[d[f]]&&(b[d[f]]=h[d[f]]);if(b._linked){for(f=0;f<b._linked.length;f++)delete b[b._linked[f]];delete b._linked}for(e in b)b.hasOwnProperty(e)&&"_"!=e.substr(0,1)&&isArray(b[e])&&(b[e]=JSON.stringify(b[e]));
  localStorage.setItem(a._dbTag_+"_item_"+c,JSON.stringify(b));-1==a._list.indexOf(c)&&(a._list[a._list.length]=c,localStorage.setItem(a._dbTag_+"_list",JSON.stringify(a._list)))},setBinItem:function(c,b,d){a.setItem(c,a.toBinString(b),d)},getItem:function(c){c=String(c);c=localStorage.getItem(a._dbTag_+"_item_"+c);c=JSON.parse(c||"{}");if(!isEmpty(c)&&isArray(a._siblingDB)){var b;c._linked=[];for(var d=0;d<a._siblingDB.length;d++){b=a._siblingDB[d].db.getItem(c[a._siblingDB[d].linkage]);for(var f in b)c._linked=
  [],b.hasOwnProperty(f)&&"undefined"==typeof c[f]&&(c[f]=b[f],c._linked.push(f))}}return c},getBinItem:function(c){return a.toBinArray(a.getItem(c))},getList:function(){return a._list||[]},linkTo:function(c,b){c&&c.getItem?"undefined"==typeof b&&(c=null):c=b=null;if(c){var d={db:c,linkage:b||null};a._siblingDB=a._siblingDB||[];a._siblingDB.push(d)}},filter:function(c,b,d,f){if("function"==typeof c){d=d||!0;var e=!1,h;!0===d?e=!0:(h=yLexObj(d),h.parse());var m=a.getList(),n,k;for(d=0;d<m.length;d++)if(n=
  a.getItem(m[d]),k=e||h.solve(n))c(n),f&&(d=m.length+1)}"function"==typeof b&&b()},each:function(c,b,d,f){var e=function(a,b){b=String(b).split(" ");var d=!0,c,f;for(c in b)f=trim(b[c]),d=isNumber(f)&&isNumber(a)?d&&parseFloat(f)===parseFloat(a):d&&0<=(""+a).toUpperCase().indexOf(f.toUpperCase());return d},h,m=a.getList(),n,k;for(h=0;h<m.length;h++)if("function"==typeof c){n=a.getItem(m[h]);k="undefined"==typeof d;if(!k)if("string"==typeof d)k=e(n[a.cfg.keyName],d);else if("object"==typeof d){k=!0;
  for(var g in d)d.hasOwnProperty(g)&&(k="undefined"!==typeof n[g]?k&&e(n[g],d[g]):!1)}k&&(c(n),f&&(h=m.length+1))}"function"==typeof b&&b()},insertData:function(c,b){for(var d in c)c.hasOwnProperty(d)&&a.setItem(c[d][a._keyName_],c[d],b)},count:function(c){var b=0;a.each(function(){b++},null,c);return b},extractData:function(c,b){var d=[];a.each(function(a){d[d.length]=a},function(){c(d)},b)},fillList:function(c,b,d,f){b=b||"id";d&&a.cleanList();for(d=0;d<c.length;d++)c[d][b]&&a.setItem(c[d][b],c,
  f)},removeItem:function(c,b){if(("undefined"!==typeof b?b:1)&&"function"==typeof a.onremove)a.onremove(a.getItem(c));localStorage.removeItem(a._dbTag_+"_item_"+c);var d=a._list.indexOf(String(c));-1<d&&(a._list.splice(d,1),localStorage.setItem(a._dbTag_+"_list",JSON.stringify(a._list)))},removeItems:function(c,b){b="undefined"!==typeof b?b:!0;a.extractData(function(d){for(var c in d)d.hasOwnProperty(c)&&a.removeItem(d[c][a._keyName_],b)},c)},eliminateItem:function(c){a.removeItem(c,!1)},eliminateItems:function(c){a.removeItems(c,
  !1)},cleanList:function(c){c="undefined"!==typeof c?c:!0;var b=[],d=0,f;for(f in a._list)b[d++]=a._list[f];for(d=0;d<b.length;d++)a.removeItem(b[d],c)},blankList:function(){a.cleanList(!1)},init:function(c,b){a._dbTag_=c;a._keyName_=b||"_id";console.log("ystorage: creating "+c);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(g,l)},console.log("ystorage ready!"));window.yIndexedDB||(window.indexedDB||
  (window.indexedDB=window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),window.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction,window.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange,window.yIndexedDB=function(g,l,a,c){var b={};c=Math.max(1,c||1);b._newTransaction=function(a,c,e){e=e||function(a){0!==a&&m&&(m=!1,"function"==typeof c&&c(520,a,[{}]))};a=b._db.transaction([b._dbTag_],"readwrite");var h,m=!0;a.oncomplete=
  function(){h=0;"function"==typeof e&&e(h)};a.onerror=function(){h=1;"function"==typeof e&&e(h)};return a.objectStore(b._dbTag_)};b.count=function(a){var c=b._newTransaction("readonly").count();c.onsuccess=function(){"function"==typeof a&&a(200,0,[c.result])}};b.setItem=function(a,c,e){a=!1;if(3==b.status){c._id=c._id||generateUUID();c._ts_update=(new Date).getTime()/1E3;var h=b._newTransaction("readwrite",e).put(c);h.onsuccess=function(){"function"==typeof e&&e(200,0,[h.result])};a=!0}return a};b.getItem=
  function(a,c){var e=!1;if(3==b.status){var h=b._newTransaction("readonly",c).get(a);h.onsuccess=function(){"function"==typeof c&&c(200,0,[h.result])};e=!0}return e};b.insertData=function(a,c,e){c=!1;if(3==b.status){c=b._newTransaction("readwrite",e);for(var h=0,m=0,g=0;a&&g<a.length;g++){var k=a[g];k._id=k._id||generateUUID();k._ts_update=(new Date).getTime()/1E3;k=c.put(k);k.onsuccess=function(b){b=b.target;h++;h+m>=a.length&&"function"==typeof e&&e(200,{errorCount:m},[b.result])};k.onerror=function(b){m++;
  h+m>=a.length&&"function"==typeof e&&e(200,{errorCount:m},[{}])}}c=!0}return c};b.filter=function(a,c,e,h){if(3==b.status){var m=function(a){0===a&&"function"==typeof c&&c()};if("function"==typeof a){e=e||!0;var g=!1;if(!0===e)g=!0;else{var k=yLexObj(e);k.parse()}e=b._newTransaction("readonly",void 0,m).openCursor();e.onsuccess=function(b){var c=b.target.result;c&&((b=g||k.solve(c.value))&&a(c.value),h||c.continue())};e.onerror=function(){}}else m(0)}};b.slice=function(a,c,e,h,m){if(3==b.status){var g=
  function(a){0===a&&"function"==typeof c&&c()};if("function"==typeof a){var g=b._newTransaction("readonly",void 0,g).openCursor(),k=0;e=Math.max(0,e);g.onsuccess=function(b){if(b=b.target.result)k<e?(k=e,console.log("Advancing to {0}".format(e)),0<e&&b.advance(e)):(k++,k<=h&&("function"===typeof a&&a(b.value),m||k<h&&b.continue()))};g.onerror=function(){}}else g(0)}};b.removeItem=function(a,c){var e=!1;if(3==b.status){var h=b._newTransaction("readonly",c).delete(a);h.onsuccess=function(){"function"==
  typeof c&&c(200,0,h.result)};e=!0}return e};b.cleanList=function(a){b.filter(function(a){b.removeItem(a.keyValue)})};b.blankList=function(){b.cleanList(!1)};b.onDBRequestError=function(a){console.log("{0} onDBRequestError(): {1}".format(g,a.currentTarget.error));b.newStatus(-1)};b.onDBRequestSuccess=function(c){console.log("{0} onDBRequestSuccess()".format(g));b._db=c.target.result;b.newStatus(3);"function"==typeof a&&a()};b.onDBUpgradeNeeded=function(a){console.log("{0} onDBUpgradeNeeded()".format(g));
  b.newStatus(2);b._db=a.target.result;try{var c=a.target.transaction.db.createObjectStore(b._dbTag_,{keyPath:b._keyName_[0]}),e=1,h=function(){e<b._keyName_.length?c.createIndex(b._keyName_[e]+"_ndx",b._keyName_[e],{unique:!1,keyPath:b._keyName_[e]}).onsuccess=function(){e++;setTimeout(h,125)}:b.newStatus(3)};h(e)}catch(m){console.error(m.message)}};b.init=function(a,f){b._dbTag_=a;f=f||"_id";if(!isArray(f)){var e=0<=f.indexOf(",")?",":";";f=f.split(e)}b._keyName_=f.slice();0===b._keyName_.length&&
  (b._keyName_[0]="_id");b._status=0;Object.defineProperty(b,"status",{get:function(){return b._status},configurable:!1,enumerable:!1});b.newStatus=function(a){if(a!=b._status&&(console.log(b._dbTag_+".status changes from {0} to {1}".format(b.status,a)),b._status=a,"function"==typeof b.onStatusChange))b.onStatusChange(b)};if(window.indexedDB){b.newStatus(1);console.log("Creating {0}".format(a));try{b._DBOpenRequest=window.indexedDB.open(a,c),b._DBOpenRequest.onerror=b.onDBRequestError,b._DBOpenRequest.onsuccess=
  b.onDBRequestSuccess,b._DBOpenRequest.onupgradeneeded=b.onDBUpgradeNeeded}catch(h){console.error(h.message)}}else console.error("indexedDB not found!");return b};return b.init(g,l)});window.yServerWatcherObj||(window.yServerWatcherObj=function(g){var l={serverReady:function(a,c){var b=(new Date).getTime();ycomm.crave("sync","ping",null,function(d,f,e){200==d?0<parseInt(e.pong||0)&&(d=(new Date).getTime()-b,console.log("Server ready..."),console.log("Wasted time: {0}ms".format(d)),ycomm.wd_interval=
  4*d,"function"==typeof a&&a()):"function"==typeof c&&c(d,f)})},init:function(){ycomm.setDataLocation(g);l.serverReady(function(){console.log("Server ready!")});return l}};return l.init()});window.yInfoObj||(window.yInfoObj=function(g,l){var a={};if("object"==typeof g&&"string"==typeof g.dbName)return a.cfg={db:ySingleDb(g.dbName,g.keyName),garbage:ySingleDb(g.dbName+"_garbage",g.keyName),dbName:g.dbName,keyName:g.keyName,dataModified:0,onrecordcount:null,onprogress:null,oncomplete:null},a.onremove=
  function(c){c._ts_deletion=(new Date).getTime()/1E3;a.cfg.garbage.setItem(c._id,c);a.cfg.dataModified++},a.isbusy=function(){return a.busy},a.getItem=function(c){return a.cfg.db.getItem(c)},a.setItem=function(c,b,d){a.cfg.dataModified++;return a.cfg.db.setItem(c,b,d)},a.removeItem=function(c){return a.cfg.db.removeItem(c)},a.removeItems=function(c){return a.cfg.db.removeItems(c)},a.eliminateItem=function(c){return a.cfg.db.eliminateItem(c)},a.eliminateItems=function(c){return a.cfg.db.eliminateItems(c)},
  a.cleanList=function(){return a.cfg.db.cleanList()},a.blankList=function(){return a.cfg.db.blankList()},a.linkTo=function(c,b){return a.cfg.db.linkTo(c,b)},a.filter=function(c,b,d,f){return a.cfg.db.filter(c,b,d,f)},a.each=function(c,b,d,f){return a.cfg.db.each(c,b,d,f)},a.paint=a.each,a.count=function(c){return a.cfg.db.count(c)},a.extractData=function(c,b){var d=[];a.each(function(a){d[d.length]=a},function(){c(d)},b)},a.insertData=function(c,b){return a.cfg.db.insertData(c,b)},a.cleanCondition=
  function(){a.cfg.condition={}},a.setCondition=function(c){if("string"==typeof c){c=c.match(/\S+/g);var b,d="";for(b=0;b<c.length;b++)isNumber(c[b])||isOperator(c[b])||(c[b]="%("+c[b]+")"),d+=c[b]+" ";a.cfg.condition={_statement_:d}}else a.cfg.condition=c||{}},a.retrieveFromServer=function(c,b,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.log("yInfoObj busy"),!1;a.busy=!0;a.cfg.onrecordcount=c||null;a.cfg.oncomplete=b||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(c){var b;if(a.cfg.dataTemplateEmpty)b=c;else{b={};for(var d in a.cfg.dataTemplate)a.cfg.dataTemplate.hasOwnProperty(d)&&(b[d]=c[d])}return b},a.sendToServer=function(c,b,d){d=d||console.warn;if(a.busy)return d("yInfoObj busy"),
  !1;a.busy=!0;a.cfg.onrecordcount=null;a.cfg.oncomplete=c||null;a.cfg.onprogress=b||null;var f=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){if("function"==typeof a.cfg.onprogress)a.cfg.onprogress(a.cfg.dbName,e[0],++f)}else d(b+": "+c)})},function(){if("function"==typeof a.cfg.oncomplete)a.cfg.oncomplete(a.cfg.dbName);a.busy=!1},a.cfg.condition)},
  function(a,b){d("Erro {0} ao tentar acessar o servidor: {1}".format(a,b.message))});return!0},a.init=function(c){a.cfg.interleave=yRestTimeControl(500);a.cfg.dataTemplateEmpty="undefined"===typeof c?!0:!1;a.cfg.dataTemplate=c||{};a.cfg.db.onremove=a.onremove;a.server=yServerWatcherObj(restServer);a.cleanCondition();return a},a.init(g.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: {})")})})();
  