quill-table-up 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`quill`)):typeof define==`function`&&define.amd?define([`exports`,`quill`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TableUp={},e.Quill))})(this,function(e,t){Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);function l(e,t){this.v=e,this.k=t}function u(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){if(Array.isArray(e))return e}function f(e){if(Array.isArray(e))return u(e)}function p(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function m(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){m(a,r,i,o,s,`next`,e)}function s(e){m(a,r,i,o,s,`throw`,e)}o(void 0)})}}function g(e,t,n){return t=C(t),ee(e,T()?Reflect.construct(t,n||[],C(e).constructor):t.apply(e,n))}function _(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ie(r.key),r)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function b(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=oe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`quill`)):typeof define==`function`&&define.amd?define([`exports`,`quill`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TableUp={},e.Quill))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);function l(e,t){this.v=e,this.k=t}function u(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e){if(Array.isArray(e))return e}function f(e){if(Array.isArray(e))return u(e)}function p(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function m(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){m(a,r,i,o,s,`next`,e)}function s(e){m(a,r,i,o,s,`throw`,e)}o(void 0)})}}function g(e,t,n){return t=C(t),ee(e,T()?Reflect.construct(t,n||[],C(e).constructor):t.apply(e,n))}function _(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ie(r.key),r)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function b(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=oe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function x(e,t,n){return(t=ie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=ne(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},S.apply(null,arguments)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function w(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&te(e,t)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function E(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function D(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function O(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k(){throw TypeError(`Invalid attempt to spread non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?A(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t){if(e==null)return{};var n,r,i=N(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function N(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ee(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return p(e)}function P(){"use strict";P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol==`function`?Symbol:{},a=i.iterator||`@@iterator`,o=i.asyncIterator||`@@asyncIterator`,s=i.toStringTag||`@@toStringTag`;function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},``)}catch(e){c=function(e,t,n){return e[t]=n}}function l(t,n,r,i){var a=n&&n.prototype instanceof f?n:f,o=Object.create(a.prototype);return c(o,`_invoke`,function(t,n,r){var i=1;return function(a,o){if(i===3)throw Error(`Generator is already running`);if(i===4){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=x(s,r);if(c){if(c===d)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===1)throw i=4,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=3;var l=u(t,n,r);if(l.type===`normal`){if(i=r.done?4:2,l.arg===d)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=4,r.method=`throw`,r.arg=l.arg)}}}(t,r,new w(i||[])),!0),o}function u(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=l;var d={};function f(){}function p(){}function m(){}var h={};c(h,a,function(){return this});var g=Object.getPrototypeOf,_=g&&g(g(T([])));_&&_!==n&&r.call(_,a)&&(h=_);var v=m.prototype=f.prototype=Object.create(h);function y(e){[`next`,`throw`,`return`].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function n(i,a,o,s){var c=u(e[i],e,a);if(c.type!==`throw`){var l=c.arg,d=l.value;return d&&typeof d==`object`&&r.call(d,`__await`)?t.resolve(d.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(d).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var i;c(this,`_invoke`,function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()},!0)}function x(t,n){var r=n.method,i=t.i[r];if(i===e)return n.delegate=null,r===`throw`&&t.i.return&&(n.method=`return`,n.arg=e,x(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),d;var a=u(i,t.i,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,d;var o=a.arg;return o?o.done?(n[t.r]=o.value,n.next=t.n,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,d):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,d)}function S(e){this.tryEntries.push(e)}function C(t){var n=t[4]||{};n.type=`normal`,n.arg=e,t[4]=n}function w(e){this.tryEntries=[[-1]],e.forEach(S,this),this.reset(!0)}function T(t){if(t!=null){var n=t[a];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw TypeError(typeof t+` is not iterable`)}return p.prototype=m,c(v,`constructor`,m),c(m,`constructor`,p),p.displayName=c(m,s,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===p||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,`GeneratorFunction`)),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},y(b.prototype),c(b.prototype,o,function(){return this}),t.AsyncIterator=b,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},y(v),c(v,s,`Generator`),c(v,a,function(){return this}),c(v,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},t.values=T,w.prototype={constructor:w,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){o.type=`throw`,o.arg=t,n.next=e}for(var i=n.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a[4],s=this.prev,c=a[1],l=a[2];if(a[0]===-1)return r(`end`),!1;if(!c&&!l)throw Error(`try statement without catch or finally`);if(a[0]!=null&&a[0]<=s){if(s<c)return this.method=`next`,this.arg=e,r(c),!0;if(s<l)return r(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var i=r;break}}i&&(e===`break`||e===`continue`)&&i[0]<=t&&t<=i[2]&&(i=null);var a=i?i[4]:{};return a.type=e,a.arg=t,i?(this.method=`next`,this.next=i[2],d):this.complete(a)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if(r.type===`throw`){var i=r.arg;C(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={i:T(t),r:n,n:r},this.method===`next`&&(this.arg=e),d}},t}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},te(e,t)}function F(e,t){return d(e)||D(e,t)||oe(e,t)||O()}function ne(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=C(e))!==null;);return e}function I(e,t,n,r){var i=S(C(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function L(e){return f(e)||E(e)||oe(e)||k()}function re(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ie(e){var t=re(e,`string`);return typeof t==`symbol`?t:t+``}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ae(e)}function oe(e,t){if(e){if(typeof e==`string`)return u(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function se(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof l;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}se.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},se.prototype.next=function(e){return this._invoke(`next`,e)},se.prototype.throw=function(e){return this._invoke(`throw`,e)},se.prototype.return=function(e){return this._invoke(`return`,e)};var R={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableHead:`table-up-head`,tableBody:`table-up-body`,tableFoot:`table-up-foot`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},z={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},B={AFTER_TABLE_RESIZE:`after-table-resize`,TABLE_SELECTION_DRAG_START:`table-selection-drag-start`,TABLE_SELECTION_DRAG_END:`table-selection-drag-end`,TABLE_SELECTION_CHANGE:`table-selection-change`,TABLE_SELECTION_DISPLAY_CHANGE:`table-selection-display-change`},V={moduleName:`table-up`,tableSelectionName:`table-selection`},ce=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],le=`table-up`,ue=new Set([R.tableCellInner]),de=function(e){return ue.has(e.statics.blotName)};function fe(e){return e!=null&&e.parent?de(e.parent)?!0:fe(e.parent):!1}function H(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:le,n=t?`${t}-`:``;return{b:function(){return`${n}${e}`},be:function(t){return t?`${n}${e}__${t}`:``},bm:function(t){return t?`${n}${e}--${t}`:``},bem:function(t,r){return t&&r?`${n}${e}__${t}--${r}`:``},ns:function(e){return e?`${n}${e}`:``},bs:function(t){return t?`${n}${e}-${t}`:``},cv:function(e){return e?`--${n}${e}`:``},is:function(e){return`is-${e}`}}}function U(e,t){for(var n=e.parent;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function pe(e,t){for(var n=Array(t.length),r=new Map(t.map(function(e,t){return[e,t]})),i=e.parent;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){var a=r.get(i.statics.blotName);n[a]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function me(e){for(var t=new Map,n=e;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function he(e,t){for(var n=[],r=e.children.iterator(),i=null;i=r();)i instanceof t&&n.push(i);return n}function ge(e,t,n){var r=b(Object.getOwnPropertyNames(t)),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;n!=null&&n.test(a)||Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}}catch(e){r.e(e)}finally{r.f()}return e}function _e(e,t){var n=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(e),r=b(t),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;ge(n.prototype,a.prototype,/^constructor$/)}}catch(e){r.e(e)}finally{r.f()}return n}function ve(e,t){return e.prototype&&e.prototype instanceof t}function ye(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function be(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function xe(e){return e=e.startsWith(`#`)?e.slice(1):e,{r:Number.parseInt(e.slice(0,2),16),g:Number.parseInt(e.slice(2,4),16),b:Number.parseInt(e.slice(4,6),16),a:Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2))}}function Se(e){var t=e.r,n=e.g,r=e.b,i=e.a;t=ye(t,255),n=ye(n,255),r=ye(r,255);var a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function Ce(e){var t=e.h,n=e.s,r=e.b,i=e.a;t=ye(t,360)*6,n=ye(n,100),r=ye(r,100);var a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function we(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(var n in t)t[n].length===1&&(t[n]=`0${t[n]}`);return t.join(``)}var Te=function(e){return we(Ce(e))},Ee=function(e){return typeof e==`function`},De=Array.isArray,Oe=function(e){return typeof e==`string`},ke=function(e){return typeof e==`number`},Ae=function(e){return e!==null&&ae(e)===`object`},je=function(e){return e===void 0},Me=function(e){return!Number.isNaN(e)&&Number(e)>0},Ne=function(e){return De(e)?e:[e]};function Pe(e){var t=e||{},n=t.type,r=n===void 0?`default`:n,i=t.content,a=H(`button`),o=document.createElement(`button`);return o.classList.add(a.b(),r),i&&(Oe(i)?o.textContent=i:o.appendChild(i)),o}function Fe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=230,n=150,r=10,i=Se(xe(e.color||`#ff0000`)),a=H(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());var s=document.createElement(`div`);s.classList.add(a.be(`content`));var c=document.createElement(`div`);c.classList.add(a.be(`selector`));var l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);var u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);var d=document.createElement(`div`);d.classList.add(a.be(`alpha`));var f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));var p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);var m=document.createElement(`div`);m.classList.add(a.be(`hue`));var h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);var g=document.createElement(`div`);g.classList.add(a.be(`action`));var _=F([`r`,`g`,`b`,`a`].map(function(e){var t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);var n=document.createElement(`label`);n.textContent=e.toUpperCase();var r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,function(){r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,function(){var t=Math.round(Number(r.value));e===`a`&&(t/=100),ee(be(Se(Object.assign({},Ce(i),x({},e,t))))),N()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r}),4),v=_[0],y=_[1],S=_[2],C=_[3];s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);var w=!1,T=!1,E=!1;function D(){var e=Te(i),t=b([v,y,S].entries()),n;try{for(t.s();!(n=t.n()).done;){var r=F(n.value,2),a=r[0],o=r[1];o.value=String(Number.parseInt(e[a*2]+e[a*2+1],16))}}catch(e){t.e(e)}finally{t.f()}C.value=String((i.a*100).toFixed(0))}function O(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function k(){c.style.backgroundColor=`#${we(Ce({h:i.h,s:100,b:100,a:1}))}`}function A(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function j(){p.style.left=`${i.a*100}%`}function M(){var e=Ce(i),t=e.r,n=e.g,r=e.b;f.style.background=`linear-gradient(to right, rgba(${t}, ${n}, ${r}, 0) 0%, rgba(${t}, ${n}, ${r}, 1) 100%)`}function N(){O(),k(),A(),j(),M(),D()}function ee(t){i=be(Object.assign({},i,t)),D(),e.onChange&&e.onChange(`#${Te(i)}`)}function P(e){var r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft;ee({s:Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),b:Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n)}),N()}function te(e){var t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);ee({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),N()}function ne(e){var t=e.pageX,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),ee({a:Math.round((i-10/2)/(n.width-10)*100)/100}),N()}function I(e){w&&(e.preventDefault(),P(e)),T&&(e.preventDefault(),te(e)),E&&(e.preventDefault(),ne(e))}function L(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L),w=!1}function re(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L),w=!0,P(e)}c.addEventListener(`mousedown`,re);function ie(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,ie),T=!1}function ae(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,ie),T=!0,te(e)}m.addEventListener(`mousedown`,ae);function oe(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,oe),E=!1}function se(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,oe),E=!0,ne(e)}return d.addEventListener(`mousedown`,se),N(),o}var Ie=8e3;function Le(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.child,n=e.target,r=n===void 0?document.body:n,i=e.beforeClose,a=i===void 0?function(){}:i,o=H(`dialog`),s=r,c=document.createElement(`div`);c.classList.add(o.b()),c.style.zIndex=String(Ie);var l=document.createElement(`div`);if(l.classList.add(o.be(`overlay`)),c.appendChild(l),t){var u=document.createElement(`div`);u.classList.add(o.be(`content`)),u.appendChild(t),l.appendChild(u),u.addEventListener(`click`,function(e){e.stopPropagation()})}var d=getComputedStyle(s).overflow;s.style.overflow=`hidden`,s.appendChild(c);var f=function(){a(),c.remove(),s.style.overflow=d};return c.addEventListener(`click`,f),Ie+=1,{dialog:c,close:f}}function Re(e){return ze.apply(this,arguments)}function ze(){return ze=h(P().mark(function e(t){var n,r,i;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.message,r=t.confirm,i=t.cancel,e.abrupt(`return`,new Promise(function(e){var t=document.createElement(`div`);Object.assign(t.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});var a=document.createElement(`p`);a.textContent=n;var o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});var s=Pe({content:i}),c=Pe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Le({child:t}).close;s.addEventListener(`click`,function(){e(!1),l()}),c.addEventListener(`click`,function(){e(!0),l()})}));case 1:case`end`:return e.stop()}},e)})),ze.apply(this,arguments)}function Be(e,t){var n=H(`input`);t.type||(t.type=`text`),t.value||(t.value=``);var r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){var i=document.createElement(`span`);i.classList.add(n.be(`label`)),i.textContent=e,r.appendChild(i)}var a=document.createElement(`div`);a.classList.add(n.be(`input`));var o=document.createElement(`input`);for(var s in t)o.setAttribute(s,t[s]);return(t.max||t.min)&&o.addEventListener(`blur`,function(){t.max&&t.max<=Number(o.value)&&(o.value=String(t.max)),t.min&&t.min>=Number(o.value)&&(o.value=String(t.min))}),a.appendChild(o),r.appendChild(a),o.addEventListener(`focus`,function(){a.classList.add(`focus`)}),o.addEventListener(`blur`,function(){a.classList.remove(`focus`)}),{item:r,input:o,errorTip:function(e){var t;return a.classList.contains(`error`)?t=a.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),a.appendChild(t)),t.textContent=e,a.classList.add(`error`),{removeError:function(){a.classList.remove(`error`),t.remove()}}}}}function Ve(){return He.apply(this,arguments)}function He(){return He=h(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=arguments;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&v[0]!==void 0?v[0]:{},n=H(`creator`),r=document.createElement(`div`),r.classList.add(n.b()),i=document.createElement(`div`),i.classList.add(n.be(`input`)),a=Be(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=Be(t.colText||`Column`,{type:`number`,value:String(t.col||``),max:99}),u=l.item,d=l.input,f=l.errorTip,i.appendChild(o),i.appendChild(u),r.appendChild(i),p=document.createElement(`div`),p.classList.add(n.be(`control`)),m=Pe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Pe({type:`default`,content:t.cancelText||`Cancel`}),p.appendChild(m),p.appendChild(h),r.appendChild(p),g=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number(s.value),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number(d.value);if(Number.isNaN(e)||e<=0){c(t.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){f(t.notPositiveNumberError||`Please enter a positive integer`);return}return{row:e,col:n}},_=function(e){e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,_))},e.abrupt(`return`,new Promise(function(e,t){var n=Le({child:r,beforeClose:t}).close;s.focus();for(var i=0,a=[s,d];i<a.length;i++)a[i].addEventListener(`keydown`,function(t){if(t.key===`Enter`){var r=g();r&&(e(r),n())}});m.addEventListener(`click`,function(){var t=g();t&&(e(t),n())}),document.addEventListener(`keydown`,_),h.addEventListener(`click`,n)}).finally(function(){document.removeEventListener(`keydown`,_)}));case 1:case`end`:return e.stop()}},e)})),He.apply(this,arguments)}function Ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=H(`select-box`),n=document.createElement(`div`);n.classList.add(t.b());var r=document.createElement(`div`);r.classList.add(t.be(`block`));for(var i=0;i<(e.row||8);i++)for(var a=0;a<(e.col||8);a++){var o=document.createElement(`div`);o.classList.add(t.be(`item`)),o.dataset.row=String(i+1),o.dataset.col=String(a+1),r.appendChild(o)}var s=function(){for(var e=n.dataset,t=e.row,i=e.col,a=0,o=Array.from(r.querySelectorAll(`.active`));a<o.length;a++)o[a].classList.remove(`active`);if(!(!t||!i))for(var s=Array.from(r.children),c=0,l=s;c<l.length;c++){var u=l[c],d=u.dataset,f=d.row,p=d.col;if(f>t&&p>i)return;u.classList.toggle(`active`,f<=t&&p<=i)}};if(r.addEventListener(`mousemove`,function(e){if(e.target){var t=e.target.dataset,r=t.row,i=t.col;!r||!i||(n.dataset.row=r,n.dataset.col=i,s())}}),r.addEventListener(`mouseleave`,function(){n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),s()}),r.addEventListener(`click`,function(){var t,r=n.dataset,i=r.row,a=r.col;!i||!a||(t=e.onSelect)==null||t.call(e,Number(i),Number(a))}),n.appendChild(r),e.customBtn){var c=e.texts||{},l=document.createElement(`div`);l.classList.add(t.be(`custom`)),l.textContent=c.customBtnText||`Custom`,l.addEventListener(`click`,h(P().mark(function t(){var n,r;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,Ve(c);case 1:n=t.sent,n&&((r=e.onSelect)==null||r.call(e,n.row,n.col));case 2:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function We(e){"@babel/helpers - typeof";return We=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},We(e)}function Ge(e,t){if(We(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(We(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ke(e){var t=Ge(e,`string`);return We(t)==`symbol`?t:t+``}function qe(e,t,n){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Je(Object(n),!0).forEach(function(t){qe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Ye=Math.min,Xe=Math.max,Ze=Math.round,Qe=Math.floor,$e=e=>({x:e,y:e}),et={left:`right`,right:`left`,bottom:`top`,top:`bottom`},tt={start:`end`,end:`start`};function nt(e,t,n){return Xe(e,Ye(t,n))}function rt(e,t){return typeof e==`function`?e(t):e}function it(e){return e.split(`-`)[0]}function at(e){return e.split(`-`)[1]}function ot(e){return e===`x`?`y`:`x`}function st(e){return e===`y`?`height`:`width`}let ct=new Set([`top`,`bottom`]);function lt(e){return ct.has(it(e))?`y`:`x`}function ut(e){return ot(lt(e))}function dt(e,t,n){n===void 0&&(n=!1);let r=at(e),i=ut(e),a=st(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bt(o)),[o,bt(o)]}function ft(e){let t=bt(e);return[pt(e),t,pt(t)]}function pt(e){return e.replace(/start|end/g,e=>tt[e])}let mt=[`left`,`right`],ht=[`right`,`left`],gt=[`top`,`bottom`],_t=[`bottom`,`top`];function vt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ht:mt:t?mt:ht;case`left`:case`right`:return t?gt:_t;default:return[]}}function yt(e,t,n,r){let i=at(e),a=vt(it(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pt)))),a}function bt(e){return e.replace(/left|right|bottom|top/g,e=>et[e])}function xt(e){return W({top:0,right:0,bottom:0,left:0},e)}function St(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xt(e)}function Ct(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wt(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Tt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){wt(a,r,i,o,s,`next`,e)}function s(e){wt(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Et(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Dt(e,t){if(e==null)return{};var n,r,i=Et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let Ot=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],kt=[`mainAxis`,`crossAxis`,`limiter`];function At(e,t,n){let{reference:r,floating:i}=e,a=lt(t),o=ut(t),s=st(o),c=it(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(at(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let jt=function(){var e=Tt(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=At(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=yield h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g==null?u:g,d=_==null?d:_,p=W(W({},p),{},{[a]:W(W({},p[a]),v)}),y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=At(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}();function Mt(e,t){return Nt.apply(this,arguments)}function Nt(){return Nt=Tt(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=rt(t,e),m=St(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=Ct(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(h))==null||n?h:h.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),y=(yield a.isElement==null?void 0:a.isElement(v))&&(yield a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=Ct(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}),Nt.apply(this,arguments)}let Pt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return Tt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=rt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=Dt(u,Ot);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=it(i),y=lt(s),b=it(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[bt(s)]:ft(s)),C=h!==`none`;!p&&C&&S.push(...yt(s,g,h,x));let w=[s,...S],T=yield Mt(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=dt(i,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:i,overflows:E}],!E.every(e=>e<=0)){var O,k;let e=(((O=a.flip)==null?void 0:O.index)||0)+1,t=w[e];if(t&&(!(f===`alignment`&&y!==lt(t))||D.every(e=>lt(e.placement)===y?e.overflows[0]>0:!0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=(k=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:k.placement;if(!n)switch(m){case`bestFit`:{var A;let e=(A=D.filter(e=>{if(C){let t=lt(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:A[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}},Ft=new Set([`left`,`top`]);function It(e,t){return Lt.apply(this,arguments)}function Lt(){return Lt=Tt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=it(n),s=at(n),c=lt(n)===`y`,l=Ft.has(o)?-1:1,u=a&&c?-1:1,d=rt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),Lt.apply(this,arguments)}let Rt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return Tt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield It(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:W(W({},c),{},{placement:o})}})()}}},zt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return Tt(function*(){let{x:n,y:r,placement:i}=t,a=rt(e,t),{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=a,l=Dt(a,kt),u={x:n,y:r},d=yield Mt(t,l),f=lt(it(i)),p=ot(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=nt(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=nt(n,h,r)}let g=c.fn(W(W({},t),{},{[p]:m,[f]:h}));return W(W({},g),{},{data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}})})()}}},Bt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=rt(e,t),u={x:n,y:r},d=lt(i),f=ot(d),p=u[f],m=u[d],h=rt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:W({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=Ft.has(it(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function Vt(){return typeof window<`u`}function Ht(e){return Gt(e)?(e.nodeName||``).toLowerCase():`#document`}function Ut(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wt(e){var t;return(t=(Gt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gt(e){return Vt()?e instanceof Node||e instanceof Ut(e).Node:!1}function Kt(e){return Vt()?e instanceof Element||e instanceof Ut(e).Element:!1}function qt(e){return Vt()?e instanceof HTMLElement||e instanceof Ut(e).HTMLElement:!1}function Jt(e){return!Vt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ut(e).ShadowRoot}let Yt=new Set([`inline`,`contents`]);function Xt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=un(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Yt.has(i)}let Zt=new Set([`table`,`td`,`th`]);function Qt(e){return Zt.has(Ht(e))}let $t=[`:popover-open`,`:modal`];function en(e){return $t.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let tn=[`transform`,`translate`,`scale`,`rotate`,`perspective`],nn=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],rn=[`paint`,`layout`,`strict`,`content`];function an(e){let t=sn(),n=Kt(e)?un(e):e;return tn.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||nn.some(e=>(n.willChange||``).includes(e))||rn.some(e=>(n.contain||``).includes(e))}function on(e){let t=fn(e);for(;qt(t)&&!ln(t);){if(an(t))return t;if(en(t))return null;t=fn(t)}return null}function sn(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let cn=new Set([`html`,`body`,`#document`]);function ln(e){return cn.has(Ht(e))}function un(e){return Ut(e).getComputedStyle(e)}function dn(e){return Kt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fn(e){if(Ht(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Jt(e)&&e.host||Wt(e);return Jt(t)?t.host:t}function pn(e){let t=fn(e);return ln(t)?e.ownerDocument?e.ownerDocument.body:e.body:qt(t)&&Xt(t)?t:pn(t)}function mn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=pn(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ut(i);if(a){let e=hn(o);return t.concat(o,o.visualViewport||[],Xt(i)?i:[],e&&n?mn(e):[])}return t.concat(i,mn(i,[],n))}function hn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gn(e){let t=un(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ze(n)!==a||Ze(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _n(e){return Kt(e)?e:e.contextElement}function vn(e){let t=_n(e);if(!qt(t))return $e(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gn(t),o=(a?Ze(n.width):n.width)/r,s=(a?Ze(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let yn=$e(0);function bn(e){let t=Ut(e);return!sn()||!t.visualViewport?yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ut(e)?!1:t}function Sn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_n(e),o=$e(1);t&&(r?Kt(r)&&(o=vn(r)):o=vn(e));let s=xn(a,n,r)?bn(a):$e(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ut(a),t=r&&Kt(r)?Ut(r):r,n=e,i=hn(n);for(;i&&r&&t!==n;){let e=vn(i),t=i.getBoundingClientRect(),r=un(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ut(i),i=hn(n)}}return Ct({width:u,height:d,x:c,y:l})}function Cn(e,t){let n=dn(e).scrollLeft;return t?t.left+n:Sn(Wt(e)).left+n}function wn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Cn(e,n),y:n.top+t.scrollTop}}function Tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Wt(r),s=t?en(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$e(1),u=$e(0),d=qt(r);if((d||!d&&!a)&&((Ht(r)!==`body`||Xt(o))&&(c=dn(r)),qt(r))){let e=Sn(r);l=vn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wn(o,c):$e(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function En(e){return Array.from(e.getClientRects())}function Dn(e){let t=Wt(e),n=dn(e),r=e.ownerDocument.body,i=Xe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Cn(e),s=-n.scrollTop;return un(r).direction===`rtl`&&(o+=Xe(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function On(e,t){let n=Ut(e),r=Wt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=sn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Cn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let kn=new Set([`absolute`,`fixed`]);function An(e,t){let n=Sn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=qt(e)?vn(e):$e(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function jn(e,t,n){let r;if(t===`viewport`)r=On(e,n);else if(t===`document`)r=Dn(Wt(e));else if(Kt(t))r=An(t,n);else{let n=bn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ct(r)}function Mn(e,t){let n=fn(e);return n===t||!Kt(n)||ln(n)?!1:un(n).position===`fixed`||Mn(n,t)}function Nn(e,t){let n=t.get(e);if(n)return n;let r=mn(e,[],!1).filter(e=>Kt(e)&&Ht(e)!==`body`),i=null,a=un(e).position===`fixed`,o=a?fn(e):e;for(;Kt(o)&&!ln(o);){let t=un(o),n=an(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&kn.has(i.position)||Xt(o)&&!n&&Mn(e,o))?r=r.filter(e=>e!==o):i=t,o=fn(o)}return t.set(e,r),r}function Pn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?en(t)?[]:Nn(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=jn(t,n,i);return e.top=Xe(r.top,e.top),e.right=Ye(r.right,e.right),e.bottom=Ye(r.bottom,e.bottom),e.left=Xe(r.left,e.left),e},jn(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Fn(e){let{width:t,height:n}=gn(e);return{width:t,height:n}}function In(e,t,n){let r=qt(t),i=Wt(t),a=n===`fixed`,o=Sn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$e(0);function l(){c.x=Cn(i)}if(r||!r&&!a)if((Ht(t)!==`body`||Xt(i))&&(s=dn(t)),r){let e=Sn(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?wn(i,s):$e(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ln(e){return un(e).position===`static`}function Rn(e,t){if(!qt(e)||un(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Wt(e)===n&&(n=n.ownerDocument.body),n}function zn(e,t){let n=Ut(e);if(en(e))return n;if(!qt(e)){let t=fn(e);for(;t&&!ln(t);){if(Kt(t)&&!Ln(t))return t;t=fn(t)}return n}let r=Rn(e,t);for(;r&&Qt(r)&&Ln(r);)r=Rn(r,t);return r&&ln(r)&&Ln(r)&&!an(r)?n:r||on(e)||n}let Bn=function(){var e=Tt(function*(e){let t=this.getOffsetParent||zn,n=this.getDimensions,r=yield n(e.floating);return{reference:In(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function Vn(e){return un(e).direction===`rtl`}let Hn={convertOffsetParentRelativeRectToViewportRelativeRect:Tn,getDocumentElement:Wt,getClippingRect:Pn,getOffsetParent:zn,getElementRects:Bn,getClientRects:En,getDimensions:Fn,getScale:vn,isElement:Kt,isRTL:Vn};function Un(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wn(e,t){let n=null,r,i=Wt(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qe(d),h=Qe(i.clientWidth-(u+f)),g=Qe(i.clientHeight-(d+p)),_=Qe(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xe(0,Ye(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Un(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,W(W({},v),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Gn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_n(e),u=i||a?[...l?mn(l):[],...mn(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Wn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Sn(e):null;c&&g();function g(){let t=Sn(e);h&&!Un(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d==null||d(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Kn=Rt,qn=zt,Jn=Pt,Yn=Bt,Xn=(e,t,n)=>{let r=new Map,i=W({platform:Hn},n),a=W(W({},i.platform),{},{_c:r});return jt(e,t,W(W({},i),{},{platform:a}))};function Zn(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Qn=4;function $n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.msg,r=n===void 0?``:n,i=t.delay,a=i===void 0?150:i,o=t.content,s=t.direction,c=s===void 0?`bottom`:s,l=t.type,u=l===void 0?`hover`:l,d=t.container,f=t.onOpen,p=t.onClose,m=t.closed,h=t.onDestroy,g=H(`tooltip`);if(r||o){var _=d||document.body,v=document.createElement(`div`);v.classList.add(g.b(),`hidden`,`transparent`),o?v.appendChild(o):r&&(v.textContent=r);var y,b,x,S=function(){x&&x(),Xn(e,v,{placement:c,middleware:[Jn(),qn({limiter:Yn()}),Kn(Qn)]}).then(function(e){var t=e.x,n=e.y;Object.assign(v.style,{left:`${t}px`,top:`${n}px`})})},C=function(){v.classList.add(`hidden`),_.contains(v)&&_.removeChild(v),x&&x(),m&&m()},w=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;b&&clearTimeout(b),y=setTimeout(function(){if(f){var n=f(t);if(!t&&n)return}_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=Gn(e,v,S),v.classList.remove(`transparent`)},a)},T=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;y&&clearTimeout(y),b=setTimeout(function(){if(p){var t=p(e);if(!e&&t)return}Zn(v,150,C,{once:!0}),v.classList.add(`transparent`)},a)},E={hover:function(){var t=[e,v],n=T.bind(void 0,!1),r=w.bind(void 0,!1);return{prepare:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.addEventListener(`mouseenter`,r),a.addEventListener(`mouseleave`,n)}},show:w,hide:T,destroy:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.removeEventListener(`mouseenter`,r),a.removeEventListener(`mouseleave`,n)}}}},click:function(){var t=function(e){e.stopPropagation(),T(!1)},n=function(e){e.stopPropagation(),w(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:function(){v.addEventListener(`click`,function(e){return e.stopPropagation()}),e.addEventListener(`click`,n)},show:w,hide:function(){T(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1),document.removeEventListener(`click`,t)},destroy:function(){e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}}}[u](),D=E.prepare,O=E.show,k=E.hide,A=E.destroy;return D(),{show:O,hide:k,destroy:function(){k(!0),h&&h(),A(),x&&x(),v.remove()}}}return null}function er(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.axis,r=n===void 0?`both`:n,i=t.onMove,a=i===void 0?function(){}:i,o=t.onStart,s=o===void 0?function(){}:o,c=t.onEnd,l=c===void 0?function(){}:c,u=t.buttons,d=u===void 0?[0]:u,f=t.container,p=t.draggingElement,m=p===void 0?document:p,h=t.exact,g=h===void 0?!0:h,_={x:0,y:0},v,y={x:0,y:0};function b(t){if(v){var n=e.getBoundingClientRect(),i=_,a=i.x,o=i.y;(r===`x`||r===`both`)&&(a=t.clientX-v.x,f&&(a=Math.min(Math.max(0,a),f.scrollWidth-n.width))),(r===`y`||r===`both`)&&(o=t.clientY-v.y,f&&(o=Math.min(Math.max(0,o),f.scrollHeight-n.height))),_={x:a,y:o}}}function x(t){var n;if(d.includes(t.button)&&!(g&&t.target!==e)){m.addEventListener(`pointerup`,C),m.addEventListener(`pointermove`,S);var r=f==null||(n=f.getBoundingClientRect)==null?void 0:n.call(f),i=e.getBoundingClientRect(),a={x:t.clientX-(f?i.left-r.left+f.scrollLeft:i.left),y:t.clientY-(f?i.top-r.top+f.scrollTop:i.top)};y={x:t.clientX,y:t.clientY},s({position:_,startPosition:a,movePosition:{x:t.clientX-y.x,y:t.clientY-y.y}},t)!==!1&&(v=a,_=a)}}function S(e){v&&(b(e),a({position:_,startPosition:v,movePosition:{x:e.clientX-y.x,y:e.clientY-y.y}},e))}function C(e){m.removeEventListener(`pointermove`,S),m.removeEventListener(`pointerup`,C),b(e),l({position:_,startPosition:v,movePosition:{x:e.clientX-y.x,y:e.clientY-y.y}},e),v=void 0,y={x:0,y:0},_={x:0,y:0}}return m.addEventListener(`pointerdown`,x),{stop:function(){m.removeEventListener(`pointerdown`,x)}}}function tr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=e.x,a=e.y,o=e.x1,s=e.y1,c=t.x,l=t.y,u=t.x1,d=t.y1,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function nr(e,t){var n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}var rr=8;function ir(e){var t=e.left,n=e.top,r=e.width,i=e.height,a=document.documentElement,o=a.clientWidth,s=a.clientHeight,c=!1,l=!1;return t+r>o?(t=o-r-rr,c=!0):t<0&&(t=rr,c=!0),n+i>s?(n=s-i-rr,l=!0):n<0&&(n=rr,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function ar(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(function(r){t.ignoreFirstBind&&r.some(function(e){var t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe.bind(i);i.observe=function(e,t){r.add(e),a(e,t)};var o=i.unobserve;i.unobserve=function(e){r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};var s=i.disconnect;return i.disconnect=function(){var e=b(r.values()),t;try{for(e.s();!(t=e.n()).done;){var a=t.value;a[n]=void 0}}catch(t){e.e(t)}finally{e.f()}s.call(i)},i}function or(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function sr(e,t){for(var n=0;n<this.scrollHandler.length;n++){var r=F(this.scrollHandler[n],2),i=r[0],a=r[1];if(i===e&&a===t){this.scrollHandler.splice(n,1);break}}}function cr(){var e=b(this.scrollHandler),t;try{for(e.s();!(t=e.n()).done;){var n=F(t.value,2),r=n[0],i=n[1];r.removeEventListener(`scroll`,i)}}catch(t){e.e(t)}finally{e.f()}this.scrollHandler=[]}function lr(e){return{y:e.scrollTop,x:e.scrollLeft}}function ur(){var e,t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).target,n=t===void 0?document.body:t,r=document.createElement(`div`);Object.assign(r.style,{visibility:`hidden`,width:`100px`,height:`100%`,overflow:`auto`,position:`absolute`,top:`-9999px`}),n.appendChild(r);var i=r.offsetWidth;r.style.overflow=`scroll`;var a=document.createElement(`div`);a.style.width=`100%`,r.appendChild(a);var o=a.offsetWidth;return(e=r.parentNode)==null||e.removeChild(r),i-o}var dr=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:50,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:20;_(this,e),x(this,`scrollThresholdX`,void 0),x(this,`scrollThresholdY`,void 0),x(this,`maxScrollSpeed`,void 0),x(this,`mouseY`,0),x(this,`mouseX`,0),x(this,`animationId`,null),this.scrollThresholdX=t,this.scrollThresholdY=n,this.maxScrollSpeed=r}return y(e,[{key:`checkMinY`,value:function(e){return this.mouseY<e.top+this.scrollThresholdY}},{key:`checkMaxY`,value:function(e){return this.mouseY>e.bottom-this.scrollThresholdY}},{key:`checkMinX`,value:function(e){return this.mouseX<e.left+this.scrollThresholdX}},{key:`checkMaxX`,value:function(e){return this.mouseX>e.right-this.scrollThresholdX}},{key:`start`,value:function(e,t){var n=this,r=e.getBoundingClientRect(),i=function(){var a=!1,o=0,s=0;if(n.checkMinY(r)){var c=r.top+n.scrollThresholdY-n.mouseY,l=Math.min(c/n.scrollThresholdY*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollTop-=l,s=-1*l,a=!0}else if(n.checkMaxY(r)){var u=n.mouseY-(r.bottom-n.scrollThresholdY),d=Math.min(u/n.scrollThresholdY*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollTop+=d,s=d,a=!0}if(n.checkMinX(r)){var f=r.left+n.scrollThresholdX-n.mouseX,p=Math.min(f/n.scrollThresholdX*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollLeft-=p,o=-1*p,a=!0}else if(n.checkMaxX(r)){var m=n.mouseX-(r.right-n.scrollThresholdX),h=Math.min(m/n.scrollThresholdX*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollLeft+=h,o=h,a=!0}a&&t&&t(o,s),n.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}},{key:`updateMousePosition`,value:function(e,t){this.mouseX=e,this.mouseY=t}},{key:`stop`,value:function(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}}])}();function fr(e){return e.replaceAll(/([A-Z])/g,` $1`).trim().split(` `).join(`-`).toLowerCase()}function pr(e){return e.replaceAll(/-(\w)/g,function(e,t){return t.toUpperCase()})}function mr(e){var t={};if(!e.style.cssText)return t;var n=b(e.style.cssText.split(`;`).filter(function(e){return e.trim()})),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,a).trim();t[o]=i.slice(a+1).trim()}}}catch(e){n.e(e)}finally{n.f()}return t}function hr(e){var t={},n=b(e.trim().split(`;`)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value.trim();if(i){var a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,Math.max(0,a)).trim(),s=i.slice(Math.max(0,a+1)).trim();t[pr(o)]=s}}}}catch(e){n.e(e)}finally{n.f()}return t}function gr(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${fr(n)}: ${r};`}).join(` `)}var G=function(){return Math.random().toString(36).slice(2)};function _r(e,t){var n;return function(){for(var r=this,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,a)},t)}}var vr=t.default.import(`parchment`),yr=t.default.import(`blots/container`),br=t.default.import(`blots/block`),xr=t.default.import(`blots/block/embed`),K=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n);var r=this.statics.allowDataAttrsChangeHandler[e];r&&Ee(this[r])&&this[r](t)}}},{key:`optimize`,value:function(e){if(this.children.length===0)if(this.statics.defaultChild!=null){var t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`enforceAllowedChildren`,value:function(){var e=this;this.children.forEach(function(n){e.statics.allowedChildren.some(function(e){return n instanceof e})||(n.statics.scope===vr.Scope.BLOCK_BLOT?(n.parent instanceof t?(n.next!=null&&n.parent.splitAfter(n),n.prev!=null&&n.parent.splitAfter(n.prev)):(n.next!=null&&e.splitAfter(n),n.prev!=null&&e.splitAfter(n.prev)),n.parent.unwrap()):n instanceof vr.ParentBlot?n.unwrap():n.remove())})}}],[{key:`create`,value:function(e){var t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}}])}(yr);x(K,`tagName`,void 0),x(K,`blotName`,R.container),x(K,`scope`,vr.Scope.BLOCK_BLOT),x(K,`allowedChildren`,[br,xr,yr]),x(K,`requiredContainer`,void 0),x(K,`defaultChild`,void 0),x(K,`allowAttrs`,new Set),x(K,`allowDataAttrs`,new Set),x(K,`allowDataAttrsChangeHandler`,{});var Sr=function(e){return Me(e)?e:1};function Cr(e,t){return Object.keys(e).every(function(n){return JSON.stringify(e[n])===JSON.stringify(t[n])})}var wr=t.default.import(`parchment`),Tr=t.default.import(`blots/block`),Er=t.default.import(`blots/block/embed`),Dr=t.default.import(`blots/container`),Or=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`replaceWith`,value:function(e,t){var n=Oe(e)?this.scroll.create(e,t):e;if(n instanceof wr.ParentBlot)if(n.statics.blotName===R.tableCellInner){var r=null;try{if(r=U(this,R.tableCellInner),Cr(r.formats(),n.formats()))return r}catch(e){}if(r)r.insertBefore(n,this),n.appendChild(this),r.children.length===0&&r.remove();else{for(var i=this,a=i;i.parent!==this.scroll&&i.parent instanceof Dr;)a=i,i=i.parent;i===this.scroll&&(i=a);var o=this.offset(i),s=this.length(),c=i.isolate(o,s);c!=null&&c.parent&&c.parent.insertBefore(n,c.next),n.appendChild(this)}return n}else this.moveChildren(n);return this.parent!==null&&(this.parent.insertBefore(n,this.next),this.remove()),this.attributes.copy(n),n}},{key:`format`,value:function(e,n){if(e===R.tableCellInner&&this.parent.statics.blotName===e&&!n){if(this.prev&&this.prev instanceof Er)return;try{U(this,R.tableCellInner).unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}}else I(t,`format`,this,3)([e,n])}}])}(Tr),kr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`delta`,value:function(){var e=I(t,`delta`,this,3)([]),n=Ar(this);return n[R.tableCellInner]&&e.insert(`
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?A(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t){if(e==null)return{};var n,r,i=N(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function N(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ee(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return p(e)}function P(){"use strict";P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol==`function`?Symbol:{},a=i.iterator||`@@iterator`,o=i.asyncIterator||`@@asyncIterator`,s=i.toStringTag||`@@toStringTag`;function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},``)}catch(e){c=function(e,t,n){return e[t]=n}}function l(t,n,r,i){var a=n&&n.prototype instanceof f?n:f,o=Object.create(a.prototype);return c(o,`_invoke`,function(t,n,r){var i=1;return function(a,o){if(i===3)throw Error(`Generator is already running`);if(i===4){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=x(s,r);if(c){if(c===d)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===1)throw i=4,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=3;var l=u(t,n,r);if(l.type===`normal`){if(i=r.done?4:2,l.arg===d)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=4,r.method=`throw`,r.arg=l.arg)}}}(t,r,new w(i||[])),!0),o}function u(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=l;var d={};function f(){}function p(){}function m(){}var h={};c(h,a,function(){return this});var g=Object.getPrototypeOf,_=g&&g(g(T([])));_&&_!==n&&r.call(_,a)&&(h=_);var v=m.prototype=f.prototype=Object.create(h);function y(e){[`next`,`throw`,`return`].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function n(i,a,o,s){var c=u(e[i],e,a);if(c.type!==`throw`){var l=c.arg,d=l.value;return d&&typeof d==`object`&&r.call(d,`__await`)?t.resolve(d.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(d).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var i;c(this,`_invoke`,function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()},!0)}function x(t,n){var r=n.method,i=t.i[r];if(i===e)return n.delegate=null,r===`throw`&&t.i.return&&(n.method=`return`,n.arg=e,x(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),d;var a=u(i,t.i,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,d;var o=a.arg;return o?o.done?(n[t.r]=o.value,n.next=t.n,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,d):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,d)}function S(e){this.tryEntries.push(e)}function C(t){var n=t[4]||{};n.type=`normal`,n.arg=e,t[4]=n}function w(e){this.tryEntries=[[-1]],e.forEach(S,this),this.reset(!0)}function T(t){if(t!=null){var n=t[a];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw TypeError(typeof t+` is not iterable`)}return p.prototype=m,c(v,`constructor`,m),c(m,`constructor`,p),p.displayName=c(m,s,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===p||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,`GeneratorFunction`)),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},y(b.prototype),c(b.prototype,o,function(){return this}),t.AsyncIterator=b,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},y(v),c(v,s,`Generator`),c(v,a,function(){return this}),c(v,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},t.values=T,w.prototype={constructor:w,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){o.type=`throw`,o.arg=t,n.next=e}for(var i=n.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a[4],s=this.prev,c=a[1],l=a[2];if(a[0]===-1)return r(`end`),!1;if(!c&&!l)throw Error(`try statement without catch or finally`);if(a[0]!=null&&a[0]<=s){if(s<c)return this.method=`next`,this.arg=e,r(c),!0;if(s<l)return r(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var i=r;break}}i&&(e===`break`||e===`continue`)&&i[0]<=t&&t<=i[2]&&(i=null);var a=i?i[4]:{};return a.type=e,a.arg=t,i?(this.method=`next`,this.next=i[2],d):this.complete(a)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if(r.type===`throw`){var i=r.arg;C(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={i:T(t),r:n,n:r},this.method===`next`&&(this.arg=e),d}},t}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},te(e,t)}function F(e,t){return d(e)||D(e,t)||oe(e,t)||O()}function ne(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=C(e))!==null;);return e}function I(e,t,n,r){var i=S(C(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function L(e){return f(e)||E(e)||oe(e)||k()}function re(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ie(e){var t=re(e,`string`);return typeof t==`symbol`?t:t+``}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ae(e)}function oe(e,t){if(e){if(typeof e==`string`)return u(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function se(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof l;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}se.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},se.prototype.next=function(e){return this._invoke(`next`,e)},se.prototype.throw=function(e){return this._invoke(`throw`,e)},se.prototype.return=function(e){return this._invoke(`return`,e)};var R={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableHead:`table-up-head`,tableBody:`table-up-body`,tableFoot:`table-up-foot`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},z={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},B={AFTER_TABLE_RESIZE:`after-table-resize`,TABLE_SELECTION_DRAG_START:`table-selection-drag-start`,TABLE_SELECTION_DRAG_END:`table-selection-drag-end`,TABLE_SELECTION_CHANGE:`table-selection-change`,TABLE_SELECTION_DISPLAY_CHANGE:`table-selection-display-change`},V={moduleName:`table-up`,tableSelectionName:`table-selection`},ce=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],le=`table-up`,ue=new Set([R.tableCellInner]),de=function(e){return ue.has(e.statics.blotName)};function fe(e){return e!=null&&e.parent?de(e.parent)?!0:fe(e.parent):!1}function H(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:le,n=t?`${t}-`:``;return{b:function(){return`${n}${e}`},be:function(t){return t?`${n}${e}__${t}`:``},bm:function(t){return t?`${n}${e}--${t}`:``},bem:function(t,r){return t&&r?`${n}${e}__${t}--${r}`:``},ns:function(e){return e?`${n}${e}`:``},bs:function(t){return t?`${n}${e}-${t}`:``},cv:function(e){return e?`--${n}${e}`:``},is:function(e){return`is-${e}`}}}function U(e,t){for(var n=e.parent;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function pe(e,t){for(var n=Array(t.length),r=new Map(t.map(function(e,t){return[e,t]})),i=e.parent;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){var a=r.get(i.statics.blotName);n[a]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function me(e){for(var t=new Map,n=e;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function he(e,t){for(var n=[],r=e.children.iterator(),i=null;i=r();)i instanceof t&&n.push(i);return n}function ge(e,t,n){var r=b(Object.getOwnPropertyNames(t)),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;n!=null&&n.test(a)||Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}}catch(e){r.e(e)}finally{r.f()}return e}function _e(e,t){var n=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(e),r=b(t),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;ge(n.prototype,a.prototype,/^constructor$/)}}catch(e){r.e(e)}finally{r.f()}return n}function ve(e,t){return e.prototype&&e.prototype instanceof t}function ye(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function be(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function xe(e){return e=e.startsWith(`#`)?e.slice(1):e,{r:Number.parseInt(e.slice(0,2),16),g:Number.parseInt(e.slice(2,4),16),b:Number.parseInt(e.slice(4,6),16),a:Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2))}}function Se(e){var t=e.r,n=e.g,r=e.b,i=e.a;t=ye(t,255),n=ye(n,255),r=ye(r,255);var a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function Ce(e){var t=e.h,n=e.s,r=e.b,i=e.a;t=ye(t,360)*6,n=ye(n,100),r=ye(r,100);var a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function we(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(var n in t)t[n].length===1&&(t[n]=`0${t[n]}`);return t.join(``)}var Te=function(e){return we(Ce(e))},Ee=function(e){return typeof e==`function`},De=Array.isArray,Oe=function(e){return typeof e==`string`},ke=function(e){return typeof e==`number`},Ae=function(e){return e!==null&&ae(e)===`object`},je=function(e){return e===void 0},Me=function(e){return!Number.isNaN(e)&&Number(e)>0},Ne=function(e){return De(e)?e:[e]};function Pe(e){var t=e||{},n=t.type,r=n===void 0?`default`:n,i=t.content,a=H(`button`),o=document.createElement(`button`);return o.classList.add(a.b(),r),i&&(Oe(i)?o.textContent=i:o.appendChild(i)),o}function Fe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=230,n=150,r=10,i=Se(xe(e.color||`#ff0000`)),a=H(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());var s=document.createElement(`div`);s.classList.add(a.be(`content`));var c=document.createElement(`div`);c.classList.add(a.be(`selector`));var l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);var u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);var d=document.createElement(`div`);d.classList.add(a.be(`alpha`));var f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));var p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);var m=document.createElement(`div`);m.classList.add(a.be(`hue`));var h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);var g=document.createElement(`div`);g.classList.add(a.be(`action`));var _=F([`r`,`g`,`b`,`a`].map(function(e){var t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);var n=document.createElement(`label`);n.textContent=e.toUpperCase();var r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,function(){r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,function(){var t=Math.round(Number(r.value));e===`a`&&(t/=100),ee(be(Se(Object.assign({},Ce(i),x({},e,t))))),N()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r}),4),v=_[0],y=_[1],S=_[2],C=_[3];s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);var w=!1,T=!1,E=!1;function D(){var e=Te(i),t=b([v,y,S].entries()),n;try{for(t.s();!(n=t.n()).done;){var r=F(n.value,2),a=r[0],o=r[1];o.value=String(Number.parseInt(e[a*2]+e[a*2+1],16))}}catch(e){t.e(e)}finally{t.f()}C.value=String((i.a*100).toFixed(0))}function O(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function k(){c.style.backgroundColor=`#${we(Ce({h:i.h,s:100,b:100,a:1}))}`}function A(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function j(){p.style.left=`${i.a*100}%`}function M(){var e=Ce(i),t=e.r,n=e.g,r=e.b;f.style.background=`linear-gradient(to right, rgba(${t}, ${n}, ${r}, 0) 0%, rgba(${t}, ${n}, ${r}, 1) 100%)`}function N(){O(),k(),A(),j(),M(),D()}function ee(t){i=be(Object.assign({},i,t)),D(),e.onChange&&e.onChange(`#${Te(i)}`)}function P(e){var r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft;ee({s:Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),b:Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n)}),N()}function te(e){var t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);ee({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),N()}function ne(e){var t=e.pageX,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),ee({a:Math.round((i-10/2)/(n.width-10)*100)/100}),N()}function I(e){w&&(e.preventDefault(),P(e)),T&&(e.preventDefault(),te(e)),E&&(e.preventDefault(),ne(e))}function L(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L),w=!1}function re(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L),w=!0,P(e)}c.addEventListener(`mousedown`,re);function ie(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,ie),T=!1}function ae(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,ie),T=!0,te(e)}m.addEventListener(`mousedown`,ae);function oe(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,oe),E=!1}function se(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,oe),E=!0,ne(e)}return d.addEventListener(`mousedown`,se),N(),o}var Ie=8e3;function Le(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.child,n=e.target,r=n===void 0?document.body:n,i=e.beforeClose,a=i===void 0?function(){}:i,o=H(`dialog`),s=r,c=document.createElement(`div`);c.classList.add(o.b()),c.style.zIndex=String(Ie);var l=document.createElement(`div`);if(l.classList.add(o.be(`overlay`)),c.appendChild(l),t){var u=document.createElement(`div`);u.classList.add(o.be(`content`)),u.appendChild(t),l.appendChild(u),u.addEventListener(`click`,function(e){e.stopPropagation()})}var d=getComputedStyle(s).overflow;s.style.overflow=`hidden`,s.appendChild(c);var f=function(){a(),c.remove(),s.style.overflow=d};return c.addEventListener(`click`,f),Ie+=1,{dialog:c,close:f}}function Re(e){return ze.apply(this,arguments)}function ze(){return ze=h(P().mark(function e(t){var n,r,i;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.message,r=t.confirm,i=t.cancel,e.abrupt(`return`,new Promise(function(e){var t=document.createElement(`div`);Object.assign(t.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});var a=document.createElement(`p`);a.textContent=n;var o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});var s=Pe({content:i}),c=Pe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Le({child:t}).close;s.addEventListener(`click`,function(){e(!1),l()}),c.addEventListener(`click`,function(){e(!0),l()})}));case 1:case`end`:return e.stop()}},e)})),ze.apply(this,arguments)}function Be(e,t){var n=H(`input`);t.type||(t.type=`text`),t.value||(t.value=``);var r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){var i=document.createElement(`span`);i.classList.add(n.be(`label`)),i.textContent=e,r.appendChild(i)}var a=document.createElement(`div`);a.classList.add(n.be(`input`));var o=document.createElement(`input`);for(var s in t)o.setAttribute(s,t[s]);return(t.max||t.min)&&o.addEventListener(`blur`,function(){t.max&&t.max<=Number(o.value)&&(o.value=String(t.max)),t.min&&t.min>=Number(o.value)&&(o.value=String(t.min))}),a.appendChild(o),r.appendChild(a),o.addEventListener(`focus`,function(){a.classList.add(`focus`)}),o.addEventListener(`blur`,function(){a.classList.remove(`focus`)}),{item:r,input:o,errorTip:function(e){var t;return a.classList.contains(`error`)?t=a.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),a.appendChild(t)),t.textContent=e,a.classList.add(`error`),{removeError:function(){a.classList.remove(`error`),t.remove()}}}}}function Ve(){return He.apply(this,arguments)}function He(){return He=h(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=arguments;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&v[0]!==void 0?v[0]:{},n=H(`creator`),r=document.createElement(`div`),r.classList.add(n.b()),i=document.createElement(`div`),i.classList.add(n.be(`input`)),a=Be(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=Be(t.colText||`Column`,{type:`number`,value:String(t.col||``),max:99}),u=l.item,d=l.input,f=l.errorTip,i.appendChild(o),i.appendChild(u),r.appendChild(i),p=document.createElement(`div`),p.classList.add(n.be(`control`)),m=Pe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Pe({type:`default`,content:t.cancelText||`Cancel`}),p.appendChild(m),p.appendChild(h),r.appendChild(p),g=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number(s.value),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number(d.value);if(Number.isNaN(e)||e<=0){c(t.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){f(t.notPositiveNumberError||`Please enter a positive integer`);return}return{row:e,col:n}},_=function(e){e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,_))},e.abrupt(`return`,new Promise(function(e,t){var n=Le({child:r,beforeClose:t}).close;s.focus();for(var i=0,a=[s,d];i<a.length;i++)a[i].addEventListener(`keydown`,function(t){if(t.key===`Enter`){var r=g();r&&(e(r),n())}});m.addEventListener(`click`,function(){var t=g();t&&(e(t),n())}),document.addEventListener(`keydown`,_),h.addEventListener(`click`,n)}).finally(function(){document.removeEventListener(`keydown`,_)}));case 1:case`end`:return e.stop()}},e)})),He.apply(this,arguments)}function Ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=H(`select-box`),n=document.createElement(`span`);n.classList.add(t.b());var r=document.createElement(`span`);r.classList.add(t.be(`block`));for(var i=0;i<(e.row||8);i++)for(var a=0;a<(e.col||8);a++){var o=document.createElement(`span`);o.classList.add(t.be(`item`)),o.dataset.row=String(i+1),o.dataset.col=String(a+1),r.appendChild(o)}var s=function(){for(var e=n.dataset,t=e.row,i=e.col,a=0,o=Array.from(r.querySelectorAll(`.active`));a<o.length;a++)o[a].classList.remove(`active`);if(!(!t||!i))for(var s=Array.from(r.children),c=0,l=s;c<l.length;c++){var u=l[c],d=u.dataset,f=d.row,p=d.col;if(f>t&&p>i)return;u.classList.toggle(`active`,f<=t&&p<=i)}};if(r.addEventListener(`mousemove`,function(e){if(e.target){var t=e.target.dataset,r=t.row,i=t.col;!r||!i||(n.dataset.row=r,n.dataset.col=i,s())}}),r.addEventListener(`mouseleave`,function(){n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),s()}),r.addEventListener(`click`,function(){var t,r=n.dataset,i=r.row,a=r.col;!i||!a||(t=e.onSelect)==null||t.call(e,Number(i),Number(a))}),n.appendChild(r),e.customBtn){var c=e.texts||{},l=document.createElement(`span`);l.classList.add(t.be(`custom`)),l.textContent=c.customBtnText||`Custom`,l.addEventListener(`click`,h(P().mark(function t(){var n,r;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,Ve(c);case 1:n=t.sent,n&&((r=e.onSelect)==null||r.call(e,n.row,n.col));case 2:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function We(e){"@babel/helpers - typeof";return We=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},We(e)}function Ge(e,t){if(We(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(We(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ke(e){var t=Ge(e,`string`);return We(t)==`symbol`?t:t+``}function qe(e,t,n){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Je(Object(n),!0).forEach(function(t){qe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Ye=Math.min,Xe=Math.max,Ze=Math.round,Qe=Math.floor,$e=e=>({x:e,y:e}),et={left:`right`,right:`left`,bottom:`top`,top:`bottom`},tt={start:`end`,end:`start`};function nt(e,t,n){return Xe(e,Ye(t,n))}function rt(e,t){return typeof e==`function`?e(t):e}function it(e){return e.split(`-`)[0]}function at(e){return e.split(`-`)[1]}function ot(e){return e===`x`?`y`:`x`}function st(e){return e===`y`?`height`:`width`}let ct=new Set([`top`,`bottom`]);function lt(e){return ct.has(it(e))?`y`:`x`}function ut(e){return ot(lt(e))}function dt(e,t,n){n===void 0&&(n=!1);let r=at(e),i=ut(e),a=st(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bt(o)),[o,bt(o)]}function ft(e){let t=bt(e);return[pt(e),t,pt(t)]}function pt(e){return e.replace(/start|end/g,e=>tt[e])}let mt=[`left`,`right`],ht=[`right`,`left`],gt=[`top`,`bottom`],_t=[`bottom`,`top`];function vt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ht:mt:t?mt:ht;case`left`:case`right`:return t?gt:_t;default:return[]}}function yt(e,t,n,r){let i=at(e),a=vt(it(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pt)))),a}function bt(e){return e.replace(/left|right|bottom|top/g,e=>et[e])}function xt(e){return W({top:0,right:0,bottom:0,left:0},e)}function St(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xt(e)}function Ct(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wt(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Tt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){wt(a,r,i,o,s,`next`,e)}function s(e){wt(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Et(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Dt(e,t){if(e==null)return{};var n,r,i=Et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let Ot=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],kt=[`mainAxis`,`crossAxis`,`limiter`];function At(e,t,n){let{reference:r,floating:i}=e,a=lt(t),o=ut(t),s=st(o),c=it(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(at(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}function jt(e,t){return Mt.apply(this,arguments)}function Mt(){return Mt=Tt(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=rt(t,e),m=St(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=Ct(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(h))==null||n?h:h.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),y=(yield a.isElement==null?void 0:a.isElement(v))&&(yield a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=Ct(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}),Mt.apply(this,arguments)}let Nt=function(){var e=Tt(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=At(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){var h;let{name:a,fn:g}=s[n],{x:_,y:v,data:y,reset:b}=yield g({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:W(W({},o),{},{detectOverflow:(h=o.detectOverflow)==null?jt:h}),elements:{reference:e,floating:t}});u=_==null?u:_,d=v==null?d:v,p=W(W({},p),{},{[a]:W(W({},p[a]),y)}),b&&m<=50&&(m++,typeof b==`object`&&(b.placement&&(f=b.placement),b.rects&&(l=b.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):b.rects),{x:u,y:d}=At(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}(),Pt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return Tt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=rt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=Dt(u,Ot);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=it(i),y=lt(s),b=it(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[bt(s)]:ft(s)),C=h!==`none`;!p&&C&&S.push(...yt(s,g,h,x));let w=[s,...S],T=yield c.detectOverflow(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=dt(i,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:i,overflows:E}],!E.every(e=>e<=0)){var O,k;let e=(((O=a.flip)==null?void 0:O.index)||0)+1,t=w[e];if(t&&(!(f===`alignment`&&y!==lt(t))||D.every(e=>lt(e.placement)===y?e.overflows[0]>0:!0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=(k=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:k.placement;if(!n)switch(m){case`bestFit`:{var A;let e=(A=D.filter(e=>{if(C){let t=lt(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:A[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}},Ft=new Set([`left`,`top`]);function It(e,t){return Lt.apply(this,arguments)}function Lt(){return Lt=Tt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=it(n),s=at(n),c=lt(n)===`y`,l=Ft.has(o)?-1:1,u=a&&c?-1:1,d=rt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),Lt.apply(this,arguments)}let Rt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return Tt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield It(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:W(W({},c),{},{placement:o})}})()}}},zt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return Tt(function*(){let{x:n,y:r,placement:i,platform:a}=t,o=rt(e,t),{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=o,u=Dt(o,kt),d={x:n,y:r},f=yield a.detectOverflow(t,u),p=lt(it(i)),m=ot(p),h=d[m],g=d[p];if(s){let e=m===`y`?`top`:`left`,t=m===`y`?`bottom`:`right`,n=h+f[e],r=h-f[t];h=nt(n,h,r)}if(c){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=g+f[e],r=g-f[t];g=nt(n,g,r)}let _=l.fn(W(W({},t),{},{[m]:h,[p]:g}));return W(W({},_),{},{data:{x:_.x-n,y:_.y-r,enabled:{[m]:s,[p]:c}}})})()}}},Bt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=rt(e,t),u={x:n,y:r},d=lt(i),f=ot(d),p=u[f],m=u[d],h=rt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:W({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=Ft.has(it(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function Vt(){return typeof window<`u`}function Ht(e){return Gt(e)?(e.nodeName||``).toLowerCase():`#document`}function Ut(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wt(e){var t;return(t=(Gt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gt(e){return Vt()?e instanceof Node||e instanceof Ut(e).Node:!1}function Kt(e){return Vt()?e instanceof Element||e instanceof Ut(e).Element:!1}function qt(e){return Vt()?e instanceof HTMLElement||e instanceof Ut(e).HTMLElement:!1}function Jt(e){return!Vt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ut(e).ShadowRoot}let Yt=new Set([`inline`,`contents`]);function Xt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=un(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Yt.has(i)}let Zt=new Set([`table`,`td`,`th`]);function Qt(e){return Zt.has(Ht(e))}let $t=[`:popover-open`,`:modal`];function en(e){return $t.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let tn=[`transform`,`translate`,`scale`,`rotate`,`perspective`],nn=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],rn=[`paint`,`layout`,`strict`,`content`];function an(e){let t=sn(),n=Kt(e)?un(e):e;return tn.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||nn.some(e=>(n.willChange||``).includes(e))||rn.some(e=>(n.contain||``).includes(e))}function on(e){let t=fn(e);for(;qt(t)&&!ln(t);){if(an(t))return t;if(en(t))return null;t=fn(t)}return null}function sn(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let cn=new Set([`html`,`body`,`#document`]);function ln(e){return cn.has(Ht(e))}function un(e){return Ut(e).getComputedStyle(e)}function dn(e){return Kt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fn(e){if(Ht(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Jt(e)&&e.host||Wt(e);return Jt(t)?t.host:t}function pn(e){let t=fn(e);return ln(t)?e.ownerDocument?e.ownerDocument.body:e.body:qt(t)&&Xt(t)?t:pn(t)}function mn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=pn(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ut(i);if(a){let e=hn(o);return t.concat(o,o.visualViewport||[],Xt(i)?i:[],e&&n?mn(e):[])}return t.concat(i,mn(i,[],n))}function hn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gn(e){let t=un(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ze(n)!==a||Ze(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _n(e){return Kt(e)?e:e.contextElement}function vn(e){let t=_n(e);if(!qt(t))return $e(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gn(t),o=(a?Ze(n.width):n.width)/r,s=(a?Ze(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let yn=$e(0);function bn(e){let t=Ut(e);return!sn()||!t.visualViewport?yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ut(e)?!1:t}function Sn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_n(e),o=$e(1);t&&(r?Kt(r)&&(o=vn(r)):o=vn(e));let s=xn(a,n,r)?bn(a):$e(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ut(a),t=r&&Kt(r)?Ut(r):r,n=e,i=hn(n);for(;i&&r&&t!==n;){let e=vn(i),t=i.getBoundingClientRect(),r=un(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ut(i),i=hn(n)}}return Ct({width:u,height:d,x:c,y:l})}function Cn(e,t){let n=dn(e).scrollLeft;return t?t.left+n:Sn(Wt(e)).left+n}function wn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Cn(e,n),y:n.top+t.scrollTop}}function Tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Wt(r),s=t?en(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$e(1),u=$e(0),d=qt(r);if((d||!d&&!a)&&((Ht(r)!==`body`||Xt(o))&&(c=dn(r)),qt(r))){let e=Sn(r);l=vn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wn(o,c):$e(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function En(e){return Array.from(e.getClientRects())}function Dn(e){let t=Wt(e),n=dn(e),r=e.ownerDocument.body,i=Xe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Cn(e),s=-n.scrollTop;return un(r).direction===`rtl`&&(o+=Xe(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function On(e,t){let n=Ut(e),r=Wt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=sn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Cn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let kn=new Set([`absolute`,`fixed`]);function An(e,t){let n=Sn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=qt(e)?vn(e):$e(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function jn(e,t,n){let r;if(t===`viewport`)r=On(e,n);else if(t===`document`)r=Dn(Wt(e));else if(Kt(t))r=An(t,n);else{let n=bn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ct(r)}function Mn(e,t){let n=fn(e);return n===t||!Kt(n)||ln(n)?!1:un(n).position===`fixed`||Mn(n,t)}function Nn(e,t){let n=t.get(e);if(n)return n;let r=mn(e,[],!1).filter(e=>Kt(e)&&Ht(e)!==`body`),i=null,a=un(e).position===`fixed`,o=a?fn(e):e;for(;Kt(o)&&!ln(o);){let t=un(o),n=an(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&kn.has(i.position)||Xt(o)&&!n&&Mn(e,o))?r=r.filter(e=>e!==o):i=t,o=fn(o)}return t.set(e,r),r}function Pn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?en(t)?[]:Nn(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=jn(t,n,i);return e.top=Xe(r.top,e.top),e.right=Ye(r.right,e.right),e.bottom=Ye(r.bottom,e.bottom),e.left=Xe(r.left,e.left),e},jn(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Fn(e){let{width:t,height:n}=gn(e);return{width:t,height:n}}function In(e,t,n){let r=qt(t),i=Wt(t),a=n===`fixed`,o=Sn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$e(0);function l(){c.x=Cn(i)}if(r||!r&&!a)if((Ht(t)!==`body`||Xt(i))&&(s=dn(t)),r){let e=Sn(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?wn(i,s):$e(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ln(e){return un(e).position===`static`}function Rn(e,t){if(!qt(e)||un(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Wt(e)===n&&(n=n.ownerDocument.body),n}function zn(e,t){let n=Ut(e);if(en(e))return n;if(!qt(e)){let t=fn(e);for(;t&&!ln(t);){if(Kt(t)&&!Ln(t))return t;t=fn(t)}return n}let r=Rn(e,t);for(;r&&Qt(r)&&Ln(r);)r=Rn(r,t);return r&&ln(r)&&Ln(r)&&!an(r)?n:r||on(e)||n}let Bn=function(){var e=Tt(function*(e){let t=this.getOffsetParent||zn,n=this.getDimensions,r=yield n(e.floating);return{reference:In(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function Vn(e){return un(e).direction===`rtl`}let Hn={convertOffsetParentRelativeRectToViewportRelativeRect:Tn,getDocumentElement:Wt,getClippingRect:Pn,getOffsetParent:zn,getElementRects:Bn,getClientRects:En,getDimensions:Fn,getScale:vn,isElement:Kt,isRTL:Vn};function Un(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wn(e,t){let n=null,r,i=Wt(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qe(d),h=Qe(i.clientWidth-(u+f)),g=Qe(i.clientHeight-(d+p)),_=Qe(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xe(0,Ye(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Un(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,W(W({},v),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Gn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_n(e),u=i||a?[...l?mn(l):[],...mn(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Wn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Sn(e):null;c&&g();function g(){let t=Sn(e);h&&!Un(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d==null||d(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Kn=Rt,qn=zt,Jn=Pt,Yn=Bt,Xn=(e,t,n)=>{let r=new Map,i=W({platform:Hn},n),a=W(W({},i.platform),{},{_c:r});return Nt(e,t,W(W({},i),{},{platform:a}))};function Zn(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Qn=4;function $n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.msg,r=n===void 0?``:n,i=t.delay,a=i===void 0?150:i,o=t.content,s=t.direction,c=s===void 0?`bottom`:s,l=t.type,u=l===void 0?`hover`:l,d=t.container,f=t.onOpen,p=t.onClose,m=t.closed,h=t.onDestroy,g=H(`tooltip`);if(r||o){var _=d||document.body,v=document.createElement(`div`);v.classList.add(g.b(),`hidden`,`transparent`),o?v.appendChild(o):r&&(v.textContent=r);var y,b,x,S=function(){x&&x(),Xn(e,v,{placement:c,middleware:[Jn(),qn({limiter:Yn()}),Kn(Qn)]}).then(function(e){var t=e.x,n=e.y;Object.assign(v.style,{left:`${t}px`,top:`${n}px`})})},C=function(){v.classList.add(`hidden`),_.contains(v)&&_.removeChild(v),x&&x(),m&&m()},w=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;b&&clearTimeout(b),y=setTimeout(function(){if(f){var n=f(t);if(!t&&n)return}_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=Gn(e,v,S),v.classList.remove(`transparent`)},a)},T=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;y&&clearTimeout(y),b=setTimeout(function(){if(p){var t=p(e);if(!e&&t)return}Zn(v,150,C,{once:!0}),v.classList.add(`transparent`)},a)},E={hover:function(){var t=[e,v],n=T.bind(void 0,!1),r=w.bind(void 0,!1);return{prepare:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.addEventListener(`mouseenter`,r),a.addEventListener(`mouseleave`,n)}},show:w,hide:T,destroy:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.removeEventListener(`mouseenter`,r),a.removeEventListener(`mouseleave`,n)}}}},click:function(){var t=function(e){e.stopPropagation(),T(!1)},n=function(e){e.stopPropagation(),w(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:function(){v.addEventListener(`click`,function(e){return e.stopPropagation()}),e.addEventListener(`click`,n)},show:w,hide:function(){T(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1),document.removeEventListener(`click`,t)},destroy:function(){e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}}}[u](),D=E.prepare,O=E.show,k=E.hide,A=E.destroy;return D(),{show:O,hide:k,destroy:function(){k(!0),h&&h(),A(),x&&x(),v.remove()}}}return null}function er(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.axis,r=n===void 0?`both`:n,i=t.onMove,a=i===void 0?function(){}:i,o=t.onStart,s=o===void 0?function(){}:o,c=t.onEnd,l=c===void 0?function(){}:c,u=t.buttons,d=u===void 0?[0]:u,f=t.container,p=t.draggingElement,m=p===void 0?document:p,h=t.exact,g=h===void 0?!0:h,_={x:0,y:0},v,y={x:0,y:0};function b(t){if(v){var n=e.getBoundingClientRect(),i=_,a=i.x,o=i.y;(r===`x`||r===`both`)&&(a=t.clientX-v.x,f&&(a=Math.min(Math.max(0,a),f.scrollWidth-n.width))),(r===`y`||r===`both`)&&(o=t.clientY-v.y,f&&(o=Math.min(Math.max(0,o),f.scrollHeight-n.height))),_={x:a,y:o}}}function x(t){var n;if(d.includes(t.button)&&!(g&&t.target!==e)){m.addEventListener(`pointerup`,C),m.addEventListener(`pointermove`,S);var r=f==null||(n=f.getBoundingClientRect)==null?void 0:n.call(f),i=e.getBoundingClientRect(),a={x:t.clientX-(f?i.left-r.left+f.scrollLeft:i.left),y:t.clientY-(f?i.top-r.top+f.scrollTop:i.top)};y={x:t.clientX,y:t.clientY},s({position:_,startPosition:a,movePosition:{x:t.clientX-y.x,y:t.clientY-y.y}},t)!==!1&&(v=a,_=a)}}function S(e){v&&(b(e),a({position:_,startPosition:v,movePosition:{x:e.clientX-y.x,y:e.clientY-y.y}},e))}function C(e){m.removeEventListener(`pointermove`,S),m.removeEventListener(`pointerup`,C),b(e),l({position:_,startPosition:v,movePosition:{x:e.clientX-y.x,y:e.clientY-y.y}},e),v=void 0,y={x:0,y:0},_={x:0,y:0}}return m.addEventListener(`pointerdown`,x),{stop:function(){m.removeEventListener(`pointerdown`,x)}}}function tr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=e.x,a=e.y,o=e.x1,s=e.y1,c=t.x,l=t.y,u=t.x1,d=t.y1,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function nr(e,t){var n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}var rr=8;function ir(e){var t=e.left,n=e.top,r=e.width,i=e.height,a=document.documentElement,o=a.clientWidth,s=a.clientHeight,c=!1,l=!1;return t+r>o?(t=o-r-rr,c=!0):t<0&&(t=rr,c=!0),n+i>s?(n=s-i-rr,l=!0):n<0&&(n=rr,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function ar(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(function(r){t.ignoreFirstBind&&r.some(function(e){var t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe.bind(i);i.observe=function(e,t){r.add(e),a(e,t)};var o=i.unobserve;i.unobserve=function(e){r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};var s=i.disconnect;return i.disconnect=function(){var e=b(r.values()),t;try{for(e.s();!(t=e.n()).done;){var a=t.value;a[n]=void 0}}catch(t){e.e(t)}finally{e.f()}s.call(i)},i}function or(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function sr(e,t){for(var n=0;n<this.scrollHandler.length;n++){var r=F(this.scrollHandler[n],2),i=r[0],a=r[1];if(i===e&&a===t){this.scrollHandler.splice(n,1);break}}}function cr(){var e=b(this.scrollHandler),t;try{for(e.s();!(t=e.n()).done;){var n=F(t.value,2),r=n[0],i=n[1];r.removeEventListener(`scroll`,i)}}catch(t){e.e(t)}finally{e.f()}this.scrollHandler=[]}function lr(e){return{y:e.scrollTop,x:e.scrollLeft}}function ur(){var e,t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).target,n=t===void 0?document.body:t,r=document.createElement(`div`);Object.assign(r.style,{visibility:`hidden`,width:`100px`,height:`100%`,overflow:`auto`,position:`absolute`,top:`-9999px`}),n.appendChild(r);var i=r.offsetWidth;r.style.overflow=`scroll`;var a=document.createElement(`div`);a.style.width=`100%`,r.appendChild(a);var o=a.offsetWidth;return(e=r.parentNode)==null||e.removeChild(r),i-o}var dr=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:50,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:20;_(this,e),x(this,`scrollThresholdX`,void 0),x(this,`scrollThresholdY`,void 0),x(this,`maxScrollSpeed`,void 0),x(this,`mouseY`,0),x(this,`mouseX`,0),x(this,`animationId`,null),this.scrollThresholdX=t,this.scrollThresholdY=n,this.maxScrollSpeed=r}return y(e,[{key:`checkMinY`,value:function(e){return this.mouseY<e.top+this.scrollThresholdY}},{key:`checkMaxY`,value:function(e){return this.mouseY>e.bottom-this.scrollThresholdY}},{key:`checkMinX`,value:function(e){return this.mouseX<e.left+this.scrollThresholdX}},{key:`checkMaxX`,value:function(e){return this.mouseX>e.right-this.scrollThresholdX}},{key:`start`,value:function(e,t){var n=this,r=e.getBoundingClientRect(),i=function(){var a=!1,o=0,s=0;if(n.checkMinY(r)){var c=r.top+n.scrollThresholdY-n.mouseY,l=Math.min(c/n.scrollThresholdY*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollTop-=l,s=-1*l,a=!0}else if(n.checkMaxY(r)){var u=n.mouseY-(r.bottom-n.scrollThresholdY),d=Math.min(u/n.scrollThresholdY*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollTop+=d,s=d,a=!0}if(n.checkMinX(r)){var f=r.left+n.scrollThresholdX-n.mouseX,p=Math.min(f/n.scrollThresholdX*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollLeft-=p,o=-1*p,a=!0}else if(n.checkMaxX(r)){var m=n.mouseX-(r.right-n.scrollThresholdX),h=Math.min(m/n.scrollThresholdX*n.maxScrollSpeed,n.maxScrollSpeed);e.scrollLeft+=h,o=h,a=!0}a&&t&&t(o,s),n.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}},{key:`updateMousePosition`,value:function(e,t){this.mouseX=e,this.mouseY=t}},{key:`stop`,value:function(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}}])}();function fr(e){return e.replaceAll(/([A-Z])/g,` $1`).trim().split(` `).join(`-`).toLowerCase()}function pr(e){return e.replaceAll(/-(\w)/g,function(e,t){return t.toUpperCase()})}function mr(e){var t={};if(!e.style.cssText)return t;var n=b(e.style.cssText.split(`;`).filter(function(e){return e.trim()})),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,a).trim();t[o]=i.slice(a+1).trim()}}}catch(e){n.e(e)}finally{n.f()}return t}function hr(e){var t={},n=b(e.trim().split(`;`)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value.trim();if(i){var a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,Math.max(0,a)).trim(),s=i.slice(Math.max(0,a+1)).trim();t[pr(o)]=s}}}}catch(e){n.e(e)}finally{n.f()}return t}function gr(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${fr(n)}: ${r};`}).join(` `)}var G=function(){return Math.random().toString(36).slice(2)};function _r(e,t){var n;return function(){for(var r=this,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,a)},t)}}var vr=t.default.import(`parchment`),yr=t.default.import(`blots/container`),br=t.default.import(`blots/block`),xr=t.default.import(`blots/block/embed`),K=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n);var r=this.statics.allowDataAttrsChangeHandler[e];r&&Ee(this[r])&&this[r](t)}}},{key:`optimize`,value:function(e){if(this.children.length===0)if(this.statics.defaultChild!=null){var t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`enforceAllowedChildren`,value:function(){var e=this;this.children.forEach(function(n){e.statics.allowedChildren.some(function(e){return n instanceof e})||(n.statics.scope===vr.Scope.BLOCK_BLOT?(n.parent instanceof t?(n.next!=null&&n.parent.splitAfter(n),n.prev!=null&&n.parent.splitAfter(n.prev)):(n.next!=null&&e.splitAfter(n),n.prev!=null&&e.splitAfter(n.prev)),n.parent.unwrap()):n instanceof vr.ParentBlot?n.unwrap():n.remove())})}}],[{key:`create`,value:function(e){var t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}}])}(yr);x(K,`tagName`,void 0),x(K,`blotName`,R.container),x(K,`scope`,vr.Scope.BLOCK_BLOT),x(K,`allowedChildren`,[br,xr,yr]),x(K,`requiredContainer`,void 0),x(K,`defaultChild`,void 0),x(K,`allowAttrs`,new Set),x(K,`allowDataAttrs`,new Set),x(K,`allowDataAttrsChangeHandler`,{});var Sr=function(e){return Me(e)?e:1};function Cr(e,t){return Object.keys(e).every(function(n){return JSON.stringify(e[n])===JSON.stringify(t[n])})}var wr=t.default.import(`parchment`),Tr=t.default.import(`blots/block`),Er=t.default.import(`blots/block/embed`),Dr=t.default.import(`blots/container`),Or=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`replaceWith`,value:function(e,t){var n=Oe(e)?this.scroll.create(e,t):e;if(n instanceof wr.ParentBlot)if(n.statics.blotName===R.tableCellInner){var r=null;try{if(r=U(this,R.tableCellInner),Cr(r.formats(),n.formats()))return r}catch(e){}if(r)r.insertBefore(n,this),n.appendChild(this),r.children.length===0&&r.remove();else{for(var i=this,a=i;i.parent!==this.scroll&&i.parent instanceof Dr;)a=i,i=i.parent;i===this.scroll&&(i=a);var o=this.offset(i),s=this.length(),c=i.isolate(o,s);c!=null&&c.parent&&c.parent.insertBefore(n,c.next),n.appendChild(this)}return n}else this.moveChildren(n);return this.parent!==null&&(this.parent.insertBefore(n,this.next),this.remove()),this.attributes.copy(n),n}},{key:`format`,value:function(e,n){if(e===R.tableCellInner&&this.parent.statics.blotName===e&&!n){if(this.prev&&this.prev instanceof Er)return;try{U(this,R.tableCellInner).unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}}else I(t,`format`,this,3)([e,n])}}])}(Tr),kr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`delta`,value:function(){var e=I(t,`delta`,this,3)([]),n=Ar(this);return n[R.tableCellInner]&&e.insert(`
5
5
  `,x({},R.tableCellInner,n[R.tableCellInner])),e}},{key:`length`,value:function(){return Ar(this)[R.tableCellInner]?I(t,`length`,this,3)([])+1:I(t,`length`,this,3)([])}},{key:`formatAt`,value:function(e,t,n,r){if(n===R.tableCellInner)try{var i=U(this,R.tableCellInner),a=this.scroll.create(R.tableCellInner,r);i.insertBefore(a,this),a.appendChild(this),i.length()===0&&i.remove()}catch(e){}else this.format(n,r)}}])}(t.default.import(`blots/block/embed`));function Ar(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e==null||(`formats`in e&&typeof e.formats==`function`&&(t=j(j({},t),e.formats()),n&&delete t[`code-token`]),e.parent==null||e.parent.statics.blotName===`scroll`||e.parent.statics.scope!==e.statics.scope)?t:Ar(e.parent,t,n)}var jr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==R.tableMain){var r=this.tableId;this.wrap(R.tableMain,{tableId:r})}I(t,`optimize`,this,3)([e])}},{key:`convertBody`,value:function(e){var t=b(this.descendants(q)),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;r.wrapTag=e}}catch(e){t.e(e)}finally{t.f()}}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e,n}}])}(K);x(jr,`blotName`,R.tableBody),x(jr,`tagName`,`tbody`);var Mr=t.default.import(`blots/block`),Nr=t.default.import(`blots/block/embed`),q=function(e){function t(e,n,r){var i;return _(this,t),i=g(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i}return w(t,e),y(t,[{key:`setFormatValue`,value:function(e,n){var r;if(arguments.length>2&&arguments[2]!==void 0&&arguments[2]){if(!this.statics.isAllowStyle(e))return}else I(t,`setFormatValue`,this,3)([e,n]);((r=this.parent)==null?void 0:r.statics.blotName)===R.tableCell&&this.parent.setFormatValue(e,n),this.clearCache()}},{key:`clearCache`,value:function(){var e=b(this.descendants(Mr,0)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.cache={}}}catch(t){e.e(t)}finally{e.f()}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId},set:function(e){this.setFormatValue(`row-id`,e)}},{key:`colId`,get:function(){return this.domNode.dataset.colId},set:function(e){this.setFormatValue(`col-id`,e)}},{key:`rowspan`,get:function(){return Number(this.domNode.dataset.rowspan)},set:function(e){this.setFormatValue(`rowspan`,e)}},{key:`colspan`,get:function(){return Number(this.domNode.dataset.colspan)},set:function(e){this.setFormatValue(`colspan`,e)}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}},set:function(e){if(this.emptyRow.toString()!==e.toString())try{e.length>0?this.setFormatValue(`empty-row`,JSON.stringify(e),!1):this.setFormatValue(`empty-row`,null,!1)}catch(e){this.setFormatValue(`empty-row`,null,!1)}}},{key:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`},set:function(e){this.setFormatValue(`wrap-tag`,e)}},{key:`getColumnIndex`,value:function(){return U(this,R.tableMain).getColIds().indexOf(this.colId)}},{key:`getRowIndex`,value:function(){return U(this,R.tableMain).getRowIds().indexOf(this.rowId)}},{key:`getTableBody`,value:function(){for(var e=this.parent;e&&!(e instanceof jr)&&e!==this.scroll;)e=e.parent;return e===this.scroll?null:e}},{key:`getTableRow`,value:function(){try{return U(this,R.tableRow)}catch(e){return null}}},{key:`setStyleByString`,value:function(e){for(var t=hr(e),n=0,r=Object.entries(t);n<r.length;n++){var i=F(r[n],2),a=i[0],o=i[1];this.setFormatValue(a,o,!0)}}},{key:`convertTableCell`,value:function(){this.parent.statics.blotName===R.tableCell&&(this.parent.convertTableCell(),this.clearCache())}},{key:`formatAt`,value:function(e,n,r,i){if(this.children.length===0){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a),n+=a.length()}I(t,`formatAt`,this,3)([e,n,r,i]),i!=null&&i.style&&this.setStyleByString(i.style)}},{key:`insertAt`,value:function(e,n,r){var i=F(this.children.find(e),1)[0];if(!i&&this.statics.defaultChild){var a=this.scroll.create(this.statics.defaultChild.blotName||`block`);this.appendChild(a)}I(t,`insertAt`,this,3)([e,n,r]),(r==null?this.scroll.create(`text`,n):this.scroll.create(n,r))instanceof Nr&&i&&i.length()<=1&&i.remove()}},{key:`formats`,value:function(){var e=this.statics.formats(this.domNode);return x({},this.statics.blotName,e)}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(){var e=this.parent,t=this.statics.formats(this.domNode);if(this.prev&&this.prev instanceof Nr){var n=this.prev;if(this.insertBefore(n,this.children.head),this.length()<=1){var r=this.scroll.create(`block`);this.insertBefore(r,n.next)}}var i=e!==null&&e.statics.blotName!==R.tableCell;if(i&&(this.wrap(R.tableCell,t),this.children.length===0)){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a)}this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0?this.remove():this.domNode.dataset.style&&i&&e.domNode.style.cssText!==this.domNode.dataset.style&&this.setStyleByString(this.domNode.dataset.style)}},{key:`insertBefore`,value:function(e,n){if(e.statics.blotName===this.statics.blotName){var r=e,i=this.statics.formats(r.domNode),a=this.statics.formats(this.domNode);if(Cr(a,i)){var o=this.split(n?n.offset():0);return this.parent.insertBefore(r,o)}else{var s=F(pe(this,[R.tableRow,R.tableCell]),2),c=s[0],l=s[1],u=l;if(n){var d=n.offset(),f=this.length();if(d!==0&&d<f){var p=this.split(d).wrap(R.tableCell,a);c.insertBefore(p,l.next),u=p}}if(this.tableId!==r.tableId){var m=U(this,R.tableWrapper),h=this.offset(m),g=m.split(h);return m.parent.insertBefore(r,g)}if(this.rowId!==r.rowId){var _=c,v=n;if(v){var y=v.offset(c);_=c.split(y)}var b=this.scroll.create(R.tableRow,i),x=this.scroll.create(R.tableCell,i);return x.appendChild(r),b.appendChild(x),c.parent.insertBefore(b,_)}return c.insertBefore(r.wrap(R.tableCell,i),u)}}else if(e.statics.blotName===R.tableCol){try{var S=U(this,R.tableBody),C=this.offset(S),w=S.split(C);S.parent.insertBefore(e,w),e.optimize({})}catch(e){console.warn(`TableCellInner not in TableBody`)}return}I(t,`insertBefore`,this,3)([e,n])}}],[{key:`isAllowStyle`,value:function(e){var t=pr(e),n=b(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(pr(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=e.tag,u=l===void 0?`td`:l,d=e.wrapTag,f=d===void 0?`tbody`:d,p=I(t,`create`,this,2)([]);p.dataset.tableId=n,p.dataset.rowId=r,p.dataset.colId=i,p.dataset.rowspan=String(Sr(a)),p.dataset.colspan=String(Sr(o)),p.dataset.tag=u,p.dataset.wrapTag=f,s&&(p.dataset.style=s);try{c&&(p.dataset.emptyRow=JSON.stringify(c))}catch(e){}return p}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.rowspan,o=t.colspan,s=t.style,c=t.emptyRow,l=t.tag,u=l===void 0?`td`:l,d=t.wrapTag,f=d===void 0?`tbody`:d,p={tableId:String(n),rowId:String(r),colId:String(i),rowspan:Number(Sr(a)),colspan:Number(Sr(o)),tag:u,wrapTag:f};s&&(p.style=s);try{c&&(p.emptyRow=JSON.parse(c))}catch(e){}return p}}])}(K);x(q,`blotName`,R.tableCellInner),x(q,`tagName`,`div`),x(q,`className`,`ql-table-cell-inner`),x(q,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`,`empty-row`,`wrap-tag`])),x(q,`defaultChild`,Mr),x(q,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Pr=t.default.import(`parchment`),Fr=function(e){function n(){return _(this,n),g(this,n,arguments)}return w(n,e),y(n,[{key:`enable`,value:function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=t.default.import(`formats/${R.tableCellInner}`),i=this.domNode.querySelectorAll(`.${r.className}`),a=0,o=Array.from(i);a<o.length;a++)o[a].setAttribute(`contenteditable`,String(!!e));for(var s=t.default.import(`formats/${R.tableCaption}`),c=this.domNode.querySelectorAll(`.${s.className}`),l=0,u=Array.from(c);l<u.length;l++)u[l].setAttribute(`contenteditable`,String(!!e));I(n,`enable`,this,3)([e])}},{key:`createBlock`,value:function(e,t){var n,r={};if(e[R.tableCellInner])n=R.tableCellInner;else for(var i=0,a=Object.entries(e);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1];this.query(s,Pr.Scope.BLOCK&Pr.Scope.BLOT)==null?r[s]=c:n=s}n===R.tableCellInner&&(r=j({},e),delete r[n]);var l=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(l,t||void 0);var u=l.length();l instanceof q&&u===0&&(u+=1);for(var d=0,f=Object.entries(r);d<f.length;d++){var p=F(f[d],2),m=p[0],h=p[1];l.formatAt(0,u,m,h)}return l}}])}(t.default.import(`blots/scroll`)),Ir=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
6
6
  <!-- Icon from Tabler Icons by Paweł Kuna - https://github.com/tabler/tabler-icons/blob/master/LICENSE -->
7
7
  <path
@@ -14,8 +14,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
14
14
  />
15
15
  </svg>
16
16
  `,Lr=t.default.import(`parchment`),Rr=t.default.import(`blots/inline`),zr=t.default.import(`blots/text`),Br=function(e){function t(e,n,r){var i;return _(this,t),i=g(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i.attachUI(i.createUI()),i.domNode.addEventListener(`mouseenter`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`flex`)}),i.domNode.addEventListener(`mouseleave`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`none`)}),i.uiNode.style.display=`none`,i}return w(t,e),y(t,[{key:`createUI`,value:function(){var e=this,t=document.createElement(`i`);return t.classList.add(`ql-table-caption--switch`),t.innerHTML=Ir,t.addEventListener(`click`,function(){e.scroll.isEnabled()&&(e.side=e.side===`top`?`bottom`:`top`)}),t}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`side`,get:function(){return this.domNode.style.captionSide===`bottom`?`bottom`:`top`},set:function(e){this.domNode.style.captionSide=e===`bottom`?`bottom`:`top`}},{key:`format`,value:function(e,n){(!this.scroll.query(e,Lr.Scope.BLOCK_BLOT)||e===this.statics.blotName)&&I(t,`format`,this,3)([e,n])}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==R.tableMain){var r=this.tableId;this.wrap(R.tableMain,{tableId:r})}this.children.length===0?this.remove():(I(t,`optimize`,this,3)([e]),this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()))}}],[{key:`create`,value:function(e){var n=e.tableId,r=I(t,`create`,this,2)([]);return r.dataset.tableId=n,e.side===`bottom`&&(r.style.captionSide=`bottom`),r}},{key:`formats`,value:function(e){return{tableId:e.dataset.tableId,side:e.style.captionSide===`bottom`?`bottom`:`top`}}}])}(Or);x(Br,`blotName`,R.tableCaption),x(Br,`tagName`,`caption`),x(Br,`className`,`ql-table-caption`),x(Br,`allowedChildren`,[Rr,zr]);var J=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{key:`setHeight`,value:function(e){this.foreachCellInner(function(t){t.setFormatValue(`height`,e,!0)})}},{key:`getCellByColId`,value:function(e,t){for(var n,r=U(this,R.tableMain).getColIds(),i=r.indexOf(e),a=this.children.iterator(),o=null;o=a();){if(o.colId===e)return o;var s=r.indexOf(o.colId);if(s<i&&s+o.colspan>i)return o}return((n=this[t])==null?void 0:n.statics.blotName)===R.tableRow?this[t].getCellByColId(e,t):null}},{key:`insertCell`,value:function(e,t){for(var n=[],r=this.children.iterator(),i=0,a;(a=r())&&(i+=a.colspan,!(i>e));)if(a.rowspan!==1)for(var o=0;o<a.rowspan-1;o++)n[o]=(n[o]||0)+a.colspan;if(a&&i-a.colspan<e){var s=a.getCellInner();s.colspan+=1,a.rowspan!==1&&(n.skipRowNum=a.rowspan-1)}else{var c=this.scroll.create(R.tableCell,t),l=this.scroll.create(R.tableCellInner,t),u=this.scroll.create(`block`);u.appendChild(this.scroll.create(`break`)),l.appendChild(u),c.appendChild(l),this.insertBefore(c,a)}return n}},{key:`getCellByColumIndex`,value:function(e){var t=[],n=null,r=0;if(e<0)return[n,r,t];for(var i=this.children.iterator();n=i();){if(r+=n.colspan,n.rowspan!==1)for(var a=0;a<n.rowspan-1;a++)t[a]=(t[a]||0)+n.colspan;if(r>e)break}return[n,r,t]}},{key:`removeCell`,value:function(e){if(e<0)return[];var t=this.getCellByColumIndex(e),n=F(t,2),r=n[0],i=n[1],a=t[2];if(!r)return a;if(i-r.colspan<e||r.colspan>1){var o=F(r.descendants(q),1)[0];if(r.colspan!==1&&e===i-r.colspan){var s=U(this,R.tableMain).getColIds();o.colId=s[s.indexOf(o.colId)+1]}r.rowspan!==1&&(a.skipRowNum=r.rowspan-1),--o.colspan}else r.remove();return a}},{key:`foreachCellInner`,value:function(e){for(var t=this.children.iterator(),n=0,r;r=t();){var i=F(r.descendants(q),1)[0];if(i&&e(i,n++))break}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.rowId===this.rowId}},{key:`wrapParentTag`,value:function(){var e={thead:R.tableHead,tbody:R.tableBody,tfoot:R.tableFoot},t=this.parent;if(t!==null&&t.statics.blotName!==e[this.wrapTag])if(Object.values(e).includes(t.statics.blotName)){var n=this.offset(this.parent),r=this.parent.split(n);r&&r.length()<=0&&r.remove();var i=this.parent.splitAfter(this);i&&i.length()<=0&&i.remove(),this.parent.replaceWith(e[this.wrapTag],this.tableId)}else this.wrap(e[this.wrapTag],this.tableId)}},{key:`optimize`,value:function(e){this.wrapParentTag(),this.enforceAllowedChildren(),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`remove`,value:function(){I(t,`remove`,this,3)([]),this.next&&this.next instanceof t&&this.next.length()<=0&&this.next.remove()}}],[{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.wrapTag,a=i===void 0?`tbody`:i,o=I(t,`create`,this,2)([]);return o.dataset.tableId=n,o.dataset.rowId=r,o.dataset.wrapTag=a,o}}])}(K);x(J,`blotName`,R.tableRow),x(J,`tagName`,`tr`),x(J,`className`,`ql-table-row`),x(J,`allowDataAttrs`,new Set([`table-id`,`row-id`,`wrap-tag`])),x(J,`allowDataAttrsChangeHandler`,{"wrap-tag":`wrapParentTag`});var Y=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`isChildHeadTableCellInner`,value:function(){var e=this.children.head;return(e==null?void 0:e.statics.blotName)===R.tableCellInner}},{key:`setFormatValue`,value:function(e,t){var n;if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var r=e;this.statics.allowDataAttrs.has(e)&&(r=`data-${e}`),t?this.domNode.setAttribute(r,t):this.domNode.removeAttribute(r)}else this.statics.isAllowStyle(e)&&(Object.assign(this.domNode.style,x({},e,t)),e.startsWith(`border`)&&this.setStyleBoder(e,t));var i=this.children.head;this.isChildHeadTableCellInner()&&this.domNode.style.cssText&&this.domNode.style.cssText!==i.domNode.dataset.style&&(i.domNode.dataset.style=this.domNode.style.cssText),((n=this.parent)==null?void 0:n.statics.blotName)===R.tableRow&&this.parent.setFormatValue(e,t)}},{key:`setStyleBoder`,value:function(e,t){var n=t||null;if(![`left`,`right`,`top`,`bottom`].some(function(t){return e.includes(t)})&&e.startsWith(`border-`)){var r=b(this.getNearByCell(`left`).map(function(e){return e.descendant(q,0)[0]}).filter(Boolean)),i;try{for(r.s();!(i=r.n()).done;)i.value.setFormatValue(e.replace(`border-`,`border-right-`),n,!0)}catch(e){r.e(e)}finally{r.f()}var a=b(this.getNearByCell(`top`).map(function(e){return e.descendant(q,0)[0]}).filter(Boolean)),o;try{for(a.s();!(o=a.n()).done;)o.value.setFormatValue(e.replace(`border-`,`border-bottom-`),n,!0)}catch(e){a.e(e)}finally{a.f()}}}},{key:`getNearByCell`,value:function(e){var t=[];try{var n=U(this,R.tableMain);t.push.apply(t,L(n.getColIds()))}catch(e){console.error(`Cell is not in table! ${e}`)}if(t.length===0)return[];if(e===`left`){for(var r=new Set,i=this.parent,a=0;a<this.rowspan&&i instanceof J;a++){for(var o=i.children.iterator(),s=null;s=o();){var c=t.indexOf(s.colId)+s.colspan;this.colId===t[c]&&r.add(s)}i=i.next}return Array.from(r)}else if(e===`top`){if(!(this.parent instanceof J)||!this.parent.prev)return[];for(var l=new Set,u=this.getColumnIndex(),d=u+this.colspan,f=new Set(t.filter(function(e,t){return t>=u&&t<d})),p=1,m=this.parent.prev;m;){for(var h=!1,g=m.children.iterator(),_=null,v=0;_=g();)f.has(_.colId)&&_.rowspan>=p&&(l.add(_),f.delete(_.colId)),v+=_.colspan,_.rowspan>=p&&(h=!0);if(!h&&v===t.length)break;m=m.prev,p+=1}return Array.from(l)}return[]}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`rowspan`,get:function(){return Number(this.domNode.getAttribute(`rowspan`))}},{key:`colspan`,get:function(){return Number(this.domNode.getAttribute(`colspan`))}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}}},{key:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{key:`getColumnIndex`,value:function(){return U(this,R.tableMain).getColIds().indexOf(this.colId)}},{key:`getCellInner`,value:function(){return this.children.head}},{key:`convertTableCell`,value:function(){var e=this.statics.formats(this.domNode),t=e.tag===`td`?`th`:`td`,n=this.children.head;this.isChildHeadTableCellInner()&&n.domNode.dataset.tag!==t&&(n.domNode.dataset.tag=t),this.replaceWith(R.tableCell,j(j({},e),{},{tag:t}))}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(e){var n=this.tableId,r=this.rowId,i=this.wrapTag;if(this.parent!==null&&this.parent.statics.blotName!==R.tableRow&&this.wrap(R.tableRow,{tableId:n,rowId:r,wrapTag:i}),this.parent.statics.blotName===R.tableRow&&this.parent.wrapTag!==i&&this.parent.setFormatValue(`wrap-tag`,i),this.emptyRow.length>0){var a=this.parent.parent;if(a instanceof jr){var o=this.parent.next,s=b(this.emptyRow),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=this.scroll.create(R.tableRow,{tableId:n,rowId:l,wrapTag:i});a.insertBefore(u,o),o=u.next}}catch(e){s.e(e)}finally{s.f()}}}I(t,`optimize`,this,3)([e])}}],[{key:`isAllowStyle`,value:function(e){var t=pr(e),n=b(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(pr(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var t,n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=e.tag,u=l===void 0?`td`:l,d=e.wrapTag,f=d===void 0?`tbody`:d,p=document.createElement(u);(t=p.classList).add.apply(t,L(Ne(this.className))),p.dataset.tableId=n,p.dataset.rowId=r,p.dataset.colId=i,p.dataset.wrapTag=f,p.setAttribute(`rowspan`,String(Sr(a))),p.setAttribute(`colspan`,String(Sr(o))),s&&(p.style.cssText=s);try{c&&(p.dataset.emptyRow=JSON.stringify(c))}catch(e){}return p}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.emptyRow,o=t.wrapTag,s=o===void 0?`tbody`:o,c=Number(e.getAttribute(`rowspan`)),l=Number(e.getAttribute(`colspan`)),u={tableId:n,rowId:r,colId:i,rowspan:Sr(c),colspan:Sr(l),tag:e.tagName.toLowerCase(),wrapTag:s},d=mr(e),f=Object.entries(d).filter(function(e){var t=F(e,2)[1];return![`initial`,`inherit`].includes(t)});f.length>0&&(u.style=f.map(function(e){var t=F(e,2);return`${t[0]}: ${t[1]}`}).join(`;`));try{a&&(u.emptyRow=JSON.parse(a))}catch(e){}return u}}])}(K);x(Y,`blotName`,R.tableCell),x(Y,`tagName`,`td`),x(Y,`className`,`ql-table-cell`),x(Y,`allowAttrs`,new Set([`rowspan`,`colspan`])),x(Y,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`empty-row`,`wrap-tag`])),x(Y,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Vr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`width`,get:function(){var e=this.domNode.getAttribute(`width`);if(!e){if(e=this.domNode.getBoundingClientRect().width,this.full){var t=this.domNode.closest(`table`);return t?e/100*t.getBoundingClientRect().width:z[this.full?`colMinWidthPre`:`colMinWidthPx`]}return e}return Number.parseFloat(String(e))},set:function(e){var t=Number.parseFloat(String(e));Number.isNaN(t)&&(t=z[this.full?`colMinWidthPre`:`colMinWidthPx`]),this.domNode.setAttribute(`width`,this.statics.validWidth(t,!!this.full))}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`checkMerge`,value:function(){var e=this.next,t=this.tableId,n=this.colId;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===t&&e.colId===n}},{key:`optimize`,value:function(e){var n=this.parent;if(n!=null&&n.statics.blotName!==R.tableColgroup){var r=this.statics.value(this.domNode);this.wrap(R.tableColgroup,r)}var i=U(this,R.tableColgroup);i.align=this.align,this.next!=null&&this.checkMerge()&&this.next.remove(),I(t,`optimize`,this,3)([e]);try{var a=U(this,R.tableColgroup),o=!0;a.children.forEach(function(e){o&&(o=e.full)}),a.full=o}catch(e){}}},{key:`insertAt`,value:function(e,n,r){var i=this;if(r!=null){if(n===this.statics.blotName&&r.tableId!==this.tableId)try{var a=U(this,R.tableWrapper),o=a.split(this.offset(a)),s=this.scroll.create(n,r);o.parent.insertBefore(s,o)}catch(e){console.warn(`TableCol not in TableColgroup`)}else I(t,`insertAt`,this,3)([e,n,r]);return}try{var c=U(this,R.tableWrapper),l=c.split(this.offset(c)),u=n.split(`
17
- `),d=u.pop(),f=b(u.map(function(e){var t=i.scroll.create(`block`);return t.insertAt(0,e),t})),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;l.parent.insertBefore(m,l)}}catch(e){f.e(e)}finally{f.f()}d&&l.parent.insertBefore(this.scroll.create(`text`,d),l)}catch(e){console.warn(`TableCol not in TableColgroup`)}}}],[{key:`validWidth`,value:function(e,t){var n=Number.parseFloat(String(e));return Number.isNaN(n)&&(n=z[t?`colMinWidthPre`:`colMinWidthPx`]),`${n}${t?`%`:`px`}`}},{key:`create`,value:function(e){var n=e.width,r=e.tableId,i=e.colId,a=e.full,o=e.align,s=I(t,`create`,this,2)([]);return s.setAttribute(`width`,this.validWidth(n,!!a)),a&&(s.dataset.full=String(a)),o&&o!==`left`&&(s.dataset.align=o),s.dataset.tableId=r,s.dataset.colId=i,s}},{key:`value`,value:function(e){var t=e.dataset,n=t.tableId,r=t.colId,i=e.getAttribute(`width`)||String(z.colDefaultWidth),a=e.dataset.align,o=Object.hasOwn(e.dataset,`full`),s={tableId:String(n),colId:String(r),full:o,width:Number.parseFloat(i)};return a&&(s.align=a),s}}])}(t.default.import(`blots/block/embed`));x(Vr,`blotName`,R.tableCol),x(Vr,`tagName`,`col`);var X=function(e){function t(e,n,r){var i;return _(this,t),i=g(this,t,[e,n]),x(i,`scroll`,void 0),i.scroll=e,i.updateAlign(),i}return w(t,e),y(t,[{key:`colWidthFillTable`,value:function(){if(this.full){Object.assign(this.domNode.style,{width:null});return}var e=this.getCols();if(e){var t=e.reduce(function(e,t){return t.width+e},0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}},{key:`setFull`,value:function(){if(!this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.width/t*100;i.full=!0,i.width=a}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`cancelFull`,value:function(){if(this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.full=!1,i.width=Math.max(i.width/100*t,z.colMinWidthPx)}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`updateAlign`,value:function(){var e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}},{key:`getBodys`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`thead, tbody, tfoot`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRowIds`,value:function(){return this.getRows().map(function(e){return e.rowId})}},{key:`getCols`,value:function(){return this.descendants(Vr)}},{key:`getColIds`,value:function(){return this.getCols().map(function(e){return e.colId})}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;n!==null&&n.statics.blotName!==R.tableWrapper&&this.wrap(R.tableWrapper,this.tableId),I(t,`optimize`,this,3)([e]),this.mergeRow()}},{key:`mergeRow`,value:function(){if(this.parent){var e=this.getRows(),t={},n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t[i.rowId]||(t[i.rowId]=[]),t[i.rowId].push(i)}}catch(e){n.e(e)}finally{n.f()}for(var a=0,o=Object.values(t);a<o.length;a++)for(var s=o[a],c=1;c<s.length;c++){var l=s[c];l.moveChildren(s[0]),l.remove()}}}},{key:`checkEmptyCol`,value:function(e){if(e){var t=this.getRows().length,n=this.getCols(),r=b(this.descendants(q)),i;try{var a=function(){var e=i.value;if(e.colspan>1&&e.rowspan>=t){for(var r=n.findIndex(function(t){return t.colId===e.colId}),a=n[r],o=r+1;o<r+e.colspan;o++)n[o].remove(),a.width+=n[o].width;e.colspan=1}};for(r.s();!(i=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}}},{key:`checkEmptyRow`,value:function(e){for(var t=this,n=this.getRows(),r=new Set(n.map(function(e){return e.rowId})),i=function(){var i=n[a];if(e){if(i.children.length===0){for(var o=function(e){n[c].foreachCellInner(function(t){if(t.rowspan>e){--t.rowspan;var n=new Set(t.emptyRow);n.delete(i.rowId),t.emptyRow=Array.from(n)}})},s=1,c=a-1;c>=0;c--,s++)o(s);i.remove()}}else{if(i.children.length===0&&i.prev){for(var l=i.prev;((u=l)==null?void 0:u.children.length)===0;){var u;l=l.prev}l.foreachCellInner(function(e){var t=new Set(e.emptyRow);t.has(i.rowId)||(e.emptyRow=[i.rowId].concat(L(t)))})}i.foreachCellInner(function(e){var n=b(e.emptyRow),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;r.has(o)||i.parent.insertBefore(t.scroll.create(R.tableRow,{tableId:t.tableId,rowId:o}),i.next)}}catch(e){n.e(e)}finally{n.f()}})}},a=n.length-1;a>=0;a--)i()}},{key:`sortMergeChildren`,value:function(){var e=x(x(x(x(x({},R.tableCaption,[]),R.tableColgroup,[]),R.tableHead,[]),R.tableBody,[]),R.tableFoot,[]);this.children.forEach(function(t){e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(var t=0,n=Object.values(e);t<n.length;t++)for(var r=n[t],i=1;i<r.length;i++)r[i].moveChildren(r[0]);var a=e[R.tableCaption][0],o=e[R.tableColgroup][0],s=e[R.tableHead][0],c=e[R.tableBody][0],l=e[R.tableFoot][0],u=a&&this.children.head!==a,d=o&&a&&a.next!==o,f=o&&!a&&this.children.head!==o,p=s&&!c&&!l&&this.children.tail!==s,m=c&&s&&c.prev!==s,h=c&&!l&&this.children.tail!==c,g=c&&l&&c.next!==l,_=l&&this.children.tail!==l;if(u||d||f||p||m||h||g||_){var v=this.clone();a&&v.appendChild(a),o&&v.appendChild(o),s&&v.appendChild(s),c&&v.appendChild(c),l&&v.appendChild(l),this.children.forEach(function(e){return e.remove()}),v.moveChildren(this)}}},{key:`insertRow`,value:function(e){var t=this.getColIds(),n=this.descendants(J),r=new Set(t),i=0,a=b(n),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i===e)break;s.foreachCellInner(function(n){if(i+n.rowspan>e&&(n.rowspan+=1,r.delete(n.colId),n.colspan!==1))for(var a=t.indexOf(n.colId),o=0;o<n.colspan-1;o++)r.delete(t[a+o+1])}),i+=1}}catch(e){a.e(e)}finally{a.f()}var c=this.tableId,l=G(),u=this.scroll.create(R.tableRow,{tableId:c,rowId:l}),d=b(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=this.scroll.create(`break`).wrap(`block`).wrap(R.tableCellInner,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1}).wrap(R.tableCell,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1});u.appendChild(m)}}catch(e){d.e(e)}finally{d.f()}var h=n[e]||null;h?h.parent.insertBefore(u,h):n[n.length-1].parent.appendChild(u)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]),r=e.tableId,i=e.full,a=e.align;return n.dataset.tableId=r,a===`right`||a===`center`?n.dataset.align=a:n.removeAttribute(`date-align`),i&&(n.dataset.full=String(i)),n.setAttribute(`cellpadding`,`0`),n.setAttribute(`cellspacing`,`0`),n}}])}(K);x(X,`blotName`,R.tableMain),x(X,`tagName`,`table`),x(X,`className`,`ql-table`);var Hr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof X&&(this.parent.full=e)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`findCol`,value:function(e){for(var t=this.children.iterator(),n=0,r;(r=t())&&n!==e;)n++;return r}},{key:`insertColByIndex`,value:function(e,t){var n=this.parent;if(!(n instanceof X))throw TypeError(`TableColgroupFormat should be child of TableFormat`);var r=this.findCol(e),i=this.scroll.create(R.tableCol,t);if(n.full){for(var a=this.children.iterator(),o;o=a();)if(o.width-i.width>=z.colMinWidthPre){o.width-=i.width;break}}this.insertBefore(i,r)}},{key:`removeColByIndex`,value:function(e){var t=this.parent;if(!(t instanceof X))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);var n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}},{key:`checkMerge`,value:function(){var e=this.next,t=this.parent;return t instanceof X&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.full,a=this.align;n!=null&&n.statics.blotName!==R.tableMain&&this.wrap(R.tableMain,{tableId:r,full:i,align:a});var o=U(this,R.tableMain);o.align=a,I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,e.full&&(n.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(n.dataset.align=e.align),n.setAttribute(`contenteditable`,`false`),n}}])}(K);x(Hr,`blotName`,R.tableColgroup),x(Hr,`tagName`,`colgroup`);var Ur=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(jr);x(Ur,`blotName`,R.tableFoot),x(Ur,`tagName`,`tfoot`);var Wr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(jr);x(Wr,`blotName`,R.tableHead),x(Wr,`tagName`,`thead`);var Gr=t.default.import(`parchment`),Kr=function(e){function n(e,r,i){var a;return _(this,n),a=g(this,n,[e,r]),x(a,`scroll`,void 0),x(a,`insertLineAround`,function(){(!a.prev||!a.isBlockLine(a.prev))&&a.parent.insertBefore(a.scroll.create(`block`),a),(!a.next||!a.isBlockLine(a.next))&&a.parent.insertBefore(a.scroll.create(`block`),a.next)}),a.scroll=e,a.scroll.emitter.on(t.default.events.TEXT_CHANGE,a.insertLineAround),a}return w(n,e),y(n,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){if(this.length()===0){this.remove();return}I(n,`optimize`,this,3)([e])}},{key:`deleteAt`,value:function(e,t){I(n,`deleteAt`,this,3)([e,t]);var r=this.descendants(jr),i=this.descendants(Hr);r.length===0&&i.length===0&&this.remove()}},{key:`remove`,value:function(){I(n,`remove`,this,3)([]),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}},{key:`isBlockLine`,value:function(e){return e instanceof Gr.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}}],[{key:`create`,value:function(e){var t=I(n,`create`,this,2)([]);return t.dataset.tableId=e,t.addEventListener(`dragstart`,function(e){e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,function(e){e.preventDefault()}),t.addEventListener(`dragover`,function(e){e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}}])}(K);x(Kr,`blotName`,R.tableWrapper),x(Kr,`tagName`,`div`),x(Kr,`className`,`ql-table-wrapper`);function Z(e){for(var t=new Set([R.tableHead,R.tableBody,R.tableFoot]),n=e.children.iterator(),r=null,i={};r=n();)t.has(r.statics.blotName)&&(i[r.statics.blotName]=r);if(Object.values(i).length<=0)return{rect:null,head:null,body:null,foot:null};var a=Object.values(i).reduce(function(e,t){var n=t.domNode.getBoundingClientRect();return j(j({},e),{},{top:Math.min(e.top,n.top),bottom:Math.max(e.bottom,n.bottom),left:Math.min(e.left,n.left),right:Math.max(e.right,n.right)})},{top:1/0,bottom:0,left:1/0,right:0,width:0,height:0,x:1/0,y:1/0});return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,{rect:a,head:i[R.tableHead]||null,body:i[R.tableBody]||null,foot:i[R.tableFoot]||null}}var qr=function(){function e(t,n){_(this,e),x(this,`tableModule`,void 0),x(this,`quill`,void 0),x(this,`table`,void 0),x(this,`tableSelectMouseDownHandler`,void 0),this.tableModule=t,this.quill=n,this.tableSelectMouseDownHandler=this.tableSelectHandler.bind(this),this.quill.root.addEventListener(`mousedown`,this.tableSelectMouseDownHandler)}return y(e,[{key:`tableSelectHandler`,value:function(e){var t=e.composedPath();if(!(e.button!==0||!t||t.length<=0)){var n=t.find(function(e){var t;return((t=e.tagName)==null?void 0:t.toUpperCase())===`TABLE`});this.setSelectionTable(n)}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.hide(),this.table=e,this.table&&this.show(),this.update())}},{key:`hide`,value:function(){}},{key:`show`,value:function(){}},{key:`update`,value:function(){}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`mousedown`,this.tableSelectMouseDownHandler),this.hide(),this.table=void 0}}])}(),Jr=function(e){function n(e,r,i){var a;return _(this,n),a=g(this,n,[e,r]),x(a,`tableModule`,void 0),x(a,`quill`,void 0),x(a,`tableBlot`,void 0),x(a,`tableWrapperBlot`,void 0),x(a,`alignBox`,void 0),x(a,`cleanup`,void 0),x(a,`bem`,H(`align`)),x(a,`resizeObserver`,void 0),x(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.alignBox=a.buildTools(),a.hide(),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return w(n,e),y(n,[{key:`buildTools`,value:function(){for(var e=this.tableModule.addContainer(this.bem.b()),n=t.default.import(`ui/icons`),r={left:n.align[``],center:n.align.center,right:n.align.right},i=0,a=Object.entries(r);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=document.createElement(`span`);l.dataset.align=s,l.classList.add(this.bem.be(`item`)),l.innerHTML=`<i class="icon">${c}</i>`,l.addEventListener(`click`,this.handleAlignItemClick.bind(this)),e.appendChild(l)}return e}},{key:`handleAlignItemClick`,value:function(e){var t=e.currentTarget;if(t){var n=t.dataset.align;n&&this.tableBlot&&this.setTableAlign(this.tableBlot,n)}}},{key:`setTableAlign`,value:function(e,t){var n=b(e.getCols()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.align=t}}catch(e){n.e(e)}finally{n.f()}}},{key:`show`,value:function(){var e=this;!this.table||!this.alignBox||(this.tableBlot=t.default.find(this.table),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=ar(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.cleanup&&this.cleanup(),this.cleanup=Gn(this.tableWrapperBlot.domNode,this.alignBox,function(){return e.update()}))}},{key:`hide`,value:function(){this.tableBlot=void 0,this.tableWrapperBlot=void 0,this.alignBox&&this.alignBox.classList.add(this.bem.is(`hidden`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0)}},{key:`update`,value:function(){var e=this;if(!(!this.alignBox||!this.tableBlot||!this.tableWrapperBlot)){if(!this.table||this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}Xn(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[Jn(),qn({limiter:Yn()}),Kn(16)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.alignBox.style,{left:`${n}px`,top:`${r}px`})})}}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.hide(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=null)}}])}(qr);x(Jr,`moduleName`,`table-align`);var Yr=t.default.import(`delta`);function Xr(e,t,n){var r=Zr(t),i=r.rows,a=r.cols,o=Qr(n),s=o.rows,c=o.cols,l=o.cells;i===s&&a===c?ei(t,l,e):ri(e,t,l)}function Zr(e){return e.length===0?{rows:0,cols:0}:$r(ti(e))}function Qr(e){var t=new Map,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.attributes;if(a){var o=a[R.tableCellInner];if(o){var s=`${o.rowId}-${o.colId}`;if(!t.has(s)){var c={rowId:o.rowId,colId:o.colId,rowspan:o.rowspan||1,colspan:o.colspan||1,deltaOps:[]};o.emptyRow&&o.emptyRow.length>0&&(c.emptyRow=o.emptyRow),t.set(s,c)}var l=t.get(s),u=R.tableCellInner;a[u];var d=M(a,[u].map(ie));l.deltaOps.push({insert:i.insert,attributes:j({},d)})}}}}catch(e){n.e(e)}finally{n.f()}var f=Array.from(t.values());return j(j({},$r(ti(f))),{},{cells:f})}function $r(e){var t=1/0,n=-1/0,r=1/0,i=-1/0,a=b(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.cell,l=s.rowIndex,u=s.colIndex,d=c.colspan||1,f=c.rowspan||1;t=Math.min(t,l),n=Math.max(n,l+f-1),r=Math.min(r,u),i=Math.max(i,u+d-1)}}catch(e){a.e(e)}finally{a.f()}return{rows:Math.max(n-t+1,0),cols:Math.max(i-r+1,0)}}function ei(e,t,n){var r=ti(e),i=ti(t),a=new Map,o=b(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;a.set(`${c.rowIndex}-${c.colIndex}`,c.cell)}}catch(e){o.e(e)}finally{o.f()}var l=[],u=new Set,d=b(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=p.cell;if(!(!m.domNode.isConnected||u.has(m))){var h=a.get(`${p.rowIndex}-${p.colIndex}`);if(h){var g=ii(n,m,h.deltaOps,{rowspan:h.rowspan,colspan:h.colspan,emptyRow:h.emptyRow});l.push(g),u.add(m)}}}}catch(e){d.e(e)}finally{d.f()}ai(n,l)}function ti(e){var t=[],n=ni(e),r=-1,i=new Map,a=b(n.entries()),o;try{for(a.s();!(o=a.n()).done;){var s=F(o.value,2),c=s[0],l=s[1];i.has(c)||(r+=1,i.set(c,r));var u=0,d=b(l),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;t.push({cell:p,rowIndex:i.get(c),colIndex:u}),u+=p.colspan||1;var m=b(p.emptyRow||[]),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;i.has(g)||(r+=1,i.set(g,r))}}catch(e){m.e(e)}finally{m.f()}}}catch(e){d.e(e)}finally{d.f()}}}catch(e){a.e(e)}finally{a.f()}return t}function ni(e){var t=new Map,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.has(i.rowId)||t.set(i.rowId,[]),t.get(i.rowId).push(i)}}catch(e){n.e(e)}finally{n.f()}return t}function ri(e,t,n){for(var r=ni(n),i=Array.from(r.values()),a=Zr(t).cols,o=[],s=0;s<t.length;s++){var c=t[s],l=Math.floor(s/a),u=s%a,d=i[l%i.length],f=d[u%d.length],p=ii(e,c,f.deltaOps);o.push(p)}ai(e,o)}function ii(e,t,n,r){var i=r||{},a=i.rowspan,o=a===void 0?1:a,s=i.colspan,c=s===void 0?1:s,l=i.emptyRow;r&&(t.rowspan=o,t.colspan=c,l&&l.length>0&&(t.emptyRow=l));var u=t.formats(),d=new Yr,f=b(n),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;d.insert(m.insert,j(j({},m.attributes),u))}}catch(e){f.e(e)}finally{f.f()}return{offset:t.offset(e.quill.scroll),length:t.length(),insertDelta:d,cell:t,rowspan:o,colspan:c,emptyRow:l}}function ai(e,n){if(n.length!==0){n.sort(function(e,t){return e.offset-t.offset});for(var r=new Yr,i=0;i<n.length;i++){var a=n[i],o=a.offset;if(i!==0){var s=n[i-1];o=a.offset-s.offset-s.length}r=r.retain(o).concat(a.insertDelta).delete(a.length)}var c=b(n),l;try{for(c.s();!(l=c.n()).done;){var u=l.value;oi(e,u)}}catch(e){c.e(e)}finally{c.f()}e.quill.updateContents(r,t.default.sources.USER)}}function oi(e,t){var n=t.cell,r=t.rowspan,i=r===void 0?1:r,a=t.colspan,o=a===void 0?1:a;if(!(i===1&&o===1)){var s=U(n,R.tableMain);if(s){var c=n.getTableRow();if(c){var l=s.descendants(q),u=s.getRows(),d=u.indexOf(c),f=n.getColumnIndex(),p=[],m=b(l),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g!==n){var _=g.getTableRow();if(_){var v=u.indexOf(_),y=g.getColumnIndex(),x=v>=d&&v<d+i,S=y>=f&&y<f+o;x&&S&&p.push(g)}}}}catch(e){m.e(e)}finally{m.f()}for(var C=e.talbeModule.options.autoMergeCell,w=0,T=p;w<T.length;w++){var E=T[w];if(E.domNode.isConnected){var D=E.getTableRow();E.remove(),!C&&D&&D.length()<=0&&D.remove()}}}}}}var si=[`style`],ci=[`attributes`],li=[`attributes`],ui=[`background`],di=t.default.import(`delta`),fi=t.default.import(`modules/clipboard`);function pi(e){var t=Number.parseFloat(e.getAttribute(`width`));if(Number.isNaN(t)){var n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t||z.colDefaultWidth}function mi(e,t){for(var n=Array(t).fill(z.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`)),i=0,a=r;i<a.length;i++)for(var o=a[i],s=Array.from(o.querySelectorAll(`td`)),c=0,l=0,u=s;l<u.length;l++){var d=u[l],f=d.colSpan||1;if(c<t)for(var p=pi(d),m=0;m<f;m++)n[c+m]=p/f;else break;c+=f}return n}var hi=function(e){function t(e,n){var r;return _(this,t),r=g(this,t,[e,n]),x(r,`quill`,void 0),x(r,`tableId`,G()),x(r,`rowId`,G()),x(r,`colIds`,[]),x(r,`rowspanCount`,[]),x(r,`cellCount`,0),x(r,`colCount`,0),r.quill=e,r.addMatcher(`table`,r.matchTable.bind(r)),r.addMatcher(`thead`,r.matchThead.bind(r)),r.addMatcher(`tbody`,r.matchTbody.bind(r)),r.addMatcher(`tfoot`,r.matchTfoot.bind(r)),r.addMatcher(`colgroup`,r.matchColgroup.bind(r)),r.addMatcher(`col`,r.matchCol.bind(r)),r.addMatcher(`tr`,r.matchTr.bind(r)),r.addMatcher(`td`,r.matchTd.bind(r)),r.addMatcher(`th`,r.matchTd.bind(r)),r.addMatcher(`caption`,r.matchCaption.bind(r)),r.addMatcher(Node.ELEMENT_NODE,r.matchTdAttributor.bind(r)),r}return w(t,e),y(t,[{key:`getStyleBackgroundColor`,value:function(e,t){var n=e.style.backgroundColor;if(n){var r=b(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner],c=s.style,l=M(s,si),u=hr(c||``);u.backgroundColor||(u.backgroundColor=n,o.attributes[R.tableCellInner]=j(j({},l),{},{style:gr(u)}))}}}catch(e){r.e(e)}finally{r.f()}}}},{key:`matchTable`,value:function(e,t){var n=this;if(t.ops.length===0)return t;for(var r=[],i=[],a=-1,o=0;o<t.ops.length;o++){var s=t.ops[o],c=s.attributes,l=s.insert;if(!Ae(l)&&(!c||!c[R.tableCellInner]&&!c[R.tableCaption])){t.ops.splice(o,1),--o;continue}var u=c||{},d=R.tableCell;u.table,u[d];var f=M(u,[`table`,d].map(ie)),p=Ae(l)&&l[R.tableCol];p?i.push({insert:l}):r.push({attributes:f,insert:l}),!(f!=null&&f[R.tableCellInner])&&!(f!=null&&f[R.tableCaption])&&!p&&Oe(l)&&l.trim().length>0&&(a=o)}var m=mi(e,this.colIds.length).reduce(function(e,t,r){return i[r]?e.push(i[r]):e.push({insert:x({},R.tableCol,{tableId:n.tableId,colId:n.colIds[r],width:t,full:!1})}),e},[]);r.splice.apply(r,[a+1,0].concat(L(m)));var h=new di(r);return this.getStyleBackgroundColor(e,h),this.tableId=G(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,h}},{key:`matchTbody`,value:function(e,t){this.getStyleBackgroundColor(e,t);for(var n=[],r=t.ops.length-1;r>=0;r--){var i,a=t.ops[r];if((i=a.attributes)!=null&&i[R.tableCellInner]){if(a.attributes){var o=a.attributes[R.tableCellInner];if(o.rowspan===1)n=[];else if(n.length>0&&(o.emptyRow||(o.emptyRow=[]),n.length>o.emptyRow.length)){var s;(s=o.emptyRow).push.apply(s,L(n.slice(o.emptyRow.length-n.length)))}}}else{n=[];for(var c=a.insert?Oe(a.insert)?a.insert.split(`
18
- `).length-1:1:0,l=0;l<c;l++)n.push(G())}}return this.rowspanCount=[],t}},{key:`matchThead`,value:function(e,t){var n=this.matchTbody(e,t),r=b(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner];s.wrapTag=`thead`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchTfoot`,value:function(e,t){var n=this.matchTbody(e,t),r=b(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner];s.wrapTag=`tfoot`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchColgroup`,value:function(e,t){var n=[],r=b(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a&&Ae(a.insert)&&a.insert[R.tableCol]&&n.push(a)}}catch(e){r.e(e)}finally{r.f()}return new di(n)}},{key:`matchCol`,value:function(e,t){var n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);for(var r=new di,i=0;i<n;i++)this.colIds[this.colCount]=G(),r.insert(x({},R.tableCol,Object.assign(Vr.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]}))),this.colCount+=1;return r}},{key:`matchTr`,value:function(e,t){this.rowId=G(),this.cellCount=0;var n=b(this.rowspanCount.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];o.rowspan>0&&--o.rowspan,o.rowspan<=0&&(this.rowspanCount[a]={rowspan:0,colspan:0})}}catch(e){n.e(e)}finally{n.f()}return this.getStyleBackgroundColor(e,t),t.ops.length===0?new di([{insert:`
17
+ `),d=u.pop(),f=b(u.map(function(e){var t=i.scroll.create(`block`);return t.insertAt(0,e),t})),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;l.parent.insertBefore(m,l)}}catch(e){f.e(e)}finally{f.f()}d&&l.parent.insertBefore(this.scroll.create(`text`,d),l)}catch(e){console.warn(`TableCol not in TableColgroup`)}}}],[{key:`validWidth`,value:function(e,t){var n=Number.parseFloat(String(e));return Number.isNaN(n)&&(n=z[t?`colMinWidthPre`:`colMinWidthPx`]),t&&(n=Math.trunc(n*1e4)/1e4),`${n}${t?`%`:`px`}`}},{key:`create`,value:function(e){var n=e.width,r=e.tableId,i=e.colId,a=e.full,o=e.align,s=I(t,`create`,this,2)([]);return s.setAttribute(`width`,this.validWidth(n,!!a)),a&&(s.dataset.full=String(a)),o&&o!==`left`&&(s.dataset.align=o),s.dataset.tableId=r,s.dataset.colId=i,s}},{key:`value`,value:function(e){var t=e.dataset,n=t.tableId,r=t.colId,i=e.getAttribute(`width`)||String(z.colDefaultWidth),a=e.dataset.align,o=Object.hasOwn(e.dataset,`full`),s={tableId:String(n),colId:String(r),full:o,width:Number.parseFloat(i)};return a&&(s.align=a),s}}])}(t.default.import(`blots/block/embed`));x(Vr,`blotName`,R.tableCol),x(Vr,`tagName`,`col`);var X=function(e){function t(e,n,r){var i;return _(this,t),i=g(this,t,[e,n]),x(i,`scroll`,void 0),i.scroll=e,i.updateAlign(),i}return w(t,e),y(t,[{key:`colWidthFillTable`,value:function(){if(this.full){Object.assign(this.domNode.style,{width:null});return}var e=this.getCols();if(e){var t=e.reduce(function(e,t){return t.width+e},0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}},{key:`setFull`,value:function(){if(!this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.width/t*100;i.full=!0,i.width=a}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`cancelFull`,value:function(){if(this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.full=!1,i.width=Math.max(i.width/100*t,z.colMinWidthPx)}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`updateAlign`,value:function(){var e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}},{key:`getBodys`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`thead, tbody, tfoot`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRowIds`,value:function(){return this.getRows().map(function(e){return e.rowId})}},{key:`getCols`,value:function(){return this.descendants(Vr)}},{key:`getColIds`,value:function(){return this.getCols().map(function(e){return e.colId})}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;n!==null&&n.statics.blotName!==R.tableWrapper&&this.wrap(R.tableWrapper,this.tableId),I(t,`optimize`,this,3)([e]),this.mergeRow()}},{key:`mergeRow`,value:function(){if(this.parent){var e=this.getRows(),t={},n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t[i.rowId]||(t[i.rowId]=[]),t[i.rowId].push(i)}}catch(e){n.e(e)}finally{n.f()}for(var a=0,o=Object.values(t);a<o.length;a++)for(var s=o[a],c=1;c<s.length;c++){var l=s[c];l.moveChildren(s[0]),l.remove()}}}},{key:`checkEmptyCol`,value:function(e){if(e){var t=this.getRows().length,n=this.getCols(),r=b(this.descendants(q)),i;try{var a=function(){var e=i.value;if(e.colspan>1&&e.rowspan>=t){for(var r=n.findIndex(function(t){return t.colId===e.colId}),a=n[r],o=r+1;o<r+e.colspan;o++)n[o].remove(),a.width+=n[o].width;e.colspan=1}};for(r.s();!(i=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}}},{key:`checkEmptyRow`,value:function(e){for(var t=this,n=this.getRows(),r=new Set(n.map(function(e){return e.rowId})),i=function(){var i=n[a];if(e){if(i.children.length===0){for(var o=function(e){n[c].foreachCellInner(function(t){if(t.rowspan>e){--t.rowspan;var n=new Set(t.emptyRow);n.delete(i.rowId),t.emptyRow=Array.from(n)}})},s=1,c=a-1;c>=0;c--,s++)o(s);i.remove()}}else{if(i.children.length===0&&i.prev){for(var l=i.prev;((u=l)==null?void 0:u.children.length)===0;){var u;l=l.prev}l.foreachCellInner(function(e){var t=new Set(e.emptyRow);t.has(i.rowId)||(e.emptyRow=[i.rowId].concat(L(t)))})}i.foreachCellInner(function(e){var n=b(e.emptyRow),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;r.has(o)||i.parent.insertBefore(t.scroll.create(R.tableRow,{tableId:t.tableId,rowId:o}),i.next)}}catch(e){n.e(e)}finally{n.f()}})}},a=n.length-1;a>=0;a--)i()}},{key:`sortMergeChildren`,value:function(){var e=x(x(x(x(x({},R.tableCaption,[]),R.tableColgroup,[]),R.tableHead,[]),R.tableBody,[]),R.tableFoot,[]);this.children.forEach(function(t){e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(var t=0,n=Object.values(e);t<n.length;t++)for(var r=n[t],i=1;i<r.length;i++)r[i].moveChildren(r[0]);var a=e[R.tableCaption][0],o=e[R.tableColgroup][0],s=e[R.tableHead][0],c=e[R.tableBody][0],l=e[R.tableFoot][0],u=a&&this.children.head!==a,d=o&&a&&a.next!==o,f=o&&!a&&this.children.head!==o,p=s&&!c&&!l&&this.children.tail!==s,m=c&&s&&c.prev!==s,h=c&&!l&&this.children.tail!==c,g=c&&l&&c.next!==l,_=l&&this.children.tail!==l;if(u||d||f||p||m||h||g||_){var v=this.clone();a&&v.appendChild(a),o&&v.appendChild(o),s&&v.appendChild(s),c&&v.appendChild(c),l&&v.appendChild(l),this.children.forEach(function(e){return e.remove()}),v.moveChildren(this)}}},{key:`insertRow`,value:function(e){var t=this.getColIds(),n=this.descendants(J),r=new Set(t),i=0,a=b(n),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i===e)break;s.foreachCellInner(function(n){if(i+n.rowspan>e&&(n.rowspan+=1,r.delete(n.colId),n.colspan!==1))for(var a=t.indexOf(n.colId),o=0;o<n.colspan-1;o++)r.delete(t[a+o+1])}),i+=1}}catch(e){a.e(e)}finally{a.f()}var c=this.tableId,l=G(),u=this.scroll.create(R.tableRow,{tableId:c,rowId:l}),d=b(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=this.scroll.create(`break`).wrap(`block`).wrap(R.tableCellInner,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1}).wrap(R.tableCell,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1});u.appendChild(m)}}catch(e){d.e(e)}finally{d.f()}var h=n[e]||null;h?h.parent.insertBefore(u,h):n[n.length-1].parent.appendChild(u)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]),r=e.tableId,i=e.full,a=e.align;return n.dataset.tableId=r,a===`right`||a===`center`?n.dataset.align=a:n.removeAttribute(`date-align`),i&&(n.dataset.full=String(i)),n.setAttribute(`cellpadding`,`0`),n.setAttribute(`cellspacing`,`0`),n}}])}(K);x(X,`blotName`,R.tableMain),x(X,`tagName`,`table`),x(X,`className`,`ql-table`);var Hr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof X&&(this.parent.full=e)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`findCol`,value:function(e){for(var t=this.children.iterator(),n=0,r;(r=t())&&n!==e;)n++;return r}},{key:`insertColByIndex`,value:function(e,t){var n=this.parent;if(!(n instanceof X))throw TypeError(`TableColgroupFormat should be child of TableFormat`);var r=this.findCol(e),i=this.scroll.create(R.tableCol,t);if(n.full){for(var a=this.children.iterator(),o;o=a();)if(o.width-i.width>=z.colMinWidthPre){o.width-=i.width;break}}this.insertBefore(i,r)}},{key:`removeColByIndex`,value:function(e){var t=this.parent;if(!(t instanceof X))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);var n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}},{key:`checkMerge`,value:function(){var e=this.next,t=this.parent;return t instanceof X&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.full,a=this.align;n!=null&&n.statics.blotName!==R.tableMain&&this.wrap(R.tableMain,{tableId:r,full:i,align:a});var o=U(this,R.tableMain);o.align=a,I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,e.full&&(n.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(n.dataset.align=e.align),n.setAttribute(`contenteditable`,`false`),n}}])}(K);x(Hr,`blotName`,R.tableColgroup),x(Hr,`tagName`,`colgroup`);var Ur=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(jr);x(Ur,`blotName`,R.tableFoot),x(Ur,`tagName`,`tfoot`);var Wr=function(e){function t(){return _(this,t),g(this,t,arguments)}return w(t,e),y(t)}(jr);x(Wr,`blotName`,R.tableHead),x(Wr,`tagName`,`thead`);var Gr=t.default.import(`parchment`),Kr=function(e){function n(e,r,i){var a;return _(this,n),a=g(this,n,[e,r]),x(a,`scroll`,void 0),x(a,`insertLineAround`,function(){(!a.prev||!a.isBlockLine(a.prev))&&a.parent.insertBefore(a.scroll.create(`block`),a),(!a.next||!a.isBlockLine(a.next))&&a.parent.insertBefore(a.scroll.create(`block`),a.next)}),a.scroll=e,a.scroll.emitter.on(t.default.events.TEXT_CHANGE,a.insertLineAround),a}return w(n,e),y(n,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){if(this.length()===0){this.remove();return}I(n,`optimize`,this,3)([e])}},{key:`deleteAt`,value:function(e,t){I(n,`deleteAt`,this,3)([e,t]);var r=this.descendants(jr),i=this.descendants(Hr);r.length===0&&i.length===0&&this.remove()}},{key:`remove`,value:function(){I(n,`remove`,this,3)([]),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}},{key:`isBlockLine`,value:function(e){return e instanceof Gr.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}}],[{key:`create`,value:function(e){var t=I(n,`create`,this,2)([]);return t.dataset.tableId=e,t.addEventListener(`dragstart`,function(e){e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,function(e){e.preventDefault()}),t.addEventListener(`dragover`,function(e){e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}}])}(K);x(Kr,`blotName`,R.tableWrapper),x(Kr,`tagName`,`div`),x(Kr,`className`,`ql-table-wrapper`);function Z(e){for(var t=new Set([R.tableHead,R.tableBody,R.tableFoot]),n=e.children.iterator(),r=null,i={};r=n();)t.has(r.statics.blotName)&&(i[r.statics.blotName]=r);if(Object.values(i).length<=0)return{rect:null,head:null,body:null,foot:null};var a=Object.values(i).reduce(function(e,t){var n=t.domNode.getBoundingClientRect();return j(j({},e),{},{top:Math.min(e.top,n.top),bottom:Math.max(e.bottom,n.bottom),left:Math.min(e.left,n.left),right:Math.max(e.right,n.right)})},{top:1/0,bottom:0,left:1/0,right:0,width:0,height:0,x:1/0,y:1/0});return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,{rect:a,head:i[R.tableHead]||null,body:i[R.tableBody]||null,foot:i[R.tableFoot]||null}}var qr=function(){function e(t,n){_(this,e),x(this,`tableModule`,void 0),x(this,`quill`,void 0),x(this,`table`,void 0),x(this,`tableSelectMouseDownHandler`,void 0),this.tableModule=t,this.quill=n,this.tableSelectMouseDownHandler=this.tableSelectHandler.bind(this),this.quill.root.addEventListener(`mousedown`,this.tableSelectMouseDownHandler)}return y(e,[{key:`tableSelectHandler`,value:function(e){var t=e.composedPath();if(!(e.button!==0||!t||t.length<=0)){var n=t.find(function(e){var t;return((t=e.tagName)==null?void 0:t.toUpperCase())===`TABLE`});this.setSelectionTable(n)}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.hide(),this.table=e,this.table&&this.show(),this.update())}},{key:`hide`,value:function(){}},{key:`show`,value:function(){}},{key:`update`,value:function(){}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`mousedown`,this.tableSelectMouseDownHandler),this.hide(),this.table=void 0}}])}(),Jr=function(e){function n(e,r,i){var a;return _(this,n),a=g(this,n,[e,r]),x(a,`tableModule`,void 0),x(a,`quill`,void 0),x(a,`tableBlot`,void 0),x(a,`tableWrapperBlot`,void 0),x(a,`alignBox`,void 0),x(a,`cleanup`,void 0),x(a,`bem`,H(`align`)),x(a,`resizeObserver`,void 0),x(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.alignBox=a.buildTools(),a.hide(),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return w(n,e),y(n,[{key:`buildTools`,value:function(){for(var e=this.tableModule.addContainer(this.bem.b()),n=t.default.import(`ui/icons`),r={left:n.align[``],center:n.align.center,right:n.align.right},i=0,a=Object.entries(r);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=document.createElement(`span`);l.dataset.align=s,l.classList.add(this.bem.be(`item`)),l.innerHTML=`<i class="icon">${c}</i>`,l.addEventListener(`click`,this.handleAlignItemClick.bind(this)),e.appendChild(l)}return e}},{key:`handleAlignItemClick`,value:function(e){var t=e.currentTarget;if(t){var n=t.dataset.align;n&&this.tableBlot&&this.setTableAlign(this.tableBlot,n)}}},{key:`setTableAlign`,value:function(e,t){var n=b(e.getCols()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.align=t}}catch(e){n.e(e)}finally{n.f()}}},{key:`show`,value:function(){var e=this;!this.table||!this.alignBox||(this.tableBlot=t.default.find(this.table),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=ar(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.cleanup&&this.cleanup(),this.cleanup=Gn(this.tableWrapperBlot.domNode,this.alignBox,function(){return e.update()}))}},{key:`hide`,value:function(){this.tableBlot=void 0,this.tableWrapperBlot=void 0,this.alignBox&&this.alignBox.classList.add(this.bem.is(`hidden`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0)}},{key:`update`,value:function(){var e=this;if(!(!this.alignBox||!this.tableBlot||!this.tableWrapperBlot)){if(!this.table||this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}Xn(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[Jn(),qn({limiter:Yn()}),Kn(16)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.alignBox.style,{left:`${n}px`,top:`${r}px`})})}}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.hide(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=null)}}])}(qr);x(Jr,`moduleName`,`table-align`);var Yr=t.default.import(`delta`);function Xr(e,t,n){var r=Zr(t),i=r.rows,a=r.cols,o=Qr(n),s=o.rows,c=o.cols,l=o.cells;i===s&&a===c?ei(t,l,e):ri(e,t,l)}function Zr(e){return e.length===0?{rows:0,cols:0}:$r(ti(e))}function Qr(e){var t=new Map,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.attributes;if(a){var o=a[R.tableCellInner];if(o){var s=`${o.rowId}-${o.colId}`;if(!t.has(s)){var c={rowId:o.rowId,colId:o.colId,rowspan:o.rowspan||1,colspan:o.colspan||1,deltaOps:[]};o.emptyRow&&o.emptyRow.length>0&&(c.emptyRow=o.emptyRow),t.set(s,c)}var l=t.get(s),u=R.tableCellInner;a[u];var d=M(a,[u].map(ie));l.deltaOps.push({insert:i.insert,attributes:j({},d)})}}}}catch(e){n.e(e)}finally{n.f()}var f=Array.from(t.values());return j(j({},$r(ti(f))),{},{cells:f})}function $r(e){var t=1/0,n=-1/0,r=1/0,i=-1/0,a=b(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.cell,l=s.rowIndex,u=s.colIndex,d=c.colspan||1,f=c.rowspan||1;t=Math.min(t,l),n=Math.max(n,l+f-1),r=Math.min(r,u),i=Math.max(i,u+d-1)}}catch(e){a.e(e)}finally{a.f()}return{rows:Math.max(n-t+1,0),cols:Math.max(i-r+1,0)}}function ei(e,t,n){var r=ti(e),i=ti(t),a=new Map,o=b(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;a.set(`${c.rowIndex}-${c.colIndex}`,c.cell)}}catch(e){o.e(e)}finally{o.f()}var l=[],u=new Set,d=b(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=p.cell;if(!(!m.domNode.isConnected||u.has(m))){var h=a.get(`${p.rowIndex}-${p.colIndex}`);if(h){var g=ii(n,m,h.deltaOps,{rowspan:h.rowspan,colspan:h.colspan,emptyRow:h.emptyRow});l.push(g),u.add(m)}}}}catch(e){d.e(e)}finally{d.f()}ai(n,l)}function ti(e){var t=[],n=ni(e),r=-1,i=new Map,a=b(n.entries()),o;try{for(a.s();!(o=a.n()).done;){var s=F(o.value,2),c=s[0],l=s[1];i.has(c)||(r+=1,i.set(c,r));var u=0,d=b(l),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;t.push({cell:p,rowIndex:i.get(c),colIndex:u}),u+=p.colspan||1;var m=b(p.emptyRow||[]),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;i.has(g)||(r+=1,i.set(g,r))}}catch(e){m.e(e)}finally{m.f()}}}catch(e){d.e(e)}finally{d.f()}}}catch(e){a.e(e)}finally{a.f()}return t}function ni(e){var t=new Map,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.has(i.rowId)||t.set(i.rowId,[]),t.get(i.rowId).push(i)}}catch(e){n.e(e)}finally{n.f()}return t}function ri(e,t,n){for(var r=ni(n),i=Array.from(r.values()),a=Zr(t).cols,o=[],s=0;s<t.length;s++){var c=t[s],l=Math.floor(s/a),u=s%a,d=i[l%i.length],f=d[u%d.length],p=ii(e,c,f.deltaOps);o.push(p)}ai(e,o)}function ii(e,t,n,r){var i=r||{},a=i.rowspan,o=a===void 0?1:a,s=i.colspan,c=s===void 0?1:s,l=i.emptyRow;r&&(t.rowspan=o,t.colspan=c,l&&l.length>0&&(t.emptyRow=l));var u=t.formats(),d=new Yr,f=b(n),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;d.insert(m.insert,j(j({},m.attributes),u))}}catch(e){f.e(e)}finally{f.f()}return{offset:t.offset(e.quill.scroll),length:t.length(),insertDelta:d,cell:t,rowspan:o,colspan:c,emptyRow:l}}function ai(e,n){if(n.length!==0){n.sort(function(e,t){return e.offset-t.offset});for(var r=new Yr,i=0;i<n.length;i++){var a=n[i],o=a.offset;if(i!==0){var s=n[i-1];o=a.offset-s.offset-s.length}r=r.retain(o).concat(a.insertDelta).delete(a.length)}var c=b(n),l;try{for(c.s();!(l=c.n()).done;){var u=l.value;oi(e,u)}}catch(e){c.e(e)}finally{c.f()}e.quill.updateContents(r,t.default.sources.USER)}}function oi(e,t){var n=t.cell,r=t.rowspan,i=r===void 0?1:r,a=t.colspan,o=a===void 0?1:a;if(!(i===1&&o===1)){var s=U(n,R.tableMain);if(s){var c=n.getTableRow();if(c){var l=s.descendants(q),u=s.getRows(),d=u.indexOf(c),f=n.getColumnIndex(),p=[],m=b(l),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g!==n){var _=g.getTableRow();if(_){var v=u.indexOf(_),y=g.getColumnIndex(),x=v>=d&&v<d+i,S=y>=f&&y<f+o;x&&S&&p.push(g)}}}}catch(e){m.e(e)}finally{m.f()}for(var C=e.talbeModule.options.autoMergeCell,w=0,T=p;w<T.length;w++){var E=T[w];if(E.domNode.isConnected){var D=E.getTableRow();E.remove(),!C&&D&&D.length()<=0&&D.remove()}}}}}}var si=[`style`],ci=[`attributes`],li=[`attributes`],ui=[`background`],di=t.default.import(`delta`),fi=t.default.import(`modules/clipboard`);function pi(e){var t=Number.parseFloat(e.getAttribute(`width`));if(Number.isNaN(t)){var n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t||z.colDefaultWidth}function mi(e,t){for(var n=Array(t).fill(z.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`)),i=0,a=r;i<a.length;i++)for(var o=a[i],s=Array.from(o.querySelectorAll(`td`)),c=0,l=0,u=s;l<u.length;l++){var d=u[l],f=d.colSpan||1;if(c<t)for(var p=pi(d),m=0;m<f;m++)n[c+m]=p/f;else break;c+=f}return n}var hi=function(e){function t(e,n){var r;return _(this,t),r=g(this,t,[e,n]),x(r,`quill`,void 0),x(r,`tableId`,G()),x(r,`rowId`,G()),x(r,`colIds`,[]),x(r,`rowspanCount`,[]),x(r,`cellCount`,0),x(r,`colCount`,0),r.quill=e,r.addMatcher(`table`,r.matchTable.bind(r)),r.addMatcher(`thead`,r.matchThead.bind(r)),r.addMatcher(`tbody`,r.matchTbody.bind(r)),r.addMatcher(`tfoot`,r.matchTfoot.bind(r)),r.addMatcher(`colgroup`,r.matchColgroup.bind(r)),r.addMatcher(`col`,r.matchCol.bind(r)),r.addMatcher(`tr`,r.matchTr.bind(r)),r.addMatcher(`td`,r.matchTd.bind(r)),r.addMatcher(`th`,r.matchTd.bind(r)),r.addMatcher(`caption`,r.matchCaption.bind(r)),r.addMatcher(Node.ELEMENT_NODE,r.matchTdAttributor.bind(r)),r}return w(t,e),y(t,[{key:`getStyleBackgroundColor`,value:function(e,t){var n=e.style.backgroundColor;if(n){var r=b(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner],c=s.style,l=M(s,si),u=hr(c||``);u.backgroundColor||(u.backgroundColor=n,o.attributes[R.tableCellInner]=j(j({},l),{},{style:gr(u)}))}}}catch(e){r.e(e)}finally{r.f()}}}},{key:`matchTable`,value:function(e,t){var n=this;if(t.ops.length===0)return t;for(var r=[],i=[],a=-1,o=0;o<t.ops.length;o++){var s=t.ops[o],c=s.attributes,l=s.insert;if(!Ae(l)&&(!c||!c[R.tableCellInner]&&!c[R.tableCaption])){t.ops.splice(o,1),--o;continue}var u=c||{},d=R.tableCell;u.table,u[d];var f=M(u,[`table`,d].map(ie)),p=Ae(l)&&l[R.tableCol];p?i.push({insert:l}):r.push({attributes:f,insert:l}),!(f!=null&&f[R.tableCellInner])&&!(f!=null&&f[R.tableCaption])&&!p&&Oe(l)&&l.trim().length>0&&(a=o)}var m=mi(e,this.colIds.length).reduce(function(e,t,r){return i[r]?e.push(i[r]):e.push({insert:x({},R.tableCol,{tableId:n.tableId,colId:n.colIds[r],width:t,full:!1})}),e},[]);r.splice.apply(r,[a+1,0].concat(L(m)));var h=new di(r);return this.getStyleBackgroundColor(e,h),this.tableId=G(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,h}},{key:`matchTbody`,value:function(e,t){this.getStyleBackgroundColor(e,t);for(var n=[],r=t.ops.length-1;r>=0;r--){var i,a=t.ops[r];if(!((i=a.attributes)!=null&&i[R.tableCellInner])){n=[];for(var o=a.insert?Oe(a.insert)?a.insert.split(`
18
+ `).length-1:1:0,s=0;s<o;s++)n.push(G())}else if(a.attributes){var c=a.attributes[R.tableCellInner];if(c.rowspan===1)n=[];else if(n.length>0&&(c.emptyRow||(c.emptyRow=[]),n.length>c.emptyRow.length)){var l;(l=c.emptyRow).push.apply(l,L(n.slice(c.emptyRow.length-n.length)))}}}return this.rowspanCount=[],t}},{key:`matchThead`,value:function(e,t){var n=this.matchTbody(e,t),r=b(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner];s.wrapTag=`thead`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchTfoot`,value:function(e,t){var n=this.matchTbody(e,t),r=b(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner];s.wrapTag=`tfoot`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchColgroup`,value:function(e,t){var n=[],r=b(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a&&Ae(a.insert)&&a.insert[R.tableCol]&&n.push(a)}}catch(e){r.e(e)}finally{r.f()}return new di(n)}},{key:`matchCol`,value:function(e,t){var n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);for(var r=new di,i=0;i<n;i++)this.colIds[this.colCount]=G(),r.insert(x({},R.tableCol,Object.assign(Vr.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]}))),this.colCount+=1;return r}},{key:`matchTr`,value:function(e,t){this.rowId=G(),this.cellCount=0;var n=b(this.rowspanCount.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];o.rowspan>0&&--o.rowspan,o.rowspan<=0&&(this.rowspanCount[a]={rowspan:0,colspan:0})}}catch(e){n.e(e)}finally{n.f()}return this.getStyleBackgroundColor(e,t),t.ops.length===0?new di([{insert:`
19
19
  `}]):t}},{key:`matchTd`,value:function(e,t){var n=e,r=Y.formats(n);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(var i=this.cellCount;i>=0;i--)this.colIds[i]||(this.colIds[i]=G()),this.rowspanCount[i]||(this.rowspanCount[i]={rowspan:0,colspan:0});for(var a=this.cellCount;a<this.rowspanCount.length;a++){var o=this.rowspanCount[a],s=o.rowspan,c=o.colspan;if(s===0)break;this.cellCount+=c}r.rowspan>1&&(this.rowspanCount[this.cellCount]={rowspan:r.rowspan,colspan:r.colspan});var l=this.colIds[this.cellCount];this.cellCount+=r.colspan;var u=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:l});n.style.border===`none`&&(u.style=u.style.replaceAll(/border-(top|right|bottom|left)-style:none;?/g,``));var d=[],f=b(t.ops),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.attributes,g=h===void 0?{}:h,_=M(m,ci),v=R.tableCell;g[v];var y=M(g,[v].map(ie));d.push(j(j({},_),{},{attributes:j(j({},y),{},x({},R.tableCellInner,u))}))}}catch(e){f.e(e)}finally{f.f()}return(d.length<=0||!Oe(d[d.length-1].insert)||!d[d.length-1].insert.endsWith(`
20
20
  `))&&d.push({insert:`
21
21
  `,attributes:x({},R.tableCellInner,u)}),new di(d)}},{key:`matchTdAttributor`,value:function(e,t){if(e.tagName.toLocaleLowerCase()===`td`){var n=[],r=b(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.attributes,s=M(a,li),c=o==null?void 0:o[R.tableCellInner];if(o&&c!=null&&c.style){var l=o.background,u=M(o,ui),d=document.createElement(`div`);d.style.background=l;var f=document.createElement(`div`);if(f.style.cssText=c.style,d.style.background===f.style.backgroundColor){n.push(j(j({},s),{},{attributes:j({},u)}));continue}}n.push(a)}}catch(e){r.e(e)}finally{r.f()}return new di(n)}return t}},{key:`convert`,value:function(e){var n=e.html,r=e.text,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=I(t,`convert`,this,3)([{html:n,text:r},i]);if(i[R.tableCellInner]){var o=b(a.ops),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(Ae(c.insert)&&c.insert[R.tableCol]){c.insert=``;continue}c.attributes||(c.attributes={}),c.attributes[R.tableCellInner]=i[R.tableCellInner]}}catch(e){o.e(e)}finally{o.f()}}return a}},{key:`matchCaption`,value:function(e,t){var n=b(t.ops),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.attributes;a!=null&&a[R.tableCaption]&&(a[R.tableCaption].tableId=this.tableId,i.attributes=a)}}catch(e){n.e(e)}finally{n.f()}return t}}])}(fi),gi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
@@ -134,7 +134,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
134
134
  </div>`}}catch(e){s.e(e)}finally{s.f()}var d=document.createElement(`div`);d.classList.add(this.bem.be(`col`));var f=document.createElement(`div`);f.classList.add(this.bem.be(`col-wrapper`)),Object.assign(d.style,{transform:`translateY(-${this.options.size}px)`,maxWidth:`${i.width}px`,height:`${this.options.size}px`}),Object.assign(f.style,{width:`${t.width}px`}),f.innerHTML=o,d.appendChild(f),this.root.appendChild(d),d.scrollLeft=this.tableWrapperBlot.domNode.scrollLeft,this.colHeadWrapper=d,this.bindColEvents()}if(r.length>0){for(var p=``,m=0;m<r.length;m++){var h,g=m,_=r[m],v=_.domNode.getBoundingClientRect().height;if(_.children.length===1&&(((h=_.children.head)==null?void 0:h.emptyRow.length)||0)>0){for(var y=_.children.head.emptyRow.length,x=m+1;x<r.length&&x<=m+y;x++){var S=r[x];v+=S.domNode.getBoundingClientRect().height}m+=y}p+=`<div class="${this.bem.be(`row-header`)}" data-index="${g}" style="height: ${v}px">
135
135
  <div class="${this.bem.be(`row-separator`)}" style="width: ${t.width+this.options.size-3}px"></div>
136
136
  </div>`}var C=document.createElement(`div`);C.classList.add(this.bem.be(`row`));var w=document.createElement(`div`);w.classList.add(this.bem.be(`row-wrapper`)),Object.assign(C.style,{transform:`translateX(-${this.options.size}px)`,width:`${this.options.size}px`,maxHeight:`${i.height}px`}),Object.assign(w.style,{height:`${t.height}px`}),w.innerHTML=p,C.appendChild(w),this.root.appendChild(C),C.scrollTop=this.tableWrapperBlot.domNode.scrollTop,this.rowHeadWrapper=C,this.bindRowEvents()}var T=F(he(this.tableBlot,Br),1)[0],E=!T||(T==null?void 0:T.side)!==`top`;E?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`));var D=-1*this.options.size,O=-1*this.options.size;Bi(this.tableBlot)?(this.root.classList.add(this.bem.is(`align-right`)),D=Math.min(i.width,t.width),O=Math.min(i.width,t.width)):this.root.classList.remove(this.bem.is(`align-right`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.options.size}px) translateX(${D}px)`,top:`${E?0:t.height+this.options.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${O}px)`,maxHeight:`${i.height}px`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${E?0:t.height+this.options.size}px`,maxWidth:`${i.width}px`})}}}},{key:`show`,value:function(){var e=this;!this.table||!this.tableBlot||(this.root.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=ar(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.update(),or.call(this,this.quill.root,function(){e.update()}))}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`)),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.hide(),cr.call(this),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange);var e=b(this.scrollHandler),r;try{for(e.s();!(r=e.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];a.removeEventListener(`scroll`,o)}}catch(t){e.e(t)}finally{e.f()}this.root.remove()}}])}(Wi);x(Ji,`moduleName`,`table-resize-box`);var Yi=function(e){function n(e,r){var i;return _(this,n),i=g(this,n,[e,r]),x(i,`tableModule`,void 0),x(i,`quill`,void 0),x(i,`colResizer`,void 0),x(i,`rowResizer`,void 0),x(i,`currentTableCell`,void 0),x(i,`tableCellBlot`,void 0),x(i,`bem`,H(`resize-line`)),x(i,`stopColDrag`,void 0),x(i,`stopRowDrag`,void 0),x(i,`scrollHandler`,[]),x(i,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(i.table&&!i.quill.root.contains(i.table)?i.setSelectionTable(void 0):i.update())}),x(i,`pointermoveHandler`,function(e){if(!i.dragging){var n=i.tableModule.getModule(V.tableSelectionName);if(!(n!=null&&n.dragging)){var r=i.findTableCell(e);if(!r)return i.hide();var a=t.default.find(r);a&&i.currentTableCell!==r&&(i.show(),i.currentTableCell=r,i.tableCellBlot=a,i.tableBlot=U(a,R.tableMain),i.tableBlot.getCols().length>0&&i.updateColResizer(),i.updateRowResizer(),or.call(i,i.quill.root,function(){i.dragging||i.hideResizer()}))}}}),i.tableModule=e,i.quill=r,i.colResizer=i.tableModule.addContainer(i.bem.be(`col`)),i.rowResizer=i.tableModule.addContainer(i.bem.be(`row`)),i.quill.on(t.default.events.EDITOR_CHANGE,i.updateWhenTextChange),i}return w(n,e),y(n,[{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.hide(),this.table=e,this.table&&this.show())}},{key:`findTableCell`,value:function(e){var t=b(e.composedPath()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;if(r instanceof HTMLElement&&[`TD`,`TH`].includes(r.tagName))return r;if(r===document.body)return null}}catch(e){t.e(e)}finally{t.f()}return null}},{key:`findDragColIndex`,value:function(e){var t=this;return this.tableCellBlot?e.findIndex(function(e){return e.colId===t.tableCellBlot.colId}):-1}},{key:`updateColResizer`,value:function(){var e=this;if(!(!this.tableBlot||!this.tableCellBlot||!this.colResizer)){this.colResizer.remove();var t=Z(this.tableBlot).rect;if(t){this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var n=this.tableCellBlot.domNode.getBoundingClientRect(),r=this.quill.root.getBoundingClientRect(),i=n.right-r.x;Bi(this.tableBlot)&&(i=n.left-r.x),Object.assign(this.colResizer.style,{top:`${t.y-r.y}px`,left:`${i}px`,height:`${t.height}px`});var a=er(this.colResizer,{axis:`x`,onStart:function(t,n){if(e.dragging=!0,e.calculateColDragRange(),e.dragXCommon.createBreak(),e.tableBlot){var r=e.tableBlot.domNode.parentElement.getBoundingClientRect(),i=Z(e.tableBlot).rect;if(i){e.dragXCommon.startValue=i.x;var a=e.quill.root.getBoundingClientRect();Object.assign(e.dragXCommon.dragBreak.style,{top:`${Math.max(r.y,i.y)-a.y}px`,left:`${n.clientX-a.x}px`,height:`${Math.min(r.height,i.height)}px`})}}},onMove:function(t){var n=t.position;if(e.dragXCommon.dragBreak){var r=e.dragXCommon.limitRange(e.tableBlot,n.x,!0),i=e.quill.root.getBoundingClientRect();e.dragXCommon.dragBreak.style.left=`${r-i.x}px`}},onEnd:function(t){var n=t.position;if(e.dragging=!1,e.colResizer){var r=e.dragXCommon.limitRange(e.tableBlot,n.x,!0),i=e.quill.root.getBoundingClientRect();e.colResizer.style.left=`${r-i.x}px`}e.updateTableCol(n.x),e.removeBreak()}}).stop;this.stopColDrag&&this.stopColDrag(),this.stopColDrag=a,this.colResizer.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}}},{key:`findDragRowIndex`,value:function(e){if(!this.tableCellBlot)return-1;var t=this.tableCellBlot.parent;return t instanceof J?e.indexOf(t):-1}},{key:`updateRowResizer`,value:function(){var e=this;if(!(!this.tableBlot||!this.tableCellBlot||!this.rowResizer)){var t=this.tableCellBlot;this.rowResizer.remove();var n=Z(this.tableBlot).rect;if(n){this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var r=t.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${r.bottom-i.y}px`,left:`${n.x-i.x}px`,width:`${n.width}px`});var a=er(this.rowResizer,{axis:`y`,onStart:function(t,n){if(e.dragging=!0,e.calculateRowDragRange(),e.dragYCommon.createBreak(),e.tableBlot){var r=e.tableBlot.domNode.parentElement.getBoundingClientRect(),i=Z(e.tableBlot).rect;if(i){e.dragYCommon.startValue=i.y;var a=e.quill.root.getBoundingClientRect();Object.assign(e.dragYCommon.dragBreak.style,{top:`${n.clientY-a.y}px`,left:`${Math.max(r.x,i.x)-a.x}px`,width:`${Math.min(r.width,i.width)}px`})}}},onMove:function(t){var n=t.position;if(!(!e.dragYCommon.dragBreak||!e.table)){var r=e.dragYCommon.limitRange(e.tableBlot,n.y,!0),i=e.quill.root.getBoundingClientRect();e.dragYCommon.dragBreak.style.top=`${r-i.y}px`}},onEnd:function(t){var n=t.position;if(e.dragging=!1,e.rowResizer){var r=e.dragYCommon.limitRange(e.tableBlot,n.y,!0),i=e.quill.root.getBoundingClientRect();e.rowResizer.style.left=`${r-i.y}px`}e.updateTableRow(n.y),e.removeBreak()}}).stop;this.stopRowDrag&&this.stopRowDrag(),this.stopRowDrag=a,this.rowResizer.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}}},{key:`show`,value:function(){!this.table||!this.rowResizer||!this.colResizer||(this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`)),this.table.addEventListener(`pointermove`,this.pointermoveHandler))}},{key:`hideResizer`,value:function(){!this.rowResizer||!this.colResizer||(this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`)))}},{key:`hide`,value:function(){this.currentTableCell=void 0,cr.call(this),this.hideResizer(),this.table&&this.table.removeEventListener(`pointermove`,this.pointermoveHandler)}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.colResizer&&(this.colResizer.remove(),this.colResizer=void 0),this.rowResizer&&(this.rowResizer.remove(),this.rowResizer=void 0),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange)}}])}(Wi);x(Yi,`moduleName`,`table-resize-line`);var Xi=function(e){function n(e,r,i){var a;return _(this,n),a=g(this,n,[e,r]),x(a,`tableModule`,void 0),x(a,`quill`,void 0),x(a,`scrollHandler`,[]),x(a,`tableMainBlot`,void 0),x(a,`tableWrapperBlot`,void 0),x(a,`bem`,H(`scale`)),x(a,`options`,void 0),x(a,`root`,void 0),x(a,`block`,void 0),x(a,`resizeobserver`,new ResizeObserver(function(){return a.update()})),x(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.options=a.resolveOptions(i),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return w(n,e),y(n,[{key:`resolveOptions`,value:function(e){return Object.assign({blockSize:12,offset:6},e)}},{key:`buildResizer`,value:function(){var e=this;if(!(!this.tableMainBlot||!this.tableWrapperBlot)){this.root=this.tableModule.addContainer(this.bem.b()),this.block=document.createElement(`div`),this.block.classList.add(this.bem.be(`block`)),Object.assign(this.block.style,{width:`${this.options.blockSize}px`,height:`${this.options.blockSize}px`}),this.root.appendChild(this.block);var t=[],n=[];er(this.block,{onStart:function(){e.tableMainBlot&&(t=e.tableMainBlot.getCols().map(function(e){return{blot:e,width:Math.floor(e.width)}}),n=e.tableMainBlot.getRows().map(function(e){return{blot:e,height:Math.floor(e.domNode.getBoundingClientRect().height)}}))},onMove:function(r){var i=r.movePosition;if(e.tableMainBlot){var a=Bi(e.tableMainBlot)?-1:1,o=i.x*a,s=i.y,c=Math.floor(o/t.length),l=Math.floor(s/n.length),u=b(t),d;try{for(u.s();!(d=u.n()).done;){var f=d.value,p=f.blot,m=f.width;p.width=Math.max(m+c,z.colMinWidthPx)}}catch(e){u.e(e)}finally{u.f()}var h=b(n),g;try{for(h.s();!(g=h.n()).done;){var _=g.value,v=_.blot,y=_.height;v.setHeight(`${Math.max(y+l,z.rowMinHeightPx)}px`)}}catch(e){h.e(e)}finally{h.f()}}},onEnd:function(){t=[],n=[]}}),this.block.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`update`,value:function(){if(!(!this.block||!this.root||!this.tableMainBlot||!this.tableWrapperBlot)){if(this.tableMainBlot.full){this.hide();return}var e=Z(this.tableMainBlot).rect;if(e){var t=this.tableWrapperBlot.domNode.getBoundingClientRect(),n=this.quill.root.getBoundingClientRect(),r=this.tableWrapperBlot.domNode,i=r.scrollTop,a=r.scrollLeft,o=this.options.blockSize*2+this.options.offset,s=Math.min(e.width,t.width)+o,c=Math.min(e.height,t.height)+o;Object.assign(this.root.style,{width:`${s}px`,height:`${c}px`,left:`${Math.max(e.x,t.x)-n.x-this.options.blockSize}px`,top:`${Math.max(e.y,t.y)-n.y-this.options.blockSize}px`});var l={left:`${e.width+o-a}px`,top:`${c-i}px`};Bi(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),l.left=`${this.options.blockSize+-1*a}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,l)}}}},{key:`show`,value:function(){var e=this;this.table&&(this.tableMainBlot=t.default.find(this.table),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.resizeobserver.observe(this.tableMainBlot.domNode),or.call(this,this.quill.root,function(){return e.update()}),or.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})),this.buildResizer())}},{key:`hide`,value:function(){this.tableMainBlot=void 0,this.tableWrapperBlot=void 0,this.root&&(this.root.remove(),this.root=void 0,this.block=void 0),cr.call(this)}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.hide(),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect()}}])}(qr);x(Xi,`moduleName`,`table-resize-scale`);var Zi={size:`height`,offset:`offsetHeight`,scrollDirection:`scrollTop`,scrollSize:`scrollHeight`,axis:`y`,direction:`top`,client:`clientY`},Qi={size:`width`,offset:`offsetWidth`,scrollDirection:`scrollLeft`,scrollSize:`scrollWidth`,axis:`x`,direction:`left`,client:`clientX`},$i=function(){function e(n,r,i){var a=this;_(this,e),x(this,`quill`,void 0),x(this,`table`,void 0),x(this,`options`,void 0),x(this,`minSize`,20),x(this,`gap`,4),x(this,`move`,0),x(this,`cursorDown`,!1),x(this,`cursorLeave`,!1),x(this,`ratioY`,1),x(this,`ratioX`,1),x(this,`sizeWidth`,``),x(this,`sizeHeight`,``),x(this,`size`,``),x(this,`bem`,H(`scrollbar`)),x(this,`tableMainBlot`,void 0),x(this,`ob`,void 0),x(this,`container`,void 0),x(this,`scrollbar`,void 0),x(this,`thumb`,document.createElement(`div`)),x(this,`scrollHandler`,[]),x(this,`propertyMap`,void 0),x(this,`thumbState`,{x:0,y:0}),x(this,`showScrollbar`,_r(function(){a.cursorLeave=!1,a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.style.display=a.size?`block`:`none`,requestAnimationFrame(function(){a.scrollbar.classList.remove(a.bem.is(`transparent`))})},200)),x(this,`hideScrollbar`,_r(function(){a.cursorLeave=!0,!a.cursorDown&&(a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.addEventListener(`transitionend`,a.hideScrollbarTransitionend,{once:!0}),a.scrollbar.classList.add(a.bem.is(`transparent`)))},200)),x(this,`hideScrollbarTransitionend`,function(){a.scrollbar.style.display=a.cursorDown&&a.size?`block`:`none`}),this.quill=n,this.table=r,this.options=i,this.tableMainBlot=t.default.find(this.table),this.container=r.parentElement,this.propertyMap=this.isVertical?Zi:Qi,this.calculateSize(),this.ob=new ResizeObserver(function(){return a.update()}),this.ob.observe(r),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),or.call(this,this.quill.root,function(){return a.setScrollbarPosition()}),this.showScrollbar()}return y(e,[{key:`isVertical`,get:function(){return this.options.isVertical}},{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Z(this.tableMainBlot),t=e.rect,n=e.head,r=e.body,i=e.foot,a=n||r||i;if(!(!a||!t)){var o=this.quill.root,s=o.scrollLeft,c=o.scrollTop,l=o.offsetLeft,u=o.offsetTop,d=this.container,f=d.offsetLeft,p=d.offsetTop,m=a.domNode,h=m.offsetLeft,g=m.offsetTop,_=this.container.getBoundingClientRect(),v=_.width,y=_.height,b=f+h-l,S=p+g-u;this.isVertical?b+=Math.min(v,t.width):S+=Math.min(y,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(b+=this.table.offsetLeft-f),Object.assign(this.scrollbar.style,x(x({},this.propertyMap.size,`${this.isVertical?Math.min(y,t.height):v}px`),`transform`,`translate(${b-s}px, ${S-c}px)`)),this.containerScrollHandler(this.container)}}},{key:`calculateSize`,value:function(){var e=this.container.offsetHeight-this.gap,t=this.container.offsetWidth-this.gap,n=Math.pow(e,2)/this.container.scrollHeight,r=Math.pow(t,2)/this.container.scrollWidth,i=Math.max(n,this.minSize),a=Math.max(r,this.minSize);this.ratioY=n/(e-n)/(i/(e-i)),this.ratioX=r/(t-r)/(a/(t-a)),this.sizeWidth=a+this.gap<t?`${a}px`:``,this.sizeHeight=i+this.gap<e?`${i}px`:``,this.size=this.isVertical?this.sizeHeight:this.sizeWidth}},{key:`createScrollbar`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b(),this.isVertical?this.bem.is(`vertical`):this.bem.is(`horizontal`),this.bem.is(`transparent`)),Object.assign(t.style,{display:`none`}),this.thumb.classList.add(this.bem.be(`thumb`));var n=null,r=function(t){if(e.cursorDown!==!1){var n=e.thumbState[e.propertyMap.axis];if(n){var r=Math.pow(e.scrollbar[e.propertyMap.offset],2)/e.container[e.propertyMap.scrollSize]/(e.isVertical?e.ratioY:e.ratioX)/e.thumb[e.propertyMap.offset],i=((e.scrollbar.getBoundingClientRect()[e.propertyMap.direction]-t[e.propertyMap.client])*-1-(e.thumb[e.propertyMap.offset]-n))*100*r/e.scrollbar[e.propertyMap.offset];e.container[e.propertyMap.scrollDirection]=i*e.container[e.propertyMap.scrollSize]/100}}},i=function(){e.thumbState[e.propertyMap.axis]=0,e.cursorDown=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),e.cursorLeave&&e.hideScrollbar(),document.onselectstart=n},a=function(t){t.stopImmediatePropagation(),e.cursorDown=!0,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i),n=document.onselectstart,document.onselectstart=function(){return!1}};this.thumb.addEventListener(`mousedown`,function(t){var n;if(t.stopPropagation(),!(t.ctrlKey||[1,2].includes(t.button))){(n=window.getSelection())==null||n.removeAllRanges(),a(t);var r=t.currentTarget;r&&(e.thumbState[e.propertyMap.axis]=r[e.propertyMap.offset]-(t[e.propertyMap.client]-r.getBoundingClientRect()[e.propertyMap.direction]))}});for(var o=[this.table,t],s=0,c=o;s<c.length;s++){var l=c[s];l.addEventListener(`mouseenter`,this.showScrollbar),l.addEventListener(`mouseleave`,this.hideScrollbar)}return or.call(this,this.container,function(){e.containerScrollHandler(e.container)}),t.appendChild(this.thumb),t}},{key:`containerScrollHandler`,value:function(e){var t=e[this.propertyMap.offset]-this.gap;this.move=e[this.propertyMap.scrollDirection]*100/t*(this.isVertical?this.ratioY:this.ratioX),Object.assign(this.thumb.style,x(x({},this.propertyMap.size,this.size),`transform`,`translate${this.propertyMap.axis.toUpperCase()}(${this.move}%)`))}},{key:`destroy`,value:function(){this.ob.disconnect(),cr.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),ea=function(e){function n(e,r,i){var a;_(this,n),a=g(this,n,[e,r]),x(a,`tableModule`,void 0),x(a,`quill`,void 0),x(a,`scrollbarContainer`,void 0),x(a,`scrollbar`,[]),x(a,`bem`,H(`scrollbar`)),x(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r;var o=H(`scrollbar`);return a.quill.container.classList.add(o.bm(`virtual`)),a.scrollbarContainer=a.tableModule.addContainer(a.bem.be(`container`)),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return w(n,e),y(n,[{key:`hide`,value:function(){var e=b(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;)t.value.destroy()}catch(t){e.e(t)}finally{e.f()}this.scrollbar=[],this.scrollbarContainer.innerHTML=``}},{key:`show`,value:function(){if(this.table){this.scrollbar=[new $i(this.quill,this.table,{isVertical:!0}),new $i(this.quill,this.table,{isVertical:!1})];var e=b(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.scrollbarContainer.appendChild(n.scrollbar),n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}}},{key:`update`,value:function(){if(this.table){this.scrollbar.length<=0&&this.show();var e=b(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.calculateSize(),n.setScrollbarPosition()}}catch(t){e.e(t)}finally{e.f()}}else this.scrollbar.length>0&&this.hide()}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.hide(),this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}}])}(qr);x(ea,`moduleName`,`table-scrollbar`);var ta=0,na=function(e){function n(e,r){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return _(this,n),i=g(this,n,[e,r]),x(i,`tableModule`,void 0),x(i,`quill`,void 0),x(i,`options`,void 0),x(i,`boundary`,null),x(i,`scrollRecordEls`,[]),x(i,`startScrollRecordPosition`,[]),x(i,`selectedTableScrollX`,0),x(i,`selectedTableScrollY`,0),x(i,`selectedEditorScrollX`,0),x(i,`selectedEditorScrollY`,0),x(i,`selectedTds`,[]),x(i,`cellSelectWrap`,void 0),x(i,`cellSelect`,void 0),x(i,`scrollHandler`,[]),x(i,`resizeObserver`,void 0),x(i,`isDisplaySelection`,!1),x(i,`bem`,H(`selection`)),x(i,`autoScroller`,void 0),x(i,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),x(i,`_dragging`,!1),x(i,`handlePaste`,function(e){if(!(!(document.activeElement&&i.quill.root.contains(document.activeElement))||i.quill.getSelection())){var t=e.clipboardData;if(t){e.preventDefault();var n=i.selectedTds;if(!(n.length<=0)){var r=t.getData(`text/html`),a=i.quill.clipboard.convert({html:r}).ops.filter(function(e){var t;return(t=e.attributes)==null?void 0:t[R.tableCellInner]});a.length!==0&&Xr({quill:i.quill,talbeModule:i.tableModule},n,a)}}}}),x(i,`keyboardHandler`,function(){var e=h(P().mark(function e(t){var n;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.ctrlKey){e.next=4;break}n=t.key,e.next=n===`c`||n===`x`?1:3;break;case 1:return e.next=2,Ni(i.tableModule,i.selectedTds,t.key===`x`);case 2:return e.abrupt(`continue`,3);case 3:e.next=5;break;case 4:(t.key===`Backspace`||t.key===`Delete`)&&i.removeCellBySelectedTds();case 5:case`end`:return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),x(i,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(i.table&&!i.quill.root.contains(i.table)?i.setSelectionTable(void 0):i.updateAfterEvent())}),x(i,`updateAfterEvent`,function(){var e=b(i.selectedTds),t;try{for(e.s();!(t=e.n()).done;)if(!t.value.domNode.isConnected){i.selectedTds=[];break}}catch(t){e.e(t)}finally{e.f()}i.updateWithSelectedTds()}),x(i,`quillSelectionChangeHandler`,function(e,n,r){if(r!==t.default.sources.API&&e&&!i.quill.composition.isComposing&&i.selectedTds.length>0){var a=i.quill.getFormat(e),o=F(i.quill.getLine(e.index),1)[0],s=!!a[R.tableCellInner]&&!!o,c=o&&i.selectedTds.some(function(e){return e.domNode.contains(o.domNode)});if(s&&!c)try{var l=U(o,R.tableCellInner);i.setSelectedTds([l]),i.updateWithSelectedTds()}catch(e){}else s&&c||i.hide()}}),x(i,`selectionChangeHandler`,function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,a=e.anchorOffset,o=e.focusOffset;if(!(!n||!r)){var s=t.default.find(n),c=t.default.find(r);if(!(!s||!c||s.scroll!==i.quill.scroll||c.scroll!==i.quill.scroll)){var l=me(s),u=me(c),d=l.has(R.tableColgroup),f=u.has(R.tableColgroup);if(d||f){var p=n,m=a,h=r,g=o;if(d){var _=l.get(R.tableWrapper).descendants(q);_.length>0&&(p=_[0].domNode,m=0)}if(f){var v=u.get(R.tableWrapper).descendants(q);v.length>0&&(h=v[0].domNode,g=0)}i.setSelectionData(e,{anchorNode:p,anchorOffset:m,focusNode:h,focusOffset:g});return}var y=l.has(R.tableCellInner),b=u.has(R.tableCellInner),x=y&&b;if(x){var S=l.get(R.tableCellInner),C=u.get(R.tableCellInner);x&&(x=S!==C)}if(y&&b&&x||!y&&b||!b&&y){i.setSelectionData(e,i.lastSelection),i.selectedTds.length>0&&i.hide();return}i.lastSelection={anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:o}}}}}),i.tableModule=e,i.quill=r,i.options=i.resolveOptions(a),i.scrollRecordEls=[i.quill.root,document.documentElement],i.cellSelectWrap=e.addContainer(i.bem.b()),i.cellSelect=i.helpLinesInitial(),i.resizeObserver=ar(i.updateAfterEvent,{ignoreFirstBind:!0}),i.resizeObserver.observe(i.quill.root),document.addEventListener(`paste`,i.handlePaste),document.addEventListener(`selectionchange`,i.selectionChangeHandler),i.quill.on(B.AFTER_TABLE_RESIZE,i.updateAfterEvent),i.quill.on(t.default.events.SELECTION_CHANGE,i.quillSelectionChangeHandler),i.quill.on(t.default.events.EDITOR_CHANGE,i.updateWhenTextChange),i.autoScroller=new dr(50,40),i.hide(),i}return w(n,e),y(n,[{key:`dragging`,get:function(){return this._dragging},set:function(e){this._dragging!==e&&(this._dragging=e,this.quill.emitter.emit(e?B.TABLE_SELECTION_DRAG_START:B.TABLE_SELECTION_DRAG_END,this))}},{key:`removeCellBySelectedTds`,value:function(){var e=this.quill.getSelection(),n=document.activeElement;if(!(e||!this.quill.root.contains(n))){if(this.table){var r=t.default.find(this.table),i=r.descendants(q);if(this.selectedTds.length===i.length){r.remove();return}}var a=b(this.selectedTds),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.clone();c.appendChild(s.scroll.create(`block`)),s.parent.insertBefore(c,s),s.remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:`setSelectedTds`,value:function(e){var t=new Set(this.selectedTds),n=this.selectedTds.length===e.length&&e.every(function(e){return t.has(e)});this.selectedTds=e,n||this.quill.emitter.emit(B.TABLE_SELECTION_CHANGE,this,this.selectedTds)}},{key:`setSelectionData`,value:function(e,t){var n=t.anchorNode,r=t.anchorOffset,i=t.focusNode,a=t.focusOffset;if(!(!n||!i)){var o=document.createRange(),s=this.selectionDirectionUp(t);s?(o.setStart(n,r),o.setEnd(n,r)):(o.setStart(n,r),o.setEnd(i,a)),e.removeAllRanges(),e.addRange(o),s&&e.extend(i,a)}}},{key:`selectionDirectionUp`,value:function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,i=e.focusOffset;if(!t||!r)return!1;if(t===r)return n>i;var a=t.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_CONTAINS||a&Node.DOCUMENT_POSITION_CONTAINED_BY?(a&Node.DOCUMENT_POSITION_FOLLOWING)!==0:(a&Node.DOCUMENT_POSITION_PRECEDING)!==0}},{key:`resolveOptions`,value:function(e){return Object.assign({selectColor:`#0589f340`},e)}},{key:`helpLinesInitial`,value:function(){this.cellSelectWrap.style.setProperty(`--select-color`,this.options.selectColor);var e=document.createElement(`div`);return e.classList.add(this.bem.be(`line`)),this.cellSelectWrap.appendChild(e),e}},{key:`computeSelectedTds`,value:function(e,n){if(!this.table)return[];var r=t.default.find(this.table);if(!r)return[];var i=new Set(r.descendants(Y).map(function(e,t){return e.index=t,e})),a=this.getScrollPositionDiff(),o=Z(r).rect;if(!o)return[];for(var s=e.x+a.x,c=e.y+a.y,l={x:Math.max(o.left,Math.min(n.x,s)),y:Math.max(o.top,Math.min(n.y,c)),x1:Math.min(o.right,Math.max(n.x,s)),y1:Math.min(o.bottom,Math.max(n.y,c))},u=new Set,d=!0;d;){d=!1;var f=b(i),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;m.__rect||(m.__rect=m.domNode.getBoundingClientRect());var h=m.__rect,g=h.x,_=h.y,v=h.right,y=h.bottom;if(tr({x:Math.floor(l.x),y:Math.floor(l.y),x1:Math.floor(l.x1),y1:Math.floor(l.y1)},{x:Math.floor(g),y:Math.floor(_),x1:Math.floor(v),y1:Math.floor(y)},ta,u.size===0)){u.add(m),i.delete(m),l={x:Math.min(l.x,g),y:Math.min(l.y,_),x1:Math.max(l.x1,v),y1:Math.max(l.y1,y)},d=!0;break}}}catch(e){f.e(e)}finally{f.f()}}for(var x=0,S=[].concat(L(u),L(i));x<S.length;x++){var C=S[x];delete C.__rect}return this.boundary=nr(j(j({},l),{},{width:l.x1-l.x,height:l.y1-l.y}),this.quill.root),Array.from(u).toSorted(function(e,t){return e.index-t.index}).map(function(e){return delete e.index,e.getCellInner()})}},{key:`getScrollPositionDiff`,value:function(){var e=this,t=this.getTableViewScroll(),n=t.x,r=t.y,i=lr(this.quill.root),a=i.x,o=i.y;return this.selectedTableScrollX=n,this.selectedTableScrollY=r,this.selectedEditorScrollX=a,this.selectedEditorScrollY=o,this.startScrollRecordPosition.reduce(function(t,n,r){var i=n.x,a=n.y,o=lr(e.scrollRecordEls[r]),s=o.x,c=o.y;return t.x+=i-s,t.y+=a-c,t},{x:0,y:0})}},{key:`recordScrollPosition`,value:function(){this.clearRecordScrollPosition();var e=b(this.scrollRecordEls),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.startScrollRecordPosition.push(lr(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`tableSelectHandler`,value:function(e){var n=this,r=e.button,i=e.target,a=e.clientX,o=e.clientY,s=i.closest(`table`),c=i.closest(`caption`);if(!(r!==0||!s||c)){this.setSelectionTable(s);var l=s.dataset.tableId,u={x:a,y:o};this.recordScrollPosition(),this.setSelectedTds(this.computeSelectedTds(u,u)),this.show();var d=function(e){n.dragging=!0;var t=e.button,r=e.target,i=e.clientX,a=e.clientY,o=r.closest(`.ql-table`),s=r.closest(`caption`);if(!(t!==0||s||!o||o.dataset.tableId!==l)){var c={x:i,y:a};n.setSelectedTds(n.computeSelectedTds(u,c)),n.selectedTds.length>1&&n.quill.blur(),n.update(),n.autoScroller.updateMousePosition(i,a)}},f=function(){document.body.removeEventListener(`mousemove`,d,!1),document.body.removeEventListener(`mouseup`,f,!1),n.autoScroller.stop(),n.dragging=!1,n.clearRecordScrollPosition()};document.body.addEventListener(`mousemove`,d,!1),document.body.addEventListener(`mouseup`,f,!1);var p=t.default.find(s);if(p){var m=p.parent.domNode;this.autoScroller.updateMousePosition(a,o),this.autoScroller.start(m)}}}},{key:`updateWithSelectedTds`,value:function(){if(this.selectedTds.length<=0){this.hide();return}var e={x:1/0,y:1/0},t={x:-1/0,y:-1/0},n=b(this.selectedTds),r;try{for(n.s();!(r=n.n()).done;){var i=r.value.domNode.getBoundingClientRect();e.x=Math.min(e.x,i.left),e.y=Math.min(e.y,i.top),t.x=Math.max(t.x,i.right),t.y=Math.max(t.y,i.bottom)}}catch(e){n.e(e)}finally{n.f()}this.setSelectedTds(this.computeSelectedTds(e,t)),this.selectedTds.length>0?this.update():this.hide()}},{key:`update`,value:function(){if(!this.table){this.hide();return}if(!(this.selectedTds.length===0||!this.boundary)){var e=lr(this.quill.root),t=e.x,n=e.y,r=this.getTableViewScroll(),i=r.x,a=r.y,o=this.table.parentElement.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect(),c=o.x-s.x,l=o.y-s.y;Object.assign(this.cellSelect.style,{left:`${this.selectedEditorScrollX*2-t+this.boundary.x+this.selectedTableScrollX-i-c}px`,top:`${this.selectedEditorScrollY*2-n+this.boundary.y+this.selectedTableScrollY-a-l}px`,width:`${this.boundary.width}px`,height:`${this.boundary.height}px`}),Object.assign(this.cellSelectWrap.style,{left:`${c}px`,top:`${l}px`,width:`${o.width}px`,height:`${o.height}px`}),this.quill.emitter.emit(B.TABLE_SELECTION_DISPLAY_CHANGE,this)}}},{key:`getTableViewScroll`,value:function(){return this.table?lr(this.table.parentElement):{x:0,y:0}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.table=e,this.table?this.scrollRecordEls.push(this.table.parentElement):this.scrollRecordEls.pop())}},{key:`showDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`block`}),this.isDisplaySelection=!0,this.table&&this.resizeObserver.observe(this.table)}},{key:`show`,value:function(){var e=this;this.table&&(cr.call(this),this.showDisplay(),this.update(),this.quill.root.addEventListener(`keydown`,this.keyboardHandler),or.call(this,this.quill.root,function(){e.update()}),or.call(this,this.table.parentElement,function(){e.update()}))}},{key:`hideDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`none`}),this.isDisplaySelection=!1,this.table&&this.resizeObserver.unobserve(this.table)}},{key:`hide`,value:function(){cr.call(this),this.quill.root.removeEventListener(`keydown`,this.keyboardHandler),this.hideDisplay(),this.boundary=null,this.setSelectedTds([]),this.setSelectionTable(void 0)}},{key:`destroy`,value:function(){I(n,`destroy`,this,3)([]),this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),cr.call(this),document.removeEventListener(`paste`,this.handlePaste),document.removeEventListener(`selectionchange`,this.selectionChangeHandler),this.quill.off(B.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler)}}])}(qr);x(na,`moduleName`,V.tableSelectionName);var ra=[`attributes`],ia=[`style`],aa=[`emptyRow`],oa=t.default.import(`parchment`),sa=t.default.import(`delta`),ca=t.default.import(`ui/icons`),la=t.default.import(`blots/break`),ua=t.default.import(`blots/block`),da=t.default.import(`blots/block/embed`);function fa(e,t){var n={tableId:t.tableId,rowId:t.rowId,colId:t.colId,colspan:1,rowspan:1},r=e.create(R.tableCell,n),i=e.create(R.tableCellInner,n),a=e.create(`block`);return a.appendChild(e.create(`break`)),i.appendChild(a),r.appendChild(i),r}function pa(e){ue.delete(R.tableCellInner),Object.assign(R,e.blotName||{}),Object.assign(z,e.tableUpSize||{}),Object.assign(B,e.tableUpEvent||{}),Object.assign(V,e.tableUpInternal||{}),ga.moduleName=V.moduleName,ga.toolName=R.tableWrapper,K.blotName=R.container,Br.blotName=R.tableCaption,Kr.blotName=R.tableWrapper,X.blotName=R.tableMain,Hr.blotName=R.tableColgroup,Vr.blotName=R.tableCol,Wr.blotName=R.tableHead,jr.blotName=R.tableBody,Ur.blotName=R.tableFoot,J.blotName=R.tableRow,Y.blotName=R.tableCell,q.blotName=R.tableCellInner,ue.add(R.tableCellInner)}function ma(e,n){return Ue({onSelect:function(r,i){e.insertTable(r,i,t.default.sources.USER),n&&n.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function ha(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[R.tableCellInner],handler:function(n,r){var i=e?`prev`:`next`,a=e?`tail`:`head`;if(r.line[i])return!0;var o=this.quill.selection.getBounds(n.index),s=r.line.domNode.getBoundingClientRect();if(!o||!s)return!0;if(e){if(o.top-s.top>3)return!0}else if(s.bottom-o.bottom>3)return!0;var c,l,u,d;try{var f=F(pe(r.line,[R.tableWrapper,R.tableMain,R.tableRow,R.tableCell]),4);c=f[0],l=f[1],u=f[2],d=f[3]}catch(e){return!0}var p=l.getColIds(),m=c.descendants(Br,0)[0],h;if(m){var g=window.getComputedStyle(m.domNode);h=i===`next`&&g.captionSide===`bottom`?m:i===`next`?c.next:m}else h=c[i];if(r.line[i]||!h)return!0;var _=u[i];if(_){var v=p.indexOf(d.colId),y=_.getCellByColId(p[v],i);if(!y)return!0;var b=y.children[a];b.children&&(b=b.children[a]);var x=b.offset(this.quill.scroll)+Math.min(r.offset,b.length()-1);this.quill.setSelection(x,0,t.default.sources.USER)}else{var S=h.offset(this.quill.scroll)+(e?h.length()-1:0);this.quill.setSelection(S,0,t.default.sources.USER)}return!1}}}var ga=function(){function e(t,n){var r=this;_(this,e),x(this,`quill`,void 0),x(this,`options`,void 0),x(this,`toolBox`,void 0),x(this,`fixTableByLisenter`,_r(this.balanceTables,100)),x(this,`selector`,void 0),x(this,`resizeOb`,void 0),x(this,`editableObserver`,void 0),x(this,`modules`,{}),this.quill=t,this.options=this.resolveOptions(n||{}),this.toolBox=this.initialContainer();var i=this.quill.getModule(`toolbar`);if(i&&this.quill.theme.pickers){var a=F((i.controls||[]).find(function(e){return F(e,1)[0]===r.statics.toolName})||[],2)[1];if((a==null?void 0:a.tagName.toLocaleLowerCase())===`select`){var o=this.quill.theme.pickers.find(function(e){return e.select===a});o&&(o.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,o),o.label.addEventListener(`mousedown`,function(){if(!(!r.selector||!o))if(ir(r.selector.getBoundingClientRect()).leftLimited){var e=o.label.getBoundingClientRect();Object.assign(o.options.style,{transform:`translateX(calc(-100% + ${e.width}px))`})}else Object.assign(o.options.style,{transform:void 0})}))}}for(var s=this.quill.getModule(`keyboard`),c=0,l=Object.values(e.keyboradHandler);c<l.length;c++){var u=l[c];u.bindInHead?s.bindings[u.key].unshift(u):s.addBinding(u.key,u)}this.initModules(),this.listenEditableChange(),this.quillHack(),this.listenBalanceCells()}return y(e,[{key:`statics`,get:function(){return this.constructor}},{key:`initialContainer`,value:function(){var e=this,t=H(`toolbox`),n=this.quill.addContainer(t.b());return this.resizeOb=new ResizeObserver(function(){var t=e.quill.root.getBoundingClientRect(),r=e.quill.root,i=r.offsetLeft,a=r.offsetTop;Object.assign(n.style,{top:`${a}px`,left:`${i}px`,width:`${t.width}px`,height:`${t.height}px`})}),this.resizeOb.observe(this.quill.root),n}},{key:`addContainer`,value:function(e){if(Oe(e)){var t=document.createElement(`div`),n=b(e.split(` `)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.classList.add(i)}}catch(e){n.e(e)}finally{n.f()}return this.toolBox.appendChild(t),t}else return this.toolBox.appendChild(e),e}},{key:`resolveOptions`,value:function(e){return Object.assign({customBtn:!1,texts:this.resolveTexts(e.texts||{}),full:!1,fullSwitch:!0,icon:ca.table,autoMergeCell:!0,modules:[]},e)}},{key:`resolveTexts`,value:function(e){return Object.assign({fullCheckboxText:`Insert full width table`,customBtnText:`Custom`,confirmText:`Confirm`,cancelText:`Cancel`,rowText:`Row`,colText:`Column`,notPositiveNumberError:`Please enter a positive integer`,custom:`Custom`,clear:`Clear`,transparent:`Transparent`,perWidthInsufficient:`The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?`,CopyCell:`Copy cell`,CutCell:`Cut cell`,InsertTop:`Insert row above`,InsertRight:`Insert column right`,InsertBottom:`Insert row below`,InsertLeft:`Insert column Left`,MergeCell:`Merge Cell`,SplitCell:`Split Cell`,DeleteRow:`Delete Row`,DeleteColumn:`Delete Column`,DeleteTable:`Delete table`,BackgroundColor:`Set background color`,BorderColor:`Set border color`},e)}},{key:`initModules`,value:function(){if(this.quill.isEnabled()){var e=b(this.options.modules),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.modules[n.module.moduleName]=new n.module(this,this.quill,n.options)}}catch(t){e.e(t)}finally{e.f()}}}},{key:`listenEditableChange`,value:function(){var e=this;this.editableObserver=new MutationObserver(function(t){var n=b(t),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.type===`attributes`&&i.attributeName===`contenteditable`){e.quill.root.getAttribute(`contenteditable`)===`false`?e.destroyModules():e.initModules();break}}}catch(e){n.e(e)}finally{n.f()}}),this.editableObserver.observe(this.quill.root,{attributes:!0,attributeFilter:[`contenteditable`]})}},{key:`destroyModules`,value:function(){for(var e=0,t=Object.entries(this.modules);e<t.length;e++){var n=F(t[e],2),r=n[0],i=n[1];if(i&&typeof i.destroy==`function`)try{i.destroy()}catch(e){console.warn(`Failed to destroy module ${r}:`,e)}}this.modules={}}},{key:`getModule`,value:function(e){return this.modules[e]}},{key:`quillHack`,value:function(){var e=this,n=this.quill.getSemanticHTML;this.quill.getSemanticHTML=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0,a=n.call(e.quill,r,i),o=t.default.import(`formats/${R.tableWrapper}`),s=new DOMParser().parseFromString(a,`text/html`),c=0,l=Array.from(s.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} .${Y.className} > [contenteditable]`));c<l.length;c++)l[c].removeAttribute(`contenteditable`);return s.body.innerHTML};var r=this.quill.format;this.quill.format=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API;if(!(this.scroll.query(e).prototype instanceof oa.EmbedBlot)){var a=this.getModule(V.moduleName),o=this.getSelection(!0),s=this.getFormat(o),c=a.getModule(V.tableSelectionName);if(!s[R.tableCellInner]||o.length>0||a&&c&&c.selectedTds.length<=1)return r.call(this,e,n,i);if(a&&c&&c.selectedTds.length>0){var l=c.selectedTds,u=!1,d=[],f=b(l),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.offset(this.scroll),g=m.length();d.push({index:h,length:g}),this.getFormat(h,g)[e]!==n&&(u=!0)}}catch(e){f.e(e)}finally{f.f()}var _=u?n:!1,v=new sa,y=b(d.entries()),S;try{for(y.s();!(S=y.n()).done;){var C=F(S.value,2),w=C[0],T=C[1],E=T.index,D=T.length,O=w===0?0:d[w-1].index+d[w-1].length;v.retain(E-O).retain(D,x({},e,_))}}catch(e){y.e(e)}finally{y.f()}var k=this.updateContents(v,i);return this.blur(),k}}return r.call(this,e,n,i)};var i=this.quill.theme.modules.toolbar;if(i){var a,o=(a=i.handlers)==null?void 0:a.clean;if(o){var s=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return``},i=e.quill.getText(t,n),a=F(e.quill.getLine(t+n),2),o=a[0],s=a[1],c=0,l=new sa;o!=null&&(c=o.length()-s,l=o.delta().slice(s,s+c-1).insert(`
137
- `));var u=e.quill.getContents(t,n+c),d=u.diff(new sa().insert(i).concat(l)),f=0;return new sa(d.ops.map(function(e){var t=e.attributes,n=M(e,ra);if(e.insert?f-=Oe(e.insert)?e.insert.length:1:e.retain?f+=ke(e.retain)?e.retain:1:e.delete&&(f+=e.delete),t){var i=R.tableCellInner;t[i];var a=M(t,[i].map(ie));if(r){var o,s=u.slice(f-1,f).ops[0];if(s!=null&&(o=s.attributes)!=null&&o[R.tableCellInner]){var c=s.attributes[R.tableCellInner],l=c.style,d=M(c,ia),p=r(l);return p?j(j({},n),{},{attributes:j(j({},a),{},x({},R.tableCellInner,j({style:p},d)))}):j(j({},n),{},{attributes:j(j({},a),{},x({},R.tableCellInner,d))})}}return j(j({},n),{},{attributes:j({},a)})}return e}))};i.handlers.clean=function(e){var n=this,r=this.quill.getModule(V.moduleName),i=this.quill.getSelection();if(i&&i.length>0&&this.quill.getFormat(i)[R.tableCellInner]){var a=s(i.index,i.length,!1),c=new sa().retain(i.index).concat(a);this.quill.updateContents(c,t.default.sources.USER);return}var l=r.getModule(V.tableSelectionName);if(r&&l&&l.selectedTds.length>0&&l.table){var u=t.default.find(l.table);if(!u){console.warn(`TableMainFormat not found`);return}var d=l.selectedTds,f=new Set,p=[],m=b(d),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g.parent instanceof Y){var _=b(g.parent.getNearByCell(`top`)),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;f.has(y)||(f.add(y),p.push({td:y,cleanBorder:`bottom`}))}}catch(e){_.e(e)}finally{_.f()}var x=b(g.parent.getNearByCell(`left`)),S;try{for(x.s();!(S=x.n()).done;){var C=S.value;f.has(C)||(f.add(C),p.push({td:C,cleanBorder:`right`}))}}catch(e){x.e(e)}finally{x.f()}f.add(g.parent),p.push({td:g.parent,cleanBorder:!0})}}}catch(e){m.e(e)}finally{m.f()}var w=u.descendants(Y),T=new Map(w.map(function(e,t){return[e,t]}));p.sort(function(e,t){return T.get(e.td)-T.get(t.td)});for(var E=new sa,D=0,O=function(){var e=A[k],t=e.td,r=e.cleanBorder,i=t.getCellInner().offset(n.quill.scroll),a=t.getCellInner().length(),o=s(i,a-1,function(e){if(!e||r===!0)return``;var t=hr(e);return gr(Object.keys(t).filter(function(e){return!e.startsWith(pr(`border-${r}`))}).reduce(function(e,n){return e[n]=t[n],e},{}))}),c=new sa().retain(i-D).concat(o);E=E.concat(c),D=i+a},k=0,A=p;k<A.length;k++)O();this.quill.updateContents(E,t.default.sources.USER),d.length>1&&this.quill.blur();return}return o.call(this,e)}}}}},{key:`buildCustomSelect`,value:function(){var e=h(P().mark(function e(t,n){var r=this,i,a,o,s,c;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t||!Ee(t))){e.next=1;break}return e.abrupt(`return`);case 1:return i=document.createElement(`div`),i.classList.add(`ql-custom-select`),e.next=2,t(this,n);case 2:this.selector=e.sent,i.appendChild(this.selector),this.options.fullSwitch&&(a=H(`creator`),o=document.createElement(`label`),o.classList.add(a.be(`checkbox`)),s=document.createElement(`input`),s.type=`checkbox`,s.checked=this.options.full,s.addEventListener(`change`,function(){r.options.full=s.checked}),c=document.createElement(`span`),c.textContent=this.options.texts.fullCheckboxText,o.appendChild(s),o.appendChild(c),i.appendChild(o)),n.options.innerHTML=``,n.options.appendChild(i);case 3:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setCellAttrs`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length!==0){var i=b(e),a;try{for(i.s();!(a=i.n()).done;)a.value.setFormatValue(t,n,r)}catch(e){i.e(e)}finally{i.f()}}}},{key:`getTextByCell`,value:function(e){var t=``,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.offset(this.quill.scroll),o=i.length(),s=b(this.quill.getContents(a,o).ops),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;Oe(l.insert)&&(t+=l.insert)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}return t}},{key:`getHTMLByCell`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.length===0)return``;var n=null;try{var r=b(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=U(a,R.tableMain);if(n||(n=o),o!==n)return console.error(`tableMain is not same`),``}}catch(e){r.e(e)}finally{r.f()}}catch(e){return console.error(`tds must be in same tableMain`),``}if(!n)return``;var s=this.quill.getIndex(n),c=n.length(),l=this.quill.getSemanticHTML(s,c),u=new DOMParser().parseFromString(l,`text/html`),d=Array.from(u.querySelectorAll(`col`)),f=d.map(function(e){return e.dataset.colId}),p=[],m=new Set,h=new Set,g=b(e),_;try{for(g.s();!(_=g.n()).done;){var v=_.value;m.add(v.colId);for(var y=v.colId,x=f.indexOf(y),S=0;S<v.colspan;S++)m.add(f[x+S]);h.add(`${v.rowId}-${v.colId}`)}}catch(e){g.e(e)}finally{g.f()}for(var C=0;C<d.length;C++){var w=d[C];m.has(w.dataset.colId)?p.push(w.getAttribute(`width`)):(w.remove(),d.splice(C--,1))}for(var T=0,E=null,D=0,O=Array.from(u.querySelectorAll(`td, th`));D<O.length;D++){var k=O[D];if(h.has(`${k.dataset.rowId}-${k.dataset.colId}`))E!==k.dataset.rowId&&(T+=1,E=k.dataset.rowId);else{var A=k.parentElement;k.remove(),A&&A.children.length<=0&&A.remove()}}var j=d.map(function(e){return Vr.value(e)});if(n.full){var M=j.reduce(function(e,t){return t.width+e},0),N=b(j.entries()),ee;try{for(N.s();!(ee=N.n()).done;){var P=F(ee.value,2),te=P[0],ne=P[1];ne.width=Math.round(ne.width/M*100),d[te].setAttribute(`width`,`${ne.width}%`)}}catch(e){N.e(e)}finally{N.f()}}else{var I=0,L=b(j),re;try{for(L.s();!(re=L.n()).done;){var ie=re.value;I+=ie.width}}catch(e){L.e(e)}finally{L.f()}var ae=u.querySelector(`table`);ae.style.width=`${I}px`}if(t){var oe=n.getRows();if(T===oe.length)this.removeCol(e);else{var se=b(e),z;try{for(se.s();!(z=se.n()).done;){var B=z.value;B.domNode.innerHTML=`<p><br></p>`}}catch(e){se.e(e)}finally{se.f()}}}return u.body.innerHTML}},{key:`insertTable`,value:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API;if(e>=30||n>=30)throw Error(`Both rows and columns must be less than 30.`);this.quill.focus();var i=this.quill.getSelection();if(i!=null){var a=F(this.quill.getLeaf(i.index),1)[0];if(a){if(fe(a))throw Error(`Not supported ${a.statics.blotName} insert into table.`);var o=G(),s=Array(n).fill(0).map(function(){return G()}),c=this.calculateTableCellBorderWidth(),l=getComputedStyle(this.quill.root),u=Number.parseInt(l.paddingLeft),d=Number.parseInt(l.paddingRight),f=this.quill.root.scrollHeight>this.quill.root.clientHeight?ur({target:this.quill.root}):0,p=Number.parseInt(l.width)-u-d-c-f,m=this.options.full?`${Math.max(1/n*100,z.colMinWidthPre)}%`:`${Math.max(Math.floor(p/n),z.colMinWidthPx)}px`,h=[{retain:i.index}],g=this.quill.getContents(i.index,1),_=F(this.quill.getLine(i.index),2)[1];g.ops[0].insert!==`
137
+ `));var u=e.quill.getContents(t,n+c),d=u.diff(new sa().insert(i).concat(l)),f=0;return new sa(d.ops.map(function(e){var t=e.attributes,n=M(e,ra);if(e.insert?f-=Oe(e.insert)?e.insert.length:1:e.retain?f+=ke(e.retain)?e.retain:1:e.delete&&(f+=e.delete),t){var i=R.tableCellInner;t[i];var a=M(t,[i].map(ie));if(r){var o,s=u.slice(f-1,f).ops[0];if(s!=null&&(o=s.attributes)!=null&&o[R.tableCellInner]){var c=s.attributes[R.tableCellInner],l=c.style,d=M(c,ia),p=r(l);return p?j(j({},n),{},{attributes:j(j({},a),{},x({},R.tableCellInner,j({style:p},d)))}):j(j({},n),{},{attributes:j(j({},a),{},x({},R.tableCellInner,d))})}}return j(j({},n),{},{attributes:j({},a)})}return e}))};i.handlers.clean=function(e){var n=this,r=this.quill.getModule(V.moduleName),i=this.quill.getSelection();if(i&&i.length>0&&this.quill.getFormat(i)[R.tableCellInner]){var a=s(i.index,i.length,!1),c=new sa().retain(i.index).concat(a);this.quill.updateContents(c,t.default.sources.USER);return}var l=r.getModule(V.tableSelectionName);if(r&&l&&l.selectedTds.length>0&&l.table){var u=t.default.find(l.table);if(!u){console.warn(`TableMainFormat not found`);return}var d=l.selectedTds,f=new Set,p=[],m=b(d),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g.parent instanceof Y){var _=b(g.parent.getNearByCell(`top`)),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;f.has(y)||(f.add(y),p.push({td:y,cleanBorder:`bottom`}))}}catch(e){_.e(e)}finally{_.f()}var x=b(g.parent.getNearByCell(`left`)),S;try{for(x.s();!(S=x.n()).done;){var C=S.value;f.has(C)||(f.add(C),p.push({td:C,cleanBorder:`right`}))}}catch(e){x.e(e)}finally{x.f()}f.add(g.parent),p.push({td:g.parent,cleanBorder:!0})}}}catch(e){m.e(e)}finally{m.f()}var w=u.descendants(Y),T=new Map(w.map(function(e,t){return[e,t]}));p.sort(function(e,t){return T.get(e.td)-T.get(t.td)});for(var E=new sa,D=0,O=function(){var e=A[k],t=e.td,r=e.cleanBorder,i=t.getCellInner().offset(n.quill.scroll),a=t.getCellInner().length(),o=s(i,a-1,function(e){if(!e||r===!0)return``;var t=hr(e);return gr(Object.keys(t).filter(function(e){return!e.startsWith(pr(`border-${r}`))}).reduce(function(e,n){return e[n]=t[n],e},{}))}),c=new sa().retain(i-D).concat(o);E=E.concat(c),D=i+a},k=0,A=p;k<A.length;k++)O();this.quill.updateContents(E,t.default.sources.USER),d.length>1&&this.quill.blur();return}return o.call(this,e)}}}}},{key:`buildCustomSelect`,value:function(){var e=h(P().mark(function e(t,n){var r=this,i,a,o,s,c;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t||!Ee(t))){e.next=1;break}return e.abrupt(`return`);case 1:return i=document.createElement(`span`),i.classList.add(`ql-custom-select`),e.next=2,t(this,n);case 2:this.selector=e.sent,i.appendChild(this.selector),this.options.fullSwitch&&(a=H(`creator`),o=document.createElement(`label`),o.classList.add(a.be(`checkbox`)),s=document.createElement(`input`),s.type=`checkbox`,s.checked=this.options.full,s.addEventListener(`change`,function(){r.options.full=s.checked}),c=document.createElement(`span`),c.textContent=this.options.texts.fullCheckboxText,o.appendChild(s),o.appendChild(c),i.appendChild(o)),n.options.innerHTML=``,n.options.appendChild(i);case 3:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setCellAttrs`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length!==0){var i=b(e),a;try{for(i.s();!(a=i.n()).done;)a.value.setFormatValue(t,n,r)}catch(e){i.e(e)}finally{i.f()}}}},{key:`getTextByCell`,value:function(e){var t=``,n=b(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.offset(this.quill.scroll),o=i.length(),s=b(this.quill.getContents(a,o).ops),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;Oe(l.insert)&&(t+=l.insert)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}return t}},{key:`getHTMLByCell`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.length===0)return``;var n=null;try{var r=b(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=U(a,R.tableMain);if(n||(n=o),o!==n)return console.error(`tableMain is not same`),``}}catch(e){r.e(e)}finally{r.f()}}catch(e){return console.error(`tds must be in same tableMain`),``}if(!n)return``;var s=this.quill.getIndex(n),c=n.length(),l=this.quill.getSemanticHTML(s,c),u=new DOMParser().parseFromString(l,`text/html`),d=Array.from(u.querySelectorAll(`col`)),f=d.map(function(e){return e.dataset.colId}),p=[],m=new Set,h=new Set,g=b(e),_;try{for(g.s();!(_=g.n()).done;){var v=_.value;m.add(v.colId);for(var y=v.colId,x=f.indexOf(y),S=0;S<v.colspan;S++)m.add(f[x+S]);h.add(`${v.rowId}-${v.colId}`)}}catch(e){g.e(e)}finally{g.f()}for(var C=0;C<d.length;C++){var w=d[C];m.has(w.dataset.colId)?p.push(w.getAttribute(`width`)):(w.remove(),d.splice(C--,1))}for(var T=0,E=null,D=0,O=Array.from(u.querySelectorAll(`td, th`));D<O.length;D++){var k=O[D];if(h.has(`${k.dataset.rowId}-${k.dataset.colId}`))E!==k.dataset.rowId&&(T+=1,E=k.dataset.rowId);else{var A=k.parentElement;k.remove(),A&&A.children.length<=0&&A.remove()}}var j=d.map(function(e){return Vr.value(e)});if(n.full){var M=j.reduce(function(e,t){return t.width+e},0),N=b(j.entries()),ee;try{for(N.s();!(ee=N.n()).done;){var P=F(ee.value,2),te=P[0],ne=P[1];ne.width=Math.round(ne.width/M*100),d[te].setAttribute(`width`,`${ne.width}%`)}}catch(e){N.e(e)}finally{N.f()}}else{var I=0,L=b(j),re;try{for(L.s();!(re=L.n()).done;){var ie=re.value;I+=ie.width}}catch(e){L.e(e)}finally{L.f()}var ae=u.querySelector(`table`);ae.style.width=`${I}px`}if(t){var oe=n.getRows();if(T===oe.length)this.removeCol(e);else{var se=b(e),z;try{for(se.s();!(z=se.n()).done;){var B=z.value;B.domNode.innerHTML=`<p><br></p>`}}catch(e){se.e(e)}finally{se.f()}}}return u.body.innerHTML}},{key:`insertTable`,value:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API;if(e>=30||n>=30)throw Error(`Both rows and columns must be less than 30.`);this.quill.focus();var i=this.quill.getSelection();if(i!=null){var a=F(this.quill.getLeaf(i.index),1)[0];if(a){if(fe(a))throw Error(`Not supported ${a.statics.blotName} insert into table.`);var o=G(),s=Array(n).fill(0).map(function(){return G()}),c=this.calculateTableCellBorderWidth(),l=getComputedStyle(this.quill.root),u=Number.parseInt(l.paddingLeft),d=Number.parseInt(l.paddingRight),f=this.quill.root.scrollHeight>this.quill.root.clientHeight?ur({target:this.quill.root}):0,p=Number.parseInt(l.width)-u-d-c-f,m=this.options.full?`${Math.max(1/n*100,z.colMinWidthPre)}%`:`${Math.max(Math.floor(p/n),z.colMinWidthPx)}px`,h=[{retain:i.index}],g=this.quill.getContents(i.index,1),_=F(this.quill.getLine(i.index),2)[1];g.ops[0].insert!==`
138
138
  `&&_!==0&&h.push({insert:`
139
139
  `});for(var v=0;v<n;v++)h.push({insert:x({},R.tableCol,{width:m,tableId:o,colId:s[v],full:this.options.full})});for(var y=0;y<e;y++)for(var b=G(),S=0;S<n;S++)h.push({insert:`
140
140
  `,attributes:x({},R.tableCellInner,{tableId:o,rowId:b,colId:s[S],rowspan:1,colspan:1})});this.quill.updateContents(new sa(h),r),this.quill.setSelection(i.index+n,t.default.sources.SILENT),this.quill.focus()}}}},{key:`calculateTableCellBorderWidth`,value:function(){var e=`