@ckeditor/ckeditor5-code-block 33.0.0 → 34.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/build/code-block.js +1 -1
- package/build/code-block.js.map +1 -1
- package/build/translations/jv.js +1 -0
- package/lang/translations/jv.po +25 -0
- package/package.json +20 -19
- package/src/codeblockediting.js +28 -13
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@ CKEditor 5 code block feature
|
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-code-block)
|
|
5
5
|
[](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
|
6
|
-
[](https://travis-ci.com/ckeditor/ckeditor5)
|
|
6
|
+
[](https://app.travis-ci.com/github/ckeditor/ckeditor5)
|
|
7
|
+

|
|
7
8
|
|
|
8
9
|
This package implements the code block feature for CKEditor 5.
|
|
9
10
|
|
package/build/code-block.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={67:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(609),i=n.n(o)()((function(e){return e[1]}));i.push([e.id,".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}",""]);const r=i},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(i[a]=!0)}for(var c=0;c<e.length;c++){var s=[].concat(e[c]);o&&i[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}},62:(e,t,n)=>{"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function c(e){for(var t=-1,n=0;n<a.length;n++)if(a[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},o=[],i=0;i<e.length;i++){var r=e[i],s=t.base?r[0]+t.base:r[0],l=n[s]||0,d="".concat(s," ").concat(l);n[s]=l+1;var u=c(d),g={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(a[u].references++,a[u].updater(g)):a.push({identifier:d,updater:h(g,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var i=n.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function g(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function f(e,t,n){var o=n.css,i=n.media,r=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var m=null,p=0;function h(e,t){var n,o,i;if(t.singleton){var r=p++;n=m||(m=l(t)),o=g.bind(null,n,r,!1),i=g.bind(null,n,r,!0)}else n=l(t),o=f.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=c(n[o]);a[i].references--}for(var r=s(e,t),l=0;l<n.length;l++){var d=c(n[l]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}n=r}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},492:(e,t,n)=>{e.exports=n(79)("./src/engine.js")},331:(e,t,n)=>{e.exports=n(79)("./src/enter.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{CodeBlock:()=>_,CodeBlockEditing:()=>v,CodeBlockUI:()=>A});var e=n(704),t=n(331),i=n(492),r=n(209);function a(e){const t=e.t,n=e.config.get("codeBlock.languages");for(const e of n)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return n}function c(e,t,n){const o={};for(const i of e)"class"===t?o[i[t].split(" ").shift()]=i[n]:o[i[t]]=i[n];return o}function s(e){return e.data.match(/^(\s*)/)[0]}function l(e){const t=e.document.selection,n=[];if(t.isCollapsed)n.push(t.anchor);else{const o=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of o)if(t.is("$textProxy")&&t.parent.is("element","codeBlock")){const o=s(t.textNode),{parent:i,startOffset:r}=t.textNode,a=e.createPositionAt(i,r+o.length);n.push(a)}}return n}function d(e){const t=(0,r.first)(e.getSelectedBlocks());return t&&t.is("element","codeBlock")}class u extends e.Command{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,n=t.model,o=n.document.selection,i=a(t)[0],r=Array.from(o.getSelectedBlocks()),c=void 0===e.forceValue?!this.value:e.forceValue,s=function(e,t,n){if(e.language)return e.language;if(e.usePreviousLanguageChoice&&t)return t;return n}(e,this._lastLanguage,i.language);n.change((e=>{c?this._applyCodeBlock(e,r,s):this._removeCodeBlock(e,r)}))}_getValue(){const e=this.editor.model.document.selection,t=(0,r.first)(e.getSelectedBlocks());return!!!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=(0,r.first)(e.getSelectedBlocks());return!!n&&g(t,n)}_applyCodeBlock(e,t,n){this._lastLanguage=n;const o=this.editor.model.schema,i=t.filter((e=>g(o,e)));for(const t of i)e.rename(t,"codeBlock"),e.setAttribute("language",n,t),o.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter((e=>!o.checkChild(t,e))).forEach((t=>e.remove(t)));i.reverse().forEach(((t,n)=>{const o=i[n+1];t.previousSibling===o&&(e.appendElement("softBreak",o),e.merge(e.createPositionBefore(t)))}))}_removeCodeBlock(e,t){const n=t.filter((e=>e.is("element","codeBlock")));for(const t of n){const n=e.createRangeOn(t);for(const t of Array.from(n.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:n}=e.split(e.createPositionBefore(t));e.rename(n.nodeAfter,"paragraph"),e.removeAttribute("language",n.nodeAfter),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}function g(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}class f extends e.Command{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const n=l(e);for(const e of n)t.insertText(this._indentSequence,e)}))}_checkEnabled(){return!!this._indentSequence&&d(this.editor.model.document.selection)}}class m extends e.Command{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const n=l(e);for(const e of n){const n=p(this.editor.model,e,this._indentSequence);n&&t.remove(n)}}))}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!d(e.document.selection)&&l(e).some((t=>p(e,t,this._indentSequence)))}}function p(e,t,n){const o=function(e){let t=e.parent.getChild(e.index);t&&!t.is("element","softBreak")||(t=e.nodeBefore);if(!t||t.is("element","softBreak"))return null;return t}(t);if(!o)return null;const i=s(o),r=i.lastIndexOf(n);if(r+n.length!==i.length)return null;if(-1===r)return null;const{parent:a,startOffset:c}=o;return e.createRange(e.createPositionAt(a,c+r),e.createPositionAt(a,c+r+n.length))}function h(e,t,n=!1){const o=c(t,"language","class"),i=c(t,"language","label");return(t,r,a)=>{const{writer:c,mapper:s,consumable:l}=a;if(!l.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),u=s.toViewPosition(e.createPositionBefore(r.item)),g={};n&&(g["data-language"]=i[d],g.spellcheck="false");const f=c.createContainerElement("code",{class:o[d]||null}),m=c.createContainerElement("pre",g,f);c.insert(u,m),s.bindElements(r.item,f)}}const b="paragraph";class v extends e.Plugin{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[t.ShiftEnter]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,n=e.model,o=(e.editing.view,a(e));e.commands.add("codeBlock",new u(e)),e.commands.add("indentCodeBlock",new f(e)),e.commands.add("outdentCodeBlock",new m(e));const r=e=>(t,n)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),n())};e.keystrokes.set("Tab",r("indentCodeBlock")),e.keystrokes.set("Shift+Tab",r("outdentCodeBlock")),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck((e=>{if(e.endsWith("codeBlock $text"))return!1})),e.model.schema.addChildCheck(((e,t)=>{if(e.endsWith("codeBlock")&&t.isObject)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",h(n,o,!0)),e.data.downcastDispatcher.on("insert:codeBlock",h(n,o)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,n,o)=>{if("codeBlock"!==n.item.parent.name)return;const{writer:i,mapper:r,consumable:a}=o;if(!a.consume(n.item,"insert"))return;const c=r.toViewPosition(e.createPositionBefore(n.item));i.insert(c,i.createText("\n"))}}(n),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const n=c(t,"class","language"),o=t[0].language;return(e,t,i)=>{const r=t.viewItem,a=r.parent;if(!a||!a.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:c,writer:s}=i;if(!c.test(r,{name:!0}))return;const l=s.createElement("codeBlock"),d=[...r.getClassNames()];d.length||d.push("");for(const e of d){const t=n[e];if(t){s.setAttribute("language",t,l);break}}l.hasAttribute("language")||s.setAttribute("language",o,l),i.convertChildren(r,l),i.safeInsert(l,t.modelCursor)&&(c.consume(r,{name:!0}),i.updateConversionResult(l,t))}}(0,o)),e.data.upcastDispatcher.on("text",((e,t,{consumable:n,writer:o})=>{let i=t.modelCursor;if(!n.test(t.viewItem))return;if(!i.findAncestor("codeBlock"))return;n.consume(t.viewItem);const r=t.viewItem.data.split("\n").map((e=>o.createText(e))),a=r[r.length-1];for(const e of r)if(o.insert(e,i),i=i.getShiftedBy(e.offsetSize),e!==a){const e=o.createElement("softBreak");o.insert(e,i),i=o.createPositionAfter(e)}t.modelRange=o.createRange(t.modelCursor,i),t.modelCursor=i})),this.listenTo(e.editing.view.document,"clipboardInput",((t,o)=>{let r=n.createRange(n.document.selection.anchor);if(o.targetRanges&&(r=e.editing.mapper.toModelRange(o.targetRanges[0])),!r.start.parent.is("element","codeBlock"))return;const a=o.dataTransfer.getData("text/plain"),c=new i.UpcastWriter(e.editing.view.document);o.content=function(e,t){const n=e.createDocumentFragment(),o=t.split("\n"),i=o.reduce(((t,n,i)=>(t.push(n),i<o.length-1&&t.push(e.createElement("br")),t)),[]);return e.appendChild(i,n),n}(c,a)})),this.listenTo(n,"getSelectedContent",((e,[o])=>{const i=o.anchor;!o.isCollapsed&&i.parent.is("element","codeBlock")&&i.hasSameParentAs(o.focus)&&n.change((n=>{const r=e.return;if(r.childCount>1||o.containsEntireContent(i.parent)){const t=n.createElement("codeBlock",i.parent.getAttributes());n.append(r,t);const o=n.createDocumentFragment();n.append(t,o),e.return=o}else{const e=r.getChild(0);t.checkAttribute(e,"code")&&n.setAttribute("code",!0,e)}}))}))}afterInit(){const e=this.editor,t=e.commands,n=t.get("indent"),o=t.get("outdent");n&&n.registerChildCommand(t.get("indentCodeBlock")),o&&o.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((t,n)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const n=e.model.document,o=e.editing.view,i=n.selection.getLastPosition(),r=i.nodeAfter;if(t||!n.selection.isCollapsed||!i.isAtStart)return!1;if(!B(r))return!1;return e.model.change((t=>{e.execute("enter");const o=n.selection.anchor.parent.previousSibling;t.rename(o,b),t.setSelection(o,"in"),e.model.schema.removeDisallowedAttributes([o],t),t.remove(r)})),o.scrollToTheSelection(),!0}(e,n.isSoft)||function(e,t){const n=e.model,o=n.document,i=e.editing.view,r=o.selection.getLastPosition(),a=r.nodeBefore;let c;if(t||!o.selection.isCollapsed||!r.isAtEnd||!a||!a.previousSibling)return!1;if(B(a)&&B(a.previousSibling))c=n.createRange(n.createPositionBefore(a.previousSibling),n.createPositionAfter(a));else if(k(a)&&B(a.previousSibling)&&B(a.previousSibling.previousSibling))c=n.createRange(n.createPositionBefore(a.previousSibling.previousSibling),n.createPositionAfter(a));else{if(!(k(a)&&B(a.previousSibling)&&k(a.previousSibling.previousSibling)&&B(a.previousSibling.previousSibling.previousSibling)))return!1;c=n.createRange(n.createPositionBefore(a.previousSibling.previousSibling.previousSibling),n.createPositionAfter(a))}return e.model.change((t=>{t.remove(c),e.execute("enter");const n=o.selection.anchor.parent;t.rename(n,b),e.model.schema.removeDisallowedAttributes([n],t)})),i.scrollToTheSelection(),!0}(e,n.isSoft)||function(e){const t=e.model.document,n=t.selection.getLastPosition(),o=n.nodeBefore||n.textNode;let i;o&&o.is("$text")&&(i=s(o));e.model.change((n=>{e.execute("shiftEnter"),i&&n.insertText(i,t.selection.anchor)}))}(e),n.preventDefault(),t.stop())}),{context:"pre"})}}function k(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function B(e){return e&&e.is("element","softBreak")}var w=n(273);var x=n(62),C=n.n(x),S=n(67),y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};C()(S.Z,y);S.Z.locals;class A extends e.Plugin{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,n=e.ui.componentFactory,o=a(e);n.add("codeBlock",(n=>{const i=e.commands.get("codeBlock"),r=(0,w.createDropdown)(n,w.SplitButtonView),a=r.buttonView;return a.set({label:t("Insert code block"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),a.bind("isOn").to(i,"value",(e=>!!e)),a.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),r.on("execute",(t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),r.class="ck-code-block-dropdown",r.bind("isEnabled").to(i),(0,w.addListToDropdown)(r,this._getLanguageListItemDefinitions(o)),r}))}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),n=new r.Collection;for(const o of e){const e={type:"button",model:new w.Model({_codeBlockLanguage:o.language,label:o.label,withText:!0})};e.model.bind("isOn").to(t,"value",(t=>t===e.model._codeBlockLanguage)),n.add(e)}return n}}class _ extends e.Plugin{static get requires(){return[v,A]}static get pluginName(){return"CodeBlock"}}})(),(window.CKEditor5=window.CKEditor5||{}).codeBlock=o})();
|
|
5
|
+
*/(()=>{var e={67:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=n(609),i=n.n(o)()((function(e){return e[1]}));i.push([e.id,".ck-content pre{background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;color:#353535;direction:ltr;font-style:normal;min-width:200px;padding:1em;tab-size:4;text-align:left;white-space:pre-wrap}.ck-content pre code{background:unset;border-radius:0;padding:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{background:var(--ck-color-code-block-label-background);color:#fff;font-family:var(--ck-font-face);font-size:10px;line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);right:10px;top:-1px;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-x:hidden;overflow-y:auto}",""]);const r=i},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(i[a]=!0)}for(var c=0;c<e.length;c++){var s=[].concat(e[c]);o&&i[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}},62:(e,t,n)=>{"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function c(e){for(var t=-1,n=0;n<a.length;n++)if(a[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},o=[],i=0;i<e.length;i++){var r=e[i],s=t.base?r[0]+t.base:r[0],l=n[s]||0,d="".concat(s," ").concat(l);n[s]=l+1;var u=c(d),g={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(a[u].references++,a[u].updater(g)):a.push({identifier:d,updater:h(g,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var i=n.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function g(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function f(e,t,n){var o=n.css,i=n.media,r=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var m=null,p=0;function h(e,t){var n,o,i;if(t.singleton){var r=p++;n=m||(m=l(t)),o=g.bind(null,n,r,!1),i=g.bind(null,n,r,!0)}else n=l(t),o=f.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=c(n[o]);a[i].references--}for(var r=s(e,t),l=0;l<n.length;l++){var d=c(n[l]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}n=r}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},492:(e,t,n)=>{e.exports=n(79)("./src/engine.js")},331:(e,t,n)=>{e.exports=n(79)("./src/enter.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{CodeBlock:()=>E,CodeBlockEditing:()=>v,CodeBlockUI:()=>A});var e=n(704),t=n(331),i=n(492),r=n(209);function a(e){const t=e.t,n=e.config.get("codeBlock.languages");for(const e of n)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return n}function c(e,t,n){const o={};for(const i of e)"class"===t?o[i[t].split(" ").shift()]=i[n]:o[i[t]]=i[n];return o}function s(e){return e.data.match(/^(\s*)/)[0]}function l(e){const t=e.document.selection,n=[];if(t.isCollapsed)n.push(t.anchor);else{const o=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of o)if(t.is("$textProxy")&&t.parent.is("element","codeBlock")){const o=s(t.textNode),{parent:i,startOffset:r}=t.textNode,a=e.createPositionAt(i,r+o.length);n.push(a)}}return n}function d(e){const t=(0,r.first)(e.getSelectedBlocks());return t&&t.is("element","codeBlock")}class u extends e.Command{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,n=t.model,o=n.document.selection,i=a(t)[0],r=Array.from(o.getSelectedBlocks()),c=void 0===e.forceValue?!this.value:e.forceValue,s=function(e,t,n){if(e.language)return e.language;if(e.usePreviousLanguageChoice&&t)return t;return n}(e,this._lastLanguage,i.language);n.change((e=>{c?this._applyCodeBlock(e,r,s):this._removeCodeBlock(e,r)}))}_getValue(){const e=this.editor.model.document.selection,t=(0,r.first)(e.getSelectedBlocks());return!!!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=(0,r.first)(e.getSelectedBlocks());return!!n&&g(t,n)}_applyCodeBlock(e,t,n){this._lastLanguage=n;const o=this.editor.model.schema,i=t.filter((e=>g(o,e)));for(const t of i)e.rename(t,"codeBlock"),e.setAttribute("language",n,t),o.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter((e=>!o.checkChild(t,e))).forEach((t=>e.remove(t)));i.reverse().forEach(((t,n)=>{const o=i[n+1];t.previousSibling===o&&(e.appendElement("softBreak",o),e.merge(e.createPositionBefore(t)))}))}_removeCodeBlock(e,t){const n=t.filter((e=>e.is("element","codeBlock")));for(const t of n){const n=e.createRangeOn(t);for(const t of Array.from(n.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:n}=e.split(e.createPositionBefore(t));e.rename(n.nodeAfter,"paragraph"),e.removeAttribute("language",n.nodeAfter),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}function g(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}class f extends e.Command{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const n=l(e);for(const e of n)t.insertText(this._indentSequence,e)}))}_checkEnabled(){return!!this._indentSequence&&d(this.editor.model.document.selection)}}class m extends e.Command{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const n=l(e);for(const e of n){const n=p(this.editor.model,e,this._indentSequence);n&&t.remove(n)}}))}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!d(e.document.selection)&&l(e).some((t=>p(e,t,this._indentSequence)))}}function p(e,t,n){const o=function(e){let t=e.parent.getChild(e.index);t&&!t.is("element","softBreak")||(t=e.nodeBefore);if(!t||t.is("element","softBreak"))return null;return t}(t);if(!o)return null;const i=s(o),r=i.lastIndexOf(n);if(r+n.length!==i.length)return null;if(-1===r)return null;const{parent:a,startOffset:c}=o;return e.createRange(e.createPositionAt(a,c+r),e.createPositionAt(a,c+r+n.length))}function h(e,t,n=!1){const o=c(t,"language","class"),i=c(t,"language","label");return(t,r,a)=>{const{writer:c,mapper:s,consumable:l}=a;if(!l.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),u=s.toViewPosition(e.createPositionBefore(r.item)),g={};n&&(g["data-language"]=i[d],g.spellcheck="false");const f=c.createContainerElement("code",{class:o[d]||null}),m=c.createContainerElement("pre",g,f);c.insert(u,m),s.bindElements(r.item,f)}}const b="paragraph";class v extends e.Plugin{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[t.ShiftEnter]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,n=e.model,o=e.editing.view,r=e.plugins.has("DocumentListEditing"),s=a(e);e.commands.add("codeBlock",new u(e)),e.commands.add("indentCodeBlock",new f(e)),e.commands.add("outdentCodeBlock",new m(e)),this.listenTo(o.document,"tab",((t,n)=>{const o=n.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(o).isEnabled&&(e.execute(o),n.stopPropagation(),n.preventDefault(),t.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck(((e,t)=>{const n=e.endsWith("codeBlock")&&t.startsWith("list")&&"list"!==t;return!(!r||!n)||!e.endsWith("codeBlock $text")&&void 0})),e.model.schema.addChildCheck(((e,t)=>{if(e.endsWith("codeBlock")&&t.isObject)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",h(n,s,!0)),e.data.downcastDispatcher.on("insert:codeBlock",h(n,s)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,n,o)=>{if("codeBlock"!==n.item.parent.name)return;const{writer:i,mapper:r,consumable:a}=o;if(!a.consume(n.item,"insert"))return;const c=r.toViewPosition(e.createPositionBefore(n.item));i.insert(c,i.createText("\n"))}}(n),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const n=c(t,"class","language"),o=t[0].language;return(e,t,i)=>{const r=t.viewItem,a=r.parent;if(!a||!a.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:c,writer:s}=i;if(!c.test(r,{name:!0}))return;const l=s.createElement("codeBlock"),d=[...r.getClassNames()];d.length||d.push("");for(const e of d){const t=n[e];if(t){s.setAttribute("language",t,l);break}}l.hasAttribute("language")||s.setAttribute("language",o,l),i.convertChildren(r,l),i.safeInsert(l,t.modelCursor)&&(c.consume(r,{name:!0}),i.updateConversionResult(l,t))}}(0,s)),e.data.upcastDispatcher.on("text",((e,t,{consumable:n,writer:o})=>{let i=t.modelCursor;if(!n.test(t.viewItem))return;if(!i.findAncestor("codeBlock"))return;n.consume(t.viewItem);const r=t.viewItem.data.split("\n").map((e=>o.createText(e))),a=r[r.length-1];for(const e of r)if(o.insert(e,i),i=i.getShiftedBy(e.offsetSize),e!==a){const e=o.createElement("softBreak");o.insert(e,i),i=o.createPositionAfter(e)}t.modelRange=o.createRange(t.modelCursor,i),t.modelCursor=i})),this.listenTo(e.editing.view.document,"clipboardInput",((t,o)=>{let r=n.createRange(n.document.selection.anchor);if(o.targetRanges&&(r=e.editing.mapper.toModelRange(o.targetRanges[0])),!r.start.parent.is("element","codeBlock"))return;const a=o.dataTransfer.getData("text/plain"),c=new i.UpcastWriter(e.editing.view.document);o.content=function(e,t){const n=e.createDocumentFragment(),o=t.split("\n"),i=o.reduce(((t,n,i)=>(t.push(n),i<o.length-1&&t.push(e.createElement("br")),t)),[]);return e.appendChild(i,n),n}(c,a)})),this.listenTo(n,"getSelectedContent",((e,[o])=>{const i=o.anchor;!o.isCollapsed&&i.parent.is("element","codeBlock")&&i.hasSameParentAs(o.focus)&&n.change((n=>{const r=e.return;if(r.childCount>1||o.containsEntireContent(i.parent)){const t=n.createElement("codeBlock",i.parent.getAttributes());n.append(r,t);const o=n.createDocumentFragment();n.append(t,o),e.return=o}else{const e=r.getChild(0);t.checkAttribute(e,"code")&&n.setAttribute("code",!0,e)}}))}))}afterInit(){const e=this.editor,t=e.commands,n=t.get("indent"),o=t.get("outdent");n&&n.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),o&&o.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((t,n)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const n=e.model.document,o=e.editing.view,i=n.selection.getLastPosition(),r=i.nodeAfter;if(t||!n.selection.isCollapsed||!i.isAtStart)return!1;if(!B(r))return!1;return e.model.change((t=>{e.execute("enter");const o=n.selection.anchor.parent.previousSibling;t.rename(o,b),t.setSelection(o,"in"),e.model.schema.removeDisallowedAttributes([o],t),t.remove(r)})),o.scrollToTheSelection(),!0}(e,n.isSoft)||function(e,t){const n=e.model,o=n.document,i=e.editing.view,r=o.selection.getLastPosition(),a=r.nodeBefore;let c;if(t||!o.selection.isCollapsed||!r.isAtEnd||!a||!a.previousSibling)return!1;if(B(a)&&B(a.previousSibling))c=n.createRange(n.createPositionBefore(a.previousSibling),n.createPositionAfter(a));else if(k(a)&&B(a.previousSibling)&&B(a.previousSibling.previousSibling))c=n.createRange(n.createPositionBefore(a.previousSibling.previousSibling),n.createPositionAfter(a));else{if(!(k(a)&&B(a.previousSibling)&&k(a.previousSibling.previousSibling)&&B(a.previousSibling.previousSibling.previousSibling)))return!1;c=n.createRange(n.createPositionBefore(a.previousSibling.previousSibling.previousSibling),n.createPositionAfter(a))}return e.model.change((t=>{t.remove(c),e.execute("enter");const n=o.selection.anchor.parent;t.rename(n,b),e.model.schema.removeDisallowedAttributes([n],t)})),i.scrollToTheSelection(),!0}(e,n.isSoft)||function(e){const t=e.model.document,n=t.selection.getLastPosition(),o=n.nodeBefore||n.textNode;let i;o&&o.is("$text")&&(i=s(o));e.model.change((n=>{e.execute("shiftEnter"),i&&n.insertText(i,t.selection.anchor)}))}(e),n.preventDefault(),t.stop())}),{context:"pre"})}}function k(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function B(e){return e&&e.is("element","softBreak")}var w=n(273);var x=n(62),C=n.n(x),S=n(67),y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};C()(S.Z,y);S.Z.locals;class A extends e.Plugin{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,n=e.ui.componentFactory,o=a(e);n.add("codeBlock",(n=>{const i=e.commands.get("codeBlock"),r=(0,w.createDropdown)(n,w.SplitButtonView),a=r.buttonView;return a.set({label:t("Insert code block"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),a.bind("isOn").to(i,"value",(e=>!!e)),a.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),r.on("execute",(t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),r.class="ck-code-block-dropdown",r.bind("isEnabled").to(i),(0,w.addListToDropdown)(r,this._getLanguageListItemDefinitions(o)),r}))}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),n=new r.Collection;for(const o of e){const e={type:"button",model:new w.Model({_codeBlockLanguage:o.language,label:o.label,withText:!0})};e.model.bind("isOn").to(t,"value",(t=>t===e.model._codeBlockLanguage)),n.add(e)}return n}}class E extends e.Plugin{static get requires(){return[v,A]}static get pluginName(){return"CodeBlock"}}})(),(window.CKEditor5=window.CKEditor5||{}).codeBlock=o})();
|
package/build/code-block.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://CKEditor5.codeBlock/./theme/codeblock.css","webpack://CKEditor5.codeBlock/../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.codeBlock/../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.codeBlock/./theme/icons/codeblock.svg","webpack://CKEditor5.codeBlock/./theme/codeblock.css?c660","webpack://CKEditor5.codeBlock/../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.codeBlock/./src/codeblock.js","webpack://CKEditor5.codeBlock/./src/codeblockcommand.js","webpack://CKEditor5.codeBlock/./src/codeblockediting.js","webpack://CKEditor5.codeBlock/./src/codeblockui.js","webpack://CKEditor5.codeBlock/./src/converters.js","webpack://CKEditor5.codeBlock/./src/indentcodeblockcommand.js","webpack://CKEditor5.codeBlock/./src/outdentcodeblockcommand.js","webpack://CKEditor5.codeBlock/./src/utils.js","webpack://CKEditor5.codeBlock/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/engine.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/enter.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/external var \"CKEditor5.dll\"","webpack://CKEditor5.codeBlock/webpack/bootstrap","webpack://CKEditor5.codeBlock/webpack/runtime/compat get default export","webpack://CKEditor5.codeBlock/webpack/runtime/define property getters","webpack://CKEditor5.codeBlock/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.codeBlock/webpack/runtime/make namespace object","webpack://CKEditor5.codeBlock/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAC4H;AAC7B;AAC/F,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,0DAA0D,YAAY,cAAc,6BAA6B,yBAAyB,kBAAkB,gBAAgB,cAAc,WAAW,qBAAqB,kBAAkB,gBAAgB,qBAAqB,iBAAiB,UAAU,gBAAgB,4BAA4B,kBAAkB,iDAAiD,4BAA4B,kBAAkB,MAAM,+CAA+C,iDAAiD,SAAS,WAAW,uDAAuD,eAAe,gCAAgC,iBAAiB,wDAAwD,WAAW,mBAAmB,+CAA+C,iBAAiB,gBAAgB,kBAAkB,OAAO,0vBAA0vB,iBAAiB,6BAA6B,sCAAsC,sCAAsC,uBAAuB,4EAA4E,mBAAmB,kBAAkB,0BAA0B,uFAAuF,0FAA0F,cAAc,wBAAwB,iBAAiB,uBAAuB,KAAK,GAAG,iCAAiC,uBAAuB,+BAA+B,mCAAmC,yBAAyB,KAAK,GAAG,0LAA0L,4DAA4D,GAAG,uDAAuD,cAAc,gBAAgB,4DAA4D,sBAAsB,qCAAqC,sBAAsB,6DAA6D,4BAA4B,wBAAwB,GAAG,oDAAoD,sHAAsH,qBAAqB,uBAAuB,GAAG,qBAAqB;AAC9mG;AACA,iEAAe,uBAAuB,EAAC;;;;;;;;;;;;ACP1B;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA,4CAA4C,qBAAqB;AACjE;;AAEA;AACA,KAAK;AACL,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,qBAAqB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACjEa;;AAEb,kCAAkC;;AAElC,8BAA8B;;AAE9B,kDAAkD,gBAAgB,gEAAgE,wDAAwD,6DAA6D,sDAAsD;;AAE7S,uCAAuC,uDAAuD,uCAAuC,SAAS,OAAO,oBAAoB;;AAEzK,yCAAyC,8FAA8F,wBAAwB,eAAe,eAAe,gBAAgB,YAAY,MAAM,wBAAwB,+BAA+B,aAAa,qBAAqB,uCAAuC,cAAc,WAAW,YAAY,UAAU,MAAM,mDAAmD,UAAU,sBAAsB;;AAEve,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;;;;;ACnCA,iEAAe,svBAAsvB;;;;;;;;;;;;;;;;;;ACAtqB;AAC/F,YAA8K;;AAE9K,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,0JAAO;;;;AAIxB,iEAAe,iKAAc,MAAM;;;;;;;;;;;ACZtB;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAwC,GAAG,sBAAiB,GAAG,CAAI;;AAEnF;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,qEAAqE,qBAAqB,cAAc;;AAExG;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,yDAAyD;AACzD,IAAI;;AAEJ;;;AAGA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB,6BAA6B;AAClD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AC5QA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;;AAEM;AACV;;AAExC;AACA;AACA;AACA,sDAAsD,oCAAoC;AAC1F,IAAI,qDAAqD;AACzD;AACA,2CAA2C;AAC3C,YAAY,sEAAsE;AAClF;AACA;AACA;AACe,wBAAwB,sDAAM;AAC7C;AACA;AACA;AACA;AACA,WAAW,yDAAgB,EAAE,oDAAW;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,6CAA6C;AAC1E;AACA,iBAAiB,kDAAkD;AACnE;AACA,YAAY,6CAA6C;AACzD;;AAEA;AACA,6BAA6B,+DAA+D;AAC5F;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,sEAAsE;AAC9E;AACA;AACA;;AAEA;AACA,4CAA4C,6DAA6D;AACzG;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,6CAA6C;AACvD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,uDAAuD;AACjE;AACA;AACA,UAAU,kDAAkD;AAC5D;AACA;AACA;AACA,UAAU,6EAA6E;AACvF;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,4CAA4C;AACnD,OAAO,2BAA2B;AAClC,OAAO,6BAA6B;AACpC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,iCAAiC;AACxC,OAAO,iCAAiC;AACxC,OAAO,iCAAiC;AACxC,OAAO,6CAA6C;AACpD,OAAO,+BAA+B;AACtC,OAAO,qCAAqC;AAC5C,OAAO,iCAAiC;AACxC,OAAO,6CAA6C;AACpD,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iEAAiE;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sEAAsE;AAC1E;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;;;;;;;;;;;;;;;;;;AC1KA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;AACD;;AAE2B;;AAEvE;AACA;AACA;AACA;AACA;AACe,+BAA+B,uDAAO;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB;AACA,YAAY,SAAS;AACrB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,kCAAkC,oFAA4C;AAC9E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;;AAEA;AACA,0BAA0B,aAAa;AACvC;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA,qBAAqB,0DAAK;AAC1B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB,0DAAK;;AAE1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,WAAW;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB,WAAW,aAAa;AACxB,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AClNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;AACG;;AAEF;AACY;AACE;AAK/C;AAMK;;AAEtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,+BAA+B,sDAAM;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,2DAAU;AACrB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,4CAA4C;AAClD,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AACnC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAM,6CAA6C;AACnD,MAAM,+BAA+B;AACrC,MAAM,qCAAqC;AAC3C,MAAM,iCAAiC;AACvC,MAAM,6CAA6C;AACnD,MAAM;AACN;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,oFAA4C;;AAE9E;AACA,wCAAwC,yDAAgB;;AAExD;AACA,8CAA8C,+DAAsB;AACpE,+CAA+C,gEAAuB;;AAEtE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA,4DAA4D,0EAA6B;AACzF,yDAAyD,0EAA6B;AACtF,yDAAyD,8EAAiC,aAAa,mBAAmB;;AAE1H,mDAAmD,8EAAiC;AACpF,2CAA2C,iFAAoC;;AAE/E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,8DAAY;;AAElC;AACA,kBAAkB,4EAAoC;AACtD,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG,IAAI,iBAAiB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6DAAqB;AAC5C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACncA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;AAC4C;;AAEtB;;AAEd;AACzB;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,0BAA0B,sDAAM;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oFAA4C;;AAE7E;AACA;AACA,wBAAwB,gEAAc,UAAU,6DAAe;AAC/D;;AAEA;AACA;AACA;AACA,UAAU,kEAAa;AACvB;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,MAAM;;AAEN;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA,KAAK;;AAEL;AACA;;AAEA,GAAG,mEAAiB;;AAEpB;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,iEAAiE;AAC7E,cAAc;AACd;AACA;AACA;AACA;AACA,8BAA8B,2DAAU;;AAExC;AACA;AACA;AACA,eAAe,mDAAK;AACpB;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AClHA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEiD;;AAEjD;AACA;AACA;AACA;AACA;AACA,2CAA2C,6BAA6B;AACxE;AACA;AACA;AACA,4EAA4E,YAAY;AACxF;AACA,6BAA6B,qEAAqE;AAClG;AACA,iDAAiD,QAAQ;AACzD;AACA,WAAW,iCAAiC;AAC5C,WAAW,iEAAiE;AAC5E;AACA,WAAW,SAAS;AACpB;AACA,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8DAAsB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8DAAsB;;AAEjD;AACA,UAAU,6BAA6B;;AAEvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB,6BAA6B;AACtD;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA,WAAW,iCAAiC;AAC5C,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;;AAEA,UAAU,6BAA6B;;AAEvC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,MAAM;AACvD;AACA;AACA;AACA,2CAA2C,MAAM;AACjD;AACA,WAAW,8BAA8B;AACzC,WAAW,iEAAiE;AAC5E;AACA,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8DAAsB;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,UAAU,qBAAqB;;AAE/B,4CAA4C,aAAa;AACzD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,aAAa;;AAEtD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA,2CAA2C,6BAA6B;AACxE;AACA,aAAa,UAAU;AACvB;AACO;AACP,uBAAuB,qBAAqB;AAC5C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC3PA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;;AAK5B;;AAEjB;AACA;AACA;AACA;AACA;AACe,qCAAqC,uDAAO;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,4BAA4B;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,iEAAyB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,mEAA2B;AACpC;AACA;;;;;;;;;;;;;;;;;;AClGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;;AAM5B;;AAEjB;AACA;AACA;AACA;AACA;AACe,sCAAsC,uDAAO;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,4BAA4B;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,iEAAyB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,QAAQ,mEAA2B;AACnC;AACA;;AAEA;AACA;AACA,SAAS,iEAAyB;AAClC;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mCAAmC;AAC9C,WAAW,yCAAyC;AACpD,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B,6DAAqB;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,sBAAsB;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;AC3LA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA,2DAA2D;AAC3D,oDAAoD,oCAAoC;AACxF;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,gEAAgE;AAC7E;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,cAAc;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,sDAAsD;AAC7D,OAAO,0DAA0D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW;AACX;AACO;AACP;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,+BAA+B;AAC1C,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD,WAAW,QAAQ;AACnB,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,iCAAiC;AAC5C,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ,gBAAgB,OAAO;AACvB;AACA;AACA,YAAY,sBAAsB;;AAElC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yCAAyC;AACpD,aAAa;AACb;AACO;AACP,oBAAoB,0DAAK;;AAEzB;AACA;;;;;;;;;;;AC5NA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACc;AACV","file":"code-block.js","sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}\", \"\",{\"version\":3,\"sources\":[\"webpack://./theme/codeblock.css\",\"webpack://./../ckeditor5-theme-lark/theme/ckeditor5-code-block/codeblock.css\"],\"names\":[],\"mappings\":\"AAKA,gBACC,WAAY,CACZ,aAAwB,CACxB,4BAAiC,CACjC,wBAAiC,CACjC,iBAAkB,CAGlB,eAAgB,CAChB,aAAc,CAEd,UAAW,CACX,oBAAqB,CAGrB,iBAAkB,CAGlB,eAOD,CALC,qBACC,gBAAiB,CACjB,SAAU,CACV,eACD,CAGD,4BACC,iBAMD,CAJC,iDACC,2BAA4B,CAC5B,iBACD,CCjCD,MACC,8CACD,CAEA,iDACC,QAAS,CACT,UAAW,CACX,sDAAuD,CAEvD,cAAe,CACf,+BAAgC,CAChC,gBAAiB,CACjB,uDAAwD,CACxD,UAAuB,CACvB,kBACD,CAEA,+CAEC,gBAAiB,CACjB,eAAgB,CAChB,iBACD\",\"sourcesContent\":[\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n.ck-content pre {\\n\\tpadding: 1em;\\n\\tcolor: hsl(0, 0%, 20.8%);\\n\\tbackground: hsla(0, 0%, 78%, 0.3);\\n\\tborder: 1px solid hsl(0, 0%, 77%);\\n\\tborder-radius: 2px;\\n\\n\\t/* Code block are language direction–agnostic. */\\n\\ttext-align: left;\\n\\tdirection: ltr;\\n\\n\\ttab-size: 4;\\n\\twhite-space: pre-wrap;\\n\\n\\t/* Don't inherit the style, e.g. when in a block quote. */\\n\\tfont-style: normal;\\n\\n\\t/* Don't let the code be squashed e.g. when in a table cell. */\\n\\tmin-width: 200px;\\n\\n\\t& code {\\n\\t\\tbackground: unset;\\n\\t\\tpadding: 0;\\n\\t\\tborder-radius: 0;\\n\\t}\\n}\\n\\n.ck.ck-editor__editable pre {\\n\\tposition: relative;\\n\\n\\t&[data-language]::after {\\n\\t\\tcontent: attr(data-language);\\n\\t\\tposition: absolute;\\n\\t}\\n}\\n\",\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n:root {\\n\\t--ck-color-code-block-label-background: hsl(0, 0%, 46%);\\n}\\n\\n.ck.ck-editor__editable pre[data-language]::after {\\n\\ttop: -1px;\\n\\tright: 10px;\\n\\tbackground: var(--ck-color-code-block-label-background);\\n\\n\\tfont-size: 10px;\\n\\tfont-family: var(--ck-font-face);\\n\\tline-height: 16px;\\n\\tpadding: var(--ck-spacing-tiny) var(--ck-spacing-medium);\\n\\tcolor: hsl(0, 0%, 100%);\\n\\twhite-space: nowrap;\\n}\\n\\n.ck.ck-code-block-dropdown .ck-dropdown__panel {\\n\\t/* There could be dozens of languages available. Use scroll to prevent a 10e6px dropdown. */\\n\\tmax-height: 250px;\\n\\toverflow-y: auto;\\n\\toverflow-x: hidden;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","export default \"<svg viewBox=\\\"0 0 20 20\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path d=\\\"M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z\\\"/></svg>\";","import api from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./codeblock.css\";\n\nvar options = {\"injectType\":\"singletonStyleTag\",\"attributes\":{\"data-cke\":true}};\n\noptions.insert = \"head\";\noptions.singleton = true;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblock\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\n\nimport CodeBlockEditing from './codeblockediting';\nimport CodeBlockUI from './codeblockui';\n\n/**\n * The code block plugin.\n *\n * For more information about this feature check the {@glink api/code-block package page} and the\n * {@glink features/code-blocks code block feature guide}.\n *\n * This is a \"glue\" plugin that loads the {@link module:code-block/codeblockediting~CodeBlockEditing code block editing feature}\n * and the {@link module:code-block/codeblockui~CodeBlockUI code block UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlock extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ CodeBlockEditing, CodeBlockUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlock';\n\t}\n}\n\n/**\n * The configuration of the {@link module:code-block/codeblock~CodeBlock} feature.\n *\n * Read more in {@link module:code-block/codeblock~CodeBlockConfig}.\n *\n * @member {module:code-block/codeblock~CodeBlockConfig} module:core/editor/editorconfig~EditorConfig#codeBlock\n */\n\n/**\n * The configuration of the {@link module:code-block/codeblock~CodeBlock code block feature}.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\tcodeBlock: ... // The code block feature configuration.\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface CodeBlockConfig\n */\n\n/**\n * The code block language descriptor. See {@link module:code-block/codeblock~CodeBlockConfig#languages} to learn more.\n *\n *\t\t{\n *\t\t\t language: 'javascript',\n *\t\t\t label: 'JavaScript'\n *\t\t}\n *\n * @typedef {Object} module:code-block/codeblock~CodeBlockLanguageDefinition\n * @property {String} language The name of the language that will be stored in the model attribute. Also, when `class`\n * is not specified, it will be used to create the CSS class associated with the language (prefixed by \"language-\").\n * @property {String} label The human–readable label associated with the language and displayed in the UI.\n * @property {String} [class] The CSS class associated with the language. When not specified the `language`\n * property is used to create a class prefixed by \"language-\".\n */\n\n/**\n * The list of code languages available in the user interface to choose for a particular code block.\n *\n * The language of the code block is represented as a CSS class (by default prefixed by \"language-\") set on the\n * `<code>` element, both when editing and in the editor data. The CSS class associated with the language\n * can be used by third–party code syntax highlighters to detect and apply the correct highlighting.\n *\n * For instance, this language configuration:\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcodeBlock: {\n *\t\t\t\t\tlanguages: [\n *\t\t\t\t\t\t// ...\n *\t\t\t\t\t\t{ language: 'javascript', label: 'JavaScript' },\n *\t\t\t\t\t\t// ...\n *\t\t\t\t\t]\n *\t\t\t\t}\n *\t\t} )\n *\t\t.then( ... )\n *\t\t.catch( ... );\n *\n * will result in the following structure of JavaScript code blocks in the editor editing and data:\n *\n *\t\t<pre><code class=\"language-javascript\">window.alert( 'Hello world!' )</code></pre>\n *\n * You can customize the CSS class by specifying an optional `class` property in the language definition.\n * You can set **multiple classes** but **only the first one** will be used as defining language class:\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcodeBlock: {\n *\t\t\t\t\tlanguages: [\n *\t\t\t\t\t\t// Do not render the CSS class for the plain text code blocks.\n *\t\t\t\t\t\t{ language: 'plaintext', label: 'Plain text', class: '' },\n *\n *\t\t\t\t\t\t// Use the \"php-code\" class for PHP code blocks.\n *\t\t\t\t\t\t{ language: 'php', label: 'PHP', class: 'php-code' },\n *\n *\t\t\t\t\t\t// Use the \"js\" class for JavaScript code blocks.\n *\t\t\t\t\t\t// Note that only the first (\"js\") class will determine the language of the block when loading data.\n *\t\t\t\t\t\t{ language: 'javascript', label: 'JavaScript', class: 'js javascript js-code' },\n *\n *\t\t\t\t\t\t// Python code blocks will have the default \"language-python\" CSS class.\n *\t\t\t\t\t\t{ language: 'python', label: 'Python' }\n *\t\t\t\t\t]\n *\t\t\t\t}\n *\t\t} )\n *\t\t.then( ... )\n *\t\t.catch( ... );\n *\n * The default value of the language configuration is as follows:\n *\n *\t\tlanguages: [\n *\t\t\t{ language: 'plaintext', label: 'Plain text' }, // The default language.\n *\t\t\t{ language: 'c', label: 'C' },\n *\t\t\t{ language: 'cs', label: 'C#' },\n *\t\t\t{ language: 'cpp', label: 'C++' },\n *\t\t\t{ language: 'css', label: 'CSS' },\n *\t\t\t{ language: 'diff', label: 'Diff' },\n *\t\t\t{ language: 'html', label: 'HTML' },\n *\t\t\t{ language: 'java', label: 'Java' },\n *\t\t\t{ language: 'javascript', label: 'JavaScript' },\n *\t\t\t{ language: 'php', label: 'PHP' },\n *\t\t\t{ language: 'python', label: 'Python' },\n *\t\t\t{ language: 'ruby', label: 'Ruby' },\n *\t\t\t{ language: 'typescript', label: 'TypeScript' },\n *\t\t\t{ language: 'xml', label: 'XML' }\n *\t\t]\n *\n * **Note**: The first language defined in the configuration is considered the default one. This means it will be\n * applied to code blocks loaded from the data that have no CSS `class` specified (or no matching `class` in the configuration).\n * It will also be used when creating new code blocks using the main UI button. By default it is \"Plain text\".\n *\n * @member {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} module:code-block/codeblock~CodeBlockConfig#languages\n */\n\n/**\n * A sequence of characters inserted or removed from the code block lines when its indentation\n * is changed by the user, for instance, using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.\n *\n * The default value is a single tab character (\"\t\", `\\u0009` in Unicode).\n *\n * This configuration is used by `indentCodeBlock` and `outdentCodeBlock` commands (instances of\n * {@link module:code-block/indentcodeblockcommand~IndentCodeBlockCommand}).\n *\n * **Note**: Setting this configuration to `false` will disable the code block indentation commands\n * and associated keystrokes.\n *\n * @member {String} module:code-block/codeblock~CodeBlockConfig#indentSequence\n */\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { first } from 'ckeditor5/src/utils';\n\nimport { getNormalizedAndLocalizedLanguageDefinitions } from './utils';\n\n/**\n * The code block command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class CodeBlockCommand extends Command {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * Contains the last used language.\n\n\t\t * @protected\n\t\t * @type {String|null}\n\t\t */\n\t\tthis._lastLanguage = null;\n\t}\n\n\t/**\n\t * Whether the selection starts in a code block.\n\t *\n\t * @observable\n\t * @readonly\n\t * @member {Boolean} #value\n\t */\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.value = this._getValue();\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #value is on}, all topmost code blocks within\n\t * the selection will be removed. If it is off, all selected blocks will be flattened and\n\t * wrapped by a code block.\n\t *\n\t * @fires execute\n\t * @param {Object} [options] Command options.\n\t * @param {String} [options.language] The code block language.\n\t * @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply a code block,\n\t * otherwise the command will remove the code block. If not set, the command will act basing on its current value.\n\t * @param {Boolean} [options.usePreviousLanguageChoice] If set on `true` and the `options.language` is not specified, the command\n\t * will apply the previous language (if the command was already executed) when inserting the `codeBlock` element.\n\t */\n\texecute( options = {} ) {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\t\tconst selection = model.document.selection;\n\t\tconst normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\t\tconst firstLanguageInConfig = normalizedLanguagesDefs[ 0 ];\n\n\t\tconst blocks = Array.from( selection.getSelectedBlocks() );\n\t\tconst value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;\n\t\tconst language = getLanguage( options, this._lastLanguage, firstLanguageInConfig.language );\n\n\t\tmodel.change( writer => {\n\t\t\tif ( value ) {\n\t\t\t\tthis._applyCodeBlock( writer, blocks, language );\n\t\t\t} else {\n\t\t\t\tthis._removeCodeBlock( writer, blocks );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks the command's {@link #value}.\n\t *\n\t * @private\n\t * @returns {Boolean} The current value.\n\t */\n\t_getValue() {\n\t\tconst selection = this.editor.model.document.selection;\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\t\tconst isCodeBlock = !!( firstBlock && firstBlock.is( 'element', 'codeBlock' ) );\n\n\t\treturn isCodeBlock ? firstBlock.getAttribute( 'language' ) : false;\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( this.value ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst selection = this.editor.model.document.selection;\n\t\tconst schema = this.editor.model.schema;\n\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\t\tif ( !firstBlock ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn canBeCodeBlock( schema, firstBlock );\n\t}\n\n\t/**\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t * @param {String} [language]\n\t */\n\t_applyCodeBlock( writer, blocks, language ) {\n\t\tthis._lastLanguage = language;\n\n\t\tconst schema = this.editor.model.schema;\n\t\tconst allowedBlocks = blocks.filter( block => canBeCodeBlock( schema, block ) );\n\n\t\tfor ( const block of allowedBlocks ) {\n\t\t\twriter.rename( block, 'codeBlock' );\n\t\t\twriter.setAttribute( 'language', language, block );\n\t\t\tschema.removeDisallowedAttributes( [ block ], writer );\n\n\t\t\t// Remove children of the `codeBlock` element that are not allowed. See #9567.\n\t\t\tArray.from( block.getChildren() )\n\t\t\t\t.filter( child => !schema.checkChild( block, child ) )\n\t\t\t\t.forEach( child => writer.remove( child ) );\n\t\t}\n\n\t\tallowedBlocks.reverse().forEach( ( currentBlock, i ) => {\n\t\t\tconst nextBlock = allowedBlocks[ i + 1 ];\n\n\t\t\tif ( currentBlock.previousSibling === nextBlock ) {\n\t\t\t\twriter.appendElement( 'softBreak', nextBlock );\n\t\t\t\twriter.merge( writer.createPositionBefore( currentBlock ) );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t */\n\t_removeCodeBlock( writer, blocks ) {\n\t\tconst codeBlocks = blocks.filter( block => block.is( 'element', 'codeBlock' ) );\n\n\t\tfor ( const block of codeBlocks ) {\n\t\t\tconst range = writer.createRangeOn( block );\n\n\t\t\tfor ( const item of Array.from( range.getItems() ).reverse() ) {\n\t\t\t\tif ( item.is( 'element', 'softBreak' ) && item.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\t\tconst { position } = writer.split( writer.createPositionBefore( item ) );\n\n\t\t\t\t\twriter.rename( position.nodeAfter, 'paragraph' );\n\t\t\t\t\twriter.removeAttribute( 'language', position.nodeAfter );\n\t\t\t\t\twriter.remove( item );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twriter.rename( block, 'paragraph' );\n\t\t\twriter.removeAttribute( 'language', block );\n\t\t}\n\t}\n}\n\nfunction canBeCodeBlock( schema, element ) {\n\tif ( element.is( 'rootElement' ) || schema.isLimit( element ) ) {\n\t\treturn false;\n\t}\n\n\treturn schema.checkChild( element.parent, 'codeBlock' );\n}\n\n// Picks the language for the new code block. If any language is passed as an option,\n// it will be returned. Else, if option usePreviousLanguageChoice is true and some\n// code block was already created (lastLanguage is not null) then previously used\n// language will be returned. If not, it will return default language.\n//\n// @param {Object} options\n// @param {Boolean} [options.usePreviousLanguageChoice]\n// @param {String} [options.language]\n// @param {String|null} lastLanguage\n// @param {String} defaultLanguage\n// @return {String}\nfunction getLanguage( options, lastLanguage, defaultLanguage ) {\n\tif ( options.language ) {\n\t\treturn options.language;\n\t}\n\n\tif ( options.usePreviousLanguageChoice && lastLanguage ) {\n\t\treturn lastLanguage;\n\t}\n\n\treturn defaultLanguage;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { ShiftEnter } from 'ckeditor5/src/enter';\nimport { UpcastWriter } from 'ckeditor5/src/engine';\n\nimport CodeBlockCommand from './codeblockcommand';\nimport IndentCodeBlockCommand from './indentcodeblockcommand';\nimport OutdentCodeBlockCommand from './outdentcodeblockcommand';\nimport {\n\tgetNormalizedAndLocalizedLanguageDefinitions,\n\tgetLeadingWhiteSpaces,\n\trawSnippetTextToViewDocumentFragment\n} from './utils';\nimport {\n\tmodelToViewCodeBlockInsertion,\n\tmodelToDataViewSoftBreakInsertion,\n\tdataViewToModelCodeBlockInsertion,\n\tdataViewToModelTextNewlinesInsertion\n} from './converters';\n\nconst DEFAULT_ELEMENT = 'paragraph';\n\n/**\n * The editing part of the code block feature.\n *\n * Introduces the `'codeBlock'` command and the `'codeBlock'` model element.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlockEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlockEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ShiftEnter ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\teditor.config.define( 'codeBlock', {\n\t\t\tlanguages: [\n\t\t\t\t{ language: 'plaintext', label: 'Plain text' },\n\t\t\t\t{ language: 'c', label: 'C' },\n\t\t\t\t{ language: 'cs', label: 'C#' },\n\t\t\t\t{ language: 'cpp', label: 'C++' },\n\t\t\t\t{ language: 'css', label: 'CSS' },\n\t\t\t\t{ language: 'diff', label: 'Diff' },\n\t\t\t\t{ language: 'html', label: 'HTML' },\n\t\t\t\t{ language: 'java', label: 'Java' },\n\t\t\t\t{ language: 'javascript', label: 'JavaScript' },\n\t\t\t\t{ language: 'php', label: 'PHP' },\n\t\t\t\t{ language: 'python', label: 'Python' },\n\t\t\t\t{ language: 'ruby', label: 'Ruby' },\n\t\t\t\t{ language: 'typescript', label: 'TypeScript' },\n\t\t\t\t{ language: 'xml', label: 'XML' }\n\t\t\t],\n\n\t\t\t// A single tab.\n\t\t\tindentSequence: '\\t'\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst schema = editor.model.schema;\n\t\tconst model = editor.model;\n\t\tconst view = editor.editing.view;\n\n\t\tconst normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\n\t\t// The main command.\n\t\teditor.commands.add( 'codeBlock', new CodeBlockCommand( editor ) );\n\n\t\t// Commands that change the indentation.\n\t\teditor.commands.add( 'indentCodeBlock', new IndentCodeBlockCommand( editor ) );\n\t\teditor.commands.add( 'outdentCodeBlock', new OutdentCodeBlockCommand( editor ) );\n\n\t\tconst getCommandExecuter = commandName => {\n\t\t\treturn ( data, cancel ) => {\n\t\t\t\tconst command = this.editor.commands.get( commandName );\n\n\t\t\t\tif ( command.isEnabled ) {\n\t\t\t\t\tthis.editor.execute( commandName );\n\t\t\t\t\tcancel();\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\n\t\teditor.keystrokes.set( 'Tab', getCommandExecuter( 'indentCodeBlock' ) );\n\t\teditor.keystrokes.set( 'Shift+Tab', getCommandExecuter( 'outdentCodeBlock' ) );\n\n\t\tschema.register( 'codeBlock', {\n\t\t\tallowWhere: '$block',\n\t\t\tallowChildren: '$text',\n\t\t\tisBlock: true,\n\t\t\tallowAttributes: [ 'language' ]\n\t\t} );\n\n\t\t// Disallow all attributes on $text inside `codeBlock`.\n\t\tschema.addAttributeCheck( context => {\n\t\t\tif ( context.endsWith( 'codeBlock $text' ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} );\n\n\t\t// Disallow object elements inside `codeBlock`. See #9567.\n\t\teditor.model.schema.addChildCheck( ( context, childDefinition ) => {\n\t\t\tif ( context.endsWith( 'codeBlock' ) && childDefinition.isObject ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} );\n\n\t\t// Conversion.\n\t\teditor.editing.downcastDispatcher.on( 'insert:codeBlock', modelToViewCodeBlockInsertion( model, normalizedLanguagesDefs, true ) );\n\t\teditor.data.downcastDispatcher.on( 'insert:codeBlock', modelToViewCodeBlockInsertion( model, normalizedLanguagesDefs ) );\n\t\teditor.data.downcastDispatcher.on( 'insert:softBreak', modelToDataViewSoftBreakInsertion( model ), { priority: 'high' } );\n\n\t\teditor.data.upcastDispatcher.on( 'element:code', dataViewToModelCodeBlockInsertion( view, normalizedLanguagesDefs ) );\n\t\teditor.data.upcastDispatcher.on( 'text', dataViewToModelTextNewlinesInsertion() );\n\n\t\t// Intercept the clipboard input (paste) when the selection is anchored in the code block and force the clipboard\n\t\t// data to be pasted as a single plain text. Otherwise, the code lines will split the code block and\n\t\t// \"spill out\" as separate paragraphs.\n\t\tthis.listenTo( editor.editing.view.document, 'clipboardInput', ( evt, data ) => {\n\t\t\tlet insertionRange = model.createRange( model.document.selection.anchor );\n\n\t\t\t// Use target ranges in case this is a drop.\n\t\t\tif ( data.targetRanges ) {\n\t\t\t\tinsertionRange = editor.editing.mapper.toModelRange( data.targetRanges[ 0 ] );\n\t\t\t}\n\n\t\t\tif ( !insertionRange.start.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst text = data.dataTransfer.getData( 'text/plain' );\n\t\t\tconst writer = new UpcastWriter( editor.editing.view.document );\n\n\t\t\t// Pass the view fragment to the default clipboardInput handler.\n\t\t\tdata.content = rawSnippetTextToViewDocumentFragment( writer, text );\n\t\t} );\n\n\t\t// Make sure multi–line selection is always wrapped in a code block when `getSelectedContent()`\n\t\t// is used (e.g. clipboard copy). Otherwise, only the raw text will be copied to the clipboard and,\n\t\t// upon next paste, this bare text will not be inserted as a code block, which is not the best UX.\n\t\t// Similarly, when the selection in a single line, the selected content should be an inline code\n\t\t// so it can be pasted later on and retain it's preformatted nature.\n\t\tthis.listenTo( model, 'getSelectedContent', ( evt, [ selection ] ) => {\n\t\t\tconst anchor = selection.anchor;\n\n\t\t\tif ( selection.isCollapsed || !anchor.parent.is( 'element', 'codeBlock' ) || !anchor.hasSameParentAs( selection.focus ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmodel.change( writer => {\n\t\t\t\tconst docFragment = evt.return;\n\n\t\t\t\t// fo[o<softBreak></softBreak>b]ar -> <codeBlock language=\"...\">[o<softBreak></softBreak>b]<codeBlock>\n\t\t\t\tif ( docFragment.childCount > 1 || selection.containsEntireContent( anchor.parent ) ) {\n\t\t\t\t\tconst codeBlock = writer.createElement( 'codeBlock', anchor.parent.getAttributes() );\n\t\t\t\t\twriter.append( docFragment, codeBlock );\n\n\t\t\t\t\tconst newDocumentFragment = writer.createDocumentFragment();\n\t\t\t\t\twriter.append( codeBlock, newDocumentFragment );\n\n\t\t\t\t\tevt.return = newDocumentFragment;\n\t\t\t\t}\n\n\t\t\t\t// \"f[oo]\" -> <$text code=\"true\">oo</text>\n\t\t\t\telse {\n\t\t\t\t\tconst textNode = docFragment.getChild( 0 );\n\n\t\t\t\t\tif ( schema.checkAttribute( textNode, 'code' ) ) {\n\t\t\t\t\t\twriter.setAttribute( 'code', true, textNode );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tafterInit() {\n\t\tconst editor = this.editor;\n\t\tconst commands = editor.commands;\n\t\tconst indent = commands.get( 'indent' );\n\t\tconst outdent = commands.get( 'outdent' );\n\n\t\tif ( indent ) {\n\t\t\tindent.registerChildCommand( commands.get( 'indentCodeBlock' ) );\n\t\t}\n\n\t\tif ( outdent ) {\n\t\t\toutdent.registerChildCommand( commands.get( 'outdentCodeBlock' ) );\n\t\t}\n\n\t\t// Customize the response to the <kbd>Enter</kbd> and <kbd>Shift</kbd>+<kbd>Enter</kbd>\n\t\t// key press when the selection is in the code block. Upon enter key press we can either\n\t\t// leave the block if it's \"two or three enters\" in a row or create a new code block line, preserving\n\t\t// previous line's indentation.\n\t\tthis.listenTo( editor.editing.view.document, 'enter', ( evt, data ) => {\n\t\t\tconst positionParent = editor.model.document.selection.getLastPosition().parent;\n\n\t\t\tif ( !positionParent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( !leaveBlockStartOnEnter( editor, data.isSoft ) && !leaveBlockEndOnEnter( editor, data.isSoft ) ) {\n\t\t\t\tbreakLineOnEnter( editor );\n\t\t\t}\n\n\t\t\tdata.preventDefault();\n\t\t\tevt.stop();\n\t\t}, { context: 'pre' } );\n\t}\n}\n\n// Normally, when the Enter (or Shift+Enter) key is pressed, a soft line break is to be added to the\n// code block. Let's try to follow the indentation of the previous line when possible, for instance:\n//\n//\t\t// Before pressing enter (or shift enter)\n//\t\t<codeBlock>\n//\t\t\" foo()\"[] // Indent of 4 spaces.\n//\t\t</codeBlock>\n//\n//\t\t// After pressing:\n//\t\t<codeBlock>\n//\t\t\" foo()\" // Indent of 4 spaces.\n//\t\t<softBreak></softBreak> // A new soft break created by pressing enter.\n//\t\t\" \"[] // Retain the indent of 4 spaces.\n//\t\t</codeBlock>\n//\n// @param {module:core/editor/editor~Editor} editor\nfunction breakLineOnEnter( editor ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst node = lastSelectionPosition.nodeBefore || lastSelectionPosition.textNode;\n\tlet leadingWhiteSpaces;\n\n\t// Figure out the indentation (white space chars) at the beginning of the line.\n\tif ( node && node.is( '$text' ) ) {\n\t\tleadingWhiteSpaces = getLeadingWhiteSpaces( node );\n\t}\n\n\t// Keeping everything in a change block for a single undo step.\n\teditor.model.change( writer => {\n\t\teditor.execute( 'shiftEnter' );\n\n\t\t// If the line before being broken in two had some indentation, let's retain it\n\t\t// in the new line.\n\t\tif ( leadingWhiteSpaces ) {\n\t\t\twriter.insertText( leadingWhiteSpaces, modelDoc.selection.anchor );\n\t\t}\n\t} );\n}\n\n// Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the beginning\n// of the code block:\n//\n//\t\t// Before:\n//\t\t<codeBlock>[]<softBreak></softBreak>foo</codeBlock>\n//\n//\t\t// After pressing:\n//\t\t<paragraph>[]</paragraph><codeBlock>foo</codeBlock>\n//\n// @param {module:core/editor/editor~Editor} editor\n// @param {Boolean} isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n// @returns {Boolean} `true` when selection left the block. `false` if stayed.\nfunction leaveBlockStartOnEnter( editor, isSoftEnter ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst view = editor.editing.view;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst nodeAfter = lastSelectionPosition.nodeAfter;\n\n\tif ( isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtStart ) {\n\t\treturn false;\n\t}\n\n\tif ( !isSoftBreakNode( nodeAfter ) ) {\n\t\treturn false;\n\t}\n\n\t// We're doing everything in a single change block to have a single undo step.\n\teditor.model.change( writer => {\n\t\t// \"Clone\" the <codeBlock> in the standard way.\n\t\teditor.execute( 'enter' );\n\n\t\t// The cloned block exists now before the original code block.\n\t\tconst newBlock = modelDoc.selection.anchor.parent.previousSibling;\n\n\t\t// Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n\t\twriter.rename( newBlock, DEFAULT_ELEMENT );\n\t\twriter.setSelection( newBlock, 'in' );\n\t\teditor.model.schema.removeDisallowedAttributes( [ newBlock ], writer );\n\n\t\t// Remove the <softBreak> that originally followed the selection position.\n\t\twriter.remove( nodeAfter );\n\t} );\n\n\t// Eye candy.\n\tview.scrollToTheSelection();\n\n\treturn true;\n}\n\n// Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the end\n// of the code block:\n//\n//\t\t// Before:\n//\t\t<codeBlock>foo[]</codeBlock>\n//\n//\t\t// After first press:\n//\t\t<codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n//\n//\t\t// After second press:\n//\t\t<codeBlock>foo</codeBlock><paragraph>[]</paragraph>\n//\n// @param {module:core/editor/editor~Editor} editor\n// @param {Boolean} isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n// @returns {Boolean} `true` when selection left the block. `false` if stayed.\nfunction leaveBlockEndOnEnter( editor, isSoftEnter ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst view = editor.editing.view;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst nodeBefore = lastSelectionPosition.nodeBefore;\n\n\tlet emptyLineRangeToRemoveOnEnter;\n\n\tif ( isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtEnd || !nodeBefore || !nodeBefore.previousSibling ) {\n\t\treturn false;\n\t}\n\n\t// When the position is directly preceded by two soft breaks\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>[]</codeBlock>\n\t//\n\t// it creates the following range that will be cleaned up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak>]</codeBlock>\n\t//\n\tif ( isSoftBreakNode( nodeBefore ) && isSoftBreakNode( nodeBefore.previousSibling ) ) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling ), model.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// When there's some text before the position that is\n\t// preceded by two soft breaks and made purely of white–space characters\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak> []</codeBlock>\n\t//\n\t// it creates the following range to clean up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak> ]</codeBlock>\n\t//\n\telse if (\n\t\tisEmptyishTextNode( nodeBefore ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling.previousSibling )\n\t) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling.previousSibling ), model.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// When there's some text before the position that is made purely of white–space characters\n\t// and is preceded by some other text made purely of white–space characters\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak> <softBreak></softBreak> []</codeBlock>\n\t//\n\t// it creates the following range to clean up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak> <softBreak></softBreak> ]</codeBlock>\n\t//\n\telse if (\n\t\tisEmptyishTextNode( nodeBefore ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling ) &&\n\t\tisEmptyishTextNode( nodeBefore.previousSibling.previousSibling ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling.previousSibling.previousSibling )\n\t) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling.previousSibling.previousSibling ),\n\t\t\tmodel.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// Not leaving the block in the following cases:\n\t//\n\t//\t\t<codeBlock> []</codeBlock>\n\t//\t\t<codeBlock> a []</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>bar[]</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak> a []</codeBlock>\n\t//\n\telse {\n\t\treturn false;\n\t}\n\n\t// We're doing everything in a single change block to have a single undo step.\n\teditor.model.change( writer => {\n\t\t// Remove the last <softBreak>s and all white space characters that followed them.\n\t\twriter.remove( emptyLineRangeToRemoveOnEnter );\n\n\t\t// \"Clone\" the <codeBlock> in the standard way.\n\t\teditor.execute( 'enter' );\n\n\t\tconst newBlock = modelDoc.selection.anchor.parent;\n\n\t\t// Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n\t\twriter.rename( newBlock, DEFAULT_ELEMENT );\n\t\teditor.model.schema.removeDisallowedAttributes( [ newBlock ], writer );\n\t} );\n\n\t// Eye candy.\n\tview.scrollToTheSelection();\n\n\treturn true;\n}\n\nfunction isEmptyishTextNode( node ) {\n\treturn node && node.is( '$text' ) && !node.data.match( /\\S/ );\n}\n\nfunction isSoftBreakNode( node ) {\n\treturn node && node.is( 'element', 'softBreak' );\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockui\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Collection } from 'ckeditor5/src/utils';\nimport { Model, SplitButtonView, createDropdown, addListToDropdown } from 'ckeditor5/src/ui';\n\nimport { getNormalizedAndLocalizedLanguageDefinitions } from './utils';\n\nimport codeBlockIcon from '../theme/icons/codeblock.svg';\nimport '../theme/codeblock.css';\n\n/**\n * The code block UI plugin.\n *\n * Introduces the `'codeBlock'` dropdown.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlockUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlockUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst componentFactory = editor.ui.componentFactory;\n\t\tconst normalizedLanguageDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\n\t\tcomponentFactory.add( 'codeBlock', locale => {\n\t\t\tconst command = editor.commands.get( 'codeBlock' );\n\t\t\tconst dropdownView = createDropdown( locale, SplitButtonView );\n\t\t\tconst splitButtonView = dropdownView.buttonView;\n\n\t\t\tsplitButtonView.set( {\n\t\t\t\tlabel: t( 'Insert code block' ),\n\t\t\t\ttooltip: true,\n\t\t\t\ticon: codeBlockIcon,\n\t\t\t\tisToggleable: true\n\t\t\t} );\n\n\t\t\tsplitButtonView.bind( 'isOn' ).to( command, 'value', value => !!value );\n\n\t\t\tsplitButtonView.on( 'execute', () => {\n\t\t\t\teditor.execute( 'codeBlock', {\n\t\t\t\t\tusePreviousLanguageChoice: true\n\t\t\t\t} );\n\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\tdropdownView.on( 'execute', evt => {\n\t\t\t\teditor.execute( 'codeBlock', {\n\t\t\t\t\tlanguage: evt.source._codeBlockLanguage,\n\t\t\t\t\tforceValue: true\n\t\t\t\t} );\n\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\tdropdownView.class = 'ck-code-block-dropdown';\n\t\t\tdropdownView.bind( 'isEnabled' ).to( command );\n\n\t\t\taddListToDropdown( dropdownView, this._getLanguageListItemDefinitions( normalizedLanguageDefs ) );\n\n\t\t\treturn dropdownView;\n\t\t} );\n\t}\n\n\t/**\n\t * A helper returning a collection of the `codeBlock` dropdown items representing languages\n\t * available for the user to choose from.\n\t *\n\t * @private\n\t * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} normalizedLanguageDefs\n\t * @returns {Iterable.<module:ui/dropdown/utils~ListDropdownItemDefinition>}\n\t */\n\t_getLanguageListItemDefinitions( normalizedLanguageDefs ) {\n\t\tconst editor = this.editor;\n\t\tconst command = editor.commands.get( 'codeBlock' );\n\t\tconst itemDefinitions = new Collection();\n\n\t\tfor ( const languageDef of normalizedLanguageDefs ) {\n\t\t\tconst definition = {\n\t\t\t\ttype: 'button',\n\t\t\t\tmodel: new Model( {\n\t\t\t\t\t_codeBlockLanguage: languageDef.language,\n\t\t\t\t\tlabel: languageDef.label,\n\t\t\t\t\twithText: true\n\t\t\t\t} )\n\t\t\t};\n\n\t\t\tdefinition.model.bind( 'isOn' ).to( command, 'value', value => {\n\t\t\t\treturn value === definition.model._codeBlockLanguage;\n\t\t\t} );\n\n\t\t\titemDefinitions.add( definition );\n\t\t}\n\n\t\treturn itemDefinitions;\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/converters\n */\n\nimport { getPropertyAssociation } from './utils';\n\n/**\n * A model-to-view (both editing and data) converter for the `codeBlock` element.\n *\n * Sample input:\n *\n *\t\t<codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * Sample output (editing):\n *\n *\t\t<pre data-language=\"JavaScript\"><code class=\"language-javascript\">foo();<br />bar();</code></pre>\n *\n * Sample output (data, see {@link module:code-block/converters~modelToDataViewSoftBreakInsertion}):\n *\n *\t\t<pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n *\n * @param {module:engine/model/model~Model} model\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} languageDefs The normalized language\n * configuration passed to the feature.\n * @param {Boolean} [useLabels=false] When `true`, the `<pre>` element will get a `data-language` attribute with a\n * human–readable label of the language. Used only in the editing.\n * @returns {Function} Returns a conversion callback.\n */\nexport function modelToViewCodeBlockInsertion( model, languageDefs, useLabels = false ) {\n\t// Language CSS classes:\n\t//\n\t//\t\t{\n\t//\t\t\tphp: 'language-php',\n\t//\t\t\tpython: 'language-python',\n\t//\t\t\tjavascript: 'js',\n\t//\t\t\t...\n\t//\t\t}\n\tconst languagesToClasses = getPropertyAssociation( languageDefs, 'language', 'class' );\n\n\t// Language labels:\n\t//\n\t//\t\t{\n\t//\t\t\tphp: 'PHP',\n\t//\t\t\tpython: 'Python',\n\t//\t\t\tjavascript: 'JavaScript',\n\t//\t\t\t...\n\t//\t\t}\n\tconst languagesToLabels = getPropertyAssociation( languageDefs, 'language', 'label' );\n\n\treturn ( evt, data, conversionApi ) => {\n\t\tconst { writer, mapper, consumable } = conversionApi;\n\n\t\tif ( !consumable.consume( data.item, 'insert' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst codeBlockLanguage = data.item.getAttribute( 'language' );\n\t\tconst targetViewPosition = mapper.toViewPosition( model.createPositionBefore( data.item ) );\n\t\tconst preAttributes = {};\n\n\t\t// Attributes added only in the editing view.\n\t\tif ( useLabels ) {\n\t\t\tpreAttributes[ 'data-language' ] = languagesToLabels[ codeBlockLanguage ];\n\t\t\tpreAttributes.spellcheck = 'false';\n\t\t}\n\n\t\tconst pre = writer.createContainerElement( 'pre', preAttributes );\n\t\tconst code = writer.createContainerElement( 'code', {\n\t\t\tclass: languagesToClasses[ codeBlockLanguage ] || null\n\t\t} );\n\n\t\twriter.insert( writer.createPositionAt( pre, 0 ), code );\n\t\twriter.insert( targetViewPosition, pre );\n\t\tmapper.bindElements( data.item, code );\n\t};\n}\n\n/**\n * A model-to-data view converter for the new line (`softBreak`) separator.\n *\n * Sample input:\n *\n *\t\t<codeBlock ...>foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * Sample output:\n *\n *\t\t<pre><code ...>foo();\\nbar();</code></pre>\n *\n * @param {module:engine/model/model~Model} model\n * @returns {Function} Returns a conversion callback.\n */\nexport function modelToDataViewSoftBreakInsertion( model ) {\n\treturn ( evt, data, conversionApi ) => {\n\t\tif ( data.item.parent.name !== 'codeBlock' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { writer, mapper, consumable } = conversionApi;\n\n\t\tif ( !consumable.consume( data.item, 'insert' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst position = mapper.toViewPosition( model.createPositionBefore( data.item ) );\n\n\t\twriter.insert( position, writer.createText( '\\n' ) );\n\t};\n}\n\n/**\n * A view-to-model converter for `<pre>` with the `<code>` HTML.\n *\n * Sample input:\n *\n *\t\t<pre><code class=\"language-javascript\">foo();bar();</code></pre>\n *\n * Sample output:\n *\n *\t\t<codeBlock language=\"javascript\">foo();bar();</codeBlock>\n *\n * @param {module:engine/view/view~View} editingView\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} languageDefs The normalized language\n * configuration passed to the feature.\n * @returns {Function} Returns a conversion callback.\n */\nexport function dataViewToModelCodeBlockInsertion( editingView, languageDefs ) {\n\t// Language names associated with CSS classes:\n\t//\n\t//\t\t{\n\t//\t\t\t'language-php': 'php',\n\t//\t\t\t'language-python': 'python',\n\t//\t\t\tjs: 'javascript',\n\t//\t\t\t...\n\t//\t\t}\n\tconst classesToLanguages = getPropertyAssociation( languageDefs, 'class', 'language' );\n\tconst defaultLanguageName = languageDefs[ 0 ].language;\n\n\treturn ( evt, data, conversionApi ) => {\n\t\tconst viewCodeElement = data.viewItem;\n\t\tconst viewPreElement = viewCodeElement.parent;\n\n\t\tif ( !viewPreElement || !viewPreElement.is( 'element', 'pre' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In case of nested code blocks we don't want to convert to another code block.\n\t\tif ( data.modelCursor.findAncestor( 'codeBlock' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { consumable, writer } = conversionApi;\n\n\t\tif ( !consumable.test( viewCodeElement, { name: true } ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst codeBlock = writer.createElement( 'codeBlock' );\n\t\tconst viewChildClasses = [ ...viewCodeElement.getClassNames() ];\n\n\t\t// As we're to associate each class with a model language, a lack of class (empty class) can be\n\t\t// also associated with a language if the language definition was configured so. Pushing an empty\n\t\t// string to make sure the association will work.\n\t\tif ( !viewChildClasses.length ) {\n\t\t\tviewChildClasses.push( '' );\n\t\t}\n\n\t\t// Figure out if any of the <code> element's class names is a valid programming\n\t\t// language class. If so, use it on the model element (becomes the language of the entire block).\n\t\tfor ( const className of viewChildClasses ) {\n\t\t\tconst language = classesToLanguages[ className ];\n\n\t\t\tif ( language ) {\n\t\t\t\twriter.setAttribute( 'language', language, codeBlock );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// If no language value was set, use the default language from the config.\n\t\tif ( !codeBlock.hasAttribute( 'language' ) ) {\n\t\t\twriter.setAttribute( 'language', defaultLanguageName, codeBlock );\n\t\t}\n\n\t\tconversionApi.convertChildren( viewCodeElement, codeBlock );\n\n\t\t// Let's try to insert code block.\n\t\tif ( !conversionApi.safeInsert( codeBlock, data.modelCursor ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsumable.consume( viewCodeElement, { name: true } );\n\n\t\tconversionApi.updateConversionResult( codeBlock, data );\n\t};\n}\n\n/**\n * A view-to-model converter for new line characters in `<pre>`.\n *\n * Sample input:\n *\n *\t\t<pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n *\n * Sample output:\n *\n *\t\t<codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * @returns {Function} Returns a conversion callback.\n */\nexport function dataViewToModelTextNewlinesInsertion() {\n\treturn ( evt, data, { consumable, writer } ) => {\n\t\tlet position = data.modelCursor;\n\n\t\t// When node is already converted then do nothing.\n\t\tif ( !consumable.test( data.viewItem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// When not inside `codeBlock` then do nothing.\n\t\tif ( !position.findAncestor( 'codeBlock' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsumable.consume( data.viewItem );\n\n\t\tconst text = data.viewItem.data;\n\t\tconst textLines = text.split( '\\n' ).map( data => writer.createText( data ) );\n\t\tconst lastLine = textLines[ textLines.length - 1 ];\n\n\t\tfor ( const node of textLines ) {\n\t\t\twriter.insert( node, position );\n\t\t\tposition = position.getShiftedBy( node.offsetSize );\n\n\t\t\tif ( node !== lastLine ) {\n\t\t\t\tconst softBreak = writer.createElement( 'softBreak' );\n\n\t\t\t\twriter.insert( softBreak, position );\n\t\t\t\tposition = writer.createPositionAfter( softBreak );\n\t\t\t}\n\t\t}\n\n\t\tdata.modelRange = writer.createRange(\n\t\t\tdata.modelCursor,\n\t\t\tposition\n\t\t);\n\t\tdata.modelCursor = position;\n\t};\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/indentcodeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\n\nimport {\n\tgetIndentOutdentPositions,\n\tisModelSelectionInCodeBlock\n} from './utils';\n\n/**\n * The code block indentation increase command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class IndentCodeBlockCommand extends Command {\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * A sequence of characters added to the line when the command is executed.\n\t\t *\n\t\t * @readonly\n\t\t * @private\n\t\t * @member {String}\n\t\t */\n\t\tthis._indentSequence = editor.config.get( 'codeBlock.indentSequence' );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n\t * code lines in the selection will be increased.\n\t *\n\t * @fires execute\n\t */\n\texecute() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\tconst positions = getIndentOutdentPositions( model );\n\n\t\t\t// Indent all positions, for instance assuming the indent sequence is 4x space (\" \"):\n\t\t\t//\n\t\t\t//\t\t<codeBlock>^foo</codeBlock> -> <codeBlock> foo</codeBlock>\n\t\t\t//\n\t\t\t//\t\t<codeBlock>foo^bar</codeBlock> -> <codeBlock>foo bar</codeBlock>\n\t\t\t//\n\t\t\t// Also, when there is more than one position:\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t^foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t^bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\t//\t\t->\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\tfor ( const position of positions ) {\n\t\t\t\twriter.insertText( this._indentSequence, position );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( !this._indentSequence ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Indent (forward) command is always enabled when there's any code block in the selection\n\t\t// because you can always indent code lines.\n\t\treturn isModelSelectionInCodeBlock( this.editor.model.document.selection );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/outdentcodeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\n\nimport {\n\tgetLeadingWhiteSpaces,\n\tgetIndentOutdentPositions,\n\tisModelSelectionInCodeBlock\n} from './utils';\n\n/**\n * The code block indentation decrease command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class OutdentCodeBlockCommand extends Command {\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * A sequence of characters removed from the line when the command is executed.\n\t\t *\n\t\t * @readonly\n\t\t * @private\n\t\t * @member {String}\n\t\t */\n\t\tthis._indentSequence = editor.config.get( 'codeBlock.indentSequence' );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n\t * code lines in the selection will be decreased.\n\t *\n\t * @fires execute\n\t */\n\texecute() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\tconst positions = getIndentOutdentPositions( model );\n\n\t\t\t// Outdent all positions, for instance assuming the indent sequence is 4x space (\" \"):\n\t\t\t//\n\t\t\t//\t\t<codeBlock>^foo</codeBlock> -> <codeBlock>foo</codeBlock>\n\t\t\t//\n\t\t\t//\t\t<codeBlock> ^bar</codeBlock> -> <codeBlock>bar</codeBlock>\n\t\t\t//\n\t\t\t// Also, when there is more than one position:\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t ^foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t ^bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\t//\t\t->\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\tfoobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\tbazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\tfor ( const position of positions ) {\n\t\t\t\tconst range = getLastOutdentableSequenceRange( this.editor.model, position, this._indentSequence );\n\n\t\t\t\tif ( range ) {\n\t\t\t\t\twriter.remove( range );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( !this._indentSequence ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst model = this.editor.model;\n\n\t\tif ( !isModelSelectionInCodeBlock( model.document.selection ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Outdent command can execute only when there is an indent character sequence\n\t\t// in some of the lines.\n\t\treturn getIndentOutdentPositions( model ).some( position => {\n\t\t\treturn getLastOutdentableSequenceRange( model, position, this._indentSequence );\n\t\t} );\n\t}\n}\n\n// For a position coming from `getIndentOutdentPositions()`, it returns the range representing\n// the last occurrence of the indent sequence among the leading whitespaces of the code line the\n// position represents.\n//\n// For instance, assuming the indent sequence is 4x space (\" \"):\n//\n//\t\t<codeBlock>foo^</codeBlock> -> null\n//\t\t<codeBlock>foo^<softBreak></softBreak>bar</codeBlock> -> null\n//\t\t<codeBlock> ^foo</codeBlock> -> null\n//\t\t<codeBlock> ^foo</codeBlock> -> <codeBlock> [ ]foo</codeBlock>\n//\t\t<codeBlock> ^foo bar</codeBlock> -> <codeBlock>[ ]foo bar</codeBlock>\n//\n// @param {<module:engine/model/model~Model>} model\n// @param {<module:engine/model/position~Position>} position\n// @param {String} sequence\n// @returns {<module:engine/model/range~Range>|null}\nfunction getLastOutdentableSequenceRange( model, position, sequence ) {\n\t// Positions start before each text node (code line). Get the node corresponding to the position.\n\tconst nodeAtPosition = getCodeLineTextNodeAtPosition( position );\n\n\tif ( !nodeAtPosition ) {\n\t\treturn null;\n\t}\n\n\tconst leadingWhiteSpaces = getLeadingWhiteSpaces( nodeAtPosition );\n\tconst lastIndexOfSequence = leadingWhiteSpaces.lastIndexOf( sequence );\n\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> \t^foo</codeBlock> -> null\n\t//\n\tif ( lastIndexOfSequence + sequence.length !== leadingWhiteSpaces.length ) {\n\t\treturn null;\n\t}\n\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> ^foo</codeBlock> -> null\n\t//\n\tif ( lastIndexOfSequence === -1 ) {\n\t\treturn null;\n\t}\n\n\tconst { parent, startOffset } = nodeAtPosition;\n\n\t// Create a range that contains the **last** indent sequence among the leading whitespaces\n\t// of the line.\n\t//\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> ^foo</codeBlock> -> <codeBlock> [ ]foo</codeBlock>\n\t//\n\treturn model.createRange(\n\t\tmodel.createPositionAt( parent, startOffset + lastIndexOfSequence ),\n\t\tmodel.createPositionAt( parent, startOffset + lastIndexOfSequence + sequence.length )\n\t);\n}\n\nfunction getCodeLineTextNodeAtPosition( position ) {\n\t// Positions start before each text node (code line). Get the node corresponding to the position.\n\tlet nodeAtPosition = position.parent.getChild( position.index );\n\n\t// <codeBlock>foo^</codeBlock>\n\t// <codeBlock>foo^<softBreak></softBreak>bar</codeBlock>\n\tif ( !nodeAtPosition || nodeAtPosition.is( 'element', 'softBreak' ) ) {\n\t\tnodeAtPosition = position.nodeBefore;\n\t}\n\n\t// <codeBlock>^</codeBlock>\n\t// <codeBlock>foo^<softBreak></softBreak>bar</codeBlock>\n\tif ( !nodeAtPosition || nodeAtPosition.is( 'element', 'softBreak' ) ) {\n\t\treturn null;\n\t}\n\n\treturn nodeAtPosition;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/utils\n */\n\nimport { first } from 'ckeditor5/src/utils';\n\n/**\n * Returns code block languages as defined in `config.codeBlock.languages` but processed:\n *\n * * To consider the editor localization, i.e. to display {@link module:code-block/codeblock~CodeBlockLanguageDefinition}\n * in the correct language. There is no way to use {@link module:utils/locale~Locale#t} when the user\n * configuration is defined because the editor does not exist yet.\n * * To make sure each definition has a CSS class associated with it even if not specified\n * in the original configuration.\n *\n * @param {module:core/editor/editor~Editor} editor\n * @returns {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>}.\n */\nexport function getNormalizedAndLocalizedLanguageDefinitions( editor ) {\n\tconst t = editor.t;\n\tconst languageDefs = editor.config.get( 'codeBlock.languages' );\n\n\tfor ( const def of languageDefs ) {\n\t\tif ( def.label === 'Plain text' ) {\n\t\t\tdef.label = t( 'Plain text' );\n\t\t}\n\n\t\tif ( def.class === undefined ) {\n\t\t\tdef.class = `language-${ def.language }`;\n\t\t}\n\t}\n\n\treturn languageDefs;\n}\n\n/**\n * Returns an object associating certain language definition properties with others. For instance:\n *\n * For:\n *\n *\t\tconst definitions = {\n *\t\t\t{ language: 'php', class: 'language-php', label: 'PHP' },\n *\t\t\t{ language: 'javascript', class: 'js', label: 'JavaScript' },\n *\t\t};\n *\n *\t\tgetPropertyAssociation( definitions, 'class', 'language' );\n *\n * returns:\n *\n *\t\t{\n *\t\t\t'language-php': 'php'\n *\t\t\t'js': 'javascript'\n *\t\t}\n *\n * and\n *\n *\t\tgetPropertyAssociation( definitions, 'language', 'label' );\n *\n * returns:\n *\n *\t\t{\n *\t\t\t'php': 'PHP'\n *\t\t\t'javascript': 'JavaScript'\n *\t\t}\n *\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>}\n * @param {String} key\n * @param {String} value\n * @param {Object.<String,String>}\n */\nexport function getPropertyAssociation( languageDefs, key, value ) {\n\tconst association = {};\n\n\tfor ( const def of languageDefs ) {\n\t\tif ( key === 'class' ) {\n\t\t\t// Only the first class is considered.\n\t\t\tassociation[ def[ key ].split( ' ' ).shift() ] = def[ value ];\n\t\t} else {\n\t\t\tassociation[ def[ key ] ] = def[ value ];\n\t\t}\n\t}\n\n\treturn association;\n}\n\n/**\n * For a given model text node, it returns white spaces that precede other characters in that node.\n * This corresponds to the indentation part of the code block line.\n *\n * @param {module:engine/model/text~Text} codeLineNodes\n * @returns {String}\n */\nexport function getLeadingWhiteSpaces( textNode ) {\n\treturn textNode.data.match( /^(\\s*)/ )[ 0 ];\n}\n\n/**\n * For plain text containing the code (a snippet), it returns a document fragment containing\n * view text nodes separated by `<br>` elements (in place of new line characters \"\\n\"), for instance:\n *\n * Input:\n *\n *\t\t\"foo()\\n\n *\t\tbar()\"\n *\n * Output:\n *\n *\t\t<DocumentFragment>\n *\t\t\t\"foo()\"\n *\t\t\t<br/>\n *\t\t\t\"bar()\"\n *\t\t</DocumentFragment>\n *\n * @param {module:engine/view/upcastwriter~UpcastWriter} writer\n * @param {String} text The raw code text to be converted.\n * @returns {module:engine/view/documentfragment~DocumentFragment}\n */\nexport function rawSnippetTextToViewDocumentFragment( writer, text ) {\n\tconst fragment = writer.createDocumentFragment();\n\tconst textLines = text.split( '\\n' );\n\n\tconst nodes = textLines.reduce( ( nodes, line, lineIndex ) => {\n\t\tnodes.push( line );\n\n\t\tif ( lineIndex < textLines.length - 1 ) {\n\t\t\tnodes.push( writer.createElement( 'br' ) );\n\t\t}\n\n\t\treturn nodes;\n\t}, [] );\n\n\twriter.appendChild( nodes, fragment );\n\n\treturn fragment;\n}\n\n/**\n * Returns an array of all model positions within the selection that represent code block lines.\n *\n * If the selection is collapsed, it returns the exact selection anchor position:\n *\n *\t\t<codeBlock>[]foo</codeBlock> -> <codeBlock>^foo</codeBlock>\n *\t\t<codeBlock>foo[]bar</codeBlock> -> <codeBlock>foo^bar</codeBlock>\n *\n * Otherwise, it returns positions **before** each text node belonging to all code blocks contained by the selection:\n *\n *\t\t<codeBlock> <codeBlock>\n *\t\t foo[bar ^foobar\n *\t\t <softBreak></softBreak> -> <softBreak></softBreak>\n *\t\t baz]qux ^bazqux\n *\t\t</codeBlock> </codeBlock>\n *\n * It also works across other non–code blocks:\n *\n *\t\t<codeBlock> <codeBlock>\n *\t\t foo[bar ^foobar\n *\t\t</codeBlock> </codeBlock>\n *\t\t<paragraph>text</paragraph> -> <paragraph>text</paragraph>\n *\t\t<codeBlock> <codeBlock>\n *\t\t baz]qux ^bazqux\n *\t\t</codeBlock> </codeBlock>\n *\n * **Note:** The positions are in reverse order so they do not get outdated when iterating over them and\n * the writer inserts or removes elements at the same time.\n *\n * **Note:** The position is located after the leading white spaces in the text node.\n *\n * @param {module:engine/model/model~Model} model\n * @returns {Array.<module:engine/model/position~Position>}\n */\nexport function getIndentOutdentPositions( model ) {\n\tconst selection = model.document.selection;\n\tconst positions = [];\n\n\t// When the selection is collapsed, there's only one position we can indent or outdent.\n\tif ( selection.isCollapsed ) {\n\t\tpositions.push( selection.anchor );\n\t}\n\n\t// When the selection is NOT collapsed, collect all positions starting before text nodes\n\t// (code lines) in any <codeBlock> within the selection.\n\telse {\n\t\t// Walk backward so positions we are about to collect here do not get outdated when\n\t\t// inserting or deleting using the writer.\n\t\tconst walker = selection.getFirstRange().getWalker( {\n\t\t\tignoreElementEnd: true,\n\t\t\tdirection: 'backward'\n\t\t} );\n\n\t\tfor ( const { item } of walker ) {\n\t\t\tif ( item.is( '$textProxy' ) && item.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\tconst leadingWhiteSpaces = getLeadingWhiteSpaces( item.textNode );\n\t\t\t\tconst { parent, startOffset } = item.textNode;\n\n\t\t\t\t// Make sure the position is after all leading whitespaces in the text node.\n\t\t\t\tconst position = model.createPositionAt( parent, startOffset + leadingWhiteSpaces.length );\n\n\t\t\t\tpositions.push( position );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn positions;\n}\n\n/**\n * Checks if any of the blocks within the model selection is a code block.\n *\n * @param {module:engine/model/selection~Selection} selection\n * @returns {Boolean}\n */\nexport function isModelSelectionInCodeBlock( selection ) {\n\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\treturn firstBlock && firstBlock.is( 'element', 'codeBlock' );\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/engine.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/enter.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/ui.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block\n */\n\nexport { default as CodeBlock } from './codeblock';\nexport { default as CodeBlockEditing } from './codeblockediting';\nexport { default as CodeBlockUI } from './codeblockui';\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://CKEditor5.codeBlock/./theme/codeblock.css","webpack://CKEditor5.codeBlock/../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.codeBlock/../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.codeBlock/./theme/icons/codeblock.svg","webpack://CKEditor5.codeBlock/./theme/codeblock.css?c660","webpack://CKEditor5.codeBlock/../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.codeBlock/./src/codeblock.js","webpack://CKEditor5.codeBlock/./src/codeblockcommand.js","webpack://CKEditor5.codeBlock/./src/codeblockediting.js","webpack://CKEditor5.codeBlock/./src/codeblockui.js","webpack://CKEditor5.codeBlock/./src/converters.js","webpack://CKEditor5.codeBlock/./src/indentcodeblockcommand.js","webpack://CKEditor5.codeBlock/./src/outdentcodeblockcommand.js","webpack://CKEditor5.codeBlock/./src/utils.js","webpack://CKEditor5.codeBlock/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/engine.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/enter.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.codeBlock/external var \"CKEditor5.dll\"","webpack://CKEditor5.codeBlock/webpack/bootstrap","webpack://CKEditor5.codeBlock/webpack/runtime/compat get default export","webpack://CKEditor5.codeBlock/webpack/runtime/define property getters","webpack://CKEditor5.codeBlock/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.codeBlock/webpack/runtime/make namespace object","webpack://CKEditor5.codeBlock/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAC4H;AAC7B;AAC/F,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,0DAA0D,6BAA6B,yBAAyB,kBAAkB,cAAc,cAAc,kBAAkB,gBAAgB,YAAY,WAAW,gBAAgB,qBAAqB,qBAAqB,iBAAiB,gBAAgB,UAAU,4BAA4B,kBAAkB,iDAAiD,4BAA4B,kBAAkB,MAAM,+CAA+C,iDAAiD,uDAAuD,WAAW,gCAAgC,eAAe,iBAAiB,wDAAwD,WAAW,SAAS,mBAAmB,+CAA+C,iBAAiB,kBAAkB,gBAAgB,OAAO,6vBAA6vB,iBAAiB,6BAA6B,sCAAsC,sCAAsC,uBAAuB,4EAA4E,mBAAmB,kBAAkB,0BAA0B,uFAAuF,0FAA0F,cAAc,wBAAwB,iBAAiB,uBAAuB,KAAK,GAAG,iCAAiC,uBAAuB,+BAA+B,mCAAmC,yBAAyB,KAAK,GAAG,0LAA0L,4DAA4D,GAAG,uDAAuD,cAAc,gBAAgB,4DAA4D,sBAAsB,qCAAqC,sBAAsB,6DAA6D,4BAA4B,wBAAwB,GAAG,oDAAoD,sHAAsH,qBAAqB,uBAAuB,GAAG,qBAAqB;AACjnG;AACA,iEAAe,uBAAuB,EAAC;;;;;;;;;;;;ACP1B;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA,4CAA4C,qBAAqB;AACjE;;AAEA;AACA,KAAK;AACL,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,qBAAqB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACjEa;;AAEb,kCAAkC;;AAElC,8BAA8B;;AAE9B,kDAAkD,gBAAgB,gEAAgE,wDAAwD,6DAA6D,sDAAsD;;AAE7S,uCAAuC,uDAAuD,uCAAuC,SAAS,OAAO,oBAAoB;;AAEzK,yCAAyC,8FAA8F,wBAAwB,eAAe,eAAe,gBAAgB,YAAY,MAAM,wBAAwB,+BAA+B,aAAa,qBAAqB,uCAAuC,cAAc,WAAW,YAAY,UAAU,MAAM,mDAAmD,UAAU,sBAAsB;;AAEve,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;;;;;ACnCA,iEAAe,svBAAsvB;;;;;;;;;;;;;;;;;;ACAtqB;AAC/F,YAA8K;;AAE9K,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,0JAAO;;;;AAIxB,iEAAe,iKAAc,MAAM;;;;;;;;;;;ACZtB;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAwC,GAAG,sBAAiB,GAAG,CAAI;;AAEnF;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,qEAAqE,qBAAqB,cAAc;;AAExG;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,yDAAyD;AACzD,IAAI;;AAEJ;;;AAGA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB,6BAA6B;AAClD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AC5QA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;;AAEM;AACV;;AAExC;AACA;AACA;AACA,sDAAsD,oCAAoC;AAC1F,IAAI,qDAAqD;AACzD;AACA,2CAA2C;AAC3C,YAAY,sEAAsE;AAClF;AACA;AACA;AACe,wBAAwB,sDAAM;AAC7C;AACA;AACA;AACA;AACA,WAAW,yDAAgB,EAAE,oDAAW;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,6CAA6C;AAC1E;AACA,iBAAiB,kDAAkD;AACnE;AACA,YAAY,6CAA6C;AACzD;;AAEA;AACA,6BAA6B,+DAA+D;AAC5F;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,sEAAsE;AAC9E;AACA;AACA;;AAEA;AACA,4CAA4C,6DAA6D;AACzG;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,6CAA6C;AACvD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,uDAAuD;AACjE;AACA;AACA,UAAU,kDAAkD;AAC5D;AACA;AACA;AACA,UAAU,6EAA6E;AACvF;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,4CAA4C;AACnD,OAAO,2BAA2B;AAClC,OAAO,6BAA6B;AACpC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,iCAAiC;AACxC,OAAO,iCAAiC;AACxC,OAAO,iCAAiC;AACxC,OAAO,6CAA6C;AACpD,OAAO,+BAA+B;AACtC,OAAO,qCAAqC;AAC5C,OAAO,iCAAiC;AACxC,OAAO,6CAA6C;AACpD,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iEAAiE;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sEAAsE;AAC1E;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;;;;;;;;;;;;;;;;;;AC1KA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;AACD;;AAE2B;;AAEvE;AACA;AACA;AACA;AACA;AACe,+BAA+B,uDAAO;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB;AACA,YAAY,SAAS;AACrB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,kCAAkC,oFAA4C;AAC9E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;;AAEA;AACA,0BAA0B,aAAa;AACvC;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA,qBAAqB,0DAAK;AAC1B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB,0DAAK;;AAE1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,WAAW;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB,WAAW,aAAa;AACxB,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AClNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;AACG;;AAEF;AACY;AACE;AAK/C;AAMK;;AAEtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,+BAA+B,sDAAM;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,2DAAU;AACrB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,4CAA4C;AAClD,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AACnC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAM,6CAA6C;AACnD,MAAM,+BAA+B;AACrC,MAAM,qCAAqC;AAC3C,MAAM,iCAAiC;AACvC,MAAM,6CAA6C;AACnD,MAAM;AACN;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,oFAA4C;;AAE9E;AACA,wCAAwC,yDAAgB;;AAExD;AACA,8CAA8C,+DAAsB;AACpE,+CAA+C,gEAAuB;;AAEtE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG,IAAI,iBAAiB;;AAExB;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA,4DAA4D,0EAA6B;AACzF,yDAAyD,0EAA6B;AACtF,yDAAyD,8EAAiC,aAAa,mBAAmB;;AAE1H,mDAAmD,8EAAiC;AACpF,2CAA2C,iFAAoC;;AAE/E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,8DAAY;;AAElC;AACA,kBAAkB,4EAAoC;AACtD,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qEAAqE,sBAAsB;AAC3F;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG,IAAI,iBAAiB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6DAAqB;AAC5C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACldA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;AAC4C;;AAEtB;;AAEd;AACzB;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,0BAA0B,sDAAM;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oFAA4C;;AAE7E;AACA;AACA,wBAAwB,gEAAc,UAAU,6DAAe;AAC/D;;AAEA;AACA;AACA;AACA,UAAU,kEAAa;AACvB;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,MAAM;;AAEN;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA,KAAK;;AAEL;AACA;;AAEA,GAAG,mEAAiB;;AAEpB;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,iEAAiE;AAC7E,cAAc;AACd;AACA;AACA;AACA;AACA,8BAA8B,2DAAU;;AAExC;AACA;AACA;AACA,eAAe,mDAAK;AACpB;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AClHA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEiD;;AAEjD;AACA;AACA;AACA;AACA;AACA,2CAA2C,6BAA6B;AACxE;AACA;AACA;AACA,4EAA4E,YAAY;AACxF;AACA,6BAA6B,qEAAqE;AAClG;AACA,iDAAiD,QAAQ;AACzD;AACA,WAAW,iCAAiC;AAC5C,WAAW,iEAAiE;AAC5E;AACA,WAAW,SAAS;AACpB;AACA,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8DAAsB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8DAAsB;;AAEjD;AACA,UAAU,6BAA6B;;AAEvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB,6BAA6B;AACtD;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA,WAAW,iCAAiC;AAC5C,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;;AAEA,UAAU,6BAA6B;;AAEvC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,MAAM;AACvD;AACA;AACA;AACA,2CAA2C,MAAM;AACjD;AACA,WAAW,8BAA8B;AACzC,WAAW,iEAAiE;AAC5E;AACA,aAAa,UAAU;AACvB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8DAAsB;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,UAAU,qBAAqB;;AAE/B,4CAA4C,aAAa;AACzD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,aAAa;;AAEtD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA,2CAA2C,6BAA6B;AACxE;AACA,aAAa,UAAU;AACvB;AACO;AACP,uBAAuB,qBAAqB;AAC5C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC3PA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;;AAK5B;;AAEjB;AACA;AACA;AACA;AACA;AACe,qCAAqC,uDAAO;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,4BAA4B;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,iEAAyB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,mEAA2B;AACpC;AACA;;;;;;;;;;;;;;;;;;AClGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;;AAM5B;;AAEjB;AACA;AACA;AACA;AACA;AACe,sCAAsC,uDAAO;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,4BAA4B;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,iEAAyB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,QAAQ,mEAA2B;AACnC;AACA;;AAEA;AACA;AACA,SAAS,iEAAyB;AAClC;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mCAAmC;AAC9C,WAAW,yCAAyC;AACpD,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B,6DAAqB;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,sBAAsB;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;AC3LA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA,2DAA2D;AAC3D,oDAAoD,oCAAoC;AACxF;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,gEAAgE;AAC7E;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,cAAc;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,sDAAsD;AAC7D,OAAO,0DAA0D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW;AACX;AACO;AACP;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,+BAA+B;AAC1C,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD,WAAW,QAAQ;AACnB,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,iCAAiC;AAC5C,aAAa;AACb;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ,gBAAgB,OAAO;AACvB;AACA;AACA,YAAY,sBAAsB;;AAElC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yCAAyC;AACpD,aAAa;AACb;AACO;AACP,oBAAoB,0DAAK;;AAEzB;AACA;;;;;;;;;;;AC5NA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACc;AACV","file":"code-block.js","sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".ck-content pre{background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;color:#353535;direction:ltr;font-style:normal;min-width:200px;padding:1em;tab-size:4;text-align:left;white-space:pre-wrap}.ck-content pre code{background:unset;border-radius:0;padding:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{background:var(--ck-color-code-block-label-background);color:#fff;font-family:var(--ck-font-face);font-size:10px;line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);right:10px;top:-1px;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-x:hidden;overflow-y:auto}\", \"\",{\"version\":3,\"sources\":[\"webpack://./theme/codeblock.css\",\"webpack://./../ckeditor5-theme-lark/theme/ckeditor5-code-block/codeblock.css\"],\"names\":[],\"mappings\":\"AAKA,gBAGC,4BAAiC,CACjC,wBAAiC,CACjC,iBAAkB,CAHlB,aAAwB,CAOxB,aAAc,CAMd,iBAAkB,CAGlB,eAAgB,CAjBhB,WAAY,CAUZ,UAAW,CAHX,eAAgB,CAIhB,oBAaD,CALC,qBACC,gBAAiB,CAEjB,eAAgB,CADhB,SAED,CAGD,4BACC,iBAMD,CAJC,iDACC,2BAA4B,CAC5B,iBACD,CCjCD,MACC,8CACD,CAEA,iDAGC,sDAAuD,CAMvD,UAAuB,CAHvB,+BAAgC,CADhC,cAAe,CAEf,gBAAiB,CACjB,uDAAwD,CANxD,UAAW,CADX,QAAS,CAST,kBACD,CAEA,+CAEC,gBAAiB,CAEjB,iBAAkB,CADlB,eAED\",\"sourcesContent\":[\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n.ck-content pre {\\n\\tpadding: 1em;\\n\\tcolor: hsl(0, 0%, 20.8%);\\n\\tbackground: hsla(0, 0%, 78%, 0.3);\\n\\tborder: 1px solid hsl(0, 0%, 77%);\\n\\tborder-radius: 2px;\\n\\n\\t/* Code block are language direction–agnostic. */\\n\\ttext-align: left;\\n\\tdirection: ltr;\\n\\n\\ttab-size: 4;\\n\\twhite-space: pre-wrap;\\n\\n\\t/* Don't inherit the style, e.g. when in a block quote. */\\n\\tfont-style: normal;\\n\\n\\t/* Don't let the code be squashed e.g. when in a table cell. */\\n\\tmin-width: 200px;\\n\\n\\t& code {\\n\\t\\tbackground: unset;\\n\\t\\tpadding: 0;\\n\\t\\tborder-radius: 0;\\n\\t}\\n}\\n\\n.ck.ck-editor__editable pre {\\n\\tposition: relative;\\n\\n\\t&[data-language]::after {\\n\\t\\tcontent: attr(data-language);\\n\\t\\tposition: absolute;\\n\\t}\\n}\\n\",\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n:root {\\n\\t--ck-color-code-block-label-background: hsl(0, 0%, 46%);\\n}\\n\\n.ck.ck-editor__editable pre[data-language]::after {\\n\\ttop: -1px;\\n\\tright: 10px;\\n\\tbackground: var(--ck-color-code-block-label-background);\\n\\n\\tfont-size: 10px;\\n\\tfont-family: var(--ck-font-face);\\n\\tline-height: 16px;\\n\\tpadding: var(--ck-spacing-tiny) var(--ck-spacing-medium);\\n\\tcolor: hsl(0, 0%, 100%);\\n\\twhite-space: nowrap;\\n}\\n\\n.ck.ck-code-block-dropdown .ck-dropdown__panel {\\n\\t/* There could be dozens of languages available. Use scroll to prevent a 10e6px dropdown. */\\n\\tmax-height: 250px;\\n\\toverflow-y: auto;\\n\\toverflow-x: hidden;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","export default \"<svg viewBox=\\\"0 0 20 20\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path d=\\\"M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z\\\"/></svg>\";","import api from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./codeblock.css\";\n\nvar options = {\"injectType\":\"singletonStyleTag\",\"attributes\":{\"data-cke\":true}};\n\noptions.insert = \"head\";\noptions.singleton = true;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblock\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\n\nimport CodeBlockEditing from './codeblockediting';\nimport CodeBlockUI from './codeblockui';\n\n/**\n * The code block plugin.\n *\n * For more information about this feature check the {@glink api/code-block package page} and the\n * {@glink features/code-blocks code block feature guide}.\n *\n * This is a \"glue\" plugin that loads the {@link module:code-block/codeblockediting~CodeBlockEditing code block editing feature}\n * and the {@link module:code-block/codeblockui~CodeBlockUI code block UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlock extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ CodeBlockEditing, CodeBlockUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlock';\n\t}\n}\n\n/**\n * The configuration of the {@link module:code-block/codeblock~CodeBlock} feature.\n *\n * Read more in {@link module:code-block/codeblock~CodeBlockConfig}.\n *\n * @member {module:code-block/codeblock~CodeBlockConfig} module:core/editor/editorconfig~EditorConfig#codeBlock\n */\n\n/**\n * The configuration of the {@link module:code-block/codeblock~CodeBlock code block feature}.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\tcodeBlock: ... // The code block feature configuration.\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface CodeBlockConfig\n */\n\n/**\n * The code block language descriptor. See {@link module:code-block/codeblock~CodeBlockConfig#languages} to learn more.\n *\n *\t\t{\n *\t\t\t language: 'javascript',\n *\t\t\t label: 'JavaScript'\n *\t\t}\n *\n * @typedef {Object} module:code-block/codeblock~CodeBlockLanguageDefinition\n * @property {String} language The name of the language that will be stored in the model attribute. Also, when `class`\n * is not specified, it will be used to create the CSS class associated with the language (prefixed by \"language-\").\n * @property {String} label The human–readable label associated with the language and displayed in the UI.\n * @property {String} [class] The CSS class associated with the language. When not specified the `language`\n * property is used to create a class prefixed by \"language-\".\n */\n\n/**\n * The list of code languages available in the user interface to choose for a particular code block.\n *\n * The language of the code block is represented as a CSS class (by default prefixed by \"language-\") set on the\n * `<code>` element, both when editing and in the editor data. The CSS class associated with the language\n * can be used by third–party code syntax highlighters to detect and apply the correct highlighting.\n *\n * For instance, this language configuration:\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcodeBlock: {\n *\t\t\t\t\tlanguages: [\n *\t\t\t\t\t\t// ...\n *\t\t\t\t\t\t{ language: 'javascript', label: 'JavaScript' },\n *\t\t\t\t\t\t// ...\n *\t\t\t\t\t]\n *\t\t\t\t}\n *\t\t} )\n *\t\t.then( ... )\n *\t\t.catch( ... );\n *\n * will result in the following structure of JavaScript code blocks in the editor editing and data:\n *\n *\t\t<pre><code class=\"language-javascript\">window.alert( 'Hello world!' )</code></pre>\n *\n * You can customize the CSS class by specifying an optional `class` property in the language definition.\n * You can set **multiple classes** but **only the first one** will be used as defining language class:\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcodeBlock: {\n *\t\t\t\t\tlanguages: [\n *\t\t\t\t\t\t// Do not render the CSS class for the plain text code blocks.\n *\t\t\t\t\t\t{ language: 'plaintext', label: 'Plain text', class: '' },\n *\n *\t\t\t\t\t\t// Use the \"php-code\" class for PHP code blocks.\n *\t\t\t\t\t\t{ language: 'php', label: 'PHP', class: 'php-code' },\n *\n *\t\t\t\t\t\t// Use the \"js\" class for JavaScript code blocks.\n *\t\t\t\t\t\t// Note that only the first (\"js\") class will determine the language of the block when loading data.\n *\t\t\t\t\t\t{ language: 'javascript', label: 'JavaScript', class: 'js javascript js-code' },\n *\n *\t\t\t\t\t\t// Python code blocks will have the default \"language-python\" CSS class.\n *\t\t\t\t\t\t{ language: 'python', label: 'Python' }\n *\t\t\t\t\t]\n *\t\t\t\t}\n *\t\t} )\n *\t\t.then( ... )\n *\t\t.catch( ... );\n *\n * The default value of the language configuration is as follows:\n *\n *\t\tlanguages: [\n *\t\t\t{ language: 'plaintext', label: 'Plain text' }, // The default language.\n *\t\t\t{ language: 'c', label: 'C' },\n *\t\t\t{ language: 'cs', label: 'C#' },\n *\t\t\t{ language: 'cpp', label: 'C++' },\n *\t\t\t{ language: 'css', label: 'CSS' },\n *\t\t\t{ language: 'diff', label: 'Diff' },\n *\t\t\t{ language: 'html', label: 'HTML' },\n *\t\t\t{ language: 'java', label: 'Java' },\n *\t\t\t{ language: 'javascript', label: 'JavaScript' },\n *\t\t\t{ language: 'php', label: 'PHP' },\n *\t\t\t{ language: 'python', label: 'Python' },\n *\t\t\t{ language: 'ruby', label: 'Ruby' },\n *\t\t\t{ language: 'typescript', label: 'TypeScript' },\n *\t\t\t{ language: 'xml', label: 'XML' }\n *\t\t]\n *\n * **Note**: The first language defined in the configuration is considered the default one. This means it will be\n * applied to code blocks loaded from the data that have no CSS `class` specified (or no matching `class` in the configuration).\n * It will also be used when creating new code blocks using the main UI button. By default it is \"Plain text\".\n *\n * @member {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} module:code-block/codeblock~CodeBlockConfig#languages\n */\n\n/**\n * A sequence of characters inserted or removed from the code block lines when its indentation\n * is changed by the user, for instance, using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.\n *\n * The default value is a single tab character (\"\t\", `\\u0009` in Unicode).\n *\n * This configuration is used by `indentCodeBlock` and `outdentCodeBlock` commands (instances of\n * {@link module:code-block/indentcodeblockcommand~IndentCodeBlockCommand}).\n *\n * **Note**: Setting this configuration to `false` will disable the code block indentation commands\n * and associated keystrokes.\n *\n * @member {String} module:code-block/codeblock~CodeBlockConfig#indentSequence\n */\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { first } from 'ckeditor5/src/utils';\n\nimport { getNormalizedAndLocalizedLanguageDefinitions } from './utils';\n\n/**\n * The code block command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class CodeBlockCommand extends Command {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * Contains the last used language.\n\n\t\t * @protected\n\t\t * @type {String|null}\n\t\t */\n\t\tthis._lastLanguage = null;\n\t}\n\n\t/**\n\t * Whether the selection starts in a code block.\n\t *\n\t * @observable\n\t * @readonly\n\t * @member {Boolean} #value\n\t */\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.value = this._getValue();\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #value is on}, all topmost code blocks within\n\t * the selection will be removed. If it is off, all selected blocks will be flattened and\n\t * wrapped by a code block.\n\t *\n\t * @fires execute\n\t * @param {Object} [options] Command options.\n\t * @param {String} [options.language] The code block language.\n\t * @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply a code block,\n\t * otherwise the command will remove the code block. If not set, the command will act basing on its current value.\n\t * @param {Boolean} [options.usePreviousLanguageChoice] If set on `true` and the `options.language` is not specified, the command\n\t * will apply the previous language (if the command was already executed) when inserting the `codeBlock` element.\n\t */\n\texecute( options = {} ) {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\t\tconst selection = model.document.selection;\n\t\tconst normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\t\tconst firstLanguageInConfig = normalizedLanguagesDefs[ 0 ];\n\n\t\tconst blocks = Array.from( selection.getSelectedBlocks() );\n\t\tconst value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;\n\t\tconst language = getLanguage( options, this._lastLanguage, firstLanguageInConfig.language );\n\n\t\tmodel.change( writer => {\n\t\t\tif ( value ) {\n\t\t\t\tthis._applyCodeBlock( writer, blocks, language );\n\t\t\t} else {\n\t\t\t\tthis._removeCodeBlock( writer, blocks );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks the command's {@link #value}.\n\t *\n\t * @private\n\t * @returns {Boolean} The current value.\n\t */\n\t_getValue() {\n\t\tconst selection = this.editor.model.document.selection;\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\t\tconst isCodeBlock = !!( firstBlock && firstBlock.is( 'element', 'codeBlock' ) );\n\n\t\treturn isCodeBlock ? firstBlock.getAttribute( 'language' ) : false;\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( this.value ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst selection = this.editor.model.document.selection;\n\t\tconst schema = this.editor.model.schema;\n\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\t\tif ( !firstBlock ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn canBeCodeBlock( schema, firstBlock );\n\t}\n\n\t/**\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t * @param {String} [language]\n\t */\n\t_applyCodeBlock( writer, blocks, language ) {\n\t\tthis._lastLanguage = language;\n\n\t\tconst schema = this.editor.model.schema;\n\t\tconst allowedBlocks = blocks.filter( block => canBeCodeBlock( schema, block ) );\n\n\t\tfor ( const block of allowedBlocks ) {\n\t\t\twriter.rename( block, 'codeBlock' );\n\t\t\twriter.setAttribute( 'language', language, block );\n\t\t\tschema.removeDisallowedAttributes( [ block ], writer );\n\n\t\t\t// Remove children of the `codeBlock` element that are not allowed. See #9567.\n\t\t\tArray.from( block.getChildren() )\n\t\t\t\t.filter( child => !schema.checkChild( block, child ) )\n\t\t\t\t.forEach( child => writer.remove( child ) );\n\t\t}\n\n\t\tallowedBlocks.reverse().forEach( ( currentBlock, i ) => {\n\t\t\tconst nextBlock = allowedBlocks[ i + 1 ];\n\n\t\t\tif ( currentBlock.previousSibling === nextBlock ) {\n\t\t\t\twriter.appendElement( 'softBreak', nextBlock );\n\t\t\t\twriter.merge( writer.createPositionBefore( currentBlock ) );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t */\n\t_removeCodeBlock( writer, blocks ) {\n\t\tconst codeBlocks = blocks.filter( block => block.is( 'element', 'codeBlock' ) );\n\n\t\tfor ( const block of codeBlocks ) {\n\t\t\tconst range = writer.createRangeOn( block );\n\n\t\t\tfor ( const item of Array.from( range.getItems() ).reverse() ) {\n\t\t\t\tif ( item.is( 'element', 'softBreak' ) && item.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\t\tconst { position } = writer.split( writer.createPositionBefore( item ) );\n\n\t\t\t\t\twriter.rename( position.nodeAfter, 'paragraph' );\n\t\t\t\t\twriter.removeAttribute( 'language', position.nodeAfter );\n\t\t\t\t\twriter.remove( item );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twriter.rename( block, 'paragraph' );\n\t\t\twriter.removeAttribute( 'language', block );\n\t\t}\n\t}\n}\n\nfunction canBeCodeBlock( schema, element ) {\n\tif ( element.is( 'rootElement' ) || schema.isLimit( element ) ) {\n\t\treturn false;\n\t}\n\n\treturn schema.checkChild( element.parent, 'codeBlock' );\n}\n\n// Picks the language for the new code block. If any language is passed as an option,\n// it will be returned. Else, if option usePreviousLanguageChoice is true and some\n// code block was already created (lastLanguage is not null) then previously used\n// language will be returned. If not, it will return default language.\n//\n// @param {Object} options\n// @param {Boolean} [options.usePreviousLanguageChoice]\n// @param {String} [options.language]\n// @param {String|null} lastLanguage\n// @param {String} defaultLanguage\n// @return {String}\nfunction getLanguage( options, lastLanguage, defaultLanguage ) {\n\tif ( options.language ) {\n\t\treturn options.language;\n\t}\n\n\tif ( options.usePreviousLanguageChoice && lastLanguage ) {\n\t\treturn lastLanguage;\n\t}\n\n\treturn defaultLanguage;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { ShiftEnter } from 'ckeditor5/src/enter';\nimport { UpcastWriter } from 'ckeditor5/src/engine';\n\nimport CodeBlockCommand from './codeblockcommand';\nimport IndentCodeBlockCommand from './indentcodeblockcommand';\nimport OutdentCodeBlockCommand from './outdentcodeblockcommand';\nimport {\n\tgetNormalizedAndLocalizedLanguageDefinitions,\n\tgetLeadingWhiteSpaces,\n\trawSnippetTextToViewDocumentFragment\n} from './utils';\nimport {\n\tmodelToViewCodeBlockInsertion,\n\tmodelToDataViewSoftBreakInsertion,\n\tdataViewToModelCodeBlockInsertion,\n\tdataViewToModelTextNewlinesInsertion\n} from './converters';\n\nconst DEFAULT_ELEMENT = 'paragraph';\n\n/**\n * The editing part of the code block feature.\n *\n * Introduces the `'codeBlock'` command and the `'codeBlock'` model element.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlockEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlockEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ShiftEnter ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\teditor.config.define( 'codeBlock', {\n\t\t\tlanguages: [\n\t\t\t\t{ language: 'plaintext', label: 'Plain text' },\n\t\t\t\t{ language: 'c', label: 'C' },\n\t\t\t\t{ language: 'cs', label: 'C#' },\n\t\t\t\t{ language: 'cpp', label: 'C++' },\n\t\t\t\t{ language: 'css', label: 'CSS' },\n\t\t\t\t{ language: 'diff', label: 'Diff' },\n\t\t\t\t{ language: 'html', label: 'HTML' },\n\t\t\t\t{ language: 'java', label: 'Java' },\n\t\t\t\t{ language: 'javascript', label: 'JavaScript' },\n\t\t\t\t{ language: 'php', label: 'PHP' },\n\t\t\t\t{ language: 'python', label: 'Python' },\n\t\t\t\t{ language: 'ruby', label: 'Ruby' },\n\t\t\t\t{ language: 'typescript', label: 'TypeScript' },\n\t\t\t\t{ language: 'xml', label: 'XML' }\n\t\t\t],\n\n\t\t\t// A single tab.\n\t\t\tindentSequence: '\\t'\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst schema = editor.model.schema;\n\t\tconst model = editor.model;\n\t\tconst view = editor.editing.view;\n\t\tconst isDocumentListEditingLoaded = editor.plugins.has( 'DocumentListEditing' );\n\n\t\tconst normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\n\t\t// The main command.\n\t\teditor.commands.add( 'codeBlock', new CodeBlockCommand( editor ) );\n\n\t\t// Commands that change the indentation.\n\t\teditor.commands.add( 'indentCodeBlock', new IndentCodeBlockCommand( editor ) );\n\t\teditor.commands.add( 'outdentCodeBlock', new OutdentCodeBlockCommand( editor ) );\n\n\t\tthis.listenTo( view.document, 'tab', ( evt, data ) => {\n\t\t\tconst commandName = data.shiftKey ? 'outdentCodeBlock' : 'indentCodeBlock';\n\t\t\tconst command = editor.commands.get( commandName );\n\n\t\t\tif ( !command.isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\teditor.execute( commandName );\n\n\t\t\tdata.stopPropagation();\n\t\t\tdata.preventDefault();\n\t\t\tevt.stop();\n\t\t}, { context: 'pre' } );\n\n\t\tschema.register( 'codeBlock', {\n\t\t\tallowWhere: '$block',\n\t\t\tallowChildren: '$text',\n\t\t\tisBlock: true,\n\t\t\tallowAttributes: [ 'language' ]\n\t\t} );\n\n\t\t// Allow all list* attributes on `codeBlock` (integration with DocumentList).\n\t\t// Disallow all attributes on $text inside `codeBlock`.\n\t\tschema.addAttributeCheck( ( context, attributeName ) => {\n\t\t\tconst isDocumentListAttributeOnCodeBlock = context.endsWith( 'codeBlock' ) &&\n\t\t\t\tattributeName.startsWith( 'list' ) &&\n\t\t\t\tattributeName !== 'list';\n\n\t\t\tif ( isDocumentListEditingLoaded && isDocumentListAttributeOnCodeBlock ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ( context.endsWith( 'codeBlock $text' ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} );\n\n\t\t// Disallow object elements inside `codeBlock`. See #9567.\n\t\teditor.model.schema.addChildCheck( ( context, childDefinition ) => {\n\t\t\tif ( context.endsWith( 'codeBlock' ) && childDefinition.isObject ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} );\n\n\t\t// Conversion.\n\t\teditor.editing.downcastDispatcher.on( 'insert:codeBlock', modelToViewCodeBlockInsertion( model, normalizedLanguagesDefs, true ) );\n\t\teditor.data.downcastDispatcher.on( 'insert:codeBlock', modelToViewCodeBlockInsertion( model, normalizedLanguagesDefs ) );\n\t\teditor.data.downcastDispatcher.on( 'insert:softBreak', modelToDataViewSoftBreakInsertion( model ), { priority: 'high' } );\n\n\t\teditor.data.upcastDispatcher.on( 'element:code', dataViewToModelCodeBlockInsertion( view, normalizedLanguagesDefs ) );\n\t\teditor.data.upcastDispatcher.on( 'text', dataViewToModelTextNewlinesInsertion() );\n\n\t\t// Intercept the clipboard input (paste) when the selection is anchored in the code block and force the clipboard\n\t\t// data to be pasted as a single plain text. Otherwise, the code lines will split the code block and\n\t\t// \"spill out\" as separate paragraphs.\n\t\tthis.listenTo( editor.editing.view.document, 'clipboardInput', ( evt, data ) => {\n\t\t\tlet insertionRange = model.createRange( model.document.selection.anchor );\n\n\t\t\t// Use target ranges in case this is a drop.\n\t\t\tif ( data.targetRanges ) {\n\t\t\t\tinsertionRange = editor.editing.mapper.toModelRange( data.targetRanges[ 0 ] );\n\t\t\t}\n\n\t\t\tif ( !insertionRange.start.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst text = data.dataTransfer.getData( 'text/plain' );\n\t\t\tconst writer = new UpcastWriter( editor.editing.view.document );\n\n\t\t\t// Pass the view fragment to the default clipboardInput handler.\n\t\t\tdata.content = rawSnippetTextToViewDocumentFragment( writer, text );\n\t\t} );\n\n\t\t// Make sure multi–line selection is always wrapped in a code block when `getSelectedContent()`\n\t\t// is used (e.g. clipboard copy). Otherwise, only the raw text will be copied to the clipboard and,\n\t\t// upon next paste, this bare text will not be inserted as a code block, which is not the best UX.\n\t\t// Similarly, when the selection in a single line, the selected content should be an inline code\n\t\t// so it can be pasted later on and retain it's preformatted nature.\n\t\tthis.listenTo( model, 'getSelectedContent', ( evt, [ selection ] ) => {\n\t\t\tconst anchor = selection.anchor;\n\n\t\t\tif ( selection.isCollapsed || !anchor.parent.is( 'element', 'codeBlock' ) || !anchor.hasSameParentAs( selection.focus ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmodel.change( writer => {\n\t\t\t\tconst docFragment = evt.return;\n\n\t\t\t\t// fo[o<softBreak></softBreak>b]ar -> <codeBlock language=\"...\">[o<softBreak></softBreak>b]<codeBlock>\n\t\t\t\tif ( docFragment.childCount > 1 || selection.containsEntireContent( anchor.parent ) ) {\n\t\t\t\t\tconst codeBlock = writer.createElement( 'codeBlock', anchor.parent.getAttributes() );\n\t\t\t\t\twriter.append( docFragment, codeBlock );\n\n\t\t\t\t\tconst newDocumentFragment = writer.createDocumentFragment();\n\t\t\t\t\twriter.append( codeBlock, newDocumentFragment );\n\n\t\t\t\t\tevt.return = newDocumentFragment;\n\t\t\t\t}\n\n\t\t\t\t// \"f[oo]\" -> <$text code=\"true\">oo</text>\n\t\t\t\telse {\n\t\t\t\t\tconst textNode = docFragment.getChild( 0 );\n\n\t\t\t\t\tif ( schema.checkAttribute( textNode, 'code' ) ) {\n\t\t\t\t\t\twriter.setAttribute( 'code', true, textNode );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tafterInit() {\n\t\tconst editor = this.editor;\n\t\tconst commands = editor.commands;\n\t\tconst indent = commands.get( 'indent' );\n\t\tconst outdent = commands.get( 'outdent' );\n\n\t\tif ( indent ) {\n\t\t\t// Priority is highest due to integration with `IndentList` command of `List` plugin.\n\t\t\t// If selection is in a code block we give priority to it. This way list item cannot be indented\n\t\t\t// but if we would give priority to indenting list item then user would have to indent list item\n\t\t\t// as much as possible and only then he could indent code block.\n\t\t\tindent.registerChildCommand( commands.get( 'indentCodeBlock' ), { priority: 'highest' } );\n\t\t}\n\n\t\tif ( outdent ) {\n\t\t\toutdent.registerChildCommand( commands.get( 'outdentCodeBlock' ) );\n\t\t}\n\n\t\t// Customize the response to the <kbd>Enter</kbd> and <kbd>Shift</kbd>+<kbd>Enter</kbd>\n\t\t// key press when the selection is in the code block. Upon enter key press we can either\n\t\t// leave the block if it's \"two or three enters\" in a row or create a new code block line, preserving\n\t\t// previous line's indentation.\n\t\tthis.listenTo( editor.editing.view.document, 'enter', ( evt, data ) => {\n\t\t\tconst positionParent = editor.model.document.selection.getLastPosition().parent;\n\n\t\t\tif ( !positionParent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( !leaveBlockStartOnEnter( editor, data.isSoft ) && !leaveBlockEndOnEnter( editor, data.isSoft ) ) {\n\t\t\t\tbreakLineOnEnter( editor );\n\t\t\t}\n\n\t\t\tdata.preventDefault();\n\t\t\tevt.stop();\n\t\t}, { context: 'pre' } );\n\t}\n}\n\n// Normally, when the Enter (or Shift+Enter) key is pressed, a soft line break is to be added to the\n// code block. Let's try to follow the indentation of the previous line when possible, for instance:\n//\n//\t\t// Before pressing enter (or shift enter)\n//\t\t<codeBlock>\n//\t\t\" foo()\"[] // Indent of 4 spaces.\n//\t\t</codeBlock>\n//\n//\t\t// After pressing:\n//\t\t<codeBlock>\n//\t\t\" foo()\" // Indent of 4 spaces.\n//\t\t<softBreak></softBreak> // A new soft break created by pressing enter.\n//\t\t\" \"[] // Retain the indent of 4 spaces.\n//\t\t</codeBlock>\n//\n// @param {module:core/editor/editor~Editor} editor\nfunction breakLineOnEnter( editor ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst node = lastSelectionPosition.nodeBefore || lastSelectionPosition.textNode;\n\tlet leadingWhiteSpaces;\n\n\t// Figure out the indentation (white space chars) at the beginning of the line.\n\tif ( node && node.is( '$text' ) ) {\n\t\tleadingWhiteSpaces = getLeadingWhiteSpaces( node );\n\t}\n\n\t// Keeping everything in a change block for a single undo step.\n\teditor.model.change( writer => {\n\t\teditor.execute( 'shiftEnter' );\n\n\t\t// If the line before being broken in two had some indentation, let's retain it\n\t\t// in the new line.\n\t\tif ( leadingWhiteSpaces ) {\n\t\t\twriter.insertText( leadingWhiteSpaces, modelDoc.selection.anchor );\n\t\t}\n\t} );\n}\n\n// Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the beginning\n// of the code block:\n//\n//\t\t// Before:\n//\t\t<codeBlock>[]<softBreak></softBreak>foo</codeBlock>\n//\n//\t\t// After pressing:\n//\t\t<paragraph>[]</paragraph><codeBlock>foo</codeBlock>\n//\n// @param {module:core/editor/editor~Editor} editor\n// @param {Boolean} isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n// @returns {Boolean} `true` when selection left the block. `false` if stayed.\nfunction leaveBlockStartOnEnter( editor, isSoftEnter ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst view = editor.editing.view;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst nodeAfter = lastSelectionPosition.nodeAfter;\n\n\tif ( isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtStart ) {\n\t\treturn false;\n\t}\n\n\tif ( !isSoftBreakNode( nodeAfter ) ) {\n\t\treturn false;\n\t}\n\n\t// We're doing everything in a single change block to have a single undo step.\n\teditor.model.change( writer => {\n\t\t// \"Clone\" the <codeBlock> in the standard way.\n\t\teditor.execute( 'enter' );\n\n\t\t// The cloned block exists now before the original code block.\n\t\tconst newBlock = modelDoc.selection.anchor.parent.previousSibling;\n\n\t\t// Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n\t\twriter.rename( newBlock, DEFAULT_ELEMENT );\n\t\twriter.setSelection( newBlock, 'in' );\n\t\teditor.model.schema.removeDisallowedAttributes( [ newBlock ], writer );\n\n\t\t// Remove the <softBreak> that originally followed the selection position.\n\t\twriter.remove( nodeAfter );\n\t} );\n\n\t// Eye candy.\n\tview.scrollToTheSelection();\n\n\treturn true;\n}\n\n// Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the end\n// of the code block:\n//\n//\t\t// Before:\n//\t\t<codeBlock>foo[]</codeBlock>\n//\n//\t\t// After first press:\n//\t\t<codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n//\n//\t\t// After second press:\n//\t\t<codeBlock>foo</codeBlock><paragraph>[]</paragraph>\n//\n// @param {module:core/editor/editor~Editor} editor\n// @param {Boolean} isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n// @returns {Boolean} `true` when selection left the block. `false` if stayed.\nfunction leaveBlockEndOnEnter( editor, isSoftEnter ) {\n\tconst model = editor.model;\n\tconst modelDoc = model.document;\n\tconst view = editor.editing.view;\n\tconst lastSelectionPosition = modelDoc.selection.getLastPosition();\n\tconst nodeBefore = lastSelectionPosition.nodeBefore;\n\n\tlet emptyLineRangeToRemoveOnEnter;\n\n\tif ( isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtEnd || !nodeBefore || !nodeBefore.previousSibling ) {\n\t\treturn false;\n\t}\n\n\t// When the position is directly preceded by two soft breaks\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>[]</codeBlock>\n\t//\n\t// it creates the following range that will be cleaned up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak>]</codeBlock>\n\t//\n\tif ( isSoftBreakNode( nodeBefore ) && isSoftBreakNode( nodeBefore.previousSibling ) ) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling ), model.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// When there's some text before the position that is\n\t// preceded by two soft breaks and made purely of white–space characters\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak> []</codeBlock>\n\t//\n\t// it creates the following range to clean up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak> ]</codeBlock>\n\t//\n\telse if (\n\t\tisEmptyishTextNode( nodeBefore ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling.previousSibling )\n\t) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling.previousSibling ), model.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// When there's some text before the position that is made purely of white–space characters\n\t// and is preceded by some other text made purely of white–space characters\n\t//\n\t//\t\t<codeBlock>foo<softBreak></softBreak> <softBreak></softBreak> []</codeBlock>\n\t//\n\t// it creates the following range to clean up before leaving:\n\t//\n\t//\t\t<codeBlock>foo[<softBreak></softBreak> <softBreak></softBreak> ]</codeBlock>\n\t//\n\telse if (\n\t\tisEmptyishTextNode( nodeBefore ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling ) &&\n\t\tisEmptyishTextNode( nodeBefore.previousSibling.previousSibling ) &&\n\t\tisSoftBreakNode( nodeBefore.previousSibling.previousSibling.previousSibling )\n\t) {\n\t\temptyLineRangeToRemoveOnEnter = model.createRange(\n\t\t\tmodel.createPositionBefore( nodeBefore.previousSibling.previousSibling.previousSibling ),\n\t\t\tmodel.createPositionAfter( nodeBefore )\n\t\t);\n\t}\n\n\t// Not leaving the block in the following cases:\n\t//\n\t//\t\t<codeBlock> []</codeBlock>\n\t//\t\t<codeBlock> a []</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>bar[]</codeBlock>\n\t//\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak> a []</codeBlock>\n\t//\n\telse {\n\t\treturn false;\n\t}\n\n\t// We're doing everything in a single change block to have a single undo step.\n\teditor.model.change( writer => {\n\t\t// Remove the last <softBreak>s and all white space characters that followed them.\n\t\twriter.remove( emptyLineRangeToRemoveOnEnter );\n\n\t\t// \"Clone\" the <codeBlock> in the standard way.\n\t\teditor.execute( 'enter' );\n\n\t\tconst newBlock = modelDoc.selection.anchor.parent;\n\n\t\t// Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n\t\twriter.rename( newBlock, DEFAULT_ELEMENT );\n\t\teditor.model.schema.removeDisallowedAttributes( [ newBlock ], writer );\n\t} );\n\n\t// Eye candy.\n\tview.scrollToTheSelection();\n\n\treturn true;\n}\n\nfunction isEmptyishTextNode( node ) {\n\treturn node && node.is( '$text' ) && !node.data.match( /\\S/ );\n}\n\nfunction isSoftBreakNode( node ) {\n\treturn node && node.is( 'element', 'softBreak' );\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/codeblockui\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Collection } from 'ckeditor5/src/utils';\nimport { Model, SplitButtonView, createDropdown, addListToDropdown } from 'ckeditor5/src/ui';\n\nimport { getNormalizedAndLocalizedLanguageDefinitions } from './utils';\n\nimport codeBlockIcon from '../theme/icons/codeblock.svg';\nimport '../theme/codeblock.css';\n\n/**\n * The code block UI plugin.\n *\n * Introduces the `'codeBlock'` dropdown.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CodeBlockUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CodeBlockUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst componentFactory = editor.ui.componentFactory;\n\t\tconst normalizedLanguageDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );\n\n\t\tcomponentFactory.add( 'codeBlock', locale => {\n\t\t\tconst command = editor.commands.get( 'codeBlock' );\n\t\t\tconst dropdownView = createDropdown( locale, SplitButtonView );\n\t\t\tconst splitButtonView = dropdownView.buttonView;\n\n\t\t\tsplitButtonView.set( {\n\t\t\t\tlabel: t( 'Insert code block' ),\n\t\t\t\ttooltip: true,\n\t\t\t\ticon: codeBlockIcon,\n\t\t\t\tisToggleable: true\n\t\t\t} );\n\n\t\t\tsplitButtonView.bind( 'isOn' ).to( command, 'value', value => !!value );\n\n\t\t\tsplitButtonView.on( 'execute', () => {\n\t\t\t\teditor.execute( 'codeBlock', {\n\t\t\t\t\tusePreviousLanguageChoice: true\n\t\t\t\t} );\n\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\tdropdownView.on( 'execute', evt => {\n\t\t\t\teditor.execute( 'codeBlock', {\n\t\t\t\t\tlanguage: evt.source._codeBlockLanguage,\n\t\t\t\t\tforceValue: true\n\t\t\t\t} );\n\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\tdropdownView.class = 'ck-code-block-dropdown';\n\t\t\tdropdownView.bind( 'isEnabled' ).to( command );\n\n\t\t\taddListToDropdown( dropdownView, this._getLanguageListItemDefinitions( normalizedLanguageDefs ) );\n\n\t\t\treturn dropdownView;\n\t\t} );\n\t}\n\n\t/**\n\t * A helper returning a collection of the `codeBlock` dropdown items representing languages\n\t * available for the user to choose from.\n\t *\n\t * @private\n\t * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} normalizedLanguageDefs\n\t * @returns {Iterable.<module:ui/dropdown/utils~ListDropdownItemDefinition>}\n\t */\n\t_getLanguageListItemDefinitions( normalizedLanguageDefs ) {\n\t\tconst editor = this.editor;\n\t\tconst command = editor.commands.get( 'codeBlock' );\n\t\tconst itemDefinitions = new Collection();\n\n\t\tfor ( const languageDef of normalizedLanguageDefs ) {\n\t\t\tconst definition = {\n\t\t\t\ttype: 'button',\n\t\t\t\tmodel: new Model( {\n\t\t\t\t\t_codeBlockLanguage: languageDef.language,\n\t\t\t\t\tlabel: languageDef.label,\n\t\t\t\t\twithText: true\n\t\t\t\t} )\n\t\t\t};\n\n\t\t\tdefinition.model.bind( 'isOn' ).to( command, 'value', value => {\n\t\t\t\treturn value === definition.model._codeBlockLanguage;\n\t\t\t} );\n\n\t\t\titemDefinitions.add( definition );\n\t\t}\n\n\t\treturn itemDefinitions;\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/converters\n */\n\nimport { getPropertyAssociation } from './utils';\n\n/**\n * A model-to-view (both editing and data) converter for the `codeBlock` element.\n *\n * Sample input:\n *\n *\t\t<codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * Sample output (editing):\n *\n *\t\t<pre data-language=\"JavaScript\"><code class=\"language-javascript\">foo();<br />bar();</code></pre>\n *\n * Sample output (data, see {@link module:code-block/converters~modelToDataViewSoftBreakInsertion}):\n *\n *\t\t<pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n *\n * @param {module:engine/model/model~Model} model\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} languageDefs The normalized language\n * configuration passed to the feature.\n * @param {Boolean} [useLabels=false] When `true`, the `<pre>` element will get a `data-language` attribute with a\n * human–readable label of the language. Used only in the editing.\n * @returns {Function} Returns a conversion callback.\n */\nexport function modelToViewCodeBlockInsertion( model, languageDefs, useLabels = false ) {\n\t// Language CSS classes:\n\t//\n\t//\t\t{\n\t//\t\t\tphp: 'language-php',\n\t//\t\t\tpython: 'language-python',\n\t//\t\t\tjavascript: 'js',\n\t//\t\t\t...\n\t//\t\t}\n\tconst languagesToClasses = getPropertyAssociation( languageDefs, 'language', 'class' );\n\n\t// Language labels:\n\t//\n\t//\t\t{\n\t//\t\t\tphp: 'PHP',\n\t//\t\t\tpython: 'Python',\n\t//\t\t\tjavascript: 'JavaScript',\n\t//\t\t\t...\n\t//\t\t}\n\tconst languagesToLabels = getPropertyAssociation( languageDefs, 'language', 'label' );\n\n\treturn ( evt, data, conversionApi ) => {\n\t\tconst { writer, mapper, consumable } = conversionApi;\n\n\t\tif ( !consumable.consume( data.item, 'insert' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst codeBlockLanguage = data.item.getAttribute( 'language' );\n\t\tconst targetViewPosition = mapper.toViewPosition( model.createPositionBefore( data.item ) );\n\t\tconst preAttributes = {};\n\n\t\t// Attributes added only in the editing view.\n\t\tif ( useLabels ) {\n\t\t\tpreAttributes[ 'data-language' ] = languagesToLabels[ codeBlockLanguage ];\n\t\t\tpreAttributes.spellcheck = 'false';\n\t\t}\n\n\t\tconst code = writer.createContainerElement( 'code', {\n\t\t\tclass: languagesToClasses[ codeBlockLanguage ] || null\n\t\t} );\n\n\t\tconst pre = writer.createContainerElement( 'pre', preAttributes, code );\n\n\t\twriter.insert( targetViewPosition, pre );\n\t\tmapper.bindElements( data.item, code );\n\t};\n}\n\n/**\n * A model-to-data view converter for the new line (`softBreak`) separator.\n *\n * Sample input:\n *\n *\t\t<codeBlock ...>foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * Sample output:\n *\n *\t\t<pre><code ...>foo();\\nbar();</code></pre>\n *\n * @param {module:engine/model/model~Model} model\n * @returns {Function} Returns a conversion callback.\n */\nexport function modelToDataViewSoftBreakInsertion( model ) {\n\treturn ( evt, data, conversionApi ) => {\n\t\tif ( data.item.parent.name !== 'codeBlock' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { writer, mapper, consumable } = conversionApi;\n\n\t\tif ( !consumable.consume( data.item, 'insert' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst position = mapper.toViewPosition( model.createPositionBefore( data.item ) );\n\n\t\twriter.insert( position, writer.createText( '\\n' ) );\n\t};\n}\n\n/**\n * A view-to-model converter for `<pre>` with the `<code>` HTML.\n *\n * Sample input:\n *\n *\t\t<pre><code class=\"language-javascript\">foo();bar();</code></pre>\n *\n * Sample output:\n *\n *\t\t<codeBlock language=\"javascript\">foo();bar();</codeBlock>\n *\n * @param {module:engine/view/view~View} editingView\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>} languageDefs The normalized language\n * configuration passed to the feature.\n * @returns {Function} Returns a conversion callback.\n */\nexport function dataViewToModelCodeBlockInsertion( editingView, languageDefs ) {\n\t// Language names associated with CSS classes:\n\t//\n\t//\t\t{\n\t//\t\t\t'language-php': 'php',\n\t//\t\t\t'language-python': 'python',\n\t//\t\t\tjs: 'javascript',\n\t//\t\t\t...\n\t//\t\t}\n\tconst classesToLanguages = getPropertyAssociation( languageDefs, 'class', 'language' );\n\tconst defaultLanguageName = languageDefs[ 0 ].language;\n\n\treturn ( evt, data, conversionApi ) => {\n\t\tconst viewCodeElement = data.viewItem;\n\t\tconst viewPreElement = viewCodeElement.parent;\n\n\t\tif ( !viewPreElement || !viewPreElement.is( 'element', 'pre' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In case of nested code blocks we don't want to convert to another code block.\n\t\tif ( data.modelCursor.findAncestor( 'codeBlock' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { consumable, writer } = conversionApi;\n\n\t\tif ( !consumable.test( viewCodeElement, { name: true } ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst codeBlock = writer.createElement( 'codeBlock' );\n\t\tconst viewChildClasses = [ ...viewCodeElement.getClassNames() ];\n\n\t\t// As we're to associate each class with a model language, a lack of class (empty class) can be\n\t\t// also associated with a language if the language definition was configured so. Pushing an empty\n\t\t// string to make sure the association will work.\n\t\tif ( !viewChildClasses.length ) {\n\t\t\tviewChildClasses.push( '' );\n\t\t}\n\n\t\t// Figure out if any of the <code> element's class names is a valid programming\n\t\t// language class. If so, use it on the model element (becomes the language of the entire block).\n\t\tfor ( const className of viewChildClasses ) {\n\t\t\tconst language = classesToLanguages[ className ];\n\n\t\t\tif ( language ) {\n\t\t\t\twriter.setAttribute( 'language', language, codeBlock );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// If no language value was set, use the default language from the config.\n\t\tif ( !codeBlock.hasAttribute( 'language' ) ) {\n\t\t\twriter.setAttribute( 'language', defaultLanguageName, codeBlock );\n\t\t}\n\n\t\tconversionApi.convertChildren( viewCodeElement, codeBlock );\n\n\t\t// Let's try to insert code block.\n\t\tif ( !conversionApi.safeInsert( codeBlock, data.modelCursor ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsumable.consume( viewCodeElement, { name: true } );\n\n\t\tconversionApi.updateConversionResult( codeBlock, data );\n\t};\n}\n\n/**\n * A view-to-model converter for new line characters in `<pre>`.\n *\n * Sample input:\n *\n *\t\t<pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n *\n * Sample output:\n *\n *\t\t<codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n *\n * @returns {Function} Returns a conversion callback.\n */\nexport function dataViewToModelTextNewlinesInsertion() {\n\treturn ( evt, data, { consumable, writer } ) => {\n\t\tlet position = data.modelCursor;\n\n\t\t// When node is already converted then do nothing.\n\t\tif ( !consumable.test( data.viewItem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// When not inside `codeBlock` then do nothing.\n\t\tif ( !position.findAncestor( 'codeBlock' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsumable.consume( data.viewItem );\n\n\t\tconst text = data.viewItem.data;\n\t\tconst textLines = text.split( '\\n' ).map( data => writer.createText( data ) );\n\t\tconst lastLine = textLines[ textLines.length - 1 ];\n\n\t\tfor ( const node of textLines ) {\n\t\t\twriter.insert( node, position );\n\t\t\tposition = position.getShiftedBy( node.offsetSize );\n\n\t\t\tif ( node !== lastLine ) {\n\t\t\t\tconst softBreak = writer.createElement( 'softBreak' );\n\n\t\t\t\twriter.insert( softBreak, position );\n\t\t\t\tposition = writer.createPositionAfter( softBreak );\n\t\t\t}\n\t\t}\n\n\t\tdata.modelRange = writer.createRange(\n\t\t\tdata.modelCursor,\n\t\t\tposition\n\t\t);\n\t\tdata.modelCursor = position;\n\t};\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/indentcodeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\n\nimport {\n\tgetIndentOutdentPositions,\n\tisModelSelectionInCodeBlock\n} from './utils';\n\n/**\n * The code block indentation increase command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class IndentCodeBlockCommand extends Command {\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * A sequence of characters added to the line when the command is executed.\n\t\t *\n\t\t * @readonly\n\t\t * @private\n\t\t * @member {String}\n\t\t */\n\t\tthis._indentSequence = editor.config.get( 'codeBlock.indentSequence' );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n\t * code lines in the selection will be increased.\n\t *\n\t * @fires execute\n\t */\n\texecute() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\tconst positions = getIndentOutdentPositions( model );\n\n\t\t\t// Indent all positions, for instance assuming the indent sequence is 4x space (\" \"):\n\t\t\t//\n\t\t\t//\t\t<codeBlock>^foo</codeBlock> -> <codeBlock> foo</codeBlock>\n\t\t\t//\n\t\t\t//\t\t<codeBlock>foo^bar</codeBlock> -> <codeBlock>foo bar</codeBlock>\n\t\t\t//\n\t\t\t// Also, when there is more than one position:\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t^foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t^bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\t//\t\t->\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\tfor ( const position of positions ) {\n\t\t\t\twriter.insertText( this._indentSequence, position );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( !this._indentSequence ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Indent (forward) command is always enabled when there's any code block in the selection\n\t\t// because you can always indent code lines.\n\t\treturn isModelSelectionInCodeBlock( this.editor.model.document.selection );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/outdentcodeblockcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\n\nimport {\n\tgetLeadingWhiteSpaces,\n\tgetIndentOutdentPositions,\n\tisModelSelectionInCodeBlock\n} from './utils';\n\n/**\n * The code block indentation decrease command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class OutdentCodeBlockCommand extends Command {\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * A sequence of characters removed from the line when the command is executed.\n\t\t *\n\t\t * @readonly\n\t\t * @private\n\t\t * @member {String}\n\t\t */\n\t\tthis._indentSequence = editor.config.get( 'codeBlock.indentSequence' );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n\t * code lines in the selection will be decreased.\n\t *\n\t * @fires execute\n\t */\n\texecute() {\n\t\tconst editor = this.editor;\n\t\tconst model = editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\tconst positions = getIndentOutdentPositions( model );\n\n\t\t\t// Outdent all positions, for instance assuming the indent sequence is 4x space (\" \"):\n\t\t\t//\n\t\t\t//\t\t<codeBlock>^foo</codeBlock> -> <codeBlock>foo</codeBlock>\n\t\t\t//\n\t\t\t//\t\t<codeBlock> ^bar</codeBlock> -> <codeBlock>bar</codeBlock>\n\t\t\t//\n\t\t\t// Also, when there is more than one position:\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\t ^foobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\t ^bazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\t//\n\t\t\t//\t\t->\n\t\t\t//\n\t\t\t//\t\t<codeBlock>\n\t\t\t//\t\t\tfoobar\n\t\t\t//\t\t\t<softBreak></softBreak>\n\t\t\t//\t\t\tbazqux\n\t\t\t//\t\t</codeBlock>\n\t\t\tfor ( const position of positions ) {\n\t\t\t\tconst range = getLastOutdentableSequenceRange( this.editor.model, position, this._indentSequence );\n\n\t\t\t\tif ( range ) {\n\t\t\t\t\twriter.remove( range );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( !this._indentSequence ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst model = this.editor.model;\n\n\t\tif ( !isModelSelectionInCodeBlock( model.document.selection ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Outdent command can execute only when there is an indent character sequence\n\t\t// in some of the lines.\n\t\treturn getIndentOutdentPositions( model ).some( position => {\n\t\t\treturn getLastOutdentableSequenceRange( model, position, this._indentSequence );\n\t\t} );\n\t}\n}\n\n// For a position coming from `getIndentOutdentPositions()`, it returns the range representing\n// the last occurrence of the indent sequence among the leading whitespaces of the code line the\n// position represents.\n//\n// For instance, assuming the indent sequence is 4x space (\" \"):\n//\n//\t\t<codeBlock>foo^</codeBlock> -> null\n//\t\t<codeBlock>foo^<softBreak></softBreak>bar</codeBlock> -> null\n//\t\t<codeBlock> ^foo</codeBlock> -> null\n//\t\t<codeBlock> ^foo</codeBlock> -> <codeBlock> [ ]foo</codeBlock>\n//\t\t<codeBlock> ^foo bar</codeBlock> -> <codeBlock>[ ]foo bar</codeBlock>\n//\n// @param {<module:engine/model/model~Model>} model\n// @param {<module:engine/model/position~Position>} position\n// @param {String} sequence\n// @returns {<module:engine/model/range~Range>|null}\nfunction getLastOutdentableSequenceRange( model, position, sequence ) {\n\t// Positions start before each text node (code line). Get the node corresponding to the position.\n\tconst nodeAtPosition = getCodeLineTextNodeAtPosition( position );\n\n\tif ( !nodeAtPosition ) {\n\t\treturn null;\n\t}\n\n\tconst leadingWhiteSpaces = getLeadingWhiteSpaces( nodeAtPosition );\n\tconst lastIndexOfSequence = leadingWhiteSpaces.lastIndexOf( sequence );\n\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> \t^foo</codeBlock> -> null\n\t//\n\tif ( lastIndexOfSequence + sequence.length !== leadingWhiteSpaces.length ) {\n\t\treturn null;\n\t}\n\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> ^foo</codeBlock> -> null\n\t//\n\tif ( lastIndexOfSequence === -1 ) {\n\t\treturn null;\n\t}\n\n\tconst { parent, startOffset } = nodeAtPosition;\n\n\t// Create a range that contains the **last** indent sequence among the leading whitespaces\n\t// of the line.\n\t//\n\t// For instance, assuming the indent sequence is 4x space (\" \"):\n\t//\n\t//\t\t<codeBlock> ^foo</codeBlock> -> <codeBlock> [ ]foo</codeBlock>\n\t//\n\treturn model.createRange(\n\t\tmodel.createPositionAt( parent, startOffset + lastIndexOfSequence ),\n\t\tmodel.createPositionAt( parent, startOffset + lastIndexOfSequence + sequence.length )\n\t);\n}\n\nfunction getCodeLineTextNodeAtPosition( position ) {\n\t// Positions start before each text node (code line). Get the node corresponding to the position.\n\tlet nodeAtPosition = position.parent.getChild( position.index );\n\n\t// <codeBlock>foo^</codeBlock>\n\t// <codeBlock>foo^<softBreak></softBreak>bar</codeBlock>\n\tif ( !nodeAtPosition || nodeAtPosition.is( 'element', 'softBreak' ) ) {\n\t\tnodeAtPosition = position.nodeBefore;\n\t}\n\n\t// <codeBlock>^</codeBlock>\n\t// <codeBlock>foo^<softBreak></softBreak>bar</codeBlock>\n\tif ( !nodeAtPosition || nodeAtPosition.is( 'element', 'softBreak' ) ) {\n\t\treturn null;\n\t}\n\n\treturn nodeAtPosition;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block/utils\n */\n\nimport { first } from 'ckeditor5/src/utils';\n\n/**\n * Returns code block languages as defined in `config.codeBlock.languages` but processed:\n *\n * * To consider the editor localization, i.e. to display {@link module:code-block/codeblock~CodeBlockLanguageDefinition}\n * in the correct language. There is no way to use {@link module:utils/locale~Locale#t} when the user\n * configuration is defined because the editor does not exist yet.\n * * To make sure each definition has a CSS class associated with it even if not specified\n * in the original configuration.\n *\n * @param {module:core/editor/editor~Editor} editor\n * @returns {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>}.\n */\nexport function getNormalizedAndLocalizedLanguageDefinitions( editor ) {\n\tconst t = editor.t;\n\tconst languageDefs = editor.config.get( 'codeBlock.languages' );\n\n\tfor ( const def of languageDefs ) {\n\t\tif ( def.label === 'Plain text' ) {\n\t\t\tdef.label = t( 'Plain text' );\n\t\t}\n\n\t\tif ( def.class === undefined ) {\n\t\t\tdef.class = `language-${ def.language }`;\n\t\t}\n\t}\n\n\treturn languageDefs;\n}\n\n/**\n * Returns an object associating certain language definition properties with others. For instance:\n *\n * For:\n *\n *\t\tconst definitions = {\n *\t\t\t{ language: 'php', class: 'language-php', label: 'PHP' },\n *\t\t\t{ language: 'javascript', class: 'js', label: 'JavaScript' },\n *\t\t};\n *\n *\t\tgetPropertyAssociation( definitions, 'class', 'language' );\n *\n * returns:\n *\n *\t\t{\n *\t\t\t'language-php': 'php'\n *\t\t\t'js': 'javascript'\n *\t\t}\n *\n * and\n *\n *\t\tgetPropertyAssociation( definitions, 'language', 'label' );\n *\n * returns:\n *\n *\t\t{\n *\t\t\t'php': 'PHP'\n *\t\t\t'javascript': 'JavaScript'\n *\t\t}\n *\n * @param {Array.<module:code-block/codeblock~CodeBlockLanguageDefinition>}\n * @param {String} key\n * @param {String} value\n * @param {Object.<String,String>}\n */\nexport function getPropertyAssociation( languageDefs, key, value ) {\n\tconst association = {};\n\n\tfor ( const def of languageDefs ) {\n\t\tif ( key === 'class' ) {\n\t\t\t// Only the first class is considered.\n\t\t\tassociation[ def[ key ].split( ' ' ).shift() ] = def[ value ];\n\t\t} else {\n\t\t\tassociation[ def[ key ] ] = def[ value ];\n\t\t}\n\t}\n\n\treturn association;\n}\n\n/**\n * For a given model text node, it returns white spaces that precede other characters in that node.\n * This corresponds to the indentation part of the code block line.\n *\n * @param {module:engine/model/text~Text} codeLineNodes\n * @returns {String}\n */\nexport function getLeadingWhiteSpaces( textNode ) {\n\treturn textNode.data.match( /^(\\s*)/ )[ 0 ];\n}\n\n/**\n * For plain text containing the code (a snippet), it returns a document fragment containing\n * view text nodes separated by `<br>` elements (in place of new line characters \"\\n\"), for instance:\n *\n * Input:\n *\n *\t\t\"foo()\\n\n *\t\tbar()\"\n *\n * Output:\n *\n *\t\t<DocumentFragment>\n *\t\t\t\"foo()\"\n *\t\t\t<br/>\n *\t\t\t\"bar()\"\n *\t\t</DocumentFragment>\n *\n * @param {module:engine/view/upcastwriter~UpcastWriter} writer\n * @param {String} text The raw code text to be converted.\n * @returns {module:engine/view/documentfragment~DocumentFragment}\n */\nexport function rawSnippetTextToViewDocumentFragment( writer, text ) {\n\tconst fragment = writer.createDocumentFragment();\n\tconst textLines = text.split( '\\n' );\n\n\tconst nodes = textLines.reduce( ( nodes, line, lineIndex ) => {\n\t\tnodes.push( line );\n\n\t\tif ( lineIndex < textLines.length - 1 ) {\n\t\t\tnodes.push( writer.createElement( 'br' ) );\n\t\t}\n\n\t\treturn nodes;\n\t}, [] );\n\n\twriter.appendChild( nodes, fragment );\n\n\treturn fragment;\n}\n\n/**\n * Returns an array of all model positions within the selection that represent code block lines.\n *\n * If the selection is collapsed, it returns the exact selection anchor position:\n *\n *\t\t<codeBlock>[]foo</codeBlock> -> <codeBlock>^foo</codeBlock>\n *\t\t<codeBlock>foo[]bar</codeBlock> -> <codeBlock>foo^bar</codeBlock>\n *\n * Otherwise, it returns positions **before** each text node belonging to all code blocks contained by the selection:\n *\n *\t\t<codeBlock> <codeBlock>\n *\t\t foo[bar ^foobar\n *\t\t <softBreak></softBreak> -> <softBreak></softBreak>\n *\t\t baz]qux ^bazqux\n *\t\t</codeBlock> </codeBlock>\n *\n * It also works across other non–code blocks:\n *\n *\t\t<codeBlock> <codeBlock>\n *\t\t foo[bar ^foobar\n *\t\t</codeBlock> </codeBlock>\n *\t\t<paragraph>text</paragraph> -> <paragraph>text</paragraph>\n *\t\t<codeBlock> <codeBlock>\n *\t\t baz]qux ^bazqux\n *\t\t</codeBlock> </codeBlock>\n *\n * **Note:** The positions are in reverse order so they do not get outdated when iterating over them and\n * the writer inserts or removes elements at the same time.\n *\n * **Note:** The position is located after the leading white spaces in the text node.\n *\n * @param {module:engine/model/model~Model} model\n * @returns {Array.<module:engine/model/position~Position>}\n */\nexport function getIndentOutdentPositions( model ) {\n\tconst selection = model.document.selection;\n\tconst positions = [];\n\n\t// When the selection is collapsed, there's only one position we can indent or outdent.\n\tif ( selection.isCollapsed ) {\n\t\tpositions.push( selection.anchor );\n\t}\n\n\t// When the selection is NOT collapsed, collect all positions starting before text nodes\n\t// (code lines) in any <codeBlock> within the selection.\n\telse {\n\t\t// Walk backward so positions we are about to collect here do not get outdated when\n\t\t// inserting or deleting using the writer.\n\t\tconst walker = selection.getFirstRange().getWalker( {\n\t\t\tignoreElementEnd: true,\n\t\t\tdirection: 'backward'\n\t\t} );\n\n\t\tfor ( const { item } of walker ) {\n\t\t\tif ( item.is( '$textProxy' ) && item.parent.is( 'element', 'codeBlock' ) ) {\n\t\t\t\tconst leadingWhiteSpaces = getLeadingWhiteSpaces( item.textNode );\n\t\t\t\tconst { parent, startOffset } = item.textNode;\n\n\t\t\t\t// Make sure the position is after all leading whitespaces in the text node.\n\t\t\t\tconst position = model.createPositionAt( parent, startOffset + leadingWhiteSpaces.length );\n\n\t\t\t\tpositions.push( position );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn positions;\n}\n\n/**\n * Checks if any of the blocks within the model selection is a code block.\n *\n * @param {module:engine/model/selection~Selection} selection\n * @returns {Boolean}\n */\nexport function isModelSelectionInCodeBlock( selection ) {\n\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\treturn firstBlock && firstBlock.is( 'element', 'codeBlock' );\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/engine.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/enter.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/ui.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module code-block\n */\n\nexport { default as CodeBlock } from './codeblock';\nexport { default as CodeBlockEditing } from './codeblockediting';\nexport { default as CodeBlockUI } from './codeblockui';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.jv=n.jv||{};i.dictionary=Object.assign(i.dictionary||{},{"Insert code block":"","Plain text":"Seratan biasa"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Javanese (https://www.transifex.com/ckeditor/teams/11143/jv/)\n"
|
|
16
|
+
"Language: jv\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A label of the button that allows inserting a new code block into the editor content."
|
|
20
|
+
msgid "Insert code block"
|
|
21
|
+
msgstr ""
|
|
22
|
+
|
|
23
|
+
msgctxt "A language of the code block in the editor content when no specific programming language is associated with it."
|
|
24
|
+
msgid "Plain text"
|
|
25
|
+
msgstr "Seratan biasa"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-code-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "34.0.0",
|
|
4
4
|
"description": "Code block feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,26 +12,27 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "^
|
|
15
|
+
"ckeditor5": "^34.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@ckeditor/ckeditor5-alignment": "^
|
|
19
|
-
"@ckeditor/ckeditor5-autoformat": "^
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
|
21
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
22
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
|
23
|
-
"@ckeditor/ckeditor5-core": "^
|
|
24
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
|
25
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
26
|
-
"@ckeditor/ckeditor5-enter": "^
|
|
27
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
28
|
-
"@ckeditor/ckeditor5-image": "^
|
|
29
|
-
"@ckeditor/ckeditor5-indent": "^
|
|
30
|
-
"@ckeditor/ckeditor5-
|
|
31
|
-
"@ckeditor/ckeditor5-
|
|
32
|
-
"@ckeditor/ckeditor5-
|
|
33
|
-
"@ckeditor/ckeditor5-
|
|
34
|
-
"@ckeditor/ckeditor5-
|
|
18
|
+
"@ckeditor/ckeditor5-alignment": "^34.0.0",
|
|
19
|
+
"@ckeditor/ckeditor5-autoformat": "^34.0.0",
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^34.0.0",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^34.0.0",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^34.0.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^34.0.0",
|
|
24
|
+
"@ckeditor/ckeditor5-dev-utils": "^30.0.0",
|
|
25
|
+
"@ckeditor/ckeditor5-engine": "^34.0.0",
|
|
26
|
+
"@ckeditor/ckeditor5-enter": "^34.0.0",
|
|
27
|
+
"@ckeditor/ckeditor5-editor-classic": "^34.0.0",
|
|
28
|
+
"@ckeditor/ckeditor5-image": "^34.0.0",
|
|
29
|
+
"@ckeditor/ckeditor5-indent": "^34.0.0",
|
|
30
|
+
"@ckeditor/ckeditor5-list": "^34.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-markdown-gfm": "^34.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-paragraph": "^34.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-theme-lark": "^34.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-undo": "^34.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-utils": "^34.0.0",
|
|
35
36
|
"webpack": "^5.58.1",
|
|
36
37
|
"webpack-cli": "^4.9.0"
|
|
37
38
|
},
|
package/src/codeblockediting.js
CHANGED
|
@@ -87,6 +87,7 @@ export default class CodeBlockEditing extends Plugin {
|
|
|
87
87
|
const schema = editor.model.schema;
|
|
88
88
|
const model = editor.model;
|
|
89
89
|
const view = editor.editing.view;
|
|
90
|
+
const isDocumentListEditingLoaded = editor.plugins.has( 'DocumentListEditing' );
|
|
90
91
|
|
|
91
92
|
const normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );
|
|
92
93
|
|
|
@@ -97,19 +98,20 @@ export default class CodeBlockEditing extends Plugin {
|
|
|
97
98
|
editor.commands.add( 'indentCodeBlock', new IndentCodeBlockCommand( editor ) );
|
|
98
99
|
editor.commands.add( 'outdentCodeBlock', new OutdentCodeBlockCommand( editor ) );
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
this.listenTo( view.document, 'tab', ( evt, data ) => {
|
|
102
|
+
const commandName = data.shiftKey ? 'outdentCodeBlock' : 'indentCodeBlock';
|
|
103
|
+
const command = editor.commands.get( commandName );
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
};
|
|
105
|
+
if ( !command.isEnabled ) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
110
108
|
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
editor.execute( commandName );
|
|
110
|
+
|
|
111
|
+
data.stopPropagation();
|
|
112
|
+
data.preventDefault();
|
|
113
|
+
evt.stop();
|
|
114
|
+
}, { context: 'pre' } );
|
|
113
115
|
|
|
114
116
|
schema.register( 'codeBlock', {
|
|
115
117
|
allowWhere: '$block',
|
|
@@ -118,8 +120,17 @@ export default class CodeBlockEditing extends Plugin {
|
|
|
118
120
|
allowAttributes: [ 'language' ]
|
|
119
121
|
} );
|
|
120
122
|
|
|
123
|
+
// Allow all list* attributes on `codeBlock` (integration with DocumentList).
|
|
121
124
|
// Disallow all attributes on $text inside `codeBlock`.
|
|
122
|
-
schema.addAttributeCheck( context => {
|
|
125
|
+
schema.addAttributeCheck( ( context, attributeName ) => {
|
|
126
|
+
const isDocumentListAttributeOnCodeBlock = context.endsWith( 'codeBlock' ) &&
|
|
127
|
+
attributeName.startsWith( 'list' ) &&
|
|
128
|
+
attributeName !== 'list';
|
|
129
|
+
|
|
130
|
+
if ( isDocumentListEditingLoaded && isDocumentListAttributeOnCodeBlock ) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
if ( context.endsWith( 'codeBlock $text' ) ) {
|
|
124
135
|
return false;
|
|
125
136
|
}
|
|
@@ -210,7 +221,11 @@ export default class CodeBlockEditing extends Plugin {
|
|
|
210
221
|
const outdent = commands.get( 'outdent' );
|
|
211
222
|
|
|
212
223
|
if ( indent ) {
|
|
213
|
-
|
|
224
|
+
// Priority is highest due to integration with `IndentList` command of `List` plugin.
|
|
225
|
+
// If selection is in a code block we give priority to it. This way list item cannot be indented
|
|
226
|
+
// but if we would give priority to indenting list item then user would have to indent list item
|
|
227
|
+
// as much as possible and only then he could indent code block.
|
|
228
|
+
indent.registerChildCommand( commands.get( 'indentCodeBlock' ), { priority: 'highest' } );
|
|
214
229
|
}
|
|
215
230
|
|
|
216
231
|
if ( outdent ) {
|