<commit_before>diff = require 'virtual-dom/diff'
patch = require 'virtual-dom/patch'
createElement = require 'virtual-dom/create-element'
virtualize = require 'vdom-virtualize'

flattenTree = require './flatten_tree'

parseFullTree = (tree) ->
  unless tree?.tagName is 'HTML'
    throw new Error 'Invalid HTML base element'

  $head = tree.children[0]
  $body = tree.children[1]
  $title = $head?.children[0]
  appTree = $body?.children[0]

  unless $head?.tagName is 'HEAD' and $title?.tagName is 'TITLE'
    throw new Error 'Invalid HEAD base element'

  unless $body?.tagName is 'BODY' and appTree?.properties.id is 'zorium-root'
    throw new Error 'Invalid BODY base element'

  unless appTree.children.length is 1
    throw new Error 'zorium-root must only contain 1 direct child'

  return {
    appTree: appTree.children[0]
    title: $title?.children[0]?.text
  }

removeContentEditable = (vnode) -><commit_msg>render: allow for components as parts of full page tree<commit_after>diff = require 'virtual-dom/diff'
patch = require 'virtual-dom/patch'
createElement = require 'virtual-dom/create-element'
virtualize = require 'vdom-virtualize'

flattenTree = require './flatten_tree'

parseFullTree = (tree) ->
  unless tree?.tagName is 'HTML' and tree.children.length is 2
    throw new Error 'Invalid HTML base element'

  $head = flattenTree tree.children[0]
  $body = flattenTree tree.children[1]
  $title = flattenTree $head.children[0]
  appTree = flattenTree $body.children[0]

  unless $head?.tagName is 'HEAD' and $title?.tagName is 'TITLE'
    throw new Error 'Invalid HEAD base element'

  unless $body?.tagName is 'BODY' and appTree?.properties.id is 'zorium-root'
    throw new Error 'Invalid BODY base element'

  unless appTree.children.length is 1
    throw new Error 'zorium-root must only contain 1 direct child'

  return {
    appTree: appTree.children[0]
    title: $title?.children[0]?.text
  }

removeContentEditable = (vnode) ->
{'fraction_non_alphanumeric': 0.11377551020408164, 'fraction_numerical': 0.008673469387755102, 'mean_word_length': 4.106770833333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3553548', 'n_tokens_mistral': 638, 'n_tokens_neox': 614, 'n_words': 191}