/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/natural-orderby/esm/natural-orderby.js": /*!*************************************************************!*\ !*** ./node_modules/natural-orderby/esm/natural-orderby.js ***! \*************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"orderBy\": () => (/* binding */ orderBy),\n/* harmony export */ \"compare\": () => (/* binding */ compare)\n/* harmony export */ });\nvar compareNumbers = function compareNumbers(numberA, numberB) {\n if (numberA < numberB) {\n return -1;\n }\n\n if (numberA > numberB) {\n return 1;\n }\n\n return 0;\n};\n\nvar RE_NUMBERS = /(^0x[\\da-fA-F]+$|^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?(?!\\.\\d+)(?=\\D|\\s|$))|\\d+)/g;\nvar RE_LEADING_OR_TRAILING_WHITESPACES = /^\\s+|\\s+$/g; // trim pre-post whitespace\n\nvar RE_WHITESPACES = /\\s+/g; // normalize all whitespace to single ' ' character\n\nvar RE_INT_OR_FLOAT = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/; // identify integers and floats\n\nvar RE_DATE = /(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[/-]\\d{1,4}[/-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/; // identify date strings\n\nvar RE_LEADING_ZERO = /^0+[1-9]{1}[0-9]*$/;\nvar RE_UNICODE_CHARACTERS = /[^\\x00-\\x80]/;\n\nvar compareUnicode = function compareUnicode(stringA, stringB) {\n var result = stringA.localeCompare(stringB);\n return result ? result / Math.abs(result) : 0;\n};\n\nvar stringCompare = function stringCompare(stringA, stringB) {\n if (stringA < stringB) {\n return -1;\n }\n\n if (stringA > stringB) {\n return 1;\n }\n\n return 0;\n};\n\nvar compareChunks = function compareChunks(chunksA, chunksB) {\n var lengthA = chunksA.length;\n var lengthB = chunksB.length;\n var size = Math.min(lengthA, lengthB);\n\n for (var i = 0; i < size; i++) {\n var chunkA = chunksA[i];\n var chunkB = chunksB[i];\n\n if (chunkA.normalizedString !== chunkB.normalizedString) {\n if (chunkA.normalizedString === '' !== (chunkB.normalizedString === '')) {\n // empty strings have lowest value\n return chunkA.normalizedString === '' ? -1 : 1;\n }\n\n if (chunkA.parsedNumber !== undefined && chunkB.parsedNumber !== undefined) {\n // compare numbers\n var result = compareNumbers(chunkA.parsedNumber, chunkB.parsedNumber);\n\n if (result === 0) {\n // compare string value, if parsed numbers are equal\n // Example:\n // chunkA = { parsedNumber: 1, normalizedString: \"001\" }\n // chunkB = { parsedNumber: 1, normalizedString: \"01\" }\n // chunkA.parsedNumber === chunkB.parsedNumber\n // chunkA.normalizedString < chunkB.normalizedString\n return stringCompare(chunkA.normalizedString, chunkB.normalizedString);\n }\n\n return result;\n } else if (chunkA.parsedNumber !== undefined || chunkB.parsedNumber !== undefined) {\n // number < string\n return chunkA.parsedNumber !== undefined ? -1 : 1;\n } else if (RE_UNICODE_CHARACTERS.test(chunkA.normalizedString + chunkB.normalizedString) && chunkA.normalizedString.localeCompare) {\n // use locale comparison only if one of the chunks contains unicode characters\n return compareUnicode(chunkA.normalizedString, chunkB.normalizedString);\n } else {\n // use common string comparison for performance reason\n return stringCompare(chunkA.normalizedString, chunkB.normalizedString);\n }\n }\n } // if the chunks are equal so far, the one which has more chunks is greater than the other one\n\n\n if (lengthA > size || lengthB > size) {\n return lengthA <= size ? -1 : 1;\n }\n\n return 0;\n};\n\nvar compareOtherTypes = function compareOtherTypes(valueA, valueB) {\n if (!valueA.chunks ? valueB.chunks : !valueB.chunks) {\n return !valueA.chunks ? 1 : -1;\n }\n\n if (valueA.isNaN ? !valueB.isNaN : valueB.isNaN) {\n return valueA.isNaN ? -1 : 1;\n }\n\n if (valueA.isSymbol ? !valueB.isSymbol : valueB.isSymbol) {\n return valueA.isSymbol ? -1 : 1;\n }\n\n if (valueA.isObject ? !valueB.isObject : valueB.isObject) {\n return valueA.isObject ? -1 : 1;\n }\n\n if (valueA.isArray ? !valueB.isArray : valueB.isArray) {\n return valueA.isArray ? -1 : 1;\n }\n\n if (valueA.isFunction ? !valueB.isFunction : valueB.isFunction) {\n return valueA.isFunction ? -1 : 1;\n }\n\n if (valueA.isNull ? !valueB.isNull : valueB.isNull) {\n return valueA.isNull ? -1 : 1;\n }\n\n return 0;\n};\n\nvar compareValues = function compareValues(valueA, valueB) {\n if (valueA.value === valueB.value) {\n return 0;\n }\n\n if (valueA.parsedNumber !== undefined && valueB.parsedNumber !== undefined) {\n return compareNumbers(valueA.parsedNumber, valueB.parsedNumber);\n }\n\n if (valueA.chunks && valueB.chunks) {\n return compareChunks(valueA.chunks, valueB.chunks);\n }\n\n return compareOtherTypes(valueA, valueB);\n};\n\nvar compareMultiple = function compareMultiple(recordA, recordB, orders) {\n var indexA = recordA.index,\n valuesA = recordA.values;\n var indexB = recordB.index,\n valuesB = recordB.values;\n var length = valuesA.length;\n var ordersLength = orders.length;\n\n for (var i = 0; i < length; i++) {\n var order = i < ordersLength ? orders[i] : null;\n\n if (order && typeof order === 'function') {\n var result = order(valuesA[i].value, valuesB[i].value);\n\n if (result) {\n return result;\n }\n } else {\n var _result = compareValues(valuesA[i], valuesB[i]);\n\n if (_result) {\n return _result * (order === 'desc' ? -1 : 1);\n }\n }\n }\n\n return indexA - indexB;\n};\n\nvar createIdentifierFn = function createIdentifierFn(identifier) {\n if (typeof identifier === 'function') {\n // identifier is already a lookup function\n return identifier;\n }\n\n return function (value) {\n if (Array.isArray(value)) {\n var index = Number(identifier);\n\n if (Number.isInteger(index)) {\n return value[index];\n }\n } else if (value && typeof value === 'object' && typeof identifier !== 'function') {\n return value[identifier];\n }\n\n return value;\n };\n};\n\nvar stringify = function stringify(value) {\n if (typeof value === 'boolean' || value instanceof Boolean) {\n return Number(value).toString();\n }\n\n if (typeof value === 'number' || value instanceof Number) {\n return value.toString();\n }\n\n if (value instanceof Date) {\n return value.getTime().toString();\n }\n\n if (typeof value === 'string' || value instanceof String) {\n return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');\n }\n\n return '';\n};\n\nvar parseNumber = function parseNumber(value) {\n if (value.length !== 0) {\n var parsedNumber = Number(value);\n\n if (!Number.isNaN(parsedNumber)) {\n return parsedNumber;\n }\n }\n\n return undefined;\n};\n\nvar parseDate = function parseDate(value) {\n if (RE_DATE.test(value)) {\n var parsedDate = Date.parse(value);\n\n if (!Number.isNaN(parsedDate)) {\n return parsedDate;\n }\n }\n\n return undefined;\n};\n\nvar numberify = function numberify(value) {\n var parsedNumber = parseNumber(value);\n\n if (parsedNumber !== undefined) {\n return parsedNumber;\n }\n\n return parseDate(value);\n};\n\nvar createChunks = function createChunks(value) {\n return value.replace(RE_NUMBERS, '\\0$1\\0').replace(/\\0$/, '').replace(/^\\0/, '').split('\\0');\n};\n\nvar normalizeAlphaChunk = function normalizeAlphaChunk(chunk) {\n return chunk.replace(RE_WHITESPACES, ' ').replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');\n};\n\nvar normalizeNumericChunk = function normalizeNumericChunk(chunk, index, chunks) {\n if (RE_INT_OR_FLOAT.test(chunk)) {\n // don´t parse a number, if there´s a preceding decimal point\n // to keep significance\n // e.g. 1.0020, 1.020\n if (!RE_LEADING_ZERO.test(chunk) || index === 0 || chunks[index - 1] !== '.') {\n return parseNumber(chunk) || 0;\n }\n }\n\n return undefined;\n};\n\nvar createChunkMap = function createChunkMap(chunk, index, chunks) {\n return {\n parsedNumber: normalizeNumericChunk(chunk, index, chunks),\n normalizedString: normalizeAlphaChunk(chunk)\n };\n};\n\nvar createChunkMaps = function createChunkMaps(value) {\n var chunksMaps = createChunks(value).map(createChunkMap);\n return chunksMaps;\n};\n\nvar isFunction = function isFunction(value) {\n return typeof value === 'function';\n};\n\nvar isNaN = function isNaN(value) {\n return Number.isNaN(value) || value instanceof Number && Number.isNaN(value.valueOf());\n};\n\nvar isNull = function isNull(value) {\n return value === null;\n};\n\nvar isObject = function isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Number) && !(value instanceof String) && !(value instanceof Boolean) && !(value instanceof Date);\n};\n\nvar isSymbol = function isSymbol(value) {\n return typeof value === 'symbol';\n};\n\nvar isUndefined = function isUndefined(value) {\n return value === undefined;\n};\n\nvar getMappedValueRecord = function getMappedValueRecord(value) {\n if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {\n var stringValue = stringify(value);\n var parsedNumber = numberify(stringValue);\n var chunks = createChunkMaps(parsedNumber ? \"\" + parsedNumber : stringValue);\n return {\n parsedNumber: parsedNumber,\n chunks: chunks,\n value: value\n };\n }\n\n return {\n isArray: Array.isArray(value),\n isFunction: isFunction(value),\n isNaN: isNaN(value),\n isNull: isNull(value),\n isObject: isObject(value),\n isSymbol: isSymbol(value),\n isUndefined: isUndefined(value),\n value: value\n };\n};\n\nvar getValueByIdentifier = function getValueByIdentifier(value, getValue) {\n return getValue(value);\n};\n\nvar getElementByIndex = function getElementByIndex(collection, index) {\n return collection[index];\n};\n\nvar baseOrderBy = function baseOrderBy(collection, identifiers, orders) {\n var identifierFns = identifiers.length ? identifiers.map(createIdentifierFn) : [function (value) {\n return value;\n }]; // temporary array holds elements with position and sort-values\n\n var mappedCollection = collection.map(function (element, index) {\n var values = identifierFns.map(function (identifier) {\n return getValueByIdentifier(element, identifier);\n }).map(getMappedValueRecord);\n return {\n index: index,\n values: values\n };\n }); // iterate over values and compare values until a != b or last value reached\n\n mappedCollection.sort(function (recordA, recordB) {\n return compareMultiple(recordA, recordB, orders);\n });\n return mappedCollection.map(function (element) {\n return getElementByIndex(collection, element.index);\n });\n};\n\nvar getIdentifiers = function getIdentifiers(identifiers) {\n if (!identifiers) {\n return [];\n }\n\n var identifierList = !Array.isArray(identifiers) ? [identifiers] : [].concat(identifiers);\n\n if (identifierList.some(function (identifier) {\n return typeof identifier !== 'string' && typeof identifier !== 'number' && typeof identifier !== 'function';\n })) {\n return [];\n }\n\n return identifierList;\n};\n\nvar getOrders = function getOrders(orders) {\n if (!orders) {\n return [];\n }\n\n var orderList = !Array.isArray(orders) ? [orders] : [].concat(orders);\n\n if (orderList.some(function (order) {\n return order !== 'asc' && order !== 'desc' && typeof order !== 'function';\n })) {\n return [];\n }\n\n return orderList;\n};\n\n/**\n * Creates an array of elements, natural sorted by specified identifiers and\n * the corresponding sort orders. This method implements a stable sort\n * algorithm, which means the original sort order of equal elements is\n * preserved.\n *\n * If `collection` is an array of primitives, `identifiers` may be unspecified.\n * Otherwise, you should specify `identifiers` to sort by or `collection` will\n * be returned unsorted. An identifier can expressed by:\n *\n * - an index position, if `collection` is a nested array,\n * - a property name, if `collection` is an array of objects,\n * - a function which returns a particular value from an element of a nested array or an array of objects. This function will be invoked by passing one element of `collection`.\n *\n * If `orders` is unspecified, all values are sorted in ascending order.\n * Otherwise, specify an order of `'desc'` for descending or `'asc'` for\n * ascending sort order of corresponding values. You may also specify a compare\n * function for an order, which will be invoked by two arguments:\n * `(valueA, valueB)`. It must return a number representing the sort order.\n *\n * @example\n *\n * import { orderBy } from 'natural-orderby';\n *\n * const users = [\n * {\n * username: 'Bamm-Bamm',\n * ip: '192.168.5.2',\n * datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * },\n * {\n * username: 'Wilma',\n * ip: '192.168.10.1',\n * datetime: '14 Jun 2018 00:00:00 PDT'\n * },\n * {\n * username: 'dino',\n * ip: '192.168.0.2',\n * datetime: 'June 15, 2018 14:48:00'\n * },\n * {\n * username: 'Barney',\n * ip: '192.168.1.1',\n * datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * },\n * {\n * username: 'Pebbles',\n * ip: '192.168.1.21',\n * datetime: '15 June 2018 14:48 UTC'\n * },\n * {\n * username: 'Hoppy',\n * ip: '192.168.5.10',\n * datetime: '2018-06-15T14:48:00.000Z'\n * },\n * ];\n *\n * orderBy(\n * users,\n * [v => v.datetime, v => v.ip],\n * ['desc', 'asc']\n * );\n *\n * // => [\n * // {\n * // username: 'dino',\n * // ip: '192.168.0.2',\n * // datetime: 'June 15, 2018 14:48:00',\n * // },\n * // {\n * // username: 'Pebbles',\n * // ip: '192.168.1.21',\n * // datetime: '15 June 2018 14:48 UTC',\n * // },\n * // {\n * // username: 'Bamm-Bamm',\n * // ip: '192.168.5.2',\n * // datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)',\n * // },\n * // {\n * // username: 'Hoppy',\n * // ip: '192.168.5.10',\n * // datetime: '2018-06-15T14:48:00.000Z',\n * // },\n * // {\n * // username: 'Barney',\n * // ip: '192.168.1.1',\n * // datetime: 'Thu, 14 Jun 2018 07:00:00 GMT',\n * // },\n * // {\n * // username: 'Wilma',\n * // ip: '192.168.10.1',\n * // datetime: '14 Jun 2018 00:00:00 PDT',\n * // },\n * // ]\n */\nfunction orderBy(collection, identifiers, orders) {\n if (!collection || !Array.isArray(collection)) {\n return [];\n }\n\n var validatedIdentifiers = getIdentifiers(identifiers);\n var validatedOrders = getOrders(orders);\n return baseOrderBy(collection, validatedIdentifiers, validatedOrders);\n}\n\nvar baseCompare = function baseCompare(options) {\n return function (valueA, valueB) {\n var a = getMappedValueRecord(valueA);\n var b = getMappedValueRecord(valueB);\n var result = compareValues(a, b);\n return result * (options.order === 'desc' ? -1 : 1);\n };\n};\n\nvar isValidOrder = function isValidOrder(value) {\n return typeof value === 'string' && (value === 'asc' || value === 'desc');\n};\n\nvar getOptions = function getOptions(customOptions) {\n var order = 'asc';\n\n if (typeof customOptions === 'string' && isValidOrder(customOptions)) {\n order = customOptions;\n } else if (customOptions && typeof customOptions === 'object' && customOptions.order && isValidOrder(customOptions.order)) {\n order = customOptions.order;\n }\n\n return {\n order: order\n };\n};\n\n/**\n * Creates a compare function that defines the natural sort order considering\n * the given `options` which may be passed to [`Array.prototype.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).\n *\n * If `options` or its property `order` is unspecified, values are sorted in\n * ascending sort order. Otherwise, specify an order of `'desc'` for descending\n * or `'asc'` for ascending sort order of values.\n *\n * @example\n *\n * import { compare } from 'natural-orderby';\n *\n * const users = [\n * {\n * username: 'Bamm-Bamm',\n * lastLogin: {\n * ip: '192.168.5.2',\n * datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * },\n * },\n * {\n * username: 'Wilma',\n * lastLogin: {\n * ip: '192.168.10.1',\n * datetime: '14 Jun 2018 00:00:00 PDT'\n * },\n * },\n * {\n * username: 'dino',\n * lastLogin: {\n * ip: '192.168.0.2',\n * datetime: 'June 15, 2018 14:48:00'\n * },\n * },\n * {\n * username: 'Barney',\n * lastLogin: {\n * ip: '192.168.1.1',\n * datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * },\n * },\n * {\n * username: 'Pebbles',\n * lastLogin: {\n * ip: '192.168.1.21',\n * datetime: '15 June 2018 14:48 UTC'\n * },\n * },\n * {\n * username: 'Hoppy',\n * lastLogin: {\n * ip: '192.168.5.10',\n * datetime: '2018-06-15T14:48:00.000Z'\n * },\n * },\n * ];\n *\n * users.sort((a, b) => compare()(a.ip, b.ip));\n *\n * // => [\n * // {\n * // username: 'dino',\n * // ip: '192.168.0.2',\n * // datetime: 'June 15, 2018 14:48:00'\n * // },\n * // {\n * // username: 'Barney',\n * // ip: '192.168.1.1',\n * // datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * // },\n * // {\n * // username: 'Pebbles',\n * // ip: '192.168.1.21',\n * // datetime: '15 June 2018 14:48 UTC'\n * // },\n * // {\n * // username: 'Bamm-Bamm',\n * // ip: '192.168.5.2',\n * // datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * // },\n * // {\n * // username: 'Hoppy',\n * // ip: '192.168.5.10',\n * // datetime: '2018-06-15T14:48:00.000Z'\n * // },\n * // {\n * // username: 'Wilma',\n * // ip: '192.168.10.1',\n * // datetime: '14 Jun 2018 00:00:00 PDT'\n * // }\n * // ]\n */\nfunction compare(options) {\n var validatedOptions = getOptions(options);\n return baseCompare(validatedOptions);\n}\n\n/*\n* Javascript natural sort algorithm with unicode support\n* based on chunking idea by Dave Koelle\n*\n* https://github.com/yobacca/natural-sort-order\n* released under MIT License\n*/\n\n\n\n\n//# sourceURL=webpack://freedatas2html/./node_modules/natural-orderby/esm/natural-orderby.js?"); /***/ }), /***/ "./node_modules/papaparse/papaparse.min.js": /*!*************************************************!*\ !*** ./node_modules/papaparse/papaparse.min.js ***! \*************************************************/ /***/ (function(module, exports) { eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* @license\nPapa Parse\nv5.3.1\nhttps://github.com/mholt/PapaParse\nLicense: MIT\n*/\n!function(e,t){ true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (t),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(this,function s(){\"use strict\";var f=\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==f?f:{};var n=!f.document&&!!f.postMessage,o=n&&/blob:/i.test((f.location||{}).protocol),a={},h=0,b={parse:function(e,t){var i=(t=t||{}).dynamicTyping||!1;M(i)&&(t.dynamicTypingFunction=i,i={});if(t.dynamicTyping=i,t.transform=!!M(t.transform)&&t.transform,t.worker&&b.WORKERS_SUPPORTED){var r=function(){if(!b.WORKERS_SUPPORTED)return!1;var e=(i=f.URL||f.webkitURL||null,r=s.toString(),b.BLOB_URL||(b.BLOB_URL=i.createObjectURL(new Blob([\"(\",r,\")();\"],{type:\"text/javascript\"})))),t=new f.Worker(e);var i,r;return t.onmessage=_,t.id=h++,a[t.id]=t}();return r.userStep=t.step,r.userChunk=t.chunk,r.userComplete=t.complete,r.userError=t.error,t.step=M(t.step),t.chunk=M(t.chunk),t.complete=M(t.complete),t.error=M(t.error),delete t.worker,void r.postMessage({input:e,config:t,workerId:r.id})}var n=null;b.NODE_STREAM_INPUT,\"string\"==typeof e?n=t.download?new l(t):new p(t):!0===e.readable&&M(e.read)&&M(e.on)?n=new g(t):(f.File&&e instanceof File||e instanceof Object)&&(n=new c(t));return n.stream(e)},unparse:function(e,t){var n=!1,_=!0,m=\",\",y=\"\\r\\n\",s='\"',a=s+s,i=!1,r=null,o=!1;!function(){if(\"object\"!=typeof t)return;\"string\"!=typeof t.delimiter||b.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(m=t.delimiter);(\"boolean\"==typeof t.quotes||\"function\"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes);\"boolean\"!=typeof t.skipEmptyLines&&\"string\"!=typeof t.skipEmptyLines||(i=t.skipEmptyLines);\"string\"==typeof t.newline&&(y=t.newline);\"string\"==typeof t.quoteChar&&(s=t.quoteChar);\"boolean\"==typeof t.header&&(_=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error(\"Option columns is empty\");r=t.columns}void 0!==t.escapeChar&&(a=t.escapeChar+s);\"boolean\"==typeof t.escapeFormulae&&(o=t.escapeFormulae)}();var h=new RegExp(j(s),\"g\");\"string\"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,i);if(\"object\"==typeof e[0])return u(r||Object.keys(e[0]),e,i)}else if(\"object\"==typeof e)return\"string\"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:\"object\"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||\"object\"==typeof e.data[0]||(e.data=[e.data])),u(e.fields||[],e.data||[],i);throw new Error(\"Unable to serialize unrecognized input\");function u(e,t,i){var r=\"\";\"string\"==typeof e&&(e=JSON.parse(e)),\"string\"==typeof t&&(t=JSON.parse(t));var n=Array.isArray(e)&&0=this._config.preview;if(o)f.postMessage({results:n,workerId:b.WORKER_ID,finished:a});else if(M(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!a||!M(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){M(this._config.error)?this._config.error(e):o&&this._config.error&&f.postMessage({workerId:b.WORKER_ID,error:e,finished:!1})}}function l(e){var r;(e=e||{}).chunkSize||(e.chunkSize=b.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),n||(r.onload=v(this._chunkLoaded,this),r.onerror=v(this._chunkError,this)),r.open(this._config.downloadRequestBody?\"POST\":\"GET\",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var t in e)r.setRequestHeader(t,e[t])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;r.setRequestHeader(\"Range\",\"bytes=\"+this._start+\"-\"+i)}try{r.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===r.status&&this._chunkError()}},this._chunkLoaded=function(){4===r.readyState&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:r.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader(\"Content-Range\");if(null===t)return-1;return parseInt(t.substring(t.lastIndexOf(\"/\")+1))}(r),this.parseChunk(r.responseText)))},this._chunkError=function(e){var t=r.statusText||e;this._sendError(new Error(t))}}function c(e){var r,n;(e=e||{}).chunkSize||(e.chunkSize=b.LocalChunkSize),u.call(this,e);var s=\"undefined\"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,s?((r=new FileReader).onload=v(this._chunkLoaded,this),r.onerror=v(this._chunkError,this)):r=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(r.error)}}function p(e){var i;u.call(this,e=e||{}),this.stream=function(e){return i=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,t=this._config.chunkSize;return t?(e=i.substring(0,t),i=i.substring(t)):(e=i,i=\"\"),this._finished=!i,this.parseChunk(e)}}}function g(e){u.call(this,e=e||{});var t=[],i=!0,r=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on(\"data\",this._streamData),this._input.on(\"end\",this._streamEnd),this._input.on(\"error\",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=!0},this._streamData=v(function(e){try{t.push(\"string\"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),r=!0,this._streamData(\"\")},this),this._streamCleanUp=v(function(){this._input.removeListener(\"data\",this._streamData),this._input.removeListener(\"end\",this._streamEnd),this._input.removeListener(\"error\",this._streamError)},this)}function i(m){var a,o,h,r=Math.pow(2,53),n=-r,s=/^\\s*-?(\\d+\\.?|\\.\\d+|\\d+\\.\\d+)([eE][-+]?\\d+)?\\s*$/,u=/^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))$/,t=this,i=0,f=0,d=!1,e=!1,l=[],c={data:[],errors:[],meta:{}};if(M(m.step)){var p=m.step;m.step=function(e){if(c=e,_())g();else{if(g(),0===c.data.length)return;i+=e.data.length,m.preview&&i>m.preview?o.abort():(c.data=c.data[0],p(c,t))}}}function y(e){return\"greedy\"===m.skipEmptyLines?\"\"===e.join(\"\").trim():1===e.length&&0===e[0].length}function g(){if(c&&h&&(k(\"Delimiter\",\"UndetectableDelimiter\",\"Unable to auto-detect delimiting character; defaulted to '\"+b.DefaultDelimiter+\"'\"),h=!1),m.skipEmptyLines)for(var e=0;e=l.length?\"__parsed_extra\":l[i]),m.transform&&(s=m.transform(s,n)),s=v(n,s),\"__parsed_extra\"===n?(r[n]=r[n]||[],r[n].push(s)):r[n]=s}return m.header&&(i>l.length?k(\"FieldMismatch\",\"TooManyFields\",\"Too many fields: expected \"+l.length+\" fields but parsed \"+i,f+t):i=r.length/2?\"\\r\\n\":\"\\r\"}(e,r)),h=!1,m.delimiter)M(m.delimiter)&&(m.delimiter=m.delimiter(e),c.meta.delimiter=m.delimiter);else{var n=function(e,t,i,r,n){var s,a,o,h;n=n||[\",\",\"\\t\",\"|\",\";\",b.RECORD_SEP,b.UNIT_SEP];for(var u=0;u=D)return C(!0)}else for(m=F,F++;;){if(-1===(m=r.indexOf(S,m+1)))return i||u.push({type:\"Quotes\",code:\"MissingQuotes\",message:\"Quoted field unterminated\",row:h.length,index:F}),E();if(m===n-1)return E(r.substring(F,m).replace(_,S));if(S!==L||r[m+1]!==L){if(S===L||0===m||r[m-1]!==L){-1!==p&&p=D)return C(!0);break}u.push({type:\"Quotes\",code:\"InvalidQuotes\",message:\"Trailing quote on quoted field is malformed\",row:h.length,index:F}),m++}}else m++}return E();function k(e){h.push(e),d=F}function b(e){var t=0;if(-1!==e){var i=r.substring(m+1,e);i&&\"\"===i.trim()&&(t=i.length)}return t}function E(e){return i||(void 0===e&&(e=r.substring(F)),f.push(e),F=n,k(f),o&&R()),C()}function w(e){F=e,k(f),f=[],g=r.indexOf(x,F)}function C(e){return{data:h,errors:u,meta:{delimiter:O,linebreak:x,aborted:z,truncated:!!e,cursor:d+(t||0)}}}function R(){T(C()),h=[],u=[]}},this.abort=function(){z=!0},this.getCharIndex=function(){return F}}function _(e){var t=e.data,i=a[t.workerId],r=!1;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){r=!0,m(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(M(i.userStep)){for(var s=0;s { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTML */ \"./src/freeDatas2HTML.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\nvar initialise = function () { return __awaiter(void 0, void 0, void 0, function () {\n var converter, mySort, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n converter = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.freeDatas2HTML();\n converter.datasViewElt = { id: \"datas\" };\n converter.datasSelectors = [{ datasFieldNb: 3, id: \"filtre1\" }, { datasFieldNb: 4, id: \"filtre2\" }, { datasFieldNb: 5, id: \"filtre3\", separator: \",\" }];\n mySort = function (a, b, order) {\n if (order === void 0) { order = \"asc\"; }\n var values = [\"> 100000\", \"> 1 et < 100 000\", \"≤ 1\", \"Traces\", \"Inexistant\"];\n if (order === \"desc\")\n values.reverse();\n if (values.indexOf(a) > values.indexOf(b))\n return -1;\n else if (values.indexOf(a) < values.indexOf(b))\n return 1;\n else\n return 0;\n };\n converter.datasSortingColumns = [{ datasFieldNb: 0 }, { datasFieldNb: 1 }, { datasFieldNb: 2 }, { datasFieldNb: 4 }];\n converter.datasSortingFunctions = [{ datasFieldNb: 4, sort: mySort }];\n converter.pagination =\n {\n selectedValue: 10,\n options: {\n displayElement: { id: \"paginationOptions\" },\n values: [10, 20, 50, 500],\n name: \"Choix de pagination :\"\n },\n pages: {\n displayElement: { id: \"pages\" },\n name: \"Page à afficher :\"\n }\n };\n converter.datasSourceUrl = \"http://localhost:8080/datas/elements-chimiques.csv\";\n return [4, converter.run()];\n case 1:\n _a.sent();\n return [3, 3];\n case 2:\n e_1 = _a.sent();\n console.error(e_1);\n if (document.getElementById(\"datas\") !== null)\n document.getElementById(\"datas\").innerHTML = \"Désolé, mais un problème technique empêche l'affichage des données.\";\n return [3, 3];\n case 3: return [2];\n }\n });\n}); };\ninitialise();\n\n\n//# sourceURL=webpack://freedatas2html/./src/firstExample.ts?"); /***/ }), /***/ "./src/freeDatas2HTML.ts": /*!*******************************!*\ !*** ./src/freeDatas2HTML.ts ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"freeDatas2HTML\": () => (/* binding */ freeDatas2HTML)\n/* harmony export */ });\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar Papa = __webpack_require__(/*! papaparse */ \"./node_modules/papaparse/papaparse.min.js\");\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\nvar compare = __webpack_require__(/*! natural-orderby */ \"./node_modules/natural-orderby/esm/natural-orderby.js\").compare;\nvar freeDatas2HTML = (function () {\n function freeDatas2HTML() {\n this._datasViewElt = { id: \"\", eltDOM: undefined };\n this.datasHTML = \"\";\n this._datasSelectors = [];\n this._datasSortingColumns = [];\n this._datasSortingFunctions = [];\n this._datasSourceUrl = \"\";\n this.parseMeta = undefined;\n this.parseDatas = [];\n this.parseErrors = [];\n this.stopIfParseErrors = false;\n }\n freeDatas2HTML.isPositiveInteger = function (nb) {\n return (Number.isInteger(nb) === false || nb <= 0) ? false : true;\n };\n freeDatas2HTML.isNaturalNumber = function (nb) {\n return (Number.isInteger(nb) === false || nb < 0) ? false : true;\n };\n Object.defineProperty(freeDatas2HTML.prototype, \"datasViewElt\", {\n set: function (elt) {\n var checkContainerExist = document.getElementById(elt.id);\n if (checkContainerExist === null)\n throw new Error(errors.elementNotFound + elt.id);\n else {\n this._datasViewElt.id = elt.id;\n this._datasViewElt.eltDOM = checkContainerExist;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(freeDatas2HTML.prototype, \"datasSourceUrl\", {\n set: function (url) {\n if (url.trim().length === 0)\n throw new Error(errors.needUrl);\n else\n this._datasSourceUrl = url.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(freeDatas2HTML.prototype, \"datasSelectors\", {\n get: function () {\n return this._datasSelectors;\n },\n set: function (selectionElts) {\n this._datasSelectors = [];\n var checkContainerExist;\n for (var i in selectionElts) {\n checkContainerExist = document.getElementById(selectionElts[i].id);\n if (checkContainerExist === null)\n console.error(errors.elementNotFound + selectionElts[i].id);\n else if (freeDatas2HTML.isNaturalNumber(selectionElts[i].datasFieldNb) === false)\n console.error(errors.needNaturalNumber);\n else {\n selectionElts[i].eltDOM = checkContainerExist;\n if (selectionElts[i].separator !== undefined && selectionElts[i].separator === \"\")\n selectionElts[i].separator = undefined;\n this._datasSelectors.push(selectionElts[i]);\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(freeDatas2HTML.prototype, \"datasSortingColumns\", {\n get: function () {\n return this._datasSortingColumns;\n },\n set: function (sortingColumns) {\n this._datasSortingColumns = [];\n for (var i = 0; i < sortingColumns.length; i++) {\n if (freeDatas2HTML.isNaturalNumber(sortingColumns[i].datasFieldNb) === false)\n console.error(errors.needNaturalNumber);\n else {\n sortingColumns[i].order = undefined;\n this._datasSortingColumns.push(sortingColumns[i]);\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(freeDatas2HTML.prototype, \"datasSortingFunctions\", {\n set: function (sortingFunctions) {\n this._datasSortingFunctions = [];\n for (var i = 0; i < sortingFunctions.length; i++) {\n if (freeDatas2HTML.isNaturalNumber(sortingFunctions[i].datasFieldNb) === false)\n console.error(errors.needNaturalNumber);\n else\n this._datasSortingFunctions.push(sortingFunctions[i]);\n }\n },\n enumerable: false,\n configurable: true\n });\n freeDatas2HTML.prototype.getSortingFunctionForField = function (datasFieldNb) {\n for (var i in this._datasSortingFunctions) {\n if (this._datasSortingFunctions[i].datasFieldNb === datasFieldNb)\n return this._datasSortingFunctions[i];\n }\n return undefined;\n };\n Object.defineProperty(freeDatas2HTML.prototype, \"pagination\", {\n get: function () {\n return this._pagination;\n },\n set: function (config) {\n this._pagination = {};\n if (config.selectedValue !== undefined || config.options !== undefined) {\n if (config.pages === undefined)\n throw new Error(errors.needPagesSelectorElt);\n var checkContainerExist = document.getElementById(config.pages.displayElement.id);\n if (checkContainerExist === null)\n throw new Error(errors.elementNotFound + config.pages.displayElement.id);\n else {\n this.pagination.pages =\n {\n displayElement: {\n id: config.pages.displayElement.id,\n eltDOM: checkContainerExist\n },\n name: (config.pages.name) ? config.pages.name : \"Pages :\",\n selectedValue: 1,\n };\n }\n }\n if (config.options !== undefined) {\n var checkContainerExist = document.getElementById(config.options.displayElement.id);\n if (checkContainerExist === null)\n throw new Error(errors.elementNotFound + config.options.displayElement.id);\n else {\n for (var i = 0; i < config.options.values.length; i++) {\n if (freeDatas2HTML.isPositiveInteger(config.options.values[i]) === false)\n throw new Error(errors.needPositiveInteger);\n }\n this._pagination.options =\n {\n displayElement: { id: config.options.displayElement.id, eltDOM: checkContainerExist },\n name: (config.options.name) ? config.options.name : \"Pagination :\",\n values: config.options.values\n };\n }\n }\n if (config.selectedValue !== undefined) {\n if (config.options !== undefined && (config.options.values.indexOf(config.selectedValue) === -1))\n throw new Error(errors.needPaginationByDefaultBeInOptions);\n if (freeDatas2HTML.isPositiveInteger(config.selectedValue))\n this._pagination.selectedValue = config.selectedValue;\n else\n throw new Error(errors.needPositiveInteger);\n }\n },\n enumerable: false,\n configurable: true\n });\n freeDatas2HTML.prototype.parse = function () {\n return __awaiter(this, void 0, void 0, function () {\n var converter;\n return __generator(this, function (_a) {\n converter = this;\n return [2, new Promise(function (resolve, reject) {\n if (converter._datasSourceUrl !== \"\") {\n Papa.parse(converter._datasSourceUrl, {\n quoteChar: '\"',\n header: true,\n complete: function (results) {\n converter.parseErrors = results.errors;\n converter.parseDatas = results.data;\n var realFields = [];\n for (var i in results.meta.fields) {\n if (results.meta.fields[i].trim() !== \"\")\n realFields.push(results.meta.fields[i]);\n }\n results.meta.fields = realFields;\n converter.parseMeta = results.meta;\n resolve(true);\n },\n error: function (error) {\n reject(new Error(errors.parserFail));\n },\n download: true,\n skipEmptyLines: true,\n });\n }\n else\n reject(new Error(errors.needUrl));\n })];\n });\n });\n };\n freeDatas2HTML.prototype.run = function () {\n return __awaiter(this, void 0, void 0, function () {\n var converter_1, selectorsHTML, i, values, colName, row, checkedValue, checkedValues, i_1, checkedValue, j, selectElement, values_1, selectorsHTML, j, selectElement_1, indexSelectedValue, i;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this._datasViewElt.eltDOM === undefined)\n throw new Error(errors.needDatasElt);\n if (this._datasSourceUrl === \"\")\n throw new Error(errors.needUrl);\n return [4, this.parse()];\n case 1:\n _a.sent();\n if (this.parseDatas.length === 0 || this.parseMeta.fields === undefined)\n throw new Error(errors.datasNotFound);\n else if (this.stopIfParseErrors && this.parseErrors.length !== 0)\n console.error(this.parseErrors);\n else {\n converter_1 = this;\n if (this._datasSelectors.length > 0) {\n selectorsHTML = [];\n for (i in this._datasSelectors) {\n if (this._datasSelectors[i].datasFieldNb > (this.parseMeta.fields.length - 1))\n throw new Error(errors.selectorFieldNotFound);\n else {\n values = [], colName = this.parseMeta.fields[this._datasSelectors[i].datasFieldNb];\n for (row in this.parseDatas) {\n if (this._datasSelectors[i].separator === undefined) {\n checkedValue = this.parseDatas[row][colName].trim();\n if (checkedValue !== \"\" && values.indexOf(checkedValue) === -1)\n values.push(checkedValue);\n }\n else {\n checkedValues = this.parseDatas[row][colName].split(this._datasSelectors[i].separator);\n for (i_1 in checkedValues) {\n checkedValue = checkedValues[i_1].trim();\n if (checkedValue !== \"\" && values.indexOf(checkedValue) === -1)\n values.push(checkedValue);\n }\n }\n }\n if (values.length > 0) {\n if (this.getSortingFunctionForField(this._datasSelectors[i].datasFieldNb) !== undefined)\n values.sort(this.getSortingFunctionForField(this._datasSelectors[i].datasFieldNb).sort);\n else\n values.sort(compare());\n this._datasSelectors[i].name = colName;\n this._datasSelectors[i].values = values;\n selectorsHTML[i] = \"\";\n this._datasSelectors[i].eltDOM.innerHTML = selectorsHTML[i];\n selectElement = document.getElementById(\"freeDatas2HTMLSelector\" + i);\n selectElement.addEventListener('change', function (e) {\n converter_1.datasHTML = converter_1.createDatasHTML(converter_1.parseMeta.fields, converter_1.parseDatas);\n converter_1.refreshView();\n });\n }\n }\n }\n }\n if (converter_1.pagination !== undefined && converter_1.pagination.options !== undefined && converter_1.pagination.options.values.length > 0) {\n values_1 = converter_1.pagination.options.values;\n selectorsHTML = \"\";\n converter_1.pagination.options.displayElement.eltDOM.innerHTML = selectorsHTML;\n selectElement_1 = document.getElementById(\"freeDatas2HTMLPaginationSelector\");\n if (converter_1.pagination.selectedValue !== undefined) {\n indexSelectedValue = converter_1.pagination.options.values.indexOf(converter_1.pagination.selectedValue) + 1;\n selectElement_1.value = \"\" + indexSelectedValue;\n }\n selectElement_1.addEventListener('change', function (e) {\n if (selectElement_1.value === \"0\")\n converter_1.pagination.selectedValue = undefined;\n else\n converter_1.pagination.selectedValue = values_1[Number(selectElement_1.value) - 1];\n converter_1.datasHTML = converter_1.createDatasHTML(converter_1.parseMeta.fields, converter_1.parseDatas);\n converter_1.refreshView();\n });\n }\n for (i in this._datasSortingColumns) {\n if (this._datasSortingColumns[i].datasFieldNb > (this.parseMeta.fields.length - 1))\n throw new Error(errors.sortingColumnsFieldNotFound);\n }\n this.datasHTML = this.createDatasHTML(this.parseMeta.fields, this.parseDatas);\n this.refreshView();\n return [2, true];\n }\n return [2];\n }\n });\n });\n };\n freeDatas2HTML.prototype.refreshView = function () {\n if (this._datasViewElt.eltDOM !== undefined) {\n var converter_2 = this;\n this._datasViewElt.eltDOM.innerHTML = this.datasHTML;\n if (this._datasSortingColumns.length > 0) {\n var getTableTh = document.querySelectorAll(\"table th\");\n if (getTableTh !== null) {\n var _loop_1 = function (i) {\n var datasFieldNb = this_1._datasSortingColumns[i].datasFieldNb;\n var htmlContent = getTableTh[datasFieldNb].innerHTML;\n htmlContent = \"\" + htmlContent + \"\";\n getTableTh[datasFieldNb].innerHTML = htmlContent;\n var sortingElement = document.getElementById(\"freeDatas2HTMLSorting\" + datasFieldNb);\n sortingElement.addEventListener(\"click\", function (e) {\n e.preventDefault();\n var order = converter_2.datasSortingColumns[i].order;\n if (order === undefined || order === \"desc\")\n converter_2.datasSortingColumns[i].order = \"asc\";\n else\n converter_2.datasSortingColumns[i].order = \"desc\";\n converter_2._datasSortedColumn = converter_2.datasSortingColumns[i];\n converter_2.datasHTML = converter_2.createDatasHTML(converter_2.parseMeta.fields, converter_2.parseDatas);\n converter_2.refreshView();\n });\n };\n var this_1 = this;\n for (var i in this._datasSortingColumns) {\n _loop_1(i);\n }\n }\n }\n }\n };\n freeDatas2HTML.prototype.createDatasHTML = function (fields, datas) {\n var checkSelectorExist, filters = [];\n for (var i in this._datasSelectors) {\n checkSelectorExist = document.querySelector(\"#\" + this._datasSelectors[i].id + \" select\");\n if (checkSelectorExist != null && checkSelectorExist.selectedIndex != 0)\n filters.push({ field: this._datasSelectors[i].name, value: this._datasSelectors[i].values[checkSelectorExist.selectedIndex - 1], separator: this._datasSelectors[i].separator });\n }\n if (this._datasSortedColumn !== undefined) {\n var col_1 = fields[this._datasSortedColumn.datasFieldNb];\n var colOrder_1 = this._datasSortedColumn.order;\n if (this.getSortingFunctionForField(this._datasSortedColumn.datasFieldNb) !== undefined) {\n var myFunction_1 = this.getSortingFunctionForField(this._datasSortedColumn.datasFieldNb);\n datas.sort(function (a, b) { return myFunction_1.sort(a[col_1], b[col_1], colOrder_1); });\n }\n else\n datas.sort(function (a, b) { return compare({ order: colOrder_1 })(a[col_1], b[col_1]); });\n }\n var firstData = 0;\n if (this.pagination !== undefined && this.pagination.selectedValue !== undefined && this.pagination.pages !== undefined && this.pagination.pages.selectedValue !== undefined)\n firstData = this.pagination.selectedValue * (this.pagination.pages.selectedValue - 1);\n var maxData = (this.pagination !== undefined && this.pagination.selectedValue !== undefined) ? this.pagination.selectedValue : datas.length + 1;\n var datasHTML = \"\";\n for (var i in fields)\n datasHTML += \"\";\n datasHTML += \"\";\n var nbVisible = 0, nbTotal = 0;\n for (var row in datas) {\n var visible = true;\n if (filters.length !== 0) {\n var i = 0;\n while (filters[i] !== undefined && visible === true) {\n if (filters[i].separator === undefined) {\n if (datas[row][filters[i].field].trim() !== filters[i].value)\n visible = false;\n }\n else {\n visible = false;\n var checkedValues = datas[row][filters[i].field].split(filters[i].separator);\n for (var j in checkedValues) {\n if (checkedValues[j].trim() === filters[i].value) {\n visible = true;\n break;\n }\n }\n }\n i++;\n }\n }\n if (visible && nbTotal >= firstData && nbVisible < maxData) {\n datasHTML += \"\";\n for (var field in datas[row]) {\n if (fields.indexOf(field) !== -1)\n datasHTML += \"\";\n }\n datasHTML += \"\";\n nbVisible++;\n nbTotal++;\n }\n else if (visible)\n nbTotal++;\n }\n datasHTML += \"
\" + fields[i] + \"
\" + datas[row][field] + \"
\";\n if (this.pagination !== undefined && this.pagination.selectedValue !== undefined && this.pagination.pages !== undefined && nbTotal > this.pagination.selectedValue) {\n var nbPages = Math.ceil(nbTotal / this.pagination.selectedValue);\n var selectorsHTML = \"\";\n this.pagination.pages.displayElement.eltDOM.innerHTML = selectorsHTML;\n var selectElement_2 = document.getElementById(\"freeDatas2HTMLPagesSelector\");\n if (this.pagination.pages.selectedValue !== undefined)\n selectElement_2.value = \"\" + this.pagination.pages.selectedValue;\n var converter_3 = this;\n this.pagination.pages.selectedValue = 1;\n selectElement_2.addEventListener('change', function (e) {\n converter_3.pagination.pages.selectedValue = Number(selectElement_2.value);\n converter_3.datasHTML = converter_3.createDatasHTML(converter_3.parseMeta.fields, converter_3.parseDatas);\n converter_3.refreshView();\n });\n }\n else if (this.pagination !== undefined && this.pagination.pages !== undefined)\n this.pagination.pages.displayElement.eltDOM.innerHTML = \"\";\n return datasHTML;\n };\n return freeDatas2HTML;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTML.ts?"); /***/ }), /***/ "./src/errors.js": /*!***********************!*\ !*** ./src/errors.js ***! \***********************/ /***/ ((module) => { eval("module.exports =\n{\n datasNotFound : \"Aucune donnée n'a été trouvée.\",\n elementNotFound : \"Aucun élément HTML n'a été trouvé ayant comme \\\"id\\\" : \",\n needDatasElt: \"Merci de fournir un id valide pour l'élément où afficher les données.\",\n needNaturalNumber: \"Merci de fournir un nombre entier supérieur ou égal à zéro pour désigner chaque colonne.\",\n needPagesSelectorElt: \"Merci de fournir l'id de l'élément où afficher le sélecteur de pages.\",\n needPaginationByDefaultBeInOptions: \"La valeur de pagination par défaut doit faire partie des options proposées.\",\n needPositiveInteger: \"Merci de fournir un nombre entier supérieur à zéro pour désigner chaque option de pagination.\",\n needUrl: \"Merci de fournir une url valide pour le fichier CSV à parser.\",\n parserFail: \"La lecture des données du fichier a échoué.\",\n selectorFieldNotFound: \"Au moins une des colonnes devant servir à filtrer les données n'existe pas dans le fichier.\",\n sortingColumnsFieldNotFound: \"Au moins une des colonnes devant servir à classer les données n'existe pas dans le fichier.\",\n};\n\n//# sourceURL=webpack://freedatas2html/./src/errors.js?"); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./src/firstExample.ts"); /******/ /******/ })() ;