//>>built
define("dojox/wire/TreeAdapter",["dijit","dojo","dojox","dojo/require!dojox/wire/CompositeWire"],function(m,d,e){d.provide("dojox.wire.TreeAdapter");d.require("dojox.wire.CompositeWire");d.declare("dojox.wire.TreeAdapter",e.wire.CompositeWire,{_wireClass:"dojox.wire.TreeAdapter",constructor:function(b){this._initializeChildren(this.nodes)},_getValue:function(b){if(!b||!this.nodes)return b;d.isArray(b)||(b=[b]);var c=[],a;for(a in b)for(var f in this.nodes)c=c.concat(this._getNodes(b[a],this.nodes[f]));
return c},_setValue:function(b,c){throw Error("Unsupported API: "+this._wireClass+"._setValue");},_initializeChildren:function(b){if(b)for(var c in b){var a=b[c];a.node&&(a.node.parent=this,e.wire.isWire(a.node)||(a.node=e.wire.create(a.node)));a.title&&(a.title.parent=this,e.wire.isWire(a.title)||(a.title=e.wire.create(a.title)));a.children&&this._initializeChildren(a.children)}},_getNodes:function(b,c){var a=null;if(c.node){a=c.node.getValue(b);if(!a)return[];d.isArray(a)||(a=[a])}else a=[b];var f=
[],k;for(k in a){b=a[k];var h={};h.title=c.title?c.title.getValue(b):b;if(c.children){var g=[],l;for(l in c.children)g=g.concat(this._getNodes(b,c.children[l]));0<g.length&&(h.children=g)}f.push(h)}return f}})});