
<h2>DDB Importer Configuration!</h2>
<p>Hello! I'm sure your <i>itching</i> to get going, but first we need to do some setup.</p>
<p>If you need help getting setup checkout MrPrimate's <a href="https://youtu.be/OMaJHLQORWo">Overview on YouTube</a>.</p>

<div class="form-description">
  <form id="ddb-importer-settings" autocomplete="off" onsubmit="event.preventDefault();">
    <hr>
    <h3>[Required] A Cobalt Cookie</h3>
    <p>Use my <a href="https://github.com/MrPrimate/ddb-importer-chrome">Chrome</a> or the <a href="https://github.com/IamWarHead/ddb-data-grabber">DDB Data Grabber</a> to get this with a click, or follow <a href="https://raw.githubusercontent.com/MrPrimate/ddb-importer/main/docs/manual-cookie.png">these manual steps</a>. Paste into this field with Ctrl-V.</p>
      <input class="setup-config" type="password" name="cobalt-cookie" id="cobalt-cookie-input" style="flex: 0 1 auto" ;
        value="{{setupConfig.cobalt-cookie}}" />
    <button id="check-cobalt-button" class="check-cobalt-button">Check Cobalt Cookie</button>
    <h3>Store Cobalt Cookie in browser storage?</h3>
    <p>If this is checked, the cobalt cookie will be stored in your local browser storage. Only your browser can run the importer.</p>
       <input {{#if this.cobaltLocal}}checked{{/if}} class="setup-config" type="checkbox" name="cobalt-cookie-local"
       style="flex: 0 1 auto"> Use local storage?
    <hr>
    <h3>[Optional] Campaign ID</h3>
    <p>If content is shared with you via a campaign select it here.</p>
    <button id="campaign-button" class="campaign-button">Fetch My Campaigns</button>
    <div class="form-group">
      <select name="campaign-select" class="form-select" id="campaign-select">
        <option value="">Select campaign:</option>
        {{#each setupConfig.available-campaigns}}
        <option value="{{this.id}}" {{#if this.selected}}selected{{/if}}>{{this.name}} ({{this.dmUsername}}) - {{this.id}}</option>
        {{/each}}
      </select>
      <div class="ddbimporter-none" name="ddb-campaign-fallback" id="ddb-campaign-fallback">
        <p>Automatic campaign detection unavailable, please enter your campaign id manually. You can find it in the URL, when you click on the campaign from <a href="https://www.dndbeyond.com/my-campaigns">My Campaigns.</a> It is a number. e.g. if the url was <i>https://www.dndbeyond.com/campaigns/12345</i> then my campaign id would be 12345</p>
        <input class="setup-config" type="number" name="campaign-fallback" id="campaign-fallback" style="flex: 0 1 auto" ;
          value="{{campaignId}}" />
      </div>
    </div>
    <hr>
    <h3>[Optional] Patreon Link</h3>
    <p>Link your <a href="https://www.patreon.com/MrPrimate">Patreon account</a> by clicking the button, or enter a provided key</p>
    <button id="patreon-button" class="patreon-button">Detect Patreon Status</button>
    <p>Patreon User: <i id=ddb-patreon-user>{{#if this.patreonLinked}}{{patreonUser}}{{else}}Not connected{{/if}}</i></p>
    <p>Tier: <i id=ddb-patreon-tier>{{#if this.tier}}{{this.tier}}{{else}}{{/if}}</i></p>
    <p>Valid: <i id=ddb-patreon-valid>{{#if this.tier}}{{validKey}}{{else}}{{/if}}</i></p>
    <p>If you have been provided a Key, enter it here instead:</p>
    <input id="ddb-beta-key" class="setup-config" type="password" name="beta-key" style="flex: 0 1 auto" ;
      value="{{setupConfig.beta-key}}" />
      <p><i>Note: this will be auto filled when you connect to patreon, and the key will be valid for a month.</i></p>
    <hr>
    <p>If you need to change these settings in the future, you can do it in the module settings page.</p>
    <hr>
    <div class="munching-task-setup" id="munching-task-setup" style="color: red">
    </div>
    <button id="munch-settings" class="munch-button" type="submit">Save</button>
  </form>
</div>

