//>>built
define("dojox/storage/AirFileStorageProvider",["dojo","dijit","dojox","dojo/require!dojox/storage/manager,dojox/storage/Provider"],function(g,m,f){g.provide("dojox.storage.AirFileStorageProvider");g.require("dojox.storage.manager");g.require("dojox.storage.Provider");g.isAIR&&function(){if(!e)var e={};e.File=window.runtime.flash.filesystem.File;e.FileStream=window.runtime.flash.filesystem.FileStream;e.FileMode=window.runtime.flash.filesystem.FileMode;g.declare("dojox.storage.AirFileStorageProvider",
[f.storage.Provider],{initialized:!1,_storagePath:"__DOJO_STORAGE/",initialize:function(){this.initialized=!1;try{var a=e.File.applicationStorageDirectory.resolvePath(this._storagePath);a.exists||a.createDirectory();this.initialized=!0}catch(b){console.debug("dojox.storage.AirFileStorageProvider.initialize:",b)}f.storage.manager.loaded()},isAvailable:function(){return!0},put:function(a,b,c,d){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);d=d||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(d))throw Error("Invalid namespace given: "+
d);try{this.remove(a,d);var h=e.File.applicationStorageDirectory.resolvePath(this._storagePath+d);h.exists||h.createDirectory();var g=h.resolvePath(a),f=new e.FileStream;f.open(g,e.FileMode.WRITE);f.writeObject(b);f.close()}catch(l){console.debug("dojox.storage.AirFileStorageProvider.put:",l);c(this.FAILED,a,l.toString(),d);return}c&&c(this.SUCCESS,a,null,d)},get:function(a,b){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);b=b||this.DEFAULT_NAMESPACE;var c=null,d=e.File.applicationStorageDirectory.resolvePath(this._storagePath+
b+"/"+a);if(d.exists&&!d.isDirectory){var h=new e.FileStream;h.open(d,e.FileMode.READ);c=h.readObject();h.close()}return c},getNamespaces:function(){var a=[this.DEFAULT_NAMESPACE],b=e.File.applicationStorageDirectory.resolvePath(this._storagePath).getDirectoryListing(),c;for(c=0;c<b.length;c++)b[c].isDirectory&&b[c].name!=this.DEFAULT_NAMESPACE&&a.push(b[c].name);return a},getKeys:function(a){a=a||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+a);var b=[];
a=e.File.applicationStorageDirectory.resolvePath(this._storagePath+a);if(a.exists&&a.isDirectory){a=a.getDirectoryListing();var c;for(c=0;c<a.length;c++)b.push(a[c].name)}return b},clear:function(a){if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+a);a=e.File.applicationStorageDirectory.resolvePath(this._storagePath+a);a.exists&&a.isDirectory&&a.deleteDirectory(!0)},remove:function(a,b){b=b||this.DEFAULT_NAMESPACE;var c=e.File.applicationStorageDirectory.resolvePath(this._storagePath+
b+"/"+a);c.exists&&!c.isDirectory&&c.deleteFile()},putMultiple:function(a,b,c,d){if(!1===this.isValidKeyArray(a)||!b instanceof Array||a.length!=b.length)throw Error("Invalid arguments: keys \x3d ["+a+"], values \x3d ["+b+"]");if(null==d||"undefined"==typeof d)d=this.DEFAULT_NAMESPACE;if(0==this.isValidKey(d))throw Error("Invalid namespace given: "+d);this._statusHandler=c;try{for(var e=0;e<a.length;e++)this.put(a[e],b[e],null,d)}catch(k){console.debug("dojox.storage.AirFileStorageProvider.putMultiple:",
k);c&&c(this.FAILED,a,k.toString(),d);return}c&&c(this.SUCCESS,a,null,d)},getMultiple:function(a,b){if(!1===this.isValidKeyArray(a))throw Error("Invalid key array given: "+a);if(null==b||"undefined"==typeof b)b=this.DEFAULT_NAMESPACE;if(0==this.isValidKey(b))throw Error("Invalid namespace given: "+b);for(var c=[],d=0;d<a.length;d++)c[d]=this.get(a[d],b);return c},removeMultiple:function(a,b){b=b||this.DEFAULT_NAMESPACE;for(var c=0;c<a.length;c++)this.remove(a[c],b)},isPermanent:function(){return!0},
getMaximumSize:function(){return this.SIZE_NO_LIMIT},hasSettingsUI:function(){return!1},showSettingsUI:function(){throw Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw Error(this.declaredClass+" does not support a storage settings user-interface");}});f.storage.manager.register("dojox.storage.AirFileStorageProvider",new f.storage.AirFileStorageProvider);f.storage.manager.initialize()}()});