//>>built
define("dojox/io/xhrMultiPart",["dojo/_base/kernel","dojo/_base/array","dojo/_base/xhr","dojo/query","dojox/uuid/generateRandomUuid"],function(f,n,p,k,l){function g(a,e){if(!a.name&&!a.content)throw Error("Each part of a multi-part request requires 'name' and 'content'.");var b=[];b.push("--"+e,'Content-Disposition: form-data; name\x3d"'+a.name+'"'+(a.filename?'; filename\x3d"'+a.filename+'"':""));if(a.contentType){var c="Content-Type: "+a.contentType;a.charset&&(c+="; Charset\x3d"+a.charset);b.push(c)}a.contentTransferEncoding&&
b.push("Content-Transfer-Encoding: "+a.contentTransferEncoding);b.push("",a.content);return b}function m(a,e){var b=f.formToObject(a),c=[],d;for(d in b)f.isArray(b[d])?f.forEach(b[d],function(h){c=c.concat(g({name:d,content:h},e))}):c=c.concat(g({name:d,content:b[d]},e));return c}f.getObject("io.xhrMultiPart",!0,dojox);dojox.io.xhrMultiPart=function(a){if(!a.file&&!a.content&&!a.form)throw Error("content, file or form must be provided to dojox.io.xhrMultiPart's arguments");var e=l(),b=[],c="";if(a.file||
a.content){var d=a.file||a.content;f.forEach(f.isArray(d)?d:[d],function(h){b=b.concat(g(h,e))})}else if(a.form){if(k("input[type\x3dfile]",a.form).length)throw Error("dojox.io.xhrMultiPart cannot post files that are values of an INPUT TYPE\x3dFILE.  Use dojo.io.iframe.send() instead.");b=m(a.form,e)}b.length&&(b.push("--"+e+"--",""),c=b.join("\r\n"));return f.rawXhrPost(f.mixin(a,{contentType:"multipart/form-data; boundary\x3d"+e,postData:c}))};return dojox.io.xhrMultiPart});