<div>
  <h2>Munch your content from D&D Beyond</a></h2>
      <ul>
          <li>This feature can take a <b>long</b> time, please be patient and leave the browser tab open.</li>
          <li>Need some <a href="https://docs.ddb.mrprimate.co.uk/docs/category/ddb-importer">documentation</a>?</li>
          <li>Access to Monster Munch and Filtering is available if you <a href="https://github.com/MrPrimate/ddb-proxy">run a proxy</a> or are a <a href="https://www.patreon.com/MrPrimate">Patreon Supporter</a>.</li>
          <li>Please log any bugs on the <a href="https://discord.gg/WzPuRuDJVP">Discord</a>.</li>
          <li>{{{localize "ddb-importer.settings.user-hint-effects"}}}</li>
          <li>{{{localize "ddb-importer.settings.user-hint-setting"}}}</li>
      </ul>
      <hr>
      <div class="munching-task-name" id="munching-task-name">
        <br />
      </div>
      <div class="munching-task-monster" id="munching-task-monster">
        <br />
      </div>
      <div class="munching-task-notes" id="munching-task-notes">
        <br />
      </div>
      <div class="munching-progress-bar" style="width: 0%"></div>
      <hr>
  <!-- Muncher Configuration Tabs -->
  <nav class="sheet-tabs tabs">
    <a class="item active" data-tab="settings"><i class="fas fa-cogs"></i> Settings</a>
    <a class="item" data-tab="spells"><i class="fas fa-magic"></i> Spells</a>
    <a class="item" data-tab="items"><i class="fas fa-shield-alt"></i> Items</a>
    <a class="item" data-tab="monsters"><i class="fas fa-pastafarianism"></i> Monsters</a>
    <a class="item" data-tab="adventures"><i class="fas fa-book-reader"></i> Adventures</a>
    <a class="item" data-tab="tools"><i class="fas fa-tools"></i> Tools</a>
    <a class="item" data-tab="characters"><i class="fas fa-users "></i> Characters</a>
    {{!-- <a class="item" data-tab="experimental"><i class="fas fa-flask"></i> Experimental</a> --}}
    <a class="item" data-tab="help"><i class="fas fa-info-circle"></i> Help</a>
  </nav>

    <!-- Settings Tab -->
  <section class="tab" data-tab="settings">
      <div>
          <h3>Munching flavours</h3>
          {{#each genericConfig}}
          <div class="munching-generic-config"><input {{#if this.isChecked}}checked{{/if}} type="checkbox"
                  id="munching-generic-policy-{{this.name}}"
                  name="munching-policy-{{this.name}}"
                  data-section="{{this.name}}" {{#if this.enabled}}enabled{{else}}disabled{{/if}}>{{{this.description}}}
          </div>
          {{/each}}
          <div id="munch-source-div" {{#if enableSources}}{{else}}class="ddbimporter-hidden"{{/if}}>
              <button type="button" id="munch-source-select" class="munch-button" enabled>Select books to use (for monsters, spells, items)</button>
          </div>
      </div>
  </section>


  <section class="tab" data-tab="spells">
      <div class="form-section">
          <div class="form-description">
              <div>
                <div>
                {{#each spellConfig}}
                <div class="munching-spell-config"><input {{#if this.isChecked}}checked{{/if}} type="checkbox"
                        name="munching-policy-{{this.name}}" id="munching-policy-{{this.name}}"
                        data-section="{{this.name}}" {{#if this.enabled}}enabled{{else}}disabled{{/if}}>{{{this.description}}}
                </div>
                {{/each}}
                  {{#if sourcesSelected}}
                  <br>
                  <div style="text-align:center"><b>{{sourceDescription}}</b></div>
                  {{/if}}
                  <button type="button" id="munch-spells-start" class="munch-button"
                      {{#if cobalt}}enabled{{else}}disabled{{/if}}>Spell Munch</button>
              </div>

              </div>
          </div>
      </div>
  </section>
  <section class="tab" data-tab="items">
      <div class="form-section">
          <div class="form-description">
              <div>
                {{#each itemConfig}}
                <div class="munching-item-config"><input {{#if this.isChecked}}checked{{/if}} type="checkbox"
                        name="munching-policy-{{this.name}}" id="munching-policy-{{this.name}}"
                        data-section="{{this.name}}" {{#if this.enabled}}enabled{{else}}disabled{{/if}}>{{{this.description}}}
                </div>
                {{/each}}
                {{#if sourcesSelected}}
                <br>
                <div style="text-align:center"><b>{{sourceDescription}}</b></div>
                {{/if}}
                  <button type="button" id="munch-items-start" class="munch-button"
                      {{#if cobalt}}enabled{{else}}disabled{{/if}}>Item Munch</button>
              </div>
          </div>
      </div>
  </section>
  <section class="tab" data-tab="adventures">
  <div class="form-section">
      <div class="form-description">
          <div>
              <p>Adventure Munching is a multipart process. First download a config file by clicking the button below.</p>
              <p>Go to the <a href="https://docs.ddb.mrprimate.co.uk/">Adventure Muncher Getting Started Guide</a>. Follow the instructions there.</p>
              <p>When you have an adventure import it using the button below.</p>
          </div>
          <div>
            <button type="button" id="munch-adventure-config-start" class="munch-button"><i class="fas fa-cog"></i> Generate Adventure Muncher Config File</button>
            <button type="button" id="munch-adventure-import-start" class="munch-button"><i class="fas fa-check"></i> Import Generated Adventure</button>
            <button type="button" id="munch-adventure-third-party-start" class="munch-button"><i class="fas fa-map-marked-alt"></i> Enhance Third Party Scenes</button>
        </div>
        <i>When you import an adventure it will use the items, spells and monsters in your DDB compendiums. If it can't find them it will attempt to import from DDB, and will use the currently selected settings in the muncher!</i>
      </div>
  </div>
  </section>
  <section class="tab" data-tab="monsters">
  <div class="form-section">
      <div class="form-description">
          <div class="form-description"></div>
                {{#each monsterConfig}}
                <div class="munching-monster-config"><input {{#if this.isChecked}}checked{{/if}} type="checkbox"
                        name="munching-policy-{{this.name}}" id="munching-policy-{{this.name}}"
                        data-section="{{this.name}}" {{#if this.enabled}}enabled{{else}}disabled{{/if}}>{{{this.description}}}
                </div>
                {{/each}}
                <hr>

              <div>
                  <h4>Monster Search Filter (leave blank for all - case insensitive)</h4>
              </div>
                <div class="form-content" style="display: flex">
                  <input type="text" name="monster-filter" id="monster-munch-filter" style="flex: 0 1 auto" ;value="" />
              </div>
              <hr>
              <div>
                  {{#if sourcesSelected}}
                  <div style="text-align:center"><b>{{sourceDescription}}</b></div>
                  {{/if}}
                  <button type="button" id="munch-monsters-start" class="munch-button"
                      {{#if tiers.all}}enabled{{else}}disabled{{/if}}>{{#if tiers.all}}Monster Munch!{{else}}Monster Munch for Patreon Supporters! (or run your own proxy){{/if}}
                  </button>
                  <button type="button" id="munch-vehicles-start" class="munch-button" disabled>
                      Vehicle import is not yet available for this version of the D&D 5e System
                  </button>
                  <!--
                      {{#if tiers.experimentalMid}}enabled{{else}}disabled{{/if}}>{{#if tiers.experimentalMid}}[Experimental BETA] Vehicle Munch!{{else}}[Experimental BETA] Vehicle Munch for Undying+ Patreon Supporters!{{/if}}
                  -->
                  </button>
              </div>
              <div style="text-align:center"><i>Make sure you have imported spells before Monsters!</i> Tokens will use default token settings.</div>
          </div>
      </div>
  </section>
<!-- Tools -->
  <section class="tab" data-tab="tools">
  <div class="form-section">
      <div class="form-description">
          <div class="form-description"></div>
              <div>
                  <h2>Tools</h2>
                  <p>Set magic item prices to values as per <a href="https://www.dndbeyond.com/sources/xgte/downtime-revisited#MagicItemPrice">Xanathar's Guide</a> rules. This will set items which have a rarity specified and no/0 cost to a random price in the range.</p>
                  <div>
                    <button type="button" id="munch-xanthar-price" class="munch-button"><i class="fas fa-coins"></i> Set Magic Item Prices</button>
                  </div>
                  <p>Reset compendium actor images back to munched defaults.</p>
                  <div>
                    <button type="button" id="munch-reset-images" class="munch-button"><i class="fas fa-person-booth"></i> Reset compendium actor images</button>
                  </div>
                  <p>Update world actors with compendium actors (only targets DDB imported monsters).</p>
                  {{#each worldUpdateConfig}}
                  <div class="munching-monster-world-update-config"><input {{#if this.isChecked}}checked{{/if}} type="checkbox"
                          name="munching-policy-{{this.name}}" id="munching-policy-{{this.name}}"
                          data-section="{{this.name}}" {{#if this.enabled}}enabled{{else}}disabled{{/if}}>{{this.description}}
                  </div>
                  {{/each}}
                  <div>
                    <button type="button" id="munch-world-monster-update" class="munch-button"><i class="fas fa-user-edit"></i> Update world monsters</button>
                  </div>
                  <div>
                    <p>Munch token frames from D&D Beyond.</p>
                    <button type="button" id="munch-frames-start" class="munch-button"
                      {{#if tiers.supporter}}enabled{{else}}disabled{{/if}}><i class="fas fa-universal-access"></i>{{#if tiers.supporter}}Token Frame Munch{{else}}Token Frames for Patreon Supporters{{/if}}</button>
                  </div>
                  <hr>
                  <h2>Compendium Folders Migration</h2>
                  <p>Compendium folder migration can take a while against big compendiums.</p>
                  <div class="form-group" style="display: flex">
                    <select name="compendium-folder-style" id="compendium-folder-style-monster" style="flex: 55%; vertical-align:middle">
                      {{#each compendiumFolderMonsterStyles}}
                        <option value="{{this.key}}" {{#if this.selected}}selected{{/if}}>{{this.label}}</option>
                      {{/each}}
                    </select>
                      <button type="button" id="munch-migrate-compendium-monster" style="vertical-align:middle" class="munch-button" enabled>Migrate Monster Compendium</button>
                  </div>
                  <div class="form-group" style="display: flex">
                    <select name="compendium-folder-style" id="compendium-folder-style-spell" style="flex: 55%; vertical-align:tomiddlep">
                      {{#each compendiumFolderSpellStyles}}
                        <option value="{{this.key}}" {{#if this.selected}}selected{{/if}}>{{this.label}}</option>
                      {{/each}}
                    </select>
                      <button type="button" id="munch-migrate-compendium-spell" style="vertical-align:middle" class="munch-button" enabled>Migrate Spell Compendium</button>
                  </div>
                  <div class="form-group" style="display: flex">
                    <select name="compendium-folder-style" id="compendium-folder-style-item" style="flex: 55%; vertical-align:middle">
                      {{#each compendiumFolderItemStyles}}
                        <option value="{{this.key}}" {{#if this.selected}}selected{{/if}}>{{this.label}}</option>
                      {{/each}}
                    </select>
                      <button type="button" id="munch-migrate-compendium-item" style="vertical-align:middle" class="munch-button" enabled>Migrate Item Compendium</button>
                  </div>
              </div>
          </div>
      </div>
  </section>
<!-- Character -->
  <section class="tab" data-tab="characters">
  <div class="form-section">
      <div class="form-description">
          <div class="form-description"></div>
              <div>
                  <h4>Unlike other options here, these are stubs to be filled out normally with just descriptions. More advanced importing is coming. Class Features are not entirely complete, especially around optional choices. For the best character experience, import characters created on DDB.</h4>
              </div>
                <div>
                  <button type="button" id="munch-feats-start" class="munch-button"
                  disabled>Feat import is not yet available for this version of the D&D 5e System</button>
                  <!--
                      {{#if tiers.supporter}}enabled{{else}}disabled{{/if}}>{{#if tiers.supporter}}Feat Munch{{else}} Feat for Patreon Supporters{{/if}}
                  -->
                  </button>
                  <button type="button" id="munch-backgrounds-start" class="munch-button"
                  disabled>Background import is not yet available for this version of the D&D 5e System</button>
                  <!--
                      {{#if tiers.supporter}}enabled{{else}}disabled{{/if}}>{{#if tiers.supporter}}Background Munch{{else}} Backgrounds for Patreon Supporters{{/if}}
                  -->
                  </button>
                  <button type="button" id="munch-races-start" class="munch-button"
                  disabled>Species and Species Traits import is not yet available for this version of the D&D 5e System</button>
                  <!--
                      {{#if tiers.supporter}}enabled{{else}}disabled{{/if}}>{{#if tiers.supporter}}Race and Racial Traits Munch{{else}}Races for Patreon Supporters{{/if}}
                  -->
                  </button>
                  <button type="button" id="munch-classes-start" class="munch-button"
                  disabled>Class and Class Features import is not yet available for this version of the D&D 5e System</button>
                  <!--
                      {{#if tiers.supporter}}enabled{{else}}disabled{{/if}}>{{#if tiers.supporter}}[Experimental] Class and Class Features Munch (partial, incomplete){{else}}[Experimental] Classes and features (limited) for Patreon Supporters{{/if}}
                  -->
                  </button>
              </div>
          </div>
      </div>
  </section>
<!-- Help Tab -->
  <section class="tab" data-tab="help">
    <h3>Videos</h3>
    <p>If you need help getting setup checkout the following YouTube videos:</p>
    <ul>
      <li>MrPrimate's <a href="https://youtu.be/OMaJHLQORWo">Overview</a></li>
      <li>Encounter Library's <a href="https://www.youtube.com/watch?v=9PjPkugkF1o">Overview (Install, Setup, How to Use)</a> is recommended!</li>
      </ul>
    </ul>
    <h3>FAQ</h3>
    <ul>
      <li>Homebrew monsters need to be part of your collection.</li>
      <li>Spells and Items should take only a few minutes at most.</li>
      <li>If it seems to stall wait a while, if it's still stalled you can refresh your browser and try again. As long as "Update existing things." remains unchecked then it will pick up where it left off.</li>
      <li>Read the <a href="https://github.com/MrPrimate/ddb-importer/blob/main/FAQ.md">FAQ</a></li>
    </ul>
    <h3>Troubleshooting</h3>
    <ul>
      <li>Make sure you're using the latest version.</li>
      <li>Try unticking any option marked Experimental.</li>
      <li>Read the <a href="https://docs.ddb.mrprimate.co.uk/docs/faqs/ddb-importer">FAQ</a> and <a href="https://docs.ddb.mrprimate.co.uk/docs/category/ddb-importer">documentation</a>/li>
      <li>Ask a question/submit a bug on <a href="https://discord.gg/WzPuRuDJVP">Discord</a>.</li>
      <li>Or submit a bug on <a href="https://github.com/MrPrimate/ddb-importer">GitHub</a>.</li>
    </ul>
    <h3>Community</h3>
    <ul>
      <li>Join us on <a href="https://discord.gg/WzPuRuDJVP">Discord</a></li>
      <li>Support me on <a href="https://patreon.com/MrPrimate">Patreon</a></li>
    </ul>
  </section>

  {{#if isCampaign}}<div style="italic; display: flex; justify-content: flex-start">Campaign ID: {{campaignId}}</div>{{/if}}
  <div style="italic; display: flex; justify-content: flex-end">v{{version}}</div>
</div>
