/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({

/***/ "./node_modules/slugify/slugify.js":
/*!*****************************************!*\
  !*** ./node_modules/slugify/slugify.js ***!
  \*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("\n;(function (name, root, factory) {\n  if (true) {\n    module.exports = factory()\n    module.exports['default'] = factory()\n  }\n  /* istanbul ignore next */\n  else {}\n}('slugify', this, function () {\n  var charMap = JSON.parse('{\"$\":\"dollar\",\"%\":\"percent\",\"&\":\"and\",\"<\":\"less\",\">\":\"greater\",\"|\":\"or\",\"¢\":\"cent\",\"£\":\"pound\",\"¤\":\"currency\",\"¥\":\"yen\",\"©\":\"(c)\",\"ª\":\"a\",\"®\":\"(r)\",\"º\":\"o\",\"À\":\"A\",\"Á\":\"A\",\"Â\":\"A\",\"Ã\":\"A\",\"Ä\":\"A\",\"Å\":\"A\",\"Æ\":\"AE\",\"Ç\":\"C\",\"È\":\"E\",\"É\":\"E\",\"Ê\":\"E\",\"Ë\":\"E\",\"Ì\":\"I\",\"Í\":\"I\",\"Î\":\"I\",\"Ï\":\"I\",\"Ð\":\"D\",\"Ñ\":\"N\",\"Ò\":\"O\",\"Ó\":\"O\",\"Ô\":\"O\",\"Õ\":\"O\",\"Ö\":\"O\",\"Ø\":\"O\",\"Ù\":\"U\",\"Ú\":\"U\",\"Û\":\"U\",\"Ü\":\"U\",\"Ý\":\"Y\",\"Þ\":\"TH\",\"ß\":\"ss\",\"à\":\"a\",\"á\":\"a\",\"â\":\"a\",\"ã\":\"a\",\"ä\":\"a\",\"å\":\"a\",\"æ\":\"ae\",\"ç\":\"c\",\"è\":\"e\",\"é\":\"e\",\"ê\":\"e\",\"ë\":\"e\",\"ì\":\"i\",\"í\":\"i\",\"î\":\"i\",\"ï\":\"i\",\"ð\":\"d\",\"ñ\":\"n\",\"ò\":\"o\",\"ó\":\"o\",\"ô\":\"o\",\"õ\":\"o\",\"ö\":\"o\",\"ø\":\"o\",\"ù\":\"u\",\"ú\":\"u\",\"û\":\"u\",\"ü\":\"u\",\"ý\":\"y\",\"þ\":\"th\",\"ÿ\":\"y\",\"Ā\":\"A\",\"ā\":\"a\",\"Ă\":\"A\",\"ă\":\"a\",\"Ą\":\"A\",\"ą\":\"a\",\"Ć\":\"C\",\"ć\":\"c\",\"Č\":\"C\",\"č\":\"c\",\"Ď\":\"D\",\"ď\":\"d\",\"Đ\":\"DJ\",\"đ\":\"dj\",\"Ē\":\"E\",\"ē\":\"e\",\"Ė\":\"E\",\"ė\":\"e\",\"Ę\":\"e\",\"ę\":\"e\",\"Ě\":\"E\",\"ě\":\"e\",\"Ğ\":\"G\",\"ğ\":\"g\",\"Ģ\":\"G\",\"ģ\":\"g\",\"Ĩ\":\"I\",\"ĩ\":\"i\",\"Ī\":\"i\",\"ī\":\"i\",\"Į\":\"I\",\"į\":\"i\",\"İ\":\"I\",\"ı\":\"i\",\"Ķ\":\"k\",\"ķ\":\"k\",\"Ļ\":\"L\",\"ļ\":\"l\",\"Ľ\":\"L\",\"ľ\":\"l\",\"Ł\":\"L\",\"ł\":\"l\",\"Ń\":\"N\",\"ń\":\"n\",\"Ņ\":\"N\",\"ņ\":\"n\",\"Ň\":\"N\",\"ň\":\"n\",\"Ő\":\"O\",\"ő\":\"o\",\"Œ\":\"OE\",\"œ\":\"oe\",\"Ŕ\":\"R\",\"ŕ\":\"r\",\"Ř\":\"R\",\"ř\":\"r\",\"Ś\":\"S\",\"ś\":\"s\",\"Ş\":\"S\",\"ş\":\"s\",\"Š\":\"S\",\"š\":\"s\",\"Ţ\":\"T\",\"ţ\":\"t\",\"Ť\":\"T\",\"ť\":\"t\",\"Ũ\":\"U\",\"ũ\":\"u\",\"Ū\":\"u\",\"ū\":\"u\",\"Ů\":\"U\",\"ů\":\"u\",\"Ű\":\"U\",\"ű\":\"u\",\"Ų\":\"U\",\"ų\":\"u\",\"Ŵ\":\"W\",\"ŵ\":\"w\",\"Ŷ\":\"Y\",\"ŷ\":\"y\",\"Ÿ\":\"Y\",\"Ź\":\"Z\",\"ź\":\"z\",\"Ż\":\"Z\",\"ż\":\"z\",\"Ž\":\"Z\",\"ž\":\"z\",\"ƒ\":\"f\",\"Ơ\":\"O\",\"ơ\":\"o\",\"Ư\":\"U\",\"ư\":\"u\",\"ǈ\":\"LJ\",\"ǉ\":\"lj\",\"ǋ\":\"NJ\",\"ǌ\":\"nj\",\"Ș\":\"S\",\"ș\":\"s\",\"Ț\":\"T\",\"ț\":\"t\",\"˚\":\"o\",\"Ά\":\"A\",\"Έ\":\"E\",\"Ή\":\"H\",\"Ί\":\"I\",\"Ό\":\"O\",\"Ύ\":\"Y\",\"Ώ\":\"W\",\"ΐ\":\"i\",\"Α\":\"A\",\"Β\":\"B\",\"Γ\":\"G\",\"Δ\":\"D\",\"Ε\":\"E\",\"Ζ\":\"Z\",\"Η\":\"H\",\"Θ\":\"8\",\"Ι\":\"I\",\"Κ\":\"K\",\"Λ\":\"L\",\"Μ\":\"M\",\"Ν\":\"N\",\"Ξ\":\"3\",\"Ο\":\"O\",\"Π\":\"P\",\"Ρ\":\"R\",\"Σ\":\"S\",\"Τ\":\"T\",\"Υ\":\"Y\",\"Φ\":\"F\",\"Χ\":\"X\",\"Ψ\":\"PS\",\"Ω\":\"W\",\"Ϊ\":\"I\",\"Ϋ\":\"Y\",\"ά\":\"a\",\"έ\":\"e\",\"ή\":\"h\",\"ί\":\"i\",\"ΰ\":\"y\",\"α\":\"a\",\"β\":\"b\",\"γ\":\"g\",\"δ\":\"d\",\"ε\":\"e\",\"ζ\":\"z\",\"η\":\"h\",\"θ\":\"8\",\"ι\":\"i\",\"κ\":\"k\",\"λ\":\"l\",\"μ\":\"m\",\"ν\":\"n\",\"ξ\":\"3\",\"ο\":\"o\",\"π\":\"p\",\"ρ\":\"r\",\"ς\":\"s\",\"σ\":\"s\",\"τ\":\"t\",\"υ\":\"y\",\"φ\":\"f\",\"χ\":\"x\",\"ψ\":\"ps\",\"ω\":\"w\",\"ϊ\":\"i\",\"ϋ\":\"y\",\"ό\":\"o\",\"ύ\":\"y\",\"ώ\":\"w\",\"Ё\":\"Yo\",\"Ђ\":\"DJ\",\"Є\":\"Ye\",\"І\":\"I\",\"Ї\":\"Yi\",\"Ј\":\"J\",\"Љ\":\"LJ\",\"Њ\":\"NJ\",\"Ћ\":\"C\",\"Џ\":\"DZ\",\"А\":\"A\",\"Б\":\"B\",\"В\":\"V\",\"Г\":\"G\",\"Д\":\"D\",\"Е\":\"E\",\"Ж\":\"Zh\",\"З\":\"Z\",\"И\":\"I\",\"Й\":\"J\",\"К\":\"K\",\"Л\":\"L\",\"М\":\"M\",\"Н\":\"N\",\"О\":\"O\",\"П\":\"P\",\"Р\":\"R\",\"С\":\"S\",\"Т\":\"T\",\"У\":\"U\",\"Ф\":\"F\",\"Х\":\"H\",\"Ц\":\"C\",\"Ч\":\"Ch\",\"Ш\":\"Sh\",\"Щ\":\"Sh\",\"Ъ\":\"U\",\"Ы\":\"Y\",\"Ь\":\"\",\"Э\":\"E\",\"Ю\":\"Yu\",\"Я\":\"Ya\",\"а\":\"a\",\"б\":\"b\",\"в\":\"v\",\"г\":\"g\",\"д\":\"d\",\"е\":\"e\",\"ж\":\"zh\",\"з\":\"z\",\"и\":\"i\",\"й\":\"j\",\"к\":\"k\",\"л\":\"l\",\"м\":\"m\",\"н\":\"n\",\"о\":\"o\",\"п\":\"p\",\"р\":\"r\",\"с\":\"s\",\"т\":\"t\",\"у\":\"u\",\"ф\":\"f\",\"х\":\"h\",\"ц\":\"c\",\"ч\":\"ch\",\"ш\":\"sh\",\"щ\":\"sh\",\"ъ\":\"u\",\"ы\":\"y\",\"ь\":\"\",\"э\":\"e\",\"ю\":\"yu\",\"я\":\"ya\",\"ё\":\"yo\",\"ђ\":\"dj\",\"є\":\"ye\",\"і\":\"i\",\"ї\":\"yi\",\"ј\":\"j\",\"љ\":\"lj\",\"њ\":\"nj\",\"ћ\":\"c\",\"ѝ\":\"u\",\"џ\":\"dz\",\"Ґ\":\"G\",\"ґ\":\"g\",\"Ғ\":\"GH\",\"ғ\":\"gh\",\"Қ\":\"KH\",\"қ\":\"kh\",\"Ң\":\"NG\",\"ң\":\"ng\",\"Ү\":\"UE\",\"ү\":\"ue\",\"Ұ\":\"U\",\"ұ\":\"u\",\"Һ\":\"H\",\"һ\":\"h\",\"Ә\":\"AE\",\"ә\":\"ae\",\"Ө\":\"OE\",\"ө\":\"oe\",\"฿\":\"baht\",\"ა\":\"a\",\"ბ\":\"b\",\"გ\":\"g\",\"დ\":\"d\",\"ე\":\"e\",\"ვ\":\"v\",\"ზ\":\"z\",\"თ\":\"t\",\"ი\":\"i\",\"კ\":\"k\",\"ლ\":\"l\",\"მ\":\"m\",\"ნ\":\"n\",\"ო\":\"o\",\"პ\":\"p\",\"ჟ\":\"zh\",\"რ\":\"r\",\"ს\":\"s\",\"ტ\":\"t\",\"უ\":\"u\",\"ფ\":\"f\",\"ქ\":\"k\",\"ღ\":\"gh\",\"ყ\":\"q\",\"შ\":\"sh\",\"ჩ\":\"ch\",\"ც\":\"ts\",\"ძ\":\"dz\",\"წ\":\"ts\",\"ჭ\":\"ch\",\"ხ\":\"kh\",\"ჯ\":\"j\",\"ჰ\":\"h\",\"Ẁ\":\"W\",\"ẁ\":\"w\",\"Ẃ\":\"W\",\"ẃ\":\"w\",\"Ẅ\":\"W\",\"ẅ\":\"w\",\"ẞ\":\"SS\",\"Ạ\":\"A\",\"ạ\":\"a\",\"Ả\":\"A\",\"ả\":\"a\",\"Ấ\":\"A\",\"ấ\":\"a\",\"Ầ\":\"A\",\"ầ\":\"a\",\"Ẩ\":\"A\",\"ẩ\":\"a\",\"Ẫ\":\"A\",\"ẫ\":\"a\",\"Ậ\":\"A\",\"ậ\":\"a\",\"Ắ\":\"A\",\"ắ\":\"a\",\"Ằ\":\"A\",\"ằ\":\"a\",\"Ẳ\":\"A\",\"ẳ\":\"a\",\"Ẵ\":\"A\",\"ẵ\":\"a\",\"Ặ\":\"A\",\"ặ\":\"a\",\"Ẹ\":\"E\",\"ẹ\":\"e\",\"Ẻ\":\"E\",\"ẻ\":\"e\",\"Ẽ\":\"E\",\"ẽ\":\"e\",\"Ế\":\"E\",\"ế\":\"e\",\"Ề\":\"E\",\"ề\":\"e\",\"Ể\":\"E\",\"ể\":\"e\",\"Ễ\":\"E\",\"ễ\":\"e\",\"Ệ\":\"E\",\"ệ\":\"e\",\"Ỉ\":\"I\",\"ỉ\":\"i\",\"Ị\":\"I\",\"ị\":\"i\",\"Ọ\":\"O\",\"ọ\":\"o\",\"Ỏ\":\"O\",\"ỏ\":\"o\",\"Ố\":\"O\",\"ố\":\"o\",\"Ồ\":\"O\",\"ồ\":\"o\",\"Ổ\":\"O\",\"ổ\":\"o\",\"Ỗ\":\"O\",\"ỗ\":\"o\",\"Ộ\":\"O\",\"ộ\":\"o\",\"Ớ\":\"O\",\"ớ\":\"o\",\"Ờ\":\"O\",\"ờ\":\"o\",\"Ở\":\"O\",\"ở\":\"o\",\"Ỡ\":\"O\",\"ỡ\":\"o\",\"Ợ\":\"O\",\"ợ\":\"o\",\"Ụ\":\"U\",\"ụ\":\"u\",\"Ủ\":\"U\",\"ủ\":\"u\",\"Ứ\":\"U\",\"ứ\":\"u\",\"Ừ\":\"U\",\"ừ\":\"u\",\"Ử\":\"U\",\"ử\":\"u\",\"Ữ\":\"U\",\"ữ\":\"u\",\"Ự\":\"U\",\"ự\":\"u\",\"Ỳ\":\"Y\",\"ỳ\":\"y\",\"Ỵ\":\"Y\",\"ỵ\":\"y\",\"Ỷ\":\"Y\",\"ỷ\":\"y\",\"Ỹ\":\"Y\",\"ỹ\":\"y\",\"‘\":\"\\'\",\"’\":\"\\'\",\"“\":\"\\\\\\\"\",\"”\":\"\\\\\\\"\",\"†\":\"+\",\"•\":\"*\",\"…\":\"...\",\"₠\":\"ecu\",\"₢\":\"cruzeiro\",\"₣\":\"french franc\",\"₤\":\"lira\",\"₥\":\"mill\",\"₦\":\"naira\",\"₧\":\"peseta\",\"₨\":\"rupee\",\"₩\":\"won\",\"₪\":\"new shequel\",\"₫\":\"dong\",\"€\":\"euro\",\"₭\":\"kip\",\"₮\":\"tugrik\",\"₯\":\"drachma\",\"₰\":\"penny\",\"₱\":\"peso\",\"₲\":\"guarani\",\"₳\":\"austral\",\"₴\":\"hryvnia\",\"₵\":\"cedi\",\"₸\":\"kazakhstani tenge\",\"₹\":\"indian rupee\",\"₽\":\"russian ruble\",\"₿\":\"bitcoin\",\"℠\":\"sm\",\"™\":\"tm\",\"∂\":\"d\",\"∆\":\"delta\",\"∑\":\"sum\",\"∞\":\"infinity\",\"♥\":\"love\",\"元\":\"yuan\",\"円\":\"yen\",\"﷼\":\"rial\"}')\n  var locales = JSON.parse('{\"vi\":{\"Đ\":\"D\",\"đ\":\"d\"}}')\n\n  function replace (string, options) {\n    if (typeof string !== 'string') {\n      throw new Error('slugify: string argument expected')\n    }\n\n    options = (typeof options === 'string')\n      ? {replacement: options}\n      : options || {}\n\n    var locale = locales[options.locale] || {}\n\n    var replacement = options.replacement || '-'\n\n    var slug = string.split('')\n      // replace characters based on charMap\n      .reduce(function (result, ch) {\n        return result + (locale[ch] || charMap[ch] || ch)\n      }, '')\n      // remove not allowed characters\n      .replace(options.remove || /[^\\w\\s$*_+~.()'\"!\\-:@]+/g, '')\n      // trim leading/trailing spaces\n      .trim()\n      // convert spaces to replacement character\n      // also remove duplicates of the replacement character\n      .replace(new RegExp('[\\\\s' + replacement + ']+', 'g'), replacement)\n\n    if (options.lower) {\n      slug = slug.toLowerCase()\n    }\n\n    if (options.strict) {\n      // remove anything besides letters, numbers, and the replacement char\n      slug = slug\n        .replace(new RegExp('[^a-zA-Z0-9' + replacement + ']', 'g'), '')\n    }\n\n    return slug\n  }\n\n  replace.extend = function (customMap) {\n    for (var key in customMap) {\n      charMap[key] = customMap[key]\n    }\n  }\n\n  return replace\n}))\n\n\n//# sourceURL=webpack:///./node_modules/slugify/slugify.js?");

/***/ }),

/***/ "./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js":
/*!*******************************************************************************!*\
  !*** ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js ***!
  \*******************************************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var slugify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! slugify */ \"./node_modules/slugify/slugify.js\");\n/* harmony import */ var slugify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(slugify__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wagtailset_draftail_links_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wagtailset_draftail_links.js */ \"./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js\");\nfunction _createForOfIteratorHelper(o) { if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(n); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar React = window.React;\nvar RichUtils = window.DraftJS.RichUtils;\nvar Modifier = window.DraftJS.Modifier;\nvar SelectionState = window.DraftJS.SelectionState;\nvar TooltipEntity = window.draftail.TooltipEntity;\nvar Icon = window.wagtail.components.Icon;\nvar EditorState = window.DraftJS.EditorState;\nvar Portal = window.wagtail.components.Portal;\nvar Tooltip = window.draftail.Tooltip;\nvar LinkModalWorkflowSource = window.draftail.LinkModalWorkflowSource;\n // import PropTypes from \"prop-types\";\n\n\nvar DECORATORS = [];\nvar CONTROLS = [];\nvar DRAFT_PLUGINS = [];\n\nvar registerDecorator = function registerDecorator(decorator) {\n  DECORATORS.push(decorator);\n  return DECORATORS;\n};\n\nvar registerControl = function registerControl(control) {\n  CONTROLS.push(control);\n  return CONTROLS;\n};\n\nvar registerDraftPlugin = function registerDraftPlugin(plugin) {\n  DRAFT_PLUGINS.push(plugin);\n  return DRAFT_PLUGINS;\n}; // Override the existing initEditor to hook the new APIs into it.\n// This works in Wagtail 2.0 but will definitely break in a future release.\n\n\nvar initEditor = window.draftail.initEditor;\n\nvar initEditorOverride = function initEditorOverride(selector, options, currentScript) {\n  var overrides = {\n    decorators: DECORATORS.concat(options.decorators || []),\n    controls: CONTROLS.concat(options.controls || []),\n    plugins: DRAFT_PLUGINS.concat(options.plugins || [])\n  };\n  var newOptions = Object.assign({}, options, overrides);\n  return initEditor(selector, newOptions, currentScript);\n};\n\nwindow.draftail.registerControl = registerControl;\nwindow.draftail.registerDecorator = registerDecorator;\nwindow.draftail.initEditor = initEditorOverride;\n\nvar AnchorIdentifierSource = /*#__PURE__*/function (_React$Component) {\n  _inherits(AnchorIdentifierSource, _React$Component);\n\n  var _super = _createSuper(AnchorIdentifierSource);\n\n  function AnchorIdentifierSource() {\n    _classCallCheck(this, AnchorIdentifierSource);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(AnchorIdentifierSource, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      var _this$props = this.props,\n          editorState = _this$props.editorState,\n          entityType = _this$props.entityType,\n          onComplete = _this$props.onComplete,\n          entity = _this$props.entity;\n      var content = editorState.getCurrentContent();\n      var anchor_id = \"\";\n\n      if (entity) {\n        anchor_id = entity.data.anchor;\n      }\n\n      var anchor = window.prompt(\"Anchor identifier:\", anchor_id); // Uses the Draft.js API to create a new entity with the right data.\n\n      if (anchor) {\n        var contentWithEntity = content.createEntity(entityType.type, \"MUTABLE\", {\n          anchor: slugify__WEBPACK_IMPORTED_MODULE_0___default()(anchor.toLowerCase())\n        });\n        var entityKey = contentWithEntity.getLastCreatedEntityKey();\n        var selection = editorState.getSelection();\n        var nextState = RichUtils.toggleLink(editorState, selection, entityKey);\n        onComplete(nextState);\n      } else {\n        onComplete(editorState);\n      }\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      return null;\n    }\n  }]);\n\n  return AnchorIdentifierSource;\n}(React.Component);\n\nvar getAnchorIdentifierAttributes = function getAnchorIdentifierAttributes(data) {\n  var url = data.anchor || null;\n  var icon = /*#__PURE__*/React.createElement(Icon, {\n    name: \"anchor\"\n  });\n  var label = \"#\".concat(url);\n  return {\n    url: url,\n    icon: icon,\n    label: label\n  };\n};\n\nvar AnchorIdentifier = function AnchorIdentifier(props) {\n  var entityKey = props.entityKey,\n      contentState = props.contentState;\n  var data = contentState.getEntity(entityKey).getData();\n  return /*#__PURE__*/React.createElement(TooltipEntity, _extends({}, props, getAnchorIdentifierAttributes(data)));\n};\n\nwindow.draftail.registerPlugin({\n  type: \"ANCHOR-IDENTIFIER\",\n  source: AnchorIdentifierSource,\n  decorator: AnchorIdentifier\n});\n\nvar CopyAnchorButton = function CopyAnchorButton(_ref) {\n  var identifier = _ref.identifier;\n\n  var _React$useState = React.useState(false),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      didCopy = _React$useState2[0],\n      setDidCopy = _React$useState2[1];\n\n  var copyText = function copyText(event) {\n    // Prevent the button click event from submitting the page form\n    event.preventDefault();\n    navigator.clipboard.writeText(identifier);\n    setDidCopy(true);\n  };\n\n  var classes = \"button button-small\";\n  return /*#__PURE__*/React.createElement(\"button\", {\n    className: classes,\n    style: {\n      marginLeft: \"1rem\"\n    },\n    \"aria-label\": \"Copy anchor identifier\",\n    \"aria-live\": \"polite\",\n    role: \"button\",\n    onClick: copyText\n  }, didCopy ? \"Copied\" : \"Copy\");\n};\n\nvar HeaderAnchorDecorator = /*#__PURE__*/function (_TooltipEntity) {\n  _inherits(HeaderAnchorDecorator, _TooltipEntity);\n\n  var _super2 = _createSuper(HeaderAnchorDecorator);\n\n  function HeaderAnchorDecorator(props) {\n    _classCallCheck(this, HeaderAnchorDecorator);\n\n    return _super2.call(this, props);\n  }\n\n  _createClass(HeaderAnchorDecorator, [{\n    key: \"getBlock\",\n    value: function getBlock(editorState) {\n      var block_key = editorState.getSelection().getFocusKey();\n      return this.props.contentState.getBlockForKey(block_key);\n    }\n  }, {\n    key: \"getData\",\n    value: function getData(editorState) {\n      var block = this.getBlock(editorState);\n      return block.getData();\n    }\n  }, {\n    key: \"setAnchor\",\n    value: function setAnchor(anchor) {\n      var editorState = this.props.getEditorState();\n      var newEditorState = editorState;\n      var newData = new Map();\n      newData.set(\"anchor\", anchor);\n      var content = editorState.getCurrentContent();\n      var selection = editorState.getSelection();\n      content = Modifier.mergeBlockData(content, selection, newData);\n      newEditorState = EditorState.push(editorState, content, editorState.getLastChangeType());\n      newEditorState = EditorState.acceptSelection(newEditorState, selection);\n      this.props.setEditorState(newEditorState);\n    }\n  }, {\n    key: \"onRemove\",\n    value: function onRemove(e) {\n      e.preventDefault();\n      e.stopPropagation();\n      this.setAnchor(null);\n    }\n  }, {\n    key: \"onEdit\",\n    value: function onEdit(e) {\n      e.preventDefault();\n      e.stopPropagation();\n      var editorState = this.props.getEditorState();\n      var block = this.getBlock(editorState);\n      var data = this.getData(editorState);\n      var anchor = window.prompt(\"Anchor Link:\", data.get(\"anchor\") || data.get(\"id\") || slugify__WEBPACK_IMPORTED_MODULE_0___default()(block.getText().toLowerCase()));\n      this.setAnchor(slugify__WEBPACK_IMPORTED_MODULE_0___default()(anchor));\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var children = this.props.children;\n      var showTooltipAt = this.state.showTooltipAt;\n      var editorState = this.props.getEditorState();\n      var data = this.getData(editorState);\n      var block = this.getBlock(editorState); // try to get custom anchor first, then id and only then build it from the text\n\n      var anchor = data.get(\"anchor\") || data.get(\"id\") || slugify__WEBPACK_IMPORTED_MODULE_0___default()(block.getText().toLowerCase());\n      var url = \"#\".concat(anchor); // Contrary to what JSX A11Y says, this should be a button but it shouldn't be focusable.\n\n      /* eslint-disable springload/jsx-a11y/interactive-supports-focus */\n\n      return /*#__PURE__*/React.createElement(\"a\", {\n        href: \"\",\n        role: \"button\" // Use onMouseUp to preserve focus in the text even after clicking.\n        ,\n        onMouseUp: this.openTooltip,\n        className: \"TooltipEntity\",\n        \"data-draftail-trigger\": true\n      }, children, showTooltipAt && /*#__PURE__*/React.createElement(Portal, {\n        node: showTooltipAt.container,\n        onClose: this.closeTooltip,\n        closeOnClick: true,\n        closeOnType: true,\n        closeOnResize: true\n      }, /*#__PURE__*/React.createElement(Tooltip, {\n        target: showTooltipAt,\n        direction: \"top\"\n      }, /*#__PURE__*/React.createElement(\"span\", {\n        className: \"Tooltip__link\"\n      }, url), /*#__PURE__*/React.createElement(CopyAnchorButton, {\n        identifier: anchor\n      }), /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small Tooltip__button\",\n        onClick: this.onEdit\n      }, \"Edit\"), /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small button-secondary no Tooltip__button\",\n        onClick: this.onRemove\n      }, \"Reset\"))));\n    }\n  }]);\n\n  return HeaderAnchorDecorator;\n}(TooltipEntity);\n\nfunction headingStrategy(contentBlock, callback, contentState) {\n  if (contentBlock.getType().includes(\"header\")) {\n    callback(0, contentBlock.getLength());\n  }\n}\n\nregisterDraftPlugin({\n  decorators: [{\n    strategy: headingStrategy,\n    component: HeaderAnchorDecorator\n  }],\n  onChange: function onChange(editorState, PluginFunctions) {\n    // if content has been modified, update all heading blocks's data with\n    // a slugified version of their contents as 'anchor', for use\n    // in generating anchor links consistently with their displayed form\n    var content = editorState.getCurrentContent();\n\n    if (content == PluginFunctions.getEditorState().getCurrentContent()) {\n      return editorState;\n    }\n\n    var blocks = content.getBlockMap();\n    var selection = editorState.getSelection();\n    var newEditorState = editorState;\n\n    var _iterator = _createForOfIteratorHelper(blocks.entries()),\n        _step;\n\n    try {\n      for (_iterator.s(); !(_step = _iterator.n()).done;) {\n        var _step$value = _slicedToArray(_step.value, 2),\n            key = _step$value[0],\n            block = _step$value[1];\n\n        if (block.getType().includes(\"header\")) {\n          var blockSelection = SelectionState.createEmpty(key);\n          var data = block.getData(); // do not change if there is a custom anchor\n\n          if (data.get(\"anchor\")) {\n            continue;\n          }\n\n          var newData = new Map();\n          newData.set(\"id\", slugify__WEBPACK_IMPORTED_MODULE_0___default()(block.getText().toLowerCase()));\n          content = Modifier.mergeBlockData(content, blockSelection, newData);\n        }\n      }\n    } catch (err) {\n      _iterator.e(err);\n    } finally {\n      _iterator.f();\n    }\n\n    newEditorState = EditorState.push(editorState, content, editorState.getLastChangeType());\n    newEditorState = EditorState.acceptSelection(newEditorState, selection);\n    return newEditorState;\n  }\n});\nHeaderAnchorDecorator.propTypes = {// contentState: PropTypes.object.isRequired,\n  // decoratedText: PropTypes.string.isRequired\n};\nwindow.draftail.registerPlugin({\n  type: \"LINK\",\n  source: LinkModalWorkflowSource,\n  decorator: _wagtailset_draftail_links_js__WEBPACK_IMPORTED_MODULE_1__[\"Link\"],\n  onPaste: _wagtailset_draftail_links_js__WEBPACK_IMPORTED_MODULE_1__[\"onPasteLink\"]\n});\n\n//# sourceURL=webpack:///./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js?");

