PageSourceSearch

https://wcle.co.kr/_next/static/chunks/e55a69e2.e478aedc02ac554e.js

js wcle.co.kr collected 2026-10-02 02:00:24 UTC 117,857 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fdfad66b-2492-4eaf-b393-4dd9b03fdad2",e._sentryDebugIdIdentifier="sentry-dbid-fdfad66b-2492-4eaf-b393-4dd9b03fdad2")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[772],{17021:function(e,t,l){l.d(t,{Rn:function(){return tL},XK:function(){return tB},fj:function(){return eW},iA:function(){return eI},rY:function(){return tU},x0:function(){return tf}});var i=l(35711),n=l(58069),o=l(74482),r=l(48965),s=l(71189),a=l(3255),d=l(40976),c=l(76931),u=l(92625),h=l(40634);function m(e,t){let{modelAttribute:l,styleName:i,viewElement:n,defaultValue:o,reduceBoxSides:r=!1,shouldUpcast:s=()=>!0}=t;e.for("upcast").attributeToAttribute({view:{name:n,styles:{[i]:/[\s\S]+/}},model:{key:l,value:e=>{if(!s(e))return;let t=e.getNormalizedStyle(i),l=r?p(t):t;if(o!==l)return l}}})}function g(e,t,l,i){e.for("upcast").add(e=>e.on("element:"+t,(e,t,n)=>{if(!t.modelRange)return;let o=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>t.viewItem.hasStyle(e));if(!o.length)return;let r={styles:o};if(!n.consumable.test(t.viewItem,r))return;let s=[...t.modelRange.getItems({shallow:!0})].pop();n.consumable.consume(t.viewItem,r);let a={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},d={style:p(a.style),color:p(a.color),width:p(a.width)};d.style!==i.style&&n.writer.setAttribute(l.style,d.style,s),d.color!==i.color&&n.writer.setAttribute(l.color,d.color,s),d.width!==i.width&&n.writer.setAttribute(l.width,d.width,s)}))}function b(e,t){let{modelElement:l,modelAttribute:i,styleName:n}=t;e.for("downcast").attributeToAttribute({model:{name:l,key:i},view:e=>({key:"style",value:{[n]:e}})})}function f(e,t){let{modelAttribute:l,styleName:i}=t;e.for("downcast").add(e=>e.on(`attribute:${l}:table`,(e,t,l)=>{let{item:n,attributeNewValue:o}=t,{mapper:r,writer:s}=l;if(!l.consumable.consume(t.item,e.name))return;let a=[...r.toViewElement(n).getChildren()].find(e=>e.is("element","table"));o?s.setStyle(i,o,a):s.removeStyle(i,a)}))}function p(e){if(!e)return;let t=["top","right","bottom","left"];if(!t.every(t=>e[t]))return e;let l=e.top;return t.every(t=>e[t]===l)?l:e}function w(e,t,l,i,n=1){null!=t&&null!=n&&t>n?i.setAttribute(e,t,l):i.removeAttribute(e,l)}function C(e,t,l={}){let i=e.createElement("tableCell",l);return e.insertElement("paragraph",i),e.insert(i,t),i}function v(e,t){let l=parseInt(t.parent.parent.getAttribute("headingColumns")||"0"),{column:i}=e.getCellLocation(t);return!!l&&i<l}function _(e,t,l){let{modelAttribute:i}=l;e.extend("tableCell",{allowAttributes:[i]}),m(t,{viewElement:/^(td|th)$/,...l}),b(t,{modelElement:"tableCell",...l})}function y(e){let t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}function A(e){return t=>{t.on(`element:${e}`,(e,t,{writer:l})=>{if(!t.modelRange)return;let i=t.modelRange.start.nodeAfter,n=l.createPositionAt(i,0);if(t.viewItem.isEmpty){l.insertElement("paragraph",n);return}let o=Array.from(i.getChildren());if(o.every(e=>e.is("element","$marker"))){let e=l.createElement("paragraph");for(let t of(l.insert(e,l.createPositionAt(i,0)),o))l.move(l.createRangeOn(t),l.createPositionAt(e,"end"))}},{priority:"low"})}}class T{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();let e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null,l=this._getSpanned();if(l)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(l.cell,l.row,l.column));else{let l=e.getChild(this._cellIndex);if(!l)return this._advanceToNextRow();let i=parseInt(l.getAttribute("colspan")||"1"),n=parseInt(l.getAttribute("rowspan")||"1");(i>1||n>1)&&this._recordSpans(l,n,i),this._shouldSkipSlot()||(t=this._formatOutValue(l)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}
1skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,l=this._column){return{done:!1,value:new S(this,e,t,l)}}_shouldSkipSlot(){let e=this._skipRows.has(this._row),t=this._row<this._startRow,l=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||l||i}_getSpanned(){let e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,l){let i={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+l;t++)(e!=this._row||t!=this._column)&&this._markSpannedCell(e,t,i)}_markSpannedCell(e,t,l){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,l)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){let e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}}class S{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,l,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=l,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function k(e,t){return(l,{writer:i})=>{let o=l.getAttribute("headingRows")||0,r=i.createContainerElement("table",null,[]),s=i.createContainerElement("figure",{class:"table"},r);for(let{positionOffset:n,filter:s}of(o>0&&i.insert(i.createPositionAt(r,"end"),i.createContainerElement("thead",null,i.createSlot(e=>e.is("element","tableRow")&&e.index<o))),o<e.getRows(l)&&i.insert(i.createPositionAt(r,"end"),i.createContainerElement("tbody",null,i.createSlot(e=>e.is("element","tableRow")&&e.index>=o))),t.additionalSlots))i.insert(i.createPositionAt(r,n),i.createSlot(s));return i.insert(i.createPositionAt(r,"after"),i.createSlot(e=>!e.is("element","tableRow")&&!t.additionalSlots.some(({filter:t})=>t(e)))),t.asWidget?(i.setCustomProperty("table",!0,s),(0,n.XC)(s,i,{hasSelectionHandle:!0})):s}}function x(e={}){return(t,{writer:l})=>{let i=t.parent,o=i.parent,r=o.getChildIndex(i),s=new T(o,{row:r}),a=o.getAttribute("headingRows")||0,d=o.getAttribute("headingColumns")||0,c=null;for(let i of s)if(i.cell==t){let t=i.row<a||i.column<d?"th":"td";c=e.asWidget?(0,n.sC)(l.createEditableElement(t),l):l.createContainerElement(t);break}return c}}function V(e={}){return(t,{writer:l})=>{if(!t.parent.is("element","tableCell")||!R(t))return null;if(e.asWidget)return l.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{let e=l.createContainerElement("p");return l.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function R(e){return 1==e.parent.childCount&&!function(e){for(let t of e.getAttributeKeys())if(!t.startsWith("selection:")&&"htmlEmptyBlock"!=t)return!0;return!1}(e)}class P extends i.mY{refresh(){let e=this.editor.model,t=e.document.selection,l=e.schema;this.isEnabled=function(e,t){let l=e.getFirstPosition().parent,i=l===l.root?l:l.parent;return t.checkChild(i,"table")}(t,l)}execute(e={}){let t=this.editor,l=t.model,i=t.plugins.get("TableUtils"),n=t.config.get("table.defaultHeadings.rows"),o=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&n&&(e.headingRows=n),void 0===e.headingColumns&&o&&(e.headingColumns=o),l.change(t=>{let n=i.createTable(t,e);
1l.insertObject(n,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(n.getNodeByPath([0,0,0]),0))})}}class I extends i.mY{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,l=e.plugins.get("TableUtils"),i="above"===this.order,n=l.getSelectionAffectedTableCells(t),o=l.getRowIndexes(n),r=i?o.first:o.last,s=n[0].findAncestor("table");l.insertRows(s,{at:i?r:r+1,copyStructureFromAbove:!i})}}class E extends i.mY{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,l=e.plugins.get("TableUtils"),i="left"===this.order,n=l.getSelectionAffectedTableCells(t),o=l.getColumnIndexes(n),r=i?o.first:o.last,s=n[0].findAncestor("table");l.insertColumns(s,{columns:1,at:i?r:r+1})}}class B extends i.mY{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function z(e,t,l){let{startRow:i,startColumn:n,endRow:o,endColumn:r}=t,s=l.createElement("table"),a=o-i+1;for(let e=0;e<a;e++)l.insertElement("tableRow",s,"end");for(let{row:t,column:a,cell:d,isAnchor:c,cellAnchorRow:u,cellAnchorColumn:h}of[...new T(e,{startRow:i,endRow:o,startColumn:n,endColumn:r,includeAllSlots:!0})]){let e=t-i,m=s.getChild(e);if(c){let e=l.cloneElement(d);l.append(e,m),H(e,t,a,o,r,l)}else(u<i||h<n)&&C(l,l.createPositionAt(m,"end"))}return function(e,t,l,i,n){let o=parseInt(t.getAttribute("headingRows")||"0");o>0&&w("headingRows",o-l,e,n,0);let r=parseInt(t.getAttribute("headingColumns")||"0");r>0&&w("headingColumns",r-i,e,n,0)}(s,e,i,n,l),s}function N(e,t,l=0){let i=[];for(let n of new T(e,{startRow:l,endRow:t-1})){let{row:e,cellHeight:l}=n,o=e+l-1;e<t&&t<=o&&i.push(n)}return i}function W(e,t,l){let i;let n=e.parent,o=n.parent,r=n.index,s=parseInt(e.getAttribute("rowspan")),a=t-r,d={},c=s-a;c>1&&(d.rowspan=c);let u=parseInt(e.getAttribute("colspan")||"1");u>1&&(d.colspan=u);let h=r+a,m=[...new T(o,{startRow:r,endRow:h,includeAllSlots:!0})],g=null;for(let t of m){let{row:n,column:o,cell:r}=t;r===e&&void 0===i&&(i=o),void 0!==i&&i===o&&n===h&&(g=C(l,t.getPositionBefore(),d))}return w("rowspan",a,e,l),g}function D(e,t){let l=[];for(let i of new T(e)){let{column:e,cellWidth:n}=i,o=e+n-1;e<t&&t<=o&&l.push(i)}return l}function F(e,t,l,i){let n=parseInt(e.getAttribute("colspan")),o=l-t,r={},s=n-o;s>1&&(r.colspan=s);let a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);let d=C(i,i.createPositionAfter(e),r);return w("colspan",o,e,i),d}function H(e,t,l,i,n,o){let r=parseInt(e.getAttribute("colspan")||"1"),s=parseInt(e.getAttribute("rowspan")||"1");l+r-1>n&&w("colspan",n-l+1,e,o,1),t+s-1>i&&w("rowspan",i-t+1,e,o,1)}function L(e,t){let l=Array(t.getColumns(e)).fill(0);for(let{column:t}of new T(e))l[t]++;let i=l.reduce((e,t,l)=>t?e:[...e,l],[]);if(i.length>0){let l=i[i.length-1];return t.removeColumns(e,{at:l}),!0}return!1}function M(e,t){let l=[],i=t.getRows(e);for(let t=0;t<i;t++)e.getChild(t).isEmpty&&l.push(t);if(l.length>0){let i=l[l.length-1];return t.removeRows(e,{at:i}),!0}return!1}function O(e,t){L(e,t)||M(e,t)}function U(e,t){let l=Array.from(new T(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(l.every(({cellHeight:e})=>1===e))return t.lastRow;let i=l[0].cellHeight-1;return t.lastRow+i}function G(e,t){let l=Array.from(new T(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(l.every(({cellWidth:e})=>
11===e))return t.lastColumn;let i=l[0].cellWidth-1;return t.lastColumn+i}class $ extends i.mY{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){let e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){let e=this.editor.model,t=e.document,l=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,n=this.direction;e.change(e=>{let t="right"==n||"down"==n,o=t?l:i,r=t?i:l,s=r.parent;K(r)||(K(o)&&e.remove(e.createRangeIn(o)),e.move(e.createRangeIn(r),e.createPositionAt(o,"end"))),e.remove(r);let a=this.isHorizontal?"colspan":"rowspan",d=parseInt(l.getAttribute(a)||"1"),c=parseInt(i.getAttribute(a)||"1");e.setAttribute(a,d+c,o),e.setSelection(e.createRangeIn(o));let u=this.editor.plugins.get("TableUtils");O(s.findAncestor("table"),u)})}_getMergeableCell(){let e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),l=t.getTableCellsContainingSelection(e.selection)[0];if(!l)return;let i=this.isHorizontal?function(e,t,l){let i=e.parent.parent,n="right"==t?e.nextSibling:e.previousSibling,o=(i.getAttribute("headingColumns")||0)>0;if(!n)return;let r="right"==t?e:n,s="right"==t?n:e,{column:a}=l.getCellLocation(r),{column:d}=l.getCellLocation(s),c=parseInt(r.getAttribute("colspan")||"1"),u=v(l,r),h=v(l,s);if(!o||u==h)return a+c===d?n:void 0}(l,this.direction,t):function(e,t,l){let i=e.parent,n=i.parent,o=n.getChildIndex(i);if("down"==t&&o===l.getRows(n)-1||"up"==t&&0===o)return null;let r=parseInt(e.getAttribute("rowspan")||"1"),s=n.getAttribute("headingRows")||0;if(s&&("down"==t&&o+r===s||"up"==t&&o===s))return null;let a=parseInt(e.getAttribute("rowspan")||"1"),d="down"==t?o+a:o,c=[...new T(n,{endRow:d})],u=c.find(t=>t.cell===e).column,h=c.find(({row:e,cellHeight:l,column:i})=>i===u&&("down"==t?e===d:d===e+l));return h&&h.cell?h.cell:null}(l,this.direction,t);if(!i)return;let n=this.isHorizontal?"rowspan":"colspan",o=parseInt(l.getAttribute(n)||"1");if(parseInt(i.getAttribute(n)||"1")===o)return i}}function K(e){let t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class j extends i.mY{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),l=t[0];if(l){let i=l.findAncestor("table"),n=e.getRows(i),o=e.getRowIndexes(t),r=0===o.first&&o.last===n-1;this.isEnabled=!r}else this.isEnabled=!1}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),l=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(l),n=l[0],o=n.findAncestor("table"),r=t.getCellLocation(n).column;e.change(e=>{let l=i.last-i.first+1;t.removeRows(o,{at:i.first,rows:l});let n=function(e,t,l,i){let n=e.getChild(Math.min(t,i-1)),o=n.getChild(0),r=0;for(let e of n.getChildren()){if(r>l)break;o=e,r+=parseInt(e.getAttribute("colspan")||"1")}return o}(o,i.first,r,t.getRows(o));e.setSelection(e.createPositionAt(n,0))})}}class q extends i.mY{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),l=t[0];if(l){let i=l.findAncestor("table"),n=e.getColumns(i),{first:o,last:r}=e.getColumnIndexes(t);this.isEnabled=r-o<n-1}else this.isEnabled=!1}execute(){let e=this.editor.plugins.get("TableUtils"),[t,l]=function(e,t){let l=t.getSelectionAffectedTableCells(e),i=l[0],n=l.pop(),o=[i,n];return i.isBefore(n)?o:o.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,n=[...new T(i)],o={first:n.find(e=>e.cell===t).column,last:n.find(e=>e.cell===l).column},r=parseInt(l.getAttribute("colspan")||"1")>1?l:t.previousSibling||l.nextSibling?l.nextSibling||t.previousSibling:o.first?n.reverse().find(({column:e})=>e<o.first).cell:n.reverse().find(({column:e})=>e>o.last).cell;this.editor.model.change(t=>{let l=o.last-o.first+1;e.removeColumns(i,{at:o.first,columns:l}),t.setSelection(t.createPositionAt(r,0))})}}class Y extends i.mY{refresh(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,l=e.getSelectionAffectedTableCells(t.document.selection),i=l.length>0;this.isEnabled=i,this.value=i&&l.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),l=this.editor.model,i=t.getSelectionAffectedTableCells(l.document.selection),n=i[0].findAnce
1stor("table"),{first:o,last:r}=t.getRowIndexes(i),s=this.value?o:r+1,a=n.getAttribute("headingRows")||0;l.change(e=>{if(s){let t=s>a?a:0;for(let{cell:l}of N(n,s,t))W(l,s,e)}w("headingRows",s,n,e,0)})}_isInHeading(e,t){let l=parseInt(t.getAttribute("headingRows")||"0");return!!l&&e.parent.index<l}}class J extends i.mY{refresh(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),l=t.getSelectionAffectedTableCells(e.document.selection),i=l.length>0;this.isEnabled=i,this.value=i&&l.every(e=>v(t,e))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),l=this.editor.model,i=t.getSelectionAffectedTableCells(l.document.selection),n=i[0].findAncestor("table"),{first:o,last:r}=t.getColumnIndexes(i),s=this.value?o:r+1;l.change(e=>{if(s)for(let{cell:t,column:l}of D(n,s))F(t,l,s,e);w("headingColumns",s,n,e,0)})}}function X(e,t){let l=Z(e,"tbody",t)||Z(e,"thead",t);return Q(t.editing.view.domConverter.mapViewToDom(l))}function Z(e,t,l){return[...[...l.editing.mapper.toViewElement(e).getChildren()].find(e=>e.is("element","table")).getChildren()].find(e=>e.is("element",t))}function Q(e){let t=o.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function ee(e){return Math.round(("number"==typeof e?e:parseFloat(e))*100)/100}function et(e){return e.map(e=>"number"==typeof e?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function el(e){let t=function(e){let t=e.filter(e=>"auto"===e).length;if(0===t)return e.map(e=>ee(e));let l=Math.max((100-et(e))/t,5);return e.map(e=>"auto"===e?l:e).map(e=>ee(e))}(e.map(e=>"auto"===e?e:parseFloat(e.replace("%","")))),l=et(t);return 100!==l&&(t=t.map(e=>ee(100*e/l)).map((e,t,l)=>t!==l.length-1?e:ee(e+100-et(l)))),t.map(e=>e+"%")}function ei(e,t,l,i){for(let n=0;n<Math.max(l.length,e.length);n++){let o=e[n],r=l[n];r?o?i.setAttribute("columnWidth",r,o):i.appendElement("tableColumn",{columnWidth:r},t):i.remove(o)}}function en(e){return e.is("element","tableColumnGroup")?e:Array.from(e.getChildren()).find(e=>e.is("element","tableColumnGroup"))}function eo(e){let t=en(e);return t?Array.from(t.getChildren()):[]}class er extends i.Sy{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){let t=e.parent,l=t.parent,i=l.getChildIndex(t);for(let{cell:t,row:n,column:o}of new T(l,{row:i}))if(t===e)return{row:n,column:o}}createTable(e,t){let l=e.createElement("table"),i=t.rows||2,n=t.columns||2;return es(e,l,0,i,n),t.headingRows&&w("headingRows",Math.min(t.headingRows,i),l,e,0),t.headingColumns&&w("headingColumns",Math.min(t.headingColumns,n),l,e,0),l}insertRows(e,t={}){let l=this.editor.model,i=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,s=t.copyStructureFromAbove?i-1:i,a=this.getRows(e),d=this.getColumns(e);if(i>a)throw new o.Bb("tableutils-insertrows-insert-out-of-range",this,{options:t});l.change(t=>{let l=e.getAttribute("headingRows")||0;if(l>i&&w("headingRows",l+n,e,t,0),!r&&(0===i||i===a)){es(t,e,i,n,d);return}let o=new T(e,{endRow:r?Math.max(i,s):i}),c=Array(d).fill(1);for(let{row:e,column:l,cellHeight:a,cellWidth:d,cell:u}of o){let o=e+a-1,h=e<i&&i<=o,m=e<=s&&s<=o;h?(t.setAttribute("rowspan",a+n,u),c[l]=-d):r&&m&&(c[l]=d)}for(let l=0;l<n;l++){let l=t.createElement("tableRow");t.insert(l,e,i);for(let e=0;e<c.length;e++){let i=c[e],n=t.createPositionAt(l,"end");i>0&&C(t,n,i>1?{colspan:i}:void 0),e+=Math.abs(i)-1}}})}insertColumns(e,t={}){let l=this.editor.model,i=t.at||0,n=t.columns||1;l.change(t=>{let l=e.getAttribute("headingColumns");i<l&&t.setAttribute("headingColumns",l+n,e);let o=this.getColumns(e);if(0===i||o===i){for(let l of e.getChildren())l.is("element","tableRow")&&ea(n,t,t.createPositionAt(l,i?"end":0));return}let r=new T(e,{column:i,includeAllSlots:!0});for(let e of r){let{row:l,cell:o,cellAnchorColumn:s,cellAnchorRow:a,cellWidth:d,cellHeight:c}=e;if(s<i){t.setAttribute("colspan",d+n,o);let e=a+c-1;for(let t=l;t<=e;t++)r.skipRow(t)}else ea(n,t,e.getPositionBefore())}})}removeRows(e,t){let l=this.editor.model,i=t.rows||1,n=this.getRows(e),r=t.at,s=r+i-1;if(s>n-1)throw new o.Bb("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});l.change(t=>{let l={first:r,last:s},{cellsToMove:i,cellsToTrim:n}=function(e,{first:t,last:l}){let i=new Map,n=[];for(let{row:o,column:r,cellHeight:s,cell:a}of new T(e,{endRow:l})){let e=o+s-1;if(o>=t&&o<=l&&e>l){let e=s-(l-o+1);i.set(r,{cell:a,rowspan:e})}if(o<t&&e>=t){let i;i=e>=l?l-t+1:e-t+1,n.push({cell:a,rowspan:s-i})}}return{cellsToMove:i,cellsToTrim:n}}(e,l);i.size&&function(e,t,l,i){let n;let o=[...new T(e,{includeAllSlots:!0,row:t})],r=e.getChild(t);for(let{column:e,cell:t,isAnchor:s}of o)if(l.has(e)){let{cell:t,rowspan:o}=l.get(e),s=n?i.createPositionAfter(n):i.createPositionAt(r,0);i.move(i.createRangeOn(t),s),w("rowspan",o,t,i),n=t}else s&&(n=t)}(e,s+1,i,t);for(let l=s;l>=r;l--)t.remove(e.getChild(l));for(let{rowspan:e,cell:l}of n)w("rowspan",e,l,t);(function(e,{first:t,last:l},i){let n=e.getAttribute("headingRows")||0;t<n&&w("headingRows",l<n?n-(l-t+1):t,e,i,0)})(e,l,t),L(e,this)||M(e,this)})}
1removeColumns(e,t){let l=this.editor.model,i=t.at,n=t.columns||1,o=t.at+n-1;l.change(t=>{!function(e,t,l){let i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){let n=Math.min(i-1,t.last)-t.first+1;l.setAttribute("headingColumns",i-n,e)}}(e,{first:i,last:o},t);let l=eo(e);for(let n=o;n>=i;n--){for(let{cell:l,column:i,cellWidth:o}of[...new T(e)])i<=n&&o>1&&i+o>n?w("colspan",o-1,l,t):i===n&&t.remove(l);if(l[n]){let e=0===n?l[1]:l[n-1],i=parseFloat(l[n].getAttribute("columnWidth")),o=parseFloat(e.getAttribute("columnWidth"));t.remove(l[n]),t.setAttribute("columnWidth",i+o+"%",e)}}M(e,this)||L(e,this)})}splitCellVertically(e,t=2){let l=this.editor.model,i=e.parent.parent,n=parseInt(e.getAttribute("rowspan")||"1"),o=parseInt(e.getAttribute("colspan")||"1");l.change(l=>{if(o>1){let{newCellsSpan:i,updatedSpan:r}=ed(o,t);w("colspan",r,e,l);let s={};i>1&&(s.colspan=i),n>1&&(s.rowspan=n),ea(o>t?t-1:o-1,l,l.createPositionAfter(e),s)}if(o<t){let r=t-o,s=[...new T(i)],{column:a}=s.find(({cell:t})=>t===e);for(let{cell:t,cellWidth:i}of s.filter(({cell:t,cellWidth:l,column:i})=>t!==e&&i===a||i<a&&i+l>a))l.setAttribute("colspan",i+r,t);let d={};n>1&&(d.rowspan=n),ea(r,l,l.createPositionAfter(e),d);let c=i.getAttribute("headingColumns")||0;c>a&&w("headingColumns",c+r,i,l)}})}splitCellHorizontally(e,t=2){let l=this.editor.model,i=e.parent,n=i.parent,o=n.getChildIndex(i),r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");l.change(l=>{if(r>1){let i=[...new T(n,{startRow:o,endRow:o+r-1,includeAllSlots:!0})],{newCellsSpan:a,updatedSpan:d}=ed(r,t);w("rowspan",d,e,l);let{column:c}=i.find(({cell:t})=>t===e),u={};a>1&&(u.rowspan=a),s>1&&(u.colspan=s);let h=0;for(let e of i){let{column:t,row:i}=e,n=t===c;h>=a&&n&&(h=0),i>=o+d&&n&&(h||ea(1,l,e.getPositionBefore(),u),h++)}}if(r<t){let i=t-r;for(let{cell:t,cellHeight:r,row:s}of[...new T(n,{startRow:0,endRow:o})])if(t!==e&&s+r>o){let e=r+i;l.setAttribute("rowspan",e,t)}let a={};s>1&&(a.colspan=s),es(l,n,o+1,i,1,a);let d=n.getAttribute("headingRows")||0;d>o&&w("headingRows",d+i,n,l)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(e=>e.is("element","tableCell")).reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0)}createTableWalker(e,t={}){return new T(e,t)}getSelectedTableCells(e){let t=[];for(let l of this.sortRanges(e.getRanges())){let e=l.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){let t=[];for(let l of e.getRanges()){let e=l.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){let t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){let t=e.map(e=>e.parent.index);return this._getFirstLastIndexesObject(t)}
1getColumnIndexes(e){let t=[...new T(e[0].findAncestor("table"))].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(t)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;let t=new Set,l=new Set,i=0;for(let n of e){let{row:e,column:o}=this.getCellLocation(n),r=parseInt(n.getAttribute("rowspan"))||1,s=parseInt(n.getAttribute("colspan"))||1;t.add(e),l.add(o),r>1&&t.add(e+r-1),s>1&&l.add(o+s-1),i+=r*s}return function(e,t){let l=Array.from(e.values()),i=Array.from(t.values());return(Math.max(...l)-Math.min(...l)+1)*(Math.max(...i)-Math.min(...i)+1)}(t,l)==i}sortRanges(e){return Array.from(e).sort(ec)}_getFirstLastIndexesObject(e){let t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){let t=e[0].findAncestor("table"),l=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(l,i))return!1;let n=this.getColumnIndexes(e),o=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(n,o)}_areIndexesInSameSection({first:e,last:t},l){return e<l==t<l}}function es(e,t,l,i,n,o={}){for(let r=0;r<i;r++){let i=e.createElement("tableRow");e.insert(i,t,l),ea(n,e,e.createPositionAt(i,"end"),o)}}function ea(e,t,l,i={}){for(let n=0;n<e;n++)C(t,l,i)}function ed(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};let l=Math.floor(e/t);return{newCellsSpan:l,updatedSpan:e-l*t+l}}function ec(e,t){let l=e.start,i=t.start;return l.isBefore(i)?-1:1}class eu extends i.mY{refresh(){let e=this.editor.plugins.get(er),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){let e=this.editor.model,t=this.editor.plugins.get(er);e.change(l=>{let i=t.getSelectedTableCells(e.document.selection),n=i.shift(),{mergeWidth:o,mergeHeight:r}=function(e,t,l){let i=0,n=0;for(let e of t){let{row:t,column:o}=l.getCellLocation(e);i=em(e,o,i,"colspan"),n=em(e,t,n,"rowspan")}let{row:o,column:r}=l.getCellLocation(e);return{mergeWidth:i-r,mergeHeight:n-o}}(n,i,t);for(let e of(w("colspan",o,n,l),w("rowspan",r,n,l),i))eh(e)||(eh(n)&&l.remove(l.createRangeIn(n)),l.move(l.createRangeIn(e),l.createPositionAt(n,"end"))),l.remove(e);O(n.findAncestor("table"),t),l.setSelection(n,"in")})}}function eh(e){let t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function em(e,t,l,i){return Math.max(l,t+parseInt(e.getAttribute(i)||"1"))}class eg extends i.mY{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),l=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(l),n=l[0].findAnce
1stor("table"),o=[];for(let t=i.first;t<=i.last;t++)for(let l of n.getChild(t).getChildren())o.push(e.createRangeOn(l));e.change(e=>{e.setSelection(o)})}}class eb extends i.mY{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,l=e.getSelectionAffectedTableCells(t.document.selection),i=l[0],n=l.pop(),o=i.findAncestor("table"),r=e.getCellLocation(i),s=e.getCellLocation(n),a=Math.min(r.column,s.column),d=Math.max(r.column,s.column),c=[];for(let e of new T(o,{startColumn:a,endColumn:d}))c.push(t.createRangeOn(e.cell));t.change(e=>{e.setSelection(c)})}}function ef(e,t){let l=!1;for(let i of e.getChildren())l=ep(i,t)||l;return l}function ep(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;let l=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(let e of l)t.wrap(t.createRangeOn(e),"paragraph");return!!l.length}class ew extends i.Sy{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[er]}constructor(e){super(e),this._additionalSlots=[]}init(){let e=this.editor,t=e.model,l=t.schema,i=e.conversion,n=e.plugins.get(er);l.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),l.register("tableRow",{allowIn:"table",isLimit:!0}),l.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(e=>{e.on("element:figure",(e,t,l)=>{if(!l.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;let i=function(e){for(let t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!i||!l.consumable.test(i,{name:!0}))return;l.consumable.consume(t.viewItem,{name:!0,classes:"table"});let n=l.convertItem(i,t.modelCursor),r=(0,o.Ps)(n.modelRange.getItems());if(!r){l.consumable.revert(t.viewItem,{name:!0,classes:"table"});return}l.convertChildren(t.viewItem,l.writer.createPositionAt(r,"end")),l.updateConversionResult(r,t)})}),i.for("upcast").add(e=>{e.on("element:table",(e,t,l)=>{let i=t.viewItem;if(!l.consumable.test(i,{name:!0}))return;let{rows:n,headingRows:o,headingColumns:r}=function(e){let t,l,i=0,n=[],o=[];for(let r of Array.from(e.getChildren())){if("tbody"!==r.name&&"thead"!==r.name&&"tfoot"!==r.name)continue;"thead"!==r.name||l||(l=r);let e=Array.from(r.getChildren()).filter(e=>e.is("element","tr")),s=null;for(let a of e){let e=Array.from(a.getChildren()).filter(e=>e.is("element","td")||e.is("element","th"));if(l&&r===l||"tbody"===r.name&&e.length>0&&(null===s||e.length===s)&&e.every(e=>e.is("element","th")))i++,n.push(a);else{o.push(a);let e=function(e){let t=0,l=0,i=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;l<i.length&&"th"===i[l].name;)t+=parseInt(i[l].getAttribute("colspan")||"1"),l++;return t}(a);(!t||e<t)&&(t=e)}s=Math.max(s||0,e.length)}}return{headingRows:i,headingColumns:t||0,rows:[...n,...o]}}(i),s={};r&&(s.headingColumns=r),o&&(s.headingRows=o);let a=l.writer.createElement("table",s);if(l.safeInsert(a,t.modelCursor)){if(l.consumable.consume(i,{name:!0}),n.forEach(e=>l.convertItem(e,l.writer.createPositionAt(a,"end"))),l.convertChildren(i,l.writer.createPositionAt(a,"end")),a.isEmpty){let e=l.writer.createElement("tableRow");l.writer.insert(e,l.writer.createPositionAt(a,"end")),C(l.writer,l.writer.createPositionAt(e,"end"))}l.updateConversionResult(a,t)}})}),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:k(n,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:k(n,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(e,{writer
1:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(A("td")),i.for("upcast").add(A("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:x({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:x()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:V({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:V(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:eC("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:eC("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new P(e)),e.commands.add("insertTableRowAbove",new I(e,{order:"above"})),e.commands.add("insertTableRowBelow",new I(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new E(e,{order:"left"})),e.commands.add("insertTableColumnRight",new E(e,{order:"right"})),e.commands.add("removeTableRow",new j(e)),e.commands.add("removeTableColumn",new q(e)),e.commands.add("splitTableCellVertically",new B(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new B(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new eu(e)),e.commands.add("mergeTableCellRight",new $(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new $(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new $(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new $(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new J(e)),e.commands.add("setTableRowHeader",new Y(e)),e.commands.add("selectTableRow",new eg(e)),e.commands.add("selectTableColumn",new eb(e)),function(e){e.document.registerPostFixer(t=>(function(e,t){let l=t.document.differ.getChanges(),i=!1,n=new Set;for(let t of l){let l=null;"insert"==t.type&&"table"==t.name&&(l=t.position.nodeAfter),("insert"==t.type||"remove"==t.type)&&("tableRow"==t.name||"tableCell"==t.name)&&(l=t.position.findAncestor("table")),function(e){if("attribute"!==e.type)return!1;let t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}(t)&&(l=t.range.start.findAncestor("table")),l&&!n.has(l)&&(i=function(e,t){let l=!1,i=function(e){let t=parseInt(e.getAttribute("headingRows")||"0"),l=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),i=[];for(let{row:n,cell:o,cellHeight:r}of new T(e)){if(r<2)continue;let e=n<t?t:l;if(n+r>e){let t=e-n;i.push({cell:o,rowspan:t})}}return i}(e);if(i.length)for(let e of(l=!0,i))w("rowspan",e.rowspan,e.cell,t,1);return l}(l,e)||i,i=function(e,t){let l=!1,i=function(e){let t=Array(e.childCount).fill(0);for(let{rowIndex:l}of new T(e,{includeAllSlots:!0}))t[l]++;return t}(e),n=[];for(let[t,l]of i.entries())!l&&e.getChild(t).is("element","tableRow")&&n.push(t);if(n.length)for(let o of(l=!0,n.reverse()))t.remove(e.getChild(o)),i.splice(o,1);let o=i.filter((t,l)=>e.getChild(l).is("element","tableRow")),r=o[0];if(!o.every(e=>e===r)){let i=o.reduce((e,t)=>t>e?t:e,0);for(let[n,r]of o.entries()){let o=i-r;if(o){for(let l=0;l<o;l++)C(t,t.createPositionAt(e.getChild(n),"end"));l=!0}}}return l}(l,e)||i,n.add(l))}return i})(t,e))}(t),function(e){e.document.registerPostFixer(t=>(function(e,t){let l=t.document.differ.getChanges(),i=!1;for(let t of l){var n;"insert"==t.type&&"table"==t.name&&(i=function(e,t){let l=!1;for(let i of e.getChildren())i.is("element","tableRow")&&(l=ef(i,t)||l);return l}(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableRow"==t.name&&(i=ef(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableCell"==t.name&&(i=ep(t.position.nodeAfter,e)||i),("remove"==t.type||"insert"==t.type)&&(n=t).position.parent.is("element","tableCell")&&("insert"==n.type&&"$text"==n.name||"remove"==n.type)&&(i=ep(t.position.parent,e)||i)}return i})(t,e))}(t),this.listenTo(t.document,"change:data",()=>{(function(e,t){for(let l of e.document.differ.getChanges()){let e;let i=!1;if("attribute"==l.type){let t=l.range.start.nodeAfter;if(!t||!t.is("element","table")||"headingRows"!=l.attributeKey&&"headingColumns"!=l.attributeKey)continue;e=t,i="headingRows"==l.attributeKey}else("tableRow"==l.name||"tableCell"==l.name)&&(e=l.position.findAnce
1stor("table"),i="tableRow"==l.name);if(!e)continue;let n=e.getAttribute("headingRows")||0,o=e.getAttribute("headingColumns")||0;for(let l of new T(e)){let e=l.row<n||l.column<o?"th":"td",r=t.mapper.toViewElement(l.cell);r&&r.is("element")&&r.name!=e&&t.reconvertItem(i?l.cell.parent:l.cell)}}})(t,e.editing),function(e,t){let l=e.document.differ,i=new Set;for(let e of l.getChanges()){let t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&i.add(t)}for(let e of i.values())for(let l of Array.from(e.getChildren()).filter(e=>(function(e,t){if(!e.is("element","paragraph"))return!1;let l=t.toViewElement(e);return!!l&&R(e)!==l.is("element","span")})(e,t.mapper)))t.reconvertItem(l)}(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function eC(e){return t=>{let l=parseInt(t.getAttribute(e));return Number.isNaN(l)||l<=0?null:l}}class ev extends r.G7{items;keystrokes;focusTracker;constructor(e){super(e);let t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new o.VD,this.focusTracker=new o.Rh,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} \xd7 ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"[email protected]":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{let{row:l,column:i}=t.target.dataset;this.items.get((parseInt(l,10)-1)*10+(parseInt(i,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(e,t,l)=>{if(!l)return;let{row:i,column:n}=l.dataset;this.set({rows:parseInt(i),columns:parseInt(n)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){for(let e of(super.render(),(0,r.IJ)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.items))this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){let e=this.rows,t=this.columns;this.items.map((l,i)=>{l.set("isOn",Math.floor(i/10)<e&&i%10<t)})}_createGridButton(e,t,l,i){let n=new r.r5(e);return n.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),n.extendTemplate({attributes:{"data-row":t,"data-column":l}}),n}_createGridCollection(){let e=[];for(let t=0;t<100;t++){let l=Math.floor(t/10),i=t%10,n=`${l+1} \xd7 ${i+1}`;e.push(this._createGridButton(this.locale,l+1,i+1,n))}return this.createCollection(e)}}class e_ extends i.Sy{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t,l="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",l=>{let n;let o=e.commands.get("insertTable"),s=(0,r.t9)(l);return s.bind("isEnabled").to(o),s.buttonView.set({icon:i.ci.table,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",()=>{n||(n=new ev(l),s.panelView.children.add(n),n.delegate("execute").to(s),s.on("execute",()=>{e.execute("insertTable",{rows:n.rows,columns:n.columns}),e.editing.view.focus()}))}),s}),e.ui.componentFactory.add("menuBar:insertTable",l=>{let n=e.commands.get("insertTable"),o=new r.AH(l),s=new ev(l);return s.delegate("execute").to(o),o.on("change:isOpen",(e,t,l)=>{l||s.reset()}),s.on("execute",()=>{e.execute("insertTable",{rows:s.rows,columns:s.columns}),e.editing.view.focus()}),o.buttonView.set({label:t("Table"),icon:i.ci.table}),o.panelView.children.add(s),o.bind("isEnabled").to(n),o}),e.ui.componentFactory.add("tableColumn",e=>{let i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:l?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:l?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',i,e)}),e.ui.componentFactory.add("tableRow",e=>{let l=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',l,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{let i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:l?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:l?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',i,e)})}_prepareDropdown(e,t,l,i){let n=this.editor,o=(0,r.t9)(i),s=this._fillDropdownWithListOptions(o,l);return o.buttonView.set({label:e,icon:t,tooltip:!0}),o.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(o,"execute",e=>{n.execute(e.source.commandName),e.source instanceof r.BM||n.editing.view.focus()}),o}_prepareMergeSplitButtonDropdown(e,t,l,i){let n=this.editor,o=(0,r.t9)(i,r.Rm),s="mergeTableCells",a=n.commands.get(s),d=this._fillDropdownWithListOptions(o,l);return o.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),o.bind("isEnabled").toMany([a,...d],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(o.buttonView,"execute",()=>{n.execute(s),n.editing.view.focus()}),this.listenTo(o,"execute",e=>{n.execute(e.source.commandName),n.editing.view.focus()}),o}_fillDropdownWithListOptions(e,t){let l=this.editor,i=[],n=new o.FE;for(let e of t)!function(e,t,l,i){if("button"===e.type||"switchbutton"===e.type){let i=e.model=new r.jz(e.model),{commandName:n,bindIsOn:o}=e.model,s=t.commands.get(n);l.push(s),i.set({commandName:n}),i.bind("isEnabled").to(s),o&&i.bind("isOn").to(s,"value"),i.set({withText:!0})}i.add(e)}(e,l,i,n);return(0,r.Pm)(e,n),i}}class ey extends i.Sy{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[er,er]}init(){let e=this.editor,t=e.model,l=e.editing.view;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this.listenTo(l.document,"insertText",(e,t)=>this._handleInsertTextEvent(e,t),{priority:"high"}
1),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){let e=this.editor.plugins.get(er),t=this.editor.model.document.selection,l=e.getSelectedTableCells(t);return 0==l.length?null:l}getSelectionAsFragment(){let e=this.editor.plugins.get(er),t=this.getSelectedTableCells();return t?this.editor.model.change(l=>{let i=l.createDocumentFragment(),{first:n,last:o}=e.getColumnIndexes(t),{first:r,last:s}=e.getRowIndexes(t),a=t[0].findAncestor("table"),d=s,c=o;if(e.isSelectionRectangular(t)){let e={firstColumn:n,lastColumn:o,firstRow:r,lastRow:s};d=U(a,e),c=G(a,e)}let u=z(a,{startRow:r,startColumn:n,endRow:d,endColumn:c},l);return l.insert(u,i,0),i}):null}setCellSelection(e,t){let l=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(l.cells.map(t=>e.createRangeOn(t)),{backward:l.backward})})}getFocusCell(){let e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){let e=this.editor.model.document.selection,t=(0,o.Ps)(e.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){let e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,l,i)=>{let n=i.writer;!function(e){for(let l of t)e.removeClass("ck-editor__editable_selected",l);t.clear()}(n);let o=this.getSelectedTableCells();if(!o)return;for(let e of o){let l=i.mapper.toViewElement(e);n.addClass("ck-editor__editable_selected",l),t.add(l)}let r=i.mapper.toViewElement(o[o.length-1]);n.setSelection(r,0)},{priority:"lowest"}))}_enablePluginDisabling(){let e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){let t=this.getSelectedTableCells();t&&e.model.change(l=>{let i=l.createPositionAt(t[0],0),n=e.model.schema.getNearestSelectionRange(i);l.setSelection(n)})}})}_handleDeleteContent(e,t){let l=this.editor.plugins.get(er),i=t[0],n=t[1],o=this.editor.model,r=!n||"backward"==n.direction,s=l.getSelectedTableCells(i);s.length&&(e.stop(),o.change(e=>{let t=s[r?s.length-1:0];o.change(e=>{for(let t of s)o.deleteContent(e.createSelection(t,"in"))});let l=o.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(l):i.setTo(l)}))}_handleInsertTextEvent(e,t){let l=this.editor,i=this.getSelectedTableCells();if(!i)return;let n=l.editing.view,o=l.editing.mapper,r=i.map(e=>n.createRangeOn(o.toViewElement(e)));t.selection=n.createSelection(r)}_getCellsToSelect(e,t){let l=this.editor.plugins.get("TableUtils"),i=l.getCellLocation(e),n=l.getCellLocation(t),o=Math.min(i.row,n.row),r=Math.max(i.row,n.row),s=Math.min(i.column,n.column),a=Math.max(i.column,n.column),d=Array(r-o+1).fill(null).map(()=>[]);for(let{row:t,cell:l}of new T(e.findAncestor("table"),{startRow:o,endRow:r,startColumn:s,endColumn:a}))d[t-o].push(l);let c=n.row<i.row,u=n.column<i.column;return c&&d.reverse(),u&&d.forEach(e=>e.reverse()),{cells:d.flat(),backward:c||u}}}class eA extends i.Sy{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[s.bH,s._l,ey,er]}init(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(t,"cut",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e.model,"insertContent",(e,[t,l])=>this._onInsertContent(e,t,l),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){let l=this.editor.editing.view,i=this.editor.plugins.get(ey),n=this.editor.plugins.get(s.bH);i.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},()=>{let o=n._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>i.getSelectionAsFragment());l.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(o),method:e.name})}))}_onInsertContent(e,t,l){if(l&&!l.is("documentSelection"))return;let i=this.editor.model,n=this.editor.plugins.get(er),o=this.editor.plugins.get(s.bH),r=this.getTableIfOnlyTableInContent(t,i);if(!r)return;
1let a=n.getSelectionAffectedTableCells(i.document.selection);if(!a.length){O(r,n);return}e.stop(),t.is("documentFragment")?o._pasteMarkersIntoTransformedElement(t.markers,e=>this._replaceSelectedCells(r,a,e)):this.editor.model.change(e=>{this._replaceSelectedCells(r,a,e)})}_replaceSelectedCells(e,t,l){let i=this.editor.plugins.get(er),n={width:i.getColumns(e),height:i.getRows(e)},o=function(e,t,l,i){let n=e[0].findAncestor("table"),o=i.getColumnIndexes(e),r=i.getRowIndexes(e),s={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},a=1===e.length;return a&&(s.lastRow+=t.height-1,s.lastColumn+=t.width-1,function(e,t,l,i){let n=i.getColumns(e),o=i.getRows(e);l>n&&i.insertColumns(e,{at:n,columns:l-n}),t>o&&i.insertRows(e,{at:o,rows:t-o})}(n,s.lastRow+1,s.lastColumn+1,i)),a||!i.isSelectionRectangular(e)?function(e,t,l){let{firstRow:i,lastRow:n,firstColumn:o,lastColumn:r}=t,s={first:i,last:n},a={first:o,last:r};eS(e,o,s,l),eS(e,r+1,s,l),eT(e,i,a,l),eT(e,n+1,a,l,i)}(n,s,l):(s.lastRow=U(n,s),s.lastColumn=G(n,s)),s}(t,n,l,i),r=o.lastRow-o.firstRow+1,s=o.lastColumn-o.firstColumn+1,a={startRow:0,startColumn:0,endRow:Math.min(r,n.height)-1,endColumn:Math.min(s,n.width)-1};e=z(e,a,l);
1let d=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,n,d,o,l);if(this.editor.plugins.get("TableSelection").isEnabled){let e=i.sortRanges(c.map(e=>l.createRangeOn(e)));l.setSelection(e)}else l.setSelection(c[0],0);return d}_replaceSelectedCellsWithPasted(e,t,l,i,n){let o;let{width:r,height:s}=t,a=function(e,t,l){let i=Array(l).fill(null).map(()=>Array(t).fill(null));for(let{column:t,row:l,cell:n}of new T(e))i[l][t]=n;return i}(e,r,s),d=[...new T(l,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];for(let e of d){let{row:t,column:l}=e;l===i.firstColumn&&(o=e.getPositionBefore());let d=t-i.firstRow,u=l-i.firstColumn,h=a[d%s][u%r],m=h?n.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,o,n);g&&(H(g,t,l,i.lastRow,i.lastColumn,n),c.push(g),o=n.createPositionAfter(g))}let u=parseInt(l.getAttribute("headingRows")||"0"),h=parseInt(l.getAttribute("headingColumns")||"0"),m=i.firstRow<u&&u<=i.lastRow,g=i.firstColumn<h&&h<=i.lastColumn;if(m){let e=eT(l,u,{first:i.firstColumn,last:i.lastColumn},n,i.firstRow);c.push(...e)}if(g){let e=eS(l,h,{first:i.firstRow,last:i.lastRow},n);c.push(...e)}return c}_replaceTableSlotCell(e,t,l,i){let{cell:n,isAnchor:o}=e;return(o&&i.remove(n),t)?(i.insert(t,l),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);let l=t.createRangeIn(e);for(let e of l.getItems())if(e.is("element","table")){let i=t.createRange(l.start,t.createPositionBefore(e));if(t.hasContent(i,{ignoreWhitespaces:!0}))return null;let n=t.createRange(t.createPositionAfter(e),l.end);if(t.hasContent(n,{ignoreWhitespaces:!0}))return null;return e}return null}}function eT(e,t,l,i,n=0){if(!(t<1))return N(e,t,n).filter(({column:e,cellWidth:t})=>ek(e,t,l)).map(({cell:e})=>W(e,t,i))}function eS(e,t,l,i){if(!(t<1))return D(e,t).filter(({row:e,cellHeight:t})=>ek(e,t,l)).map(({cell:e,column:l})=>F(e,l,t,i))}function ek(e,t,l){let{first:i,last:n}=l;return e>=i&&e<=n||e<i&&e+t-1>=i}class ex extends i.Sy{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[ey,er]}init(){let e=this.editor,t=e.editing.view.document,l=e.t;this.listenTo(t,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"}),this.listenTo(t,"tab",(...e)=>this._handleTabOnSelectedTable(...e),{context:"figure"}),this.listenTo(t,"tab",(...e)=>this._handleTab(...e),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:l("Keystrokes that can be used in a table cell"),keystrokes:[{label:l("Move the selection to the next cell"),keystroke:"Tab"},{label:l("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:l("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:l("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){let l=this.editor,i=l.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),l.model.change(e=>{e.setSelection(e.createRangeIn(i.getChild(0).getChild(0)))}))}_handleTab(e,t){let l;let i=this.editor,n=this.editor.plugins.get(er),o=this.editor.plugins.get("TableSelection"),r=i.model.document.selection,s=!t.shiftKey,a=n.getTableCellsContainingSelection(r)[0];if(a||(a=o.getFocusCell()),!a)return;t.preventDefault(),t.stopPropagation(),e.stop();let d=a.parent,c=d.parent,u=c.getChildIndex(d),h=d.getChildIndex(a),m=0===h;if(!s&&m&&0===u){i.model.change(e=>{e.setSelection(e.createRangeOn(c))});return}let g=h===d.childCount-1,b=u===n.getRows(c)-1;if(s&&b&&g&&(i.execute("insertTableRowBelow"),u===n.getRows(c)-1)){i.model.change(e=>{e.setSelection(e.createRangeOn(c))});return}if(s&&g)l=c.getChild(u+1).getChild(0);else if(!s&&m){let e=c.getChild(u-1);l=e.getChild(e.childCount-1)}else l=d.getChild(h+(s?1:-1));i.model.change(e=>{e.setSelection(e.createRangeIn(l))})}_onArrowKey(e,t){let l=this.editor,i=t.keyCode,n=(0,o.mA)(i,l.locale.contentLanguageDirection);this._handleArrowKeys(n,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){let l=this.editor.plugins.get(er),i=this.editor.plugins.get("TableSelection"),n=this.editor.model,o=n.document.selection,r=["right","down"].includes(e),s=l.getSelectedTableCells(o);if(s.length){let l;return l=t?i.getFocusCell():r?s[s.length-1]:s[0],this._navigateFromCellInDirection(l,e,t),!0}
1let a=o.focus.findAncestor("tableCell");if(!a)return!1;if(!o.isCollapsed){if(t){if(o.isBackward==r&&!o.containsEntireContent(a))return!1}else{let e=o.getSelectedElement();if(!e||!n.schema.isObject(e))return!1}}return!!this._isSelectionAtCellEdge(o,a,r)&&(this._navigateFromCellInDirection(a,e,t),!0)}_isSelectionAtCellEdge(e,t,l){let i=this.editor.model,n=this.editor.model.schema,o=l?e.getLastPosition():e.getFirstPosition();if(!n.getLimitElement(o).is("element","tableCell"))return i.createPositionAt(t,l?"end":0).isTouching(o);let r=i.createSelection(o);return i.modifySelection(r,{direction:l?"forward":"backward"}),o.isEqual(r.focus)}_navigateFromCellInDirection(e,t,l=!1){let i=this.editor.model,n=e.findAncestor("table"),o=[...new T(n,{includeAllSlots:!0})],{row:r,column:s}=o[o.length-1],a=o.find(({cell:t})=>t==e),{row:d,column:c}=a;switch(t){case"left":c--;break;case"up":d--;break;case"right":c+=a.cellWidth;break;case"down":d+=a.cellHeight}let u=d<0||d>r,h=c<0&&d<=0,m=c>s&&d>=r;if(u||h||m){i.change(e=>{e.setSelection(e.createRangeOn(n))});return}c<0?(c=l?0:s,d--):c>s&&(c=l?s:0,d++);let g=o.find(e=>e.row==d&&e.column==c).cell,b=["right","down"].includes(t),f=this.editor.plugins.get("TableSelection");if(l&&f.isEnabled){let t=f.getAnchorCell()||e;f.setCellSelection(t,g)}else{let e=i.createPositionAt(g,b?0:"end");i.change(t=>{t.setSelection(e)})}}}class eV extends a.qZ{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}}class eR extends i.Sy{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[ey,er]}init(){this.editor.editing.view.addObserver(eV),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){let e=this.editor,t=e.plugins.get(er),l=!1,i=e.plugins.get(ey);this.listenTo(e.editing.view.document,"mousedown",(n,o)=>{let r=e.model.document.selection;if(!this.isEnabled||!i.isEnabled||!o.domEvent.shiftKey)return;let s=i.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!s)return;let a=this._getModelTableCellFromDomEvent(o);a&&eP(s,a)&&(l=!0,i.setCellSelection(s,a),o.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{l=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{l&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){let e,t;let l=this.editor,i=!1,n=!1,o=l.plugins.get(ey);this.listenTo(l.editing.view.document,"mousedown",(t,l)=>{!this.isEnabled||!o.isEnabled||l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(e=this._getModelTableCellFromDomEvent(l))}),this.listenTo(l.editing.view.document,"mousemove",(l,r)=>{if(!r.domEvent.buttons||!e)return;let s=this._getModelTableCellFromDomEvent(r);s&&eP(e,s)&&(t=s,i||t==e||(i=!0)),i&&(n=!0,o.setCellSelection(e,t),r.preventDefault())}),this.listenTo(l.editing.view.document,"mouseup",()=>{i=!1,n=!1,e=null,t=null}),this.listenTo(l.editing.view.document,"selectionChange",e=>{n&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){let t=e.target,l=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(l).parent.findAncestor("tableCell",{includeSelf:!0})}}function eP(e,t){return e.parent.parent==t.parent.parent}class eI extends i.Sy{static get requires(){return[ew,e_,ey,eR,ex,eA,n.$L]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}}function eE(e){return eB(e)||ez(e)}function eB(e){let t=e.getSelectedElement();return t&&eN(t)?t:null}function ez(e){let t=e.getFirstPosition();if(!t)return null;let l=t.parent;for(;l;){if(l.is("element")&&eN(l))return l;l=l.parent}return null}function eN(e){return!!e.getCustomProperty("table")&&(0,n.Qd)(e)}class eW extends i.Sy{static get requires(){return[n.e8]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t,l=e.plugins.get(n.e8),i=e.config.get("table.contentToolbar"),o=e.config.get("table.tableToolbar");i&&l.register("tableContent",{ariaLabel:t("Table toolbar"),items:i,getRelatedElement:ez}),o&&l.register("table",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:eB})}}class eD extends r.G7{options;focusTracker;focusCycler;_focusables;dropdownView;
1inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new o.Rh,this._focusables=new r.vX,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new o.VD,this._stillTyping=!1,this.focusCycler=new r.I0({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(e,t,l)=>this._setInputValue(l))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){let e=this.locale,t=e.t,l=this.bindTemplate,i=this._createColorSelector(e),n=(0,r.t9)(e),o=new r.G7;return o.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:l.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",l.if("value","ck-hidden",e=>""!=e)]}}]}),n.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),n.buttonView.children.add(o),n.buttonView.label=t("Color picker"),n.buttonView.tooltip=!0,n.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",n.panelView.children.add(i),n.bind("isEnabled").to(this,"isReadOnly",e=>!e),n.on("change:isOpen",(e,t,l)=>{l&&(i.updateSelectedColors(),i.showColorGridsFragment())}),n}_createInputTextView(){let e=this.locale,t=new r.pq(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{let e=t.element.value,l=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=l&&l.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){let t=e.t,l=this.options.defaultColorValue||"",i=t(l?"Restore default":"Remove color"),n=new r.MI(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:i,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});n.appendUI(),n.on("execute",(e,t)=>{if("colorPickerSaveButton"===t.source){this.dropdownView.isOpen=!1;return}this.value=t.value||l,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)});let o=this.value;return n.on("colorPicker:cancel",()=>{this.value=o,this.fire("input"),this.dropdownView.isOpen=!1}),n.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{o=this.value}),n.bind("selectedColor").to(this,"value"),n}_setInputValue(e){if(!this._stillTyping){let t=eF(e),l=this.options.colorDefinitions.find(e=>t===eF(e.color));l?this.inputView.value=l.label:this.inputView.value=e||""}}}function eF(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}let eH=e=>""===e;function eL(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function eM(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function eO(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function eU(e){return eH(e=e.trim().toLowerCase())||(0,a.D5)(e)}function eG(e){return eH(e=e.trim())||eJ(e)||(0,a.G9)(e)||(0,a.zz)(e)}function e$(e){return eH(e=e.trim())||eJ(e)||(0,a.G9)(e)}function eK(e,t){let l=new o.FE,i=eL(e.t);for(let n in i){let o={type:"button",model:new r.jz({_borderStyleValue:n,label:i[n],role:"menuitemradio",withText:!0})};"none"===n?o.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===n):o.model.bind("isOn").to(e,"borderStyle",e=>e===n),l.add(o)}return l}function ej(e){let{view:t,icons:l,toolbar:i,labels:n,propertyName:o,nameToValue:s,defaultValue:a}=e;for(let e in n){let d=new r.r5(t.locale);d.set({role:"radio",isToggleable:!0,label:n[e],icon:l[e],tooltip:n[e]});let c=s?s(e):e;d.bind("isOn").to(t,o,e=>{let t=e;return""===e&&a&&(t=a),c===t}),d.on("execute",()=>{t[o]=c}),i.items.add(d)}}let eq=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];
1function eY(e){return(t,l,i)=>{let n=new eD(t.locale,{colorDefinitions:e.colorConfig.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}})),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});return n.inputView.set({id:l,ariaDescribedById:i}),n.bind("isReadOnly").to(t,"isEnabled",e=>!e),n.bind("hasError").to(t,"errorText",e=>!!e),n.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(n),n}}function eJ(e){let t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}class eX extends r.G7{children;constructor(e,t={}){super(e);let l=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach(e=>this.children.add(e)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",l.to("class")],role:l.to("_role"),"aria-labelledby":l.to("_ariaLabelledBy")},children:this.children})}}class eZ extends r.G7{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;let{borderStyleDropdown:l,borderWidthInput:i,borderColorInput:n,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:g,verticalAlignmentToolbar:b,alignmentLabel:f}=this._createAlignmentFields();this.focusTracker=new o.Rh,this.keystrokes=new o.VD,this.children=this.createCollection(),this.borderStyleDropdown=l,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=d,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=h,this.horizontalAlignmentToolbar=g,this.verticalAlignmentToolbar=b;let{saveButtonView:p,cancelButtonView:w}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=w,this._focusables=new r.vX,this._focusCycler=new r.I0({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new r.Gp(e,{label:this.t("Cell properties")})),this.children.add(new eX(e,{labelView:s,children:[s,l,n,i],class:"ck-table-form__border-row"})),this.children.add(new eX(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new eX(e,{children:[new eX(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new eX(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new eX(e,{labelView:f,children:[f,g,b],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new eX(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,r.GI)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},l=eY({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,n=this.t,o=n("Style"),s=new r.Dn(i);s.text=n("Border");let a=eL(n),d=new r.KP(i,r.FH);d.set({label:o,class:"ck-table-form__border-style"}),d.fieldView.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),d.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),d.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),d.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,r.Pm)(d.fieldView,eK(this,t.style),{role:"menu",ariaLabel:o});let c=new r.KP(i,r.R);c.set({label:n("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",eQ),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});let u=new r.KP(i,l);return u.set({label:n("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",eQ),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value}),this.on("change:borderStyle",(e,l,i,n)=>{eQ(i)||(this.borderColor="",this.borderWidth=""),eQ(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:s,borderStyleDropdown:d,borderColorInput:u,borderWidthInput:c}}
1_createBackgroundFields(){let e=this.locale,t=this.t,l=new r.Dn(e);l.text=t("Background");let i=eY({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),n=new r.KP(e,i);return n.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:l,backgroundInput:n}}_createDimensionFields(){let e=this.locale,t=this.t,l=new r.Dn(e);l.text=t("Dimensions");let i=new r.KP(e,r.R);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});let n=new r.G7(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xd7"}]});let o=new r.KP(e,r.R);return o.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),o.fieldView.bind("value").to(this,"height"),o.fieldView.on("input",()=>{this.height=o.fieldView.element.value}),{dimensionsLabel:l,widthInput:i,operatorLabel:n,heightInput:o}}_createPaddingField(){let e=this.locale,t=this.t,l=new r.KP(e,r.R);return l.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),l.fieldView.bind("value").to(this,"padding"),l.fieldView.on("input",()=>{this.padding=l.fieldView.element.value}),l}_createAlignmentFields(){let e=this.locale,t=this.t,l=new r.Dn(e),n={left:i.ci.alignLeft,center:i.ci.alignCenter,right:i.ci.alignRight,justify:i.
1ci.alignJustify,top:i.ci.alignTop,middle:i.ci.alignMiddle,bottom:i.ci.alignBottom};l.text=t("Table cell text alignment");let o=new r.jB(e),s="rtl"===e.contentLanguageDirection;o.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),ej({view:this,icons:n,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(s){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let a=new r.jB(e);return a.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),ej({view:this,icons:n,toolbar:a,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:a,alignmentLabel:l}}_createActionButtons(){let e=this.locale,t=this.t,l=new r.r5(e),n=new r.r5(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return l.set({label:t("Save"),icon:i.ci.check,class:"ck-button-save",type:"submit",withText:!0}),l.bind("isEnabled").toMany(o,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),icon:i.ci.cancel,class:"ck-button-cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:l,cancelButtonView:n}}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,l=t("Align cell text to the left"),i=t("Align cell text to the center"),n=t("Align cell text to the right"),o=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:n,center:i,left:l,justify:o}:{left:l,center:i,right:n,justify:o}}get _verticalAlignmentLabels(){let e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function eQ(e){return"none"!==e}let e0=[r.no.defaultPositions.northArrowSouth,r.no.defaultPositions.northArrowSouthWest,r.no.defaultPositions.northArrowSouthEast,r.no.defaultPositions.southArrowNorth,r.no.defaultPositions.southArrowNorthWest,r.no.defaultPositions.southArrowNorthEast,r.no.defaultPositions.viewportStickyNorth];function e1(e,t){var l;let i;let n=e.plugins.get("ContextualBalloon"),o=e.editing.view.document.selection;"cell"===t?ez(o)&&(i=e2(e)):(eB(l=o)||ez(l))&&(i=e5(e)),i&&n.updatePosition(i)}function e5(e){let t=y(e.model.document.selection),l=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(l),positions:e0}}function e2(e){let t=e.editing.mapper,l=e.editing.view.domConverter,i=e.model.document.selection;if(i.rangeCount>1)return{target:()=>(function(e,t){let l=t.editing.mapper,i=t.editing.view.domConverter,n=Array.from(e).map(e=>{let t=e7(e.start),n=l.toViewElement(t);return new o.UL(i.mapViewToDom(n))});return o.UL.getBoundingRect(n)})(i.getRanges(),e),positions:e0};let n=e7(i.getFirstPosition()),r=t.toViewElement(n);return{target:l.mapViewToDom(r),positions:e0}}function e7(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}function e4(e){if(!e||!(0,d.Z)(e))return e;let{top:t,right:l,bottom:i,left:n}=e;if(t==l&&l==i&&i==n)return t}function e6(e,t){let l=parseFloat(e);return Number.isNaN(l)||String(l)!==String(e)?e:`${l}${t}`}function e8(e,t={}){let l={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!l.alignment&&(l.alignment="center"),t.includePaddingProperty&&!l.padding&&(l.padding=""),t.includeVerticalAlignmentProperty&&!l.verticalAlignment&&(l.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!l.horizontalAlignment&&(l.horizontalAlignment=t.isRightToLeftContent?"right":"left"),l}function e3(e,t){return e8({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...e},t)}function e9(e,t){return e8({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...e},t)}let te={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroun
1dColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class tt extends i.Sy{_defaultTableCellProperties;_balloon;view;_undoStepBatch;_isReady;static get requires(){return[r.WB]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:eq,backgroundColors:eq})}init(){let e=this.editor,t=e.t;this._defaultTableCellProperties=e9(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(r.WB),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",l=>{let i=new r.r5(l);i.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());let n=Object.values(te).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableCellProperties"),l=(0,r.S1)(t.borderColors),i=(0,r.k6)(e.locale,l),n=(0,r.S1)(t.backgroundColors),o=(0,r.k6)(e.locale,n),s=!1!==t.colorPicker,a=new eZ(e.locale,{borderColors:i,backgroundColors:o,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!s&&(t.colorPicker||{})}),d=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._und
1oStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,r.eC)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let c=eM(d),u=eO(d);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:eU})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:u,validator:e$})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:u,validator:eG})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:u,validator:eG})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:u,validator:eG})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroun
1dColor",errorText:c,validator:eU})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(te).map(([t,l])=>{let i=this._defaultTableCellProperties[t]||"";return[t,e.get(l).value||i]}).forEach(([e,l])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,l)}),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:e2(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor;ez(e.editing.view.document.selection)?this._isViewVisible&&e1(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,l,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:l,validator:i,errorText:n}=e,o=(0,c.Z)(()=>{l.errorText=n},500);return(e,n,r)=>{o.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),l.errorText=null):o())}}}class tl extends i.mY{attributeName;_defaultValue;constructor(e,t,l){super(e),this.attributeName=t,this._defaultValue=l}refresh(){let e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){let{value:t,batch:l}=e,i=this.editor.model,n=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),o=this._getValueToSet(t);i.enqueueChange(l,e=>{o?n.forEach(t=>e.setAttribute(this.attributeName,o,t)):n.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){let t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class ti extends tl{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=e6(e,"px"))!==this._defaultValue)return e}}class tn extends i.Sy{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ew]}init(){let e=this.editor,t=e9(e.config.get("table.tableCellProperties.defaultProperties"));_(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new ti(e,t.width))}}class to extends tl{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=e6(e,"px");if(t!==this._defaultValue)return t}}class tr extends tl{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){let t=e6(e,"px");if(t!==this._defaultValue)return t}}class ts extends tl{constructor(e,t){super(e,"tableCellBackgroun
1dColor",t)}}class ta extends tl{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class td extends tl{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class tc extends tl{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class tu extends tl{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class th extends tl{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=e6(e,"px");if(t!==this._defaultValue)return t}}let tm=/^(top|middle|bottom)$/,tg=/^(left|center|right|justify)$/;class tb extends i.Sy{static get pluginName(){return"TableCellPropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ew,tn]}init(){var e,t;let l=this.editor,i=l.model.schema,n=l.conversion;l.config.define("table.tableCellProperties.defaultProperties",{});let o=e9(l.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===l.locale.contentLanguageDirection});l.data.addStyleProcessorRules(a.sI),function(e,t,l){let i={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};e.extend("tableCell",{allowAttributes:Object.values(i)}),g(t,"td",i,l),g(t,"th",i,l),b(t,{modelElement:"tableCell",modelAttribute:i.style,styleName:"border-style"}),b(t,{modelElement:"tableCell",modelAttribute:i.color,styleName:"border-color"}),b(t,{modelElement:"tableCell",modelAttribute:i.width,styleName:"border-width"})}(i,n,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),l.commands.add("tableCellBorderStyle",new tc(l,o.borderStyle)),l.commands.add("tableCellBorderColor",new tu(l,o.borderColor)),l.commands.add("tableCellBorderWidth",new th(l,o.borderWidth)),_(i,n,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:o.height}),l.commands.add("tableCellHeight",new tr(l,o.height)),l.data.addStyleProcessorRules(a.J8),_(i,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:o.padding}),l.commands.add("tableCellPadding",new to(l,o.padding)),l.data.addStyleProcessorRules(a.QR),_(i,n,{modelAttribute:"tableCellBackgroun
1dColor",styleName:"background-color",defaultValue:o.backgroundColor}),l.commands.add("tableCellBackgroundColor",new ts(l,o.backgroundColor)),e=o.horizontalAlignment,i.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),n.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),n.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":tg}},model:{key:"tableCellHorizontalAlignment",value:t=>{let l=t.getStyle("text-align");return l===e?null:l}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:tg}},model:{key:"tableCellHorizontalAlignment",value:t=>{let l=t.getAttribute("align");return l===e?null:l}}}),l.commands.add("tableCellHorizontalAlignment",new td(l,o.horizontalAlignment)),t=o.verticalAlignment,i.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),n.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),n.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":tm}},model:{key:"tableCellVerticalAlignment",value:e=>{let l=e.getStyle("vertical-align");return l===t?null:l}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:tm}},model:{key:"tableCellVerticalAlignment",value:e=>{let l=e.getAttribute("valign");return l===t?null:l}}}),l.commands.add("tableCellVerticalAlignment",new ta(l,o.verticalAlignment))}}class tf extends i.Sy{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[tb,tt]}}class tp extends i.mY{attributeName;_defaultValue;constructor(e,t,l){super(e),this.attributeName=t,this._defaultValue=l}refresh(){let e=y(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){let t=this.editor.model,l=t.document.selection,{value:i,batch:n}=e,o=y(l),r=this._getValueToSet(i);t.enqueueChange(n,e=>{r?e.setAttribute(this.attributeName,r,o):e.removeAttribute(this.attributeName,o)})}_getValue(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}}class tw extends tp{constructor(e,t){super(e,"tableBackgroundColor",t)}}class tC extends tp{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class tv extends tp{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}}class t_ extends tp{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;let t=e4(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=e6(e,"px");if(t!==this._defaultValue)return t}}class ty extends tp{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=e6(e,"px"))!==this._defaultValue)return e}}class tA extends tp{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=e6(e,"px"))!==this._defaultValue)return e}}class tT extends tp{constructor(e,t){super(e,"tableAlignment",t)}}let tS=/^(left|center|right)$/,tk=/^(left|none|right)$/;class tx extends i.Sy{static get pluginName(){return"TablePropertiesEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ew]}init(){var e;let t=this.editor,l=t.model.schema,i=t.conversion;t.config.define("table.tableProperties.defaultProperties",{});let n=e3(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});t.data.addStyleProcessorRules(a.sI),function(e,t,l){let i={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};e.extend("table",{allowAttributes:Object.values(i)}),g(t,"table",i,l),f(t,{modelAttribute:i.color,styleName:"border-color"}),f(t,{modelAttribute:i.style,styleName:"border-style"}),f(t,{modelAttribute:i.width,styleName:"border-width"})}(l,i,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),t.commands.add("tableBorderColor",new tC(t,n.borderColor)),t.commands.add("tableBorderStyle",new tv(t,n.borderStyle)),t.commands.add("tableBorderWidth",new t_(t,n.borderWidth)),e=n.alignment,l.extend("table",{allowAttributes:["tableAlignment"]}),i.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),i.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:tk}},model:{key:"tableAlignment",value:t=>{let l=t.getStyle("float");return"none"===l&&(l="center"),l===e?null:l}}}).attributeToAttribute({view:{attributes:{align:tS}},model:{name:"table",key:"tableAlignment",value:t=>{let l=t.getAttribute("align");return l===e?null:l}}}),t.commands.add("tableAlignment",new tT(t,n.alignment)),tV(l,i,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),t.commands.add("tableWidth",new ty(t,n.width)),tV(l,i,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),t.commands.add("tableHeight",new tA(t,n.height)),t.data.addStyleProcessorRules(a.QR),function(e,t,l){let{modelAttribute:i}=l;e.extend("table",{allowAttributes:[i]}),m(t,{viewElement:"table",...l}),f(t,l)}
1(l,i,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),t.commands.add("tableBackgroundColor",new tw(t,n.backgroundColor))}}function tV(e,t,l){let{modelAttribute:i}=l;e.extend("table",{allowAttributes:[i]}),m(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name),...l}),b(t,{modelElement:"table",...l})}class tR extends r.G7{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;let{borderStyleDropdown:l,borderWidthInput:i,borderColorInput:n,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:a,backgroundInput:d}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:g,alignmentLabel:b}=this._createAlignmentFields();this.focusTracker=new o.Rh,this.keystrokes=new o.VD,this.children=this.createCollection(),this.borderStyleDropdown=l,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=d,this.widthInput=c,this.heightInput=h,this.alignmentToolbar=g;let{saveButtonView:f,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=p,this._focusables=new r.vX,this._focusCycler=new r.I0({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new r.Gp(e,{label:this.t("Table properties")})),this.children.add(new eX(e,{labelView:s,children:[s,l,n,i],class:"ck-table-form__border-row"})),this.children.add(new eX(e,{labelView:a,children:[a,d],class:"ck-table-form__background-row"})),this.children.add(new eX(e,{children:[new eX(e,{labelView:m,children:[m,c,u,h],class:"ck-table-form__dimensions-row"}),new eX(e,{labelView:b,children:[b,g],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new eX(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,r.GI)({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},l=eY({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),i=this.locale,n=this.t,o=n("Style"),s=new r.Dn(i);s.text=n("Border");let a=eL(n),d=new r.KP(i,r.FH);d.set({label:o,class:"ck-table-form__border-style"}),d.fieldView.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),d.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),d.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),d.bind("isEmpty").to(this,"borderStyle",e=>!e),(0,r.Pm)(d.fieldView,eK(this,t.style),{role:"menu",ariaLabel:o});let c=new r.KP(i,r.R);c.set({label:n("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",tP),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value});let u=new r.KP(i,l);return u.set({label:n("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",tP),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value}),this.on("change:borderStyle",(e,l,i,n)=>{tP(i)||(this.borderColor="",this.borderWidth=""),tP(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:s,borderStyleDropdown:d,borderColorInput:u,borderWidthInput:c}}
1_createBackgroundFields(){let e=this.locale,t=this.t,l=new r.Dn(e);l.text=t("Background");let i=eY({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),n=new r.KP(e,i);return n.set({label:t("Color"),class:"ck-table-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:l,backgroundInput:n}}_createDimensionFields(){let e=this.locale,t=this.t,l=new r.Dn(e);l.text=t("Dimensions");let i=new r.KP(e,r.R);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});let n=new r.G7(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xd7"}]});let o=new r.KP(e,r.R);return o.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),o.fieldView.bind("value").to(this,"height"),o.fieldView.on("input",()=>{this.height=o.fieldView.element.value}),{dimensionsLabel:l,widthInput:i,operatorLabel:n,heightInput:o}}_createAlignmentFields(){let e=this.locale,t=this.t,l=new r.Dn(e);l.text=t("Alignment");let n=new r.jB(e);return n.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),ej({view:this,icons:{left:i.ci.objectLeft,center:i.ci.objectCenter,right:i.ci.objectRight},toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:l,alignmentToolbar:n}}_createActionButtons(){let e=this.locale,t=this.t,l=new r.r5(e),n=new r.r5(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return l.set({label:t("Save"),icon:i.ci.check,class:"ck-button-save",type:"submit",withText:!0}),l.bind("isEnabled").toMany(o,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),icon:i.ci.cancel,class:"ck-button-cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:l,cancelButtonView:n}}get _alignmentLabels(){let e=this.locale,t=this.t,l=t("Align table to the left"),i=t("Center table"),n=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:n,center:i,left:l}:{left:l,center:i,right:n}}}function tP(e){return"none"!==e}let tI={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class tE extends i.Sy{_defaultTableProperties;_balloon;view=null;_undoStepBatch;_isReady;static get requires(){return[r.WB]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:eq,backgroundColors:eq})}init(){let e=this.editor,t=e.t;this._defaultTableProperties=e3(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(r.WB),e.ui.componentFactory.add("tableProperties",l=>{let i=new r.r5(l);i.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());let n=Object.values(tI).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){let e=this.editor,t=e.config.get("table.tableProperties"),l=(0,r.S1)(t.borderColors),i=(0,r.k6)(e.locale,l),n=(0,r.S1)(t.backgroundColors),o=(0,r.k6)(e.locale,n),s=!1!==t.colorPicker,a=new tR(e.locale,{borderColors:i,backgroundColors:o,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!s&&(t.colorPicker||{})}),d=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>
1{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),(0,r.eC)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let c=eM(d),u=eO(d);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:eU})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:u,validator:e$})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:eU})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:u,validator:eG})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:u,validator:eG})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(tI).map(([t,l])=>{let i=this._defaultTableProperties[t]||"";return[t,e.get(l).value||i]}).forEach(([e,l])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,l)}),this._isReady=!0}_showView(){let e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:e5(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){var e;let t=this.editor;eB(e=t.editing.view.document.selection)||ez(e)?this._isViewVisible&&e1(t,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,l,i)=>{this._isReady&&this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:l,validator:i,errorText:n}=e,o=(0,c.Z)(()=>{l.errorText=n},500);return(e,n,r)=>{o.cancel(),this._isReady&&(i(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),l.errorText=null):o())}}}class tB extends i.Sy{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[tx,tE]}}function tz(e){return!!e&&e.is("element","table")}function tN(e){for(let t of e.getChildren())if(t.is("element","caption"))return t;return null}function tW(e){let t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class tD extends i.mY{refresh(){let e=y(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!tN(e):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){let l=this.editor.model,i=y(l.document.selection),n=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||e.createElement("caption");l.insertContent(n,i,"end"),t&&e.setSelection(n,"in")}_hideTableCaption(e){let t=this.editor.model,l=y(t.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),n=tN(l);i._saveCaption(l,n),t.deleteContent(e.createSelection(n,"on"))}}class tF extends i.Sy{_savedCaptionsMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){let e=this.editor,t=e.model.schema,l=e.editing.view,i=e.t;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new tD(this.editor)),e.conversion.for("upcast").elementToElement({view:tW,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer
1:t})=>tz(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!tz(e.parent))return null;let o=t.createEditableElement("figcaption");return t.setCustomProperty("tableCaption",!0,o),o.placeholder=i("Enter table caption"),(0,a.ID)({view:l,element:o,keepOnFocus:!0}),(0,n.sC)(o,t)}}),function(e){e.document.registerPostFixer(t=>(function(e,t){let l=t.document.differ.getChanges(),i=!1;for(let t of l){if("insert"!=t.type)continue;let l=t.position.parent;if(l.is("element","table")||"table"==t.name){let n="table"==t.name?t.position.nodeAfter:l,o=Array.from(n.getChildren()).filter(e=>e.is("element","caption")),r=o.shift();if(!r)continue;for(let t of o)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),n,"end"),i=!0),i=!!o.length||i}}return i})(t,e))}(e.model)}_getSavedCaption(e){let t=this._savedCaptionsMap.get(e);return t?a.W_.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class tH extends i.Sy{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,l=e.t;e.ui.componentFactory.add("toggleTableCaption",n=>{let o=e.commands.get("toggleTableCaption"),s=new r.r5(n);return s.set({icon:i.ci.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(o,"value","isEnabled"),s.bind("label").to(o,"value",e=>e?l("Toggle caption off"):l("Toggle caption on")),this.listenTo(s,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),o.value){let l=function(e){let t=y(e);return t?tN(t):null}(e.model.document.selection),i=e.editing.mapper.toViewElement(l);if(!i)return;t.scrollToTheSelection(),t.change(e=>{e.addClass("table__caption_highlighted",i)})}e.editing.view.focus()}),s})}}class tL extends i.Sy{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[tF,tH]}}class tM extends i.mY{refresh(){this.isEnabled=!0}execute(e={}){let{model:t,plugins:l}=this.editor,{table:i=t.document.selection.getSelectedElement(),columnWidths:n,tableWidth:o}=e;n&&(n=Array.isArray(n)?n:n.split(",")),t.change(e=>{o?e.setAttribute("tableWidth",o,i):e.removeAttribute("tableWidth",i);let t=l.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!n&&!t)return;if(!n)return e.remove(t);let r=el(n);if(t)Array.from(t.getChildren()).forEach((t,l)=>e.setAttribute("columnWidth",r[l],t));else{let t=e.createElement("tableColumnGroup");r.forEach(l=>e.appendElement("tableColumn",{columnWidth:l},t)),e.append(t,i)}})}}class tO extends i.Sy{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;static get requires(){return[ew,er]}static get pluginName(){return"TableColumnResizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,o.Xu)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,l,i)=>{let n=i?"removeClass":"addClass";e.editing.view.change(t=>{for(let l of e.editing.view.document.roots)t[n]("ck-column-resize_disabled",e.editing.view.document.getRoot(l.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();let e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});let l=new tM(e);e.commands.add("resizeTableWidth",l),e.commands.add("resizeColumnWidths",l),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",l,"isEnabled",(e,t,l)=>!e&&t&&l)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return en(e)}getTableColumnElements(e){return eo(e)}getTableColumnsWidths(e){return eo(e).map(e=>e.getAttribute("columnWidth"))}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){let e=this.editor.model;e.document.registerPostFixer(t=>{let l=!1;for(let i of function(e){let t=new Set;for(let l of e.document.differ.getChanges()){let i=null;switch(l.type){case"insert":i=["table","tableRow","tableCell"].includes(l.name)?l.position:null;break;case"remove":i=["tableRow","tableCell"].includes(l.name)?l.position:null;break;case"attribute":l.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(l.range.start.nodeAfter.name)?l.range.start:null)}if(!i)continue;let n=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAnce
1stor("table");for(let l of e.createRangeOn(n).getItems())l.is("element","table")&&en(l)&&t.add(l)}return t}(e)){let e=this.getColumnGroupElement(i),n=this.getTableColumnElements(e),o=this.getTableColumnsWidths(e),r=el(o);r=function(e,t,l){let i=l._tableUtilsPlugin.getColumns(t);if(0==i-e.length)return e;let n=e.map(e=>Number(e.replace("%","")));for(let e of function(e,t){let l=new Set;for(let i of e.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(t))l.add(i.position.nodeAfter);else if("remove"==i.type){let e=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&l.add(e)}return l}(l.editor.model.document.differ,t)){let o=i-n.length;if(0===o)continue;let r=o>0,s=l._tableUtilsPlugin.getCellLocation(e).column;if(r){let e=4e3/X(t,l.editor),i=Array(o).fill(e);n.splice(s,0,...i)}else{let e=n.splice(s,Math.abs(o));n[s]+=et(e)}}return n.map(e=>e+"%")}(r,i,this),(0,u.Z)(o,r)||(ei(n,e,r,t),l=!0)}return l})}_registerConverters(){var e;let t=this.editor.conversion;t.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:e=>e.getStyle("width")}}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),t.elementToElement({model:"tableColumnGroup",view:"colgroup"}),t.elementToElement({model:"tableColumn",view:"col"}),t.for("downcast").add(e=>e.on("insert:table",(e,t,l)=>{let i=l.writer,n=t.item,o=l.mapper.toViewElement(n),r=o.is("element","table")?o:Array.from(o.getChildren()).find(e=>e.is("element","table"));en(n)?i.addClass("ck-table-resized",r):i.removeClass("ck-table-resized",r)},{priority:"low"})),t.for("upcast").add((e=this._tableUtilsPlugin,t=>t.on("element:colgroup",(t,l,i)=>{var n;let o=l.modelCursor.findAncestor("table"),r=en(o);if(!r)return;let s=eo(r),a=e.getColumns(o),d=(n=i.writer,eo(r).reduce((e,t)=>{let l=t.getAttribute("columnWidth"),i=t.getAttribute("colSpan");if(!i)return e.push(l),e;for(let t=0;t<i;t++)e.push(l);return n.removeAttribute("colSpan",t),e},[]));((d=Array.from({length:a},(e,t)=>d[t]||"auto")).length!=s.length||d.includes("auto"))&&ei(s,r,el(d),i.writer)},{priority:"low"}))),t.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{let t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),t.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),t.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){let e=this.editor.editing.view;e.addObserver(eV),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(o.global.window.document,"mousemove",(0,h.Z)(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(o.global.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(e,t){let l=t.target;if(!l.hasClass("ck-table-column-resizer")||!this._isResizingAllowed)return;let i=this.editor,n=i.editing.mapper.toModelElement(l.findAncestor("figure"));if(!i.model.canEditAt(n))return;t.preventDefault(),e.stop();let r=function(e,t,l){let i=Array(t.getColumns(e));for(let t of new T(e)){let e=l.editing.mapper.toViewElement(t.cell),n=function(e){let t=o.global.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}(l.editing.view.domConverter.mapViewToDom(e));(!i[t.column]||n<i[t.column])&&(i[t.column]=ee(n))}return i}(n,this._tableUtilsPlugin,i),s=l.findAncestor("table"),a=i.editing.view;Array.from(s.getChildren()).find(e=>e.is("element","colgroup"))||a.change(e=>{(function(e,t,l){let i=e.createContainerElement("colgroup");for(let l=0;l<t.length;l++){let n=e.createEmptyElement("col"),o=`${ee(t[l]/et(t)*100)}%`;e.setStyle("width",o,n),e.insert(e.createPositionAt(i,"end"),n)}e.insert(e.createPositionAt(l,0),i)})(e,r,s)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(t,r),a.change(e=>(function(e,t,l){let i=l.widths.viewFigureWidth/l.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",l.elements.viewResizer),e.setStyle("width",`${ee(100*i)}
1%`,t.findAncestor("figure"))})(e,s,this._resizingData))}_onMouseMoveHandler(e,t){var l,i,n;if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}let{columnPosition:o,flags:{isRightEdge:r,isTableCentered:s,isLtrContent:a},elements:{viewFigure:d,viewLeftColumn:c,viewRightColumn:u},widths:{viewFigureParentWidth:h,tableWidth:m,leftColumnWidth:g,rightColumnWidth:b}}=this._resizingData,f=(l=(t.clientX-o)*((a?1:-1)*(r&&s?2:1)),i=Math.min(-g+40,0),n=Math.max(r?h-m:b-40,0),l<=i?ee(i):l>=n?ee(n):ee(l));0!==f&&this.editor.editing.view.change(e=>{let t=ee((g+f)*100/m);if(e.setStyle("width",`${t}%`,c),r){let t=ee((m+f)*100/h);e.setStyle("width",`${t}%`,d)}else{let t=ee((b-f)*100/m);e.setStyle("width",`${t}%`,u)}})}_onMouseUpHandler(){if(!this._isResizingActive)return;let{viewResizer:e,modelTable:t,viewFigure:l,viewColgroup:i}=this._resizingData.elements,n=this.editor,o=n.editing.view,r=this.getColumnGroupElement(t),s=Array.from(i.getChildren()).filter(e=>e.is("view:element")),a=r?this.getTableColumnsWidths(r):null,d=s.map(e=>e.getStyle("width")),c=!(0,u.Z)(a,d),h=t.getAttribute("tableWidth"),m=l.getStyle("width"),g=h!==m;(c||g)&&(this._isResizingAllowed?n.execute("resizeTableWidth",{table:t,tableWidth:`${ee(m)}%`,columnWidths:d}):o.change(e=>{if(a)for(let t of s)e.setStyle("width",a.shift(),t);else e.remove(i);g&&(h?e.setStyle("width",h,l):e.removeStyle("width",l)),a||h||e.removeClass("ck-table-resized",[...l.getChildren()].find(e=>"table"===e.name))})),o.change(t=>{t.removeClass("ck-table-column-resizer__active",e)}),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){let l=this.editor,i=e.domEvent.clientX,n=e.target,o=n.findAncestor("td")||n.findAncestor("th"),r=l.editing.mapper.toModelElement(o),s=r.findAncestor("table"),a=function(e,t){let l=t.getCellLocation(e).column;return{leftEdge:l,rightEdge:l+(e.getAttribute("colspan")||1)-1}}(r,this._tableUtilsPlugin).rightEdge,d=a===this._tableUtilsPlugin.getColumns(s)-1,c=!s.hasAttribute("tableAlignment"),u="rtl"!==l.locale.contentLanguageDirection,h=o.findAnce
1stor("table"),m=h.findAncestor("figure"),g=[...h.getChildren()].find(e=>e.is("element","colgroup")),b=g.getChild(a),f=d?void 0:g.getChild(a+1),p=Q(l.editing.view.domConverter.mapViewToDom(m.parent)),w=Q(l.editing.view.domConverter.mapViewToDom(m)),C=X(s,l),v=t[a],_=d?void 0:t[a+1];return{columnPosition:i,flags:{isRightEdge:d,isTableCentered:c,isLtrContent:u},elements:{viewResizer:n,modelTable:s,viewFigure:m,viewColgroup:g,viewLeftColumn:b,viewRightColumn:f},widths:{viewFigureParentWidth:p,viewFigureWidth:w,tableWidth:C,leftColumnWidth:v,rightColumnWidth:_}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(e,t,l)=>{let i=t.item,n=l.mapper.toViewElement(i),o=l.writer;o.insert(o.createPositionAt(n,"end"),o.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}}class tU extends i.Sy{static get requires(){return[tO,tn]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.