<commit_before>(ns devcards-om-next.core
  (:require [devcards.util.utils :as utils]))

(defn om-next-root*
  ([om-next-comp]
   (om-next-root* om-next-comp nil {}))
  ([om-next-comp om-next-reconciler]
   (om-next-root* om-next-comp om-next-reconciler {}))
  ([om-next-comp om-next-reconciler options]
   (when (utils/devcards-active?)
     (let [card-name? (not (nil? (:card-name options)))
           card-name (when card-name?
                       (symbol (:card-name options)))
           make-reconciler `(fn [state#]
                              (om.next/reconciler
                                {:state state#
                                 :parser (om.next/parser
                                           {:read (fn [] {:value state#})})}))
           reconciler (if card-name?
                        `(fn [state#]
                           (defonce ~card-name
                             (~make-reconciler state#))
                           ~card-name)
                        `(fn [state#]
                           (~make-reconciler state#)))]
       `(reify
          devcards.core/IDevcard
          (~'-devcard [this# devcard-opts#]
            (let [init-data# (:initial-data devcard-opts#)
                  state# (when-not (om.next/reconciler? ~om-next-reconciler)<commit_msg>avoid reconciler name clashing with the card name<commit_after>(ns devcards-om-next.core
  (:require [devcards.util.utils :as utils]))

(defn om-next-root*
  ([om-next-comp]
   (om-next-root* om-next-comp nil {}))
  ([om-next-comp om-next-reconciler]
   (om-next-root* om-next-comp om-next-reconciler {}))
  ([om-next-comp om-next-reconciler options]
   (when (utils/devcards-active?)
     (let [card-name? (not (nil? (:card-name options)))
           card-name (when card-name?
                       (symbol (str (:card-name options) "-reconciler")))
           make-reconciler `(fn [state#]
                              (om.next/reconciler
                                {:state state#
                                 :parser (om.next/parser
                                           {:read (fn [] {:value state#})})}))
           reconciler (if card-name?
                        `(fn [state#]
                           (defonce ~card-name
                             (~make-reconciler state#))
                           ~card-name)
                        `(fn [state#]
                           (~make-reconciler state#)))]
       `(reify
          devcards.core/IDevcard
          (~'-devcard [this# devcard-opts#]
            (let [init-data# (:initial-data devcard-opts#)
                  state# (when-not (om.next/reconciler? ~om-next-reconciler)
{'fraction_non_alphanumeric': 0.14323111443530293, 'fraction_numerical': 0.0, 'mean_word_length': 1.3526824978012313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4720161', 'n_tokens_mistral': 841, 'n_tokens_neox': 812, 'n_words': 154}