-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patha-table.min.js
110 lines (110 loc) · 79.8 KB
/
a-table.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
* Modules in this bundle
* @license
*
* a-table:
* license: MIT (http://opensource.org/licenses/MIT)
* author: appleple
* version: 1.5.10
*
* a-template:
* license: MIT (http://opensource.org/licenses/MIT)
* author: steelydylan
* version: 0.5.5
*
* base64-js:
* license: MIT (http://opensource.org/licenses/MIT)
* author: T. Jameson Little <[email protected]>
* homepage: https://github.com/beatgammit/base64-js
* version: 1.5.1
*
* buffer:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Feross Aboukhadijeh <[email protected]>
* contributors: Romain Beauxis <[email protected]>, James Halliday <[email protected]>
* homepage: https://github.com/feross/buffer
* version: 4.9.2
*
* clone:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Paul Vorbach <[email protected]>
* contributors: Blake Miner <[email protected]>, Tian You <[email protected]>, George Stagas <[email protected]>, Tobiasz Cudnik <[email protected]>, Pavel Lang <[email protected]>, Dan MacTough, w1nk, Hugh Kennedy, Dustin Diaz, Ilya Shaisultanov, Nathan MacInnes <[email protected]>, Benjamin E. Coe <[email protected]>, Nathan Zadoks, Róbert Oroszi <[email protected]>, Aurélio A. Heckert, Guy Ellis, fscherwi, rictic, Martin Jurča, Misery Lee <[email protected]>, Clemens Wolff
* homepage: https://github.com/pvorb/node-clone#readme
* version: 2.1.2
*
* custom-event-polyfill:
* license: MIT (http://opensource.org/licenses/MIT)
* contributors: Frank Panetta, Mikhail Reenko <[email protected]>, Joscha Feth <[email protected]>
* homepage: https://github.com/krambuhl/custom-event-polyfill#readme
* version: 0.3.0
*
* deep-extend:
* license: MIT (http://opensource.org/licenses/MIT)
* licenses: MIT (http://opensource.org/licenses/MIT)
* author: Viacheslav Lotsmanov <[email protected]>
* contributors: Romain Prieto, Max Maximov, Marshall Bowers, Misha Wakerman
* homepage: https://github.com/unclechu/node-deep-extend
* version: 0.5.1
*
* ie-array-find-polyfill:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Carlos Abdalla
* homepage: https://github.com/abdalla/ie-array-find-polyfill#readme
* version: 1.1.0
*
* ieee754:
* license: BSD-3-Clause (http://opensource.org/licenses/BSD-3-Clause)
* author: Feross Aboukhadijeh <[email protected]>
* contributors: Romain Beauxis <[email protected]>
* homepage: https://github.com/feross/ieee754#readme
* version: 1.2.1
*
* isarray:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Julian Gruber <[email protected]>
* homepage: https://github.com/juliangruber/isarray
* version: 1.0.0
*
* morphdom:
* license: MIT (http://opensource.org/licenses/MIT)
* author: Patrick Steele-Idem <[email protected]>
* homepage: https://github.com/patrick-steele-idem/morphdom#readme
* version: 2.7.0
*
* This header is generated by licensify (https://github.com/twada/licensify)
*/
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).aTable=t()}(function(){return function r(o,a,i){function l(e,t){if(!a[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(s)return s(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=a[e]={exports:{}},o[e][0].call(n.exports,function(t){return l(o[e][1][t]||t)},n,n.exports,r,o,a,i)}return a[e].exports}for(var s="function"==typeof require&&require,t=0;t<i.length;t++)l(i[t]);return l}({1:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t};function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t("ie-array-find-polyfill");var a=t("morphdom"),u=(a=a)&&a.__esModule?a:{default:a},c=t("./util");function l(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var s="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",h=s.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",a=(r(i,[{key:"addDataBind",value:function(t){var a=this;(0,c.on)(t,"[data-bind]","input change click",function(t){var e,t=t.delegateTarget,n=t.getAttribute("data-bind"),r=t.getAttribute("href"),o=t.value;r&&(o=o.replace("#","")),"checkbox"===t.getAttribute("type")?(e=[],r=document.querySelectorAll('[data-bind="'+n+'"]'),[].forEach.call(r,function(t){t.checked&&e.push(t.value)})):"radio"!==t.getAttribute("type")&&a.updateDataByString(n,o)})}},{key:"addActionBind",value:function(t){var i=this;(0,c.on)(t,h,s,function(e){var t,n,r=e.delegateTarget,o=s.split(" "),a="action",o=(o.forEach(function(t){r.getAttribute("data-action-"+t)&&e.type===t&&(a+="-"+t)}),r.getAttribute("data-"+a));o&&(t=o.replace(/\(.*?\);?/,""),o=o.replace(/(.*?)\((.*?)\);?/,"$2").split(","),i.e=e,i.method&&i.method[t]?(n=i.method)[t].apply(n,l(o)):i[t]&&i[t].apply(i,l(o)))})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(e){var n=this;Object.keys(e).forEach(function(t){"function"!=typeof e[t]&&(n.data[t]=e[t])})}},{key:"loadData",value:function(t){t=JSON.parse(localStorage.getItem(t));t&&this.setData(t)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length,o=0;o<t;o+=1)e+=n.charAt(Math.floor(this.getRand(0,r)));return e}},{key:"getDataFromObj",value:function(t,e){for(var n=(t=(t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1")).replace(/^\./,"")).split(".");n.length;){var r=n.shift();if(!(r in e))return null;e=e[r]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var n=this.data,r=t.split(".");1<r.length;)n=n[r.shift()];n[r.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,n=t.split(".");1<n.length;)e=e[n.shift()];t=n.shift();t.match(/^\d+$/)?e.splice(Number(t),1):delete e[t]}},{key:"resolveBlock",value:function(t,a,i){var l=this,e=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),n=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),r=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),o=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(e)for(var s=0,u=e.length;s<u;s+=1){var c=e[s],h=(c=c.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)")).replace(/BEGIN/,"END"),c=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+h,"g");t=t.replace(c,function(t,e,n,r){return""+("function"==typeof a[e]?a[e].apply(l):l.getDataFromObj(e,a))===n?r:""})}if(n)for(var f=0,d=n.length;f<d;f+=1){var p=n[f],g=(p=p.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)")).replace(/BEGIN/,"END"),p=new RegExp(p+"(([\\n\\r\\t]|.)*?)"+g,"g");t=t.replace(p,function(t,e,n,r){return""+("function"==typeof a[e]?a[e].apply(l):l.getDataFromObj(e,a))!==n?r:""})}if(r)for(var y=0,v=r.length;y<v;y+=1){var w=r[y],b=(w=w.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist")).replace(/BEGIN/,"END"),w=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+b,"g");t=t.replace(w,function(t,e,n){e="function"==typeof a[e]?a[e].apply(l):l.getDataFromObj(e,a);return e||0===e?n:""})}if(o)for(var m=0,E=o.length;m<E;m+=1){var x=o[m],C=(x=x.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty")).replace(/BEGIN/,"END"),x=new RegExp(x+"(([\\n\\r\\t]|.)*?)"+C,"g");t=t.replace(x,function(t,e,n){e="function"==typeof a[e]?a[e].apply(l):l.getDataFromObj(e,a);return e||0===e?"":n})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,e,n,r){var o=void 0;if(""+e=="i")o=i;else{if(!a[e]&&0!==a[e])return r&&l.convert&&l.convert[r]?l.convert[r].call(l,""):"";o="function"==typeof a[e]?a[e].apply(l):a[e]}return r&&l.convert&&l.convert[r]?l.convert[r].call(l,o):o})}},{key:"resolveAbsBlock",value:function(t){var n=this;return t=t.replace(/{(.*?)}/g,function(t,e){e=n.getDataByString(e);return void 0!==e?"function"==typeof e?e.apply(n):e:t})}},{key:"resolveInclude",value:function(t){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return(0,c.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var l=this;return t=t.replace(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,function(t,e,n){var e=l.getDataByString(e),r=[],o="";if((r="function"==typeof e?e.apply(l):e)instanceof Array)for(var a=0,i=r.length;a<i;a+=1)o+=l.resolveBlock(n,r[a],a);return o=o.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(r){var o=this.data;return Object.keys(o).forEach(function(t){for(var e=0,n=r.length;e<n;e+=1)t===r[e]&&delete o[t]}),this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g)}},{key:"getHtml",value:function(e,t){var n=this.atemplate.find(function(t){return t.id===e}),r="";if(n&&n.html&&(r=n.html),!(r=t?e:r))return"";n=this.data,r=this.resolveInclude(r);for(r=this.resolveWith(r);this.hasLoop(r);)r=this.resolveLoop(r);return r=(r=this.resolveBlock(r,n)).replace(/\\([^\\])/g,"$1"),(r=this.resolveAbsBlock(r)).replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){for(var a=this,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"html",l=arguments[1],s=this.templates,t=(this.beforeUpdated&&this.beforeUpdated(),0),e=s.length;t<e;t+=1)!function(t){var e=s[t],t="#"+e,n=a.getHtml(e),r=(0,c.selector)("[data-id='"+e+"']"),o=(r?"text"===i?r.innerText=n:l?((o=document.createElement("div")).innerHTML=n,o=o.querySelector(l).outerHTML,(0,u.default)(r.querySelector(l),o)):(0,u.default)(r,"<div data-id='"+e+"'>"+n+"</div>"):((0,c.selector)(t).insertAdjacentHTML("afterend",'<div data-id="'+e+'"></div>'),"text"===i?(0,c.selector)("[data-id='"+e+"']").innerText=n:(0,c.selector)("[data-id='"+e+"']").innerHTML=n),a.atemplate.find(function(t){return t.id===e}));o.binded||(o.binded=!0,a.addDataBind((0,c.selector)("[data-id='"+e+"']")),a.addActionBind((0,c.selector)("[data-id='"+e+"']")))}(t);return this.updateBindingData(l),this.onUpdated&&this.onUpdated(l),this}},{key:"updateBindingData",value:function(t){for(var n=this,e=this.templates,r=0,o=e.length;r<o;r+=1){var a=e[r],a=(0,c.selector)("[data-id='"+a+"']"),i=(a=t?a.querySelector(t):a).querySelectorAll("[data-bind]"),i=([].forEach.call(i,function(t){var e=n.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?e===t.value&&(t.checked=!0):t.value=e}),a.querySelectorAll("[data-bind-oneway]"));[].forEach.call(i,function(t){var e=n.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?e===t.value&&(t.checked=!0):t.value=e})}return this}},{key:"applyMethod",value:function(t){for(var e,n=arguments.length,r=Array(1<n?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return(e=this.method)[t].apply(e,r)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,n=t.split(".");1<n.length;)e=e[n.shift()];t=n.shift();return t.match(/^\d+$/)?e.splice(Number(t),1):delete e[t],this}}]),i);function i(e){var n=this;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.atemplate=[],e&&Object.keys(e).forEach(function(t){n[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var t=0,r=this.templates.length;t<r;t+=1){var o=this.templates[t],a=(0,c.selector)("#"+o).innerHTML;this.atemplate.push({id:o,html:a,binded:!1})}}n.default=a,e.exports=n.default},{"./util":2,"ie-array-find-polyfill":8,morphdom:11}],2:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.matches=function(t,e){for(var n,r=(n=(t.document||t.ownerDocument).querySelectorAll(e)).length;0<=--r&&n.item(r)!==t;);return-1<r},o=(n.selector=function(t){return document.querySelector(t)},n.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(r(t,e))return t;t=t.parentElement}return null});n.on=function(e,n,t,r){t.split(" ").forEach(function(t){e.addEventListener(t,function(t){t.target;var e=o(t.target,n);e&&(t.delegateTarget=e,r(t))})})}},{}],3:[function(t,e,n){"use strict";n.byteLength=function(t){var t=c(t),e=t[0],t=t[1];return 3*(e+t)/4-t},n.toByteArray=function(t){var e,n,r=c(t),o=r[0],r=r[1],a=new u(function(t,e){return 3*(t+e)/4-e}(o,r)),i=0,l=0<r?o-4:o;for(n=0;n<l;n+=4)e=s[t.charCodeAt(n)]<<18|s[t.charCodeAt(n+1)]<<12|s[t.charCodeAt(n+2)]<<6|s[t.charCodeAt(n+3)],a[i++]=e>>16&255,a[i++]=e>>8&255,a[i++]=255&e;2===r&&(e=s[t.charCodeAt(n)]<<2|s[t.charCodeAt(n+1)]>>4,a[i++]=255&e);1===r&&(e=s[t.charCodeAt(n)]<<10|s[t.charCodeAt(n+1)]<<4|s[t.charCodeAt(n+2)]>>2,a[i++]=e>>8&255,a[i++]=255&e);return a},n.fromByteArray=function(t){for(var e,n=t.length,r=n%3,o=[],a=0,i=n-r;a<i;a+=16383)o.push(function(t,e,n){for(var r,o=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(function(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}(r));return o.join("")}(t,a,i<a+16383?i:a+16383));1==r?(e=t[n-1],o.push(l[e>>2]+l[e<<4&63]+"==")):2==r&&(e=(t[n-2]<<8)+t[n-1],o.push(l[e>>10]+l[e>>4&63]+l[e<<2&63]+"="));return o.join("")};for(var l=[],s=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=r.length;o<a;++o)l[o]=r[o],s[r.charCodeAt(o)]=o;function c(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");t=t.indexOf("="),e=(t=-1===t?e:t)===e?0:4-t%4;return[t,e]}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],4:[function(S,t,D){!function(t,e){!function(){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
"use strict";var A=S("base64-js"),a=S("ieee754"),l=S("isarray");function n(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=h.prototype:(t=null===t?new h(e):t).length=e,t}function h(t,e,n){if(!(h.TYPED_ARRAY_SUPPORT||this instanceof h))return new h(t,e,n);if("number"!=typeof t)return r(this,t,e,n);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return i(this,t)}function r(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=t,a=e,i=n;if(a.byteLength,i<0||a.byteLength<i)throw new RangeError("'offset' is out of bounds");if(a.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");return a=void 0===i&&void 0===r?new Uint8Array(a):void 0===r?new Uint8Array(a,i):new Uint8Array(a,i,r),h.TYPED_ARRAY_SUPPORT?(o=a).__proto__=h.prototype:o=u(o,a),o}if("string"!=typeof e){i=t,r=e;if(h.isBuffer(r))return a=0|c(r.length),0!==(i=s(i,a)).length&&r.copy(i,0,0,a),i;if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function(t){return t!=t}(r.length)?s(i,0):u(i,r);if("Buffer"===r.type&&l(r.data))return u(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}o=t,r=e,t=n;if(h.isEncoding(t="string"==typeof t&&""!==t?t:"utf8"))return e=0|f(r,t),o=(r=(o=s(o,e)).write(r,t))!==e?o.slice(0,r):o;throw new TypeError('"encoding" must be a valid string encoding')}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function i(t,e){if(o(e),t=s(t,e<0?0:0|c(e)),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function u(t,e){var n=e.length<0?0:0|c(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function c(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function f(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;var n=(t="string"!=typeof t?""+t:t).length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return R(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return P(t).length;default:if(r)return R(t).length;e=(""+e).toLowerCase(),r=!0}}function e(t,e,n){var r,o=!1;if((e=void 0===e||e<0?0:e)>this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":var a=this,i=e,l=n,s=a.length;(!l||l<0||s<l)&&(l=s);for(var u="",c=i=!i||i<0?0:i;c<l;++c)u+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(a[c]);return u;case"utf8":case"utf-8":return k(this,e,n);case"ascii":var h=this,s=e,f=n,d="";f=Math.min(h.length,f);for(var p=s;p<f;++p)d+=String.fromCharCode(127&h[p]);return d;case"latin1":case"binary":var g=this,i=e,y=n,v="";y=Math.min(g.length,y);for(var w=i;w<y;++w)v+=String.fromCharCode(g[w]);return v;case"base64":return b=this,r=n,0===(m=e)&&r===b.length?A.fromByteArray(b):A.fromByteArray(b.slice(m,r));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var b=e,m=n,E=this.slice(b,m),x="",C=0;C<E.length;C+=2)x+=String.fromCharCode(E[C]+256*E[C+1]);return x;default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function p(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,(n=(n=isNaN(n)?o?0:t.length-1:n)<0?t.length+n:n)>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=h.from(e,r)),h.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,o);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(t,e,n):g(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,o){var a=1,i=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;i/=a=2,l/=2,n/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o)for(var u=-1,c=n;c<i;c++)if(s(t,c)===s(e,-1===u?0:c-u)){if(c-(u=-1===u?c:u)+1===l)return u*a}else-1!==u&&(c-=c-u),u=-1;else for(c=n=i<n+l?i-l:n;0<=c;c--){for(var h=!0,f=0;f<l;f++)if(s(t,c+f)!==s(e,f)){h=!1;break}if(h)return c}return-1}function y(t,e,n,r){return I(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function v(t,e,n,r){return I(function(t,e){for(var n,r,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,o.push(n%256),o.push(r);return o}(e,t.length-n),t,n,r)}function k(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var a,i,l,s,u=t[o],c=null,h=239<u?4:223<u?3:191<u?2:1;if(o+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(a=t[o+1]))&&127<(s=(31&u)<<6|63&a)&&(c=s);break;case 3:a=t[o+1],i=t[o+2],128==(192&a)&&128==(192&i)&&2047<(s=(15&u)<<12|(63&a)<<6|63&i)&&(s<55296||57343<s)&&(c=s);break;case 4:a=t[o+1],i=t[o+2],l=t[o+3],128==(192&a)&&128==(192&i)&&128==(192&l)&&65535<(s=(15&u)<<18|(63&a)<<12|(63&i)<<6|63&l)&&s<1114112&&(c=s)}null===c?(c=65533,h=1):65535<c&&(r.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=h}var f=r,d=f.length;if(d<=w)return String.fromCharCode.apply(String,f);for(var p="",g=0;g<d;)p+=String.fromCharCode.apply(String,f.slice(g,g+=w));return p}D.Buffer=h,D.SlowBuffer=function(t){+t!=t&&(t=0);return h.alloc(+t)},D.INSPECT_MAX_BYTES=50,h.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),D.kMaxLength=n(),h.poolSize=8192,h._augment=function(t){return t.__proto__=h.prototype,t},h.from=function(t,e,n){return r(null,t,e,n)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,"undefined"!=typeof Symbol)&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0}),h.alloc=function(t,e,n){return r=null,e=e,n=n,o(t=t),!(t<=0)&&void 0!==e?"string"==typeof n?s(r,t).fill(e,n):s(r,t).fill(e):s(r,t);var r},h.allocUnsafe=function(t){return i(null,t)},h.allocUnsafeSlow=function(t){return i(null,t)},h.isBuffer=function(t){return!(null==t||!t._isBuffer)},h.compare=function(t,e){if(!h.isBuffer(t)||!h.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,a=Math.min(n,r);o<a;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},h.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(t,e){if(!l(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return h.alloc(0);if(void 0===e)for(o=e=0;o<t.length;++o)e+=t[o].length;for(var n=h.allocUnsafe(e),r=0,o=0;o<t.length;++o){var a=t[o];if(!h.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,r),r+=a.length}return n},h.byteLength=f,h.prototype._isBuffer=!0,h.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},h.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},h.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},h.prototype.toString=function(){var t=0|this.length;return 0==t?"":0===arguments.length?k(this,0,t):e.apply(this,arguments)},h.prototype.equals=function(t){if(h.isBuffer(t))return this===t||0===h.compare(this,t);throw new TypeError("Argument must be a Buffer")},h.prototype.inspect=function(){var t="",e=D.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e)&&(t+=" ... "),"<Buffer "+t+">"},h.prototype.compare=function(t,e,n,r,o){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),(e=void 0===e?0:e)<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(o<=r&&n<=e)return 0;if(o<=r)return-1;if(n<=e)return 1;if(this===t)return 0;for(var a=(o>>>=0)-(r>>>=0),i=(n>>>=0)-(e>>>=0),l=Math.min(a,i),s=this.slice(r,o),u=t.slice(e,n),c=0;c<l;++c)if(s[c]!==u[c]){a=s[c],i=u[c];break}return a<i?-1:i<a?1:0},h.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},h.prototype.indexOf=function(t,e,n){return p(this,t,e,n,!0)},h.prototype.lastIndexOf=function(t,e,n){return p(this,t,e,n,!1)},h.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||o<n)&&(n=o),0<t.length&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r=r||"utf8";for(var a,i,l,s=!1;;)switch(r){case"hex":var u=this,c=t,h=e,f=n,d=(h=Number(h)||0,u.length-h);if((!f||d<(f=Number(f)))&&(f=d),(d=c.length)%2!=0)throw new TypeError("Invalid hex string");d/2<f&&(f=d/2);for(var p=0;p<f;++p){var g=parseInt(c.substr(2*p,2),16);if(isNaN(g))return p;u[h+p]=g}return p;case"utf8":case"utf-8":return d=e,l=n,I(R(t,(i=this).length-d),i,d,l);case"ascii":return y(this,t,e,n);case"latin1":case"binary":return y(this,t,e,n);case"base64":return i=this,l=e,a=n,I(P(t),i,l,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function b(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(n<t+e)throw new RangeError("Trying to access beyond buffer length")}function m(t,e,n,r,o,a){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<e||e<a)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function E(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,a=Math.min(t.length-n,2);o<a;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function x(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,a=Math.min(t.length-n,4);o<a;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function C(t,e,n,r){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,n,r,o){return o||C(t,0,n,4),a.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,o){return o||C(t,0,n,8),a.write(t,e,n,r,52,8),n+8}h.prototype.slice=function(t,e){var n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),e<t&&(e=t),h.TYPED_ARRAY_SUPPORT)(o=this.subarray(t,e)).__proto__=h.prototype;else for(var r=e-t,o=new h(r,void 0),a=0;a<r;++a)o[a]=this[a+t];return o},h.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||b(t,e,this.length);for(var r=this[t],o=1,a=0;++a<e&&(o*=256);)r+=this[t+a]*o;return r},h.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||b(t,e,this.length);for(var r=this[t+--e],o=1;0<e&&(o*=256);)r+=this[t+--e]*o;return r},h.prototype.readUInt8=function(t,e){return e||b(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||b(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||b(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||b(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||b(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||b(t,e,this.length);for(var r=this[t],o=1,a=0;++a<e&&(o*=256);)r+=this[t+a]*o;return(o*=128)<=r&&(r-=Math.pow(2,8*e)),r},h.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||b(t,e,this.length);for(var r=e,o=1,a=this[t+--r];0<r&&(o*=256);)a+=this[t+--r]*o;return(o*=128)<=a&&(a-=Math.pow(2,8*e)),a},h.prototype.readInt8=function(t,e){return e||b(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||b(t,2,this.length);e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},h.prototype.readInt16BE=function(t,e){e||b(t,2,this.length);e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},h.prototype.readInt32LE=function(t,e){return e||b(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||b(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||b(t,4,this.length),a.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||b(t,4,this.length),a.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||b(t,8,this.length),a.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||b(t,8,this.length),a.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||m(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,a=0;for(this[e]=255&t;++a<n&&(o*=256);)this[e+a]=t/o&255;return e+n},h.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||m(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,a=1;for(this[e+o]=255&t;0<=--o&&(a*=256);)this[e+o]=t/a&255;return e+n},h.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):E(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,n,r){t=+t,e|=0,r||m(this,t,e,n,(r=Math.pow(2,8*n-1))-1,-r);var o=0,a=1,i=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===i&&0!==this[e+o-1]&&(i=1),this[e+o]=(t/a>>0)-i&255;return e+n},h.prototype.writeIntBE=function(t,e,n,r){t=+t,e|=0,r||m(this,t,e,n,(r=Math.pow(2,8*n-1))-1,-r);var o=n-1,a=1,i=0;for(this[e+o]=255&t;0<=--o&&(a*=256);)t<0&&0===i&&0!==this[e+o+1]&&(i=1),this[e+o]=(t/a>>0)-i&255;return e+n},h.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&(t=t<0?255+t+1:t),e+1},h.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):E(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||m(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},h.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},h.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},h.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},h.prototype.copy=function(t,e,n,r){if(n=n||0,r||0===r||(r=this.length),e>=t.length&&(e=t.length),(r=0<r&&r<n?n:r)===n)return 0;if(0===t.length||0===this.length)return 0;if((e=e||0)<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length);var o,a=(r=t.length-e<r-n?t.length-e+n:r)-n;if(this===t&&n<e&&e<r)for(o=a-1;0<=o;--o)t[o+e]=this[o+n];else if(a<1e3||!h.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},h.prototype.fill=function(t,e,n,r){if("string"==typeof t){var o;if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length&&(o=t.charCodeAt(0))<256&&(t=o),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!h.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(!(n<=e))if(e>>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(t=t||0))for(l=e;l<n;++l)this[l]=t;else for(var a=h.isBuffer(t)?t:R(new h(t,r).toString()),i=a.length,l=0;l<n-e;++l)this[l+e]=a[l%i];return this};var T=/[^+\/0-9A-Za-z-_]/g;function R(t,e){e=e||1/0;for(var n,r=t.length,o=null,a=[],i=0;i<r;++i){if(55295<(n=t.charCodeAt(i))&&n<57344){if(!o){if(56319<n){-1<(e-=3)&&a.push(239,191,189);continue}if(i+1===r){-1<(e-=3)&&a.push(239,191,189);continue}o=n;continue}if(n<56320){-1<(e-=3)&&a.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&-1<(e-=3)&&a.push(239,191,189);if(o=null,n<128){if(--e<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function P(t){return A.toByteArray(function(t){var e;if((t=((e=t).trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function I(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},S("buffer").Buffer)},{"base64-js":3,buffer:4,ieee754:9,isarray:10}],5:[function(t,e,n){!function(k){!function(){var t=function(){"use strict";function b(t,e){return null!=e&&t instanceof e}var m,E,x;try{m=Map}catch(t){m=function(){}}try{E=Set}catch(t){E=function(){}}try{x=Promise}catch(t){x=function(){}}function C(t,d,e,p,g){"object"==typeof d&&(e=d.depth,p=d.prototype,g=d.includeNonEnumerable,d=d.circular);var y=[],v=[],w=void 0!==k;return void 0===d&&(d=!0),function r(t,o){if(null===t)return null;if(0===o)return t;var n,e,a;if("object"!=typeof t)return t;if(b(t,m))n=new m;else if(b(t,E))n=new E;else if(b(t,x))n=new x(function(e,n){t.then(function(t){e(r(t,o-1))},function(t){n(r(t,o-1))})});else if(C.__isArray(t))n=[];else if(C.__isRegExp(t))n=new RegExp(t.source,A(t)),t.lastIndex&&(n.lastIndex=t.lastIndex);else if(C.__isDate(t))n=new Date(t.getTime());else{if(w&&k.isBuffer(t))return n=k.allocUnsafe?k.allocUnsafe(t.length):new k(t.length),t.copy(n),n;b(t,Error)?n=Object.create(t):void 0===p?(e=Object.getPrototypeOf(t),n=Object.create(e)):(n=Object.create(p),e=p)}if(d){var i=y.indexOf(t);if(-1!=i)return v[i];y.push(t),v.push(n)}for(s in b(t,m)&&t.forEach(function(t,e){e=r(e,o-1),t=r(t,o-1),n.set(e,t)}),b(t,E)&&t.forEach(function(t){t=r(t,o-1),n.add(t)}),t)(a=e?Object.getOwnPropertyDescriptor(e,s):a)&&null==a.set||(n[s]=r(t[s],o-1));if(Object.getOwnPropertySymbols)for(var l=Object.getOwnPropertySymbols(t),s=0;s<l.length;s++){var u=l[s];(h=Object.getOwnPropertyDescriptor(t,u))&&!h.enumerable&&!g||(n[u]=r(t[u],o-1),h.enumerable)||Object.defineProperty(n,u,{enumerable:!1})}if(g)for(var c=Object.getOwnPropertyNames(t),s=0;s<c.length;s++){var h,f=c[s];(h=Object.getOwnPropertyDescriptor(t,f))&&h.enumerable||(n[f]=r(t[f],o-1),Object.defineProperty(n,f,{enumerable:!1}))}return n}(t,e=void 0===e?1/0:e)}function e(t){return Object.prototype.toString.call(t)}function A(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return C.clonePrototype=function(t){var e;return null===t?null:((e=function(){}).prototype=t,new e)},C.__objToStr=e,C.__isDate=function(t){return"object"==typeof t&&"[object Date]"===e(t)},C.__isArray=function(t){return"object"==typeof t&&"[object Array]"===e(t)},C.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===e(t)},C.__getRegExpFlags=A,C}();"object"==typeof e&&e.exports&&(e.exports=t)}.call(this)}.call(this,t("buffer").Buffer)},{buffer:4}],6:[function(t,e,n){try{var r=new window.CustomEvent("test");if(r.preventDefault(),!0!==r.defaultPrevented)throw new Error("Could not prevent default")}catch(t){function o(t,e){var n,r;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(t,e.bubbles,e.cancelable,e.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},n}o.prototype=window.Event.prototype,window.CustomEvent=o}},{}],7:[function(t,e,n){!function(n){!function(){
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <[email protected]>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";function a(t){return t instanceof n||t instanceof Date||t instanceof RegExp}function i(t){var e;if(t instanceof n)return e=n.alloc?n.alloc(t.length):new n(t.length),t.copy(e),e;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}function l(t,e){return"__proto__"===e?void 0:t[e]}var s=e.exports=function(){var n,r,o;return!(arguments.length<1||"object"!=typeof arguments[0])&&(arguments.length<2?arguments[0]:(n=arguments[0],Array.prototype.slice.call(arguments,1).forEach(function(e){"object"!=typeof e||null===e||Array.isArray(e)||Object.keys(e).forEach(function(t){o=l(n,t),(r=l(e,t))!==n&&("object"!=typeof r||null===r?n[t]=r:Array.isArray(r)?n[t]=function n(t){var r=[];return t.forEach(function(t,e){"object"==typeof t&&null!==t?Array.isArray(t)?r[e]=n(t):a(t)?r[e]=i(t):r[e]=s({},t):r[e]=t}),r}(r):a(r)?n[t]=i(r):"object"!=typeof o||null===o||Array.isArray(o)?n[t]=s({},r):n[t]=s(o,r))})}),n))}}.call(this)}.call(this,t("buffer").Buffer)},{buffer:4}],8:[function(t,e,n){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o<n;){var a=e[o];if(t.call(r,a,o,e))return a;o++}}})},{}],9:[function(t,e,n){n.read=function(t,e,n,r,o){var a,i,l=8*o-r-1,s=(1<<l)-1,u=s>>1,c=-7,h=n?o-1:0,f=n?-1:1,o=t[e+h];for(h+=f,a=o&(1<<-c)-1,o>>=-c,c+=l;0<c;a=256*a+t[e+h],h+=f,c-=8);for(i=a&(1<<-c)-1,a>>=-c,c+=r;0<c;i=256*i+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===s)return i?NaN:1/0*(o?-1:1);i+=Math.pow(2,r),a-=u}return(o?-1:1)*i*Math.pow(2,a-r)},n.write=function(t,e,n,r,o,a){var i,l,s=8*a-o-1,u=(1<<s)-1,c=u>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:a-1,d=r?1:-1,a=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,i=u):(i=Math.floor(Math.log(e)/Math.LN2),e*(r=Math.pow(2,-i))<1&&(i--,r*=2),2<=(e+=1<=i+c?h/r:h*Math.pow(2,1-c))*r&&(i++,r/=2),u<=i+c?(l=0,i=u):1<=i+c?(l=(e*r-1)*Math.pow(2,o),i+=c):(l=e*Math.pow(2,c-1)*Math.pow(2,o),i=0));8<=o;t[n+f]=255&l,f+=d,l/=256,o-=8);for(i=i<<o|l,s+=o;0<s;t[n+f]=255&i,f+=d,i/=256,s-=8);t[n+f-d]|=128*a}},{}],10:[function(t,e,n){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],11:[function(t,e,n){"use strict";var r;var p="http://www.w3.org/1999/xhtml",S="undefined"==typeof document?void 0:document,o=!!S&&"content"in S.createElement("template"),a=!!S&&S.createRange&&"createContextualFragment"in S.createRange();function g(t){var e,n;return t=t.trim(),(o?(e=t,(n=S.createElement("template")).innerHTML=e,n.content):a?(e=t,r||(r=S.createRange()).selectNode(S.body),r.createContextualFragment(e)):(n=t,(t=S.createElement("body")).innerHTML=n,t)).childNodes[0]}function D(t,e){var n,r,t=t.nodeName,e=e.nodeName;return t===e||(n=t.charCodeAt(0),r=e.charCodeAt(0),n<=90&&97<=r?t===e.toUpperCase():r<=90&&97<=n&&e===t.toUpperCase())}function i(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var _={OPTION:function(t,e){var n,r=t.parentNode;r&&"SELECT"===(n="OPTGROUP"===(n=r.nodeName.toUpperCase())?(r=r.parentNode)&&r.nodeName.toUpperCase():n)&&!r.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),r.selectedIndex=-1),i(t,e,"selected")},INPUT:function(t,e){i(t,e,"checked"),i(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n,e=e.value,r=(t.value!==e&&(t.value=e),t.firstChild);r&&(n=r.nodeValue)!=e&&(e||n!=t.placeholder)&&(r.nodeValue=e)},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n,r,o=-1,a=0,i=t.firstChild;i;)if("OPTGROUP"===(r=i.nodeName&&i.nodeName.toUpperCase()))i=(n=i).firstChild;else{if("OPTION"===r){if(i.hasAttribute("selected")){o=a;break}a++}!(i=i.nextSibling)&&n&&(i=n.nextSibling,n=null)}t.selectedIndex=o}}};function y(){}function v(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function l(t,e,n){n=n||{},"string"==typeof e?"#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName?(o=e,(e=S.createElement("html")).innerHTML=o):e=g(e):11===e.nodeType&&(e=e.firstElementChild);var m=n.getNodeKey||v,E=n.onBeforeNodeAdded||y,x=n.onNodeAdded||y,C=n.onBeforeElUpdated||y,A=n.onElUpdated||y,r=n.onBeforeNodeDiscarded||y,a=n.onNodeDiscarded||y,k=n.onBeforeElChildrenUpdated||y,N=n.skipFromChildren||y,B=n.addChild||function(t,e){return t.appendChild(e)},o=!0===n.childrenOnly,T=Object.create(null),i=[];function R(t){i.push(t)}function P(t,e,n){!1!==r(t)&&(e&&e.removeChild(t),a(t),function t(e,n){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;n&&(o=m(r))?R(o):(a(r),r.firstChild&&t(r,n)),r=r.nextSibling}}(t,n))}function I(t,e,n){var r=m(e);if(r&&delete T[r],!n){if(!1===C(t,e))return;if(O(t,e),A(t),!1===k(t,e))return}if("TEXTAREA"!==t.nodeName){var o,a,i,l,s,u,c=t,r=e,h=N(c),f=r.firstChild,d=c.firstChild;t:for(;f;){for(l=f.nextSibling,o=m(f);!h&&d;){if(i=d.nextSibling,f.isSameNode&&f.isSameNode(d)){f=l,d=i;continue t}a=m(d);var p=d.nodeType,g=void 0;if(p===f.nodeType&&(1===p?(o?o!==a&&(!(s=T[o])||i===s?g=!1:(c.insertBefore(s,d),a?R(a):P(d,c,!0),d=s)):a&&(g=!1),(g=!1!==g&&D(d,f))&&I(d,f)):3!==p&&8!=p||(g=!0,d.nodeValue!==f.nodeValue&&(d.nodeValue=f.nodeValue))),g){f=l,d=i;continue t}a?R(a):P(d,c,!0),d=i}o&&(s=T[o])&&D(s,f)?(h||B(c,s),I(s,f)):!1!==(u=E(f))&&((f=u?u:f).actualize&&(f=f.actualize(c.ownerDocument||S)),B(c,f),function t(e){x(e);for(var n=e.firstChild;n;){var r=n.nextSibling,o=m(n);(o=o&&T[o])&&D(n,o)?(n.parentNode.replaceChild(o,n),I(o,n)):t(n),n=r}}(f)),f=l,d=i}for(var y=c,v=d,w=void 0;v;){var b=v.nextSibling;(w=m(v))?R(w):P(v,y,!0),v=b}n=_[c.nodeName];n&&n(c,r)}else _.TEXTAREA(t,e)}!function t(e){if(1===e.nodeType||11===e.nodeType)for(var n=e.firstChild;n;){var r=m(n);r&&(T[r]=n),t(n),n=n.nextSibling}}(t);var l,s,u=(n=t).nodeType,c=e.nodeType;if(!o)if(1===u)1===c?D(t,e)||(a(t),n=function(t,e){for(var n=t.firstChild;n;){var r=n.nextSibling;e.appendChild(n),n=r}return e}(t,(l=e.nodeName,(s=e.namespaceURI)&&s!==p?S.createElementNS(s,l):S.createElement(l)))):n=e;else if(3===u||8===u){if(c===u)return n.nodeValue!==e.nodeValue&&(n.nodeValue=e.nodeValue),n;n=e}if(n===e)a(t);else{if(e.isSameNode&&e.isSameNode(n))return;if(I(n,e,o),i)for(var h=0,f=i.length;h<f;h++){var d=T[i[h]];d&&P(d,d.parentNode,!1)}}return!o&&n!==t&&t.parentNode&&(n.actualize&&(n=n.actualize(t.ownerDocument||S)),t.parentNode.replaceChild(n,t)),n}var O;O=function(t,e){var n,r,o,a,i=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var l=i.length-1;0<=l;l--)r=(n=i[l]).name,o=n.namespaceURI,a=n.value,o?(r=n.localName||r,t.getAttributeNS(o,r)!==a&&("xmlns"===n.prefix&&(r=n.name),t.setAttributeNS(o,r,a))):t.getAttribute(r)!==a&&t.setAttribute(r,a);for(var s=t.attributes,u=s.length-1;0<=u;u--)r=(n=s[u]).name,(o=n.namespaceURI)?(r=n.localName||r,e.hasAttributeNS(o,r)||t.removeAttributeNS(o,r)):e.hasAttribute(r)||t.removeAttribute(r)}};e.exports=l},{}],12:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t};function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=l(t("a-template")),x=l(t("clone")),i=l(t("deep-extend")),u=l(t("./util.js"));function l(t){return t&&t.__esModule?t:{default:t}}var c='<table class="{tableClass}">\n\t\x3c!-- BEGIN row:loop --\x3e\n\t<tr>\n\t\t\x3c!-- \\BEGIN row.{i}.col:loop --\x3e\n\t\t\x3c!-- \\BEGIN type:touch#th --\x3e\n\t\t<th\x3c!-- \\BEGIN colspan:touchnot#1 --\x3e colspan="\\{colspan\\}"\x3c!-- \\END colspan:touchnot#1 --\x3e\x3c!-- \\BEGIN rowspan:touchnot#1 --\x3e rowspan="\\{rowspan\\}"\x3c!-- \\END rowspan:touchnot#1 --\x3e class="\x3c!-- \\BEGIN align:exist --\x3e\\{align\\}[getStyleByAlign]\x3c!-- \\END align:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e \\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e">\\{value\\}</th>\n\t\t\x3c!-- \\END type:touch#th --\x3e\n\t\t\x3c!-- \\BEGIN type:touch#td --\x3e\n\t\t<td\x3c!-- \\BEGIN colspan:touchnot#1 --\x3e colspan="\\{colspan\\}"\x3c!-- \\END colspan:touchnot#1 --\x3e\x3c!-- \\BEGIN rowspan:touchnot#1 --\x3e rowspan="\\{rowspan\\}"\x3c!-- \\END rowspan:touchnot#1 --\x3e class="\x3c!-- \\BEGIN align:exist --\x3e\\{align\\}[getStyleByAlign] \x3c!-- \\END align:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e\\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e">\\{value\\}</td>\n\t\t\x3c!-- \\END type:touch#td --\x3e\n\t\t\x3c!-- \\END row.{i}.col:loop --\x3e\n\t</tr>\n\t\x3c!-- END row:loop --\x3e\n</table>\n',h={showBtnList:!0,lang:"en",mark:{align:{default:"left",left:"left",center:"center",right:"right"},btn:{group:"a-table-btn-list",item:"a-table-btn",itemActive:"a-table-btn-active"},icon:{alignLeft:"a-table-icon a-table-icon-left",alignCenter:"a-table-icon a-table-icon-center",alignRight:"a-table-icon a-table-icon-right",undo:"a-table-icon a-table-icon-undo",merge:"a-table-icon a-table-icon-merge02",split:"a-table-icon a-table-icon-split02",table:"a-table-icon a-table-icon-th02",source:"a-table-icon a-table-icon-source01",td:"a-table-icon a-table-icon-td03",th:"a-table-icon a-table-icon-th02"},label:"a-table-label",actionGroup:"a-table-action-group",selector:{self:"a-table-selector"}},message:{mergeCells:"merge cell",splitCell:"split cell",changeToTh:"change to th",changeToTd:"change to td",alignLeft:"align left",alignCenter:"align center",alignRight:"align right",addColumnLeft:"insert column on the left",addColumnRight:"insert column on the right",removeColumn:"remove column",addRowTop:"insert row above",addRowBottom:"insert row below",removeRow:"remove row",source:"Source",mergeCellError1:"All possible cells should be selected so to merge cells into one",mergeCellConfirm1:"The top left cell's value of the selected range will only be saved. Are you sure you want to continue?",pasteError1:"You can't paste here",splitError1:"Cell is not selected",splitError2:"Only one cell should be selected",splitError3:"You can't split the cell anymore"}},t=function(t){var e=s;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);function s(t,e){var n;if(this instanceof s)return(n=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this))).id=s.getUniqId(),n.menu_id=s.getUniqId(),n.addTemplate(n.id,'\x3c!-- BEGIN showMenu:exist --\x3e\n<ul class="a-table-menu" style="top:{menuY}px;left:{menuX}px;">\n\t\x3c!-- BEGIN mode:touch#cell --\x3e\n\t<li data-action-click="mergeCells">\\{message.mergeCells\\}</li>\n\t<li data-action-click="splitCell">\\{message.splitCell\\}</li>\n\t<li data-action-click="changeCellTypeTo(th)">\\{message.changeToTh\\}</li>\n\t<li data-action-click="changeCellTypeTo(td)">\\{message.changeToTd\\}</li>\n\t<li data-action-click="align(left)">\\{message.alignLeft\\}</li>\n\t<li data-action-click="align(center)">\\{message.alignCenter\\}</li>\n\t<li data-action-click="align(right)">\\{message.alignRight\\}</li>\n\t\x3c!-- END mode:touch#cell --\x3e\n\t\x3c!-- BEGIN mode:touch#col --\x3e\n\t<li data-action-click="insertColLeft({selectedRowNo})">\\{message.addColumnLeft\\}</li>\n\t<li data-action-click="insertColRight({selectedRowNo})">\\{message.addColumnRight\\}</li>\n\t<li data-action-click="removeCol({selectedRowNo})">\\{message.removeColumn\\}</li>\n\t\x3c!-- END mode:touch#col --\x3e\n\t\x3c!-- BEGIN mode:touch#row --\x3e\n\t<li data-action-click="insertRowAbove({selectedColNo})">\\{message.addRowTop\\}</li>\n\t<li data-action-click="insertRowBelow({selectedColNo})">\\{message.addRowBottom\\}</li>\n\t<li data-action-click="removeRow({selectedColNo})">\\{message.removeRow\\}</li>\n\t\x3c!-- END mode:touch#row --\x3e\n</ul>\n\x3c!-- END showMenu:exist --\x3e\n<div class="a-table-wrapper">\n\t\x3c!-- BEGIN inputMode:touch#table --\x3e\n\t<table class="a-table">\n\t\t<tr class="a-table-header js-table-header">\n\t\t\t<th class="a-table-first"></th>\n\t\t\t\x3c!-- BEGIN highestRow:loop --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedRowNo:touch#{i} --\x3e\n\t\t\t<th data-action-click="unselect()" class="selected"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedRowNo:touch#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedRowNo:touchnot#{i} --\x3e\n\t\t\t<th data-action-click="selectRow({i})"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedRowNo:touchnot#{i} --\x3e\n\t\t\t\n\t\t\t\x3c!-- END highestRow:loop --\x3e\n\t\t</tr>\n\t\t\x3c!-- BEGIN row:loop --\x3e\n\t\t<tr>\n\t\t\t\x3c!-- \\BEGIN selectedColNo:touchnot#{i} --\x3e\n\t\t\t<th class="a-table-side js-table-side" data-action-click="selectCol({i})"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedColNo:touchnot#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedColNo:touch#{i} --\x3e\n\t\t\t<th class="a-table-side js-table-side selected" data-action-click="unselect()"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedColNo:touch#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN row.{i}.col:loop --\x3e\n\t\t\t<td colspan="\\{colspan\\}" rowspan="\\{rowspan\\}" data-action="updateTable(\\{i\\},{i})" data-cell-id="\\{i\\}-{i}" class="\x3c!-- \\BEGIN selected:exist --\x3ea-table-selected\x3c!-- \\END selected:exist --\x3e\x3c!-- \\BEGIN type:touch#th --\x3e a-table-th\x3c!-- END \\type:touch#th --\x3e\x3c!-- \\BEGIN mark.top:exist --\x3e a-table-border-top\x3c!-- \\END mark.top:exist --\x3e\x3c!-- \\BEGIN mark.right:exist --\x3e a-table-border-right\x3c!-- \\END mark.right:exist --\x3e\x3c!-- \\BEGIN mark.bottom:exist --\x3e a-table-border-bottom\x3c!-- \\END mark.bottom:exist --\x3e\x3c!-- \\BEGIN mark.left:exist --\x3e a-table-border-left\x3c!-- \\END mark.left:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e \\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e"><div class="a-table-editable \\{align\\}" contenteditable>\\{value\\}</div></td>\n\t\t\t\x3c!-- \\END row.{i}.col:loop --\x3e\n\t\t</tr>\n\t\t\x3c!-- END row:loop --\x3e\n\t</table>\n\t\x3c!-- END inputMode:touch#table --\x3e\n\t\x3c!-- BEGIN inputMode:touch#source --\x3e\n\t<textarea data-bind="tableResult" class="a-table-textarea" data-action-input="updateResult"></textarea>\n\t\x3c!-- END inputMode:touch#source --\x3e\n</div>\n'),n.addTemplate(n.menu_id,u.default.removeIndentNewline('\x3c!-- BEGIN showBtnList:exist --\x3e\n<div class="a-table-btn-group-list">\n\t<div class="\\{mark.btn.group\\}">\n\t\t\x3c!-- BEGIN inputMode:touch#table --\x3e\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="changeInputMode(source)"><i class="\\{mark.icon.source\\}"></i></button>\n\t\t\x3c!-- END inputMode:touch#table --\x3e\n\t\t\x3c!-- BEGIN inputMode:touch#source --\x3e\n\t\t<button type="button" class="\\{mark.btn.itemActive\\}" data-action-click="changeInputMode(table)"><i class="\\{mark.icon.source\\}"></i></button>\n\t\t\x3c!-- END inputMode:touch#source --\x3e\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="mergeCells"><i class="\\{mark.icon.merge\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="splitCell()"><i class="\\{mark.icon.split\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="undo()"><i class="\\{mark.icon.undo\\}"></i></button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="changeCellTypeTo(td)">\x3c!-- BEGIN mark.icon.td:empty --\x3etd\x3c!-- END mark.icon.td:empty --\x3e\x3c!-- BEGIN mark.icon.td:exist --\x3e<i class="\\{mark.icon.td\\}"></i>\x3c!-- END mark.icon.td:exist --\x3e</button><button type="button" class="\\{mark.btn.item\\}" data-action-click="changeCellTypeTo(th)">\x3c!-- BEGIN mark.icon.th:empty --\x3eth\x3c!-- END mark.icon.th:empty --\x3e\x3c!-- BEGIN mark.icon.th:exist --\x3e<i class="\\{mark.icon.th\\}"></i>\x3c!-- END mark.icon.th:exist --\x3e</button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="align(left)"><i class="\\{mark.icon.alignLeft\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="align(center)"><i class="\\{mark.icon.alignCenter\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="align(right)"><i class="\\{mark.icon.alignRight\\}"></i></button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<div class="\\{mark.actionGroup\\}">\n\t\t\t<label class="\\{mark.label\\}">セル</label>\n\t\t\t<select class="\\{mark.selector.self\\}" data-bind="cellClass" data-action-change="changeCellClass()">\n\t\t\t\t<option value="">---</option>\n\t\t\t\t\x3c!-- BEGIN selector.option:loop --\x3e\n\t\t\t\t<option value="{value}">{label}</option>\n\t\t\t\t\x3c!-- END selector.option:loop --\x3e\n\t\t\t</select>\n\t\t</div>\n\t</div>\n\t\x3c!-- BEGIN tableOption:exist --\x3e\n\t<div class="\\{mark.btn.group\\}">\n\t\t<div class="\\{mark.actionGroup\\}">\n\t\t\t<label class="\\{mark.label\\}">テーブル</label>\n\t\t\t<select class="\\{mark.selector.self\\}" data-bind="tableClass" data-action-change="update">\n\t\t\t\t<option value="">---</option>\n\t\t\t\t\x3c!-- BEGIN tableOption:loop --\x3e\n\t\t\t\t<option value="{value}">{label}</option>\n\t\t\t\t\x3c!-- END tableOption:loop --\x3e\n\t\t\t</select>\n\t\t</div>\n\t</div>\n\t\x3c!-- END tableOption:exist --\x3e\n</div>\n\x3c!-- END showBtnList:exist --\x3e\n')),n.data=(0,i.default)({},h,e),e=n.data,t="string"==typeof t?document.querySelector(t):t,e.point={x:-1,y:-1},e.selectedRowNo=-1,e.selectedColNo=-1,e.showBtnList=!0,e.row=n.parse("<table>"+t.innerHTML+"</table>"),e.tableResult=n.getTable(),e.tableClass=t.getAttribute("class")||"",e.highestRow=n.highestRow,e.history=[],e.inputMode="table",e.cellClass="",e.history.push((0,x.default)(e.row)),n.convert={},n.convert.getStyleByAlign=n.getStyleByAlign,n.convert.setClass=n.setClass,e="\n <div class='a-table-container'>\n <div data-id='"+n.menu_id+"'></div>\n <div class='a-table-outer'>\n <div class='a-table-inner'>\n <div data-id='"+n.id+"'></div>\n </div>\n </div>\n </div>",u.default.before(t,e),u.default.removeElement(t),n.update(),n;throw new TypeError("Cannot call a class as a function")}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t),r(s,[{key:"highestRow",value:function(){var r=[],t=this.data.row[0],o=0;return t&&t.col.forEach(function(t){for(var e=parseInt(t.colspan),n=0;n<e;n++)r.push(o),o++}),r}},{key:"_getTableLength",value:function(t){return{x:this._getRowLength(t[0].col),y:this._getColLength(t)}}},{key:"_getRowLength",value:function(t){var e=0;return t.forEach(function(t){e+=parseInt(t.colspan)}),e}},{key:"_getColLength",value:function(t){var e=0,n=0;return t.forEach(function(t){0===n&&(n=parseInt(t.col[0].rowspan),e+=n),n--}),e}},{key:"_getElementByQuery",value:function(t){return document.querySelector("[data-id='"+this.id+"'] "+t)}},{key:"_getElementsByQuery",value:function(t){return document.querySelectorAll("[data-id='"+this.id+"'] "+t)}},{key:"_getSelf",value:function(){return document.querySelector("[data-id='"+this.id+"']")}},{key:"getCellByIndex",value:function(t,e){return this._getElementByQuery("[data-cell-id='"+t+"-"+e+"']")}},{key:"getCellInfoByIndex",value:function(t,e){this.id;var n,r,o,a,i,l,t=this.getCellByIndex(t,e);return!!t&&(e=u.default.offset(t),n=e.left,r=e.top,a=o=-1,e=parseInt(t.getAttribute("colspan")),t=parseInt(t.getAttribute("rowspan")),i=this._getElementsByQuery(".js-table-header th"),l=this._getElementsByQuery(".js-table-side"),[].forEach.call(i,function(t,e){u.default.offset(t).left===n&&(o=e)}),[].forEach.call(l,function(t,e){u.default.offset(t).top===r&&(a=e)}),{x:o-1,y:a,width:e,height:t})}},{key:"getLargePoint",value:function(){for(var t=[],e=[],n=[],r=[],o=0,a=arguments.length;o<a;o++)t.push(arguments[o].x),e.push(arguments[o].y),n.push(arguments[o].x+arguments[o].width),r.push(arguments[o].y+arguments[o].height);var i=Math.min.apply(Math,t),l=Math.min.apply(Math,e);return{x:i,y:l,width:Math.max.apply(Math,n)-i,height:Math.max.apply(Math,r)-l}}},{key:"getSelectedPoints",value:function(){var r=[],o=this;return this.data.row.forEach(function(t,n){if(!t.col)return!1;t.col.forEach(function(t,e){t.selected&&(t=o.getCellInfoByIndex(e,n))&&r.push(t)})}),r}},{key:"getSelectedPoint",value:function(){var t=this.getSelectedPoints();if(t&&t[0])return t[0]}},{key:"getAllPoints",value:function(){var r=[],o=this;return this.data.row.forEach(function(t,n){t&&t.col&&t.col.forEach(function(t,e){e=o.getCellInfoByIndex(e,n);e&&r.push(e)})}),r}},{key:"getCellIndexByPos",value:function(o,a){var i=void 0,l=void 0,s=this;return this.data.row.forEach(function(t,r){t&&t.col&&t.col.forEach(function(t,e){var n=s.getCellInfoByIndex(e,r);n.x===o&&n.y===a&&(i=e,l=r)})}),{row:l,col:i}}},{key:"getCellByPos",value:function(t,e){t=this.getCellIndexByPos(t,e);if(this.data.row[t.row])return this.data.row[t.row].col[t.col]}},{key:"hitTest",value:function(t,e){return t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height}},{key:"markup",value:function(){var t,o,a,e=this.data;e.splited?e.splited=!1:(t=this.getSelectedPoints(),o=this.getLargePoint.apply(null,t),a=this,e.row.forEach(function(t,r){if(!t||!t.col)return!1;t.col.forEach(function(t,e){var e=a.getCellInfoByIndex(e,r),n={};t.selected&&(e.x===o.x&&(n.left=!0),e.x+e.width===o.x+o.width&&(n.right=!0),e.y===o.y&&(n.top=!0),e.y+e.height===o.y+o.height)&&(n.bottom=!0),t.mark=n})}))}},{key:"selectRange",value:function(t,e){var r,o,n=this.data;n.point&&(r=this,n.row[t].col[e].selected=!0,t=this.getSelectedPoints(),o=this.getLargePoint.apply(null,t),n.row.forEach(function(t,n){if(!t||!t.col)return!1;t.col.forEach(function(t,e){e=r.getCellInfoByIndex(e,n);e&&r.hitTest(o,e)&&(t.selected=!0)})}),1<t.length)&&this.update()}},{key:"select",value:function(r,o){var t=this.data;t.point={x:o,y:r},t.row.forEach(function(t,n){if(!t||!t.col)return!1;t.col.forEach(function(t,e){n===r&&e===o||(t.selected=!1)})}),t.row[r].col[o].selected||(t.row[r].col[o].selected=!0)}},{key:"unselectCells",value:function(){this.data.row.forEach(function(t,e){if(!t||!t.col)return!1;t.col.forEach(function(t,e){t.selected=!1})})}},{key:"removeCell",value:function(t){for(var e=this.data.row,n=0,r=e.length;n<r;n++)for(var o=e[n].col,a=0,i=o.length;a<i;a++)o[a]===t&&(o.splice(a,1),a--,i--)}},{key:"removeSelectedCellExcept",value:function(t){for(var e=this.data.row,n=0,r=e.length;n<r;n++)for(var o=e[n].col,a=0,i=o.length;a<i;a++){var l=o[a];l!==t&&l.selected&&(o.splice(a,1),a--,i--)}}},{key:"contextmenu",value:function(){var t=this.data;this.e.preventDefault(),t.showMenu=!0,t.menuX=this.e.clientX,t.menuY=this.e.clientY,this.update()}},{key:"parse",value:function(t){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"html",i=this,n=[],t=u.default.parseHTML(t).querySelectorAll("tr");return[].forEach.call(t,function(t){var e={},o=[],t=t.querySelectorAll("th,td");e.col=o,[].forEach.call(t,function(t){var n={},e="html"===a?t.innerHTML:t.innerText,e=("TH"===t.tagName?n.type="th":n.type="td",n.colspan=t.getAttribute("colspan")||1,n.rowspan=t.getAttribute("rowspan")||1,n.value="",e&&(n.value=e.replace(/{(.*?)/g,"{$1"),n.value=e.replace(/(.*?)}/g,"$1}"),n.value=n.value.replace(/\\/g,"\")),t.getAttribute("class")),r="";e&&e.split(/\s+/).forEach(function(t){var e=i.getAlignByStyle(t);e?n.align=e:r+=" "+t}),n.cellClass=r.substr(1),o.push(n)}),n.push(e)}),n}},{key:"parseText",value:function(t){var r=[];return(t=t.replace(/"(([\n\r\t]|.)*?)"/g,function(t,e){return e.replace(/[\n\r]/g,"<br>")})).split(String.fromCharCode(13)).forEach(function(t){var e={},n=[];e.col=n,t.split(String.fromCharCode(9)).forEach(function(t){var e={type:"td",colspan:1,rowspan:1,value:""};t&&(e.value=t.replace(/{(.*?)/g,"{$1"),e.value=t.replace(/(.*?)}/g,"$1}")),n.push(e)}),r.push(e)}),r}},{key:"getTableClass",value:function(t){return u.default.parseHTML(t).getAttribute("class")}},{key:"toMarkdown",value:function(t){var t=u.default.parseHTML(t),n="",t=t.querySelectorAll("tr");return[].forEach.call(t,function(t,e){n+="| ";t=t.querySelectorAll("td,th");[].forEach.call(t,function(t){n=n+t.innerHTML+" | "}),0===e&&(n+="\n| ",[].forEach.call(t,function(t){n+="--- | "})),n+="\n"}),n}},{key:"getTable",value:function(){return this.getHtml(c,!0).replace(/ class=""/g,"").replace(/class="(.*)? "/g,'class="$1"')}},{key:"getMarkdown",value:function(){return this.toMarkdown(this.getHtml(c,!0))}},{key:"putCaret",value:function(t){var e,n;t&&(t.focus(),void 0!==window.getSelection&&void 0!==document.createRange?((e=document.createRange()).selectNodeContents(t),e.collapse(!1),(n=window.getSelection()).removeAllRanges(),n.addRange(e)):void 0!==document.body.createTextRange&&((n=document.body.createTextRange()).moveToElementText(t),n.collapse(!1),n.select()))}},{key:"onUpdated",value:function(){var t=this,e=this.getAllPoints(),e=(this.getLargePoint.apply(null,e).width,this._getElementByQuery("table")),n=this._getSelf().parentNode,r=this._getElementByQuery(".a-table-selected .a-table-editable"),o=this.getSelectedPoints();r&&!this.data.showMenu&&1===o.length&&setTimeout(function(){t.putCaret(r)},1),e?(n.style.width="9999px",o=e.offsetWidth,n.style.width=o+"px"):n.style.width="auto",this.afterRendered&&this.afterRendered()}},{key:"undo",value:function(){var t=this.data,e=t.row,n=t.history;if(0!==t.history.length){for(;JSON.stringify(e)===JSON.stringify(t.row);)e=n.pop();e&&(0===n.length&&n.push((0,x.default)(e)),t.row=e,this.update())}}},{key:"insertRow",value:function(t,e){var n=this.data.row;n[t]?n.splice(t,0,{col:e}):n.length===t&&n.push({col:e})}},{key:"insertCellAt",value:function(t,e,n){var r=this.data.row;r[t]&&r[t].col&&r[t].col.splice(e,0,n)}},{key:"unselect",value:function(){var t=this.data;this.unselectCells(),t.selectedColNo=-1,t.selectedRowNo=-1,t.showMenu=!1,this.update()}},{key:"selectRow",value:function(t){var e=this.data,n=(this.unselectCells(),e.showMenu=!1,this.getAllPoints()),r=this.getLargePoint.apply(null,n),o={x:parseInt(t),y:0,width:1,height:r.height},a=[],i=this;n.forEach(function(t){i.hitTest(o,t)&&a.push(t)}),a.forEach(function(t){i.getCellByPos(t.x,t.y).selected=!0}),e.mode="col",e.selectedColNo=-1,e.selectedRowNo=t,this.contextmenu(),this.update()}},{key:"selectCol",value:function(t){var e=this.getAllPoints(),n=this.getLargePoint.apply(null,e),r={x:0,y:parseInt(t),width:n.width,height:1},o=[],a=this,n=this.data;this.unselectCells(),n.showMenu=!1,e.forEach(function(t){a.hitTest(r,t)&&o.push(t)}),o.forEach(function(t){a.getCellByPos(t.x,t.y).selected=!0}),n.mode="row",n.selectedRowNo=-1,n.selectedColNo=t,this.contextmenu(),this.update()}},{key:"removeCol",value:function(t){var e=this.data,n=(e.showMenu=!1,this),r=this.getAllPoints(),o=this.getLargePoint.apply(null,r),a={x:parseInt(t),y:0,width:1,height:o.height},i=[];r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),i.forEach(function(t){t=n.getCellByPos(t.x,t.y);1===t.colspan?n.removeCell(t):t.colspan=parseInt(t.colspan)-1}),e.history.push((0,x.default)(e.row)),this.update()}},{key:"removeRow",value:function(n){var t=this.data,r=(t.showMenu=!1,this),e=this.getAllPoints(),o=this.getLargePoint.apply(null,e),a={x:0,y:n=parseInt(n),width:o.width,height:1},i={x:0,y:n+1,width:o.width,height:1},l=[],s=[],u=[];e.forEach(function(t){r.hitTest(a,t)&&l.push(t)}),e.forEach(function(t){var e;r.hitTest(i,t)&&((e=r.getCellByPos(t.x,t.y)).x=t.x,t.y===i.y)&&u.push(e)}),l.forEach(function(t){var e=r.getCellByPos(t.x,t.y);1===e.rowspan?s.push(e):(e.rowspan=parseInt(e.rowspan)-1,n===t.y&&(e.x=t.x,u.push(e)))}),u.sort(function(t,e){return t.x>e.x?1:-1}),s.forEach(function(t){r.removeCell(t)}),t.row.splice(n,1),0<u.length&&(t.row[n]={col:u}),t.history.push((0,x.default)(t.row)),this.update()}},{key:"updateTable",value:function(t,e){var n,r=this.data,o=this.e,a=o.type,i=this.getSelectedPoints(),l=s.isSmartPhone();"mouseup"===a&&this.data.showMenu||(e=(n=[parseInt(e),parseInt(t)])[0],t=n[1],r.mode="cell",r.selectedRowNo=-1,r.selectedColNo=-1,r.showMenu=!1,"compositionstart"===a?r.beingInput=!0:"compositionend"===a?r.beingInput=!1:"click"!==a||l?"keydown"===a&&67==o.keyCode&&(o.ctrlKey||o.metaKey)?(n=this._getElementByQuery(".a-table-selected .a-table-editable"),u.default.triggerEvent(n,"copy")):"copy"===a?this.copyTable(o):"paste"===a?this.pasteTable(o):"mousedown"!==a||l?"mousemove"!==a||l?"mouseup"!==a||l?"contextmenu"===a?(this.mousedown=!1,this.contextmenu()):"touchstart"===a?1===i.length&&this.data.row[e].col[t].selected||this.data.beingInput||(this.select(e,t),this.update()):"input"!==a&&("keyup"!==a||-1===(n=s.getBrowser()).indexOf("ie")&&"edge"!==n)||(u.default.hasClass(this.e.target,"a-table-editable")&&this.e.target.parentNode.getAttribute("data-cell-id")===t+"-"+e&&(r.history.push((0,x.default)(r.row)),r.row[e].col[t].value=this.e.target.innerHTML.replace(/{(.*?)/g,"{$1"),r.row[e].col[t].value=this.e.target.innerHTML.replace(/(.*?)}/g,"$1}"),r.row[e].col[t].value=r.row[e].col[t].value.replace(/\\/g,"\")),this.afterEntered&&this.afterEntered()):(this.mousedown=!1,o=this._getElementByQuery(".a-table-selected .a-table-editable"),1<i.length&&this.putCaret(o)):this.mousedown&&this.selectRange(e,t):2===this.e.button||this.e.ctrlKey||(this.mousedown=!0,this.data.beingInput)||1===i.length&&this.data.row[e].col[t].selected||(this.select(e,t),this.update()):this.e.shiftKey&&this.selectRange(e,t))}},{key:"copyTable",value:function(t){var n;this.getSelectedPoints().length<=1||(t.preventDefault(),n='<meta name="generator" content="Sheets"><table>',this.data.row.forEach(function(t,e){if(!t.col)return!1;n+="<tr>",t.col.forEach(function(t,e){t.selected&&(n+="<"+t.type+' colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.value+"</"+t.type+">")}),n+="</tr>"}),n=(n=(n+="</table>").replace(/<table>(<tr><\/tr>)*/g,"<table>")).replace(/(<tr><\/tr>)*<\/table>/g,"</table>"),t.clipboardData?t.clipboardData.setData("text/html",n):window.clipboardData&&window.clipboardData.setData("Text",n))}},{key:"pasteTable",value:function(t){var e;t.clipboardData?(e=(e=t.clipboardData.getData("text/html"))||t.clipboardData.getData("text/plain"),this.processPaste(e)):window.clipboardData&&this.getClipBoardData()}},{key:"getClipBoardData",value:function(){for(var t=document.createDocumentFragment(),e=this.getSelectedPoint(),e=this.getCellIndexByPos(e.x,e.y),n=this.getCellByIndex(e.col,e.row).querySelector(".a-table-editable");0<n.childNodes.length;)t.appendChild(n.childNodes[0]);return this.waitForPastedData(n,t),!0}},{key:"waitForPastedData",value:function(t,e){var n,r=this;t.childNodes&&0<t.childNodes.length?(n=t.innerHTML,t.innerHTML="",t.appendChild(e),this.processPaste(n)):setTimeout(function(){r.waitForPastedData(t,e)},20)}},{key:"processPaste",value:function(t){var e=this.e,n=(e.preventDefault(),this.getSelectedPoint()),r=t.match(/<table(([\n\r\t]|.)*?)>(([\n\r\t]|.)*?)<\/table>/i),o=this.data;if(r&&r[0]){r=this.parse(r[0],"text");if(r&&r.length)return this.insertTable(r,{x:n.x,y:n.y}),void o.history.push((0,x.default)(o.row))}var r=this.parseText(t);r&&r[0]&&r[0].col&&1<r[0].col.length?(n=this.getSelectedPoint(),this.insertTable(r,{x:n.x,y:n.y}),this.update(),o.history.push((0,x.default)(o.row))):e.clipboardData?(t=e.clipboardData.getData("text/plain"),document.execCommand("insertText",!1,t)):window.clipboardData&&(r=window.clipboardData.getData("Text"),u.default.replaceSelectionWithHtml(r))}},{key:"insertTable",value:function(n,t){for(var o=this,e=this._getTableLength(this.data.row),r=this._getTableLength(n),a=t.x+r.x-e.x,i=t.y+r.y-e.y,l=e.x,s=(this.data.row,[]),u=[],c=this.data,c=(0,x.default)(c.row);0<i;){for(var h=[],f=0;f<l;f++)h.push({type:"td",colspan:1,rowspan:1,value:""});this.insertRow(e.y,h),i--}0<a&&this.data.row.forEach(function(t){for(var e=0;e<a;e++)t.col.push({type:"td",colspan:1,rowspan:1,value:""})}),this.update();var d={},p={x:t.x,y:t.y};if(p.y+=r.y-1,p.x+=r.x-1,this.data.row.forEach(function(t,r){if(!t.col)return!1;t.col.forEach(function(t,e){var n=o.getCellInfoByIndex(e,r);n.x+n.width-1===p.x&&n.y+n.height-1===p.y&&(d.x=e,d.y=r)})}),void 0===d.x)alert(this.data.message.pasteError1),this.data.row=c;else{this.selectRange(d.y,d.x);var t=this.getSelectedPoints(),g=this.getLargePoint.apply(null,t);if(g.width!==r.x||g.height!==r.y)alert(this.data.message.pasteError1),this.data.row=c;else{var y={x:0,y:g.y,width:g.x,height:g.height};this.getAllPoints().forEach(function(t){var e;o.hitTest(y,t)&&(e=o.getCellIndexByPos(t.x,t.y),o.getCellByPos(t.x,t.y),s.push(e))}),s.forEach(function(t){var e=t.row;t.row<g.y||(u[e]||(u[e]=[]),u[e].push(t))});for(var v=1,w=u.length;v<w;v++)u[v]&&u[v].sort(function(t,e){return t.col>e.col?1:-1});for(var b=g.y,m=b+g.height;b<m;b++)u[b]||(u[b]=[],u[b].push({row:b,col:-1}));this.removeSelectedCellExcept();var E=0;u.forEach(function(t){var e=t[t.length-1];n[E]&&n[E].col.reverse().forEach(function(t){o.insertCellAt(e.row,e.col+1,{type:"td",colspan:parseInt(t.colspan),rowspan:parseInt(t.rowspan),value:t.value,selected:!0})}),E++})}}this.update()}},{key:"updateResult",value:function(){var t=this.data;t.row=this.parse(t.tableResult),t.tableClass=this.getTableClass(t.tableResult),t.history.push((0,x.default)(t.row)),"table"===t.inputMode&&this.update(),this.afterEntered&&this.afterEntered()}},{key:"insertColRight",value:function(t){var e=this.data,o=(e.selectedRowNo=parseInt(t),e.showMenu=!1,this),n=this.getAllPoints(),r=this.getLargePoint.apply(null,n),a={x:parseInt(t),y:0,width:1,height:r.height},i=[];n.forEach(function(t){o.hitTest(a,t)&&i.push(t)}),i.forEach(function(t){var e=o.getCellIndexByPos(t.x,t.y),n=o.getCellByPos(t.x,t.y),r={type:"td",colspan:1,rowspan:n.rowspan,value:""};void 0!==e.row&&void 0!==e.col&&(1<t.width+t.x-a.x?(n.colspan=parseInt(n.colspan)+1,n.colspan+=""):o.insertCellAt(e.row,e.col+1,r))}),e.history.push((0,x.default)(e.row)),this.update()}},{key:"insertColLeft",value:function(t){var e=this.data,o=(t=parseInt(t),e.selectedRowNo=t+1,e.showMenu=!1,this),n=this.getAllPoints(),r=this.getLargePoint.apply(null,n),a={x:parseInt(t)-1,y:0,width:1,height:r.height},i=[];if(n.forEach(function(t){o.hitTest(a,t)&&i.push(t)}),0===t){for(var l=r.height,s=0;s<l;s++)o.insertCellAt(s,0,{type:"td",colspan:1,rowspan:1,value:""});e.history.push((0,x.default)(e.row)),o.update()}else i.forEach(function(t){var e=o.getCellIndexByPos(t.x,t.y),n=o.getCellByPos(t.x,t.y),r={type:"td",colspan:1,rowspan:n.rowspan,value:""};void 0!==e.row&&void 0!==e.col&&(1<t.width+t.x-a.x?(n.colspan=parseInt(n.colspan)+1,n.colspan+=""):o.insertCellAt(e.row,e.col+1,r))}),e.history.push((0,x.default)(e.row)),this.update()}},{key:"beforeUpdated",value:function(){this.changeSelectOption(),this.markup()}},{key:"insertRowBelow",value:function(a){var t=this.data,i=(t.showMenu=!1,t.selectedColNo=parseInt(a),this),e=this.getAllPoints(),n=this.getLargePoint.apply(null,e),r={x:0,y:(a=parseInt(a))+1,width:n.width,height:1},o=[],l=[];if(e.forEach(function(t){i.hitTest(r,t)&&o.push(t)}),0===o.length){for(var s=n.width,u=0;u<s;u++)l.push({type:"td",colspan:1,rowspan:1,value:""});i.insertRow(a+1,l),i.update()}else o.forEach(function(t){var e=i.getCellIndexByPos(t.x,t.y),n=i.getCellByPos(t.x,t.y);if(n)if(void 0!==e.row&&void 0!==e.col)if(1<t.height&&t.y<=a)n.rowspan=parseInt(n.rowspan)+1,n.rowspan+="";else if(e.row===a+1)for(var r=parseInt(n.colspan),o=0;o<r;o++)l.push({type:"td",colspan:1,rowspan:1,value:""});else i.insertCellAt(e.row+1,e.col,{type:"td",colspan:1,rowspan:1,value:""})}),this.insertRow(a+1,l),t.history.push((0,x.default)(t.row)),this.update()}},{key:"insertRowAbove",value:function(a){var t=this.data,i=(t.showMenu=!1,t.selectedColNo=parseInt(a)+1,this),e=this.getAllPoints(),n=this.getLargePoint.apply(null,e),r={x:0,y:(a=parseInt(a))-1,width:n.width,height:1},o=[],l=[];if(e.forEach(function(t){i.hitTest(r,t)&&o.push(t)}),0===a){for(var s=n.width,u=0;u<s;u++)l.push({type:"td",colspan:1,rowspan:1,value:""});i.insertRow(0,l),i.update()}else o.forEach(function(t){var e=i.getCellIndexByPos(t.x,t.y),n=i.getCellByPos(t.x,t.y);if(n)if(void 0!==e.row&&void 0!==e.col)if(1<t.height)n.rowspan=parseInt(n.rowspan)+1,n.rowspan+="";else if(e.row===a-1)for(var r=parseInt(n.colspan),o=0;o<r;o++)l.push({type:"td",colspan:1,rowspan:1,value:""});else i.insertCellAt(e.row,e.col,{type:"td",colspan:1,rowspan:1,value:""})}),this.insertRow(a,l),t.history.push((0,x.default)(this.data.row)),this.update()}},{key:"mergeCells",value:function(){var t,e=this.data,n=this.getSelectedPoints();this.isSelectedCellsRectangle()?0!==n.length&&confirm(this.data.message.mergeCellConfirm1)&&(n=this.getLargePoint.apply(null,n),t=this.getCellByPos(n.x,n.y),this.removeSelectedCellExcept(t),t.colspan=n.width,t.rowspan=n.height,e.showMenu=!1,e.history.push((0,x.default)(e.row)),this.update()):alert(this.data.message.mergeCellError1)}},{key:"splitCell",value:function(){var t=this.data,e=this.getSelectedPoints().length;if(0===e)alert(this.data.message.splitError1);else if(1<e)alert(this.data.message.splitError2);else{var e=this.getSelectedPoint(),n={x:0,y:e.y,width:e.x,height:e.height},r=this.getAllPoints(),o=this.getCellIndexByPos(e.x,e.y),a=this.getCellByPos(e.x,e.y),i=parseInt(a.colspan),l=parseInt(a.rowspan),s=a.value,u=this,c=[],h=[];if(1===i&&1===l)alert(this.data.message.splitError3);else{r.forEach(function(t){var e;u.hitTest(n,t)&&(e=u.getCellIndexByPos(t.x,t.y),u.getCellByPos(t.x,t.y),c.push(e))}),c.forEach(function(t){var e=t.row;t.row<o.row||(h[e]||(h[e]=[]),h[e].push(t))});for(var f=1,d=h.length;f<d;f++)h[f]&&h[f].sort(function(t,e){return t.col>e.col?1:-1});for(var p=e.y,g=p+l;p<g;p++)h[p]||(h[p]=[],h[p].push({row:p,col:-1}));var y=!0;h.forEach(function(t){for(var e=t[t.length-1],n=0;n<i;n++){var r="";!0===y&&n===i-1&&(r=s,y=!1),u.insertCellAt(e.row,e.col+1,{type:"td",colspan:1,rowspan:1,value:r,selected:!0})}}),this.removeCell(a),t.showMenu=!1,t.history.push((0,x.default)(t.row)),t.splited=!0,this.update()}}}},{key:"changeCellTypeTo",value:function(n){var t=this.data;t.row.forEach(function(t,e){t.col.forEach(function(t,e){t.selected&&(t.type=n)})}),t.showMenu=!1,t.history.push((0,x.default)(t.row)),this.update()}},{key:"align",value:function(n){var t=this.data;t.row.forEach(function(t,e){t.col.forEach(function(t,e){t.selected&&(t.align=n)})}),t.showMenu=!1,t.history.push((0,x.default)(t.row)),this.update()}},{key:"getStyleByAlign",value:function(t){var e=this.data.mark.align;return e.default===t?"":e[t]}},{key:"getAlignByStyle",value:function(t){var e=this.data.mark.align;return e.right===t?"right":e.center===t?"center":e.left===t?"left":void 0}},{key:"isSelectedCellsRectangle",value:function(){var t=this.getSelectedPoints(),e=this.getLargePoint.apply(null,t),t=this.getAllPoints(),n=!0,r=this;return t.forEach(function(t){r.hitTest(e,t)&&!r.getCellByPos(t.x,t.y).selected&&(n=!1)}),n}},{key:"changeInputMode",value:function(t){var e=this.data;"source"===(e.inputMode=t)?e.tableResult=this.getTable():(e.row=this.parse(e.tableResult),e.tableClass=this.getTableClass(e.tableResult)),this.update()}},{key:"changeCellClass",value:function(){var t=this.data,n=t.cellClass;t.row.forEach(function(t,e){t.col.forEach(function(t,e){t.selected&&(t.cellClass=n)})}),t.history.push((0,x.default)(t.row)),this.update()}},{key:"changeSelectOption",value:function(){var e=void 0,n=!0,t=this.data;t.row.forEach(function(t){t.col.forEach(function(t){t.selected&&(e?e!==t.cellClass&&(n=!1):e=t.cellClass)})}),t.cellClass=n&&e?e:""}}],[{key:"isSmartPhone",value:function(){var t=navigator.userAgent;return 0<t.indexOf("iPhone")||0<t.indexOf("iPad")||0<t.indexOf("ipod")||0<t.indexOf("Android")}},{key:"getBrowser",value:function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),n="unknown";return-1!=t.indexOf("msie")?n=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?n="ie11":-1!=t.indexOf("edge")?n="edge":-1!=t.indexOf("chrome")?n="chrome":-1!=t.indexOf("safari")?n="safari":-1!=t.indexOf("opera")?n="opera":-1!=t.indexOf("firefox")&&(n="firefox"),n}},{key:"getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}}]),s}(a.default);n.default=t,e.exports=n.default},{"./util.js":13,"a-template":1,clone:5,"deep-extend":7}],13:[function(t,e,n){"use strict";var a="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};t("custom-event-polyfill"),e.exports.before=function(t,e){t.insertAdjacentHTML("beforebegin",e)},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.offset=function(t){t=t.getBoundingClientRect();return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}},e.exports.parseHTML=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body.children[0]},e.exports.hasClass=function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},e.exports.replaceSelectionWithHtml=function(t){var e=void 0;if(window.getSelection&&window.getSelection().getRangeAt){(e=window.getSelection().getRangeAt(0)).deleteContents();for(var n,r=document.createElement("div"),o=(r.innerHTML=t,document.createDocumentFragment());n=r.firstChild;)o.appendChild(n);e.insertNode(o)}else document.selection&&document.selection.createRange&&(e=document.selection.createRange()).pasteHTML(t)},e.exports.extend=function t(e){e=e||{};for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)r.hasOwnProperty(o)&&("object"===a(r[o])?e[o]=t(e[o],r[o]):e[o]=r[o])}return e},e.exports.triggerEvent=function(t,e,n){var r=void 0;window.CustomEvent?r=new CustomEvent(e,{cancelable:!0}):(r=document.createEvent("CustomEvent")).initCustomEvent(e,!1,!1,n),t.dispatchEvent(r)},e.exports.removeIndentNewline=function(t){return t.replace(/(\n|\t)/g,"")}},{"custom-event-polyfill":6}]},{},[12])(12)});