require.def("preview/requestBody",["domplate/domplate","i18n!nls/requestBody","core/lib","domplate/tabView","syntax-highlighter/shCore"],function(h,e,d,i,o){with(h){h=function(){};h.prototype=domplate({render:function(a,b){var c=new i("requestBody");c.appendTab(new g(b));b.request.queryString&&b.request.queryString.length&&c.appendTab(new j(b));b.request.postData&&c.appendTab(new k(b,b.request.method));b.response.content.size>0&&c.appendTab(new l(b));this.showCache(b)&&c.appendTab(new m(b));this.showHtml(b)&& c.appendTab(new n(b));a=c.render(a);c.selectTabByName("Headers");return a},showCache:function(a){if(!a.cache)return false;if(!a.cache.afterRequest)return false;if(a.category=="image")return false;return true},showHtml:function(a){return a.response.content.mimeType=="text/html"||a.mimeType=="application/xhtml+xml"}});var g=function(a){this.file=a};g.prototype=domplate(i.Tab.prototype,{id:"Headers",label:e.Headers,bodyTag:TABLE({"class":"netInfoHeadersText netInfoText netInfoHeadersTable",cellpadding:0, cellspacing:0},TBODY(TR({"class":"netInfoResponseHeadersTitle"},TD({colspan:2},DIV({"class":"netInfoHeadersGroup"},e.ResponseHeaders))),TR({"class":"netInfoRequestHeadersTitle"},TD({colspan:2},DIV({"class":"netInfoHeadersGroup"},e.RequestHeaders))))),headerDataTag:FOR("param","$headers",TR(TD({"class":"netInfoParamName"},"$param.name"),TD({"class":"netInfoParamValue"},PRE("$param|getParamValue")))),getParamValue:function(a){return d.wrapText(a.value,true)},onUpdateBody:function(a,b){this.file.response.headers&& this.insertHeaderRows(b,this.file.response.headers,"Headers","ResponseHeaders");this.file.request.headers&&this.insertHeaderRows(b,this.file.request.headers,"Headers","RequestHeaders")},insertHeaderRows:function(a,b,c,f){c=d.getElementByClass(a,"netInfo"+c+"Table");f=d.getElementByClass(c,"netInfo"+f+"Title");if(b.length){this.headerDataTag.insertRows({headers:b},f?f:a);d.removeClass(f,"collapsed")}else d.setClass(f,"collapsed")}});var l=function(a){this.file=a};l.prototype=domplate(i.Tab.prototype, {id:"Response",label:e.Response,bodyTag:DIV({"class":"netInfoResponseText netInfoText"},PRE({"class":"javascript:nocontrols:nogutter:",name:"code"})),onUpdateBody:function(a,b){a=d.getElementByClass(b,"netInfoResponseText");if(this.file.category=="image"){d.clearNode(a);b=b.ownerDocument.createElement("img");b.src=this.file.href;a.appendChild(b,a)}else{d.clearNode(a.firstChild);b=this.file.response.content.text;var c=this.file.response.content.mimeType;if(c=="application/javascript"||c=="text/javascript"|| c=="application/x-javascript"||c=="text/ecmascript"||c=="application/ecmascript"){a.firstChild.innerHTML=b;o.SyntaxHighlighter.HighlightAll(a.firstChild)}else d.insertWrappedText(b,a.firstChild)}}});var j=function(a){this.file=a};j.prototype=domplate(g.prototype,{id:"Params",label:e.URLParameters,bodyTag:TABLE({"class":"netInfoParamsText netInfoText netInfoParamsTable",cellpadding:0,cellspacing:0},TBODY()),onUpdateBody:function(a,b){this.file.request.queryString&&this.insertHeaderRows(d.getElementByClass(b, "netInfoParamsText"),this.file.request.queryString,"Params")}});var k=function(a,b){b=b.charAt(0).toUpperCase()+b.slice(1).toLowerCase();this.file=a;this.id=b;this.label=e[b]};k.prototype=domplate(g.prototype,{bodyTag:DIV({"class":"netInfo$tab.id\\Text netInfoText"},TABLE({"class":"netInfo$tab.id\\Table",cellpadding:0,cellspacing:0},TBODY())),onUpdateBody:function(a,b){if(a=this.file.request.postData){b=d.getElementByClass(b,"netInfo"+this.id+"Text");a.mimeType=="application/x-www-form-urlencoded"? this.insertHeaderRows(b,a.params,this.id):d.insertWrappedText(a.text,b)}}});(function(a){this.file=a}).prototype=domplate(g.prototype,{id:"Cookies",label:e.Cookies,bodyTag:DIV({"class":"netInfoCookiesText netInfoText"},TABLE({"class":"netInfoCookiesTable",cellpadding:0,cellspacing:0},TBODY(TR({"class":"netInfoResponseCookiesTitle"},TD({colspan:2},DIV({"class":"netInfoCookiesGroup"},e.ResponseCookies))),TR({"class":"netInfoRequestCookiesTitle"},TD({colspan:2},DIV({"class":"netInfoCookiesGroup"},e.RequestCookies)))))), onUpdateBody:function(a,b){if(file.response.cookies){a=d.getElementByClass(b,"netInfoParamsText");this.insertHeaderRows(a,file.response.cookies,"Cookies","ResponseCookies")}if(file.request.cookies){a=d.getElementByClass(b,"netInfoParamsText");this.insertHeaderRows(a,file.request.cookies,"Cookies","RequestCookies")}}});var m=function(a){this.file=a};m.prototype=domplate(g.prototype,{id:"Cache",label:e.Cache,bodyTag:DIV({"class":"netInfoCacheText netInfoText"},TABLE({"class":"netInfoCacheTable",cellpadding:0, cellspacing:0},TBODY())),onUpdateBody:function(a,b){if(this.file.cache&&this.file.cache.afterRequest){a=this.file.cache.afterRequest;var c=[];for(var f in a)c.push({name:f,value:a[f]});this.insertHeaderRows(b,c,"Cache")}}});var n=function(a){this.file=a};n.prototype=domplate(g.prototype,{id:"HTML",label:e.HTML,bodyTag:DIV({"class":"netInfoHtmlText netInfoText"},IFRAME({"class":"netInfoHtmlPreview"})),onUpdateBody:function(a,b){d.getElementByClass(b,"netInfoHtmlPreview").contentWindow.document.body.innerHTML= this.file.response.content.text}});return h}});