/* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(){function v(){return!1}var l=CKEDITOR.tools,D=CKEDITOR.plugins.pastetools,w=D.filters.common,h=w.styles,E=w.createAttributeStack,A=w.lists.getElementIndentation,F=["o:p","xml","script","meta","link"],G="v:arc v:curve v:line v:oval v:polyline v:rect v:roundrect v:group".split(" "),B={},z=0,u={},f,t;CKEDITOR.plugins.pastetools.filters.word=u;CKEDITOR.plugins.pastefromword=u;u.rules=function(c,b,d){function e(a){(a.attributes["o:gfxdata"]||"v:group"===a.parent.name)&&k.push(a.attributes.id)} var g=Boolean(c.match(/mso-list:\s*l\d+\s+level\d+\s+lfo\d+/)),k=[],x={root:function(a){a.filterChildren(d);CKEDITOR.plugins.pastefromword.lists.cleanup(f.createLists(a,b))},elementNames:[[/^\?xml:namespace$/,""],[/^v:shapetype/,""],[new RegExp(F.join("|")),""]],elements:{a:function(a){if(a.attributes.name){if("_GoBack"==a.attributes.name){delete a.name;return}if(a.attributes.name.match(/^OLE_LINK\d+$/)){delete a.name;return}}if(a.attributes.href&&a.attributes.href.match(/#.+$/)){var b=a.attributes.href.match(/#(.+)$/)[1]; B[b]=a}a.attributes.name&&B[a.attributes.name]&&(a=B[a.attributes.name],a.attributes.href=a.attributes.href.replace(/.*#(.*)$/,"#$1"))},div:function(a){if(b.plugins.pagebreak&&a.attributes["data-cke-pagebreak"])return a;h.createStyleStack(a,d,b)},img:function(a){if(a.parent&&a.parent.attributes){var b=a.parent.attributes;(b=b.style||b.STYLE)&&b.match(/mso\-list:\s?Ignore/)&&(a.attributes["cke-ignored"]=!0)}h.mapCommonStyles(a);a.attributes.src&&a.attributes.src.match(/^file:\/\//)&&a.attributes.alt&& a.attributes.alt.match(/^https?:\/\//)&&(a.attributes.src=a.attributes.alt);a=a.attributes["v:shapes"]?a.attributes["v:shapes"].split(" "):[];b=CKEDITOR.tools.array.every(a,function(a){return-1/)?!0:!1},convertToFakeListItem:function(c,b){t.isDegenerateListItem(c,b)&&t.assignListLevels(c, b);this.getListItemInfo(b);if(!b.attributes["cke-dissolved"]){var d;b.forEach(function(b){!d&&"img"==b.name&&b.attributes["cke-ignored"]&&"*"==b.attributes.alt&&(d="·",b.remove())},CKEDITOR.NODE_ELEMENT);b.forEach(function(b){d||b.value.match(/^ /)||(d=b.value)},CKEDITOR.NODE_TEXT);if("undefined"==typeof d)return;b.attributes["cke-symbol"]=d.replace(/(?: | ).*$/,"");f.removeSymbolText(b)}var e=b.attributes&&l.parseCssText(b.attributes.style);if(e["margin-left"]){var g=e["margin-left"],k=b.attributes["cke-list-level"]; (g=Math.max(CKEDITOR.tools.convertToPx(g)-40*k,0))?e["margin-left"]=g+"px":delete e["margin-left"];b.attributes.style=CKEDITOR.tools.writeCssText(e)}b.name="cke:li"},convertToRealListItems:function(c){var b=[];c.forEach(function(c){"cke:li"==c.name&&(c.name="li",b.push(c))},CKEDITOR.NODE_ELEMENT,!1);return b},removeSymbolText:function(c){var b=c.attributes["cke-symbol"],d=c.findOne(function(c){return c.value&&-1b&&(c.attributes.dir="rtl")},createList:function(c){return(c.attributes["cke-symbol"].match(/([\da-np-zA-NP-Z]).?/)||[])[1]? new CKEDITOR.htmlParser.element("ol"):new CKEDITOR.htmlParser.element("ul")},createLists:function(c,b){function d(b){return CKEDITOR.tools.array.reduce(b,function(b,a){if(a.attributes&&a.attributes.style)var c=CKEDITOR.tools.parseCssText(a.attributes.style)["margin-left"];return c?b+parseInt(c,10):b},0)}function e(a,c){var d=CKEDITOR.tools.parseCssText(a.attributes.style),e=CKEDITOR.plugins.pastetools.getConfigValue(b,"keepZeroMargins"),g="margin-"+c;if(!(g in d))return"";d=CKEDITOR.tools.convertToPx(d[g]); return 0===d&&e?g+": "+d+"; ":0p.length;){var l=f.createList(g),y=m.children; 0g;g++)d[g]&&delete d[g];d[c[k].attributes["cke-list-level"]]=n;e[e.length-1].push(c[k]);g=a}[].splice.apply(b,[].concat([l.indexOf(b, c),1],e))},isAListContinuation:function(c){var b=c;do if((b=b.previous)&&b.type===CKEDITOR.NODE_ELEMENT){if(void 0===b.attributes["cke-list-level"])break;if(b.attributes["cke-list-level"]===c.attributes["cke-list-level"])return b.attributes["cke-list-id"]===c.attributes["cke-list-id"]}while(b);return!1},toArabic:function(c){return c.match(/[ivxl]/i)?c.match(/^l/i)?50+f.toArabic(c.slice(1)):c.match(/^lx/i)?40+f.toArabic(c.slice(1)):c.match(/^x/i)?10+f.toArabic(c.slice(1)):c.match(/^ix/i)?9+f.toArabic(c.slice(2)): c.match(/^v/i)?5+f.toArabic(c.slice(1)):c.match(/^iv/i)?4+f.toArabic(c.slice(2)):c.match(/^i/i)?1+f.toArabic(c.slice(1)):f.toArabic(c.slice(1)):0},getSymbolInfo:function(c,b){var d=c.toUpperCase()==c?"upper-":"lower-",e={"·":["disc",-1],o:["circle",-2],"§":["square",-3]};if(c in e||b&&b.match(/(disc|circle|square)/))return{index:e[c][1],type:e[c][0]};if(c.match(/\d/))return{index:c?parseInt(f.getSubsectionSymbol(c),10):0,type:"decimal"};c=c.replace(/\W/g,"").toLowerCase();return!b&&c.match(/[ivxl]+/i)|| b&&"alpha"!=b||"roman"==b?{index:f.toArabic(c),type:d+"roman"}:c.match(/[a-z]/i)?{index:c.charCodeAt(0)-97,type:d+"alpha"}:{index:-1,type:"disc"}},getListItemInfo:function(c){if(void 0!==c.attributes["cke-list-id"])return{id:c.attributes["cke-list-id"],level:c.attributes["cke-list-level"]};var b=l.parseCssText(c.attributes.style)["mso-list"],d={id:"0",level:"1"};b&&(b+=" ",d.level=b.match(/level(.+?)\s+/)[1],d.id=b.match(/l(\d+?)\s+/)[1]);c.attributes["cke-list-level"]=void 0!==c.attributes["cke-list-level"]? c.attributes["cke-list-level"]:d.level;c.attributes["cke-list-id"]=d.id;return d}};f=u.lists;u.heuristics={isEdgeListItem:function(c,b){if(!CKEDITOR.env.edge||!c.config.pasteFromWord_heuristicsEdgeList)return!1;var d="";b.forEach&&b.forEach(function(b){d+=b.value},CKEDITOR.NODE_TEXT);return d.match(/^(?: | )*\(?[a-zA-Z0-9]+?[\.\)](?: | ){2,}/)?!0:t.isDegenerateListItem(c,b)},cleanupEdgeListItem:function(c){var b=!1;c.forEach(function(c){b||(c.value=c.value.replace(/^(?: |[\s])+/,""), c.value.length&&(b=!0))},CKEDITOR.NODE_TEXT)},isDegenerateListItem:function(c,b){return!!b.attributes["cke-list-level"]||b.attributes.style&&!b.attributes.style.match(/mso\-list/)&&!!b.find(function(c){if(c.type==CKEDITOR.NODE_ELEMENT&&b.name.match(/h\d/i)&&c.getHtml().match(/^[a-zA-Z0-9]+?[\.\)]$/))return!0;var e=l.parseCssText(c.attributes&&c.attributes.style,!0);if(!e)return!1;var f=e["font-family"]||"";return(e.font||e["font-size"]||"").match(/7pt/i)&&!!c.previous||f.match(/symbol/i)},!0).length}, assignListLevels:function(c,b){if(!b.attributes||void 0===b.attributes["cke-list-level"]){for(var d=[A(b)],e=[b],f=[],k=CKEDITOR.tools.array,h=k.map;b.next&&b.next.attributes&&!b.next.attributes["cke-list-level"]&&t.isDegenerateListItem(c,b.next);)b=b.next,d.push(A(b)),e.push(b);var a=h(d,function(a,b){return 0===b?0:a-d[b-1]}),l=this.guessIndentationStep(k.filter(d,function(a){return 0!==a})),f=h(d,function(a){return Math.round(a/l)});-1!==k.indexOf(f,0)&&(f=h(f,function(a){return a+1}));k.forEach(e, function(a,b){a.attributes["cke-list-level"]=f[b]});return{indents:d,levels:f,diffs:a}}},guessIndentationStep:function(c){return c.length?Math.min.apply(null,c):null},correctLevelShift:function(c){if(this.isShifted(c)){var b=CKEDITOR.tools.array.filter(c.children,function(b){return"ul"==b.name||"ol"==b.name}),d=CKEDITOR.tools.array.reduce(b,function(b,c){return(c.children&&1==c.children.length&&t.isShifted(c.children[0])?[c]:c.children).concat(b)},[]);CKEDITOR.tools.array.forEach(b,function(b){b.remove()}); CKEDITOR.tools.array.forEach(d,function(b){c.add(b)});delete c.name}},isShifted:function(c){return"li"!==c.name?!1:0===CKEDITOR.tools.array.filter(c.children,function(b){return b.name&&("ul"==b.name||"ol"==b.name||"p"==b.name&&0===b.children.length)?!1:!0}).length}};t=u.heuristics;f.setListSymbol.removeRedundancies=function(c,b){(1===b&&"disc"===c["list-style-type"]||"decimal"===c["list-style-type"])&&delete c["list-style-type"]};CKEDITOR.cleanWord=CKEDITOR.pasteFilters.word=D.createFilter({rules:[w.rules, u.rules],additionalTransforms:function(c){CKEDITOR.plugins.clipboard.isCustomDataTypesSupported&&(c=w.styles.inliner.inline(c).getBody().getHtml());return c.replace(//g,"]--\x3e")}});CKEDITOR.config.pasteFromWord_heuristicsEdgeList=!0})();