//>>built
define("dojo/request/iframe","module require ./watch ./util ./handlers ../_base/lang ../io-query ../query ../has ../dom ../dom-construct ../_base/window ../NodeList-dom ../NodeList-manipulate".split(" "),function(D,E,F,r,G,y,A,B,n,C,t,d){function H(a){return!this.isFulfilled()}function I(a){return!!this._finished}function J(a,b){if(!b)try{var f=a.options,g=c.doc(c._frame),e=f.handleAs;if("html"!==e){if("xml"===e)if("html"===g.documentElement.tagName.toLowerCase()){B("a",g.documentElement).orphan();
var d=g.documentElement.innerText||g.documentElement.textContent,d=d.replace(/>\s+</g,"\x3e\x3c");a.text=y.trim(d)}else a.data=g;else a.text=g.getElementsByTagName("textarea")[0].value;G(a)}else a.data=g}catch(h){b=h}b?this.reject(b):this._finished?this.resolve(a):this.reject(Error("Invalid dojo/request/iframe request state"))}function K(a){this._callNext()}function c(a,b,f){var d=r.parseArgs(a,r.deepCreate(L,b),!0);a=d.url;b=d.options;if("GET"!==b.method&&"POST"!==b.method)throw Error(b.method+" not supported by dojo/request/iframe");
c._frame||(c._frame=c.create(c._iframeName,z+"();"));a=r.deferred(d,null,H,I,J,K);a._callNext=function(){this._calledNext||(this._calledNext=!0,c._currentDfd=null,c._fireNextRequest())};a._legacy=f;c._dfdQueue.push(a);c._fireNextRequest();F(a);return f?a:a.promise}var v=D.id.replace(/[\/\.\-]/g,"_"),z=v+"_onload";d.global[z]||(d.global[z]=function(){var a=c._currentDfd;if(a){var b=C.byId(a.response.options.form)||a._tmpForm;if(b){for(var f=a._contentToClean,d=0;d<f.length;d++)for(var e=f[d],l=0;l<
b.childNodes.length;l++){var h=b.childNodes[l];if(h.name===e){t.destroy(h);break}}a._originalAction&&b.setAttribute("action",a._originalAction);a._originalMethod&&(b.setAttribute("method",a._originalMethod),b.method=a._originalMethod);a._originalTarget&&(b.setAttribute("target",a._originalTarget),b.target=a._originalTarget)}a._tmpForm&&(t.destroy(a._tmpForm),delete a._tmpForm);a._finished=!0}else c._fireNextRequest()});var L={method:"POST"};c.create=function(a,b,c){if(d.global[a])return d.global[a];
if(d.global.frames[a])return d.global.frames[a];c||(n("config-useXDomain")&&n("config-dojoBlankHtmlUrl"),c=n("config-dojoBlankHtmlUrl")||E.toUrl("dojo/resources/blank.html"));b=t.place('\x3ciframe id\x3d"'+a+'" name\x3d"'+a+'" src\x3d"'+c+'" onload\x3d"'+b+'" style\x3d"position: absolute; left: 1px; top: 1px; height: 1px; width: 1px; visibility: hidden"\x3e',d.body());return d.global[a]=b};c.doc=function(a){if(a.contentDocument)return a.contentDocument;var b=a.name;if(b){var c=d.doc.getElementsByTagName("iframe");
if(a.document&&c[b].contentWindow&&c[b].contentWindow.document)return c[b].contentWindow.document;if(d.doc.frames[b]&&d.doc.frames[b].document)return d.doc.frames[b].document}return null};c.setSrc=function(a,b,c){a=d.global.frames[a.name];a.contentWindow&&(a=a.contentWindow);try{c?a.location.replace(b):a.location=b}catch(g){}};c._iframeName=v+"_IoIframe";c._notifyStart=function(){};c._dfdQueue=[];c._currentDfd=null;c._fireNextRequest=function(){var a;try{if(!c._currentDfd&&c._dfdQueue.length){do a=
c._currentDfd=c._dfdQueue.shift();while(a&&(a.canceled||a.isCanceled&&a.isCanceled())&&c._dfdQueue.length);if(!a||a.canceled||a.isCanceled&&a.isCanceled())c._currentDfd=null;else{var b=a.response,f=b.options,g=a._contentToClean=[],e=C.byId(f.form),l=r.notify,h=f.data||null,p;a._legacy||"POST"!==f.method||e?"GET"===f.method&&e&&-1<b.url.indexOf("?")&&(p=b.url.slice(b.url.indexOf("?")+1),h=y.mixin(A.queryToObject(p),h)):e=a._tmpForm=t.create("form",{name:v+"_form",style:{position:"absolute",top:"-1000px",
left:"-1000px"}},d.body());if(e){if(!a._legacy){var k=e;do k=k.parentNode;while(k&&k!==d.doc.documentElement);k||(e.style.position="absolute",e.style.left="-1000px",e.style.top="-1000px",d.body().appendChild(e));e.name||(e.name=v+"_form")}if(h){var k=function(a,b){t.create("input",{type:"hidden",name:a,value:b},e);g.push(a)},u;for(u in h){var q=h[u];if(y.isArray(q)&&1<q.length)for(p=0;p<q.length;p++)k(u,q[p]);else{var n=B("input[name\x3d'"+u+"']",e);-1==n.indexOf()?k(u,q):n.val(q)}}}var w=e.getAttributeNode("action"),
m=e.getAttributeNode("method"),x=e.getAttributeNode("target");b.url&&(a._originalAction=w?w.value:null,w?w.value=b.url:e.setAttribute("action",b.url));a._legacy?m&&m.value||(m?m.value=f.method:e.setAttribute("method",f.method)):(a._originalMethod=m?m.value:null,m?m.value=f.method:e.setAttribute("method",f.method));a._originalTarget=x?x.value:null;x?x.value=c._iframeName:e.setAttribute("target",c._iframeName);e.target=c._iframeName;l&&l.emit("send",b,a.promise.cancel);c._notifyStart(b);e.submit()}else f=
"",b.options.data&&(f=b.options.data,"string"!==typeof f&&(f=A.objectToQuery(f))),k=b.url+(-1<b.url.indexOf("?")?"\x26":"?")+f,l&&l.emit("send",b,a.promise.cancel),c._notifyStart(b),c.setSrc(c._frame,k,!0)}}}catch(M){a.reject(M)}};r.addCommonMethods(c,["GET","POST"]);return c});
//# sourceMappingURL=iframe.js.map