//>>built
define("dojox/data/HtmlTableStore","dojo/_base/kernel dojo/_base/declare dojo/_base/lang dojo/dom dojo/_base/array dojo/_base/xhr dojo/_base/sniff dojo/data/util/simpleFetch dojo/data/util/filter dojox/xml/parser".split(" "),function(p,q,u,r,t,v,z,A,w,x){q=q("dojox.data.HtmlTableStore",null,{constructor:function(a){p.deprecated("dojox.data.HtmlTableStore","Please use dojox.data.HtmlStore");if(a.url){if(!a.tableId)throw Error("dojo.data.HtmlTableStore: Cannot instantiate using url without an id!");
this.url=a.url;this.tableId=a.tableId}else for(a.tableId?(this._rootNode=r.byId(a.tableId),this.tableId=this._rootNode.id):this._rootNode=r.byId(this.tableId),this._getHeadings(),a=0;a<this._rootNode.rows.length;a++)this._rootNode.rows[a].store=this},url:"",tableId:"",_getHeadings:function(){this._headings=[];t.forEach(this._rootNode.tHead.rows[0].cells,u.hitch(this,function(a){this._headings.push(x.textContent(a))}))},_getAllItems:function(){for(var a=[],c=1;c<this._rootNode.rows.length;c++)a.push(this._rootNode.rows[c]);
return a},_assertIsItem:function(a){if(!this.isItem(a))throw Error("dojo.data.HtmlTableStore: a function was passed an item argument that was not an item");},_assertIsAttribute:function(a){if("string"!==typeof a)throw Error("dojo.data.HtmlTableStore: a function was passed an attribute argument that was not an attribute name string");return t.indexOf(this._headings,a)},getValue:function(a,c,b){a=this.getValues(a,c);return 0<a.length?a[0]:b},getValues:function(a,c){this._assertIsItem(a);var b=this._assertIsAttribute(c);
return-1<b?[x.textContent(a.cells[b])]:[]},getAttributes:function(a){this._assertIsItem(a);for(var c=[],b=0;b<this._headings.length;b++)this.hasAttribute(a,this._headings[b])&&c.push(this._headings[b]);return c},hasAttribute:function(a,c){return 0<this.getValues(a,c).length},containsValue:function(a,c,b){var d=void 0;"string"===typeof b&&(d=w.patternToRegExp(b,!1));return this._containsValue(a,c,b,d)},_containsValue:function(a,c,b,d){a=this.getValues(a,c);for(c=0;c<a.length;++c){var e=a[c];if("string"===
typeof e&&d)return null!==e.match(d);if(b===e)return!0}return!1},isItem:function(a){return a&&a.store&&a.store===this?!0:!1},isItemLoaded:function(a){return this.isItem(a)},loadItem:function(a){this._assertIsItem(a.item)},_fetchItems:function(a,c,b){if(this._rootNode)this._finishFetchItems(a,c,b);else if(this.url){var d=this,e=v.get({url:this.url,handleAs:"text"});e.addCallback(function(g){var f=function(h,k){if(h.id==k)return h;if(h.childNodes)for(var m=0;m<h.childNodes.length;m++){var n=f(h.childNodes[m],
k);if(n)return n}return null},l=document.createElement("div");l.innerHTML=g;d._rootNode=f(l,d.tableId);d._getHeadings.call(d);for(g=0;g<d._rootNode.rows.length;g++)d._rootNode.rows[g].store=d;d._finishFetchItems(a,c,b)});e.addErrback(function(g){b(g,a)})}else for(this._rootNode=r.byId(this.tableId),this._getHeadings(),e=0;e<this._rootNode.rows.length;e++)this._rootNode.rows[e].store=this},_finishFetchItems:function(a,c,b){b=null;var d=this._getAllItems();if(a.query){var e=a.queryOptions?a.queryOptions.ignoreCase:
!1;b=[];var g={},f;for(f in a.query){var l=a.query[f]+"";"string"===typeof l&&(g[f]=w.patternToRegExp(l,e))}for(e=0;e<d.length;++e){var h=!0,k=d[e];for(f in a.query)l=a.query[f]+"",this._containsValue(k,f,l,g[f])||(h=!1);h&&b.push(k)}}else 0<d.length&&(b=d.slice(0,d.length));c(b,a)},getFeatures:function(){return{"dojo.data.api.Read":!0,"dojo.data.api.Identity":!0}},close:function(a){},getLabel:function(a){if(this.isItem(a))return"Table Row #"+this.getIdentity(a)},getLabelAttributes:function(a){return null},
getIdentity:function(a){this._assertIsItem(a);return z("opera")?t.indexOf(this._rootNode.rows,a)-1:a.sectionRowIndex},getIdentityAttributes:function(a){return null},fetchItemByIdentity:function(a){var c=a.identity,b=this,d=null,e=null;if(this._rootNode)this._rootNode.rows[c+1]&&(d=this._rootNode.rows[c+1],a.onItem&&(e=a.scope?a.scope:p.global,a.onItem.call(e,d)));else if(this.url){var g=v.get({url:this.url,handleAs:"text"});g.addCallback(function(f){var l=function(k,m){if(k.id==m)return k;if(k.childNodes)for(var n=
0;n<k.childNodes.length;n++){var y=l(k.childNodes[n],m);if(y)return y}return null},h=document.createElement("div");h.innerHTML=f;b._rootNode=l(h,b.tableId);b._getHeadings.call(b);for(f=0;f<b._rootNode.rows.length;f++)b._rootNode.rows[f].store=b;d=b._rootNode.rows[c+1];a.onItem&&(e=a.scope?a.scope:p.global,a.onItem.call(e,d))});g.addErrback(function(f){a.onError&&(e=a.scope?a.scope:p.global,a.onError.call(e,f))})}else{this._rootNode=r.byId(this.tableId);this._getHeadings();for(g=0;g<this._rootNode.rows.length;g++)this._rootNode.rows[g].store=
this;d=this._rootNode.rows[c+1];a.onItem&&(e=a.scope?a.scope:p.global,a.onItem.call(e,d))}}});u.extend(q,A);return q});