text: /* Tabulator v4.0.4 (c) Oliver Folkerd */
  var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Clipboard=function(t){this.table=t,this.mode=!0,this.copySelector=!1,this.copySelectorParams={},this.copyFormatter=!1,this.copyFormatterParams={},this.pasteParser=function(){},this.pasteAction=function(){},this.htmlElement=!1,this.blocked=!0};Clipboard.prototype.initialize=function(){var t=this;this.mode=this.table.options.clipboard,!0!==this.mode&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(e){var o;t.blocked||(e.preventDefault(),o=t.generateContent(),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",o):e.clipboardData&&e.clipboardData.setData?(e.clipboardData.setData("text/plain",o),t.htmlElement&&e.clipboardData.setData("text/html",t.htmlElement.outerHTML)):e.originalEvent&&e.originalEvent.clipboardData.setData&&(e.originalEvent.clipboardData.setData("text/plain",o),t.htmlElement&&e.originalEvent.clipboardData.setData("text/html",t.htmlElement.outerHTML)),t.table.options.clipboardCopied.call(this.table,o),t.reset())}),!0!==this.mode&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(e){t.paste(e)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},Clipboard.prototype.reset=function(){this.blocked=!1,this.originalSelectionText=""},Clipboard.prototype.setPasteAction=function(t){switch(void 0===t?"undefined":_typeof(t)){case"string":this.pasteAction=this.pasteActions[t],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",t);break;case"function":this.pasteAction=t}},Clipboard.prototype.setPasteParser=function(t){switch(void 0===t?"undefined":_typeof(t)){case"string":this.pasteParser=this.pasteParsers[t],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",t);break;case"function":this.pasteParser=t}},Clipboard.prototype.paste=function(t){var e,o,a;this.checkPaseOrigin(t)&&(e=this.getPasteData(t),o=this.pasteParser.call(this,e),o?(t.preventDefault(),this.table.modExists("mutator")&&(o=this.mutateData(o)),a=this.pasteAction.call(this,o),this.table.options.clipboardPasted.call(this.table,e,o,a)):this.table.options.clipboardPasteError.call(this.table,e))},Clipboard.prototype.mutateData=function(t){var e=this,o=[];return Array.isArray(t)?t.forEach(function(t){o.push(e.table.modules.mutator.transformRow(t,"clipboard"))}):o=t,o},Clipboard.prototype.checkPaseOrigin=function(t){var e=!0;return("DIV"!=t.target.tagName||this.table.modules.edit.currentCell)&&(e=!1),e},Clipboard.prototype.getPasteData=function(t){var e;return window.clipboardData&&window.clipboardData.getData?e=window.clipboardData.getData("Text"):t.clipboardData&&t.clipboardData.getData?e=t.clipboardData.getData("text/plain"):t.originalEvent&&t.originalEvent.clipboardData.getData&&(e=t.originalEvent.clipboardData.getData("text/plain")),e},Clipboard.prototype.copy=function(t,e,o,a,r){var i,n;this.blocked=!1,!0!==this.mode&&"copy"!==this.mode||(void 0!==window.getSelection&&void 0!==document.createRange?(i=document.createRange(),i.selectNodeContents(this.table.element),n=window.getSelection(),n.toString()&&r&&(t="userSelection",o="raw",this.copySelectorParams=n.toString()),n.removeAllRanges(),n.addRange(i)):void 0!==document.selection&&void 0!==document.body.createTextRange&&(textRange=document.body.createTextRange(),textRange.moveToElementText(this.table.element),textRange.select()),this.setSelector(t),this.copySelectorParams=void 0!==e&&null!=e?e:this.table.options.clipboardCopyHeader,this.setFormatter(o),this.copyFormatterParams=void 0!==a&&null!=a?a:{},document.execCommand("copy"),n&&n.removeAllRanges())},Clipboard.prototype.setSelector=function(t){switch(t=t||this.table.options.clipboardCopySelector,void 0===t?"undefined":_typeof(t)){case"string":this.copySelectors[t]?this.copySelector=this.copySelectors[t]:console.warn("Clipboard Error - No such selector found:",t);break;case"function":this.copySelector=t}},Clipboard.prototype.setFormatter=function(t){switch(t=t||this.table.options.clipboardCopyFormatter,void 0===t?"undefined":_typeof(t)){case"string":this.copyFormatters[t]?this.copyFormatter=this.copyFormatters[t]:console.warn("Clipboard Error - No such formatter found:",t);break;case"function":this.copyFormatter=t}},Clipboard.prototype.generateContent=function(){var t;return this.htmlElement=!1,t=this.copySelector.call(this,this.copySelectorParams),this.copyFormatter.call(this,t,this.copyFormatterParams)},Clipboard.prototype.rowsToData=function(t,e){var o=this.table.columnManager.columnsByIndex,a=[],r=[];return this.table.options.clipboardCopyStyled&&this.generateHTML(t,e),e&&(o.forEach(function(t){a.push(t.definition.title)}),r.push(a)),t.forEach(function(t){var e=[],a=t.getData("clipboard");o.forEach(function(t){var o=t.getFieldValue(a);e.push(o)}),r.push(e)}),r},Clipboard.prototype.generateHTML=function(t,e){var o,a,r,i,n,l,s,c=this,p=this.table.columnManager.columnsByIndex;this.htmlElement=document.createElement("table"),c.mapElementStyles(this.table.element,this.htmlElement,["border-top","border-left","border-right","border-bottom"]),e&&(o=document.createElement("tr"),p.forEach(function(t){var e=document.createElement("th");e.innerHTML=t.definition.title,c.mapElementStyles(t.getElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),o.appendChild(e)}),c.mapElementStyles(this.table.columnManager.getHeadersElement(),o,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),this.htmlElement.appendChild(document.createElement("thead").appendChild(o))),a=document.createElement("tbody"),window.getComputedStyle&&(r=this.table.element.getElementsByClassName("tabulator-row-odd")[0],i=this.table.element.getElementsByClassName("tabulator-row-even")[0],(n=this.table.element.getElementsByClassName("tabulator-row")[0])&&(s=n.getElementsByClassName("tabulator-cell"),l=s[0],s[s.length-1])),t.forEach(function(t,e){var o=document.createElement("tr"),s=t.getData("clipboard"),d=n;p.forEach(function(t,e){var a=document.createElement("td");a.innerHTML=t.getFieldValue(s),t.definition.align&&(a.style.textAlign=t.definition.align),p.length,l&&c.mapElementStyles(l,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),o.appendChild(a)}),e%2||!r||(d=r),e%2&&i&&(d=i),d&&c.mapElementStyles(d,o,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),a.appendChild(o)}),this.htmlElement.appendChild(a)},Clipboard.prototype.mapElementStyles=function(t,e,o){var a={"background-color":"backgroundColor",color:"fontColor","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom"};if(window.getComputedStyle){var r=window.getComputedStyle(t);o.forEach(function(t){e.style[a[t]]=r.getPropertyValue(t)})}},Clipboard.prototype.copySelectors={userSelection:function(t){return t},selected:function(t){var e=[];return this.table.modExists("selectRow",!0)&&(e=this.table.modules.selectRow.getSelectedRows()),this.rowsToData(e,t)},table:function(t){return this.rowsToData(this.table.rowManager.getComponents(),t)},active:function(t){return this.rowsToData(this.table.rowManager.getComponents(!0),t)}},Clipboard.prototype.copyFormatters={raw:function(t,e){return t},table:function(t,e){var o=[];return t.forEach(function(t){t.forEach(function(t){void 0===t&&(t=""),t=void 0===t||null===t?"":t.toString(),t.match(/\r|\n/)&&(t=t.split('"').join('""'),t='"'+t+'"')}),o.push(t.join("\t"))}),o.join("\n")}},Clipboard.prototype.pasteParsers={table:function(t){var e=[],o=!0,a=this.table.columnManager.columns,r=[],i=[];return t=t.split("\n"),t.forEach(function(t){e.push(t.split("\t"))}),!(!e.length||1===e.length&&e[0].length<2)&&(!0,e[0].forEach(function(t){var e=a.find(function(e){return t&&e.definition.title&&t.trim()&&e.definition.title.trim()===t.trim()});e?r.push(e):o=!1}),o||(o=!0,r=[],e[0].forEach(function(t){var e=a.find(function(e){return t&&e.field&&t.trim()&&e.field.trim()===t.trim()});e?r.push(e):o=!1}),o||(r=this.table.columnManager.columnsByIndex)),o&&e.shift(),e.forEach(function(t){var e={};t.forEach(function(t,o){r[o]&&(e[r[o].field]=t)}),i.push(e)}),i)}},Clipboard.prototype.pasteActions={replace:function(t){return this.table.setData(t)},update:function(t){return this.table.updateOrAddData(t)},insert:function(t){return this.table.addData(t)}},Tabulator.prototype.registerModule("clipboard",Clipboard);