text: // Compiled by ClojureScript 1.10.520 {}
  goog.provide('reagent.impl.template');
  goog.require('cljs.core');
  goog.require('react');
  goog.require('clojure.string');
  goog.require('clojure.walk');
  goog.require('reagent.impl.util');
  goog.require('reagent.impl.component');
  goog.require('reagent.impl.batching');
  goog.require('reagent.ratom');
  goog.require('reagent.interop');
  goog.require('reagent.debug');
  reagent.impl.template.global$module$react = goog.global["React"];
  /**
   * Regular expression that parses a CSS-style id and class
   *           from a tag name.
   */
  reagent.impl.template.re_tag = /([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?/;
  
  /**
  * @constructor
  */
  reagent.impl.template.NativeWrapper = (function (){
  });
  
  reagent.impl.template.NativeWrapper.getBasis = (function (){
  return cljs.core.PersistentVector.EMPTY;
  });
  
  reagent.impl.template.NativeWrapper.cljs$lang$type = true;
  
  reagent.impl.template.NativeWrapper.cljs$lang$ctorStr = "reagent.impl.template/NativeWrapper";
  
  reagent.impl.template.NativeWrapper.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
  return cljs.core._write.call(null,writer__4375__auto__,"reagent.impl.template/NativeWrapper");
  });
  
  /**
   * Positional factory function for reagent.impl.template/NativeWrapper.
   */
  reagent.impl.template.__GT_NativeWrapper = (function reagent$impl$template$__GT_NativeWrapper(){
  return (new reagent.impl.template.NativeWrapper());
  });
  
  reagent.impl.template.named_QMARK_ = (function reagent$impl$template$named_QMARK_(x){
  return (((x instanceof cljs.core.Keyword)) || ((x instanceof cljs.core.Symbol)));
  });
  reagent.impl.template.hiccup_tag_QMARK_ = (function reagent$impl$template$hiccup_tag_QMARK_(x){
  return ((reagent.impl.template.named_QMARK_.call(null,x)) || (typeof x === 'string'));
  });
  reagent.impl.template.valid_tag_QMARK_ = (function reagent$impl$template$valid_tag_QMARK_(x){
  return ((reagent.impl.template.hiccup_tag_QMARK_.call(null,x)) || (cljs.core.ifn_QMARK_.call(null,x)) || ((x instanceof reagent.impl.template.NativeWrapper)));
  });
  reagent.impl.template.prop_name_cache = ({"class": "className", "for": "htmlFor", "charset": "charSet"});
  reagent.impl.template.cache_get = (function reagent$impl$template$cache_get(o,k){
  if(o.hasOwnProperty(k)){
  return (o[k]);
  } else {
  return null;
  }
  });
  reagent.impl.template.cached_prop_name = (function reagent$impl$template$cached_prop_name(k){
  if(reagent.impl.template.named_QMARK_.call(null,k)){
  var temp__5722__auto__ = reagent.impl.template.cache_get.call(null,reagent.impl.template.prop_name_cache,cljs.core.name.call(null,k));
  if((temp__5722__auto__ == null)){
  return (reagent.impl.template.prop_name_cache[cljs.core.name.call(null,k)] = reagent.impl.util.dash_to_camel.call(null,k));
  } else {
  var k_SINGLEQUOTE_ = temp__5722__auto__;
  return k_SINGLEQUOTE_;
  }
  } else {
  return k;
  }
  });
  reagent.impl.template.js_val_QMARK_ = (function reagent$impl$template$js_val_QMARK_(x){
  return (!(("object" === goog.typeOf(x))));
  });
  reagent.impl.template.kv_conv = (function reagent$impl$template$kv_conv(o,k,v){
  var G__34659 = o;
  (G__34659[reagent.impl.template.cached_prop_name.call(null,k)] = reagent.impl.template.convert_prop_value.call(null,v));
  
  return G__34659;
  });
  reagent.impl.template.convert_prop_value = (function reagent$impl$template$convert_prop_value(x){
  if(reagent.impl.template.js_val_QMARK_.call(null,x)){
  return x;
  } else {
  if(reagent.impl.template.named_QMARK_.call(null,x)){
  return cljs.core.name.call(null,x);
  } else {
  if(cljs.core.map_QMARK_.call(null,x)){
  return cljs.core.reduce_kv.call(null,reagent.impl.template.kv_conv,({}),x);
  } else {
  if(cljs.core.coll_QMARK_.call(null,x)){
  return cljs.core.clj__GT_js.call(null,x);
  } else {
  if(cljs.core.ifn_QMARK_.call(null,x)){
  return (function() { 
  var G__34660__delegate = function (args){
  return cljs.core.apply.call(null,x,args);
  };
  var G__34660 = function (var_args){
  var args = null;
  if (arguments.length > 0) {
  var G__34661__i = 0, G__34661__a = new Array(arguments.length -  0);
  while (G__34661__i < G__34661__a.length) {G__34661__a[G__34661__i] = arguments[G__34661__i + 0]; ++G__34661__i;}
    args = new cljs.core.IndexedSeq(G__34661__a,0,null);
  } 
  return G__34660__delegate.call(this,args);};
  G__34660.cljs$lang$maxFixedArity = 0;
  G__34660.cljs$lang$applyTo = (function (arglist__34662){
  var args = cljs.core.seq(arglist__34662);
  return G__34660__delegate(args);
  });
  G__34660.cljs$core$IFn$_invoke$arity$variadic = G__34660__delegate;
  return G__34660;
  })()
  ;
  } else {
  return cljs.core.clj__GT_js.call(null,x);
  
  }
  }
  }
  }
  }
  });
  reagent.impl.template.custom_prop_name_cache = ({});
  reagent.impl.template.cached_custom_prop_name = (function reagent$impl$template$cached_custom_prop_name(k){
  if(reagent.impl.template.named_QMARK_.call(null,k)){
  var temp__5722__auto__ = reagent.impl.template.cache_get.call(null,reagent.impl.template.custom_prop_name_cache,cljs.core.name.call(null,k));
  if((temp__5722__auto__ == null)){
  return (reagent.impl.template.custom_prop_name_cache[cljs.core.name.call(null,k)] = reagent.impl.util.dash_to_camel.call(null,k));
  } else {
  var k_SINGLEQUOTE_ = temp__5722__auto__;
  return k_SINGLEQUOTE_;
  }
  } else {
  return k;
  }
  });
  reagent.impl.template.custom_kv_conv = (function reagent$impl$template$custom_kv_conv(o,k,v){
  var G__34663 = o;
  (G__34663[reagent.impl.template.cached_custom_prop_name.call(null,k)] = reagent.impl.template.convert_prop_value.call(null,v));
  
  return G__34663;
  });
  reagent.impl.template.convert_custom_prop_value = (function reagent$impl$template$convert_custom_prop_value(x){
  if(reagent.impl.template.js_val_QMARK_.call(null,x)){
  return x;
  } else {
  if(reagent.impl.template.named_QMARK_.call(null,x)){
  return cljs.core.name.call(null,x);
  } else {
  if(cljs.core.map_QMARK_.call(null,x)){
  return cljs.core.reduce_kv.call(null,reagent.impl.template.custom_kv_conv,({}),x);
  } else {
  if(cljs.core.coll_QMARK_.call(null,x)){
  return cljs.core.clj__GT_js.call(null,x);
  } else {
  if(cljs.core.ifn_QMARK_.call(null,x)){
  return (function() { 
  var G__34664__delegate = function (args){
  return cljs.core.apply.call(null,x,args);
  };
  var G__34664 = function (var_args){
  var args = null;
  if (arguments.length > 0) {
  var G__34665__i = 0, G__34665__a = new Array(arguments.length -  0);
  while (G__34665__i < G__34665__a.length) {G__34665__a[G__34665__i] = arguments[G__34665__i + 0]; ++G__34665__i;}
    args = new cljs.core.IndexedSeq(G__34665__a,0,null);
  } 
  return G__34664__delegate.call(this,args);};
  G__34664.cljs$lang$maxFixedArity = 0;
  G__34664.cljs$lang$applyTo = (function (arglist__34666){
  var args = cljs.core.seq(arglist__34666);
  return G__34664__delegate(args);
  });
  G__34664.cljs$core$IFn$_invoke$arity$variadic = G__34664__delegate;
  return G__34664;
  })()
  ;
  } else {
  return cljs.core.clj__GT_js.call(null,x);
  
  }
  }
  }
  }
  }
  });
  reagent.impl.template.oset = (function reagent$impl$template$oset(o,k,v){
  var G__34667 = (((o == null))?({}):o);
  (G__34667[k] = v);
  
  return G__34667;
  });
  reagent.impl.template.oget = (function reagent$impl$template$oget(o,k){
  if((o == null)){
  return null;
  } else {
  return (o[k]);
  }
  });
  /**
   * Takes the id and class from tag keyword, and adds them to the
   *   other props. Parsed tag is JS object with :id and :class properties.
   */
  reagent.impl.template.set_id_class = (function reagent$impl$template$set_id_class(props,id_class){
  var id = (id_class["id"]);
  var class$ = (id_class["class"]);
  var G__34668 = props;
  var G__34668__$1 = (((((!((id == null)))) && ((new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(props) == null))))?cljs.core.assoc.call(null,G__34668,new cljs.core.Keyword(null,"id","id",-1388402092),id):G__34668);
  if(cljs.core.truth_(class$)){
  return cljs.core.assoc.call(null,G__34668__$1,new cljs.core.Keyword(null,"class","class",-2030961996),(function (){var old_class = new cljs.core.Keyword(null,"class","class",-2030961996).cljs$core$IFn$_invoke$arity$1(props);
  if((old_class == null)){
  return class$;
  } else {
  return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(class$)," ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(((reagent.impl.template.named_QMARK_.call(null,old_class))?cljs.core.name.call(null,old_class):old_class))].join('');
  }
  })());
  } else {
  return G__34668__$1;
  }
  });
  reagent.impl.template.stringify_class = (function reagent$impl$template$stringify_class(p__34669){
  var map__34670 = p__34669;
  var map__34670__$1 = (((((!((map__34670 == null))))?(((((map__34670.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34670.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34670):map__34670);
  var props = map__34670__$1;
  var class$ = cljs.core.get.call(null,map__34670__$1,new cljs.core.Keyword(null,"class","class",-2030961996));
  if(cljs.core.coll_QMARK_.call(null,class$)){
  return cljs.core.assoc.call(null,props,new cljs.core.Keyword(null,"class","class",-2030961996),clojure.string.join.call(null," ",cljs.core.keep.call(null,((function (map__34670,map__34670__$1,props,class$){
  return (function (c){
  if(cljs.core.truth_(c)){
  if(reagent.impl.template.named_QMARK_.call(null,c)){
  return cljs.core.name.call(null,c);
  } else {
  return c;
  }
  } else {
  return null;
  }
  });})(map__34670,map__34670__$1,props,class$))
  ,class$)));
  } else {
  return props;
  }
  });
  reagent.impl.template.convert_props = (function reagent$impl$template$convert_props(props,id_class){
  var props__$1 = reagent.impl.template.set_id_class.call(null,reagent.impl.template.stringify_class.call(null,props),id_class);
  if(cljs.core.truth_((id_class["custom"]))){
  return reagent.impl.template.convert_custom_prop_value.call(null,props__$1);
  } else {
  return reagent.impl.template.convert_prop_value.call(null,props__$1);
  }
  });
  if((typeof reagent !== 'undefined') && (typeof reagent.impl !== 'undefined') && (typeof reagent.impl.template !== 'undefined') && (typeof reagent.impl.template.find_dom_node !== 'undefined')){
  } else {
  reagent.impl.template.find_dom_node = null;
  }
  reagent.impl.template.these_inputs_have_selection_api = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 6, ["url",null,"tel",null,"text",null,"textarea",null,"password",null,"search",null], null), null);
  reagent.impl.template.has_selection_api_QMARK_ = (function reagent$impl$template$has_selection_api_QMARK_(input_type){
  return cljs.core.contains_QMARK_.call(null,reagent.impl.template.these_inputs_have_selection_api,input_type);
  });
  reagent.impl.template.input_node_set_value = (function reagent$impl$template$input_node_set_value(node,rendered_value,dom_value,component,p__34672){
  var map__34673 = p__34672;
  var map__34673__$1 = (((((!((map__34673 == null))))?(((((map__34673.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34673.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34673):map__34673);
  var on_write = cljs.core.get.call(null,map__34673__$1,new cljs.core.Keyword(null,"on-write","on-write",31519475));
  if((!((((node === (document["activeElement"]))) && (reagent.impl.template.has_selection_api_QMARK_.call(null,(node["type"]))) && (typeof rendered_value === 'string') && (typeof dom_value === 'string'))))){
  (component["cljsDOMValue"] = rendered_value);
  
  (node["value"] = rendered_value);
  
  if(cljs.core.fn_QMARK_.call(null,on_write)){
  return on_write.call(null,rendered_value);
  } else {
  return null;
  }
  } else {
  var node_value = (node["value"]);
  if(cljs.core.not_EQ_.call(null,node_value,dom_value)){
  return reagent.impl.batching.do_after_render.call(null,((function (node_value,map__34673,map__34673__$1,on_write){
  return (function (){
  return reagent.impl.template.input_component_set_value.call(null,component);
  });})(node_value,map__34673,map__34673__$1,on_write))
  );
  } else {
  var existing_offset_from_end = (cljs.core.count.call(null,node_value) - (node["selectionStart"]));
  var new_cursor_offset = (cljs.core.count.call(null,rendered_value) - existing_offset_from_end);
  (component["cljsDOMValue"] = rendered_value);
  
  (node["value"] = rendered_value);
  
  if(cljs.core.fn_QMARK_.call(null,on_write)){
  on_write.call(null,rendered_value);
  } else {
  }
  
  (node["selectionStart"] = new_cursor_offset);
  
  return (node["selectionEnd"] = new_cursor_offset);
  }
  }
  });
  reagent.impl.template.input_component_set_value = (function reagent$impl$template$input_component_set_value(this$){
  if(cljs.core.truth_((this$["cljsInputLive"]))){
  (this$["cljsInputDirty"] = false);
  
  var rendered_value = (this$["cljsRenderedValue"]);
  var dom_value = (this$["cljsDOMValue"]);
  var node = reagent.impl.template.find_dom_node.call(null,this$);
  if(cljs.core.not_EQ_.call(null,rendered_value,dom_value)){
  return reagent.impl.template.input_node_set_value.call(null,node,rendered_value,dom_value,this$,cljs.core.PersistentArrayMap.EMPTY);
  } else {
  return null;
  }
  } else {
  return null;
  }
  });
  reagent.impl.template.input_handle_change = (function reagent$impl$template$input_handle_change(this$,on_change,e){
  (this$["cljsDOMValue"] = e.target.value);
  
  if(cljs.core.truth_((this$["cljsInputDirty"]))){
  } else {
  (this$["cljsInputDirty"] = true);
  
  reagent.impl.batching.do_after_render.call(null,(function (){
  return reagent.impl.template.input_component_set_value.call(null,this$);
  }));
  }
  
  return on_change.call(null,e);
  });
  reagent.impl.template.input_render_setup = (function reagent$impl$template$input_render_setup(this$,jsprops){
  if(cljs.core.truth_((function (){var and__4120__auto__ = (!((jsprops == null)));
  if(and__4120__auto__){
  var and__4120__auto____$1 = jsprops.hasOwnProperty("onChange");
  if(cljs.core.truth_(and__4120__auto____$1)){
  return jsprops.hasOwnProperty("value");
  } else {
  return and__4120__auto____$1;
  }
  } else {
  return and__4120__auto__;
  }
  })())){
  if(cljs.core.truth_(reagent.impl.template.find_dom_node)){
  } else {
  throw (new Error(["Assert failed: ","reagent.dom needs to be loaded for controlled input to work","\n","find-dom-node"].join('')));
  }
  
  var v = (jsprops["value"]);
  var value = (((v == null))?"":v);
  var on_change = (jsprops["onChange"]);
  if(cljs.core.truth_((this$["cljsInputLive"]))){
  } else {
  (this$["cljsInputLive"] = true);
  
  (this$["cljsDOMValue"] = value);
  }
  
  (this$["cljsRenderedValue"] = value);
  
  delete jsprops["value"];
  
  var G__34676 = jsprops;
  (G__34676["defaultValue"] = value);
  
  (G__34676["onChange"] = ((function (G__34676,v,value,on_change){
  return (function (p1__34675_SHARP_){
  return reagent.impl.template.input_handle_change.call(null,this$,on_change,p1__34675_SHARP_);
  });})(G__34676,v,value,on_change))
  );
  
  return G__34676;
  } else {
  return null;
  }
  });
  reagent.impl.template.input_unmount = (function reagent$impl$template$input_unmount(this$){
  return (this$["cljsInputLive"] = null);
  });
  reagent.impl.template.input_component_QMARK_ = (function reagent$impl$template$input_component_QMARK_(x){
  var G__34677 = x;
  switch (G__34677) {
  case "input":
  case "textarea":
  return true;
  
  break;
  default:
  return false;
  
  }
  });
  reagent.impl.template.reagent_input_class = null;
  reagent.impl.template.input_spec = new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"display-name","display-name",694513143),"ReagentInput",new cljs.core.Keyword(null,"component-did-update","component-did-update",-1468549173),reagent.impl.template.input_component_set_value,new cljs.core.Keyword(null,"component-will-unmount","component-will-unmount",-2058314698),reagent.impl.template.input_unmount,new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853),(function (argv,comp,jsprops,first_child){
  var this$ = reagent.impl.component._STAR_current_component_STAR_;
  reagent.impl.template.input_render_setup.call(null,this$,jsprops);
  
  return reagent.impl.template.make_element.call(null,argv,comp,jsprops,first_child);
  })], null);
  reagent.impl.template.reagent_input = (function reagent$impl$template$reagent_input(){
  if((reagent.impl.template.reagent_input_class == null)){
  reagent.impl.template.reagent_input_class = reagent.impl.component.create_class.call(null,reagent.impl.template.input_spec);
  } else {
  }
  
  return reagent.impl.template.reagent_input_class;
  });
  reagent.impl.template.parse_tag = (function reagent$impl$template$parse_tag(hiccup_tag){
  var vec__34679 = cljs.core.next.call(null,cljs.core.re_matches.call(null,reagent.impl.template.re_tag,cljs.core.name.call(null,hiccup_tag)));
  var tag = cljs.core.nth.call(null,vec__34679,(0),null);
  var id = cljs.core.nth.call(null,vec__34679,(1),null);
  var class$ = cljs.core.nth.call(null,vec__34679,(2),null);
  var class$__$1 = (((class$ == null))?null:clojure.string.replace.call(null,class$,/\./," "));
  if(cljs.core.truth_(tag)){
  } else {
  throw (new Error(["Assert failed: ",["Invalid tag: '",cljs.core.str.cljs$core$IFn$_invoke$arity$1(hiccup_tag),"'",reagent.impl.component.comp_name.call(null)].join(''),"\n","tag"].join('')));
  }
  
  return ({"name": tag, "id": id, "class": class$__$1, "custom": cljs.core.not_EQ_.call(null,(-1),tag.indexOf("-"))});
  });
  reagent.impl.template.try_get_key = (function reagent$impl$template$try_get_key(x){
  try{return cljs.core.get.call(null,x,new cljs.core.Keyword(null,"key","key",-1516042587));
  }catch (e34682){var e = e34682;
  return null;
  }});
  reagent.impl.template.get_key = (function reagent$impl$template$get_key(x){
  if(cljs.core.map_QMARK_.call(null,x)){
  return reagent.impl.template.try_get_key.call(null,x);
  } else {
  return null;
  }
  });
  reagent.impl.template.key_from_vec = (function reagent$impl$template$key_from_vec(v){
  var temp__5722__auto__ = reagent.impl.template.get_key.call(null,cljs.core.meta.call(null,v));
  if((temp__5722__auto__ == null)){
  return reagent.impl.template.get_key.call(null,cljs.core.nth.call(null,v,(1),null));
  } else {
  var k = temp__5722__auto__;
  return k;
  }
  });
  reagent.impl.template.reag_element = (function reagent$impl$template$reag_element(tag,v){
  var c = reagent.impl.component.as_class.call(null,tag);
  var jsprops = ({"argv": v});
  var temp__5724__auto___34683 = reagent.impl.template.key_from_vec.call(null,v);
  if((temp__5724__auto___34683 == null)){
  } else {
  var key_34684 = temp__5724__auto___34683;
  (jsprops["key"] = key_34684);
  }
  
  return reagent.impl.template.global$module$react.createElement.call(null,c,jsprops);
  });
  reagent.impl.template.fragment_element = (function reagent$impl$template$fragment_element(argv){
  var props = cljs.core.nth.call(null,argv,(1),null);
  var hasprops = (((props == null)) || (cljs.core.map_QMARK_.call(null,props)));
  var jsprops = reagent.impl.template.convert_prop_value.call(null,((hasprops)?props:null));
  var first_child = ((1) + ((hasprops)?(1):(0)));
  var temp__5724__auto___34685 = reagent.impl.template.key_from_vec.call(null,argv);
  if((temp__5724__auto___34685 == null)){
  } else {
  var key_34686 = temp__5724__auto___34685;
  reagent.impl.template.oset.call(null,jsprops,"key",key_34686);
  }
  
  return reagent.impl.template.make_element.call(null,argv,reagent.impl.template.global$module$react.Fragment,jsprops,first_child);
  });
  reagent.impl.template.adapt_react_class = (function reagent$impl$template$adapt_react_class(c){
  var G__34687 = reagent.impl.template.__GT_NativeWrapper.call(null);
  (G__34687["name"] = c);
  
  (G__34687["id"] = null);
  
  (G__34687["class"] = null);
  
  return G__34687;
  });
  reagent.impl.template.tag_name_cache = ({});
  reagent.impl.template.cached_parse = (function reagent$impl$template$cached_parse(x){
  var temp__5722__auto__ = reagent.impl.template.cache_get.call(null,reagent.impl.template.tag_name_cache,x);
  if((temp__5722__auto__ == null)){
  return (reagent.impl.template.tag_name_cache[x] = reagent.impl.template.parse_tag.call(null,x));
  } else {
  var s = temp__5722__auto__;
  return s;
  }
  });
  reagent.impl.template.native_element = (function reagent$impl$template$native_element(parsed,argv,first){
  var comp = (parsed["name"]);
  var props = cljs.core.nth.call(null,argv,first,null);
  var hasprops = (((props == null)) || (cljs.core.map_QMARK_.call(null,props)));
  var jsprops = reagent.impl.template.convert_props.call(null,((hasprops)?props:null),parsed);
  var first_child = (first + ((hasprops)?(1):(0)));
  if(reagent.impl.template.input_component_QMARK_.call(null,comp)){
  return reagent.impl.template.as_element.call(null,cljs.core.with_meta.call(null,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [reagent.impl.template.reagent_input.call(null),argv,comp,jsprops,first_child], null),cljs.core.meta.call(null,argv)));
  } else {
  var key = reagent.impl.template.get_key.call(null,cljs.core.meta.call(null,argv));
  var p = (((key == null))?jsprops:reagent.impl.template.oset.call(null,jsprops,"key",key));
  return reagent.impl.template.make_element.call(null,argv,comp,p,first_child);
  }
  });
  reagent.impl.template.str_coll = (function reagent$impl$template$str_coll(coll){
  return cljs.core.str.cljs$core$IFn$_invoke$arity$1(clojure.walk.prewalk.call(null,(function (x){
  if(cljs.core.fn_QMARK_.call(null,x)){
  var n = reagent.impl.util.fun_name.call(null,x);
  var G__34689 = n;
  switch (G__34689) {
  case "":
  return x;
  
  break;
  default:
  return cljs.core.symbol.call(null,n);
  
  }
  } else {
  return x;
  }
  }),coll));
  
  });
  reagent.impl.template.hiccup_err = (function reagent$impl$template$hiccup_err(var_args){
  var args__4736__auto__ = [];
  var len__4730__auto___34693 = arguments.length;
  var i__4731__auto___34694 = (0);
  while(true){
  if((i__4731__auto___34694 < len__4730__auto___34693)){
  args__4736__auto__.push((arguments[i__4731__auto___34694]));
  
  var G__34695 = (i__4731__auto___34694 + (1));
  i__4731__auto___34694 = G__34695;
  continue;
  } else {
  }
  break;
  }
  
  var argseq__4737__auto__ = ((((1) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__auto__.slice((1)),(0),null)):null);
  return reagent.impl.template.hiccup_err.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__4737__auto__);
  });
  
  reagent.impl.template.hiccup_err.cljs$core$IFn$_invoke$arity$variadic = (function (v,msg){
  return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.apply.call(null,cljs.core.str,msg)),": ",reagent.impl.template.str_coll.call(null,v),"\n",reagent.impl.component.comp_name.call(null)].join('');
  });
  
  reagent.impl.template.hiccup_err.cljs$lang$maxFixedArity = (1);
  
  /** @this {Function} */
  reagent.impl.template.hiccup_err.cljs$lang$applyTo = (function (seq34691){
  var G__34692 = cljs.core.first.call(null,seq34691);
  var seq34691__$1 = cljs.core.next.call(null,seq34691);
  var self__4717__auto__ = this;
  return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__34692,seq34691__$1);
  });
  
  reagent.impl.template.vec_to_elem = (function reagent$impl$template$vec_to_elem(v){
  while(true){
  if((cljs.core.count.call(null,v) > (0))){
  } else {
  throw (new Error(["Assert failed: ",reagent.impl.template.hiccup_err.call(null,v,"Hiccup form should not be empty"),"\n","(pos? (count v))"].join('')));
  }
  
  var tag = cljs.core.nth.call(null,v,(0),null);
  if(reagent.impl.template.valid_tag_QMARK_.call(null,tag)){
  } else {
  throw (new Error(["Assert failed: ",reagent.impl.template.hiccup_err.call(null,v,"Invalid Hiccup form"),"\n","(valid-tag? tag)"].join('')));
  }
  
  if(cljs.core.keyword_identical_QMARK_.call(null,new cljs.core.Keyword(null,"<>","<>",1280186386),tag)){
  return reagent.impl.template.fragment_element.call(null,v);
  } else {
  if(reagent.impl.template.hiccup_tag_QMARK_.call(null,tag)){
  var n = cljs.core.name.call(null,tag);
  var pos = n.indexOf(">");
  var G__34696 = pos;
  switch (G__34696) {
  case (-1):
  return reagent.impl.template.native_element.call(null,reagent.impl.template.cached_parse.call(null,n),v,(1));
  
  break;
  case (0):
  var comp = cljs.core.nth.call(null,v,(1),null);
  if(cljs.core._EQ_.call(null,">",n)){
  } else {
  throw (new Error(["Assert failed: ",reagent.impl.template.hiccup_err.call(null,v,"Invalid Hiccup tag"),"\n","(= \">\" n)"].join('')));
  }
  
  return reagent.impl.template.native_element.call(null,({"name": comp}),v,(2));
  
  break;
  default:
  var G__34698 = cljs.core.with_meta.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.subs.call(null,n,(0),pos),cljs.core.assoc.call(null,cljs.core.with_meta.call(null,v,null),(0),cljs.core.subs.call(null,n,(pos + (1))))], null),cljs.core.meta.call(null,v));
  v = G__34698;
  continue;
  
  }
  } else {
  if((tag instanceof reagent.impl.template.NativeWrapper)){
  return reagent.impl.template.native_element.call(null,tag,v,(1));
  } else {
  return reagent.impl.template.reag_element.call(null,tag,v);
  
  }
  }
  }
  break;
  }
  });
  reagent.impl.template.as_element = (function reagent$impl$template$as_element(x){
  if(reagent.impl.template.js_val_QMARK_.call(null,x)){
  return x;
  } else {
  if(cljs.core.vector_QMARK_.call(null,x)){
  return reagent.impl.template.vec_to_elem.call(null,x);
  } else {
  if(cljs.core.seq_QMARK_.call(null,x)){
  return reagent.impl.template.expand_seq_check.call(null,x);
  
  } else {
  if(reagent.impl.template.named_QMARK_.call(null,x)){
  return cljs.core.name.call(null,x);
  } else {
  if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (2147483648))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$IPrintWithWriter$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IPrintWithWriter,x):false)):cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IPrintWithWriter,x))){
  return cljs.core.pr_str.call(null,x);
  } else {
  return x;
  
  }
  }
  }
  }
  }
  });
  reagent.impl.component.as_element = reagent.impl.template.as_element;
  reagent.impl.template.expand_seq = (function reagent$impl$template$expand_seq(s){
  var a = cljs.core.into_array.call(null,s);
  var n__4607__auto___34700 = a.length;
  var i_34701 = (0);
  while(true){
  if((i_34701 < n__4607__auto___34700)){
  (a[i_34701] = reagent.impl.template.as_element.call(null,(a[i_34701])));
  
  var G__34702 = (i_34701 + (1));
  i_34701 = G__34702;
  continue;
  } else {
  }
  break;
  }
  
  return a;
  });
  reagent.impl.template.expand_seq_dev = (function reagent$impl$template$expand_seq_dev(s,o){
  var a = cljs.core.into_array.call(null,s);
  var n__4607__auto___34703 = a.length;
  var i_34704 = (0);
  while(true){
  if((i_34704 < n__4607__auto___34703)){
  var val_34705 = (a[i_34704]);
  if(((cljs.core.vector_QMARK_.call(null,val_34705)) && ((reagent.impl.template.key_from_vec.call(null,val_34705) == null)))){
  (o["no-key"] = true);
  } else {
  }
  
  (a[i_34704] = reagent.impl.template.as_element.call(null,val_34705));
  
  var G__34706 = (i_34704 + (1));
  i_34704 = G__34706;
  continue;
  } else {
  }
  break;
  }
  
  return a;
  });
  reagent.impl.template.expand_seq_check = (function reagent$impl$template$expand_seq_check(x){
  var ctx = ({});
  var vec__34707 = reagent.ratom.check_derefs.call(null,((function (ctx){
  return (function (){
  return reagent.impl.template.expand_seq_dev.call(null,x,ctx);
  });})(ctx))
  );
  var res = cljs.core.nth.call(null,vec__34707,(0),null);
  var derefed = cljs.core.nth.call(null,vec__34707,(1),null);
  if(cljs.core.truth_(derefed)){
  if(cljs.core.truth_(reagent.debug.has_console)){
  (cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).warn(["Warning: ",reagent.impl.template.hiccup_err.call(null,x,"Reactive deref not supported in lazy seq, ","it should be wrapped in doall")].join(''));
  } else {
  }
  } else {
  }
  
  if(cljs.core.truth_((ctx["no-key"]))){
  if(cljs.core.truth_(reagent.debug.has_console)){
  (cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).warn(["Warning: ",reagent.impl.template.hiccup_err.call(null,x,"Every element in a seq should have a unique :key")].join(''));
  } else {
  }
  } else {
  }
  
  return res;
  });
  reagent.impl.template.make_element = (function reagent$impl$template$make_element(argv,comp,jsprops,first_child){
  var G__34710 = (cljs.core.count.call(null,argv) - first_child);
  switch (G__34710) {
  case (0):
  return reagent.impl.template.global$module$react.createElement.call(null,comp,jsprops);
  
  break;
  case (1):
  return reagent.impl.template.global$module$react.createElement.call(null,comp,jsprops,reagent.impl.template.as_element.call(null,cljs.core.nth.call(null,argv,first_child,null)));
  
  break;
  default:
  return reagent.impl.template.global$module$react.createElement.apply(null,cljs.core.reduce_kv.call(null,((function (G__34710){
  return (function (a,k,v){
  if((k >= first_child)){
  a.push(reagent.impl.template.as_element.call(null,v));
  } else {
  }
  
  return a;
  });})(G__34710))
  ,[comp,jsprops],argv));
  
  }
  });
  
  //# sourceMappingURL=template.js.map
  