goog.provide('ajax.xml_http_request'); ajax.xml_http_request.ready_state = (function ajax$xml_http_request$ready_state(e){ var G__47160 = e.target.readyState; var fexpr__47159 = new cljs.core.PersistentArrayMap(null, 5, [(0),new cljs.core.Keyword(null,"not-initialized","not-initialized",-1937378906),(1),new cljs.core.Keyword(null,"connection-established","connection-established",-1403749733),(2),new cljs.core.Keyword(null,"request-received","request-received",2110590540),(3),new cljs.core.Keyword(null,"processing-request","processing-request",-264947221),(4),new cljs.core.Keyword(null,"response-ready","response-ready",245208276)], null); return (fexpr__47159.cljs$core$IFn$_invoke$arity$1 ? fexpr__47159.cljs$core$IFn$_invoke$arity$1(G__47160) : fexpr__47159.call(null,G__47160)); }); ajax.xml_http_request.append = (function ajax$xml_http_request$append(current,next){ if(cljs.core.truth_(current)){ return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(current),", ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(next)].join(''); } else { return next; } }); ajax.xml_http_request.process_headers = (function ajax$xml_http_request$process_headers(header_str){ if(cljs.core.truth_(header_str)){ return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (headers,header_line){ if(cljs.core.truth_(goog.string.isEmptyOrWhitespace(header_line))){ return headers; } else { var key_value = goog.string.splitLimit(header_line,": ",(2)); return cljs.core.update.cljs$core$IFn$_invoke$arity$4(headers,(key_value[(0)]),ajax.xml_http_request.append,(key_value[(1)])); } }),cljs.core.PersistentArrayMap.EMPTY,header_str.split("\r\n")); } else { return cljs.core.PersistentArrayMap.EMPTY; } }); ajax.xml_http_request.xmlhttprequest = (((typeof goog !== 'undefined') && (typeof goog.global !== 'undefined') && (typeof goog.global.XMLHttpRequest !== 'undefined'))?goog.global.XMLHttpRequest:(((typeof require !== 'undefined'))?(function (){var req = require; return (req.cljs$core$IFn$_invoke$arity$1 ? req.cljs$core$IFn$_invoke$arity$1("xmlhttprequest") : req.call(null,"xmlhttprequest")).XMLHttpRequest; })():null)); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxImpl$ = cljs.core.PROTOCOL_SENTINEL); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxImpl$_js_ajax_request$arity$3 = (function (this$,p__47168,handler){ var map__47169 = p__47168; var map__47169__$1 = cljs.core.__destructure_map(map__47169); var uri = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__47169__$1,new cljs.core.Keyword(null,"uri","uri",-774711847)); var method = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__47169__$1,new cljs.core.Keyword(null,"method","method",55703592)); var body = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__47169__$1,new cljs.core.Keyword(null,"body","body",-2049205669)); var headers = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__47169__$1,new cljs.core.Keyword(null,"headers","headers",-835030129)); var timeout = cljs.core.get.cljs$core$IFn$_invoke$arity$3(map__47169__$1,new cljs.core.Keyword(null,"timeout","timeout",-318625318),(0)); var with_credentials = cljs.core.get.cljs$core$IFn$_invoke$arity$3(map__47169__$1,new cljs.core.Keyword(null,"with-credentials","with-credentials",-1163127235),false); var response_format = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__47169__$1,new cljs.core.Keyword(null,"response-format","response-format",1664465322)); var this$__$1 = this; (this$__$1.withCredentials = with_credentials); (this$__$1.onreadystatechange = (function (p1__47167_SHARP_){ if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"response-ready","response-ready",245208276),ajax.xml_http_request.ready_state(p1__47167_SHARP_))){ return (handler.cljs$core$IFn$_invoke$arity$1 ? handler.cljs$core$IFn$_invoke$arity$1(this$__$1) : handler.call(null,this$__$1)); } else { return null; } })); this$__$1.open(method,uri,true); (this$__$1.timeout = timeout); var temp__5804__auto___47205 = new cljs.core.Keyword(null,"type","type",1174270348).cljs$core$IFn$_invoke$arity$1(response_format); if(cljs.core.truth_(temp__5804__auto___47205)){ var response_type_47206 = temp__5804__auto___47205; (this$__$1.responseType = cljs.core.name(response_type_47206)); } else { } var seq__47170_47207 = cljs.core.seq(headers); var chunk__47171_47208 = null; var count__47172_47209 = (0); var i__47173_47210 = (0); while(true){ if((i__47173_47210 < count__47172_47209)){ var vec__47183_47211 = chunk__47171_47208.cljs$core$IIndexed$_nth$arity$2(null,i__47173_47210); var k_47212 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__47183_47211,(0),null); var v_47213 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__47183_47211,(1),null); this$__$1.setRequestHeader(k_47212,v_47213); var G__47214 = seq__47170_47207; var G__47215 = chunk__47171_47208; var G__47216 = count__47172_47209; var G__47217 = (i__47173_47210 + (1)); seq__47170_47207 = G__47214; chunk__47171_47208 = G__47215; count__47172_47209 = G__47216; i__47173_47210 = G__47217; continue; } else { var temp__5804__auto___47219 = cljs.core.seq(seq__47170_47207); if(temp__5804__auto___47219){ var seq__47170_47220__$1 = temp__5804__auto___47219; if(cljs.core.chunked_seq_QMARK_(seq__47170_47220__$1)){ var c__5548__auto___47221 = cljs.core.chunk_first(seq__47170_47220__$1); var G__47222 = cljs.core.chunk_rest(seq__47170_47220__$1); var G__47223 = c__5548__auto___47221; var G__47224 = cljs.core.count(c__5548__auto___47221); var G__47225 = (0); seq__47170_47207 = G__47222; chunk__47171_47208 = G__47223; count__47172_47209 = G__47224; i__47173_47210 = G__47225; continue; } else { var vec__47188_47226 = cljs.core.first(seq__47170_47220__$1); var k_47227 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__47188_47226,(0),null); var v_47228 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__47188_47226,(1),null); this$__$1.setRequestHeader(k_47227,v_47228); var G__47229 = cljs.core.next(seq__47170_47220__$1); var G__47230 = null; var G__47231 = (0); var G__47232 = (0); seq__47170_47207 = G__47229; chunk__47171_47208 = G__47230; count__47172_47209 = G__47231; i__47173_47210 = G__47232; continue; } } else { } } break; } this$__$1.send((function (){var or__5025__auto__ = body; if(cljs.core.truth_(or__5025__auto__)){ return or__5025__auto__; } else { return ""; } })()); return this$__$1; })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxRequest$ = cljs.core.PROTOCOL_SENTINEL); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxRequest$_abort$arity$1 = (function (this$){ var this$__$1 = this; return this$__$1.abort(); })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$ = cljs.core.PROTOCOL_SENTINEL); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_body$arity$1 = (function (this$){ var this$__$1 = this; return this$__$1.response; })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_status$arity$1 = (function (this$){ var this$__$1 = this; return this$__$1.status; })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_status_text$arity$1 = (function (this$){ var this$__$1 = this; return this$__$1.statusText; })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_get_all_headers$arity$1 = (function (this$){ var this$__$1 = this; return ajax.xml_http_request.process_headers(this$__$1.getAllResponseHeaders()); })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_get_response_header$arity$2 = (function (this$,header){ var this$__$1 = this; return this$__$1.getResponseHeader(header); })); (ajax.xml_http_request.xmlhttprequest.prototype.ajax$protocols$AjaxResponse$_was_aborted$arity$1 = (function (this$){ var this$__$1 = this; return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2((0),this$__$1.readyState); })); //# sourceMappingURL=ajax.xml_http_request.js.map