/***/ }),

/***/ "./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js":
/*!******************************************************************************!*\
  !*** ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js ***!
  \******************************************************************************/
/*! exports provided: onPasteLink, Link */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"onPasteLink\", function() { return onPasteLink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Link\", function() { return Link; });\n/* harmony import */ var slugify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! slugify */ \"./node_modules/slugify/slugify.js\");\n/* harmony import */ var slugify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(slugify__WEBPACK_IMPORTED_MODULE_0__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(n); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar React = window.React;\nvar RichUtils = window.DraftJS.RichUtils;\nvar Modifier = window.DraftJS.Modifier;\nvar TooltipEntity = window.draftail.TooltipEntity;\nvar Icon = window.wagtail.components.Icon;\nvar EditorState = window.DraftJS.EditorState;\nvar Portal = window.wagtail.components.Portal;\nvar Tooltip = window.draftail.Tooltip; // import PropTypes from \"prop-types\";\n\n\n\nvar shortenLabel = function shortenLabel(label) {\n  var shortened = label;\n\n  if (shortened.length > 25) {\n    shortened = \"\".concat(shortened.slice(0, 20), \"\\u2026\");\n  }\n\n  return shortened;\n};\n\nvar gettext = function gettext(text) {\n  var _window$django;\n\n  var djangoGettext = (_window$django = window.django) === null || _window$django === void 0 ? void 0 : _window$django.gettext;\n\n  if (djangoGettext) {\n    return djangoGettext(text);\n  }\n\n  return text;\n};\n\nvar LINK_ICON = /*#__PURE__*/React.createElement(Icon, {\n  name: \"link\"\n});\nvar BROKEN_LINK_ICON = /*#__PURE__*/React.createElement(Icon, {\n  name: \"warning\"\n});\nvar MAIL_ICON = /*#__PURE__*/React.createElement(Icon, {\n  name: \"mail\"\n});\n\nvar getEmailAddress = function getEmailAddress(mailto) {\n  return mailto.replace(\"mailto:\", \"\").split(\"?\")[0];\n};\n\nvar getPhoneNumber = function getPhoneNumber(tel) {\n  return tel.replace(\"tel:\", \"\").split(\"?\")[0];\n};\n\nvar getDomainName = function getDomainName(url) {\n  return url.replace(/(^\\w+:|^)\\/\\//, \"\").split(\"/\")[0];\n}; // Determines how to display the link based on its type: page, mail, hash or external.\n\n\nvar getLinkAttributes = function getLinkAttributes(data) {\n  var url = data.url || null;\n  var icon;\n  var label;\n\n  if (!url) {\n    icon = BROKEN_LINK_ICON;\n    label = gettext(\"Broken link\");\n  } else if (data.id) {\n    icon = LINK_ICON;\n    label = url;\n  } else if (url.startsWith(\"mailto:\")) {\n    icon = MAIL_ICON;\n    label = getEmailAddress(url);\n  } else if (url.startsWith(\"tel:\")) {\n    icon = LINK_ICON;\n    label = getPhoneNumber(url);\n  } else if (url.startsWith(\"#\")) {\n    icon = LINK_ICON;\n    label = url;\n  } else {\n    icon = LINK_ICON;\n    label = getDomainName(url);\n  }\n\n  return {\n    url: url,\n    icon: icon,\n    label: label\n  };\n};\n\nvar djangoUserRegex = /(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$|^\"([\\001-\\010\\013\\014\\016-\\037!#-[\\]-\\177]|\\\\[\\001-\\011\\013\\014\\016-\\177])*\"$)/i; // Compared to Django, changed to remove the end-of-domain `-` check that was done with a negative lookbehind `(?<!-)` (unsupported in Safari), and disallow all TLD hyphens instead.\n// const djangoDomainRegex = /((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+)(?:[A-Z0-9-]{2,63}(?<!-))$/i;\n\nvar djangoDomainRegex = /((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+)(?:[A-Z0-9]{2,63})$/i;\n/**\n * See https://docs.djangoproject.com/en/4.0/_modules/django/core/validators/#URLValidator.\n */\n\nvar djangoSchemes = [\"http:\", \"https:\", \"ftp:\", \"ftps:\"];\n\nvar getValidLinkURL = function getValidLinkURL(text, schemes) {\n  if (text.includes(\"@\")) {\n    var _text$split = text.split(\"@\"),\n        _text$split2 = _slicedToArray(_text$split, 2),\n        user = _text$split2[0],\n        domain = _text$split2[1];\n\n    if (djangoUserRegex.test(user) && djangoDomainRegex.test(domain)) {\n      return \"mailto:\".concat(text);\n    }\n  }\n\n  try {\n    var url = new URL(text);\n\n    if (schemes.includes(url.protocol)) {\n      return text;\n    }\n  } catch (e) {\n    return false;\n  }\n\n  return false;\n};\n\nvar onPasteLink = function onPasteLink(text, html, editorState, _ref) {\n  var setEditorState = _ref.setEditorState;\n  var url = getValidLinkURL(text, djangoSchemes);\n\n  if (!url) {\n    return \"not-handled\";\n  }\n\n  var selection = editorState.getSelection();\n  var content = editorState.getCurrentContent();\n  content = content.createEntity(\"LINK\", \"MUTABLE\", {\n    url: url\n  });\n  var entityKey = content.getLastCreatedEntityKey();\n  var nextState;\n\n  if (selection.isCollapsed()) {\n    content = Modifier.insertText(content, selection, text, undefined, entityKey);\n    nextState = EditorState.push(editorState, content, \"insert-characters\");\n  } else {\n    nextState = RichUtils.toggleLink(editorState, selection, entityKey);\n  }\n\n  setEditorState(nextState);\n  return \"handled\";\n};\n\nvar buttonContainerStyle = {\n  \"float\": 'right'\n};\n\nvar Link = /*#__PURE__*/function (_TooltipEntity) {\n  _inherits(Link, _TooltipEntity);\n\n  var _super = _createSuper(Link);\n\n  function Link(props) {\n    var _this;\n\n    _classCallCheck(this, Link);\n\n    _this = _super.call(this, props);\n    _this.onSetHash = _this.onSetHash.bind(_assertThisInitialized(_this));\n    _this.onRemoveHash = _this.onRemoveHash.bind(_assertThisInitialized(_this));\n    return _this;\n  }\n\n  _createClass(Link, [{\n    key: \"onSetHash\",\n    value: function onSetHash(e) {\n      e.preventDefault();\n      e.stopPropagation();\n      var _this$props = this.props,\n          entityKey = _this$props.entityKey,\n          contentState = _this$props.contentState;\n      var data = contentState.getEntity(entityKey).getData();\n      var hash = window.prompt(\"Hash Link:\", data.hash || \"\");\n\n      if (hash != null && hash !== data.hash) {\n        this.setHash(slugify__WEBPACK_IMPORTED_MODULE_0___default()(hash));\n      }\n    }\n  }, {\n    key: \"onRemoveHash\",\n    value: function onRemoveHash(e) {\n      e.preventDefault();\n      e.stopPropagation();\n      this.setHash(null);\n    }\n  }, {\n    key: \"setHash\",\n    value: function setHash(hash) {\n      var editorState = this.props.getEditorState();\n      var newEditorState = editorState;\n      var content = editorState.getCurrentContent();\n      var entityKey = this.props.entityKey;\n      var nextContent = content.mergeEntityData(entityKey, {\n        hash: hash\n      });\n      var selection = editorState.getSelection();\n      content = Modifier.mergeBlockData(nextContent, selection, {\n        hash: hash\n      });\n      newEditorState = EditorState.push(editorState, content, editorState.getLastChangeType());\n      newEditorState = EditorState.acceptSelection(newEditorState, selection);\n      this.props.setEditorState(newEditorState);\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this$props2 = this.props,\n          entityKey = _this$props2.entityKey,\n          contentState = _this$props2.contentState,\n          children = _this$props2.children;\n      var data = contentState.getEntity(entityKey).getData();\n\n      var _getLinkAttributes = getLinkAttributes(data),\n          icon = _getLinkAttributes.icon,\n          label = _getLinkAttributes.label,\n          url = _getLinkAttributes.url;\n\n      var showTooltipAt = this.state.showTooltipAt;\n      var hash = data.hash || \"\";\n      var isInternalLink = data.id ? true : false;\n      var fullUrl = url;\n\n      if (isInternalLink && hash) {\n        fullUrl = \"\".concat(url, \"#{hash}\");\n      }\n\n      return /*#__PURE__*/React.createElement(\"a\", {\n        href: url,\n        role: \"button\" // Use onMouseUp to preserve focus in the text even after clicking.\n        ,\n        onMouseUp: this.openTooltip,\n        className: \"TooltipEntity\",\n        \"data-draftail-trigger\": true\n      }, icon, children, showTooltipAt && /*#__PURE__*/React.createElement(Portal, {\n        node: showTooltipAt.container,\n        onClose: this.closeTooltip,\n        closeOnClick: true,\n        closeOnType: true,\n        closeOnResize: true\n      }, /*#__PURE__*/React.createElement(Tooltip, {\n        target: showTooltipAt,\n        direction: \"top\"\n      }, /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"a\", {\n        href: fullUrl,\n        title: url,\n        target: \"_blank\",\n        rel: \"noreferrer\",\n        className: \"Tooltip__link\"\n      }, shortenLabel(label)), /*#__PURE__*/React.createElement(\"div\", {\n        style: buttonContainerStyle\n      }, /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small Tooltip__button\",\n        onClick: this.onEdit\n      }, \"Edit\"), /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small button-secondary no Tooltip__button\",\n        onClick: this.onRemove\n      }, \"Remove\"))), isInternalLink && /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"hr\", null), /*#__PURE__*/React.createElement(\"a\", {\n        href: fullUrl,\n        title: url,\n        target: \"_blank\",\n        rel: \"noreferrer\",\n        className: \"Tooltip__link\",\n        style: {\n          marginTop: '-1em'\n        }\n      }, \"Anchor: \", /*#__PURE__*/React.createElement(\"br\", null), \" #\", shortenLabel(hash)), /*#__PURE__*/React.createElement(\"div\", {\n        style: buttonContainerStyle\n      }, /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small Tooltip__button\",\n        onClick: this.onSetHash\n      }, hash ? \"Edit\" : \"Add\"), /*#__PURE__*/React.createElement(\"button\", {\n        className: \"button button-small button-secondary no Tooltip__button\",\n        onClick: this.onRemoveHash\n      }, \"Remove\"))))));\n    }\n  }]);\n\n  return Link;\n}(TooltipEntity);\n\nLink.propTypes = {// entityKey: PropTypes.string.isRequired,\n  // contentState: PropTypes.object.isRequired,\n};\n\n\n//# sourceURL=webpack:///./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js?");

/***/ }),

/***/ 0:
/*!************************************************************************************************************************************************************!*\
  !*** multi ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js ***!
  \************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("__webpack_require__(/*! ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js */\"./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js\");\nmodule.exports = __webpack_require__(/*! ./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js */\"./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js\");\n\n\n//# sourceURL=webpack:///multi_./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_anchor.js_./static_src/wagtailsetdraftailanchors/js/wagtailset_draftail_links.js?");

/***/ })

/******/ });