function Sc(a,b){this.Init(a,b)}m("AdfIndexedDbLogWriter",Sc);r.v(Sc,Ic);
Sc.prototype.Init=function(a,b){u.s(b,qa);Sc.h.Init.call(this,a,b);this.sW=a.localStorage;this.Hc=q.b.R();var d=this.EJ().indexedDB;if(!Sc.Nx&&d){var e=this,d=d.open("oracle.adf.view.rich.adfRcProfilerDb",1);d.onupgradeneeded=function(a){a.target.result.createObjectStore("records",{autoIncrement:!0}).createIndex("logDate","logDate",{unique:!1})};d.onsuccess=function(a){a=a.target.result;Sc.Nx?a.close():Sc.Nx=a;Tc(e)};d.onerror=function(a){e.Mq("Error opening IndexedDB: "+a.target.error)}}};
r.a("AdfIndexedDbLogWriter.prototype.Init",{Init:Sc.prototype.Init});Sc.prototype.close=function(){this.Kp(!0);this.a4=!0};r.a("AdfIndexedDbLogWriter.prototype.close",{close:Sc.prototype.close});
Sc.prototype.Kp=function(a){if(Sc.Nx){this.ug();var b=this.HH();if(b&&0<b.length)if(b={brb:b[0][Jc.dn].getTime(),Ksb:Date.now(),vpb:M.y1,page:this.Hc.title,path:this.EJ().location.pathname,Qy:b},!a)Tc(this),Uc(this,b);else if(this.sW)try{this.sW.setItem(Sc.Bga,JSON.stringify(b))}catch(d){this.Mq("Error setting localStorage: "+d)}}else this.Mq("IndexedDB is not available.");this.kD()};r.a("AdfIndexedDbLogWriter.prototype.closeRecord",{Kp:Sc.prototype.Kp});
function Uc(a,b){var d=Sc.Nx.transaction("records","readwrite");d.onerror=function(){a.Mq("Error: "+d.error)};var e=d.objectStore("records");e.add(b);e.count().onsuccess=Sc.ccb}Sc.ccb=function(a){var b=a.target.result-Sc.i2a;0<b&&(a.target.source.index("logDate").openCursor().onsuccess=function(a){b--;if(a=a.target.result)if(a["delete"](),0<b)a["continue"]()})};
function Tc(a){if(a.sW)try{var b=a.sW.getItem(Sc.Bga);if(b){a.sW.removeItem(Sc.Bga);for(var b=JSON.parse(b),d=0;d<b.Qy.length;d++)b.Qy[d][Jc.dn]&&(b.Qy[d][Jc.dn]=new Date(b.Qy[d][Jc.dn]));Uc(a,b)}}catch(e){a.Mq("Error processing localStorage value: "+e)}}
function Vc(a,b,d){var e="";b||(b=Sc.IIa);if(Sc.Nx){var f=function(d){d=d.target;d.error&&(a.Mq("Error: "+d.error),e="\x3cerror\x3e"+d.error+"\x3c/error\x3e\n"+e);b(e)};try{var g=Sc.Nx.transaction("records","readwrite");g.onerror=f;g.onabort=f;g.oncomplete=f;d||(e=a.$_());g.objectStore("records").index("logDate").openCursor().onsuccess=function(b){if(b=b.target.result){var f=b.value;e+=a.a0(new Date(f.Ksb),f.vpb,f.page,f.path,f.Qy);b["delete"]();b["continue"]()}else d||(e+=Ic.T_)}}catch(h){b("\x3cerror\x3e"+
h+"\x3c/error\x3e")}}else b(e)}function Wc(a,b){if(Sc.Nx){b||(b=Number.MAX_VALUE);var d=Sc.Nx.transaction("records","readwrite");d.onerror=function(){a.Mq("Error: "+d.error)};d.objectStore("records").openCursor().onsuccess=function(a){if(a=a.target.result){if(a.value.brb<b)a["delete"]();a["continue"]()}}}}Sc.Nx=null;Sc.i2a=100;Sc.Bga="oracle.adf.view.rich.adfRcProfilerKey";Sc.ska=function(){var a=null;v.Yc&&(a=v.Yc.ek(),Sc.prototype.isPrototypeOf(a)||(a=null));return a};Sc.IIa=function(a){console.log(a)};
Sc.eqb=function(a,b){a||(a=Sc.IIa);try{var d=Sc.ska();d?Vc(d,a,b):a("\x3cAdfIndexedDbLogWriterNotFound/\x3e")}catch(e){a("\x3cerror\x3e"+e+"\x3c/error\x3e")}};m("AdfIndexedDbLogWriter.getLogData",Sc.eqb);Sc.qpb=function(a){var b=Sc.ska();b&&Wc(b,a)};m("AdfIndexedDbLogWriter.deleteLogData",Sc.qpb);Sc.isEnabled=function(){return null!=Sc.ska()};m("AdfIndexedDbLogWriter.isEnabled",Sc.isEnabled);