v0.0.51


When a HTTP request is made to load this page, we dynamically compile the WebAssembly for the above widget on-the-fly.

At WebAssembly compile-time (but Elixir runtime) we:

  1. Load CSV of USA States using Req from https://raw.githubusercontent.com/jasonong/List-of-US-States/master/states.csv
  2. Parse CSV using NimbleCSV.
  3. Initialize each state name in WebAssembly memory.

At WebAssembly runtime we:

  1. Loop over each state name.
  2. Render HTML using SilverOrb.StringBuilder, with a list item for each state name.

At HTTP response time we:

  1. Render initial HTML using GoldenOrb.html Phoenix Component that:
    1. Instantiates WebAssembly instance on server.
    2. Calls exported text_html on the WebAssembly instance, and read HTML from its memory.
    3. Renders HTML as child.

In the browser we:

  1. Download .wasm from server.
  2. Instantiate WebAssembly instance in browser.
  3. Call exported text_html on the WebAssembly instance, and read HTML from its memory.
  4. Use morphdom (the same library LiveView uses) to efficiently update the DOM.
  5. Listen to DOM events using event delegation, calling matching function export on the WebAssembly instance.
  6. For each event received, repeat steps 3–5. Tada, we have an interactive widget!

View WebAssembly source (4296 bytes compiled)
(module $Combobox
  (type $SilverOrb.StringBuilder (func (result i32 i32)))
  (memory (export "memory") 6)
  (global $bump_offset (mut i32) (i32.const 65536))
  (global $bump_mark (mut i32) (i32.const 0))
  (global $bump_write_level (mut i32) (i32.const 0))
  (global $OrbShowcase.Widgets.Combobox.Output.bump_offset (mut i32) (i32.const 131072))
  (global $OrbShowcase.Widgets.Combobox.States.bump_offset (mut i32) (i32.const 196608))
  (global $OrbShowcase.Widgets.Combobox.Input.bump_offset (mut i32) (i32.const 262144))
  (global $open? (mut i32) (i32.const 0))
  (global $active_item_index (mut i32) (i32.const 0))
  (global $focus_enum (mut i32) (i32.const 0))
  (global $focus_clock (mut i32) (i32.const 0))
  (global $text_html_clock (mut i32) (i32.const 0))
  (global $id_suffix (export "id_suffix") (mut i32) (i32.const 1))
  (global $item_count (export "item_count") (mut i32) (i32.const 51))
  (; constants 1135 bytes ;)
  (data (i32.const 255) "input:")
  (data (i32.const 262) "menubutton:")
  (data (i32.const 274) "menu:")
  (data (i32.const 280) "menuitem:")
  (data (i32.const 290) ".")
  (data (i32.const 292) "<label for=\"")
  (data (i32.const 305) "\">")
  (data (i32.const 308) "State")
  (data (i32.const 314) "</label>")
  (data (i32.const 323) "<input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" id=\"")
  (data (i32.const 388) "\" aria-expanded=\"")
  (data (i32.const 406) "true")
  (data (i32.const 411) "false")
  (data (i32.const 417) "\" aria-controls=\"")
  (data (i32.const 435) "\" value=\"")
  (data (i32.const 445) "\" data-action=\"open\" data-input-write=\"input_range\" data-keydown-arrow-down=\"focus_next_item\" data-keydown-arrow-up=\"focus_previous_item\">")
  (data (i32.const 584) "<button type=\"button\" id=\"")
  (data (i32.const 611) "\" tabindex=\"-1\" aria-label=\"Open\" aria-haspopup=\"true\" aria-expanded=\"")
  (data (i32.const 682) "\" data-action=\"toggle\">")
  (data (i32.const 706) "<hero-icon class=\"hero-chevron-down-solid size-4\"></hero-icon>")
  (data (i32.const 769) "</button>")
  (data (i32.const 779) "<ul role=\"listbox\" id=\"")
  (data (i32.const 803) "\" tabindex=\"-1\" aria-labelledby=\"")
  (data (i32.const 837) "\" aria-activedescendant=\"")
  (data (i32.const 863) "\" data-keydown-escape=\"close\" data-keydown-arrow-up=\"focus_previous_item\" data-keydown-arrow-down=\"focus_next_item\"")
  (data (i32.const 979) " hidden")
  (data (i32.const 987) ">")
  (data (i32.const 989) "\n")
  (data (i32.const 991) "</ul>")
  (data (i32.const 997) "<li role=\"option\" id=\"")
  (data (i32.const 1020) "\"")
  (data (i32.const 1022) " aria-selected=\"")
  (data (i32.const 1039) "\" data-action=\"select_item:[")
  (data (i32.const 1068) "]\">")
  (data (i32.const 1072) "</li>")
  (data (i32.const 1078) "\" tabindex=\"-1\" data-action=\"select_item:[")
  (data (i32.const 1121) "]\" data-pointerover=\"focus_item:[")
  (data (i32.const 1155) "Action ")
  (data (i32.const 1163) "<lipid-combobox>\n")
  (data (i32.const 1181) "<golden-orb>\n")
  (data (i32.const 1195) "<source type=\"application/wasm\" src=\"/combobox.wasm\">\n")
  (data (i32.const 1250) "</golden-orb>\n")
  (data (i32.const 1265) "</lipid-combobox>\n")
  (data (i32.const 1284) "lipid-combobox button { background-color: var(--LipidCombobox-background); }\n")
  (data (i32.const 1362) "// data-keydown-arrow-down\n")
  (data (i32.const 196608) "Alabama")
  (data (i32.const 196628) "Alaska")
  (data (i32.const 196648) "Arizona")
  (data (i32.const 196668) "Arkansas")
  (data (i32.const 196688) "California")
  (data (i32.const 196708) "Colorado")
  (data (i32.const 196728) "Connecticut")
  (data (i32.const 196748) "Delaware")
  (data (i32.const 196768) "District of Columbia")
  (data (i32.const 196788) "Florida")
  (data (i32.const 196808) "Georgia")
  (data (i32.const 196828) "Hawaii")
  (data (i32.const 196848) "Idaho")
  (data (i32.const 196868) "Illinois")
  (data (i32.const 196888) "Indiana")
  (data (i32.const 196908) "Iowa")
  (data (i32.const 196928) "Kansas")
  (data (i32.const 196948) "Kentucky")
  (data (i32.const 196968) "Louisiana")
  (data (i32.const 196988) "Maine")
  (data (i32.const 197008) "Montana")
  (data (i32.const 197028) "Nebraska")
  (data (i32.const 197048) "Nevada")
  (data (i32.const 197068) "New Hampshire")
  (data (i32.const 197088) "New Jersey")
  (data (i32.const 197108) "New Mexico")
  (data (i32.const 197128) "New York")
  (data (i32.const 197148) "North Carolina")
  (data (i32.const 197168) "North Dakota")
  (data (i32.const 197188) "Ohio")
  (data (i32.const 197208) "Oklahoma")
  (data (i32.const 197228) "Oregon")
  (data (i32.const 197248) "Maryland")
  (data (i32.const 197268) "Massachusetts")
  (data (i32.const 197288) "Michigan")
  (data (i32.const 197308) "Minnesota")
  (data (i32.const 197328) "Mississippi")
  (data (i32.const 197348) "Missouri")
  (data (i32.const 197368) "Pennsylvania")
  (data (i32.const 197388) "Rhode Island")
  (data (i32.const 197408) "South Carolina")
  (data (i32.const 197428) "South Dakota")
  (data (i32.const 197448) "Tennessee")
  (data (i32.const 197468) "Texas")
  (data (i32.const 197488) "Utah")
  (data (i32.const 197508) "Vermont")
  (data (i32.const 197528) "Virginia")
  (data (i32.const 197548) "Washington")
  (data (i32.const 197568) "West Virginia")
  (data (i32.const 197588) "Wisconsin")
  (data (i32.const 197608) "Wyoming")
  (func $decimal_u32_char_count (param $value i32) (result i32)
    (local $digit_count i32)
    (loop $Digits
      (i32.add (local.get $digit_count) (i32.const 1))
      (local.set $digit_count)
      (i32.div_u (local.get $value) (i32.const 10))
      (local.set $value)
      (i32.gt_u (local.get $value) (i32.const 0))
      (br_if $Digits)
    )
    (local.get $digit_count)
  )
  (func $decimal_u32 (param $value i32) (param $str_ptr i32) (result i32 i32)
    (local $working_offset i32)
    (local $len i32)
    (local $digit i32)
    (call $decimal_u32_char_count (local.get $value))
    (local.set $len)
    (i32.add (local.get $str_ptr) (local.get $len))
    (local.set $working_offset)
    (loop $Digits
      (i32.sub (local.get $working_offset) (i32.const 1))
      (local.set $working_offset)
      (i32.rem_u (local.get $value) (i32.const 10))
      (local.set $digit)
      (i32.div_u (local.get $value) (i32.const 10))
      (local.set $value)
      (i32.store8 (local.get $working_offset) (i32.add (i32.const 48) (local.get $digit)))
      (i32.gt_u (local.get $value) (i32.const 0))
      (br_if $Digits)
    )
    (local.get $str_ptr)
    (local.get $len)
  )
  (func $bump_write_start
    (i32.eqz (global.get $bump_write_level))
    (if
      (then
        (i32.const 65536)
        (global.set $bump_offset)
        (global.get $bump_offset)
        (global.set $bump_mark)
      )
    )
    (i32.add (global.get $bump_write_level) (i32.const 1))
    (global.set $bump_write_level)
  )
  (func $bump_write_done (result i32 i32)
    (i32.gt_s (global.get $bump_write_level) (i32.const 0))
    (if
      (then
        nop      )
      (else
        unreachable      )
    )
    (i32.sub (global.get $bump_write_level) (i32.const 1))
    (global.set $bump_write_level)
    (global.get $bump_mark)
    (i32.sub (global.get $bump_offset) (global.get $bump_mark))
  )
  (func $bump_write_str (param $str_ptr i32) (param $len i32)
    (local $i i32)
    (local $char i32)
    (i32.or (i32.eq (local.get $str_ptr) (global.get $bump_mark)) (i32.eqz (local.get $len)))
    (if
      (then
        return      )
    )
    (loop $EachChar
      (i32.load8_u (i32.add (local.get $str_ptr) (local.get $i)))
      (local.set $char)
      (i32.store8 (i32.add (global.get $bump_offset) (local.get $i)) (local.get $char))
      (i32.lt_s (local.get $i) (local.get $len))
      (if
        (then
          (i32.add (local.get $i) (i32.const 1))
          (local.set $i)
          (br $EachChar)
        )
      )
    )
    (i32.add (global.get $bump_offset) (local.get $len))
    (global.set $bump_offset)
  )
  (func $bump_written? (result i32)
    (i32.gt_s (global.get $bump_offset) (global.get $bump_mark))
  )
  (func $string_equal_impl (param $lhs i32) (param $rhs i64) (result i32)
    (local $i i32)
    (local $byte_a i32)
    (local $byte_b i32)
    (loop $EachByte (result i32)
      (i32.load8_u (i32.add (local.get $lhs) (local.get $i)))
      (local.set $byte_a)
      (i32.load8_u (i32.add (i32.wrap_i64 (local.get $rhs)) (local.get $i)))
      (local.set $byte_b)
      (i32.eqz (local.get $byte_a))
      (if
        (then
          (return (i32.eqz (local.get $byte_b)))
        )
      )
      (i32.eq (local.get $byte_a) (local.get $byte_b))
      (if
        (then
          (i32.add (local.get $i) (i32.const 1))
          (local.set $i)
          (br $EachByte)
        )
      )
      (return (i32.const 0))
    )
  )
  (func $OrbShowcase.Widgets.Combobox.Output.alloc! (param $byte_count i32) (result i32)
    (local $new_ptr i32)
    (global.get $OrbShowcase.Widgets.Combobox.Output.bump_offset)
    (local.set $new_ptr)
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.const 196608))
    (if
      (then
        unreachable
      )
    )
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.mul (memory.size) (i32.const 65536)))
    (if
      (then
        (memory.grow (i32.const 1))
        drop
      )
    )
    (i32.add (local.get $new_ptr) (local.get $byte_count))
    (global.set $OrbShowcase.Widgets.Combobox.Output.bump_offset)
    (local.get $new_ptr)
  )
  (func $OrbShowcase.Widgets.Combobox.Output.rewind
    (i32.const 131072)
    (global.set $OrbShowcase.Widgets.Combobox.Output.bump_offset)
  )
  (func $OrbShowcase.Widgets.Combobox.Output.string_equal? (param $slice i64) (result i32)
    (call $string_equal_impl (i32.const 131072) (local.get $slice))
  )
  (func $OrbShowcase.Widgets.Combobox.States.alloc! (param $byte_count i32) (result i32)
    (local $new_ptr i32)
    (global.get $OrbShowcase.Widgets.Combobox.States.bump_offset)
    (local.set $new_ptr)
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.const 262144))
    (if
      (then
        unreachable
      )
    )
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.mul (memory.size) (i32.const 65536)))
    (if
      (then
        (memory.grow (i32.const 1))
        drop
      )
    )
    (i32.add (local.get $new_ptr) (local.get $byte_count))
    (global.set $OrbShowcase.Widgets.Combobox.States.bump_offset)
    (local.get $new_ptr)
  )
  (func $OrbShowcase.Widgets.Combobox.States.rewind
    (i32.const 196608)
    (global.set $OrbShowcase.Widgets.Combobox.States.bump_offset)
  )
  (func $OrbShowcase.Widgets.Combobox.States.string_equal? (param $slice i64) (result i32)
    (call $string_equal_impl (i32.const 196608) (local.get $slice))
  )
  (func $OrbShowcase.Widgets.Combobox.Input.alloc! (param $byte_count i32) (result i32)
    (local $new_ptr i32)
    (global.get $OrbShowcase.Widgets.Combobox.Input.bump_offset)
    (local.set $new_ptr)
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.const 327680))
    (if
      (then
        unreachable
      )
    )
    (i32.gt_u (i32.add (local.get $new_ptr) (local.get $byte_count)) (i32.mul (memory.size) (i32.const 65536)))
    (if
      (then
        (memory.grow (i32.const 1))
        drop
      )
    )
    (i32.add (local.get $new_ptr) (local.get $byte_count))
    (global.set $OrbShowcase.Widgets.Combobox.Input.bump_offset)
    (local.get $new_ptr)
  )
  (func $OrbShowcase.Widgets.Combobox.Input.rewind
    (i32.const 262144)
    (global.set $OrbShowcase.Widgets.Combobox.Input.bump_offset)
  )
  (func $OrbShowcase.Widgets.Combobox.Input.string_equal? (param $slice i64) (result i32)
    (call $string_equal_impl (i32.const 262144) (local.get $slice))
  )
  (func $trim_trailing_nul_bytes (param $start i32) (param $max_length i32) (result i32)
    (local $i i32)
    (loop $EachChar
      (i32.eq (i32.load8_u (i32.add (local.get $start) (local.get $i))) (i32.const 0))
      (if
        (then
          (return (local.get $i))
        )
      )
      (i32.add (local.get $i) (i32.const 1))
      (local.set $i)
      (i32.lt_s (local.get $i) (local.get $max_length))
      (br_if $EachChar)
    )
    (local.get $max_length)
  )
  (func $state_at_index (param $index i32) (result i32 i32)
    (local $start i32)
    (i32.add (i32.const 196608) (i32.mul (i32.sub (local.get $index) (i32.const 1)) (i32.const 20)))
    (local.set $start)
    (local.get $start)
    (call $trim_trailing_nul_bytes (local.get $start) (i32.const 20))
  )
  (func $input_range (export "input_range") (result i32 i32)
    (i32.const 262144)
    (i32.const 65536)
  )
  (func $input_used_range (result i32 i32)
    (local $ptr i32)
    (local $max_length i32)
    (i32.const 262144)
    (local.set $ptr)
    (i32.const 65536)
    (local.set $max_length)
    (local.get $ptr)
    (call $trim_trailing_nul_bytes (local.get $ptr) (local.get $max_length))
  )
  (func $state_at_index_matches_input? (param $index i32) (result i32)
    (local $state_ptr i32)
    (local $state_len i32)
    (local $input_ptr i32)
    (local $input_len i32)
    (i32.add (i32.const 196608) (i32.mul (i32.sub (local.get $index) (i32.const 1)) (i32.const 20)))
    (local.set $state_ptr)
    (call $trim_trailing_nul_bytes (local.get $state_ptr) (i32.const 20))
    (local.set $state_len)
    (i32.const 262144)
    (local.set $input_ptr)
    (call $trim_trailing_nul_bytes (local.get $input_ptr) (i32.const 65536))
    (local.set $input_len)
    (i32.eq (local.get $input_len) (i32.const 0))
    (if
      (then
        (return (i32.const 1))
      )
    )
    (i32.or (i32.gt_s (local.get $input_len) (local.get $state_len)) (i32.eq (local.get $state_len) (i32.const 0)))
    (if
      (then
        (return (i32.const 0))
      )
    )
    (loop $EachChar
      (i32.ne (call $ascii_to_lower (i32.load8_u (local.get $state_ptr))) (call $ascii_to_lower (i32.load8_u (local.get $input_ptr))))
      (if
        (then
          (return (i32.const 0))
        )
      )
      (i32.add (local.get $state_ptr) (i32.const 1))
      (local.set $state_ptr)
      (i32.add (local.get $input_ptr) (i32.const 1))
      (local.set $input_ptr)
      (i32.sub (local.get $input_len) (i32.const 1))
      (local.set $input_len)
      (i32.gt_s (local.get $input_len) (i32.const 0))
      (br_if $EachChar)
    )
    (i32.const 1)
  )
  (func $ascii_to_lower (param $char i32) (result i32)
    (i32.and (i32.ge_s (local.get $char) (i32.const 65)) (i32.le_s (local.get $char) (i32.const 90)))
    (if (result i32)
      (then
        (i32.add (local.get $char) (i32.const 32))
      )
      (else
        (local.get $char)
      )
    )
  )
  (func $open? (export "open?") (result i32)
    (global.get $open?)
  )
  (func $open (export "open")
    (i32.gt_s (global.get $item_count) (i32.const 0))
    (if
      (then
        (i32.const 1)
        (global.set $open?)
        (i32.const 2)
        (global.set $focus_enum)
      )
    )
  )
  (func $close (export "close")
    (i32.const 0)
    (global.set $open?)
    (i32.const 0)
    (global.set $active_item_index)
    (i32.const 2)
    (global.set $focus_enum)
  )
  (func $toggle (export "toggle")
    (call $open?)
    (if
      (then
        (call $close)
      )
      (else
        (call $open)
      )
    )
  )
  (func $focus_item (export "focus_item") (param $index i32)
    (i32.gt_s (local.get $index) (global.get $item_count))
    (if (result i32)
      (then
        (i32.const 1)
      )
      (else
        (i32.le_s (local.get $index) (i32.const 0))
        (if (result i32)
          (then
            (global.get $item_count)
          )
          (else
            (local.get $index)
          )
        )
      )
    )
    (global.set $active_item_index)
    (i32.const 1)
    (global.set $open?)
    (i32.const 2)
    (global.set $focus_enum)
  )
  (func $focus_previous_item (export "focus_previous_item")
    (call $focus_item (i32.sub (global.get $active_item_index) (i32.const 1)))
  )
  (func $focus_next_item (export "focus_next_item")
    (call $focus_item (i32.add (global.get $active_item_index) (i32.const 1)))
  )
  (func $input_id (export "input_id") (result i32 i32)
    (call $bump_write_start)
    (i32.const 255) (i32.const 6)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (global.get $id_suffix) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (call $bump_write_done)
  )
  (func $button_id (export "button_id") (result i32 i32)
    (call $bump_write_start)
    (i32.const 262) (i32.const 11)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (global.get $id_suffix) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (call $bump_write_done)
  )
  (func $listbox_id (export "listbox_id") (result i32 i32)
    (call $bump_write_start)
    (i32.const 274) (i32.const 5)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (global.get $id_suffix) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (call $bump_write_done)
  )
  (func $option_id (export "option_id") (param $index i32) (result i32 i32)
    (call $bump_write_start)
    (i32.const 280) (i32.const 9)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (global.get $id_suffix) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (i32.const 290) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (local.get $index) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (call $bump_write_done)
  )
  (func $label (result i32 i32)
    (call $bump_write_start)
    (i32.const 292) (i32.const 12)
    (call $bump_write_str (;i32;) (;i32;))
    (call $input_id)
    drop
    drop
    (i32.const 305) (i32.const 2)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 308) (i32.const 5)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 314) (i32.const 8)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $input (result i32 i32)
    (call $bump_write_start)
    (i32.const 323) (i32.const 64)
    (call $bump_write_str (;i32;) (;i32;))
    (call $input_id)
    drop
    drop
    (i32.const 388) (i32.const 17)
    (call $bump_write_str (;i32;) (;i32;))
    (call $open?)
    (if
      (then
        (i32.const 406) (i32.const 4)
        (call $bump_write_str (;i32;) (;i32;))
      )
      (else
        (i32.const 411) (i32.const 5)
        (call $bump_write_str (;i32;) (;i32;))
      )
    )
    (i32.const 417) (i32.const 17)
    (call $bump_write_str (;i32;) (;i32;))
    (call $listbox_id)
    drop
    drop
    (i32.const 435) (i32.const 9)
    (call $bump_write_str (;i32;) (;i32;))
    (call $input_used_range)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 445) (i32.const 138)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $button (result i32 i32)
    (call $bump_write_start)
    (i32.const 584) (i32.const 26)
    (call $bump_write_str (;i32;) (;i32;))
    (call $button_id)
    drop
    drop
    (i32.const 611) (i32.const 70)
    (call $bump_write_str (;i32;) (;i32;))
    (call $open?)
    (if
      (then
        (i32.const 406) (i32.const 4)
        (call $bump_write_str (;i32;) (;i32;))
      )
      (else
        (i32.const 411) (i32.const 5)
        (call $bump_write_str (;i32;) (;i32;))
      )
    )
    (i32.const 417) (i32.const 17)
    (call $bump_write_str (;i32;) (;i32;))
    (call $listbox_id)
    drop
    drop
    (i32.const 682) (i32.const 23)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 706) (i32.const 62)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 769) (i32.const 9)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $listbox (result i32 i32)
    (local $i i32)
    (i32.const 1)
    (local.set $i)
    (call $bump_write_start)
    (i32.const 779) (i32.const 23)
    (call $bump_write_str (;i32;) (;i32;))
    (call $listbox_id)
    drop
    drop
    (i32.const 803) (i32.const 33)
    (call $bump_write_str (;i32;) (;i32;))
    (call $button_id)
    drop
    drop
    (i32.const 837) (i32.const 25)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.gt_s (global.get $active_item_index) (i32.const 0))
    (if
      (then
        (call $option_id (global.get $active_item_index))
        drop
        drop
      )
    )
    (i32.const 863) (i32.const 115)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.eq (call $open?) (i32.const 0))
    (if
      (then
        (i32.const 979) (i32.const 7)
        (call $bump_write_str (;i32;) (;i32;))
      )
    )
    (i32.const 987) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 989) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $state_options)
    drop
    drop
    (i32.const 991) (i32.const 5)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 989) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $state_option (param $index i32) (result i32 i32)
    (call $bump_write_start)
    (i32.const 997) (i32.const 22)
    (call $bump_write_str (;i32;) (;i32;))
    (call $option_id (local.get $index))
    drop
    drop
    (i32.const 1020) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $state_at_index_matches_input? (local.get $index))
    (if
      (then
      )
      (else
        (i32.const 979) (i32.const 7)
        (call $bump_write_str (;i32;) (;i32;))
      )
    )
    (i32.const 1022) (i32.const 16)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.eq (local.get $index) (global.get $active_item_index))
    (if
      (then
        (i32.const 406) (i32.const 4)
        (call $bump_write_str (;i32;) (;i32;))
      )
      (else
        (i32.const 411) (i32.const 5)
        (call $bump_write_str (;i32;) (;i32;))
      )
    )
    (i32.const 1039) (i32.const 28)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (local.get $index) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (i32.const 1068) (i32.const 3)
    (call $bump_write_str (;i32;) (;i32;))
    (call $state_at_index (local.get $index))
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 1072) (i32.const 5)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 989) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $state_options (result i32 i32)
    (local $index i32)
    (i32.const 1)
    (local.set $index)
    (call $bump_write_start)
    (loop $EachState (result i32 i32)
      (call $state_option (local.get $index))
      (i32.add (local.get $index) (i32.const 1))
      (local.set $index)
      (i32.le_s (local.get $index) (i32.const 51))
      (if
        (then
          (br $EachState)
        )
      )
    )
    drop
    drop
    (call $bump_write_done)
  )
  (func $option (param $i i32) (result i32 i32)
    (call $bump_write_start)
    (i32.const 997) (i32.const 22)
    (call $bump_write_str (;i32;) (;i32;))
    (call $option_id (local.get $i))
    drop
    drop
    (i32.const 1078) (i32.const 42)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (local.get $i) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (i32.const 1121) (i32.const 33)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (local.get $i) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (i32.const 1068) (i32.const 3)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 1155) (i32.const 7)
    (call $bump_write_str (;i32;) (;i32;))
    (call $decimal_u32 (local.get $i) (global.get $bump_offset))
    (i32.add (global.get $bump_offset))
    (global.set $bump_offset)
    nop
    drop
    (i32.const 1072) (i32.const 5)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 989) (i32.const 1)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $text_html (export "text_html") (result i32 i32)
    (call $bump_write_start)
    (i32.const 1163) (i32.const 17)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 1181) (i32.const 13)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 1195) (i32.const 54)
    (call $bump_write_str (;i32;) (;i32;))
    (call $label)
    drop
    drop
    (call $input)
    drop
    drop
    (call $button)
    drop
    drop
    (call $listbox)
    drop
    drop
    (i32.const 1250) (i32.const 14)
    (call $bump_write_str (;i32;) (;i32;))
    (i32.const 1265) (i32.const 18)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $text_css (export "text_css") (result i32 i32)
    (call $bump_write_start)
    (i32.const 1284) (i32.const 77)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
  (func $focus_id (export "focus_id") (result i32 i32)
    (call $bump_write_start)
    (i32.gt_s (global.get $active_item_index) (i32.const 0))
    (if
      (then
        (call $input_id)
        drop
        drop
      )
      (else
        (i32.eq (global.get $focus_enum) (i32.const 1))
        (if
          (then
            (call $listbox_id)
            drop
            drop
          )
          (else
            (i32.eq (global.get $focus_enum) (i32.const 2))
            (if
              (then
                (call $input_id)
                drop
                drop
              )
            )
          )
        )
      )
    )
    (call $bump_write_done)
  )
  (func $application_javascript (export "application_javascript") (result i32 i32)
    (call $bump_write_start)
    (i32.const 1362) (i32.const 27)
    (call $bump_write_str (;i32;) (;i32;))
    (call $bump_write_done)
  )
)