varJIO=function(){vara=function(a,b){varc={jobMethodObject:{checkNameAvailability:{start_event:"start_checkingNameAvailability",stop_event:"stop_checkingNameAvailability",retvalue:"isAvailable"},saveDocument:{start_event:"start_saving",stop_event:"stop_saving",retvalue:"isSaved"},loadDocument:{start_event:"start_loading",stop_event:"stop_loading",retvalue:"fileContent"},getDocumentList:{start_event:"start_gettingList",stop_event:"stop_gettingList",retvalue:"list"},removeDocument:{start_event:"start_removing",stop_event:"stop_removing",retvalue:"isRemoved"}}},d={jobManagingMethod:{canSelect:function(a,b){returnJSON.stringify(a.storage)===JSON.stringify(b.storage)&&JSON.stringify(a.applicant)===JSON.stringify(b.applicant)&&a.fileName===b.fileName?!0:!1},canRemoveFailOrDone:function(a,b){returna.status==="fail"||a.status==="done"?!0:!1},canEliminate:function(a,b){returna.status!=="ongoing"&&(a.method==="removeDocument"&&b.method==="saveDocument"||a.method==="saveDocument"&&b.method==="removeDocument")?!0:!1},canReplace:function(a,b){returna.status!=="ongoing"&&a.method===b.method&&a.date<b.date?!0:!1},cannotAccept:function(a,b){if(a.status!=="ongoing"){if(a.method==="removeDocument"&&b.method==="loadDocument")return!0}else{if(a.method===b.method==="loadDocument")return!0;if(a.method==="removeDocument"&&(b.method==="loadDocument"||b.method==="removeDocument"))return!0;if(a.method===b.method==="saveDocument"&&a.fileContent===b.fileContent)return!0;if(a.method===b.method==="getDocumentList"||a.method===b.method==="checkNameAvailability")return!0}return!1},mustWait:function(a,b){returna.method==="getDocumentList"||a.method==="checkNameAvailability"||b.method==="getDocumentList"||b.method==="checkNameAvailability"?!1:!0}},localStorage:null,queueID:1,storageTypeObject:{},max_wait_time:1e4},e,f,g,h,i,j,k,l;returne=function(){vara={},c={},d={},e,f;returnc.eventAction=function(a){returnf=a&&d[a],f||(e=b.Callbacks(),f={publish:e.fire,subscribe:e.add,unsubscribe:e.remove},a&&(d[a]=f)),f},a.publish=function(a,b){c.eventAction(a).publish(b)},a.subscribe=function(a,b){returnc.eventAction(a).subscribe(b),b},a.unsubscribe=function(a,b){c.eventAction(a).unsubscribe(b)},a},f=function(a){varc=b.extend({},a);returnc.id=0,c.status="initial",c.date=Date.now(),c},g=function(a,e){varg={},h={},i="jio/idArray";returng.init=function(b){varc,e=function(){},f=d.localStorage.getItem(i)||[];b.publisher&&(h.publisher=a),h.jioID=b.jioID,h.jobObjectName="jio/jobObject/"+b.jioID,h.jobObject={},f.push(h.jioID),d.localStorage.setItem(i,f),g.copyJobQueueToLocalStorage();for(cinh.recoveredJobObject)h.recoveredJobObject[c].callback=e,g.addJob(h.recoveredJobObject[c])},g.close=function(){JSON.stringify(h.jobObject)==="{}"&&d.localStorage.deleteItem(h.jobObjectName)},g.getNewQueueID=function(){vara=null,b=0,c=d.localStorage.getItem(i)||[];for(a=0;a<c.length;a+=1)c[a]>=d.queueID&&(d.queueID=c[a]+1);returnb=d.queueID,d.queueID++,b},g.recoverOlderJobObject=function(){vara=null,b=[],c=!1,e=d.localStorage.getItem(i)||[];for(a=0;a<e.length;a+=1)d.localStorage.getItem("jio/id/"+e[a])<Date.now()-1e4?(d.localStorage.deleteItem("jio/id/"+e[a]),h.recoveredJobObject=d.localStorage.getItem("jio/jioObject/"+e[a]),d.localStorage.deleteItem("jio/jobObject/"+e[a]),c=!0):b.push(e[a]);c&&d.localStorage.setItem(i,b)},g.isThereJobsWhere=function(a){varb="id";if(!a)return!0;for(binh.jobObject)if(a(h.jobObject[b]))return!0;return!1},g.copyJobQueueToLocalStorage=function(){returnh.useLocalStorage?d.localStorage.setItem(h.jobObjectName,h.jobObject):!1},g.createJob=function(a){returng.addJob(newf(a))},g.addJob=function(a){varb={newone:!0,elimArray:[],waitArray:[],removeArray:[]},c=null,e="id";for(einh.jobObject){if(d.jobManagingMethod.canRemoveFailOrDone(h.jobObject[e],a)){b.removeArray.push(e);continue}if(d.jobManagingMethod.canSelect(h.jobObject[e],a)){if(d.jobManagingMethod.canEliminate(h.jobObject[e],a)){b.elimArray.push(e);continue}if(d.jobManagingMethod.canReplace(h.jobObject[e],a)){c=newj({queue:g,job:h.jobObject[e]}),c.replace(a),b.newone=!1;break}if(d.jobManagingMethod.cannotAccept(h.jobObject[e],a))return!1;if(d.jobManagingMethod.mustWait(h.jobObject[e],a)){b.waitArray.push(e);continue}}}if(b.newone){for(e=0;e<b.elimArray.length;e+=1)c=newj({queue:g,job:h.jobObject[b.elimArray[e]]}),c.eliminate();if(b.waitArray.length>0){a.status="wait",a.waitingFor={jobIdArray:b.waitArray};for(e=0;e<b.waitArray.length;e+=1)h.jobObject[b.waitArray[e]]&&(h.jobObject[b.waitArray[e]].maxtries=1)}for(e=0;e<b.removeArray.length;e+=1)g.removeJob(h.jobObject[b.removeArray[e]]);a.id=h.jobid,a.tries=0,h.jobid++,h.jobObject[a.id]=a}returng.copyJobQueueToLocalStorage(),!0},g.removeJob=function(a){varc=b.extend({where:function(a){return!0}},a),d,e=!1,f="key";if(c.job)h.jobObject[c.job.id]&&c.where(h.jobObject[c.job.id])&&(deleteh.jobObject[c.job.id],e=!0);elsefor(finh.jobObject)c.where(h.jobObject[f])&&(deleteh.jobObject[f],e=!0);e||b.error("No jobs was found, when trying to remove some."),g.copyJobQueueToLocalStorage()},g.resetAll=function(){vara="id";for(ainh.jobObject)h.jobObject[a].status="initial";g.copyJobQueueToLocalStorage()},g.invokeAll=function(){vara="id",b,c;for(ainh.jobObject){c=!1;if(h.jobObject[a].status==="initial")g.invoke(h.jobObject[a]);elseif(h.jobObject[a].status==="wait"){c=!0;if(h.jobObject[a].waitingFor.jobIdArray)for(b=0;b<h.jobObject[a].waitingFor.jobIdArray.length;b+=1)if(h.jobObject[h.jobObject[a].waitingFor.jobIdArray[b]]){c=!1;break}h.jobObject[a].waitingFor.time&&h.jobObject[a].waitingFor.time>Date.now()&&(c=!1),c&&g.invoke(h.jobObject[a])}}this.copyJobQueueToLocalStorage()},g.invoke=function(a){varb;if(!c.jobMethodObject[a.method])return!1;g.isThereJobsWhere(function(b){returnb.method===a.method&&b.method==="initial"})?a.status="ongoing":(a.status="ongoing",h.publisher.publish(c.jobMethodObject[a.method].start_event)),b=newj({queue:this,job:a}),b.execute()},g.ended=function(a){vard=b.extend({},a);g.removeJob({job:d});if(!c.jobMethodObject[d.method])return!1;if(!g.isThereJobsWhere(function(a){returna.method===d.method&&a.status==="ongoing"||a.status==="initial"})){h.publisher.publish(c.jobMethodObject[d.method].stop_event);return}},g.clean=function(){g.removeJob(undefined,{where:function(a){returna.status==="fail"}})},h.useLocalStorage=e.useLocalStorage,h.publisher=a,h.jobid=1,h.jioID=0,h.jobObjectName="",h.jobObject={},h.recoveredJobObject={},g},h=function(a){varb={},c={};returnc.interval=200,c.id=null,c.queue=a,b.setIntervalDelay=function(a){c.interval=a},b.start=function(){returnc.id?!1:(c.id=setInterval(function(){c.queue.recoverOlderJobObject(),c.queue.invokeAll()},c.interval),!0)},b.stop=function(){returnc.id?(clearInterval(c.id),c.id=null,!0):!1},b},i=function(){vara={},b={};returnb.interval=400,b.id=null,a.start=function(c){returnb.id?!1:(a.touch(c),b.id=setInterval(function(){a.touch(c)},b.interval),!0)},a.stop=function(){returnb.id?(clearInterval(b.id),b.id=null,!0):!1},a.touch=function(a){d.localStorage.setItem("jio/id/"+a,Date.now())},a},j=function(a){varc={},e={};returne.job=a.job,e.callback=a.job.callback,e.queue=a.queue,e.res={status:"done",message:""},e.fail_checkNameAvailability=function(){e.res.message="Unable to check name availability."},e.done_checkNameAvailability=function(a){e.res.message=e.job.userName+" is "+(a?"":"not ")+"available.",e.res.return_value=a},e.fail_loadDocument=function(){e.res.message="Unable to load document."},e.done_loadDocument=function(a){e.res.message="Document loaded.",e.res.return_value=a,e.res.return_value.lastModified=(newDate(e.res.return_value.lastModified)).getTime(),e.res.return_value.creationDate=(newDate(e.res.return_value.creationDate)).getTime()},e.fail_saveDocument=function(){e.res.message="Unable to save document."},e.done_saveDocument=function(){e.res.message="Document saved."},e.fail_getDocumentList=function(){e.res.message="Unable to retrieve document list."},e.done_getDocumentList=function(a){varb;e.res.message="Document list received.",e.res.return_value=a;for(b=0;b<e.res.return_value.length;b+=1)e.res.return_value[b].lastModified=(newDate(e.res.return_value[b].lastModified)).getTime(),e.res.return_value[b].creationDate=(newDate(e.res.return_value[b].creationDate)).getTime()},e.fail_removeDocument=function(){e.res.message="Unable to removed document."},e.done_removeDocument=function(){e.res.message="Document removed."},e.retryLater=function(){vara=e.job.tries*e.job.tries*1e3;a>d.max_wait_time&&(a=d.max_wait_time),e.job.status="wait",e.job.waitingFor={time:Date.now()+a}},c.cloneJob=function(){returnb.extend({},e.job)},c.getUserName=function(){returne.job.userName||""},c.getApplicantID=function(){returne.job.applicant.ID||""},c.getStorageUserName=function(){returne.job.storage.userName||""},c.getStoragePassword=function(){returne.job.storage.password||""},c.getStorageLocation=function(){returne.job.storage.location||""},c.getStorageArray=function(){returne.job.storage.storageArray||[]},c.getFileName=function(){returne.job.fileName||""},c.getFileContent=function(){returne.job.fileContent||""},c.cloneOptionObject=function(){returnb.extend({},e.job.options)},c.getMaxTries=function(){returne.job.maxtries},c.getTries=function(){returne.job.tries||0},c.setMaxTries=function(a){e.job.maxtries=a},c.addJob=function(a){returne.queue.createJob(a)},c.eliminate=function(){e.job.maxtries=1,e.job.tries=1,c.fail("Job Stopped!",0)},c.replace=function(a){e.job.tries=0,e.job.date=a.date,e.job.callback=a.callback,e.res.status="fail",e.res.message="Job Stopped!",e.res.error={},e.res.error.status=0,e.res.error.statusText="Replaced",e.res.error.message="The job was replaced by a newer one.",e["fail_"+e.job.method](),e.callback(e.res)},c.fail=function(a){e.res.status="fail",e.res.error=a,e.res.error.status=e.res.error.status||0,e.res.error.statusText=e.res.error.statusText||"Unknown Error",e.res.error.array=e.res.error.array||[],e.res.error.message=e.res.error.message||"",!e.job.maxtries||e.job.tries<e.job.maxtries?e.retryLater():(e.job.status="fail",e["fail_"+e.job.method](),e.queue.ended(e.job),e.callback(e.res))},c.done=function(a){e.job.status="done",e["done_"+e.job.method](a),e.queue.ended(e.job),e.callback(e.res)},c.execute=function(){returne.job.tries=c.getTries()+1,d.storageTypeObject[e.job.storage.type]?d.storageTypeObject[e.job.storage.type]({job:e.job,queue:e.queue})[e.job.method]():null},c.checkNameAvailability=function(){c.fail("This method must be redefined!",0)},c.loadDocument=function(){c.fail("This method must be redefined!",0)},c.saveDocument=function(){c.fail("This method must be redefined!",0)},c.getDocumentList=function(){c.fail("This method must be redefined!",0)},c.removeDocument=function(){c.fail("This method must be redefined!",0)},c},k=function(a,c,f){varj={},k={};j.getID=function(){returnk.id},j.start=function(){returnk.id!==0?!1:(k.id=k.queue.getNewQueueID(),k.queue.init({jioID:k.id}),k.updater&&k.updater.start(k.id),k.listener.start(),k.ready=!0,j.isReady())},j.stop=function(){returnk.queue.close(),k.listener.stop(),k.updater&&k.updater.stop(),k.ready=!1,k.id=0,!0},j.kill=function(){returnk.queue.close(),k.listener.stop(),k.updater&&k.updater.stop(),k.ready=!1,!0},j.isReady=function(){returnk.ready},j.publish=function(a,b){if(!j.isReady())return;returnk.pubsub.publish(a,b)},j.subscribe=function(a,b){returnk.pubsub.subscribe(a,b)},j.unsubscribe=function(a,b){returnk.pubsub.unsubscribe(a,b)},j.checkNameAvailability=function(a){varc=b.extend({userName:k.storage.userName,storage:k.storage,applicant:k.applicant,method:"checkNameAvailability",callback:function(){}},a);returnj.isReady()&&c.userName&&c.storage&&c.applicant?k.queue.createJob(c):null},j.saveDocument=function(a){varc=b.extend({storage:k.storage,applicant:k.applicant,method:"saveDocument",callback:function(){}},a);returnj.isReady()&&c.fileName&&c.fileContent&&c.storage&&c.applicant?k.queue.createJob(c):null},j.loadDocument=function(a){varc=b.extend({storage:k.storage,applicant:k.applicant,method:"loadDocument",callback:function(){}},a);returnj.isReady()&&c.fileName&&c.storage&&c.applicant?k.queue.createJob(c):null},j.getDocumentList=function(a){varc=b.extend({storage:k.storage,applicant:k.applicant,method:"getDocumentList",callback:function(){}},a);returnj.isReady()&&c.storage&&c.applicant?k.queue.createJob(c):null},j.removeDocument=function(a){varc=b.extend({storage:k.storage,applicant:k.applicant,method:"removeDocument",callback:function(){}},a);returnj.isReady()&&c.fileName&&c.storage&&c.applicant?k.queue.createJob(c):null};varl=b.extend({useLocalStorage:!0},f);returntypeofa=="string"&&(a=JSON.parse(f.storage)),typeofc=="string"&&(c=JSON.parse(f.applicant)),k.storage=a,k.applicant=c,k.id=0,k.pubsub=newe(l),k.queue=newg(k.pubsub,l),k.listener=newh(k.queue,l),k.ready=!1,l.useLocalStorage?k.updater=newi(l):k.updater=null,k.storage&&!d.storageTypeObject[k.storage.type]&&b.error('Unknown storage type "'+k.storage.type+'"'),j.start(),j},l=function(){vare={};returne.createNew=function(c,e,f){varg=b.extend({useLocalStorage:!0},f);returnd.localStorage===null&&(d.localStorage=a),newk(c,e,g)},e.newBaseStorage=function(a){returnnewj(a)},e.addStorageType=function(a,b){returna&&b?(d.storageTypeObject[a]=b,!0):!1},e.getGlobalObject=function(){returnd},e.getConstObject=function(){returnb.extend({},c)},e},newl};returnwindow.requirejs?(define("JIO",["LocalOrCookieStorage","jQuery"],a),undefined):a(LocalOrCookieStorage,jQuery)}();
\ No newline at end of file
varJIO=function(){vara=function(a,b){varc={job_method_object:{checkNameAvailability:{},saveDocument:{},loadDocument:{},getDocumentList:{},removeDocument:{}}},d={job_managing_method:{canSelect:function(a,b){returnJSON.stringify(a.storage)===JSON.stringify(b.storage)&&JSON.stringify(a.applicant)===JSON.stringify(b.applicant)&&a.fileName===b.fileName?!0:!1},canRemoveFailOrDone:function(a,b){returna.status==="fail"||a.status==="done"?!0:!1},canEliminate:function(a,b){returna.status!=="ongoing"&&(a.method==="removeDocument"&&b.method==="saveDocument"||a.method==="saveDocument"&&b.method==="removeDocument")?!0:!1},canReplace:function(a,b){returna.status!=="ongoing"&&a.method===b.method&&a.date<b.date?!0:!1},cannotAccept:function(a,b){if(a.status!=="ongoing"){if(a.method==="removeDocument"&&b.method==="loadDocument")return!0}else{if(a.method===b.method==="loadDocument")return!0;if(a.method==="removeDocument"&&(b.method==="loadDocument"||b.method==="removeDocument"))return!0;if(a.method===b.method==="saveDocument"&&a.fileContent===b.fileContent)return!0;if(a.method===b.method==="getDocumentList"||a.method===b.method==="checkNameAvailability")return!0}return!1},mustWait:function(a,b){returna.method==="getDocumentList"||a.method==="checkNameAvailability"||b.method==="getDocumentList"||b.method==="checkNameAvailability"?!1:!0}},queue_id:1,storage_type_object:{},max_wait_time:1e4},e=function(a,b){varc;for(cinb)a[c]=b[c];returna},f,g,h,i,j,k,l,m;returnf=function(a,c){vard={},e={},f={},g,h;returne.eventAction=function(a){returnh=a&&f[a],h||(g=b.Callbacks(),h={publish:g.fire,subscribe:g.add,unsubscribe:g.remove},a&&(f[a]=h)),h},d.publish=function(a,b){e.eventAction(a).publish(b)},d.subscribe=function(a,b){returne.eventAction(a).subscribe(b),b},d.unsubscribe=function(a,b){e.eventAction(a).unsubscribe(b)},d},g=function(a,b){varc=e({},a);returnc.id=0,c.status="initial",c.date=Date.now(),c},h=function(b,f){varh={},i={},j="jio/idarray";returnh.init=function(c){vard,e=function(){},f;i.use_local_storage&&(f=a.getItem(j)||[],b.publisher&&(i.publisher=b.publisher),i.jio_id=c.jio_id,i.job_object_name="jio/jobobject/"+i.jio_id,f.push(i.jio_id),a.setItem(j,f)),i.job_object={},h.copyJobQueueToLocalStorage();for(dini.recovered_job_object)i.recovered_job_object[d].callback=e,h.addJob(i.recovered_job_object[d])},h.close=function(){JSON.stringify(i.job_object)==="{}"&&a.deleteItem(i.job_object_name)},h.getNewQueueID=function(){varb=null,c=0,e=a.getItem(j)||[];for(b=0;b<e.length;b+=1)e[b]>=d.queue_id&&(d.queue_id=e[b]+1);returnc=d.queue_id,d.queue_id++,c},h.recoverOlderJobObject=function(){varb=null,c=[],d=!1,e;if(i.use_local_storage){e=a.getItem(j)||[];for(b=0;b<e.length;b+=1)a.getItem("jio/id/"+e[b])<Date.now()-1e4?(a.deleteItem("jio/id/"+e[b]),i.recovered_job_object=a.getItem("jio/jobobject/"+e[b]),a.deleteItem("jio/jobobject/"+e[b]),d=!0):c.push(e[b]);d&&a.setItem(j,c)}},h.isThereJobsWhere=function(a){varb="id";if(!a)return!0;for(bini.job_object)if(a(i.job_object[b]))return!0;return!1},h.copyJobQueueToLocalStorage=function(){returni.use_local_storage?a.setItem(i.job_object_name,i.job_object):!1},h.createJob=function(a){returnh.addJob(g(a))},h.addJob=function(a){varb=!0,c=[],e=[],f=[],g=null,j="id";for(jini.job_object){if(d.job_managing_method.canRemoveFailOrDone(i.job_object[j],a)){f.push(j);continue}if(d.job_managing_method.canSelect(i.job_object[j],a)){if(d.job_managing_method.canEliminate(i.job_object[j],a)){c.push(j);continue}if(d.job_managing_method.canReplace(i.job_object[j],a)){g=k({queue:h,job:i.job_object[j]}),g.replace(a),b=!1;break}if(d.job_managing_method.cannotAccept(i.job_object[j],a))return!1;if(d.job_managing_method.mustWait(i.job_object[j],a)){e.push(j);continue}}}if(b){for(j=0;j<c.length;j+=1)g=k({queue:h,job:i.job_object[c[j]]}),g.eliminate();if(e.length>0){a.status="wait",a.waitingFor={jobIdArray:e};for(j=0;j<e.length;j+=1)i.job_object[e[j]]&&(i.job_object[e[j]].maxtries=1)}for(j=0;j<f.length;j+=1)h.removeJob(i.job_object[f[j]]);a.id=i.job_id,a.tries=0,i.job_id++,i.job_object[a.id]=a}returnh.copyJobQueueToLocalStorage(),!0},h.removeJob=function(a){varb=e({where:function(a){return!0}},a),c,d=!1,f="key";if(b.job)i.job_object[b.job.id]&&b.where(i.job_object[b.job.id])&&(deletei.job_object[b.job.id],d=!0);elsefor(fini.job_object)b.where(i.job_object[f])&&(deletei.job_object[f],d=!0);d||console.error("No jobs was found, when trying to remove some."),h.copyJobQueueToLocalStorage()},h.resetAll=function(){vara="id";for(aini.job_object)i.job_object[a].status="initial";h.copyJobQueueToLocalStorage()},h.invokeAll=function(){vara="id",b,c;for(aini.job_object){c=!1;if(i.job_object[a].status==="initial")h.invoke(i.job_object[a]);elseif(i.job_object[a].status==="wait"){c=!0;if(i.job_object[a].waitingFor.jobIdArray)for(b=0;b<i.job_object[a].waitingFor.jobIdArray.length;b+=1)if(i.job_object[i.job_object[a].waitingFor.jobIdArray[b]]){c=!1;break}i.job_object[a].waitingFor.time&&i.job_object[a].waitingFor.time>Date.now()&&(c=!1),c&&h.invoke(i.job_object[a])}}this.copyJobQueueToLocalStorage()},h.invoke=function(a){varb;if(!c.job_method_object[a.method])return!1;h.isThereJobsWhere(function(b){returnb.method===a.method&&b.method==="initial"})?a.status="ongoing":(a.status="ongoing",i.publisher.publish(c.job_method_object[a.method]["start_"+a.method])),b=k({queue:this,job:a}),b.execute()},h.ended=function(a){varb=e({},a);h.removeJob({job:b});if(!c.job_method_object[b.method])return!1;if(!h.isThereJobsWhere(function(a){returna.method===b.method&&a.status==="ongoing"||a.status==="initial"})){i.publisher.publish(c.job_method_object[b.method]["stop_"+b.method]);return}},h.clean=function(){h.removeJob(undefined,{where:function(a){returna.status==="fail"}})},i.use_local_storage=b.options.use_local_storage,i.publisher=b.publisher,i.job_id=1,i.jio_id=0,i.job_object_name="",i.job_object={},i.recovered_job_object={},h},i=function(a,b){varc={},d={};returnd.interval=200,d.id=null,d.queue=a.queue,c.setIntervalDelay=function(a){d.interval=a},c.start=function(){returnd.id?!1:(d.id=setInterval(function(){d.queue.recoverOlderJobObject(),d.queue.invokeAll()},d.interval),!0)},c.stop=function(){returnd.id?(clearInterval(d.id),d.id=null,!0):!1},c},j=function(){varb={},c={};returnc.interval=400,c.id=null,b.start=function(a){returnc.id?!1:(b.touch(a),c.id=setInterval(function(){b.touch(a)},c.interval),!0)},b.stop=function(){returnc.id?(clearInterval(c.id),c.id=null,!0):!1},b.touch=function(b){a.setItem("jio/id/"+b,Date.now())},b},k=function(a){varb={},c={};returnc.job=a.job,c.callback=a.job.callback,c.queue=a.queue,c.res={status:"done",message:""},c.fail_checkNameAvailability=function(){c.res.message="Unable to check name availability."},c.done_checkNameAvailability=function(a){c.res.message=c.job.userName+" is "+(a?"":"not ")+"available.",c.res.return_value=a},c.fail_loadDocument=function(){c.res.message="Unable to load document."},c.done_loadDocument=function(a){c.res.message="Document loaded.",c.res.return_value=a,c.res.return_value.lastModified=(newDate(c.res.return_value.lastModified)).getTime(),c.res.return_value.creationDate=(newDate(c.res.return_value.creationDate)).getTime()},c.fail_saveDocument=function(){c.res.message="Unable to save document."},c.done_saveDocument=function(){c.res.message="Document saved."},c.fail_getDocumentList=function(){c.res.message="Unable to retrieve document list."},c.done_getDocumentList=function(a){varb;c.res.message="Document list received.",c.res.return_value=a;for(b=0;b<c.res.return_value.length;b+=1)c.res.return_value[b].lastModified=(newDate(c.res.return_value[b].lastModified)).getTime(),c.res.return_value[b].creationDate=(newDate(c.res.return_value[b].creationDate)).getTime()},c.fail_removeDocument=function(){c.res.message="Unable to removed document."},c.done_removeDocument=function(){c.res.message="Document removed."},c.retryLater=function(){vara=c.job.tries*c.job.tries*1e3;a>d.max_wait_time&&(a=d.max_wait_time),c.job.status="wait",c.job.waitingFor={time:Date.now()+a}},b.cloneJob=function(){returne({},c.job)},b.getUserName=function(){returnc.job.userName||""},b.getApplicantID=function(){returnc.job.applicant.ID||""},b.getStorageUserName=function(){returnc.job.storage.userName||""},b.getStoragePassword=function(){returnc.job.storage.password||""},b.getStorageLocation=function(){returnc.job.storage.location||""},b.getStorageArray=function(){returnc.job.storage.storageArray||[]},b.getFileName=function(){returnc.job.fileName||""},b.getFileContent=function(){returnc.job.fileContent||""},b.cloneOptionObject=function(){returne({},c.job.options)},b.getMaxTries=function(){returnc.job.maxtries},b.getTries=function(){returnc.job.tries||0},b.setMaxTries=function(a){c.job.maxtries=a},b.addJob=function(a){returnc.queue.createJob(a)},b.eliminate=function(){c.job.maxtries=1,c.job.tries=1,b.fail("Job Stopped!",0)},b.replace=function(a){c.job.tries=0,c.job.date=a.date,c.job.callback=a.callback,c.res.status="fail",c.res.message="Job Stopped!",c.res.error={},c.res.error.status=0,c.res.error.statusText="Replaced",c.res.error.message="The job was replaced by a newer one.",c["fail_"+c.job.method](),c.callback(c.res)},b.fail=function(a){c.res.status="fail",c.res.error=a,c.res.error.status=c.res.error.status||0,c.res.error.statusText=c.res.error.statusText||"Unknown Error",c.res.error.array=c.res.error.array||[],c.res.error.message=c.res.error.message||"",!c.job.maxtries||c.job.tries<c.job.maxtries?c.retryLater():(c.job.status="fail",c["fail_"+c.job.method](),c.queue.ended(c.job),c.callback(c.res))},b.done=function(a){c.job.status="done",c["done_"+c.job.method](a),c.queue.ended(c.job),c.callback(c.res)},b.execute=function(){returnc.job.tries=b.getTries()+1,d.storage_type_object[c.job.storage.type]?d.storage_type_object[c.job.storage.type]({job:c.job,queue:c.queue})[c.job.method]():null},b.checkNameAvailability=function(){b.fail({status:0,statusText:"Undefined Method",message:"This method must be redefined!"})},b.loadDocument=function(){b.fail({status:0,statusText:"Undefined Method",message:"This method must be redefined!"})},b.saveDocument=function(){b.fail({status:0,statusText:"Undefined Method",message:"This method must be redefined!"})},b.getDocumentList=function(){b.fail({status:0,statusText:"Undefined Method",message:"This method must be redefined!"})},b.removeDocument=function(){b.fail({status:0,statusText:"Undefined Method",message:"This method must be redefined!"})},b},l=function(a,b){varc={},g={};c.getID=function(){returng.id},c.start=function(){returng.id!==0?!1:(g.id=g.queue.getNewQueueID(),g.queue.init({jio_id:g.id}),g.updater&&g.updater.start(g.id),g.listener.start(),g.ready=!0,c.isReady())},c.stop=function(){returng.queue.close(),g.listener.stop(),g.updater&&g.updater.stop(),g.ready=!1,g.id=0,!0},c.kill=function(){returng.queue.close(),g.listener.stop(),g.updater&&g.updater.stop(),g.ready=!1,!0},c.isReady=function(){returng.ready},c.publish=function(a,b){if(!c.isReady())return;returng.pubsub.publish(a,b)},c.subscribe=function(a,b){returng.pubsub.subscribe(a,b)},c.unsubscribe=function(a,b){returng.pubsub.unsubscribe(a,b)},c.checkNameAvailability=function(a){varb=e({userName:g.storage.userName,storage:g.storage,applicant:g.applicant,method:"checkNameAvailability",callback:function(){}},a);returnc.isReady()&&b.userName&&b.storage&&b.applicant?g.queue.createJob(b):null},c.saveDocument=function(a){varb=e({storage:g.storage,applicant:g.applicant,method:"saveDocument",callback:function(){}},a);returnc.isReady()&&b.fileName&&b.fileContent&&b.storage&&b.applicant?g.queue.createJob(b):null},c.loadDocument=function(a){varb=e({storage:g.storage,applicant:g.applicant,method:"loadDocument",callback:function(){}},a);returnc.isReady()&&b.fileName&&b.storage&&b.applicant?g.queue.createJob(b):null},c.getDocumentList=function(a){varb=e({storage:g.storage,applicant:g.applicant,method:"getDocumentList",callback:function(){}},a);returnc.isReady()&&b.storage&&b.applicant?g.queue.createJob(b):null},c.removeDocument=function(a){varb=e({storage:g.storage,applicant:g.applicant,method:"removeDocument",callback:function(){}},a);returnc.isReady()&&b.fileName&&b.storage&&b.applicant?g.queue.createJob(b):null};vark=e({use_local_storage:!0},a.options);returntypeofa.storage=="string"&&(a.storage=JSON.parse(a.storage)),typeofa.applicant=="string"&&(a.applicant=JSON.parse(a.applicant)),g.storage=a.storage,g.applicant=a.applicant,g.id=0,g.pubsub=f({options:k}),g.queue=h({publisher:g.pubsub,options:k}),g.listener=i({queue:g.queue,options:k}),g.ready=!1,k.use_local_storage?g.updater=j({options:k}):g.updater=null,g.storage&&!d.storage_type_object[g.storage.type]&&console.error('Unknown storage type "'+g.storage.type+'"'),c.start(),c},m=function(a,b){varf={};returnf.createNew=function(a,b,c){vard=e({use_local_storage:!0},c);returnl({storage:a,applicant:b,options:d})},f.newBaseStorage=function(a,b){returnk(a,b)},f.addStorageType=function(a,b){returna&&b?(d.storage_type_object[a]=b,!0):!1},f.getGlobalObject=function(){returnd},f.getConstObject=function(){returne({},c)},f},m()};returnwindow.requirejs?(define("JIO",["LocalOrCookieStorage","jQuery"],a),undefined):a(LocalOrCookieStorage,jQuery)}();
(function(){vara=function(a,b,c,d){vare,f,g;e=function(b){vare=c.newBaseStorage(b),f={};returne.checkNameAvailability=function(){setTimeout(function(){varb=null,c,d;b=a.getAll();for(cinb){d=c.split("/");if(d[0]==="jio"&&d[1]==="local"&&d[2]===e.getUserName())returne.done(!1)}returne.done(!0)},100)},e.saveDocument=function(){setTimeout(function(){varb=null;returnb=a.getItem("jio/local/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName()),b?(b.lastModified=Date.now(),b.fileContent=e.getFileContent()):b={fileName:e.getFileName(),fileContent:e.getFileContent(),creationDate:Date.now(),lastModified:Date.now()},a.setItem("jio/local/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName(),b),e.done()},100)},e.loadDocument=function(){setTimeout(function(){varb=null,c=d.extend({getContent:!0},e.cloneOptionObject());b=a.getItem("jio/local/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName()),b?(c.getContent||deleteb.fileContent,e.done(b)):e.fail({status:404,statusText:"Not Found.",message:'Document "'+e.getFileName()+'" not found in localStorage.'})},100)},e.getDocumentList=function(){setTimeout(function(){varb=[],c=null,d="key",f=["splitedkey"],g={};c=a.getAll();for(dinc)f=d.split("/"),f[0]==="jio"&&f[1]==="local"&&f[2]===e.getStorageUserName()&&f[3]===e.getApplicantID()&&(g=JSON.parse(c[d]),b.push({fileName:g.fileName,creationDate:g.creationDate,lastModified:g.lastModified}));e.done(b)},100)},e.removeDocument=function(){setTimeout(function(){returna.deleteItem("jio/local/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName()),e.done()},100)},e},f=function(a){vare=c.newBaseStorage(a);returne.mkcol=function(a){varc=d.extend({success:function(){},error:function(){}},a),f=["splitedpath"],g="temp/path";if(!c.pathsteps)c.pathsteps=1,e.mkcol(c);else{f=c.path.split("/");if(c.pathsteps>=f.length-1)returnc.success();f.length=c.pathsteps+1,c.pathsteps++,g=f.join("/"),d.ajax({url:c.location+g,type:"MKCOL",async:!0,headers:{Authorization:"Basic "+b.encode(c.userName+":"+c.password),Depth:"1"},success:function(){e.mkcol(c)},error:function(a){c.error()}})}},e.checkNameAvailability=function(){d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/",async:!0,type:"PROPFIND",dataType:"xml",headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword()),Depth:"1"},success:function(a){e.done(!1)},error:function(a){a.status===404?e.done(!0):(a.message='Cannot check availability of "'+e.getUserName()+'" into DAVStorage.',e.fail(a))}})},e.saveDocument=function(){d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName(),type:"PUT",data:e.getFileContent(),async:!0,dataType:"text",headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword())},success:function(){e.done()},error:function(a){a.message='Cannot save "'+e.getFileName()+'" into DAVStorage.',e.fail(a)}})},e.loadDocument=function(){vara={},c=d.extend({getContent:!0},e.cloneOptionObject()),f=function(){d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName(),type:"GET",async:!0,dataType:"text",headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword())},success:function(b){a.fileContent=b,e.done(a)},error:function(a){a.status===404?a.message='Document "'+e.getFileName()+'" not found in localStorage.':a.message='Cannot load "'+e.getFileName()+'" from DAVStorage.',e.fail(a)}})};d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName(),type:"PROPFIND",async:!0,dataType:"xml",headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword())},success:function(b){d(b).find("lp1\\:getlastmodified, getlastmodified").each(function(){a.lastModified=d(this).text()}),d(b).find("lp1\\:creationdate, creationdate").each(function(){a.creationDate=d(this).text()}),a.fileName=e.getFileName(),c.getContent?f():e.done(a)},error:function(a){a.message='Cannot load "'+e.getFileName()+'" informations from DAVStorage.',e.fail(a)}})},e.getDocumentList=function(){vara=[],c={},f=[];d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/",async:!0,type:"PROPFIND",dataType:"xml",headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword()),Depth:"1"},success:function(b){d(b).find("D\\:response, response").each(function(b,e){if(b>0){c={},d(e).find("D\\:href, href").each(function(){f=d(this).text().split("/"),c.fileName=f[f.length-1]?f[f.length-1]:f[f.length-2]+"/"});if(c.fileName===".htaccess"||c.fileName===".htpasswd")return;d(e).find("lp1\\:getlastmodified, getlastmodified").each(function(){c.lastModified=d(this).text()}),d(e).find("lp1\\:creationdate, creationdate").each(function(){c.creationDate=d(this).text()}),a.push(c)}}),e.done(a)},error:function(a){a.message="Cannot get a document list from DAVStorage.",e.fail(a)}})},e.removeDocument=function(){d.ajax({url:e.getStorageLocation()+"/dav/"+e.getStorageUserName()+"/"+e.getApplicantID()+"/"+e.getFileName(),type:"DELETE",async:!0,headers:{Authorization:"Basic "+b.encode(e.getStorageUserName()+":"+e.getStoragePassword())},success:function(a){console.log(a),e.done()},error:function(a){console.log(a),a.status===404?e.done():(a.message='Cannot remove "'+e.getFileName()+'" from DAVStorage.',e.fail(a))}})},e},g=function(a){varb=c.newBaseStorage(a),d={};returnd.storageArray=b.getStorageArray(),d.length=d.storageArray.length,d.returnsValuesArray=[],d.maxtries=b.getMaxTries(),b.setMaxTries(1),d.execJobsFromStorageArray=function(a){varc={},e;for(e=0;e<d.storageArray.length;e+=1)c=b.cloneJob(),c.maxtries=d.maxtries,c.storage=d.storageArray[e],c.callback=a,b.addJob(c)},b.checkNameAvailability=function(){vara={},c="id",e=!1,f=[],g={status:"done"},h=function(a){d.returnsValuesArray.push(a);if(!e){if(a.status==="fail")g.status="fail",f.push(a.error);elseif(a.return_value===!1){b.done(!1),e=!0;return}if(d.returnsValuesArray.length===d.length){g.status==="fail"?b.fail({status:207,statusText:"Multi-Status",message:'Some check availability of "'+b.getUserName()+'" requests have failed.',array:f}):b.done(!0),e=!0;return}}};d.execJobsFromStorageArray(h)},b.saveDocument=function(){vara={},c={status:"done"},e="id",f=!1,g=[],h=function(a){d.returnsValuesArray.push(a),f||(a.status!=="fail"?(b.done(),f=!0):(g.push(a.error),d.returnsValuesArray.length===d.length&&b.fail({status:207,statusText:"Multi-Status",message:'All save "'+b.getFileName()+'" requests have failed.',array:g})))};d.execJobsFromStorageArray(h)},b.loadDocument=function(){vara={},c=!1,e={},f="id",g=!1,h=[],i={status:"done"},j=function(a){d.returnsValuesArray.push(a),g||(a.status!=="fail"?(b.done(a.return_value),g=!0):(h.push(a.error),d.returnsValuesArray.length===d.length&&b.fail({status:207,statusText:"Multi-Status",message:'All load "'+b.getFileName()+'" requests have failed.',array:h})))};d.execJobsFromStorageArray(j)},b.getDocumentList=function(){vara={},c={status:"done"},e="id",f=!1,g=[],h=function(a){d.returnsValuesArray.push(a),f||(a.status!=="fail"?(b.done(a.return_value),f=!0):(g.push(a.error),d.returnsValuesArray.length===d.length&&b.fail({status:207,statusText:"Multi-Status",message:"All get document list requests have failed",array:g})))};d.execJobsFromStorageArray(h)},b.removeDocument=function(){vara={},c={status:"done"},e="key",f=!1,g=[],h=function(a){d.returnsValuesArray.push(a),f||(a.status!=="fail"?(b.done(),f=!0):(g.push(a.error),d.returnsValuesArray.length===d.length&&b.fail({status:207,statusText:"Multi-Status",message:'All remove "'+b.getFileName()+'" requests have failed.',array:g})))};d.execJobsFromStorageArray(h)},b},c.addStorageType("local",function(a){returnnewe(a)}),c.addStorageType("dav",function(a){returnnewf(a)}),c.addStorageType("replicate",function(a){returnnewg(a)})};window.requirejs?define("JIOStorages",["LocalOrCookieStorage","Base64","JIO","jQuery"],a):a(LocalOrCookieStorage,Base64,JIO,jQuery)})();
\ No newline at end of file
(function(){vara=function(a,b,c,d){vare=function(a,b){varc;for(cinb)a[c]=b[c];returna},f,g,h;f=function(b,d){varf=c.newBaseStorage(b,d),g={};returnf.checkNameAvailability=function(){setTimeout(function(){varb=null,c,d;b=a.getAll();for(cinb){d=c.split("/");if(d[0]==="jio"&&d[1]==="local"&&d[2]===f.getUserName())returnf.done(!1)}returnf.done(!0)},100)},f.saveDocument=function(){setTimeout(function(){varb=null;returnb=a.getItem("jio/local/"+f.getStorageUserName()+"/"+f.getApplicantID()+"/"+f.getFileName()),b?(b.lastModified=Date.now(),b.fileContent=f.getFileContent()):b={fileName:f.getFileName(),fileContent:f.getFileContent(),creationDate:Date.now(),lastModified:Date.now()},a.setItem("jio/local/"+f.getStorageUserName()+"/"+f.getApplicantID()+"/"+f.getFileName(),b),f.done()},100)},f.loadDocument=function(){setTimeout(function(){varb=null,c=e({getContent:!0},f.cloneOptionObject());b=a.getItem("jio/local/"+f.getStorageUserName()+"/"+f.getApplicantID()+"/"+f.getFileName()),b?(c.getContent||deleteb.fileContent,f.done(b)):f.fail({status:404,statusText:"Not Found.",message:'Document "'+f.getFileName()+'" not found in localStorage.'})},100)},f.getDocumentList=function(){setTimeout(function(){varb=[],c=null,d="key",e=["splitedkey"],g={};c=a.getAll();for(dinc)e=d.split("/"),e[0]==="jio"&&e[1]==="local"&&e[2]===f.getStorageUserName()&&e[3]===f.getApplicantID()&&(g=JSON.parse(c[d]),b.push({fileName:g.fileName,creationDate:g.creationDate,lastModified:g.lastModified}));f.done(b)},100)},f.removeDocument=function(){setTimeout(function(){returna.deleteItem("jio/local/"+f.getStorageUserName()+"/"+f.getApplicantID()+"/"+f.getFileName()),f.done()},100)},f},g=function(a,f){varg=c.newBaseStorage(a,f);returng.mkcol=function(a){varc=e({success:function(){},error:function(){}},a),f=["splitedpath"],h="temp/path";if(!c.pathsteps)c.pathsteps=1,g.mkcol(c);else{f=c.path.split("/");if(c.pathsteps>=f.length-1)returnc.success();f.length=c.pathsteps+1,c.pathsteps++,h=f.join("/"),d.ajax({url:c.location+h,type:"MKCOL",async:!0,headers:{Authorization:"Basic "+b.encode(c.userName+":"+c.password),Depth:"1"},success:function(){g.mkcol(c)},error:function(a){c.error()}})}},g.checkNameAvailability=function(){d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/",async:!0,type:"PROPFIND",dataType:"xml",headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword()),Depth:"1"},success:function(a){g.done(!1)},error:function(a){a.status===404?g.done(!0):(a.message='Cannot check availability of "'+g.getUserName()+'" into DAVStorage.',g.fail(a))}})},g.saveDocument=function(){d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/"+g.getApplicantID()+"/"+g.getFileName(),type:"PUT",data:g.getFileContent(),async:!0,dataType:"text",headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword())},success:function(){g.done()},error:function(a){a.message='Cannot save "'+g.getFileName()+'" into DAVStorage.',g.fail(a)}})},g.loadDocument=function(){vara={},c=e({getContent:!0},g.cloneOptionObject()),f=function(){d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/"+g.getApplicantID()+"/"+g.getFileName(),type:"GET",async:!0,dataType:"text",headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword())},success:function(b){a.fileContent=b,g.done(a)},error:function(a){a.status===404?a.message='Document "'+g.getFileName()+'" not found in localStorage.':a.message='Cannot load "'+g.getFileName()+'" from DAVStorage.',g.fail(a)}})};d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/"+g.getApplicantID()+"/"+g.getFileName(),type:"PROPFIND",async:!0,dataType:"xml",headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword())},success:function(b){d(b).find("lp1\\:getlastmodified, getlastmodified").each(function(){a.lastModified=d(this).text()}),d(b).find("lp1\\:creationdate, creationdate").each(function(){a.creationDate=d(this).text()}),a.fileName=g.getFileName(),c.getContent?f():g.done(a)},error:function(a){a.message='Cannot load "'+g.getFileName()+'" informations from DAVStorage.',g.fail(a)}})},g.getDocumentList=function(){vara=[],c={},e=[];d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/"+g.getApplicantID()+"/",async:!0,type:"PROPFIND",dataType:"xml",headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword()),Depth:"1"},success:function(b){d(b).find("D\\:response, response").each(function(b,f){if(b>0){c={},d(f).find("D\\:href, href").each(function(){e=d(this).text().split("/"),c.fileName=e[e.length-1]?e[e.length-1]:e[e.length-2]+"/"});if(c.fileName===".htaccess"||c.fileName===".htpasswd")return;d(f).find("lp1\\:getlastmodified, getlastmodified").each(function(){c.lastModified=d(this).text()}),d(f).find("lp1\\:creationdate, creationdate").each(function(){c.creationDate=d(this).text()}),a.push(c)}}),g.done(a)},error:function(a){a.message="Cannot get a document list from DAVStorage.",g.fail(a)}})},g.removeDocument=function(){d.ajax({url:g.getStorageLocation()+"/dav/"+g.getStorageUserName()+"/"+g.getApplicantID()+"/"+g.getFileName(),type:"DELETE",async:!0,headers:{Authorization:"Basic "+b.encode(g.getStorageUserName()+":"+g.getStoragePassword())},success:function(){g.done()},error:function(a){a.status===404?g.done():(a.message='Cannot remove "'+g.getFileName()+'" from DAVStorage.',g.fail(a))}})},g},h=function(a,b){vard=c.newBaseStorage(a,b),e={};returne.storageArray=d.getStorageArray(),e.length=e.storageArray.length,e.returnsValuesArray=[],e.maxtries=d.getMaxTries(),d.setMaxTries(1),e.execJobsFromStorageArray=function(a){varb={},c;for(c=0;c<e.storageArray.length;c+=1)b=d.cloneJob(),b.maxtries=e.maxtries,b.storage=e.storageArray[c],b.callback=a,d.addJob(b)},d.checkNameAvailability=function(){vara={},b="id",c=!1,f=[],g={status:"done"},h=function(a){e.returnsValuesArray.push(a);if(!c){if(a.status==="fail")g.status="fail",f.push(a.error);elseif(a.return_value===!1){d.done(!1),c=!0;return}if(e.returnsValuesArray.length===e.length){g.status==="fail"?d.fail({status:207,statusText:"Multi-Status",message:'Some check availability of "'+d.getUserName()+'" requests have failed.',array:f}):d.done(!0),c=!0;return}}};e.execJobsFromStorageArray(h)},d.saveDocument=function(){vara={},b={status:"done"},c="id",f=!1,g=[],h=function(a){e.returnsValuesArray.push(a),f||(a.status!=="fail"?(d.done(),f=!0):(g.push(a.error),e.returnsValuesArray.length===e.length&&d.fail({status:207,statusText:"Multi-Status",message:'All save "'+d.getFileName()+'" requests have failed.',array:g})))};e.execJobsFromStorageArray(h)},d.loadDocument=function(){vara={},b=!1,c={},f="id",g=!1,h=[],i={status:"done"},j=function(a){e.returnsValuesArray.push(a),g||(a.status!=="fail"?(d.done(a.return_value),g=!0):(h.push(a.error),e.returnsValuesArray.length===e.length&&d.fail({status:207,statusText:"Multi-Status",message:'All load "'+d.getFileName()+'" requests have failed.',array:h})))};e.execJobsFromStorageArray(j)},d.getDocumentList=function(){vara={},b={status:"done"},c="id",f=!1,g=[],h=function(a){e.returnsValuesArray.push(a),f||(a.status!=="fail"?(d.done(a.return_value),f=!0):(g.push(a.error),e.returnsValuesArray.length===e.length&&d.fail({status:207,statusText:"Multi-Status",message:"All get document list requests have failed",array:g})))};e.execJobsFromStorageArray(h)},d.removeDocument=function(){vara={},b={status:"done"},c="key",f=!1,g=[],h=function(a){e.returnsValuesArray.push(a),f||(a.status!=="fail"?(d.done(),f=!0):(g.push(a.error),e.returnsValuesArray.length===e.length&&d.fail({status:207,statusText:"Multi-Status",message:'All remove "'+d.getFileName()+'" requests have failed.',array:g})))};e.execJobsFromStorageArray(h)},d},c.addStorageType("local",function(a){returnf(a)}),c.addStorageType("dav",function(a){returng(a)}),c.addStorageType("replicate",function(a){returnh(a)})};window.requirejs?define("JIOStorages",["LocalOrCookieStorage","Base64","JIO","jQuery"],a):a(LocalOrCookieStorage,Base64,JIO,jQuery)})();