(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

Vue.component('wpcfto_hint_textarea', {
    mixins: [window.validationMixin],
    props: ['fields', 'field_label', 'field_name', 'field_id', 'field_value'],
    data() {
      return {
        value: ''
      };
    },
    template: `
      <div class="wpcfto_generic_field" :class="field_id">
        <wpcfto_fields_aside_before 
            :fields="fields" 
            :field_label="field_label" 
            :required="fields.required === true">
        </wpcfto_fields_aside_before>
        
        <div class="wpcfto-field-content">
          <div class="hints" role="list" aria-label="Available hints">
            <span 
              v-for="(hint_text, hint_key) in fields.hints" 
              :key="hint_key"
              role="listitem"
              tabindex="0"
              @click="enterHint(hint_key)"
              @keydown.enter.prevent="enterHint(hint_key)"
              @keydown.space.prevent="enterHint(hint_key)"
              class="hint-item"
              :aria-label="'Insert hint ' + hint_text"
            >
              {{ hint_text }}
            </span>
          </div>
          
          <textarea 
            :name="field_name"
            :placeholder="field_label"
            :id="field_id"
            v-model="value"
            :required="fields.required === true"
            aria-describedby="hints-description"
            rows="5"
          ></textarea>
        </div>
      </div>
    `,
    mounted() {
      this.value = this.field_value || '';
    },
    methods: {
      enterHint(hint) {
        // Insert hint placeholder at cursor position or append at end
        const placeholder = ` {{${hint}}}`;
        const textarea = this.$el.querySelector('textarea');
        if (!textarea) {
          this.value += placeholder;
          return;
        }
        const start = textarea.selectionStart;
        const end = textarea.selectionEnd;
        this.value = this.value.substring(0, start) + placeholder + this.value.substring(end);
        this.$nextTick(() => {
          textarea.selectionStart = textarea.selectionEnd = start + placeholder.length;
          textarea.focus();
        });
      }
    },
    watch: {
      value(newVal) {
        this.$emit('wpc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