//>>built
define("dojox/wire/Wire",["dijit","dojo","dojox","dojo/require!dojox/wire/_base"],function(m,f,k){f.provide("dojox.wire.Wire");f.require("dojox.wire._base");f.declare("dojox.wire.Wire",null,{_wireClass:"dojox.wire.Wire",constructor:function(b){f.mixin(this,b);if(this.converter)if(f.isString(this.converter)){b=f.getObject(this.converter);if(f.isFunction(b))try{var a=new b;a&&!f.isFunction(a.convert)?this.converter={convert:b}:this.converter=a}catch(c){}else f.isObject(b)&&f.isFunction(b.convert)&&
(this.converter=b);f.isString(this.converter)&&(this.converter=(a=k.wire._getClass(this.converter))?new a:void 0)}else f.isFunction(this.converter)&&(this.converter={convert:this.converter})},getValue:function(b){var a=void 0;a=k.wire.isWire(this.object)?this.object.getValue(b):this.object||b;if(this.property){b=this.property.split(".");for(var c in b){if(!a)return a;a=this._getPropertyValue(a,b[c])}}c=void 0;if(c=this._getValue?this._getValue(a):a)this.type&&("string"==this.type?c=c.toString():"number"==
this.type?c=parseInt(c,10):"boolean"==this.type?c="false"!=c:"array"==this.type&&(f.isArray(c)||(c=[c]))),this.converter&&this.converter.convert&&(c=this.converter.convert(c,this));return c},setValue:function(b,a){var c=void 0;c=k.wire.isWire(this.object)?this.object.getValue(a):this.object||a;var d=void 0;if(this.property){if(!c)if(k.wire.isWire(this.object))c={},this.object.setValue(c,a);else throw Error(this._wireClass+".setValue(): invalid object");d=this.property.split(".");for(var h=d.length-
1,e=0;e<h;e++){var l=d[e];var g=this._getPropertyValue(c,l);g||(g={},this._setPropertyValue(c,l,g));c=g}d=d[h]}if(this._setValue){if(d&&(g=this._getPropertyValue(c,d),g||(g={},this._setPropertyValue(c,d,g)),c=g),g=this._setValue(c,b),!c&&g)if(k.wire.isWire(this.object))this.object.setValue(g,a);else throw Error(this._wireClass+".setValue(): invalid object");}else if(d)this._setPropertyValue(c,d,b);else if(k.wire.isWire(this.object))this.object.setValue(b,a);else throw Error(this._wireClass+".setValue(): invalid property");
},_getPropertyValue:function(b,a){var c=void 0,d=a.indexOf("[");if(0<=d){var h=a.indexOf("]");h=a.substring(d+1,h);var e=null;0===d?e=b:(a=a.substring(0,d),(e=this._getPropertyValue(b,a))&&!f.isArray(e)&&(e=[e]));e&&(c=e[h])}else b.getPropertyValue?c=b.getPropertyValue(a):(c="get"+a.charAt(0).toUpperCase()+a.substring(1),c=this._useGet(b)?b.get(a):this._useAttr(b)?b.attr(a):b[c]?b[c]():b[a]);return c},_setPropertyValue:function(b,a,c){var d=a.indexOf("[");if(0<=d){var h=a.indexOf("]");h=a.substring(d+
1,h);var e=null;0===d?e=b:(a=a.substring(0,d),e=this._getPropertyValue(b,a),e||(e=[],this._setPropertyValue(b,a,e)));e[h]=c}else if(b.setPropertyValue)b.setPropertyValue(a,c);else if(d="set"+a.charAt(0).toUpperCase()+a.substring(1),this._useSet(b))b.set(a,c);else if(this._useAttr(b))b.attr(a,c);else if(b[d])b[d](c);else b[a]=c},_useGet:function(b){var a=!1;f.isFunction(b.get)&&(a=!0);return a},_useSet:function(b){var a=!1;f.isFunction(b.set)&&(a=!0);return a},_useAttr:function(b){var a=!1;f.isFunction(b.attr)&&
(a=!0);return a}})});