exports.ids = [10];
exports.modules = {

/***/ 141:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(165);
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add CSS to SSR context
var add = __webpack_require__(5).default
module.exports.__inject__ = function (context) {
  add("d37f8e50", content, true, context)
};

/***/ }),

/***/ 164:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_3_node_modules_sass_resources_loader_lib_loader_js_ref_7_oneOf_1_4_node_modules_nuxt_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_MarkdownEditor_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(141);
/* harmony import */ var _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_3_node_modules_sass_resources_loader_lib_loader_js_ref_7_oneOf_1_4_node_modules_nuxt_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_MarkdownEditor_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_3_node_modules_sass_resources_loader_lib_loader_js_ref_7_oneOf_1_4_node_modules_nuxt_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_MarkdownEditor_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_3_node_modules_sass_resources_loader_lib_loader_js_ref_7_oneOf_1_4_node_modules_nuxt_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_MarkdownEditor_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_3_node_modules_sass_resources_loader_lib_loader_js_ref_7_oneOf_1_4_node_modules_nuxt_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_MarkdownEditor_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));


/***/ }),

/***/ 165:
/***/ (function(module, exports, __webpack_require__) {

// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(4);
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(false);
// Module
___CSS_LOADER_EXPORT___.push([module.i, ".markdown-editor .toastui-editor-defaultUI{border:none}.markdown-editor .toastui-editor-md-tab-container{display:none!important}.markdown-editor .CodeMirror{font-family:\"Rubik\"}.markdown-editor .CodeMirror .CodeMirror-lines{padding:.75rem}", ""]);
// Exports
module.exports = ___CSS_LOADER_EXPORT___;


/***/ }),

/***/ 198:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: D:/Development/StarlaneStudios/vindigo/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!D:/Development/StarlaneStudios/vindigo/node_modules/nuxt/node_modules/@nuxt/components/dist/loader.js??ref--0-0!D:/Development/StarlaneStudios/vindigo/node_modules/vue-loader/lib??vue-loader-options!./components/MarkdownEditor.vue?vue&type=template&id=b7264d4e&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:"container",staticClass:"markdown-editor"},[])}
var staticRenderFns = []


// CONCATENATED MODULE: ./components/MarkdownEditor.vue?vue&type=template&id=b7264d4e&

// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(1);
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);

// CONCATENATED MODULE: D:/Development/StarlaneStudios/vindigo/node_modules/babel-loader/lib??ref--13-0!D:/Development/StarlaneStudios/vindigo/node_modules/ts-loader??ref--13-1!D:/Development/StarlaneStudios/vindigo/node_modules/nuxt/node_modules/@nuxt/components/dist/loader.js??ref--0-0!D:/Development/StarlaneStudios/vindigo/node_modules/vue-loader/lib??vue-loader-options!./components/MarkdownEditor.vue?vue&type=script&lang=ts&

let createEditor;

if (false) {}

