//>>built
define("dojox/html/format",["dojo/_base/kernel","./entities","dojo/_base/array","dojo/_base/window","dojo/_base/sniff"],function(h,y,D,E,z){var p=h.getObject("dojox.html.format",!0);p.prettyPrint=function(p,l,n,A,F){var e=[],k=0,v=[],m="\t",f="",B=[],w,G=/[=]([^"']+?)(\s|>)/g,H=/style=("[^"]*"|'[^']*'|\S*)/gi,I=/[\w-]+=("[^"]*"|'[^']*'|\S*)/gi;if(l&&0<l&&10>l)for(m="",w=0;w<l;w++)m+=" ";l=E.doc.createElement("div");l.innerHTML=p;var J=y.encode,K=y.decode,x=l.ownerDocument.createElement("div"),L=function(a){a=
a.cloneNode(!1);x.appendChild(a);a=x.innerHTML;x.innerHTML="";return a},q=function(){var a;for(a=0;a<k;a++)e.push(m)},r=function(){e.push("\n")},t=function(a){var b,d;a=a.split("\n");for(b=0;b<a.length;b++)a[b]=h.trim(a[b]);a=a.join(" ");a=h.trim(a);if(""!==a){var c=[];if(n&&0<n){var g="";for(b=0;b<k;b++)g+=m;b=g.length;g=n;for(n>b&&(g-=b);a;)if(a.length>n){for(b=g;0<b&&" "!==a.charAt(b);b--);if(!b)for(b=g;b<a.length&&" "!==a.charAt(b);b++);var e=a.substring(0,b),e=h.trim(e);a=h.trim(a.substring(b==
a.length?a.length:b+1,a.length));if(e){d="";for(b=0;b<k;b++)d+=m;e=d+e+"\n"}c.push(e)}else{d="";for(b=0;b<k;b++)d+=m;a=d+a+"\n";c.push(a);a=null}return c.join("")}d="";for(b=0;b<k;b++)d+=m;return d+a+"\n"}return""},M=function(a){if(a){var b=a;b&&(b=b.replace(/&quot;/gi,'"'),b=b.replace(/&gt;/gi,"\x3e"),b=b.replace(/&lt;/gi,"\x3c"),b=b.replace(/&amp;/gi,"\x26"));var d,c;a=0;for(var g=b.split("\n"),e=[],b=0;b<g.length;b++){var f=g[b],u=-1<f.indexOf("\n");if(f=h.trim(f)){u=a;for(d=0;d<f.length;d++)c=
f.charAt(d),"{"===c?a++:"}"===c&&(a--,u=a);c="";for(d=0;d<k+u;d++)c+=m;e.push(c+f+"\n")}else u&&0===b&&e.push("\n")}a=e.join("")}return a},N=function(a){var b=a.nodeName.toLowerCase(),d=h.trim(L(a));a=d.substring(0,d.indexOf("\x3e")+1);a=a.replace(G,'\x3d"$1"$2');a=a.replace(H,function(a){var b=a.substring(0,6);a=a.substring(6,a.length);var c=a.charAt(0);a=h.trim(a.substring(1,a.length-1));a=a.split(";");var d=[];D.forEach(a,function(a){if(a=h.trim(a))a=a.substring(0,a.indexOf(":")).toLowerCase()+
a.substring(a.indexOf(":"),a.length),d.push(a)});d=d.sort();a=d.join("; ");var e=h.trim(a);return e&&";"!==e?b+c+(a+";")+c:""});var c=[];a=a.replace(I,function(a){c.push(h.trim(a));return""});c=c.sort();a="\x3c"+b;c.length&&(a+=" "+c.join(" "));-1!=d.indexOf("\x3c/")?(v.push(b),a+="\x3e"):(a=F?a+" /\x3e":a+"\x3e",v.push(!1));a:switch(b){case "a":case "b":case "strong":case "s":case "strike":case "i":case "u":case "em":case "sup":case "sub":case "span":case "font":case "big":case "cite":case "q":case "small":b=
!0;break a;default:b=!1}B.push(b);f&&!b&&(e.push(t(f)),f="");b?f+=a:(q(),e.push(a),r(),k++)},C=function(a){var b=a.childNodes;if(b){var d;for(d=0;d<b.length;d++){var c=b[d];if(1===c.nodeType){var g=h.trim(c.tagName.toLowerCase());z("ie")&&c.parentNode!=a||g&&"/"===g.charAt(0)||(N(c),"script"===g?e.push(M(c.innerHTML)):"pre"===g?(c=c.innerHTML,z("mozilla")&&(c=c.replace("\x3cbr\x3e","\n"),c=c.replace("\x3cpre\x3e",""),c=c.replace("\x3c/pre\x3e","")),"\n"!==c.charAt(c.length-1)&&(c+="\n"),e.push(c)):
C(c),c=B.pop(),f&&!c&&(e.push(t(f)),f=""),(g=v.pop())?(g="\x3c/"+g+"\x3e",c?f+=g:(k--,q(),e.push(g),r())):k--)}else 3===c.nodeType||4===c.nodeType?f+=J(c.nodeValue,A):8===c.nodeType&&(c=K(c.nodeValue,A),q(),e.push("\x3c!--"),r(),k++,e.push(t(c)),k--,q(),e.push("--\x3e"),r())}}};C(l);f&&(e.push(t(f)),f="");return e.join("")};return p});