/* harmony default export */ var MarkdownEditorvue_type_script_lang_ts_ = (external_vue_default.a.extend({
  name: 'MarkdownEditor',
  props: {
    value: String
  },
  data: () => ({
    editor: null,
    lastValue: '',
    keyMap: {
      "Ctrl-B": 'bold',
      "Ctrl-I": 'italicize',
      "Ctrl-'": 'blockquote',
      "Ctrl-Alt-L": 'orderedList',
      "Ctrl-L": 'unorderedList',
      "Ctrl-Alt-I": 'image',
      "Ctrl-H": 'hr',
      "Ctrl-K": 'link'
    }
  }),
  computed: {
    isServer() {
      return true;
    }

  },
  watch: {
    value(val) {
      if (val == this.lastValue) return;
      this.editor.setValue(val);
    }

  },

  mounted() {
    const container = this.$refs.container;
    this.editor = createEditor(container, {
      value: this.value || '',
      mode: 'gfm',
      theme: 'vindigo',
      lineWrapping: true,
      extraKeys: {
        "Ctrl-B": this.applyBold.bind(this),
        "Ctrl-I": this.applyItalicize.bind(this),
        "Ctrl-'": this.applyBlockquote.bind(this),
        "Ctrl-Alt-L": this.applyOrderedList.bind(this),
        "Ctrl-L": this.applyUnorderedList.bind(this),
        "Ctrl-Alt-I": this.applyImage.bind(this),
        "Ctrl-H": this.applyHorizontalRule.bind(this),
        "Ctrl-K": this.applyLink.bind(this)
      }
    });
    this.editor.on('change', editor => {
      const value = editor.getValue();
      this.lastValue = value;
      this.$emit('input', editor.getValue());
    });
    this.editor.on('focus', () => {
      this.$emit('focus');
    });
    this.editor.on('blur', () => {
      this.$emit('blur');
    });
  },

  methods: {
    insert(insertion) {
      let doc = this.editor.getDoc();
      let cursor = doc.getCursor();
      doc.replaceRange(insertion, {
        line: cursor.line,
        ch: cursor.ch
      });
    },

    // Inspired by https://github.com/gilbert/MirrorMark
    toggleAround(start, end) {
      let doc = this.editor.getDoc();
      let cursor = doc.getCursor();

      if (doc.somethingSelected()) {
        let selection = doc.getSelection();

        if (selection.startsWith(start) && selection.endsWith(end)) {
          doc.replaceSelection(selection.substring(start.length, selection.length - end.length), "around");
        } else {
          doc.replaceSelection(start + selection + end, "around");
        }
      } else {
        // If no selection then insert start and end args and set cursor position between the two.
        doc.replaceRange(start + end, {
          line: cursor.line,
          ch: cursor.ch
        });
        doc.setCursor({
          line: cursor.line,
          ch: cursor.ch + start.length
        });
      }
    },

    toggleBefore(insertion) {
      let doc = this.editor.getDoc();
      let cursor = doc.getCursor();

      if (doc.somethingSelected()) {
        let selections = doc.listSelections();
        let remove = null;
        this.editor.operation(function () {
          selections.forEach(function (selection) {
            let pos = [selection.head.line, selection.anchor.line].sort(); // Remove if the first text starts with it

            if (remove == null) {
              remove = doc.getLine(pos[0]).startsWith(insertion);
            }

            for (let i = pos[0]; i <= pos[1]; i++) {
              if (remove) {
                // Don't remove if we don't start with it
                if (doc.getLine(i).startsWith(insertion)) {
                  doc.replaceRange("", {
                    line: i,
                    ch: 0
                  }, {
                    line: i,
                    ch: insertion.length
                  });
                }
              } else {
                doc.replaceRange(insertion, {
                  line: i,
                  ch: 0
                });
              }
            }
          });
        });
      } else {
        let line = cursor.line;

        if (doc.getLine(line).startsWith(insertion)) {
          doc.replaceRange("", {
            line: line,
            ch: 0
          }, {
            line: line,
            ch: insertion.length
          });
        } else {
          doc.replaceRange(insertion, {
            line: line,
            ch: 0
          });
        }
      }
    },

    applyBold() {
      this.toggleAround('**', '**');
    },

    applyItalicize() {
      this.toggleAround('*', '*');
    },

    applyStrikethrough() {
      this.toggleAround('~~', '~~');
    },

    applyCode() {
      this.toggleAround('```\r\n', '\r\n```');
    },

    applyBlockquote() {
      this.toggleBefore('> ');
    },

    applyOrderedList() {
      this.toggleBefore('1. ');
    },

    applyUnorderedList() {
      this.toggleBefore('* ');
    },

    applyImage() {
      this.toggleAround('![', '](http://)');
    },

    applyLink() {
      this.toggleAround('[', '](http://)');
    },

    applyHorizontalRule() {
      this.insert('---');
    }

  }
}));
// CONCATENATED MODULE: ./components/MarkdownEditor.vue?vue&type=script&lang=ts&
 /* harmony default export */ var components_MarkdownEditorvue_type_script_lang_ts_ = (MarkdownEditorvue_type_script_lang_ts_); 
// EXTERNAL MODULE: D:/Development/StarlaneStudios/vindigo/node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(2);

// CONCATENATED MODULE: ./components/MarkdownEditor.vue



function injectStyles (context) {
  
  var style0 = __webpack_require__(164)
if (style0.__inject__) style0.__inject__(context)

}

/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  components_MarkdownEditorvue_type_script_lang_ts_,
  render,
  staticRenderFns,
  false,
  injectStyles,
  null,
  "27063cc6"
  
)

/* harmony default export */ var MarkdownEditor = __webpack_exports__["default"] = (component.exports);

/***/ })

};;
//# sourceMappingURL=markdown-editor.js.map