diff --git a/build/jodit.css b/build/jodit.css index 1290b2bea..e8f09ec73 100644 --- a/build/jodit.css +++ b/build/jodit.css @@ -1,14 +1,14 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ diff --git a/build/jodit.es2018.css b/build/jodit.es2018.css index c8ae940b5..cfe07577c 100644 --- a/build/jodit.es2018.css +++ b/build/jodit.es2018.css @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ diff --git a/build/jodit.es2018.en.css b/build/jodit.es2018.en.css index c8ae940b5..cfe07577c 100644 --- a/build/jodit.es2018.en.css +++ b/build/jodit.es2018.en.css @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ diff --git a/build/jodit.es2018.en.js b/build/jodit.es2018.en.js index 3f05787c7..6a5e6663d 100644 --- a/build/jodit.es2018.en.js +++ b/build/jodit.es2018.en.js @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ @@ -5384,7 +5384,7 @@ function hook(status) { throw (0,error/* error */.v)('Handler must be a Function'); } target.hookStatus(status, (component) => { - target[propertyKey].call(component); + component[propertyKey].call(component); }); }; } @@ -5446,7 +5446,8 @@ function persistent(target, propertyKey) { function wait(condition) { return (target, propertyKey) => { - if (!(0,helpers.isFunction)(target[propertyKey])) { + const fn = target[propertyKey]; + if (!(0,helpers.isFunction)(fn)) { throw (0,helpers.error)('Handler must be a Function'); } target.hookStatus(core_component/* STATUSES.ready */.n$.ready, (component) => { @@ -5455,15 +5456,18 @@ function wait(condition) { : component.j.async; const realMethod = component[propertyKey]; let timeout = 0; - component[propertyKey] = function callProxy(...args) { - async.clearTimeout(timeout); - if (condition(component)) { - realMethod.apply(component, args); - } - else { - timeout = async.setTimeout(() => callProxy(...args), 10); + Object.defineProperty(component, propertyKey, { + configurable: true, + value: function callProxy(...args) { + async.clearTimeout(timeout); + if (condition(component)) { + realMethod.apply(component, args); + } + else { + timeout = async.setTimeout(() => callProxy(...args), 10); + } } - }; + }); }); }; } @@ -11754,7 +11758,7 @@ class View extends component/* Component */.wA { this.isView = true; this.mods = {}; this.components = new Set(); - this.version = "3.16.2"; + this.version = "3.16.3"; this.async = new Async(); this.buffer = Storage.makeStorage(); this.storage = Storage.makeStorage(true, this.componentName); @@ -11852,10 +11856,10 @@ class View extends component/* Component */.wA { return this.__isFullSize; } getVersion() { - return "3.16.2"; + return "3.16.3"; } static getVersion() { - return "3.16.2"; + return "3.16.3"; } initOptions(options) { this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions)); diff --git a/build/jodit.es2018.en.min.js b/build/jodit.es2018.en.min.js index cfb0bc64d..491127163 100644 --- a/build/jodit.es2018.en.min.js +++ b/build/jodit.es2018.en.min.js @@ -1 +1 @@ -((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}})(self,(function(){return function(){var t=[,function(t,e,s){"use strict";s.d(e,{D:()=>o});var i=s(2);class o{constructor(){this.defaultTimeout=100,this.namespace="",this.safeMode=!1,this.safePluginsList=["about","enter","backspace"],this.license="",this.preset="custom",this.presets={inline:{inline:!0,toolbar:!1,toolbarInline:!0,toolbarInlineForSelection:!0,showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,showPlaceholder:!1}},this.ownerDocument="undefined"!=typeof document?document:null,this.ownerWindow="undefined"!=typeof window?window:null,this.shadowRoot=null,this.styleValues={},this.zIndex=0,this.readonly=!1,this.disabled=!1,this.activeButtonsInReadOnly=["source","fullsize","print","about","dots","selectall"],this.toolbarButtonSize="middle",this.allowTabNavigation=!1,this.inline=!1,this.theme="default",this.saveModeInStorage=!1,this.editorCssClass=!1,this.style=!1,this.triggerChangeEvent=!0,this.direction="",this.language="auto",this.debugLanguage=!1,this.i18n=!1,this.tabIndex=-1,this.toolbar=!0,this.statusbar=!0,this.showTooltip=!0,this.showTooltipDelay=1e3,this.useNativeTooltip=!1,this.enter=i.PARAGRAPH,this.enterBlock="br"!==this.enter?this.enter:i.PARAGRAPH,this.defaultMode=i.MODE_WYSIWYG,this.useSplitMode=!1,this.colors={greyscale:["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF"],palette:["#980000","#FF0000","#FF9900","#FFFF00","#00F0F0","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF"],full:["#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#733554","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"]},this.colorPickerDefaultTab="background",this.imageDefaultWidth=300,this.removeButtons=[],this.disablePlugins=[],this.extraPlugins=[],this.extraButtons=[],this.extraIcons={},this.createAttributes={},this.sizeLG=900,this.sizeMD=700,this.sizeSM=400,this.buttons=[{group:"font-style",buttons:[]},{group:"list",buttons:[]},{group:"font",buttons:[]},"---",{group:"script",buttons:[]},{group:"media",buttons:[]},"\n",{group:"state",buttons:[]},{group:"clipboard",buttons:[]},{group:"insert",buttons:[]},{group:"indent",buttons:[]},{group:"color",buttons:[]},{group:"form",buttons:[]},"---",{group:"history",buttons:[]},{group:"search",buttons:[]},{group:"source",buttons:[]},{group:"other",buttons:[]},{group:"info",buttons:[]}],this.buttonsMD=["bold","italic","|","ul","ol","eraser","|","font","fontsize","---","image","table","|","link","\n","brush","paragraph","align","|","hr","copyformat","fullsize","---","undo","redo","|","dots"],this.buttonsSM=["bold","italic","|","ul","ol","eraser","|","fontsize","brush","paragraph","---","image","table","\n","link","|","align","|","undo","redo","|","copyformat","fullsize","---","dots"],this.buttonsXS=["bold","brush","paragraph","eraser","|","fontsize","---","image","\n","align","undo","redo","|","link","table","---","dots"],this.events={},this.textIcons=!1,this.showBrowserColorPicker=!0}static get defaultOptions(){return o.__defaultOptions||(o.__defaultOptions=new o),o.__defaultOptions}}o.prototype.controls={}},(t,e,s)=>{"use strict";s.r(e),s.d(e,{ACCURACY:()=>T,BASE_PATH:()=>U,BR:()=>_,COMMAND_KEYS:()=>I,EMULATE_DBLCLICK_TIMEOUT:()=>B,INSEPARABLE_TAGS:()=>p,INSERT_AS_HTML:()=>O,INSERT_AS_TEXT:()=>F,INSERT_CLEAR_HTML:()=>H,INSERT_ONLY_TEXT:()=>W,INVISIBLE_SPACE:()=>i,INVISIBLE_SPACE_REG_EXP:()=>n,INVISIBLE_SPACE_REG_EXP_END:()=>r,INVISIBLE_SPACE_REG_EXP_START:()=>a,IS_BLOCK:()=>d,IS_IE:()=>N,IS_INLINE:()=>u,IS_MAC:()=>V,KEY_ALIASES:()=>Y,KEY_BACKSPACE:()=>m,KEY_DELETE:()=>j,KEY_DOWN:()=>x,KEY_ENTER:()=>v,KEY_ESC:()=>b,KEY_F3:()=>S,KEY_LEFT:()=>w,KEY_RIGHT:()=>C,KEY_SPACE:()=>E,KEY_TAB:()=>g,KEY_UP:()=>y,MARKER_CLASS:()=>A,MAY_BE_REMOVED_WITH_KEY:()=>f,MODE_SOURCE:()=>z,MODE_SPLIT:()=>M,MODE_WYSIWYG:()=>L,NBSP_SPACE:()=>o,NEARBY:()=>k,PARAGRAPH:()=>q,SAFE_COUNT_CHANGE_CALL:()=>$,SPACE_REG_EXP:()=>l,SPACE_REG_EXP_END:()=>h,SPACE_REG_EXP_START:()=>c,TEMP_ATTR:()=>G,TEXT_HTML:()=>D,TEXT_PLAIN:()=>P,TEXT_RTF:()=>R});const i="\ufeff",o=" ",n=()=>/[\uFEFF]/g,r=()=>/[\uFEFF]+$/g,a=()=>/^[\uFEFF]+/g,l=()=>/[\s\n\t\r\uFEFF\u200b]+/g,c=()=>/^[\s\n\t\r\uFEFF\u200b]+/g,h=()=>/[\s\n\t\r\uFEFF\u200b]+$/g,d=/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CANVAS|DD|DFN|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[1-6]|HEADER|HGROUP|HR|LI|MAIN|NAV|NOSCRIPT|OUTPUT|P|PRE|RUBY|SCRIPT|STYLE|OBJECT|OL|SECTION|IFRAME|JODIT|JODIT-MEDIA|UL|TR|TD|TH|TBODY|THEAD|TFOOT|TABLE|BODY|HTML|VIDEO)$/i,u=/^(STRONG|SPAN|I|EM|B|SUP|SUB|A|U)$/i,p=["img","br","video","iframe","script","input","textarea","hr","link","jodit","jodit-media"],f=RegExp(`^${p.join("|")}$`,"i"),m="Backspace",g="Tab",v="Enter",b="Escape",w="ArrowLeft",y="ArrowUp",C="ArrowRight",x="ArrowDown",E="Space",j="Delete",S="F3",k=5,T=10,I=[m,j,y,x,C,w,v,b,S,g],_="br",q="p",L=1,z=2,M=3,N="undefined"!=typeof navigator&&(-1!==navigator.userAgent.indexOf("MSIE")||/rv:11.0/i.test(navigator.userAgent)),P=N?"text":"text/plain",D=N?"html":"text/html",R=N?"rtf":"text/rtf",A="jodit-selection_marker",B=300,O="insert_as_html",H="insert_clear_html",F="insert_as_text",W="insert_only_text",$=10,V="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Y={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:V?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},U=(()=>{if("undefined"==typeof document)return"";const t=document.currentScript,e=t=>{const e=t.split("/");return/\.js/.test(e[e.length-1])?e.slice(0,e.length-1).join("/")+"/":t};if(t)return e(t.src);const s=document.querySelectorAll("script[src]");return s&&s.length?e(s[s.length-1].src):window.location.href})(),G="data-jodit-temp"},function(t,e,s){"use strict";s.d(e,{vp:()=>c,DG:()=>o,aN:()=>h.a,rO:()=>i,LO:()=>m});const i="JoditEventDefaultNamespace";class o{constructor(){this.__store={}}get(t,e){if(void 0!==this.__store[e])return this.__store[e][t]}indexOf(t,e,s){const i=this.get(t,e);if(i)for(let t=0;i.length>t;t+=1)if(i[t].originalCallback===s)return t;return!1}namespaces(t=!1){const e=Object.keys(this.__store);return t?e.filter((t=>t!==i)):e}events(t){return this.__store[t]?Object.keys(this.__store[t]):[]}set(t,e,s,i=!1){void 0===this.__store[e]&&(this.__store[e]={}),void 0===this.__store[e][t]&&(this.__store[e][t]=[]),i?this.__store[e][t].unshift(s):this.__store[e][t].push(s)}clear(){this.__store={}}}var n=s(5),r=s(6),a=s(7),l=s(4);class c{constructor(t){this.mutedEvents=new Set,this.__key="__JoditEventEmitterNamespaces",this.doc=document,this.prepareEvent=t=>{t.cancelBubble||(t.type.match(/^touch/)&&t.changedTouches&&t.changedTouches.length&&["clientX","clientY","pageX","pageY"].forEach((e=>{Object.defineProperty(t,e,{value:t.changedTouches[0][e],configurable:!0,enumerable:!0})})),t.originalEvent||(t.originalEvent=t),"paste"===t.type&&void 0===t.clipboardData&&this.doc.defaultView.clipboardData&&Object.defineProperty(t,"clipboardData",{get:()=>this.doc.defaultView.clipboardData,configurable:!0,enumerable:!0}))},this.currents=[],this.__stopped=[],this.isDestructed=!1,t&&(this.doc=t),this.__key+=(new Date).getTime()}mute(t){return this.mutedEvents.add(null!=t?t:"*"),this}isMuted(t){return!(!t||!this.mutedEvents.has(t))||this.mutedEvents.has("*")}unmute(t){return this.mutedEvents.delete(null!=t?t:"*"),this}eachEvent(t,e){t.split(/[\s,]+/).forEach((t=>{const s=t.split(".");e.call(this,s[0],s[1]||i)}))}getStore(t){if(!t)throw(0,l.v)("Need subject");if(void 0===t[this.__key]){const e=new o;Object.defineProperty(t,this.__key,{enumerable:!1,configurable:!0,value:e})}return t[this.__key]}clearStore(t){void 0!==t[this.__key]&&delete t[this.__key]}triggerNativeEvent(t,e){const s=this.doc.createEvent("HTMLEvents");"string"==typeof e?s.initEvent(e,!0,!0):(s.initEvent(e.type,e.bubbles,e.cancelable),["screenX","screenY","clientX","clientY","target","srcElement","currentTarget","timeStamp","which","keyCode"].forEach((t=>{Object.defineProperty(s,t,{value:e[t],enumerable:!0})})),Object.defineProperty(s,"originalEvent",{value:e,enumerable:!0})),t.dispatchEvent(s)}get current(){return this.currents[this.currents.length-1]}on(t,e,s,i=!1){const o=(0,n.H)(t)?this:t,c=(0,n.H)(e)?e:t;let h=s;void 0===h&&(0,r.m)(e)&&(h=e);const d=this.getStore(o);if(!(0,n.H)(c)||""===c)throw(0,l.v)("Need events names");if(!(0,r.m)(h))throw(0,l.v)("Need event handler");if((0,a.k)(o))return o.forEach((t=>{this.on(t,c,h,i)})),this;const u=(0,r.m)(o.addEventListener),p=this;let f=function(t,...e){if(!p.isMuted(t))return h&&h.call(this,...e)};return u&&(f=function(t){if(!p.isMuted(t.type))return p.prepareEvent(t),h&&!1===h.call(this,t)?(t.preventDefault(),t.stopImmediatePropagation(),!1):void 0}),this.eachEvent(c,((t,e)=>{if(""===t)throw(0,l.v)("Need event name");if(!1===d.indexOf(t,e,h)&&(d.set(t,e,{event:t,originalCallback:h,syntheticCallback:f},i),u)){const e=!!["touchstart","touchend","scroll","mousewheel","mousemove","touchmove"].includes(t)&&{passive:!0};o.addEventListener(t,f,e)}})),this}one(t,e,s,i=!1){const o=(0,n.H)(t)?this:t,a=(0,n.H)(e)?e:t;let l=s;void 0===l&&(0,r.m)(e)&&(l=e);const c=(...t)=>(this.off(o,a,c),l(...t));return this.on(o,a,c,i),this}off(t,e,s){const o=(0,n.H)(t)?this:t,a=(0,n.H)(e)?e:t,l=this.getStore(o);let c=s;if(!(0,n.H)(a)||!a)return l.namespaces().forEach((t=>{this.off(o,"."+t)})),this.clearStore(o),this;void 0===c&&(0,r.m)(e)&&(c=e);const h=(0,r.m)(o.removeEventListener),d=t=>{h&&o.removeEventListener(t.event,t.syntheticCallback,!1)},u=(t,e)=>{if(""!==t){const s=l.get(t,e);if(s&&s.length)if((0,r.m)(c)){const i=l.indexOf(t,e,c);!1!==i&&(d(s[i]),s.splice(i,1))}else s.forEach(d),s.length=0}else l.events(e).forEach((t=>{""!==t&&u(t,e)}))};return this.eachEvent(a,((t,e)=>{e===i?l.namespaces().forEach((e=>{u(t,e)})):u(t,e)})),this}stopPropagation(t,e){const s=(0,n.H)(t)?this:t,o=(0,n.H)(t)?t:e;if("string"!=typeof o)throw(0,l.v)("Need event names");const r=this.getStore(s);this.eachEvent(o,((t,e)=>{const o=r.get(t,e);o&&this.__stopped.push(o),e===i&&r.namespaces(!0).forEach((e=>this.stopPropagation(s,t+"."+e)))}))}removeStop(t){if(t){const e=this.__stopped.indexOf(t);-1!==e&&this.__stopped.splice(0,e+1)}}isStopped(t){return void 0!==t&&-1!==this.__stopped.indexOf(t)}fire(t,e,...s){let o,a;const c=(0,n.H)(t)?this:t,h=(0,n.H)(t)?t:e,d=(0,n.H)(t)?[e,...s]:s,u=(0,r.m)(c.dispatchEvent);if(!u&&!(0,n.H)(h))throw(0,l.v)("Need events names");const p=this.getStore(c);return!(0,n.H)(h)&&u?this.triggerNativeEvent(c,e):this.eachEvent(h,((t,e)=>{if(u)this.triggerNativeEvent(c,t);else{const s=p.get(t,e);if(s)try{[...s].every((e=>!this.isStopped(s)&&(this.currents.push(t),a=e.syntheticCallback.call(c,t,...d),this.currents.pop(),void 0!==a&&(o=a),!0)))}finally{this.removeStop(s)}e!==i||u||p.namespaces().filter((t=>t!==e)).forEach((e=>{const s=this.fire.call(this,c,t+"."+e,...d);void 0!==s&&(o=s)}))}})),o}destruct(){this.isDestructed&&(this.isDestructed=!0,this.off(this),this.getStore(this).clear(),delete this[this.__key])}}var h=s(8),d=s(9),u=s(19);const p=Symbol("observable-object");function f(t){return void 0!==t[p]}function m(t){if(f(t))return t;const e={},s={},i=(e,o)=>(0,d.isArray)(e)?(e.map((t=>i(t,o))),t):(s[e]||(s[e]=[]),s[e].push(o),t),o=(i,...n)=>{if((0,d.isArray)(i))i.map((t=>o(t,...n)));else try{!e[i]&&s[i]&&(e[i]=!0,s[i].forEach((e=>e.call(t,...n))))}finally{e[i]=!1}},n=(e,s=[])=>{const r={};f(e)||(Object.defineProperty(e,p,{enumerable:!1,value:!0}),Object.keys(e).forEach((i=>{const a=i,l=s.concat(a).filter((t=>t.length));r[a]=e[a];const c=(0,u.getPropertyDescriptor)(e,a);Object.defineProperty(e,a,{set(e){const s=r[a];if(!(0,d.isFastEqual)(r[a],e)){o(["beforeChange","beforeChange."+l.join(".")],a,e),(0,d.isPlainObject)(e)&&n(e,l),c&&c.set?c.set.call(t,e):r[a]=e;const i=[];o(["change",...l.reduce(((t,e)=>(i.push(e),t.push("change."+i.join(".")),t)),[])],l.join("."),s,(null==e?void 0:e.valueOf)?e.valueOf():e)}},get:()=>c&&c.get?c.get.call(t):r[a],enumerable:!0,configurable:!0}),(0,d.isPlainObject)(r[a])&&n(r[a],l)})),Object.defineProperty(t,"on",{value:i}))};return n(t),t}},(t,e,s)=>{"use strict";function i(t){return new TypeError(t)}s.d(e,{v:()=>i})},(t,e,s)=>{"use strict";function i(t){return"string"==typeof t}s.d(e,{H:()=>i})},(t,e,s)=>{"use strict";function i(t){return"function"==typeof t}s.d(e,{m:()=>i})},(t,e,s)=>{"use strict";function i(t){return Array.isArray(t)}s.d(e,{k:()=>i})},function(t,e,s){"use strict";s.d(e,{a:()=>i});class i{constructor(){this.map=new Map}on(t,e){var s;return this.map.has(t)||this.map.set(t,new Set),null===(s=this.map.get(t))||void 0===s||s.add(e),this}off(t,e){var s;return this.map.has(t)&&(null===(s=this.map.get(t))||void 0===s||s.delete(e)),this}emit(t,...e){var s;let i;return this.map.has(t)&&(null===(s=this.map.get(t))||void 0===s||s.forEach((t=>{i=t(...e)}))),i}}},(t,e,s)=>{"use strict";s.r(e),s.d(e,{$$:()=>i.$$,CamelCaseToKebabCase:()=>c.gP,ConfigFlatten:()=>i.tp,ConfigProto:()=>i.II,LimitedStack:()=>i.lI,appendScript:()=>i.uR,appendScriptAsync:()=>i.JL,appendStyleAsync:()=>i.Nf,applyStyles:()=>d,asArray:()=>o._2,assert:()=>i.hu,attr:()=>i.Lj,browser:()=>i.Xh,buildQuery:()=>i.XP,call:()=>i.RE,callPromise:()=>i.C6,camelCase:()=>c.eV,cleanFromWord:()=>f,clearCenterAlign:()=>i.bI,clearTimeout:()=>n.g,cns:()=>i.H5,colorToHex:()=>a.h,completeUrl:()=>i.WO,convertMediaUrlToVideoEmbed:()=>i.UU,css:()=>i.iv,cssPath:()=>i.iN,ctrlKey:()=>i.kT,dataBind:()=>i.qI,defaultLanguage:()=>i.X9,error:()=>i.vU,fastClone:()=>i.V8,fuzzySearchIndex:()=>c.Qy,get:()=>i.U2,getClassName:()=>i.gj,getContentWidth:()=>C,getScrollParent:()=>x,getXPathByElement:()=>i.BR,hasBrowserColorPicker:()=>r.EO,hasContainer:()=>r.Zt,htmlspecialchars:()=>m,humanSizeToBytes:()=>i.wx,i18n:()=>c.ag,inView:()=>i.jF,innerWidth:()=>E,isArray:()=>r.kJ,isAtom:()=>i.J8,isBoolean:()=>r.jn,isDestructable:()=>r.Z$,isEqual:()=>r.Xy,isFastEqual:()=>r.LP,isFunction:()=>r.mf,isHTML:()=>r.FP,isHtmlFromWord:()=>r.I4,isInitable:()=>r.Gu,isInt:()=>r.GN,isJoditObject:()=>r.Zu,isLicense:()=>r.A1,isNativeFunction:()=>r.QC,isNumber:()=>r.hj,isNumeric:()=>r.kE,isPlainObject:()=>r.PO,isPromise:()=>r.tI,isString:()=>r.HD,isURL:()=>r.PX,isValidName:()=>r.r1,isViewObject:()=>r.f2,isVoid:()=>r.nj,isWindow:()=>r.FJ,kebabCase:()=>c.GL,keepNames:()=>i.kc,keys:()=>i.am,loadImage:()=>i.po,loadNext:()=>i.wY,loadNextStyle:()=>i.GX,markAsAtomic:()=>i.XT,markDeprecated:()=>i.Q8,markOwner:()=>i.MN,memorizeExec:()=>i.u3,nl2br:()=>w,normalizeColor:()=>y.ut,normalizeCssValue:()=>y.Zh,normalizeKeyAliases:()=>y.T2,normalizeLicense:()=>y.Pd,normalizeNode:()=>y.Tz,normalizePath:()=>y.AH,normalizeRelativePath:()=>y.Jf,normalizeSize:()=>y.aC,normalizeUrl:()=>y.D5,offset:()=>j,parseQuery:()=>i.mB,position:()=>S,refs:()=>i.xL,reset:()=>i.mc,resolveElement:()=>i.W2,safeHTML:()=>b,scrollIntoViewIfNeeded:()=>i.n5,set:()=>i.t8,setTimeout:()=>n.i,size:()=>k,splitArray:()=>o.C1,sprintf:()=>c.gB,stringify:()=>c.Pz,stripTags:()=>v,toArray:()=>o.qo,trim:()=>c.fy,trimInv:()=>c.as,ucfirst:()=>c.Ps,val:()=>i.P0});var i=s(10),o=s(43),n=s(56),r=s(20),a=s(40),l=s(16),c=s(34);function h(t){return t.replace(/mso-[a-z-]+:[\s]*[^;]+;/gi,"").replace(/mso-[a-z-]+:[\s]*[^";']+$/gi,"").replace(/border[a-z-]*:[\s]*[^;]+;/gi,"").replace(/([0-9.]+)(pt|cm)/gi,((t,e,s)=>{switch(s.toLowerCase()){case"pt":return(1.328*parseFloat(e)).toFixed(0)+"px";case"cm":return(.02645833*parseFloat(e)).toFixed(0)+"px"}return t}))}function d(t){if(-1===t.indexOf("")+7);const e=document.createElement("iframe");e.style.display="none",document.body.appendChild(e);let s="",o=[];try{const n=e.contentDocument||(e.contentWindow?e.contentWindow.document:null);if(n){n.open(),n.write(t),n.close();try{for(let t=0;n.styleSheets.length>t;t+=1){const e=n.styleSheets[t].cssRules;for(let t=0;e.length>t;t+=1)""!==e[t].selectorText&&(o=(0,i.$$)(e[t].selectorText,n.body),o.forEach((s=>{s.style.cssText=h(e[t].style.cssText+";"+s.style.cssText)})))}}catch(t){}l.i.each(n.body,(t=>{if(l.i.isElement(t)){const e=t,s=e.getAttribute("style");s&&(e.style.cssText=h(s)),e.hasAttribute("style")&&!e.getAttribute("style")&&e.removeAttribute("style")}})),s=n.firstChild?(0,c.fy)(n.body.innerHTML):""}}catch(t){}finally{l.i.safeRemove(e)}return s&&(t=s),(0,c.fy)(t.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g,"").replace(//i);-1!==e&&(t=t.substring(e+20));const s=t.search(//i);return-1!==s&&(t=t.substring(0,s)),t})(s)),e.s.insertHTML(s)}function we(t,e,s,i,o){if(!1===t.e.fire("beforeOpenPasteDialog",e,s,i,o))return;const n=U(`
${t.i18n(e)}
`,t.i18n(s));n.bindDestruct(t),(0,ge.MN)(t,n.container);const r=o.map((({text:e,value:s})=>(0,N.zx)(t,{text:e,name:e.toLowerCase(),tabIndex:0}).onAction((()=>i(s))))),a=(0,N.zx)(t,{text:"Cancel",tabIndex:0});return n.setFooter([...r,a].map((t=>t.onAction((()=>n.close()))))),r[0].focus(),r[0].state.variant="primary",t.e.fire("afterOpenPasteDialog",n,e,s,i,o),n}const ye="clipboard";class Ce{constructor(){this.buttons=[{name:"cut",group:"clipboard"},{name:"copy",group:"clipboard"},{name:"paste",group:"clipboard"},{name:"selectall",group:"clipboard"}]}init(t){var e;null===(e=this.buttons)||void 0===e||e.forEach((e=>t.registerButton(e))),t.e.off("copy.clipboard cut.clipboard").on("copy.clipboard cut.clipboard",(e=>{var s;const i=t.s.html,o=ve(e)||ve(t.ew)||ve(e.originalEvent);o&&(o.setData(a.TEXT_PLAIN,(0,g.stripTags)(i)),o.setData(a.TEXT_HTML,i)),t.buffer.set(ye,i),t.e.fire("pasteStack",{html:i,action:t.o.defaultActionOnPaste}),"cut"===e.type&&(t.s.remove(),t.s.focus()),e.preventDefault(),null===(s=null==t?void 0:t.events)||void 0===s||s.fire("afterCopy",i)}))}destruct(t){var e,s;null===(e=null==t?void 0:t.buffer)||void 0===e||e.set(ye,""),null===(s=null==t?void 0:t.events)||void 0===s||s.off(".clipboard")}}r.D.prototype.askBeforePasteHTML=!0,r.D.prototype.processPasteHTML=!0,r.D.prototype.pasteHTMLActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Insert as Text"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}],r.D.prototype.memorizeChoiceWhenPasteFragment=!1,r.D.prototype.nl2brInPlainText=!0,r.D.prototype.defaultActionOnPaste=a.INSERT_AS_HTML,r.D.prototype.draggableTags=["img","jodit-media","jodit"];const xe="pasteStorage";r.D.prototype.controls.paste={tooltip:"Paste from clipboard",async exec(t,e,{control:s}){if(s.name===xe)return void t.execCommand("showPasteStorage");t.s.focus();let i="",o=!0;if(navigator.clipboard){try{const t=await navigator.clipboard.read();if(t&&t.length){const e=await t[0].getType(a.TEXT_PLAIN);i=await new Response(e).text()}o=!1}catch(t){}if(o)try{i=await navigator.clipboard.readText(),o=!1}catch(t){}}o&&(i=t.buffer.get(ye)||"",o=0===i.length);const n=t.value;o?(t.ed.execCommand("paste"),o=n===t.value,!o&&t.e.fire("afterPaste")):i.length?(be(null,t,i),t.e.fire("afterPaste")):o&&V(t.i18n("Your browser doesn't support direct access to the clipboard."),(()=>{t.s.focus()})).bindDestruct(t)},list:{[xe]:"Paste Storage"},isChildDisabled(t){return 2>t.e.fire("pasteStorageList")}};class Ee extends X{constructor(){super(...arguments),this.pasteStack=new g.LimitedStack(20)}afterInit(t){t.e.on("paste.paste",this.onPaste).on("pasteStack.paste",(t=>this.pasteStack.push(t))),t.o.nl2brInPlainText&&this.j.e.on("processPaste.paste",this.onProcessPasteReplaceNl2Br)}onPaste(t){try{if(!1===this.customPasteProcess(t)||!1===this.j.e.fire("beforePaste",t))return t.preventDefault(),!1;this.defaultPasteProcess(t)}finally{this.j.e.fire("afterPaste",t)}}customPasteProcess(t){if(!this.j.o.processPasteHTML)return;const e=ve(t),s={html:null==e?void 0:e.getData(a.TEXT_HTML),plain:null==e?void 0:e.getData(a.TEXT_PLAIN),rtf:null==e?void 0:e.getData(a.TEXT_RTF)};let i;for(i in s){const e=s[i];if((0,g.isHTML)(e)&&(this.j.e.fire("processHTML",t,e,s)||this.processHTML(t,e)))return!1}}defaultPasteProcess(t){const e=ve(t);let s=(null==e?void 0:e.getData(a.TEXT_HTML))||(null==e?void 0:e.getData(a.TEXT_PLAIN));if(e&&s&&""!==(0,g.trim)(s)){const i=this.j.e.fire("processPaste",t,s,(t=>{const e=t.types;let s="";if((0,x.kJ)(e)||"[object DOMStringList]"==={}.toString.call(e))for(let t=0;e.length>t;t+=1)s+=e[t]+";";else s=(e||a.TEXT_PLAIN)+";";return s})(e));void 0!==i&&(s=i),((0,g.isString)(s)||M.i.isNode(s))&&this.insertByType(t,s,this.j.o.defaultActionOnPaste),t.preventDefault(),t.stopPropagation()}}processHTML(t,e){if(this.j.o.askBeforePasteHTML){if(this.j.o.memorizeChoiceWhenPasteFragment){const s=this.pasteStack.find((t=>t.html===e));if(s)return this.insertByType(t,e,s.action||this.j.o.defaultActionOnPaste),!0}return we(this.j,"Your code is similar to HTML. Keep as HTML?","Paste as HTML",(s=>{this.insertByType(t,e,s)}),this.j.o.pasteHTMLActionList),!0}return!1}insertByType(t,e,s){if(this.pasteStack.push({html:e,action:s}),(0,g.isString)(e))switch(this.j.buffer.set(ye,e),s){case a.INSERT_CLEAR_HTML:e=(0,g.cleanFromWord)(e);break;case a.INSERT_ONLY_TEXT:e=(0,g.stripTags)(e);break;case a.INSERT_AS_TEXT:e=(0,g.htmlspecialchars)(e)}be(t,this.j,e)}onProcessPasteReplaceNl2Br(t,e,s){if(s===a.TEXT_PLAIN+";"&&!(0,g.isHTML)(e))return(0,g.nl2br)(e)}beforeDestruct(t){t.e.off("paste.paste",this.onPaste)}}(0,n.gn)([q.autobind],Ee.prototype,"onPaste",null),(0,n.gn)([q.autobind],Ee.prototype,"onProcessPasteReplaceNl2Br",null),r.D.prototype.askBeforePasteFromWord=!0,r.D.prototype.processPasteFromWord=!0,r.D.prototype.defaultActionOnPasteFromWord=null,r.D.prototype.pasteFromWordActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Clean"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}];class je extends X{afterInit(t){}beforeDestruct(t){}processWordHTML(t,e,s){const{j:i}=this,{processPasteFromWord:o,askBeforePasteFromWord:n,defaultActionOnPasteFromWord:r,defaultActionOnPaste:a,pasteFromWordActionList:l}=i.o;return!(!o||!(0,g.isHtmlFromWord)(e)||(n?we(i,"The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","Word Paste Detected",(i=>{this.insertFromWordByType(t,e,i,s)}),l):this.insertFromWordByType(t,e,r||a,s),0))}insertFromWordByType(t,e,s,i){var o;switch(s){case a.INSERT_AS_HTML:if(e=(0,g.applyStyles)(e),this.j.o.beautifyHTML){const t=null===(o=this.j.events)||void 0===o?void 0:o.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}break;case a.INSERT_AS_TEXT:e=(0,g.cleanFromWord)(e);break;case a.INSERT_ONLY_TEXT:e=(0,g.stripTags)((0,g.cleanFromWord)(e))}be(t,this.j,e)}}(0,n.gn)([(0,q.watch)(":processHTML")],je.prototype,"processWordHTML",null);class Se extends X{constructor(){super(...arguments),this.currentIndex=0,this.list=[],this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.paste=()=>{if(this.j.s.focus(),this.j.s.insertHTML(this.list[this.currentIndex]),0!==this.currentIndex){const t=this.list[0];this.list[0]=this.list[this.currentIndex],this.list[this.currentIndex]=t}this.dialog&&this.dialog.close(),this.j.synchronizeValues(),this.j.e.fire("afterPaste")},this.onKeyDown=t=>{let e=this.currentIndex;-1!==[a.KEY_UP,a.KEY_DOWN,a.KEY_ENTER].indexOf(t.key)&&(t.key===a.KEY_UP&&(0===e?e=this.list.length-1:e-=1),t.key===a.KEY_DOWN&&(e===this.list.length-1?e=0:e+=1),t.key!==a.KEY_ENTER?(e!==this.currentIndex&&this.selectIndex(e),t.stopImmediatePropagation(),t.preventDefault()):this.paste())},this.selectIndex=t=>{this.listBox&&(0,g.toArray)(this.listBox.childNodes).forEach(((e,s)=>{e.classList.remove("jodit_active"),t===s&&this.previewBox&&(e.classList.add("jodit_active"),this.previewBox.innerHTML=this.list[t],e.focus())})),this.currentIndex=t},this.showDialog=()=>{2>this.list.length||(this.dialog||this.createDialog(),this.listBox&&(this.listBox.innerHTML=""),this.previewBox&&(this.previewBox.innerHTML=""),this.list.forEach(((t,e)=>{const s=this.j.c.element("a");s.textContent=e+1+". "+t.replace((0,a.SPACE_REG_EXP)(),""),this.j.e.on(s,"keydown",this.onKeyDown),(0,g.attr)(s,"href","#"),(0,g.attr)(s,"data-index",""+e),(0,g.attr)(s,"tab-index","-1"),this.listBox&&this.listBox.appendChild(s)})),this.dialog&&this.dialog.open(),this.j.async.setTimeout((()=>{this.selectIndex(0)}),100))}}createDialog(){this.dialog=new $({language:this.j.o.language});const t=(0,N.zx)(this.j,"paste","Paste","primary");t.onAction(this.paste);const e=(0,N.zx)(this.j,"","Cancel");e.onAction(this.dialog.close),this.container=this.j.c.div(),this.container.classList.add("jodit-paste-storage"),this.listBox=this.j.c.div(),this.previewBox=this.j.c.div(),this.container.appendChild(this.listBox),this.container.appendChild(this.previewBox),this.dialog.setHeader(this.j.i18n("Choose Content to Paste")),this.dialog.setContent(this.container),this.dialog.setFooter([t,e]),this.j.e.on(this.listBox,"click dblclick",(t=>{const e=t.target;return M.i.isTag(e,"a")&&e.hasAttribute("data-index")&&this.selectIndex(parseInt((0,g.attr)(e,"-index")||"0",10)),"dblclick"===t.type&&this.paste(),!1}))}afterInit(){this.j.e.off("afterCopy.paste-storage").on("pasteStorageList.paste-storage",(()=>this.list.length)).on("afterCopy.paste-storage",(t=>{-1!==this.list.indexOf(t)&&this.list.splice(this.list.indexOf(t),1),this.list.unshift(t),this.list.length>5&&(this.list.length=5)})),this.j.registerCommand("showPasteStorage",{exec:this.showDialog,hotkeys:["ctrl+shift+v","cmd+shift+v"]})}beforeDestruct(){this.dialog&&this.dialog.destruct(),this.j.e.off(".paste-storage"),M.i.safeRemove(this.previewBox),M.i.safeRemove(this.listBox),M.i.safeRemove(this.container),this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.list=[]}}const ke="copyformat",Te=["fontWeight","fontStyle","fontSize","color","margin","padding","borderWidth","borderStyle","borderColor","borderRadius","backgroundColor","textDecorationLine","fontFamily"],Ie=(t,e,s,i)=>{let o=(0,g.css)(s,e);return o===i[e]&&(o=s.parentNode&&s!==t.editor&&s.parentNode!==t.editor?Ie(t,e,s.parentNode,i):void 0),o};function _e(t){t.registerButton({name:"copyformat",group:"clipboard"})}r.D.prototype.controls.copyformat={exec(t,e,{button:s}){if(e){if(t.buffer.exists(ke))t.buffer.delete(ke),t.e.off(t.editor,"mouseup.copyformat");else{const s={},i=M.i.up(e,(t=>t&&!M.i.isText(t)),t.editor)||t.editor,o=t.createInside.span();t.editor.appendChild(o),Te.forEach((t=>{s[t]=(0,g.css)(o,t)})),o!==t.editor&&M.i.safeRemove(o);const n=((t,e,s)=>{const i={};return e&&Te.forEach((o=>{i[o]=Ie(t,o,e,s),o.match(/border(Style|Color)/)&&!i.borderWidth&&(i[o]=void 0)})),i})(t,i,s),r=()=>{t.buffer.delete(ke);const e=t.s.current();e&&(M.i.isTag(e,"img")?(0,g.css)(e,n):t.s.applyStyle(n)),t.e.off(t.editor,"mouseup.copyformat")};t.e.on(t.editor,"mouseup.copyformat",r),t.buffer.set(ke,!0)}s.update()}},isActive:t=>t.buffer.exists(ke),tooltip:"Paint format"};var qe,Le=s(59);function ze(t){t.registerButton({name:"brush",group:"color"});const e=(e,s,i)=>{const o=(0,g.normalizeColor)(i);switch(e){case"background":t.s.applyStyle({backgroundColor:o||""});break;case"forecolor":t.s.applyStyle({color:o||""})}return t.synchronizeValues(),!1};t.registerCommand("forecolor",e).registerCommand("background",e)}r.D.prototype.controls.brush={update(t){const e=(0,g.dataBind)(t,"color"),s=t.j,i=(e,i)=>{i&&i!==""+(0,g.css)(s.editor,e)&&(t.state.icon.fill=i)};if(e){const s=(0,g.dataBind)(t,"color");return void i("color"===s?s:"background-color",e)}const o=s.s.current();if(o&&!t.state.disabled){const t=M.i.closest(o,M.i.isElement,s.editor)||s.editor;i("color",""+(0,g.css)(t,"color")),i("background-color",""+(0,g.css)(t,"background-color"))}t.state.icon.fill="",t.state.activated=!1},popup(t,e,s,i,o){let n="",r="",a=[],l=null;return e&&e!==t.editor&&M.i.isNode(e)&&(M.i.isElement(e)&&t.s.isCollapsed()&&!M.i.isTag(e,["br","hr"])&&(l=e),M.i.up(e,(t=>{if(M.i.isHTMLElement(t)){const e=(0,g.css)(t,"color",!0),s=(0,g.css)(t,"background-color",!0);if(e)return n=""+e,!0;if(s)return r=""+s,!0}}),t.editor)),a=[{name:"Background",content:(0,Le.YW)(t,(e=>{l?l.style.backgroundColor=e:t.execCommand("background",!1,e),(0,g.dataBind)(o,"color",e),(0,g.dataBind)(o,"color-mode","background"),i()}),r)},{name:"Text",content:(0,Le.YW)(t,(e=>{l?l.style.color=e:t.execCommand("forecolor",!1,e),(0,g.dataBind)(o,"color",e),(0,g.dataBind)(o,"color-mode","color"),i()}),n)}],"background"!==t.o.colorPickerDefaultTab&&(a=a.reverse()),(0,Le.IL)(t,a,l)},exec(t,e,{button:s}){const i=(0,g.dataBind)(s,"color-mode"),o=(0,g.dataBind)(s,"color");if(!i)return!1;if(e&&e!==t.editor&&M.i.isNode(e)&&M.i.isElement(e))switch(i){case"color":e.style.color=o;break;case"background":e.style.backgroundColor=o}else t.execCommand("background"===i?i:"forecolor",!1,o)},tooltip:"Fill color or set the text color"};class Me extends X{constructor(){super(...arguments),this.isFragmentFromEditor=!1,this.isCopyMode=!1,this.startDragPoint={x:0,y:0},this.draggable=null,this.bufferRange=null,this.getText=t=>{const e=ve(t);return e?e.getData(a.TEXT_HTML)||e.getData(a.TEXT_PLAIN):null}}afterInit(){this.j.e.on([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}onDragStart(t){let e=t.target;if(this.onDragEnd(),this.isFragmentFromEditor=M.i.isOrContains(this.j.editor,e,!0),this.isCopyMode=!this.isFragmentFromEditor||(0,g.ctrlKey)(t),this.isFragmentFromEditor){const t=this.j.s.sel,e=t&&t.rangeCount?t.getRangeAt(0):null;e&&(this.bufferRange=e.cloneRange())}else this.bufferRange=null;this.startDragPoint.x=t.clientX,this.startDragPoint.y=t.clientY,Tt(e)&&(e=e.querySelector("img")),M.i.isTag(e,"img")&&(this.draggable=e.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",e)),this.addDragListeners()}addDragListeners(){this.j.e.on("dragover",this.onDrag).on("drop.DragAndDrop",this.onDrop).on(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}removeDragListeners(){this.j.e.off("dragover",this.onDrag).off("drop.DragAndDrop",this.onDrop).off(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}onDrag(t){this.draggable&&(this.j.e.fire("hidePopup"),this.j.s.insertCursorAtPoint(t.clientX,t.clientY),t.preventDefault(),t.stopPropagation())}onDragEnd(){this.draggable&&(M.i.safeRemove(this.draggable),this.draggable=null),this.isCopyMode=!1,this.removeDragListeners()}onDrop(t){if(!t.dataTransfer||!t.dataTransfer.files||!t.dataTransfer.files.length){if(!this.isFragmentFromEditor&&!this.draggable)return this.j.e.fire("paste",t),t.preventDefault(),t.stopPropagation(),!1;const e=this.j.s.sel,s=this.bufferRange||(e&&e.rangeCount?e.getRangeAt(0):null);let i=null;if(!this.draggable&&s)i=this.isCopyMode?s.cloneContents():s.extractContents();else if(this.draggable)if(this.isCopyMode){const[t,e]="1"===(0,g.attr)(this.draggable,"-is-file")?["a","href"]:["img","src"];i=this.j.createInside.element(t),i.setAttribute(e,(0,g.attr)(this.draggable,"data-src")||(0,g.attr)(this.draggable,"src")||""),"a"===t&&(i.textContent=(0,g.attr)(i,e)||"")}else i=(0,g.dataBind)(this.draggable,"target");else this.getText(t)&&(i=this.j.createInside.fromHTML(this.getText(t)));e&&e.removeAllRanges(),this.j.s.insertCursorAtPoint(t.clientX,t.clientY),i&&(this.j.s.insertNode(i,!1,!1),s&&i.firstChild&&i.lastChild&&(s.setStartBefore(i.firstChild),s.setEndAfter(i.lastChild),this.j.s.selectRange(s),this.j.e.fire("synchro")),M.i.isTag(i,"img")&&this.j.events&&this.j.e.fire("afterInsertImage",i)),t.preventDefault(),t.stopPropagation()}this.isFragmentFromEditor=!1,this.removeDragListeners()}beforeDestruct(){this.onDragEnd(),this.j.e.off(window,".DragAndDrop").off(".DragAndDrop").off([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}}(0,n.gn)([q.autobind],Me.prototype,"onDragStart",null),(0,n.gn)([(0,q.throttle)((t=>t.j.defaultTimeout/10))],Me.prototype,"onDrag",null),(0,n.gn)([q.autobind],Me.prototype,"onDragEnd",null),(0,n.gn)([q.autobind],Me.prototype,"onDrop",null),(t=>{t[t.IDLE=0]="IDLE",t[t.WAIT_DRAGGING=1]="WAIT_DRAGGING",t[t.DRAGGING=2]="DRAGGING"})(qe||(qe={}));class Ne extends X{constructor(){super(...arguments),this.dragList=[],this.draggable=null,this.isCopyMode=!1,this.diffStep=10,this.startX=0,this.startY=0,this.state=qe.IDLE}afterInit(){this.dragList=this.j.o.draggableTags?(0,g.splitArray)(this.j.o.draggableTags).filter(Boolean).map((t=>t.toLowerCase())):[],this.dragList.length&&this.j.e.on("mousedown dragstart",this.onDragStart)}onDragStart(t){if("dragstart"===t.type&&this.draggable)return!1;if(this.state>qe.IDLE)return;const e=t.target;if(!this.dragList.length||!e)return;const s=t=>!(!t||!this.dragList.includes(t.nodeName.toLowerCase()));let i=M.i.furthest(e,s,this.j.editor)||(s(e)?e:null);i&&(M.i.isTag(i.parentElement,"a")&&i.parentElement.firstChild===i&&i.parentElement.lastChild===i&&(i=i.parentElement),this.startX=t.clientX,this.startY=t.clientY,this.isCopyMode=(0,g.ctrlKey)(t),this.draggable=i.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",i),this.state=qe.WAIT_DRAGGING,this.addDragListeners())}onDrag(t){var e,s;if(!this.draggable||this.state===qe.IDLE)return;const i=t.clientY;if(this.state!==qe.WAIT_DRAGGING||Math.sqrt(Math.pow(t.clientX-this.startX,2)+Math.pow(i-this.startY,2))>=this.diffStep){if(this.state===qe.WAIT_DRAGGING&&(this.j.lock("drag-and-drop-element"),this.state=qe.DRAGGING),this.j.e.fire("hidePopup hideResizer"),!this.draggable.parentNode){const i=(0,g.dataBind)(this.draggable,"target");(0,g.css)(this.draggable,{zIndex:1e13,pointerEvents:"none",pointer:"drag",position:"fixed",opacity:.7,display:"inline-block",left:t.clientX,top:t.clientY,width:null!==(e=null==i?void 0:i.offsetWidth)&&void 0!==e?e:100,height:null!==(s=null==i?void 0:i.offsetHeight)&&void 0!==s?s:100}),(0,_.ZO)(this.j,Ne).appendChild(this.draggable)}(0,g.css)(this.draggable,{left:t.clientX,top:t.clientY}),this.j.s.insertCursorAtPoint(t.clientX,t.clientY)}}onDragEnd(){this.isInDestruct||(this.removeDragListeners(),this.j.unlock(),this.state=qe.IDLE,this.draggable&&(M.i.safeRemove(this.draggable),this.draggable=null))}onDrop(){if(!this.draggable||qe.DRAGGING>this.state)return void this.onDragEnd();let t=(0,g.dataBind)(this.draggable,"target");this.onDragEnd(),this.isCopyMode&&(t=t.cloneNode(!0));const{parentElement:e}=t;this.j.s.insertNode(t,!0,!1),e&&M.i.isEmpty(e)&&!M.i.isTag(e,["td","th"])&&M.i.safeRemove(e),M.i.isTag(t,"img")&&this.j.e&&this.j.e.fire("afterInsertImage",t),this.j.e.fire("synchro")}addDragListeners(){this.j.e.on(this.j.editor,"mousemove",this.onDrag).on("mouseup",this.onDrop).on([this.j.ew,this.ow],"mouseup",this.onDragEnd)}removeDragListeners(){this.j.e.off(this.j.editor,"mousemove",this.onDrag).off("mouseup",this.onDrop).off([this.j.ew,this.ow],"mouseup",this.onDragEnd)}beforeDestruct(){this.onDragEnd(),this.j.e.off("mousedown dragstart",this.onDragStart),this.removeDragListeners()}}(0,n.gn)([q.autobind],Ne.prototype,"onDragStart",null),(0,n.gn)([(0,q.throttle)((t=>t.j.defaultTimeout/10))],Ne.prototype,"onDrag",null),(0,n.gn)([q.autobind],Ne.prototype,"onDragEnd",null),(0,n.gn)([q.autobind],Ne.prototype,"onDrop",null);const Pe=(t,e,s,i)=>{var o;const n=t.createInside.element(s),r=t.createInside.element("br");n.appendChild(r),i&&i.cssText&&n.setAttribute("style",i.cssText),t.s.insertNode(n,!1,!1),t.s.setCursorBefore(r);const a=t.s.createRange();return a.setStartBefore("br"!==s.toLowerCase()?r:n),a.collapse(!0),t.s.selectRange(a),M.i.safeRemove(e),(0,g.scrollIntoViewIfNeeded)(n,t.editor,t.ed),null===(o=t.events)||void 0===o||o.fire("synchro"),n};class De extends X{constructor(){super(...arguments),this.brMode=!1,this.defaultTag=a.PARAGRAPH}afterInit(t){this.defaultTag=t.o.enter.toLowerCase(),this.brMode=this.defaultTag===a.BR.toLowerCase(),t.o.enterBlock||(t.o.enterBlock=this.brMode?a.PARAGRAPH:this.defaultTag),t.e.off(".enter").on("keydown.enter",(e=>{if(e.key===a.KEY_ENTER){const s=t.e.fire("beforeEnter",e);return void 0!==s?s:(t.s.isCollapsed()||t.execCommand("Delete"),t.s.focus(),this.onEnter(e),!1)}}))}onEnter(t){const e=this.j,s=e.selection,i=this.defaultTag;let o=s.current(!1);o&&o!==e.editor||(o=e.createInside.text(a.INVISIBLE_SPACE),s.insertNode(o),s.select(o));let n=this.getBlockWrapper(o);const r=M.i.isTag(n,"li");if((!r||t.shiftKey)&&!this.checkBR(o,t.shiftKey))return!1;if(n||this.hasPreviousBlock(o)||(n=this.wrapText(o)),!n||n===o)return Pe(e,null,r?"li":i),!1;if(!this.checkUnsplittableBox(n))return!1;if(r&&M.i.isEmpty(n))return this.enterInsideEmptyLIelement(n),!1;const l=n.tagName.toLowerCase()===this.defaultTag||r,c=s.cursorOnTheRight(n),h=s.cursorOnTheLeft(n);if(!l&&(c||h)){let t=null;return t=c?s.setCursorAfter(n):s.setCursorBefore(n),Pe(e,t,this.defaultTag),void(h&&!c&&s.setCursorIn(n,!0))}s.splitSelection(n)}getBlockWrapper(t,e=a.IS_BLOCK){let s=t;const i=this.j.editor;do{if(!s||s===i)break;if(e.test(s.nodeName))return M.i.isTag(s,"li")?s:this.getBlockWrapper(s.parentNode,/^li$/i)||s;s=s.parentNode}while(s&&s!==i);return null}checkBR(t,e){const s=M.i.closest(t,["pre","blockquote"],this.j.editor);if(this.brMode||e&&!s||!e&&s){const t=this.j.createInside.element("br");return this.j.s.insertNode(t,!0),(0,g.scrollIntoViewIfNeeded)(t,this.j.editor,this.j.ed),!1}return!0}wrapText(t){let e=t;M.i.up(e,(t=>{t&&t.hasChildNodes()&&t!==this.j.editor&&(e=t)}),this.j.editor);const s=M.i.wrapInline(e,this.j.o.enter,this.j);if(M.i.isEmpty(s)){const t=this.j.createInside.element("br");s.appendChild(t),this.j.s.setCursorBefore(t)}return s}hasPreviousBlock(t){return!!M.i.prev(t,(t=>M.i.isBlock(t)||M.i.isImage(t)),this.j.editor)}checkUnsplittableBox(t){const e=this.j,s=e.selection;if(!M.i.canSplitBlock(t)){const t=e.createInside.element("br");return s.insertNode(t,!1),s.setCursorAfter(t),!1}return!0}enterInsideEmptyLIelement(t){let e=null;const s=M.i.closest(t,["ol","ul"],this.j.editor);if(s){if(M.i.prev(t,(t=>M.i.isTag(t,"li")),s))if(M.i.next(t,(t=>M.i.isTag(t,"li")),s)){const i=this.j.s.createRange();i.setStartBefore(s),i.setEndAfter(t);const o=i.extractContents();s.parentNode&&s.parentNode.insertBefore(o,s),e=this.j.s.setCursorBefore(s)}else e=this.j.s.setCursorAfter(s);else e=this.j.s.setCursorBefore(s);M.i.safeRemove(t),Pe(this.j,e,this.defaultTag),(0,g.$$)("li",s).length||M.i.safeRemove(s)}}beforeDestruct(t){t.e.off("keydown.enter")}}class Re extends X{afterInit(t){}beforeDestruct(t){}onKeyDownArrow(t){var e;if(t.key!==a.KEY_RIGHT||!this.j.selection.isCollapsed())return;const{endContainer:s,endOffset:i}=this.j.selection.range;if(M.i.isText(s)&&(null===(e=s.nodeValue)||void 0===e?void 0:e.length)===i){const{parentNode:t}=s;M.i.isInlineBlock(t)&&!ie(t,!1,this.j.editor)&&M.i.after(t,this.j.createInside.text(a.NBSP_SPACE))}}}(0,n.gn)([(0,q.watch)(":keydown")],Re.prototype,"onKeyDownArrow",null),r.D.prototype.showMessageErrors=!0,r.D.prototype.showMessageErrorTime=3e3,r.D.prototype.showMessageErrorOffsetPx=3;const Ae="error-box-for-messages";function Be(t){if(t.o.showMessageErrors){const e=t.getFullElName(Ae,"active",!0),s=t.c.div(t.getFullElName(Ae)),i=()=>{let e=5;(0,g.toArray)(s.childNodes).forEach((s=>{(0,g.css)(s,"bottom",e+"px"),e+=s.offsetHeight+t.o.showMessageErrorOffsetPx}))};t.e.on("beforeDestruct",(()=>{M.i.safeRemove(s)})).on("errorMessage",((o,n,r)=>{t.workplace.appendChild(s);const a=t.c.div(e,o);a.classList.add(t.getFullElName(Ae,"type",n)),s.appendChild(a),i(),t.async.setTimeout((()=>{a.classList.remove(e),t.async.setTimeout((()=>{M.i.safeRemove(a),i()}),300)}),r||t.o.showMessageErrorTime)}))}}function Oe(t){t.registerButton({name:"font",group:"font"}).registerButton({name:"fontsize",group:"font"});const e=(e,s,i)=>{switch(e){case"fontsize":t.s.applyStyle({fontSize:(0,g.normalizeSize)(i)});break;case"fontname":t.s.applyStyle({fontFamily:i})}return t.e.fire("synchro"),!1};t.registerCommand("fontsize",e).registerCommand("fontname",e)}function He(t){t.registerButton({name:"paragraph",group:"font"}),t.registerCommand("formatblock",((e,s,i)=>(t.s.applyStyle(void 0,{element:i}),t.synchronizeValues(),!1)))}function Fe(t){t.registerButton({name:"fullsize"});let e=!1,s=0,i=0,o=!1;const n=()=>{const{container:n,events:r}=t;r&&(e?(s=(0,g.css)(n,"height",!0),i=(0,g.css)(n,"width",!0),(0,g.css)(n,{height:t.ow.innerHeight,width:t.ow.innerWidth}),o=!0):o&&(0,g.css)(n,{height:s||"auto",width:i||"auto"}))},r=s=>{const{container:i,events:o}=t;if(i){if(void 0===s&&(s=!i.classList.contains("jodit_fullsize")),t.setMod("fullsize",s),t.o.fullsize=s,e=s,i.classList.toggle("jodit_fullsize",s),t.toolbar&&((0,g.isJoditObject)(t)&&t.toolbarContainer.appendChild(t.toolbar.container),(0,g.css)(t.toolbar.container,"width","auto")),t.o.globalFullSize){let t=i.parentNode;for(;t&&t.nodeType!==Node.DOCUMENT_NODE;)t.classList.toggle("jodit_fullsize-box_true",s),t=t.parentNode;n()}o.fire("afterResize")}};t.o.globalFullSize&&t.e.on(t.ow,"resize",n),t.e.on("afterInit afterOpen",(()=>{var e;t.toggleFullSize(null===(e=null==t?void 0:t.options)||void 0===e?void 0:e.fullsize)})).on("toggleFullSize",r).on("beforeDestruct",(()=>{e&&r(!1)})).on("beforeDestruct",(()=>{t.events&&t.e.off(t.ow,"resize",n)}))}r.D.prototype.defaultFontSizePoints="px",r.D.prototype.controls.fontsize={command:"fontSize",data:{cssRule:"font-size"},list:["8","9","10","11","12","14","16","18","24","30","36","48","60","72","96"],exec:(t,e,{control:s})=>(0,g.memorizeExec)(t,e,{control:s},(e=>{var i;return"fontsize"===(null===(i=s.command)||void 0===i?void 0:i.toLowerCase())?`${e}${t.o.defaultFontSizePoints}`:e})),childTemplate:(t,e,s)=>`${s}${t.o.defaultFontSizePoints}`,tooltip:"Font size",isChildActive(t,e){var s,i;const o=t.s.current(),n=(null===(s=e.data)||void 0===s?void 0:s.cssRule)||"font-size",r=(null===(i=e.data)||void 0===i?void 0:i.normalize)||(e=>/pt$/i.test(e)&&"pt"===t.o.defaultFontSizePoints?e.replace(/pt$/i,""):e);if(o){const s=M.i.closest(o,M.i.isElement,t.editor)||t.editor,i=(0,g.css)(s,n);return!(!i||!e.args||r(""+e.args[0])!==r(""+i))}return!1}},r.D.prototype.controls.font={...r.D.prototype.controls.fontsize,command:"fontname",list:{"":"Default","Helvetica,sans-serif":"Helvetica","Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma","Times New Roman,Times,serif":"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},childTemplate(t,e,s){let i=!1;try{i=-1===e.indexOf("dings")&&document.fonts.check("16px "+e,s)}catch(t){}return`${s}`},data:{cssRule:"font-family",normalize:t=>t.toLowerCase().replace(/['"]+/g,"").replace(/[^a-z0-9]+/g,",")},tooltip:"Font family"},r.D.prototype.controls.paragraph={command:"formatBlock",update(t){const e=t.j,s=t.control,i=e.s.current();if(i&&e.o.textIcons){const o=(M.i.closest(i,M.i.isBlock,e.editor)||e.editor).nodeName.toLowerCase(),n=s.list;t&&s.data&&s.data.currentValue!==o&&n&&n[o]&&(e.o.textIcons?t.state.text=o:t.state.icon.name=o,s.data.currentValue=o)}return!1},exec:g.memorizeExec,data:{currentValue:"left"},list:{p:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",blockquote:"Quote",pre:"Code"},isChildActive(t,e){const s=t.s.current();if(s){const i=M.i.closest(s,M.i.isBlock,t.editor);return!(!i||i===t.editor||void 0===e.args||i.nodeName.toLowerCase()!==e.args[0])}return!1},isActive(t,e){const s=t.s.current();if(s){const i=M.i.closest(s,M.i.isBlock,t.editor);return!(!i||i===t.editor||void 0===e.list||M.i.isTag(i,"p")||void 0===e.list[i.nodeName.toLowerCase()])}return!1},childTemplate:(t,e,s)=>`<${e} style="margin:0;padding:0">${t.i18n(s)}`,tooltip:"Insert format block"},r.D.prototype.fullsize=!1,r.D.prototype.globalFullSize=!0,r.D.prototype.controls.fullsize={exec(t){t.toggleFullSize()},update(t){const e=t.j,s=e.isFullSize?"shrink":"fullsize";t.state.activated=e.isFullSize,e.o.textIcons?t.state.text=s:t.state.icon.name=s},tooltip:"Open editor in fullsize",mode:a.MODE_SOURCE+a.MODE_WYSIWYG},r.D.prototype.commandToHotkeys={removeFormat:["ctrl+shift+m","cmd+shift+m"],insertOrderedList:["ctrl+shift+7","cmd+shift+7"],insertUnorderedList:["ctrl+shift+8, cmd+shift+8"],selectall:["ctrl+a","cmd+a"]};class We extends X{constructor(){super(...arguments),this.onKeyPress=t=>{const e=this.specialKeys[t.which],s=(t.key||String.fromCharCode(t.which)).toLowerCase(),i=[e||s];return["alt","ctrl","shift","meta"].forEach((s=>{t[s+"Key"]&&e!==s&&i.push(s)})),(0,g.normalizeKeyAliases)(i.join("+"))},this.specialKeys={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",91:"meta",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}}afterInit(t){(0,g.keys)(t.o.commandToHotkeys,!1).forEach((e=>{const s=t.o.commandToHotkeys[e];s&&((0,g.isArray)(s)||(0,g.isString)(s))&&t.registerHotkeyToCommand(s,e)}));let e=!1;t.e.off(".hotkeys").on([t.ow,t.ew],"keydown.hotkeys",(t=>{if(t.key===a.KEY_ESC)return this.j.e.fire("escape",t)})).on("keydown.hotkeys",(s=>{const i=this.onKeyPress(s),o={shouldStop:!0};if(!1===this.j.e.fire(i+".hotkey",s.type,o)){if(o.shouldStop)return e=!0,t.e.stopPropagation("keydown"),!1;s.preventDefault()}}),void 0,!0).on("keyup.hotkeys",(()=>{if(e)return e=!1,t.e.stopPropagation("keyup"),!1}),void 0,!0)}beforeDestruct(t){t.events&&t.e.off(".hotkeys")}}function $e(t){const e=t.options;t.e.on("afterSetMode",(()=>{t.isEditorMode()&&t.s.focus()})).on("generateDocumentStructure.iframe",((t,s)=>{const i=t||s.iframe.contentWindow.document;if(i.open(),i.write(e.iframeDoctype+``+`${e.iframeTitle}`+(e.iframeBaseUrl?``:"")+''),i.close(),e.iframeCSSLinks&&e.iframeCSSLinks.forEach((t=>{const e=i.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),i.head&&i.head.appendChild(e)})),e.iframeStyle){const t=i.createElement("style");t.innerHTML=e.iframeStyle,i.head&&i.head.appendChild(t)}})).on("createEditor",(()=>{if(!e.iframe)return;const s=t.c.element("iframe");s.style.display="block",s.src="about:blank",s.className="jodit-wysiwyg_iframe",s.setAttribute("allowtransparency","true"),s.setAttribute("tabindex",""+e.tabIndex),s.setAttribute("frameborder","0"),t.workplace.appendChild(s),t.iframe=s;const i=t.e.fire("generateDocumentStructure.iframe",null,t);return(0,g.callPromise)(i,(()=>{if(!t.iframe)return!1;const s=t.iframe.contentWindow.document;t.editorWindow=t.iframe.contentWindow;const i=()=>{(0,g.attr)(s.body,"contenteditable",t.getMode()!==a.MODE_SOURCE&&!t.getReadOnly()||null)},o=t=>{const e=//im,s="{%%BODY%%}",i=e.exec(t);return i&&(t=t.replace(e,s).replace(/]*?)>(.*?)<\/span>/gim,"").replace(/<span([^&]*?)>(.*?)<\/span>/gim,"").replace(s,i[0].replace(/(]+?)min-height["'\s]*:[\s"']*[0-9]+(px|%)/im,"$1").replace(/(]+?)([\s]*["'])?contenteditable["'\s]*=[\s"']*true["']?/im,"$1").replace(/<(style|script|span)[^>]+jodit[^>]+>.*?<\/\1>/g,"")).replace(/(class\s*=\s*)(['"])([^"']*)(jodit-wysiwyg|jodit)([^"']*\2)/g,"$1$2$3$5").replace(/(<[^<]+?)\sclass="[\s]*"/gim,"$1").replace(/(<[^<]+?)\sstyle="[\s;]*"/gim,"$1").replace(/(<[^<]+?)\sdir="[\s]*"/gim,"$1")),t};if(e.editHTMLDocumentMode){const e=t.element.tagName;if("TEXTAREA"!==e&&"INPUT"!==e)throw(0,g.error)("If enable `editHTMLDocumentMode` - source element should be INPUT or TEXTAREA");t.e.on("beforeGetNativeEditorValue",(()=>o(t.o.iframeDoctype+s.documentElement.outerHTML))).on("beforeSetNativeEditorValue",(({value:e})=>!t.isLocked&&(/<(html|body)/i.test(e)?o(s.documentElement.outerHTML)!==o(e)&&(s.open(),s.write(t.o.iframeDoctype+o(e)),s.close(),t.editor=s.body,t.e.fire("safeHTML",t.editor),i(),t.e.fire("prepareWYSIWYGEditor"),t.e.stopPropagation("beforeSetNativeEditorValue")):s.body.innerHTML=e,!0)),void 0,!0)}if(t.editor=s.body,t.e.on("afterSetMode afterInit afterAddPlace",i),"auto"===e.height){s.documentElement&&(s.documentElement.style.overflowY="hidden");const i=t.async.throttle((()=>{if(t.editor&&t.iframe&&"auto"===e.height){const e=t.ew.getComputedStyle(t.editor);(0,g.css)(t.iframe,"height",t.editor.offsetHeight+(parseInt(e.marginTop||"0",10)+parseInt(e.marginBottom||"0",10)))}}),t.defaultTimeout/2);t.e.on("change afterInit afterSetMode resize",i).on([t.iframe,t.ew,s.documentElement],"load",i).on(s,"readystatechange DOMContentLoaded",i)}return s.documentElement&&t.e.on(s.documentElement,"mousedown touchend",(()=>{t.s.isFocused()||(t.s.focus(),t.editor===s.body&&t.s.setCursorIn(s.body))})).on(t.ew,"mousedown touchstart keydown keyup touchend click mouseup mousemove scroll",(e=>{var s;null===(s=t.events)||void 0===s||s.fire(t.ow,e)})),!1}))}))}function Ve(t){const e=t.o,s=t.i18n.bind(t),i=N.JO.get.bind(N.JO),o=e.filebrowser.ajax.url||e.uploader.url,n=e.image.useImageEditor;return t.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t${i("image")}\n\t\t\t\t\t\t${i("crop")}\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t
`)}function Ye(t){const e=t.o,s=t.i18n.bind(t),i=N.JO.get.bind(N.JO);return t.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t${i("lock")}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t`)}r.D.prototype.iframe=!1,r.D.prototype.iframeBaseUrl="",r.D.prototype.iframeTitle="Jodit Editor",r.D.prototype.iframeDoctype="",r.D.prototype.iframeDefaultSrc="about:blank",r.D.prototype.iframeStyle='html{margin:0;padding:0;min-height: 100%;}body{box-sizing:border-box;font-size:13px;line-height:1.6;padding:10px;margin:0;background:transparent;color:#000;position:relative;z-index:2;user-select:auto;margin:0px;overflow:auto;outline:none;}table{width:100%;border:none;border-collapse:collapse;empty-cells: show;max-width: 100%;}th,td{padding: 2px 5px;border:1px solid #ccc;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}p{margin-top:0;}.jodit_editor .jodit_iframe_wrapper{display: block;clear: both;user-select: none;position: relative;}.jodit_editor .jodit_iframe_wrapper:after {position:absolute;content:"";z-index:1;top:0;left:0;right: 0;bottom: 0;cursor: pointer;display: block;background: rgba(0, 0, 0, 0);} .jodit_disabled{user-select: none;-o-user-select: none;-moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-ms-user-select: none}',r.D.prototype.iframeCSSLinks=[],r.D.prototype.editHTMLDocumentMode=!1;var Ue=s(60);r.D.prototype.image={dialogWidth:600,openOnDblClick:!0,editSrc:!0,useImageEditor:!0,editTitle:!0,editAlt:!0,editLink:!0,editSize:!0,editBorderRadius:!0,editMargins:!0,editClass:!0,editStyle:!0,editId:!0,editAlign:!0,showPreview:!0,selectImageAfterClose:!0};const Ge=t=>(t=(0,g.trim)(t),/^[0-9]+$/.test(t)?t+"px":t),Xe=t=>/^[-+]?[0-9.]+px$/.test(""+t)?parseFloat(""+t):t;class Ke extends X{constructor(){super(...arguments),this.state={image:new Image,get ratio(){return this.image.naturalWidth/this.image.naturalHeight||1},sizeIsLocked:!0,marginIsLocked:!0},this.activeTabState={__activeTab:"Image"}}onChangeMarginIsLocked(){if(!this.form)return;const{marginRight:t,marginBottom:e,marginLeft:s,lockMargin:i}=(0,g.refs)(this.form);[t,e,s].forEach((t=>{(0,g.attr)(t,"disabled",this.state.marginIsLocked||null)})),i.innerHTML=N.JO.get(this.state.marginIsLocked?"lock":"unlock")}onChangeSizeIsLocked(){if(!this.form)return;const{lockSize:t,imageWidth:e}=(0,g.refs)(this.form);t.innerHTML=N.JO.get(this.state.sizeIsLocked?"lock":"unlock"),t.classList.remove("jodit-properties__lock"),t.classList.remove("jodit-properties__unlock"),t.classList.add(this.state.sizeIsLocked?"jodit-properties__lock":"jodit-properties__unlock"),this.j.e.fire(e,"change")}open(){return this.makeForm(),this.activeTabState.__activeTab="Image",this.j.e.fire("hidePopup"),(0,g.markOwner)(this.j,this.dialog.container),this.state.marginIsLocked=!0,this.state.sizeIsLocked=!0,this.onChangeMarginIsLocked(),this.onChangeSizeIsLocked(),this.updateValues(),this.dialog.open().setModal(!0).setPosition(),!1}makeForm(){if(this.dialog)return;this.dialog=new $({fullsize:this.j.o.fullsize,globalFullSize:this.j.o.globalFullSize,theme:this.j.o.theme,language:this.j.o.language,minWidth:Math.min(400,screen.width),minHeight:590,buttons:["fullsize","dialog.close"]});const t=this.j,e=t.o,s=t.i18n.bind(t),i={check:(0,C.zx)(t,"ok","Apply","primary"),remove:(0,C.zx)(t,"bin","Delete")};t.e.on(this.dialog,"afterClose",(()=>{this.state.image.parentNode&&e.image.selectImageAfterClose&&t.s.select(this.state.image)})),i.remove.onAction((()=>{t.s.removeNode(this.state.image),this.dialog.close()}));const{dialog:o}=this;o.setHeader(s("Image properties"));const n=(t=>{const{showPreview:e,editSize:s}=t.o.image,i=N.JO.get.bind(N.JO);return t.c.fromHTML(`
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t${i("lock")}\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t
`)})(t);this.form=n,o.setContent(n);const{tabsBox:r}=(0,g.refs)(this.form);r&&r.appendChild((0,Le.IL)(t,[{name:"Image",content:Ve(t)},{name:"Advanced",content:Ye(t)}],this.activeTabState)),i.check.onAction(this.onApply);const{changeImage:a,editImage:l}=(0,g.refs)(this.form);t.e.on(a,"click",this.openImagePopup),e.image.useImageEditor&&t.e.on(l,"click",this.openImageEditor);const{lockSize:c,lockMargin:h,imageWidth:d,imageHeight:u}=(0,g.refs)(n);c&&t.e.on(c,"click",(()=>{this.state.sizeIsLocked=!this.state.sizeIsLocked})),t.e.on(h,"click",(t=>{this.state.marginIsLocked=!this.state.marginIsLocked,t.preventDefault()}));const p=t=>{if(!(0,g.isNumeric)(d.value)||!(0,g.isNumeric)(u.value))return;const e=parseFloat(d.value),s=parseFloat(u.value);t.target===d?u.value=""+Math.round(e/this.state.ratio):d.value=""+Math.round(s*this.state.ratio)};t.e.on([d,u],"change keydown mousedown paste",(e=>{this.state.sizeIsLocked&&t.async.setTimeout(p.bind(this,e),{timeout:t.defaultTimeout,label:"image-properties-changeSize"})})),o.setFooter([i.remove,i.check]),o.setSize(this.j.o.image.dialogWidth)}updateValues(){const t=this.j.o,{image:e}=this.state,{marginTop:s,marginRight:i,marginBottom:o,marginLeft:n,lockMargin:r,imageSrc:a,id:l,classes:c,align:h,style:d,imageTitle:u,imageAlt:p,borderRadius:f,imageLink:m,imageWidth:v,imageHeight:b,imageLinkOpenInNewTab:w,imageViewSrc:y,lockSize:C}=(0,g.refs)(this.form);(()=>{r.checked=this.state.marginIsLocked,C.checked=this.state.sizeIsLocked})(),a.value=(0,g.attr)(e,"src")||"",y&&(0,g.attr)(y,"src",(0,g.attr)(e,"src")||""),(()=>{u.value=(0,g.attr)(e,"title")||"",p.value=(0,g.attr)(e,"alt")||"";const t=M.i.closest(e,"a",this.j.editor);t?(m.value=(0,g.attr)(t,"href")||"",w.checked="_blank"===(0,g.attr)(t,"target")):(m.value="",w.checked=!1)})(),(()=>{const t=(0,g.attr)(e,"width")||(0,g.css)(e,"width",!0)||!1,s=(0,g.attr)(e,"height")||(0,g.css)(e,"height",!0)||!1;v.value=!1!==t?""+Xe(t):""+e.offsetWidth,b.value=!1!==s?""+Xe(s):""+e.offsetHeight,this.state.sizeIsLocked=(()=>!(!(0,g.isNumeric)(v.value)||!(0,g.isNumeric)(b.value))&&1>Math.abs(parseFloat(v.value)-parseFloat(b.value)*this.state.ratio))()})(),(()=>{if(!t.image.editMargins)return;let r=!0,a=!1;[s,i,o,n].forEach((t=>{const i=(0,g.attr)(t,"data-ref")||"";let o=e.style.getPropertyValue((0,g.kebabCase)(i));if(!o)return a=!0,void(t.value="");/^[0-9]+(px)?$/.test(o)&&(o=parseInt(o,10)),t.value=""+o||"",(a&&t.value||r&&"marginTop"!==i&&t.value!==s.value)&&(r=!1)})),this.state.marginIsLocked=r})(),c.value=((0,g.attr)(e,"class")||"").replace(/jodit_focused_image[\s]*/,""),l.value=(0,g.attr)(e,"id")||"",f.value=""+(parseInt(e.style.borderRadius||"0",10)||"0"),e.style.cssFloat&&-1!==["left","right"].indexOf(e.style.cssFloat.toLowerCase())?h.value=(0,g.css)(e,"float"):"block"===(0,g.css)(e,"display")&&"auto"===e.style.marginLeft&&"auto"===e.style.marginRight&&(h.value="center"),d.value=(0,g.attr)(e,"style")||""}onApply(){const{style:t,imageSrc:e,borderRadius:s,imageTitle:i,imageAlt:o,imageLink:n,imageWidth:r,imageHeight:a,marginTop:l,marginRight:c,marginBottom:h,marginLeft:d,imageLinkOpenInNewTab:u,align:p,classes:f,id:m}=(0,g.refs)(this.form),v=this.j.o,{image:b}=this.state;if(v.image.editStyle&&(0,g.attr)(b,"style",t.value||null),!e.value)return M.i.safeRemove(b),void this.dialog.close();(0,g.attr)(b,"src",e.value),b.style.borderRadius="0"!==s.value&&/^[0-9]+$/.test(s.value)?s.value+"px":"",(0,g.attr)(b,"title",i.value||null),(0,g.attr)(b,"alt",o.value||null);let w=M.i.closest(b,"a",this.j.editor);if(n.value?(w||(w=M.i.wrap(b,"a",this.j.createInside)),(0,g.attr)(w,"href",n.value),(0,g.attr)(w,"target",u.checked?"_blank":null)):w&&w.parentNode&&w.parentNode.replaceChild(b,w),r.value!==""+b.offsetWidth||a.value!==""+b.offsetHeight){const t=(0,g.trim)(r.value)?Ge(r.value):null,e=(0,g.trim)(a.value)?Ge(a.value):null;(0,g.css)(b,{width:t,height:e}),(0,g.attr)(b,"width",(0,g.attr)(b,"width")?t:null),(0,g.attr)(b,"height",(0,g.attr)(b,"height")?e:null)}const y=[l,c,h,d];v.image.editMargins&&(this.state.marginIsLocked?(0,g.css)(b,"margin",Ge(l.value)):y.forEach((t=>{const e=(0,g.attr)(t,"data-ref")||"";(0,g.css)(b,e,Ge(t.value))}))),v.image.editClass&&(0,g.attr)(b,"class",f.value||null),v.image.editId&&(0,g.attr)(b,"id",m.value||null),v.image.editAlign&&(0,Ue.z)(b,p.value),this.j.synchronizeValues(),this.dialog.close()}openImageEditor(){const t=(0,g.attr)(this.state.image,"src")||"",e=this.j.c.element("a"),s=()=>{e.host===location.host||U(this.j.i18n("You can only edit your own images. Download this image on the host?"),(t=>{t&&this.j.uploader&&this.j.uploader.uploadRemoteImage(""+e.href,(t=>{V(this.j.i18n("The image has been successfully uploaded to the host!"),(()=>{(0,g.isString)(t.newfilename)&&((0,g.attr)(this.state.image,"src",t.baseurl+t.newfilename),this.updateValues())})).bindDestruct(this.j)}),(t=>{V(this.j.i18n("There was an error loading %s",t.message)).bindDestruct(this.j)}))})).bindDestruct(this.j)};e.href=t,this.j.filebrowser.dataProvider.getPathByUrl(""+e.href).then((s=>{mt.call(this.j.filebrowser,e.href,s.name,s.path,s.source,(()=>{const e=(new Date).getTime();(0,g.attr)(this.state.image,"src",t+(-1!==t.indexOf("?")?"":"?")+"&_tmp="+e),this.updateValues()}),(t=>{V(t.message).bindDestruct(this.j)}))})).catch((t=>{V(t.message,s).bindDestruct(this.j)}))}openImagePopup(t){const e=new N.GI(this.j),{changeImage:s}=(0,g.refs)(this.form);e.setZIndex(this.dialog.getZIndex()+1),e.setContent((0,Le.ov)(this.j,{upload:t=>{t.files&&t.files.length&&(0,g.attr)(this.state.image,"src",t.baseurl+t.files[0]),this.updateValues(),e.close()},filebrowser:t=>{t&&(0,g.isArray)(t.files)&&t.files.length&&((0,g.attr)(this.state.image,"src",t.files[0]),e.close(),this.updateValues())}},this.state.image,e.close)).open((()=>(0,g.position)(s))),t.stopPropagation()}afterInit(t){const e=this;t.e.on("afterConstructor changePlace",(()=>{t.e.off(t.editor,".imageproperties").on(t.editor,"dblclick.imageproperties",(s=>{const i=s.target;if(M.i.isTag(i,"img"))if(t.o.image.openOnDblClick){if(!1===this.j.e.fire("openOnDblClick",i))return;e.state.image=i,t.o.readonly||(s.stopImmediatePropagation(),s.preventDefault(),e.open())}else s.stopImmediatePropagation(),t.s.select(i)}))})).on("openImageProperties.imageproperties",(t=>{this.state.image=t,this.open()}))}beforeDestruct(t){this.dialog&&this.dialog.destruct(),t.e.off(t.editor,".imageproperties").off(".imageproperties")}}(0,n.gn)([(0,q.watch)("state.marginIsLocked")],Ke.prototype,"onChangeMarginIsLocked",null),(0,n.gn)([(0,q.watch)("state.sizeIsLocked")],Ke.prototype,"onChangeSizeIsLocked",null),(0,n.gn)([q.autobind],Ke.prototype,"onApply",null),(0,n.gn)([q.autobind],Ke.prototype,"openImageEditor",null),(0,n.gn)([q.autobind],Ke.prototype,"openImagePopup",null);const Ze="__jodit_imageprocessor_binded";function Je(t){t.e.on("change afterInit changePlace",t.async.debounce((()=>{t.editor&&(0,g.$$)("img",t.editor).forEach((e=>{(0,g.dataBind)(e,Ze)||((0,g.dataBind)(e,Ze,!0),e.complete||t.e.on(e,"load",(function s(){var i;!t.isInDestruct&&(null===(i=t.e)||void 0===i||i.fire("resize")),t.e.off(e,"load",s)})),t.e.on(e,"mousedown touchstart",(()=>{t.s.select(e)})))}))}),t.defaultTimeout))}function Qe(t){t.registerButton({name:"image",group:"media"})}r.D.prototype.controls.image={popup(t,e,s,i){let o=null;return e&&!M.i.isText(e)&&M.i.isHTMLElement(e)&&(M.i.isTag(e,"img")||(0,g.$$)("img",e).length)&&(o=M.i.isTag(e,"img")?e:(0,g.$$)("img",e)[0]),t.s.save(),(0,Le.ov)(t,{filebrowser(e){t.s.restore(),e.files&&e.files.forEach((s=>t.s.insertImage(e.baseurl+s,null,t.o.imageDefaultWidth))),i()},upload:!0,async url(e,s){t.s.restore();const n=o||t.createInside.element("img");n.setAttribute("src",e),n.setAttribute("alt",s),o||await t.s.insertImage(n,null,t.o.imageDefaultWidth),i()}},o,i)},tags:["img"],tooltip:"Insert Image"},r.D.prototype.controls.indent={tooltip:"Increase Indent"};const ts=(t,e)=>`${M.i.isCell(e)?"padding":"margin"}${"rtl"===t?"Right":"Left"}`;function es(t){t.registerButton({name:"indent",group:"indent"}).registerButton({name:"outdent",group:"indent"});const e=e=>{const s=[];return t.s.eachSelection((i=>{t.s.save();let o=!!i&&M.i.up(i,M.i.isBlock,t.editor);const{enter:n}=t.o;if(!o&&i&&(o=M.i.wrapInline(i,n!==a.BR?n:a.PARAGRAPH,t)),!o)return t.s.restore(),!1;const r=s.includes(o);if(o&&!r){const i=ts(t.o.direction,o);s.push(o);let n=o.style[i]?parseInt(o.style[i],10):0;n+=t.o.indentMargin*("outdent"===e?-1:1),o.style[i]=n>0?n+"px":"",(0,g.attr)(o,"style")||(0,g.attr)(o,"style",null)}t.s.restore()})),t.synchronizeValues(),!1};t.registerCommand("indent",{exec:e,hotkeys:["ctrl+]","cmd+]"]}),t.registerCommand("outdent",{exec:e,hotkeys:["ctrl+[","cmd+["]})}function ss(t){t.registerButton({name:"hr",group:"insert"}),t.registerCommand("insertHorizontalRule",(()=>{const e=t.createInside.element("hr");t.s.insertNode(e,!1,!1);const s=M.i.closest(e.parentElement,M.i.isBlock,t.editor);s&&M.i.isEmpty(s)&&s!==t.editor&&(M.i.after(s,e),M.i.safeRemove(s));let i=M.i.next(e,M.i.isBlock,t.editor,!1);return i||(i=t.createInside.element(t.o.enter),M.i.after(e,i)),t.s.setCursorIn(i),!1}))}r.D.prototype.controls.outdent={isDisabled(t){const e=t.s.current();if(e){const s=M.i.closest(e,M.i.isBlock,t.editor);if(s){const e=ts(t.o.direction,s);return!s.style[e]||0>=parseInt(s.style[e],10)}}return!0},tooltip:"Decrease Indent"},r.D.prototype.indentMargin=10,r.D.prototype.controls.hr={command:"insertHorizontalRule",tags:["hr"],tooltip:"Insert Horizontal Line"},r.D.prototype.toolbarInline=!0,r.D.prototype.toolbarInlineForSelection=!1,r.D.prototype.toolbarInlineDisableFor=[],r.D.prototype.toolbarInlineDisabledButtons=["source"],r.D.prototype.popup={a:s(61).Z,img:s(62).Z,cells:s(63).Z,toolbar:s(64).Z,jodit:s(65).Z,iframe:s(65).Z,"jodit-media":s(65).Z,selection:["bold","underline","italic","ul","ol","\n","outdent","indent","fontsize","brush","cut","\n","paragraph","link","align","dots"]};class is extends X{constructor(){super(...arguments),this.requires=["select"],this.type=null,this.popup=new y.G(this.jodit,!1),this.toolbar=O(this.jodit,this.popup),this.snapRange=null,this.elmsList=(0,g.keys)(this.j.o.popup,!1).filter((t=>!this.isExcludedTarget(t)))}onClick(t){const e=this.elmsList,s=M.i.isTag(t,"img")?t:M.i.closest(t,e,this.j.editor);if(s&&this.canShowPopupForType(s.nodeName.toLowerCase()))return this.showPopup((()=>(0,g.position)(s,this.j)),s.nodeName.toLowerCase(),s),!1}showPopup(t,e,s){if(e=e.toLowerCase(),!this.canShowPopupForType(e))return!1;if(this.type!==e||s!==this.previousTarget){this.previousTarget=s;const t=this.j.o.popup[e];let i;i=(0,g.isFunction)(t)?t(this.j,s,this.popup.close):t,(0,g.isArray)(i)&&(this.toolbar.build(i,s),this.toolbar.buttonSize=this.j.o.toolbarButtonSize,i=this.toolbar.container),this.popup.setContent(i),this.type=e}return this.popup.open(t),!0}hidePopup(t){(0,g.isString)(t)&&t!==this.type||this.popup.close()}onOutsideClick(){this.popup.close()}canShowPopupForType(t){const e=this.j.o.popup[t.toLowerCase()];return!(this.j.o.readonly||!this.j.o.toolbarInline||!e||this.isExcludedTarget(t))}isExcludedTarget(t){return(0,g.splitArray)(this.j.o.toolbarInlineDisableFor).map((t=>t.toLowerCase())).includes(t.toLowerCase())}afterInit(t){this.j.e.on("getDiffButtons.mobile",(e=>{if(this.toolbar===e){const e=this.toolbar.getButtonsNames();return(0,g.toArray)(t.registeredButtons).filter((t=>!this.j.o.toolbarInlineDisabledButtons.includes(t.name))).filter((t=>{const s=(0,g.isString)(t)?t:t.name;return s&&"|"!==s&&"\n"!==s&&!e.includes(s)}))}})).on("hidePopup",this.hidePopup).on("showInlineToolbar",this.showInlineToolbar).on("showPopup",((t,e,s)=>{this.showPopup(e,s||((0,g.isString)(t)?t:t.nodeName),(0,g.isString)(t)?void 0:t)})).on("mousedown keydown",this.onSelectionStart).on("change",(()=>{this.popup.isOpened&&this.previousTarget&&!this.previousTarget.parentNode&&(this.hidePopup(),this.previousTarget=void 0)})).on([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.addListenersForElements()}onSelectionStart(){this.snapRange=this.j.s.range.cloneRange()}onSelectionEnd(t){if(t&&t.target&&N.u1.closestElement(t.target,y.G))return;const{snapRange:e}=this,{range:s}=this.j.s;e&&!s.collapsed&&s.startContainer===e.startContainer&&s.startOffset===e.startOffset&&s.endContainer===e.endContainer&&s.endOffset===e.endOffset||this.onSelectionChange()}onSelectionChange(){if(!this.j.o.toolbarInlineForSelection)return;const t="selection",e=this.j.s.sel,s=this.j.s.range;(null==e?void 0:e.isCollapsed)||this.isSelectedTarget(s)||this.tableModule.getAllSelectedCells().length?this.type===t&&this.popup.isOpened&&this.hidePopup():this.j.s.current()&&this.showPopup((()=>s.getBoundingClientRect()),t)}isSelectedTarget(t){const e=t.startContainer;return M.i.isElement(e)&&e===t.endContainer&&M.i.isTag(e.childNodes[t.startOffset],(0,g.keys)(this.j.o.popup,!1))&&t.startOffset===t.endOffset-1}get tableModule(){return this.j.getInstance("Table",this.j.o)}beforeDestruct(t){t.e.off("showPopup").off([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.removeListenersForElements()}_eventsList(){const t=this.elmsList;return t.map((t=>(0,g.camelCase)("click_"+t))).concat(t.map((t=>(0,g.camelCase)("touchstart_"+t)))).join(" ")}addListenersForElements(){this.j.e.on(this._eventsList(),this.onClick)}removeListenersForElements(){this.j.e.off(this._eventsList(),this.onClick)}showInlineToolbar(t){this.showPopup((()=>{if(t)return t;const{range:e}=this.j.s;return e.getBoundingClientRect()}),"toolbar")}}(0,n.gn)([q.autobind],is.prototype,"onClick",null),(0,n.gn)([(0,q.wait)((t=>!t.j.isLocked))],is.prototype,"showPopup",null),(0,n.gn)([(0,q.watch)(":clickEditor"),q.autobind],is.prototype,"hidePopup",null),(0,n.gn)([(0,q.watch)(":outsideClick")],is.prototype,"onOutsideClick",null),(0,n.gn)([q.autobind],is.prototype,"onSelectionStart",null),(0,n.gn)([q.autobind],is.prototype,"onSelectionEnd",null),(0,n.gn)([(0,q.debounce)((t=>t.defaultTimeout))],is.prototype,"onSelectionChange",null),(0,n.gn)([q.autobind],is.prototype,"showInlineToolbar",null),r.D.prototype.controls.align={name:"left",tooltip:"Align",update(t){const e=t.j,s=t.control,i=e.s.current();if(i){const o=M.i.closest(i,M.i.isBlock,e.editor)||e.editor;let n=""+(0,g.css)(o,"text-align");s.defaultValue&&-1!==s.defaultValue.indexOf(n)&&(n="left"),s.data&&s.data.currentValue!==n&&s.list&&-1!==s.list.indexOf(n)&&(e.o.textIcons?t.state.text=n:t.state.icon.name=n,s.data.currentValue=n)}},isActive(t,e){const s=t.s.current();if(s&&e.defaultValue){const i=M.i.closest(s,M.i.isBlock,t.editor)||t.editor;return-1===e.defaultValue.indexOf(""+(0,g.css)(i,"text-align"))}return!1},defaultValue:["left","start","inherit"],data:{currentValue:"left"},list:["center","left","right","justify"]},r.D.prototype.controls.center={command:"justifyCenter",css:{"text-align":"center"},tooltip:"Align Center"},r.D.prototype.controls.justify={command:"justifyFull",css:{"text-align":"justify"},tooltip:"Align Justify"},r.D.prototype.controls.left={command:"justifyLeft",css:{"text-align":"left"},tooltip:"Align Left"},r.D.prototype.controls.right={command:"justifyRight",css:{"text-align":"right"},tooltip:"Align Right"};const os=(t,e)=>{if(M.i.isNode(e)&&M.i.isElement(e))switch(M.i.each(e,(t=>{M.i.isHTMLElement(t)&&t.style.textAlign&&(t.style.textAlign="",t.style.cssText.trim().length||t.removeAttribute("style"))})),t.toLowerCase()){case"justifyfull":e.style.textAlign="justify";break;case"justifyright":e.style.textAlign="right";break;case"justifyleft":e.style.textAlign="left";break;case"justifycenter":e.style.textAlign="center"}};function ns(t){t.registerButton({name:"align",group:"indent"});const e=e=>(t.s.focus(),t.s.eachSelection((s=>{if(!s)return;let i=M.i.up(s,M.i.isBlock,t.editor);i||(i=M.i.wrapInline(s,t.o.enterBlock,t)),os(e,i)})),!1);t.registerCommand("justifyfull",e),t.registerCommand("justifyright",e),t.registerCommand("justifyleft",e),t.registerCommand("justifycenter",e)}r.D.prototype.limitWords=!1,r.D.prototype.limitChars=!1,r.D.prototype.limitHTML=!1;class rs extends X{afterInit(t){const{limitWords:e,limitChars:s}=t.o;if(t&&(e||s)){let e=null;t.e.off(".limit").on("beforePaste.limit",(()=>{e=t.history.snapshot.make()})).on("keydown.limit keyup.limit beforeEnter.limit beforePaste.limit",this.checkPreventKeyPressOrPaste).on("change.limit",this.checkPreventChanging).on("afterPaste.limit",(()=>{if(this.shouldPreventInsertHTML()&&e)return t.history.snapshot.restore(e),!1}))}}shouldPreventInsertHTML(t=null,e=""){if(t&&a.COMMAND_KEYS.includes(t.key))return!1;const{jodit:s}=this,{limitWords:i,limitChars:o}=s.o,n=this.splitWords(e||(s.o.limitHTML?s.value:s.text));return!(!i||i>n.length)||!!o&&n.join("").length>=o}checkPreventKeyPressOrPaste(t){if(this.shouldPreventInsertHTML(t))return!1}checkPreventChanging(t,e){const{jodit:s}=this,{limitWords:i,limitChars:o}=s.o,n=s.o.limitHTML?t:(0,g.stripTags)(t),r=this.splitWords(n);(i&&r.length>i||o&&r.join("").length>o)&&(s.value=e)}splitWords(t){return t.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((t=>t.length))}beforeDestruct(t){t.e.off(".limit")}}(0,n.gn)([q.autobind],rs.prototype,"checkPreventKeyPressOrPaste",null),(0,n.gn)([q.autobind],rs.prototype,"checkPreventChanging",null),r.D.prototype.defaultLineHeight=null,r.D.prototype.controls.lineHeight={icon:"line-height",command:"applyLineHeight",tags:["ol"],tooltip:"Line height",list:[1,1.1,1.2,1.3,1.4,1.5,2],exec:(t,e,{control:s})=>(0,g.memorizeExec)(t,e,{control:s},(t=>t))};class as extends X{constructor(){super(...arguments),this.buttons=[{name:"lineHeight",group:"font"}]}afterInit(t){(0,g.css)(t.editor,{lineHeight:t.o.defaultLineHeight}),t.registerCommand("applyLineHeight",this.applyLineHeight)}applyLineHeight(t,e,s){const{s:i,createInside:o,editor:n,o:r}=this.j;let a;i.isFocused()||i.focus(),i.save();const l=t=>{let e=M.i.closest(t,M.i.isBlock,n);e||(e=M.i.wrap(t,r.enter,o));const i=(0,g.css)(e,"lineHeight");void 0===a&&(a=""+i!=""+s),(0,g.css)(e,"lineHeight",a?s:null)};try{if(i.isCollapsed()){const t=o.fake();i.insertNode(t,!1,!1),l(t),M.i.safeRemove(t)}else i.eachSelection(l)}finally{i.restore()}}beforeDestruct(t){(0,g.css)(t.editor,{lineHeight:null})}}(0,n.gn)([q.autobind],as.prototype,"applyLineHeight",null);var ls=s(55);r.D.prototype.link={formTemplate(t){const{openInNewTabCheckbox:e,noFollowCheckbox:s,modeClassName:i,selectSizeClassName:o,selectMultipleClassName:n,selectOptionsClassName:r}=t.o.link;return new ls.x4(t,[new ls.eC(t,[new ls.u3(t,{name:"url",type:"text",ref:"url_input",label:"URL",placeholder:"http://",required:!0})]),new ls.eC(t,[new ls.u3(t,{name:"content",ref:"content_input",label:"Text"})],{ref:"content_input_box"}),i?new ls.eC(t,["input"===i?new ls.u3(t,{name:"className",ref:"className_input",label:"Class name"}):"select"===i?new ls.Cj(t,{name:"className",ref:"className_select",label:"Class name",size:o,multiple:n,options:r}):null]):null,e?new ls.mA(t,{name:"target",ref:"target_checkbox",label:"Open in new tab"}):null,s?new ls.mA(t,{name:"nofollow",ref:"nofollow_checkbox",label:"No follow"}):null,new ls.eC(t,[new C.y3(t,{name:"unlink",variant:"default",text:"Unlink"}),new C.y3(t,{name:"insert",type:"submit",variant:"primary",text:"Insert"})],{align:"full"})])},followOnDblClick:!1,processVideoLink:!0,processPastedLink:!0,noFollowCheckbox:!0,openInNewTabCheckbox:!0,modeClassName:"input",selectMultipleClassName:!0,selectSizeClassName:3,selectOptionsClassName:[],hotkeys:["ctrl+k","cmd+k"]},r.D.prototype.controls.unlink={exec(t,e){const s=M.i.closest(e,"a",t.editor);s&&M.i.unwrap(s),t.synchronizeValues(),t.e.fire("hidePopup")},tooltip:"Unlink"},r.D.prototype.controls.link={isActive(t){const e=t.s.current();return!(!e||!M.i.closest(e,"a",t.editor))},popup:(t,e,s,i)=>t.e.fire("generateLinkForm.link",e,i),tags:["a"],tooltip:"Insert link"};class cs extends X{constructor(){super(...arguments),this.buttons=[{name:"link",group:"insert"}]}afterInit(t){t.o.link.followOnDblClick&&t.e.on("dblclick.link",this.onDblClickOnLink),t.o.link.processPastedLink&&t.e.on("processPaste.link",this.onProcessPasteLink),t.e.on("generateLinkForm.link",this.generateForm),t.registerCommand("openLinkDialog",{exec:()=>{const e=new $({resizable:!1}),s=this.generateForm(t.s.current(),(()=>{e.close()}));s.container.classList.add("jodit-dialog_alert"),e.setContent(s),e.open(),t.async.requestIdleCallback((()=>{const{url_input:t}=(0,g.refs)(s.container);null==t||t.focus()}))},hotkeys:t.o.link.hotkeys})}onDblClickOnLink(t){if(!M.i.isTag(t.target,"a"))return;const e=(0,g.attr)(t.target,"href");e&&(location.href=e,t.preventDefault())}onProcessPasteLink(t,e){const{jodit:s}=this;if((0,g.isURL)(e)){if(s.o.link.processVideoLink){const t=(0,g.convertMediaUrlToVideoEmbed)(e);if(t!==e)return s.e.stopPropagation("processPaste"),s.createInside.fromHTML(t)}const t=s.createInside.element("a");return t.setAttribute("href",e),t.textContent=e,s.e.stopPropagation("processPaste"),t}}generateForm(t,e){const{jodit:s}=this,i=s.i18n.bind(s),{openInNewTabCheckbox:o,noFollowCheckbox:n,formTemplate:r,formClassName:a,modeClassName:l}=s.o.link,c=r(s),h=(0,g.isString)(c)?s.c.fromHTML(c,{target_checkbox_box:o,nofollow_checkbox_box:n}):c,d=M.i.isElement(h)?h:h.container,u=(0,g.refs)(d),{insert:p,unlink:f,content_input_box:m}=u,{target_checkbox:v,nofollow_checkbox:b,url_input:w}=u,y=M.i.isImage(t);let{content_input:C}=u;const{className_input:x}=u,{className_select:E}=u;let j;C||(C=s.c.element("input",{type:"hidden",ref:"content_input"})),a&&d.classList.add(a),y&&M.i.hide(m);const S=()=>j?j.innerText:(0,g.stripTags)(s.s.range.cloneContents(),s.ed);if(j=!(!t||!M.i.closest(t,"a",s.editor))&&M.i.closest(t,"a",s.editor),!y&&t&&(C.value=S()),j){if(w.value=(0,g.attr)(j,"href")||"",l)switch(l){case"input":x&&(x.value=(0,g.attr)(j,"class")||"");break;case"select":if(E){for(let t=0;E.selectedOptions.length>t;t++){const e=E.options.item(t);e&&(e.selected=!1)}((0,g.attr)(j,"class")||"").split(" ").forEach((t=>{if(t)for(let e=0;E.options.length>e;e++){const s=E.options.item(e);(null==s?void 0:s.value)&&s.value===t&&(s.selected=!0)}}))}}o&&v&&(v.checked="_blank"===(0,g.attr)(j,"target")),n&&b&&(b.checked="nofollow"===(0,g.attr)(j,"rel")),p.textContent=i("Update")}else M.i.hide(f);s.editor.normalize();const k=s.history.snapshot.make();f&&s.e.on(f,"click",(t=>{s.s.restore(),s.history.snapshot.restore(k),j&&M.i.unwrap(j),s.synchronizeValues(),e(),t.preventDefault()}));const T=()=>{if(!w.value.trim().length)return w.focus(),w.classList.add("jodit_error"),!1;let t;s.s.restore(),s.s.removeMarkers(),s.editor.normalize(),s.history.snapshot.restore(k);const i=S()!==C.value.trim(),r=s.createInside;if(j)t=[j];else{if(s.s.isCollapsed()){const e=r.element("a");s.s.insertNode(e,!1,!1),t=[e]}else{const e=s.s.current();t=M.i.isTag(e,["img"])?[M.i.wrap(e,"a",r)]:s.s.wrapInTag("a")}t.forEach((t=>s.s.select(t)))}return t.forEach((t=>{var e;if((0,g.attr)(t,"href",w.value),l&&(null!=x?x:E))if("input"===l)""===x.value&&t.hasAttribute("class")&&(0,g.attr)(t,"class",null),""!==x.value&&(0,g.attr)(t,"class",x.value);else if("select"===l){t.hasAttribute("class")&&(0,g.attr)(t,"class",null);for(let s=0;E.selectedOptions.length>s;s++){const i=null===(e=E.selectedOptions.item(s))||void 0===e?void 0:e.value;i&&t.classList.add(i)}}if(!y){let e=t.textContent;C.value.trim().length?i&&(e=C.value):e=w.value,e!==t.textContent&&(t.textContent=e)}o&&v&&(0,g.attr)(t,"target",v.checked?"_blank":null),n&&b&&(0,g.attr)(t,"rel",b.checked?"nofollow":null)})),s.synchronizeValues(),e(),!1};return M.i.isElement(h)?s.e.on(h,"submit",(t=>(t.preventDefault(),t.stopImmediatePropagation(),T(),!1))):h.onSubmit(T),h}beforeDestruct(t){t.e.off("generateLinkForm.link",this.generateForm).off("dblclick.link",this.onDblClickOnLink).off("processPaste.link",this.onProcessPasteLink)}}function hs(t){const e="jodit_fake_wrapper",{mediaFakeTag:s,mediaBlocks:i,mediaInFakeBlock:o}=t.options;o&&t.e.on("afterGetValueFromEditor",(t=>{const i=RegExp(`<${s}[^>]+data-${e}[^>]+>([^]+?)`,"ig");i.test(t.value)&&(t.value=t.value.replace(i,"$1"))})).on("change afterInit afterSetMode changePlace",t.async.debounce((()=>{t.isDestructed||t.getMode()===a.MODE_SOURCE||(0,g.$$)(i.join(","),t.editor).forEach((i=>{(0,g.dataBind)(i,e)||((0,g.dataBind)(i,e,!0),(i=>{if(i.parentNode&&(0,g.attr)(i.parentNode,"data-jodit_iframe_wrapper"))i=i.parentNode;else{const o=t.createInside.fromHTML(`<${s} data-jodit-temp="1" contenteditable="false" draggable="true" data-${e}="1">`);(0,g.attr)(o,"style",(0,g.attr)(i,"style")),o.style.display="inline-block"===i.style.display?"inline-block":"block",o.style.width=i.offsetWidth+"px",o.style.height=i.offsetHeight+"px",i.parentNode&&i.parentNode.insertBefore(o,i),o.appendChild(i),i=o}t.e.off(i,"mousedown.select touchstart.select").on(i,"mousedown.select touchstart.select",(()=>{t.s.setCursorAfter(i)}))})(i))}))}),t.defaultTimeout))}function ds(t){t.registerButton({name:"video",group:"media"})}function us(t){t.registerButton({name:"file",group:"media"})}function ps(t){let e=0,s=(0,g.splitArray)(t.o.buttons);t.o.mobileTapTimeout&&t.e.on("touchend",(s=>{if(s.changedTouches&&s.changedTouches.length){const i=(new Date).getTime(),o=i-e;o>t.o.mobileTapTimeout&&(e=i,1.5*t.o.mobileTapTimeout>o&&t.s.insertCursorAtPoint(s.clientX,s.clientY))}})),t.e.on("getDiffButtons.mobile",(e=>{if(e===t.toolbar){const e=(0,F.q)((0,g.splitArray)(t.o.buttons),t),i=(0,F.q)(s,t);return(0,g.toArray)(e).reduce(((t,e)=>(i.has(e)||t.push(e),t)),[])}})),t.o.toolbarAdaptive&&t.e.on("resize afterInit recalcAdaptive changePlace afterAddPlace",(()=>{var e;if(!t.o.toolbar)return;const i=(null!==(e=t.container.parentElement)&&void 0!==e?e:t.container).offsetWidth,o=(0,g.splitArray)(t.o.sizeLG>i?t.o.sizeMD>i?t.o.sizeSM>i?t.o.buttonsXS:t.o.buttonsSM:t.o.buttonsMD:t.o.buttons);""+o!=""+s&&(s=o,t.e.fire("closeAllPopups"),t.toolbar.setRemoveButtons(t.o.removeButtons).build(s.concat(t.o.extraButtons)))})).on(t.ow,"load resize",(()=>t.e.fire("recalcAdaptive")))}(0,n.gn)([q.autobind],cs.prototype,"onDblClickOnLink",null),(0,n.gn)([q.autobind],cs.prototype,"onProcessPasteLink",null),(0,n.gn)([q.autobind],cs.prototype,"generateForm",null),r.D.prototype.mediaFakeTag="jodit-media",r.D.prototype.mediaInFakeBlock=!0,r.D.prototype.mediaBlocks=["video","audio"],r.D.prototype.controls.video={popup(t,e,s,i){const o=new ls.x4(t,[new ls.eC(t,[new ls.u3(t,{name:"url",required:!0,label:"URL",placeholder:"https://",validators:["url"]})]),new ls.eC(t,[(0,C.zx)(t,"","Insert","primary").onAction((()=>o.submit()))])]),n=new ls.x4(t,[new ls.eC(t,[new ls.GJ(t,{name:"code",required:!0,label:"Embed code"})]),new ls.eC(t,[(0,C.zx)(t,"","Insert","primary").onAction((()=>n.submit()))])]),r=[],a=e=>{t.s.restore(),t.s.insertHTML(e),i()};return t.s.save(),r.push({icon:"link",name:"Link",content:o.container},{icon:"source",name:"Code",content:n.container}),o.onSubmit((t=>{a((0,g.convertMediaUrlToVideoEmbed)(t.url))})),n.onSubmit((t=>{a(t.code)})),(0,Le.IL)(t,r)},tags:["iframe"],tooltip:"Insert youtube/vimeo video"},r.D.prototype.controls.file={popup(t,e,s,i){const o=(e,s="")=>{t.s.insertNode(t.createInside.fromHTML(`${s||e}`))};let n=null;return e&&(M.i.isTag(e,"a")||M.i.closest(e,"a",t.editor))&&(n=M.i.isTag(e,"a")?e:M.i.closest(e,"a",t.editor)),(0,Le.ov)(t,{filebrowser(t){t.files&&t.files.forEach((e=>o(t.baseurl+e))),i()},upload:!0,url(t,e){n?(n.setAttribute("href",t),n.setAttribute("title",e)):o(t,e),i()}},n,i,!1)},tags:["a"],tooltip:"Insert file"},r.D.prototype.mobileTapTimeout=300,r.D.prototype.toolbarAdaptive=!0,r.D.prototype.controls.dots={mode:a.MODE_SOURCE+a.MODE_WYSIWYG,popup(t,e,s,i,o){let n=s.data;return void 0===n&&(n={toolbar:O(t),rebuild(){var e;if(o){const s=t.e.fire("getDiffButtons.mobile",o.closest(N.bz));if(s&&n){n.toolbar.build((0,g.splitArray)(s));const i=(null===(e=t.toolbar.firstButton)||void 0===e?void 0:e.container.offsetWidth)||36;n.toolbar.container.style.width=3*(i+4)+"px"}}}},s.data=n),n.rebuild(),n.toolbar},tooltip:"Show all"};var fs=s(12);const ms=(t,e,{control:s})=>{var i;const o="button"+s.command,n=null!==(i=s.args&&s.args[0])&&void 0!==i?i:(0,fs.q)(t,o);(0,fs.q)(t,o,n),t.execCommand(s.command,!1,"default"===n?null:n)};r.D.prototype.controls.ul={command:"insertUnorderedList",tags:["ul"],tooltip:"Insert Unordered List",list:{default:"Default",circle:"Circle",disc:"Dot",square:"Quadrate"},exec:ms},r.D.prototype.controls.ol={command:"insertOrderedList",tags:["ol"],tooltip:"Insert Ordered List",list:{default:"Default","lower-alpha":"Lower Alpha","lower-greek":"Lower Greek","lower-roman":"Lower Roman","upper-alpha":"Upper Alpha","upper-roman":"Upper Roman"},exec:ms};class gs extends X{constructor(){super(...arguments),this.buttons=[{name:"ul",group:"list"},{name:"ol",group:"list"}]}afterInit(t){t.registerCommand("insertUnorderedList",this.onCommand).registerCommand("insertOrderedList",this.onCommand)}onCommand(t,e,s){return this.jodit.s.applyStyle({listStyleType:null!=s?s:null},{element:"insertunorderedlist"===t?"ul":"ol"}),this.jodit.synchronizeValues(),!1}beforeDestruct(t){}}function vs(t){t.o.hidePoweredByJodit||t.o.inline||!(t.o.showCharsCounter||t.o.showWordsCounter||t.o.showXPathInStatusbar)||t.hookStatus("ready",(()=>{t.statusbar.append(t.create.fromHTML('\n\t\t\t\t\t\t\tPowered by Jodit\n\t\t\t\t\t\t'),!0)}))}(0,n.gn)([q.autobind],gs.prototype,"onCommand",null),r.D.prototype.showPlaceholder=!0,r.D.prototype.placeholder="Type something",r.D.prototype.useInputsPlaceholder=!0;class bs extends X{constructor(){super(...arguments),this.addNativeListeners=()=>{this.j.e.off(this.j.editor,"input.placeholder keydown.placeholder").on(this.j.editor,"input.placeholder keydown.placeholder",this.toggle)},this.addEvents=()=>{const t=this.j;t.o.useInputsPlaceholder&&t.element.hasAttribute("placeholder")&&(this.placeholderElm.innerHTML=(0,g.attr)(t.element,"placeholder")||""),t.e.fire("placeholder",this.placeholderElm.innerHTML),t.e.off(".placeholder").on("changePlace.placeholder",this.addNativeListeners).on("change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder mousedown.placeholder afterSetMode.placeholder changePlace.placeholder",this.toggle).on(window,"load",this.toggle),this.addNativeListeners(),this.toggle()}}afterInit(t){t.o.showPlaceholder&&(this.placeholderElm=t.c.fromHTML(``),"rtl"===t.o.direction&&(this.placeholderElm.style.right="0px",this.placeholderElm.style.direction="rtl"),t.e.on("readonly",(t=>{t?this.hide():this.toggle()})).on("changePlace",this.addEvents),this.addEvents())}show(){const t=this.j;if(t.o.readonly)return;let e=0,s=0;const i=t.s.current(),o=i&&M.i.closest(i,M.i.isBlock,t.editor)||t.editor,n=t.ew.getComputedStyle(o);t.workplace.appendChild(this.placeholderElm);const{firstChild:r}=t.editor;if(M.i.isElement(r)&&!zt.Ph.isMarker(r)){const i=t.ew.getComputedStyle(r);e=parseInt(i.getPropertyValue("margin-top"),10),s=parseInt(i.getPropertyValue("margin-left"),10),this.placeholderElm.style.fontSize=parseInt(i.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=i.getPropertyValue("line-height")}else this.placeholderElm.style.fontSize=parseInt(n.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=n.getPropertyValue("line-height");(0,g.css)(this.placeholderElm,{display:"block",textAlign:n.getPropertyValue("text-align"),marginTop:Math.max(parseInt(n.getPropertyValue("margin-top"),10),e),marginLeft:Math.max(parseInt(n.getPropertyValue("margin-left"),10),s)})}hide(){M.i.safeRemove(this.placeholderElm)}toggle(){const t=this.j;t.editor&&!t.isInDestruct&&(t.getRealMode()===a.MODE_WYSIWYG&&(t=>{if(!t.firstChild)return!0;const e=t.firstChild;if(a.MAY_BE_REMOVED_WITH_KEY.test(e.nodeName)||/^(TABLE)$/i.test(e.nodeName))return!1;const s=M.i.next(e,(t=>t&&!M.i.isEmptyTextNode(t)),t);return M.i.isText(e)&&!s?M.i.isEmptyTextNode(e):!s&&M.i.each(e,(t=>!M.i.isTag(t,["ul","li","ol"])&&(M.i.isEmpty(t)||M.i.isTag(t,"br"))))})(t.editor)?this.show():this.hide())}beforeDestruct(t){this.hide(),t.e.off(".placeholder").off(window,"load",this.toggle)}}(0,n.gn)([(0,q.debounce)((t=>t.defaultTimeout/10),!0)],bs.prototype,"toggle",null),r.D.prototype.controls.redo={mode:a.MODE_SPLIT,isDisabled:t=>!t.history.canRedo(),tooltip:"Redo"},r.D.prototype.controls.undo={mode:a.MODE_SPLIT,isDisabled:t=>!t.history.canUndo(),tooltip:"Undo"};class ws extends X{constructor(){super(...arguments),this.buttons=[{name:"undo",group:"history"},{name:"redo",group:"history"}]}beforeDestruct(){}afterInit(t){const e=e=>(t.history[e](),!1);t.registerCommand("redo",{exec:e,hotkeys:["ctrl+y","ctrl+shift+z","cmd+y","cmd+shift+z"]}),t.registerCommand("undo",{exec:e,hotkeys:["ctrl+z","cmd+z"]})}}r.D.prototype.allowResizeTags=["img","iframe","table","jodit"],r.D.prototype.resizer={showSize:!0,hideSizeTimeout:1e3,forImageChangeAttributes:!0,min_width:10,min_height:10};const ys="__jodit-resizer_binded";class Cs extends X{constructor(){super(...arguments),this.LOCK_KEY="resizer",this.element=null,this.isResized=!1,this.isShown=!1,this.start_x=0,this.start_y=0,this.width=0,this.height=0,this.ratio=0,this.rect=this.j.c.fromHTML('
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t100x100\n\t\t\t
'),this.sizeViewer=this.rect.getElementsByTagName("span")[0],this.onResize=t=>{if(this.isResized){if(!this.element)return;let e,s;if(this.j.options.iframe){const i=this.getWorkplacePosition();e=t.clientX+i.left-this.start_x,s=t.clientY+i.top-this.start_y}else e=t.clientX-this.start_x,s=t.clientY-this.start_y;const i=this.handle.className;let o=0,n=0;M.i.isTag(this.element,"img")?(e?(o=this.width+(i.match(/left/)?-1:1)*e,n=Math.round(o/this.ratio)):(n=this.height+(i.match(/top/)?-1:1)*s,o=Math.round(n*this.ratio)),o>(0,g.innerWidth)(this.j.editor,this.j.ow)&&(o=(0,g.innerWidth)(this.j.editor,this.j.ow),n=Math.round(o/this.ratio))):(o=this.width+(i.match(/left/)?-1:1)*e,n=this.height+(i.match(/top/)?-1:1)*s),o>this.j.o.resizer.min_width&&this.applySize(this.element,"width",this.rect.parentNode.offsetWidth>o?o:"100%"),n>this.j.o.resizer.min_height&&this.applySize(this.element,"height",n),this.updateSize(),this.showSizeViewer(this.element.offsetWidth,this.element.offsetHeight),t.stopImmediatePropagation()}},this.onClickOutside=t=>{this.isShown&&(this.isResized?(this.j.unlock(),this.isResized=!1,this.j.synchronizeValues(),t.stopImmediatePropagation(),this.j.e.off(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)):this.hide())},this.onClickElement=t=>{this.isResized||this.element===t&&this.isShown||(this.element=t,this.show(),M.i.isTag(this.element,"img")&&!this.element.complete&&this.j.e.on(this.element,"load",this.updateSize))},this.updateSize=()=>{if(!this.isInDestruct&&this.isShown&&this.element&&this.rect){const t=this.getWorkplacePosition(),e=(0,g.offset)(this.element,this.j,this.j.ed),s=parseInt(this.rect.style.left||"0",10),i=this.rect.offsetWidth,o=this.rect.offsetHeight,n=e.top-t.top,r=e.left-t.left;parseInt(this.rect.style.top||"0",10)===n&&s===r&&i===this.element.offsetWidth&&o===this.element.offsetHeight||((0,g.css)(this.rect,{top:n,left:r,width:this.element.offsetWidth,height:this.element.offsetHeight}),this.j.events&&(this.j.e.fire(this.element,"changesize"),isNaN(s)||this.j.e.fire("resize")))}},this.hideSizeViewer=()=>{this.sizeViewer.style.opacity="0"}}afterInit(t){(0,g.$$)("div",this.rect).forEach((e=>{t.e.on(e,"mousedown.resizer touchstart.resizer",this.onClickHandle.bind(this,e))})),_.TB.on("hideHelpers",this.hide),t.e.on("readonly",(t=>{t&&this.hide()})).on("afterInit changePlace",this.addEventListeners.bind(this)).on("afterGetValueFromEditor.resizer",(t=>{const e=/]+data-jodit_iframe_wrapper[^>]+>(.*?]*>.*?<\/iframe>.*?)<\/jodit>/gi;e.test(t.value)&&(t.value=t.value.replace(e,"$1"))})).on("hideResizer",this.hide).on("change afterInit afterSetMode",this.onChangeEditor),this.addEventListeners(),this.onChangeEditor()}onEditorClick(t){let e=t.target;const{editor:s,options:{allowResizeTags:i}}=this.j;for(;e&&e!==s;){if(M.i.isTag(e,i))return this.bind(e),void this.onClickElement(e);e=e.parentNode}}addEventListeners(){const t=this.j;t.e.off(t.editor,".resizer").off(t.ow,".resizer").on(t.editor,"keydown.resizer",(t=>{this.isShown&&t.key===a.KEY_DELETE&&this.element&&!M.i.isTag(this.element,"table")&&this.onDelete(t)})).on(t.ow,"resize.resizer",this.updateSize).on("resize.resizer",this.updateSize).on(t.ow,"mouseup.resizer keydown.resizer touchend.resizer",this.onClickOutside).on([t.ow,t.editor],"scroll.resizer",(()=>{this.isShown&&!this.isResized&&this.hide()}))}onClickHandle(t,e){if(!this.element||!this.element.parentNode)return this.hide(),!1;this.handle=t,e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.ratio=this.width/this.height,this.isResized=!0,this.start_x=e.clientX,this.start_y=e.clientY,this.j.e.fire("hidePopup"),this.j.lock(this.LOCK_KEY),this.j.e.on(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)}getWorkplacePosition(){return(0,g.offset)(this.rect.parentNode||this.j.od.documentElement,this.j,this.j.od,!0)}applySize(t,e,s){const i=M.i.isImage(t)&&this.j.o.resizer.forImageChangeAttributes;i&&(0,g.attr)(t,e,s),i&&!t.style[e]||(0,g.css)(t,e,s)}onDelete(t){this.element&&("JODIT"!==this.element.tagName?this.j.s.select(this.element):(M.i.safeRemove(this.element),this.hide(),t.preventDefault()))}onChangeEditor(){this.isShown&&(this.element&&this.element.parentNode?this.updateSize():this.hide()),(0,g.$$)("iframe",this.j.editor).forEach(this.bind)}bind(t){if(!M.i.isHTMLElement(t)||(0,g.dataBind)(t,ys))return;let e;if((0,g.dataBind)(t,ys,!0),M.i.isTag(t,"iframe")){const s=t;M.i.isHTMLElement(t.parentNode)&&(0,g.attr)(t.parentNode,"-jodit_iframe_wrapper")?t=t.parentNode:(e=this.j.createInside.fromHTML(''),(0,g.attr)(e,"style",(0,g.attr)(t,"style")),(0,g.css)(e,{display:"inline-block"===t.style.display?"inline-block":"block",width:t.offsetWidth,height:t.offsetHeight}),t.parentNode&&t.parentNode.insertBefore(e,t),e.appendChild(t),t=e),this.j.e.off(t,"mousedown.select touchstart.select").on(t,"mousedown.select touchstart.select",(()=>{this.j.s.select(t)})).off(t,"changesize").on(t,"changesize",(()=>{s.setAttribute("width",t.offsetWidth+"px"),s.setAttribute("height",t.offsetHeight+"px")}))}this.j.e.on(t,"dragstart",this.hide)}showSizeViewer(t,e){this.j.o.resizer.showSize&&(this.sizeViewer.offsetWidth>t||this.sizeViewer.offsetHeight>e?this.hideSizeViewer():(this.sizeViewer.style.opacity="1",this.sizeViewer.textContent=`${t} x ${e}`,this.j.async.setTimeout(this.hideSizeViewer,{timeout:this.j.o.resizer.hideSizeTimeout,label:"hideSizeViewer"})))}show(){this.j.o.readonly||this.isShown||(this.isShown=!0,this.rect.parentNode||((0,g.markOwner)(this.j,this.rect),this.j.workplace.appendChild(this.rect)),this.j.isFullSize&&(this.rect.style.zIndex=""+(0,g.css)(this.j.container,"zIndex")),this.updateSize())}hide(){this.isResized||(this.isResized=!1,this.isShown=!1,this.element=null,M.i.safeRemove(this.rect))}beforeDestruct(t){this.hide(),_.TB.off("hideHelpers",this.hide),t.e.off(this.j.ow,".resizer").off(".resizer")}}(0,n.gn)([(0,q.watch)(":click")],Cs.prototype,"onEditorClick",null),(0,n.gn)([(0,q.debounce)()],Cs.prototype,"onChangeEditor",null),(0,n.gn)([q.autobind],Cs.prototype,"bind",null),(0,n.gn)([q.autobind],Cs.prototype,"hide",null);var xs=s(36);class Es{constructor(t=xs.Q){this.searchIndex=t,this.queue=[],this.value=""}add(t){var e;const s=(null!==(e=t.nodeValue)&&void 0!==e?e:"").toLowerCase();if(!s.length)return;const i=this.value.length;this.queue.push({startIndex:i,endIndex:i+s.length,node:t}),this.value+=s}ranges(t,e=0){const s=[];let i=e,o=0,n=0;do{if([i,o]=this.searchIndex(t,this.value,i),-1!==i){let t,e,r=0,a=0;for(let s=n;this.queue.length>s;s+=1)if(!t&&this.queue[s].endIndex>i&&(t=this.queue[s].node,r=i-this.queue[s].startIndex),t&&this.queue[s].endIndex>=i+o){e=this.queue[s].node,a=i+o-this.queue[s].startIndex,n=s;break}t&&e&&s.push({startContainer:t,startOffset:r,endContainer:e,endOffset:a}),i+=o}}while(-1!==i);return 0===s.length?null:s}}var js=s(42);const Ss="jd-tmp-selection";function ks(t,e,s,i){if(null==t.startContainer.nodeValue||null==t.endContainer.nodeValue)return;const o=s.element("span",{[Ss]:!0}),n=t.startContainer.nodeValue;let r=0;if(0!==t.startOffset){const e=s.text(n.substring(0,t.startOffset));t.startContainer.nodeValue=n.substring(t.startOffset),M.i.before(t.startContainer,e),t.startContainer===t.endContainer&&(r=t.startOffset,t.endOffset-=r),t.startOffset=0}const a=t.endContainer.nodeValue;if(t.endOffset!==a.length){const i=s.text(a.substring(t.endOffset));t.endContainer.nodeValue=a.substring(0,t.endOffset),M.i.after(t.endContainer,i);for(const s of e){if(s.startContainer!==t.endContainer)break;s.startContainer=i,s.startOffset=s.startOffset-t.endOffset-r,s.endContainer===t.endContainer&&(s.endContainer=i,s.endOffset=s.endOffset-t.endOffset-r)}t.endOffset=t.endContainer.nodeValue.length}let l=t.startContainer;do{if(!l)break;if(!M.i.isText(l)||M.i.isElement(c=l.parentNode)&&c.hasAttribute(Ss)||M.i.wrap(l,o.cloneNode(),s),l===t.endContainer)break;let e=l.firstChild||l.nextSibling;if(!e){for(;l&&!l.nextSibling&&l!==i;)l=l.parentNode;e=null==l?void 0:l.nextSibling}l=e}while(l&&l!==i);var c}function Ts(t){return(0,js.$$)(`[${Ss}]`,t)}function Is(t){Ts(t).forEach((t=>M.i.unwrap(t)))}let _s=class extends N.u1{constructor(t){super(t),this.selInfo=null,this._currentIndex=0,this.isOpened=!1;const{query:e,replace:s,cancel:i,next:o,prev:n,replaceBtn:r,current:l,count:c}=(0,g.refs)(this.container);this.queryInput=e,this.replaceInput=s,this.closeButton=i,this.replaceButton=r,this.currentBox=l,this.countBox=c,t.e.on(this.closeButton,"pointerdown",(()=>(this.close(),!1))).on(this.queryInput,"input",(()=>{this.currentIndex=0})).on(this.queryInput,"pointerdown",(()=>{t.s.isFocused()&&(t.s.removeMarkers(),this.selInfo=t.s.save())})).on(this.replaceButton,"pointerdown",(()=>(t.e.fire(this,"pressReplaceButton"),!1))).on(o,"pointerdown",(()=>(t.e.fire("searchNext"),!1))).on(n,"pointerdown",(()=>(t.e.fire("searchPrevious"),!1))).on(this.queryInput,"input",(()=>{this.setMod("empty-query",!(0,g.trim)(this.queryInput.value).length)})).on(this.queryInput,"keydown",this.j.async.debounce((e=>{e.key===a.KEY_ENTER?(e.preventDefault(),e.stopImmediatePropagation(),t.e.fire("searchNext")&&this.close()):t.e.fire(this,"needUpdateCounters")}),this.j.defaultTimeout))}className(){return"UISearch"}render(){return`
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t0/0\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
`}get currentIndex(){return this._currentIndex}set currentIndex(t){this._currentIndex=t,this.currentBox.innerText=""+t}set count(t){this.countBox.innerText=""+t}get query(){return this.queryInput.value}get replace(){return this.replaceInput.value}onEditorKeyDown(t){if(!this.isOpened)return;const{j:e}=this;if(e.getRealMode()===a.MODE_WYSIWYG)switch(t.key){case a.KEY_ESC:this.close();break;case a.KEY_F3:this.queryInput.value&&(e.e.fire(t.shiftKey?"searchPrevious":"searchNext"),t.preventDefault())}}open(t=!1){this.isOpened||(this.j.workplace.appendChild(this.container),this.isOpened=!0),this.calcSticky(this.j.e.fire("getStickyState.sticky")||!1),this.j.e.fire("hidePopup"),this.setMod("replace",t);const e=""+(this.j.s.sel||"");e&&(this.queryInput.value=e),this.setMod("empty-query",!e.length),this.j.e.fire(this,"needUpdateCounters"),e?this.queryInput.select():this.queryInput.focus()}close(){this.isOpened&&(this.j.s.restore(),M.i.safeRemove(this.container),this.isOpened=!1,this.j.e.fire(this,"afterClose"))}calcSticky(t){if(this.isOpened)if(this.setMod("sticky",t),t){const t=(0,g.position)(this.j.toolbarContainer);(0,g.css)(this.container,{top:t.top+t.height,left:t.left+t.width})}else(0,g.css)(this.container,{top:null,left:null})}};(0,n.gn)([(0,q.watch)([":keydown","queryInput:keydown"])],_s.prototype,"onEditorKeyDown",null),(0,n.gn)([q.autobind],_s.prototype,"open",null),(0,n.gn)([q.autobind],_s.prototype,"close",null),(0,n.gn)([(0,q.watch)(":toggleSticky")],_s.prototype,"calcSticky",null),_s=(0,n.gn)([q.component],_s),r.D.prototype.useSearch=!0,r.D.prototype.search={lazyIdleTimeout:0},r.D.prototype.controls.find={tooltip:"Find",icon:"search",exec(t,e,{control:s}){switch(s.args&&s.args[0]){case"findPrevious":t.e.fire("searchPrevious");break;case"findNext":t.e.fire("searchNext");break;case"replace":t.execCommand("openReplaceDialog");break;default:t.execCommand("openSearchDialog")}},list:{search:"Find",findNext:"Find Next",findPrevious:"Find Previous",replace:"Replace"},childTemplate:(t,e,s)=>s};class qs extends X{constructor(){super(...arguments),this.buttons=[{name:"find",group:"search"}],this.previousQuery="",this.drawPromise=null,this.walker=null,this.walkerCount=null,this.cache={},this.wrapFrameRequest=0}get ui(){return new _s(this.j)}async updateCounters(){this.ui.isOpened&&(this.ui.count=await this.calcCounts(this.ui.query))}onPressReplaceButton(){this.findAndReplace(this.ui.query),this.updateCounters()}tryScrollToElement(t){let e=M.i.closest(t,M.i.isElement,this.j.editor);e||(e=M.i.prev(t,M.i.isElement,this.j.editor)),e&&e!==this.j.editor&&(0,g.scrollIntoViewIfNeeded)(e,this.j.editor,this.j.ed)}async calcCounts(t){return this.walkerCount&&this.walkerCount.break(),this.walkerCount=new M.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout}),(await this.find(this.walkerCount,t)).length}async findAndReplace(t){this.walker&&this.walker.break(),this.walker=new M.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout});const e=this.j.s.range,s=await this.find(this.walker,t);let i=this.findCurrentIndexInRanges(s,e);-1===i&&(i=0);const o=s[i];if(o){try{const t=this.j.ed.createRange();t.setStart(o.startContainer,o.startOffset),t.setEnd(o.endContainer,o.endOffset),t.deleteContents();const e=this.j.createInside.text(this.ui.replace);t.insertNode(e),this.j.s.select(e),this.tryScrollToElement(e),this.cache={},this.j.synchronizeValues()}catch(t){}return this.j.e.fire("afterFindAndReplace"),!0}return!1}async findAndSelect(t,e){var s;this.walker&&this.walker.break(),this.walker=new M.b(this.j.async,{timeout:this.j.defaultTimeout});const i=await this.find(this.walker,t);if(!i.length)return!1;this.previousQuery===t&&Ts(this.j.editor).length||(null===(s=this.drawPromise)||void 0===s||s.rejectCallback(),this.j.async.cancelAnimationFrame(this.wrapFrameRequest),Is(this.j.editor),this.drawPromise=this.drawSelectionRanges(i)),this.previousQuery=t;let o=this.ui.currentIndex-1;o=-1===o?0:e?o===i.length-1?0:o+1:0===o?i.length-1:o-1,this.ui.currentIndex=o+1;const n=i[o];if(n){const t=this.j.ed.createRange();try{t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),this.j.s.selectRange(t)}catch(t){}return this.tryScrollToElement(n.startContainer),await this.updateCounters(),await this.drawPromise,this.j.e.fire("afterFindAndSelect"),!0}return!1}findCurrentIndexInRanges(t,e){return t.findIndex((t=>t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.startContainer&&t.endOffset===e.endOffset))}async isValidCache(t){return(await t).every((t=>{var e,s,i,o;return t.startContainer.isConnected&&t.startOffset<=(null!==(s=null===(e=t.startContainer.nodeValue)||void 0===e?void 0:e.length)&&void 0!==s?s:0)&&t.endContainer.isConnected&&t.endOffset<=(null!==(o=null===(i=t.endContainer.nodeValue)||void 0===i?void 0:i.length)&&void 0!==o?o:0)}))}async find(t,e){if(!e.length)return[];const s=this.cache[e];if(s&&await this.isValidCache(s))return s;const i=new Es(this.j.o.search.fuzzySearch);return this.cache[e]=this.j.async.promise((s=>{t.on("break",(()=>{s([])})).on("visit",(t=>(M.i.isText(t)&&i.add(t),!1))).on("end",(()=>{var t;s(null!==(t=i.ranges(e))&&void 0!==t?t:[])})).setWork(this.j.editor)})),this.cache[e]}drawSelectionRanges(t){const{async:e,createInside:s,editor:i}=this.j;e.cancelAnimationFrame(this.wrapFrameRequest);const o=[...t];let n,r=0;return e.promise((t=>{const a=()=>{do{n=o.shift(),n&&ks(n,o,s,i),r+=1}while(n&&5>=r);o.length?this.wrapFrameRequest=e.requestAnimationFrame(a):t()};a()}))}onAfterGetValueFromEditor(t){t.value=t.value.replace(RegExp(`]+${Ss}[^>]+>(.*?)`,"g"),"$1")}afterInit(t){if(t.o.useSearch){const e=this;t.e.on("beforeSetMode.search",(()=>{this.ui.close()})).on(this.ui,"afterClose",(()=>{Is(t.editor),this.ui.currentIndex=0,this.ui.count=0,this.cache={}})).on("click",(()=>{this.ui.currentIndex=0,Is(t.editor)})).on("change.search",(()=>{this.cache={}})).on("keydown.search mousedown.search",t.async.debounce((()=>{this.ui.selInfo&&(t.s.removeMarkers(),this.ui.selInfo=null),this.ui.isOpened&&this.updateCounters()}),t.defaultTimeout)).on("searchNext.search searchPrevious.search",(()=>(this.ui.isOpened||this.ui.open(),e.findAndSelect(e.ui.query,"searchNext"===t.e.current).catch((()=>{}))))).on("search.search",((t,s=!0)=>(this.ui.currentIndex=0,e.findAndSelect(t||"",s).catch((()=>{}))))),t.registerCommand("search",{exec:(t,s,i=!0)=>(s&&e.findAndSelect(s,i).catch((()=>{})),!1)}).registerCommand("openSearchDialog",{exec:()=>(e.ui.open(),!1),hotkeys:["ctrl+f","cmd+f"]}).registerCommand("openReplaceDialog",{exec:()=>(t.o.readonly||e.ui.open(!0),!1),hotkeys:["ctrl+h","cmd+h"]})}}beforeDestruct(t){this.ui.destruct(),t.e.off(".search")}}(0,n.gn)([q.cache],qs.prototype,"ui",null),(0,n.gn)([(0,q.watch)("ui:needUpdateCounters")],qs.prototype,"updateCounters",null),(0,n.gn)([(0,q.watch)("ui:pressReplaceButton")],qs.prototype,"onPressReplaceButton",null),(0,n.gn)([q.autobind],qs.prototype,"findAndReplace",null),(0,n.gn)([q.autobind],qs.prototype,"findAndSelect",null),(0,n.gn)([q.autobind],qs.prototype,"find",null),(0,n.gn)([(0,q.watch)(":afterGetValueFromEditor")],qs.prototype,"onAfterGetValueFromEditor",null);var Ls=s(35);r.D.prototype.select={normalizeSelectionBeforeCutAndCopy:!0};class zs extends X{constructor(){super(...arguments),this.proxyEventsList=["click","mousedown","touchstart","mouseup","touchend"]}afterInit(t){this.proxyEventsList.forEach((e=>{t.e.on(e+".select",this.onStartSelection)}))}beforeDestruct(t){this.proxyEventsList.forEach((e=>{t.e.on(e+".select",this.onStartSelection)}))}onStartSelection(t){const{j:e}=this;let s,i=t.target;for(;void 0===s&&i&&i!==e.editor;)s=e.e.fire((0,Ls.e)(t.type+"_"+i.nodeName.toLowerCase()),i,t),i=i.parentElement;"click"===t.type&&void 0===s&&i===e.editor&&e.e.fire(t.type+"Editor",i,t)}onOutsideClick(t){const e=t.target;M.i.up(e,(t=>t===this.j.editor))||N.u1.closestElement(e,N.GI)||this.j.e.fire("outsideClick",t)}beforeCommandCut(t){const{s:e}=this.j;if("cut"===t&&!e.isCollapsed()){const t=e.current();t&&M.i.isOrContains(this.j.editor,t)&&this.onCopyNormalizeSelectionBound()}}onCopyNormalizeSelectionBound(t){const{s:e,editor:s,o:i}=this.j;i.select.normalizeSelectionBeforeCutAndCopy&&!e.isCollapsed()&&(!t||t.isTrusted&&M.i.isNode(t.target)&&M.i.isOrContains(s,t.target))&&this.jodit.s.expandSelection()}}(0,n.gn)([q.autobind],zs.prototype,"onStartSelection",null),(0,n.gn)([(0,q.watch)("ow:click")],zs.prototype,"onOutsideClick",null),(0,n.gn)([(0,q.watch)([":beforeCommand"])],zs.prototype,"beforeCommandCut",null),(0,n.gn)([(0,q.watch)([":copy",":cut"])],zs.prototype,"onCopyNormalizeSelectionBound",null),r.D.prototype.width="auto",r.D.prototype.minWidth=200,r.D.prototype.maxWidth="100%",r.D.prototype.allowResizeX=!1,r.D.prototype.allowResizeY=!0,r.D.prototype.height="auto",r.D.prototype.minHeight=200,r.D.prototype.maxHeight="auto",r.D.prototype.saveHeightInStorage=!1;let Ms=class extends X{constructor(){super(...arguments),this.isResized=!1,this.start={x:0,y:0,w:0,h:0},this.handle=this.j.c.div("jodit-editor__resize",N.JO.get("resize_handler"))}afterInit(t){const{height:e,width:s,allowResizeX:i}=t.o;let{allowResizeY:o}=t.o;"auto"===e&&"auto"!==s&&(o=!1),"auto"===e&&"auto"===s||!i&&!o||(t.statusbar.setMod("resize-handle",!0),t.e.on("toggleFullSize.resizeHandler",(()=>{this.handle.style.display=t.isFullSize?"none":"block"})).on(this.handle,"mousedown touchstart",this.onHandleResizeStart).on(t.ow,"mouseup touchend",this.onHandleResizeEnd),t.container.appendChild(this.handle))}onHandleResizeStart(t){this.isResized=!0,this.start.x=t.clientX,this.start.y=t.clientY,this.start.w=this.j.container.offsetWidth,this.start.h=this.j.container.offsetHeight,this.j.lock(),this.j.e.on(this.j.ow,"mousemove touchmove",this.onHandleResize),t.preventDefault()}onHandleResize(t){this.isResized&&(this.j.o.allowResizeY&&this.j.e.fire("setHeight",this.start.h+t.clientY-this.start.y),this.j.o.allowResizeX&&this.j.e.fire("setWidth",this.start.w+t.clientX-this.start.x),this.j.e.fire("resize"))}onHandleResizeEnd(){this.isResized&&(this.isResized=!1,this.j.e.off(this.j.ow,"mousemove touchmove",this.onHandleResize),this.j.unlock())}beforeDestruct(){M.i.safeRemove(this.handle),this.j.e.off(this.j.ow,"mouseup touchsend",this.onHandleResizeEnd)}};Ms.requires=["size"],Ms=(0,n.gn)([q.autobind],Ms);let Ns=class extends X{constructor(){super(...arguments),this.resizeWorkspaces=this.j.async.debounce(this.resizeWorkspaceImd,this.j.defaultTimeout,!0)}afterInit(t){t.e.on("setHeight.size",this.setHeight).on("setWidth.size",this.setWidth).on("afterInit.size changePlace.size",this.initialize,void 0,!0).on(t.ow,"load.size",this.resizeWorkspaces).on("afterInit.size resize.size afterUpdateToolbar.size scroll.size afterResize.size",this.resizeWorkspaces).on("toggleFullSize.size toggleToolbar.size",this.resizeWorkspaceImd),this.initialize()}initialize(){const{j:t}=this;if(t.o.inline)return;let{height:e}=t.o;if(t.o.saveHeightInStorage&&"auto"!==e){const s=t.storage.get("height");s&&(e=s)}(0,g.css)(t.editor,{minHeight:"100%"}),(0,g.css)(t.container,{minHeight:t.o.minHeight,maxHeight:t.o.maxHeight,minWidth:t.o.minWidth,maxWidth:t.o.maxWidth}),this.setHeight(e),this.setWidth(t.o.width)}setHeight(t){if((0,g.isNumber)(t)){const{minHeight:e,maxHeight:s}=this.j.o;(0,g.isNumber)(e)&&e>t&&(t=e),(0,g.isNumber)(s)&&t>s&&(t=s)}(0,g.css)(this.j.container,"height",t),this.j.o.saveHeightInStorage&&this.j.storage.set("height",t),this.resizeWorkspaceImd()}setWidth(t){if((0,g.isNumber)(t)){const{minWidth:e,maxWidth:s}=this.j.o;(0,g.isNumber)(e)&&e>t&&(t=e),(0,g.isNumber)(s)&&t>s&&(t=s)}(0,g.css)(this.j.container,"width",t),this.resizeWorkspaceImd()}getNotWorkHeight(){var t,e;return((null===(t=this.j.toolbarContainer)||void 0===t?void 0:t.offsetHeight)||0)+((null===(e=this.j.statusbar)||void 0===e?void 0:e.getHeight())||0)+2}resizeWorkspaceImd(){if(!this.j||this.j.isDestructed||!this.j.o||this.j.o.inline)return;if(!this.j.container||!this.j.container.parentNode)return;const t=((0,g.css)(this.j.container,"minHeight")||0)-this.getNotWorkHeight();if((0,g.isNumber)(t)&&t>0&&([this.j.workplace,this.j.iframe,this.j.editor].map((e=>{e&&(0,g.css)(e,"minHeight",t)})),this.j.e.fire("setMinHeight",t)),(0,g.isNumber)(this.j.o.maxHeight)){const t=this.j.o.maxHeight-this.getNotWorkHeight();[this.j.workplace,this.j.iframe,this.j.editor].map((e=>{e&&(0,g.css)(e,"maxHeight",t)})),this.j.e.fire("setMaxHeight",t)}this.j.container&&(0,g.css)(this.j.workplace,"height","auto"!==this.j.o.height||this.j.isFullSize?this.j.container.offsetHeight-this.getNotWorkHeight():"auto")}beforeDestruct(t){t.e.off(t.ow,"load.size",this.resizeWorkspaces).off(".size")}};(0,n.gn)([q.autobind],Ns.prototype,"resizeWorkspaceImd",null),Ns=(0,n.gn)([q.autobind],Ns),r.D.prototype.beautifyHTML=!a.IS_IE,r.D.prototype.sourceEditor="ace",r.D.prototype.sourceEditorNativeOptions={showGutter:!0,theme:"ace/theme/idle_fingers",mode:"ace/mode/html",wrap:!0,highlightActiveLine:!0},r.D.prototype.sourceEditorCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"],r.D.prototype.beautifyHTMLCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify.min.js","https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify-html.min.js"],r.D.prototype.controls.source={mode:a.MODE_SPLIT,exec(t){t.toggleMode()},isActive:t=>t.getRealMode()===a.MODE_SOURCE,tooltip:"Change mode"};class Ps{constructor(t,e,s,i){this.jodit=t,this.container=e,this.toWYSIWYG=s,this.fromWYSIWYG=i,this.className="",this.isReady=!1}get j(){return this.jodit}onReady(){this.replaceUndoManager(),this.isReady=!0,this.j.e.fire(this,"ready")}onReadyAlways(t){var e;this.isReady?t():null===(e=this.j.events)||void 0===e||e.on(this,"ready",t)}}class Ds extends Ps{constructor(){super(...arguments),this.autosize=this.j.async.debounce((()=>{this.instance.style.height="auto",this.instance.style.height=this.instance.scrollHeight+"px"}),this.j.defaultTimeout)}init(t){this.instance=t.c.element("textarea",{class:"jodit-source__mirror"}),this.container.appendChild(this.instance),t.e.on(this.instance,"mousedown keydown touchstart input",t.async.debounce(this.toWYSIWYG,t.defaultTimeout)).on("setMinHeight.source",(t=>{(0,g.css)(this.instance,"minHeight",t)})).on(this.instance,"change keydown mousedown touchstart input",this.autosize).on("afterSetMode.source",this.autosize).on(this.instance,"mousedown focus",(e=>{t.e.fire(e.type,e)})),this.autosize(),this.onReady()}destruct(){M.i.safeRemove(this.instance)}getValue(){return this.instance.value}setValue(t){this.instance.value=t}insertRaw(t){const e=this.getValue();if(0>this.getSelectionStart())this.setValue(e+t);else{const s=this.getSelectionStart(),i=this.getSelectionEnd();this.setValue(e.substring(0,s)+t+e.substring(i,e.length))}}getSelectionStart(){return this.instance.selectionStart}getSelectionEnd(){return this.instance.selectionEnd}setSelectionRange(t,e=t){this.instance.setSelectionRange(t,e)}focus(){this.instance.focus()}setPlaceHolder(t){this.instance.setAttribute("placeholder",t)}setReadOnly(t){t?this.instance.setAttribute("readonly","true"):this.instance.removeAttribute("readonly")}selectAll(){this.instance.select()}replaceUndoManager(){const{history:t}=this.jodit;this.j.e.on(this.instance,"keydown",(e=>{if((e.ctrlKey||e.metaKey)&&"z"===e.key)return e.shiftKey?t.redo():t.undo(),this.setSelectionRange(this.getValue().length),!1}))}}class Rs extends Ps{constructor(){super(...arguments),this.className="jodit_ace_editor",this.proxyOnBlur=t=>{this.j.e.fire("blur",t)},this.proxyOnFocus=t=>{this.j.e.fire("focus",t)},this.proxyOnMouseDown=t=>{this.j.e.fire("mousedown",t)}}aceExists(){return void 0!==this.j.ow.ace}getLastColumnIndex(t){return this.instance.session.getLine(t).length}getLastColumnIndices(){const t=this.instance.session.getLength(),e=[];let s=0;for(let i=0;t>i;i++)s+=this.getLastColumnIndex(i),i>0&&(s+=1),e[i]=s;return e}getRowColumnIndices(t){const e=this.getLastColumnIndices();if(e[0]>=t)return{row:0,column:t};let s=1;for(let i=1;e.length>i;i++)t>e[i]&&(s=i+1);return{row:s,column:t-e[s-1]-1}}setSelectionRangeIndices(t,e){const s=this.getRowColumnIndices(t),i=this.getRowColumnIndices(e);this.instance.getSelection().setSelectionRange({start:s,end:i})}getIndexByRowColumn(t,e){return this.getLastColumnIndices()[t]-this.getLastColumnIndex(t)+e}init(t){const e=()=>{if(void 0!==this.instance||!this.aceExists())return;const e=this.j.c.div("jodit-source__mirror-fake");this.container.appendChild(e),this.instance=t.ow.ace.edit(e),this.instance.setTheme(t.o.sourceEditorNativeOptions.theme),this.instance.renderer.setShowGutter(t.o.sourceEditorNativeOptions.showGutter),this.instance.getSession().setMode(t.o.sourceEditorNativeOptions.mode),this.instance.setHighlightActiveLine(t.o.sourceEditorNativeOptions.highlightActiveLine),this.instance.getSession().setUseWrapMode(!0),this.instance.setOption("indentedSoftWrap",!1),this.instance.setOption("wrap",t.o.sourceEditorNativeOptions.wrap),this.instance.getSession().setUseWorker(!1),this.instance.$blockScrolling=1/0,this.instance.on("change",this.toWYSIWYG),this.instance.on("focus",this.proxyOnFocus),this.instance.on("mousedown",this.proxyOnMouseDown),this.instance.on("blur",this.proxyOnBlur),t.getRealMode()!==a.MODE_WYSIWYG&&this.setValue(this.getValue());const s=this.j.async.debounce((()=>{t.isInDestruct||(this.instance.setOption("maxLines","auto"!==t.o.height?t.workplace.offsetHeight/this.instance.renderer.lineHeight:1/0),this.instance.resize())}),2*this.j.defaultTimeout);t.e.on("afterResize afterSetMode",s),s(),this.onReady()};t.e.on("afterSetMode",(()=>{t.getRealMode()!==a.MODE_SOURCE&&t.getMode()!==a.MODE_SPLIT||(this.fromWYSIWYG(),e())})),e(),this.aceExists()||(0,g.loadNext)(t,t.o.sourceEditorCDNUrlsJS).then((()=>{t.isInDestruct||e()}))}destruct(){var t,e;this.instance.off("change",this.toWYSIWYG),this.instance.off("focus",this.proxyOnFocus),this.instance.off("mousedown",this.proxyOnMouseDown),this.instance.destroy(),null===(e=null===(t=this.j)||void 0===t?void 0:t.events)||void 0===e||e.off("aceInited.source")}setValue(t){if(!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const e=this.j.e.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}this.instance.setValue(t),this.instance.clearSelection()}getValue(){return this.instance.getValue()}setReadOnly(t){this.instance.setReadOnly(t)}focus(){this.instance.focus()}getSelectionStart(){const t=this.instance.selection.getRange();return this.getIndexByRowColumn(t.start.row,t.start.column)}getSelectionEnd(){const t=this.instance.selection.getRange();return this.getIndexByRowColumn(t.end.row,t.end.column)}selectAll(){this.instance.selection.selectAll()}insertRaw(t){const e=this.instance.selection.getCursor(),s=this.instance.session.insert(e,t);this.instance.selection.setRange({start:e,end:s},!1)}setSelectionRange(t,e){this.setSelectionRangeIndices(t,e)}setPlaceHolder(t){}replaceUndoManager(){const{history:t}=this.jodit;this.instance.commands.addCommand({name:"Undo",bindKey:{win:"Ctrl-Z",mac:"Command-Z"},exec(){t.undo()}}),this.instance.commands.addCommand({name:"Redo",bindKey:{win:"Ctrl-Shift-Z",mac:"Command-Shift-Z"},exec(){t.redo()}})}}function As(t,e,s,i,o){let n;if((0,g.isFunction)(t))n=t(e);else switch(t){case"ace":if(!e.o.shadowRoot){n=new Rs(e,s,i,o);break}default:n=new Ds(e,s,i,o)}return n.init(e),n.onReadyAlways((()=>{n.setReadOnly(e.o.readonly)})),n}class Bs extends X{constructor(){super(...arguments),this.buttons=[{name:"source",group:"source"}],this.__lock=!1,this.__oldMirrorValue="",this.tempMarkerStart="{start-jodit-selection}",this.tempMarkerStartReg=/{start-jodit-selection}/g,this.tempMarkerEnd="{end-jodit-selection}",this.tempMarkerEndReg=/{end-jodit-selection}/g,this.getSelectionStart=()=>{var t,e;return null!==(e=null===(t=this.sourceEditor)||void 0===t?void 0:t.getSelectionStart())&&void 0!==e?e:0},this.getSelectionEnd=()=>{var t,e;return null!==(e=null===(t=this.sourceEditor)||void 0===t?void 0:t.getSelectionEnd())&&void 0!==e?e:0}}onInsertHTML(t){var e;if(!this.j.o.readonly&&!this.j.isEditorMode())return null===(e=this.sourceEditor)||void 0===e||e.insertRaw(t),this.toWYSIWYG(),!1}fromWYSIWYG(t=!1){if(!this.__lock||!0===t){this.__lock=!0;const t=this.j.getEditorValue(!1,"source-consumer");t!==this.getMirrorValue()&&this.setMirrorValue(t),this.__lock=!1}}toWYSIWYG(){if(this.__lock)return;const t=this.getMirrorValue();t!==this.__oldMirrorValue&&(this.__lock=!0,this.j.value=t,this.__lock=!1,this.__oldMirrorValue=t)}getNormalPosition(t,e){for(e=e.replace(/<(script|style|iframe)[^>]*>[^]*?<\/\1>/im,(t=>{let e="";for(let s=0;t.length>s;s+=1)e+=a.INVISIBLE_SPACE;return e}));t>0&&e[t]===a.INVISIBLE_SPACE;)t--;let s=t;for(;s>0;){if(s--,"<"===e[s]&&void 0!==e[s+1]&&e[s+1].match(/[\w/]+/i))return s;if(">"===e[s])return t}return t}clnInv(t){return t.replace(a.INVISIBLE_SPACE_REG_EXP(),"")}onSelectAll(t){var e;if("selectall"===t.toLowerCase()&&this.j.getRealMode()===a.MODE_SOURCE)return null===(e=this.sourceEditor)||void 0===e||e.selectAll(),!1}getMirrorValue(){var t;return(null===(t=this.sourceEditor)||void 0===t?void 0:t.getValue())||""}setMirrorValue(t){var e;null===(e=this.sourceEditor)||void 0===e||e.setValue(t)}setFocusToMirror(){var t;null===(t=this.sourceEditor)||void 0===t||t.focus()}saveSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)this.j.s.save(),this.j.synchronizeValues(),this.fromWYSIWYG(!0);else{if(this.j.o.editHTMLDocumentMode)return;const t=this.getMirrorValue();if(this.getSelectionStart()===this.getSelectionEnd()){const e=this.j.s.marker(!0),s=this.getNormalPosition(this.getSelectionStart(),this.getMirrorValue());this.setMirrorValue(t.substr(0,s)+this.clnInv(e.outerHTML)+t.substr(s))}else{const e=this.j.s.marker(!0),s=this.j.s.marker(!1),i=this.getNormalPosition(this.getSelectionStart(),t),o=this.getNormalPosition(this.getSelectionEnd(),t);this.setMirrorValue(t.substr(0,i)+this.clnInv(e.outerHTML)+t.substr(i,o-i)+this.clnInv(s.outerHTML)+t.substr(o))}this.toWYSIWYG()}}removeSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)return this.__lock=!0,this.j.s.restore(),void(this.__lock=!1);let t=this.getMirrorValue(),e=0,s=0;try{if(t=t.replace(/]+data-jodit-selection_marker=(["'])start\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerStart).replace(/]+data-jodit-selection_marker=(["'])end\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerEnd),!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const e=this.j.e.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}if(e=t.indexOf(this.tempMarkerStart),s=e,t=t.replace(this.tempMarkerStartReg,""),-1!==e){const e=t.indexOf(this.tempMarkerEnd);-1!==e&&(s=e)}t=t.replace(this.tempMarkerEndReg,"")}finally{t=t.replace(this.tempMarkerEndReg,"").replace(this.tempMarkerStartReg,"")}this.setMirrorValue(t),this.setMirrorSelectionRange(e,s),this.toWYSIWYG(),this.setFocusToMirror()}setMirrorSelectionRange(t,e){var s;null===(s=this.sourceEditor)||void 0===s||s.setSelectionRange(t,e)}onReadonlyReact(){var t;null===(t=this.sourceEditor)||void 0===t||t.setReadOnly(this.j.o.readonly)}afterInit(t){if(this.mirrorContainer=t.c.div("jodit-source"),t.workplace.appendChild(this.mirrorContainer),t.e.on("afterAddPlace changePlace afterInit",(()=>{t.workplace.appendChild(this.mirrorContainer)})),this.sourceEditor=As("area",t,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG),this.onReadonlyReact(),t.e.on("placeholder.source",(t=>{var e;null===(e=this.sourceEditor)||void 0===e||e.setPlaceHolder(t)})).on("change.source",this.syncValueFromWYSIWYG).on("beautifyHTML",(t=>t)),t.o.beautifyHTML){const e=()=>{var e;const s=t.ow.html_beautify;return!(!s||t.isInDestruct||(null===(e=t.events)||void 0===e||e.off("beautifyHTML").on("beautifyHTML",(t=>s(t))),0))};e()||(0,g.loadNext)(t,t.o.beautifyHTMLCDNUrlsJS).then(e)}this.syncValueFromWYSIWYG(!0),this.initSourceEditor(t)}syncValueFromWYSIWYG(t=!1){const e=this.j;e.getMode()!==a.MODE_SPLIT&&e.getMode()!==a.MODE_SOURCE||this.fromWYSIWYG(t)}initSourceEditor(t){var e;if("area"!==t.o.sourceEditor){const e=As(t.o.sourceEditor,t,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG);e.onReadyAlways((()=>{var s,i;null===(s=this.sourceEditor)||void 0===s||s.destruct(),this.sourceEditor=e,this.syncValueFromWYSIWYG(!0),null===(i=t.events)||void 0===i||i.fire("sourceEditorReady",t)}))}else null===(e=this.sourceEditor)||void 0===e||e.onReadyAlways((()=>{var e;this.syncValueFromWYSIWYG(!0),null===(e=t.events)||void 0===e||e.fire("sourceEditorReady",t)}))}beforeDestruct(){this.sourceEditor&&(this.sourceEditor.destruct(),delete this.sourceEditor),M.i.safeRemove(this.mirrorContainer)}}(0,n.gn)([(0,q.watch)(":insertHTML.source")],Bs.prototype,"onInsertHTML",null),(0,n.gn)([q.autobind],Bs.prototype,"fromWYSIWYG",null),(0,n.gn)([q.autobind],Bs.prototype,"toWYSIWYG",null),(0,n.gn)([q.autobind],Bs.prototype,"getNormalPosition",null),(0,n.gn)([(0,q.watch)(":beforeCommand.source")],Bs.prototype,"onSelectAll",null),(0,n.gn)([(0,q.watch)(":beforeSetMode.source")],Bs.prototype,"saveSelection",null),(0,n.gn)([(0,q.watch)(":afterSetMode.source")],Bs.prototype,"removeSelection",null),(0,n.gn)([q.autobind],Bs.prototype,"setMirrorSelectionRange",null),(0,n.gn)([(0,q.watch)(":readonly.source")],Bs.prototype,"onReadonlyReact",null),(0,n.gn)([q.autobind],Bs.prototype,"syncValueFromWYSIWYG",null),r.D.prototype.showCharsCounter=!0,r.D.prototype.countHTMLChars=!1,r.D.prototype.showWordsCounter=!0;class Os extends X{constructor(){super(...arguments),this.charCounter=null,this.wordCounter=null,this.reInit=()=>{this.j.o.showCharsCounter&&this.charCounter&&this.j.statusbar.append(this.charCounter,!0),this.j.o.showWordsCounter&&this.wordCounter&&this.j.statusbar.append(this.wordCounter,!0),this.j.e.off("change keyup",this.calc).on("change keyup",this.calc),this.calc()},this.calc=this.j.async.throttle((()=>{const t=this.j.text;if(this.j.o.showCharsCounter&&this.charCounter){const e=this.j.o.countHTMLChars?this.j.value:t.replace((0,a.SPACE_REG_EXP)(),"");this.charCounter.textContent=this.j.i18n("Chars: %d",e.length)}this.j.o.showWordsCounter&&this.wordCounter&&(this.wordCounter.textContent=this.j.i18n("Words: %d",t.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((t=>t.length)).length))}),this.j.defaultTimeout)}afterInit(){this.charCounter=this.j.c.span(),this.wordCounter=this.j.c.span(),this.j.e.on("afterInit changePlace afterAddPlace",this.reInit),this.reInit()}beforeDestruct(){M.i.safeRemove(this.charCounter),M.i.safeRemove(this.wordCounter),this.j.e.off("afterInit changePlace afterAddPlace",this.reInit),this.charCounter=null,this.wordCounter=null}}r.D.prototype.toolbarSticky=!0,r.D.prototype.toolbarDisableStickyForMobile=!0,r.D.prototype.toolbarStickyOffset=0;class Hs extends X{constructor(){super(...arguments),this.isToolbarSticked=!1,this.createDummy=t=>{},this.addSticky=t=>{this.isToolbarSticked||(this.createDummy(t),this.j.container.classList.add("jodit_sticky"),this.isToolbarSticked=!0),(0,g.css)(t,{top:this.j.o.toolbarStickyOffset||null,width:this.j.container.offsetWidth-2})},this.removeSticky=t=>{this.isToolbarSticked&&((0,g.css)(t,{width:"",top:""}),this.j.container.classList.remove("jodit_sticky"),this.isToolbarSticked=!1)}}afterInit(t){t.e.on(t.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).on("getStickyState.sticky",(()=>this.isToolbarSticked))}onScroll(){const{jodit:t}=this,e=t.ow.pageYOffset||t.od.documentElement&&t.od.documentElement.scrollTop||0,s=(0,g.offset)(t.container,t,t.od,!0),i=t.getMode()===a.MODE_WYSIWYG&&e+t.o.toolbarStickyOffset>s.top&&s.top+s.height>e+t.o.toolbarStickyOffset&&!(t.o.toolbarDisableStickyForMobile&&this.isMobile());if(t.o.toolbarSticky&&!0===t.o.toolbar&&this.isToolbarSticked!==i){const e=t.toolbarContainer;e&&(i?this.addSticky(e):this.removeSticky(e)),t.e.fire("toggleSticky",i)}}isMobile(){return this.j&&this.j.options&&this.j.container&&this.j.o.sizeSM>=this.j.container.offsetWidth}beforeDestruct(t){this.dummyBox&&M.i.safeRemove(this.dummyBox),t.e.off(t.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).off(".sticky")}}(0,n.gn)([(0,q.throttle)()],Hs.prototype,"onScroll",null),r.D.prototype.spellcheck=!1,r.D.prototype.controls.spellcheck={isActive(t){return t.o.spellcheck},icon:s(66),name:"spellcheck",command:"toggleSpellcheck",tooltip:"Spellchecking"};class Fs extends X{constructor(){super(...arguments),this.buttons=[{group:"state",name:"spellcheck"}]}afterInit(t){t.e.on("afterInit afterAddPlace prepareWYSIWYGEditor",this.toggleSpellcheck),this.toggleSpellcheck(),t.registerCommand("toggleSpellcheck",(()=>{this.jodit.o.spellcheck=!this.jodit.o.spellcheck,this.toggleSpellcheck(),this.j.e.fire("updateToolbar")}))}toggleSpellcheck(){(0,ge.Lj)(this.jodit.editor,"spellcheck",this.jodit.o.spellcheck)}beforeDestruct(t){}}(0,n.gn)([q.autobind],Fs.prototype,"toggleSpellcheck",null),r.D.prototype.usePopupForSpecialCharacters=!1,r.D.prototype.specialCharacters=["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","‘","’","“","”","–","—","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","»","¬","®","¯","°","²","³","´","µ","¶","·","¸","¹","º","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Ŵ","Ŷ","ŵ","ŷ","‚","‛","„","…","™","►","•","→","⇒","⇔","♦","≈"],r.D.prototype.controls.symbol={icon:"omega",hotkeys:["ctrl+shift+i","cmd+shift+i"],tooltip:"Insert Special Character",popup(t,e,s,i){const o=t.e.fire("generateSpecialCharactersTable.symbols");if(o){if(t.o.usePopupForSpecialCharacters){const e=t.c.div();return e.classList.add("jodit-symbols"),e.appendChild(o),t.e.on(o,"close_dialog",i),e}{V(o,t.i18n("Select Special Character"),void 0,"jodit-symbols").bindDestruct(t);const e=o.querySelector("a");e&&e.focus()}}}};class Ws extends X{constructor(){super(...arguments),this.buttons=[{name:"symbol",group:"insert"}],this.countInRow=17}afterInit(t){t.e.on("generateSpecialCharactersTable.symbols",(()=>{const e=t.c.fromHTML('
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
'),s=e.querySelector(".jodit-symbols__preview"),i=e.querySelector("table").tBodies[0],o=[];for(let e=0;t.o.specialCharacters.length>e;){const s=t.c.element("tr");for(let i=0;this.countInRow>i&&t.o.specialCharacters.length>e;i+=1,e+=1){const n=t.c.element("td"),r=t.c.fromHTML(`${t.o.specialCharacters[e]}`);o.push(r),n.appendChild(r),s.appendChild(n)}i.appendChild(s)}const n=this;return t.e.on(o,"focus",(function(){s.innerHTML=this.innerHTML})).on(o,"mousedown",(function(e){M.i.isTag(this,"a")&&(t.s.focus(),t.s.insertHTML(this.innerHTML),t.e.fire(this,"close_dialog"),e&&e.preventDefault(),e&&e.stopImmediatePropagation())})).on(o,"mouseenter",(function(){M.i.isTag(this,"a")&&this.focus()})).on(o,"keydown",(e=>{const s=e.target;if(M.i.isTag(s,"a")){const i=parseInt((0,ee.Lj)(s,"-index")||"0",10),r=parseInt((0,ee.Lj)(s,"data-index-j")||"0",10);let l;switch(e.key){case a.KEY_UP:case a.KEY_DOWN:l=e.key===a.KEY_UP?i-n.countInRow:i+n.countInRow,void 0===o[l]&&(l=e.key===a.KEY_UP?Math.floor(o.length/n.countInRow)*n.countInRow+r:r,l>o.length-1&&(l-=n.countInRow)),o[l]&&o[l].focus();break;case a.KEY_RIGHT:case a.KEY_LEFT:l=e.key===a.KEY_LEFT?i-1:i+1,void 0===o[l]&&(l=e.key===a.KEY_LEFT?o.length-1:0),o[l]&&o[l].focus();break;case a.KEY_ENTER:t.e.fire(s,"mousedown"),e.stopImmediatePropagation(),e.preventDefault()}}})),e}))}beforeDestruct(t){t.e.off("generateSpecialCharactersTable.symbols")}}r.D.prototype.table={allowCellSelection:!0,selectionCellStyle:"border: 1px double #1e88e5 !important;",allowCellResize:!0,useExtraClassesOptions:!1},r.D.prototype.controls.table={data:{cols:10,rows:10,classList:{"table table-bordered":"Bootstrap Bordered","table table-striped":"Bootstrap Striped","table table-dark":"Bootstrap Dark"}},popup(t,e,s,i,o){const n=s.data&&s.data.rows?s.data.rows:10,r=s.data&&s.data.cols?s.data.cols:10,a=t.c.fromHTML('
'+(()=>{if(!t.o.table.useExtraClassesOptions)return"";const e=[];if(s.data){const t=s.data.classList;Object.keys(t).forEach((s=>{e.push(``)}))}return e.join("")})()+'
'),l=a.querySelectorAll("span")[0],c=a.querySelectorAll("span")[1],h=a.querySelector(".jodit-form__container"),d=a.querySelector(".jodit-form__options"),u=[],p=n*r;for(let e=0;p>e;e+=1)u[e]||u.push(t.c.element("span",{dataIndex:e}));if(t.e.on(h,"mousemove",((t,e)=>{const s=t.target;if(!M.i.isTag(s,"span"))return;const i=void 0===e||isNaN(e)?parseInt((0,ee.Lj)(s,"-index")||"0",10):e||0,o=Math.ceil((i+1)/r),n=i%r+1;for(let t=0;u.length>t;t+=1)u[t].className=t%r+1>n||Math.ceil((t+1)/r)>o?"":"jodit_hovered";c.textContent=""+n,l.textContent=""+o})).on(h,"touchstart mousedown",(e=>{const s=e.target;if(e.preventDefault(),e.stopImmediatePropagation(),!M.i.isTag(s,"span"))return;const o=parseInt((0,ee.Lj)(s,"-index")||"0",10),n=Math.ceil((o+1)/r),a=o%r+1,l=t.createInside,c=l.element("tbody"),h=l.element("table");h.appendChild(c),h.style.width="100%";let u,p,f=null;for(let t=1;n>=t;t+=1){u=l.element("tr");for(let t=1;a>=t;t+=1)p=l.element("td"),f||(f=p),(0,g.css)(p,"width",(100/a).toFixed(4)+"%"),p.appendChild(l.element("br")),u.appendChild(l.text("\n")),u.appendChild(l.text("\t")),u.appendChild(p);c.appendChild(l.text("\n")),c.appendChild(u)}const m=t.s.current();if(m&&t.s.isCollapsed()){const e=M.i.closest(m,M.i.isBlock,t.editor);e&&e!==t.editor&&!e.nodeName.match(/^TD|TH|TBODY|TABLE|THEADER|TFOOTER$/)&&t.s.setCursorAfter(e)}(0,g.$$)("input[type=checkbox]:checked",d).forEach((t=>{t.value.split(/[\s]+/).forEach((t=>{h.classList.add(t)}))})),t.s.insertNode(l.text("\n")),t.s.insertNode(h,!1),f&&(t.s.setCursorIn(f),(0,g.scrollIntoViewIfNeeded)(f,t.editor,t.ed)),i()})),o&&o.parentElement){for(let e=0;n>e;e+=1){const s=t.c.div();for(let t=0;r>t;t+=1)s.appendChild(u[e*r+t]);h.appendChild(s)}u[0]&&(u[0].className="hovered")}return a},tooltip:"Insert table"};const $s="table_processor_observer-resize";class Vs extends X{constructor(){super(...arguments),this.selectMode=!1,this.resizeDelta=0,this.createResizeHandle=()=>{this.resizeHandler||(this.resizeHandler=this.j.c.div("jodit-table-resizer"),this.j.e.on(this.resizeHandler,"mousedown.table touchstart.table",this.onHandleMouseDown).on(this.resizeHandler,"mouseenter.table",(()=>{this.j.async.clearTimeout(this.hideTimeout)})))},this.hideTimeout=0,this.drag=!1,this.minX=0,this.maxX=0,this.startX=0}get module(){return this.j.getInstance("Table",this.j.o)}get isRTL(){return"rtl"===this.j.o.direction}showResizeHandle(){this.j.async.clearTimeout(this.hideTimeout),this.j.workplace.appendChild(this.resizeHandler)}hideResizeHandle(){this.hideTimeout=this.j.async.setTimeout((()=>{M.i.safeRemove(this.resizeHandler)}),{timeout:this.j.defaultTimeout,label:"hideResizer"})}onHandleMouseDown(t){if(this.j.isLocked)return;this.drag=!0,this.j.e.on(this.j.ow,"mouseup.resize-cells touchend.resize-cells",this.onMouseUp).on(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.startX=t.clientX,this.j.lock($s),this.resizeHandler.classList.add("jodit-table-resizer_moved");let e,s=this.workTable.getBoundingClientRect();if(this.minX=0,this.maxX=1e6,null!=this.wholeTable)s=this.workTable.parentNode.getBoundingClientRect(),this.minX=s.left,this.maxX=this.minX+s.width;else{const t=Pt.formalCoordinate(this.workTable,this.workCell,!0);Pt.formalMatrix(this.workTable,((s,i,o)=>{t[1]===o&&(e=s.getBoundingClientRect(),this.minX=Math.max(e.left+a.NEARBY/2,this.minX)),t[1]+(this.isRTL?-1:1)===o&&(e=s.getBoundingClientRect(),this.maxX=Math.min(e.left+e.width-a.NEARBY/2,this.maxX))}))}return!1}onMouseMove(t){if(!this.drag)return;this.j.e.fire("closeAllPopups");let e=t.clientX;const s=(0,g.offset)(this.resizeHandler.parentNode||this.j.od.documentElement,this.j,this.j.od,!0);this.minX>e&&(e=this.minX),e>this.maxX&&(e=this.maxX),this.resizeDelta=e-this.startX+(this.j.o.iframe?s.left:0),this.resizeHandler.style.left=e-(this.j.o.iframe?0:s.left)+"px";const i=this.j.s.sel;i&&i.removeAllRanges()}onMouseUp(t){(this.selectMode||this.drag)&&(this.selectMode=!1,this.j.unlock()),this.resizeHandler&&this.drag&&(this.drag=!1,this.j.e.off(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.resizeHandler.classList.remove("jodit-table-resizer_moved"),this.startX!==t.clientX&&(null==this.wholeTable?this.resizeColumns():this.resizeTable()),this.j.synchronizeValues(),this.j.s.focus())}resizeColumns(){const t=this.resizeDelta,e=[];Pt.setColumnWidthByDelta(this.workTable,Pt.formalCoordinate(this.workTable,this.workCell,!0)[1],t,!0,e);const s=(0,g.call)(this.isRTL?M.i.prev:M.i.next,this.workCell,M.i.isCell,this.workCell.parentNode);Pt.setColumnWidthByDelta(this.workTable,Pt.formalCoordinate(this.workTable,s)[1],-t,!1,e)}resizeTable(){const t=this.resizeDelta*(this.isRTL?-1:1),e=this.workTable.offsetWidth,s=(0,g.getContentWidth)(this.workTable.parentNode,this.j.ew),i=!this.wholeTable;if(this.isRTL?!i:i)this.workTable.style.width=(e+t)/s*100+"%";else{const i=this.isRTL?"marginRight":"marginLeft",o=parseInt(this.j.ew.getComputedStyle(this.workTable)[i]||"0",10);this.workTable.style.width=(e-t)/s*100+"%",this.workTable.style[i]=(o+t)/s*100+"%"}}setWorkCell(t,e=null){this.wholeTable=e,this.workCell=t,this.workTable=M.i.up(t,(t=>M.i.isTag(t,"table")),this.j.editor)}calcHandlePosition(t,e,s=0,i=0){const o=(0,g.offset)(e,this.j,this.j.ed);if(s>a.NEARBY&&o.width-a.NEARBY>s)return void this.hideResizeHandle();const n=(0,g.offset)(this.j.workplace,this.j,this.j.od,!0),r=(0,g.offset)(t,this.j,this.j.ed);if(this.resizeHandler.style.left=(s>a.NEARBY?o.left+o.width:o.left)-n.left+i+"px",Object.assign(this.resizeHandler.style,{height:r.height+"px",top:r.top-n.top+"px"}),this.showResizeHandle(),s>a.NEARBY){const t=(0,g.call)(this.isRTL?M.i.prev:M.i.next,e,M.i.isCell,e.parentNode);this.setWorkCell(e,!!t&&null)}else{const t=(0,g.call)(this.isRTL?M.i.next:M.i.prev,e,M.i.isCell,e.parentNode);this.setWorkCell(t||e,!t||null)}}afterInit(t){t.o.table.allowCellResize&&t.e.off(this.j.ow,".resize-cells").off(".resize-cells").on("change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells",(()=>{(0,g.$$)("table",t.editor).forEach(this.observe)})).on(this.j.ow,"scroll.resize-cells",(()=>{if(!this.drag)return;const e=M.i.up(this.workCell,(t=>M.i.isTag(t,"table")),t.editor);if(e){const t=e.getBoundingClientRect();this.resizeHandler.style.top=t.top+"px"}})).on("beforeSetMode.resize-cells",(()=>{this.module.getAllSelectedCells().forEach((e=>{this.module.removeSelection(e),Pt.normalizeTable(M.i.closest(e,"table",t.editor))}))}))}observe(t){(0,g.dataBind)(t,$s)||((0,g.dataBind)(t,$s,!0),this.j.e.on(t,"mouseleave.resize-cells",(t=>{this.resizeHandler&&this.resizeHandler!==t.relatedTarget&&this.hideResizeHandle()})).on(t,"mousemove.resize-cells touchmove.resize-cells",this.j.async.throttle((e=>{if(this.j.isLocked)return;const s=M.i.up(e.target,M.i.isCell,t);s&&this.calcHandlePosition(t,s,e.offsetX)}),{timeout:this.j.defaultTimeout})),this.createResizeHandle())}beforeDestruct(t){t.events&&(t.e.off(this.j.ow,".resize-cells"),t.e.off(".resize-cells"))}}(0,n.gn)([q.autobind],Vs.prototype,"onHandleMouseDown",null),(0,n.gn)([q.autobind],Vs.prototype,"onMouseMove",null),(0,n.gn)([q.autobind],Vs.prototype,"onMouseUp",null),(0,n.gn)([q.autobind],Vs.prototype,"observe",null);const Ys="table_processor_observer",Us="onMoveTableSelectCell";class Gs extends X{constructor(){super(...arguments),this.requires=["select"],this.selectedCell=null,this.isSelectionMode=!1}get module(){return this.j.getInstance("Table",this.j.o)}afterInit(t){t.o.table.allowCellSelection&&t.e.on("keydown.select-cells",(t=>{t.key===a.KEY_TAB&&this.unselectCells()})).on("beforeCommand.select-cells",this.onExecCommand).on("afterCommand.select-cells",this.onAfterCommand).on(["clickEditor","mousedownTd","mousedownTh","touchstartTd","touchstartTh"].map((t=>t+".select-cells")).join(" "),this.onStartSelection).on("clickTr clickTbody",(()=>{var t;const e=this.module.getAllSelectedCells().length;if(e)return e>1&&(null===(t=this.j.s.sel)||void 0===t||t.removeAllRanges()),!1}))}onStartSelection(t){if(this.j.o.readonly)return;if(this.unselectCells(),t===this.j.editor)return;const e=M.i.closest(t,"table",this.j.editor);return t&&e?(t.firstChild||t.appendChild(this.j.createInside.element("br")),this.isSelectionMode=!0,this.selectedCell=t,this.module.addSelection(t),this.j.e.on(e,"mousemove.select-cells touchmove.select-cells",this.j.async.throttle(this.onMove.bind(this,e),{label:Us,timeout:this.j.defaultTimeout/2})).on(e,"mouseup.select-cells touchend.select-cells",this.onStopSelection.bind(this,e)),!1):void 0}onOutsideClick(){this.selectedCell=null,this.onRemoveSelection()}onChange(){this.j.isLocked||this.isSelectionMode||this.onRemoveSelection()}onMove(t,e){var s;if(this.j.o.readonly&&!this.j.isLocked)return;if(this.j.isLockedNotBy(Ys))return;const i=this.j.ed.elementFromPoint(e.clientX,e.clientY);if(!i)return;const o=M.i.closest(i,["td","th"],t);if(!o||!this.selectedCell)return;o!==this.selectedCell&&this.j.lock(Ys),this.unselectCells();const n=Pt.getSelectedBound(t,[o,this.selectedCell]),r=Pt.formalMatrix(t);for(let t=n[0][0];n[1][0]>=t;t+=1)for(let e=n[0][1];n[1][1]>=e;e+=1)this.module.addSelection(r[t][e]);this.module.getAllSelectedCells().length>1&&(null===(s=this.j.s.sel)||void 0===s||s.removeAllRanges()),this.j.e.fire("hidePopup"),e.stopPropagation(),(()=>{const t=this.j.createInside.fromHTML('
 
');o.appendChild(t),this.j.async.setTimeout((()=>{var e;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}),this.j.defaultTimeout/5)})()}onRemoveSelection(t){var e;if(!(null===(e=null==t?void 0:t.buffer)||void 0===e?void 0:e.actionTrigger)&&!this.selectedCell&&this.module.getAllSelectedCells().length)return this.j.unlock(),this.unselectCells(),void this.j.e.fire("hidePopup","cells");this.isSelectionMode=!1,this.selectedCell=null}onStopSelection(t,e){if(!this.selectedCell)return;this.isSelectionMode=!1,this.j.unlock();const s=this.j.ed.elementFromPoint(e.clientX,e.clientY);if(!s)return;const i=M.i.closest(s,["td","th"],t);if(!i)return;const o=M.i.closest(i,"table",t);if(o&&o!==t)return;const n=Pt.getSelectedBound(t,[i,this.selectedCell]),r=Pt.formalMatrix(t),a=r[n[1][0]][n[1][1]],l=r[n[0][0]][n[0][1]];this.j.e.fire("showPopup",t,(()=>{const t=(0,g.position)(l,this.j),e=(0,g.position)(a,this.j);return{left:t.left,top:t.top,width:e.left-t.left+e.width,height:e.top-t.top+e.height}}),"cells"),(0,g.$$)("table",this.j.editor).forEach((t=>{this.j.e.off(t,"mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells")})),this.j.async.clearTimeout(Us)}unselectCells(t){const e=this.module,s=e.getAllSelectedCells();s.length&&s.forEach((s=>{t&&t===s||e.removeSelection(s)}))}onExecCommand(t){if(/table(splitv|splitg|merge|empty|bin|binrow|bincolumn|addcolumn|addrow)/.test(t)){t=t.replace("table","");const e=this.module.getAllSelectedCells();if(e.length){const[s]=e;if(!s)return;const i=M.i.closest(s,"table",this.j.editor);if(!i)return;switch(t){case"splitv":Pt.splitVertical(i,this.j);break;case"splitg":Pt.splitHorizontal(i,this.j);break;case"merge":Pt.mergeSelected(i,this.j);break;case"empty":e.forEach((t=>M.i.detach(t)));break;case"bin":M.i.safeRemove(i);break;case"binrow":new Set(e.map((t=>t.parentNode))).forEach((t=>{Pt.removeRow(i,t.rowIndex)}));break;case"bincolumn":{const t=new Set;e.reduce(((e,s)=>(t.has(s.cellIndex)||(e.push(s),t.add(s.cellIndex)),e)),[]).forEach((t=>{Pt.removeColumn(i,t.cellIndex)}))}break;case"addcolumnafter":case"addcolumnbefore":Pt.appendColumn(i,s.cellIndex,"addcolumnafter"===t,this.j.createInside);break;case"addrowafter":case"addrowbefore":Pt.appendRow(i,s.parentNode,"addrowafter"===t,this.j.createInside)}}return!1}}onAfterCommand(t){/^justify/.test(t)&&this.module.getAllSelectedCells().forEach((e=>os(t,e)))}beforeDestruct(t){this.onRemoveSelection(),t.e.off(".select-cells")}}function Xs(t){t.e.off(".tableKeyboardNavigation").on("keydown.tableKeyboardNavigation",(e=>{let s,i;if(e.key!==a.KEY_TAB&&e.key!==a.KEY_LEFT&&e.key!==a.KEY_RIGHT&&e.key!==a.KEY_UP&&e.key!==a.KEY_DOWN)return;{if(s=t.s.current(),i=M.i.up(s,(t=>t&&t.nodeName&&/^td|th$/i.test(t.nodeName)),t.editor),!i)return;const o=t.s.range;if(e.key!==a.KEY_TAB&&s!==i&&((e.key===a.KEY_LEFT||e.key===a.KEY_UP)&&(M.i.prev(s,(t=>e.key===a.KEY_UP?M.i.isTag(t,"br"):!!t),i)||e.key!==a.KEY_UP&&M.i.isText(s)&&0!==o.startOffset)||(e.key===a.KEY_RIGHT||e.key===a.KEY_DOWN)&&(M.i.next(s,(t=>e.key===a.KEY_DOWN?M.i.isTag(t,"br"):!!t),i)||e.key!==a.KEY_DOWN&&M.i.isText(s)&&s.nodeValue&&o.startOffset!==s.nodeValue.length)))return}const o=M.i.up(i,(t=>t&&/^table$/i.test(t.nodeName)),t.editor);let n=null;switch(e.key){case a.KEY_TAB:case a.KEY_LEFT:{const s=e.key===a.KEY_LEFT||e.shiftKey?"prev":"next";n=M.i[s](i,(t=>t&&/^td|th$/i.test(t.tagName)),o),n||(Pt.appendRow(o,"next"!==s&&o.querySelector("tr"),"next"===s,t.createInside),n=M.i[s](i,M.i.isCell,o));break}case a.KEY_UP:case a.KEY_DOWN:{let t=0,s=0;const r=Pt.formalMatrix(o,((e,o,n)=>{e===i&&(t=o,s=n)}));e.key===a.KEY_UP?void 0!==r[t-1]&&(n=r[t-1][s]):void 0!==r[t+1]&&(n=r[t+1][s])}}if(n){if(n.firstChild)e.key===a.KEY_TAB?t.s.select(n,!0):t.s.setCursorIn(n,e.key===a.KEY_RIGHT||e.key===a.KEY_DOWN);else{const e=t.createInside.element("br");n.appendChild(e),t.s.setCursorBefore(e)}return!1}}))}function Ks(t){t.registerButton({name:"table",group:"insert"})}(0,n.gn)([q.autobind],Gs.prototype,"onStartSelection",null),(0,n.gn)([(0,q.watch)(":outsideClick")],Gs.prototype,"onOutsideClick",null),(0,n.gn)([(0,q.watch)(":change")],Gs.prototype,"onChange",null),(0,n.gn)([q.autobind],Gs.prototype,"onRemoveSelection",null),(0,n.gn)([q.autobind],Gs.prototype,"onStopSelection",null),(0,n.gn)([q.autobind],Gs.prototype,"onExecCommand",null),(0,n.gn)([q.autobind],Gs.prototype,"onAfterCommand",null);class Zs extends X{constructor(){super(...arguments),this.isOpened=!1,this.delayShowTimeout=0}afterInit(t){this.container=t.c.div("jodit-tooltip"),(0,_.ZO)(this.j,Zs).appendChild(this.container);let e=0;t.e.off(".tooltip").on("showTooltip.tooltip",((s,i)=>{t.async.clearTimeout(e),this.open(s,i)})).on("delayShowTooltip.tooltip",this.delayOpen).on("escape.tooltip",this.close).on("hideTooltip.tooltip change.tooltip scroll.tooltip changePlace.tooltip hidePopup.tooltip closeAllPopups.tooltip",(()=>{this.j.async.clearTimeout(this.delayShowTimeout),e=t.async.setTimeout(this.close,this.j.defaultTimeout)}))}delayOpen(t,e){const s=this.j.o.showTooltipDelay||this.j.defaultTimeout;this.j.async.clearTimeout(this.delayShowTimeout),this.delayShowTimeout=this.j.async.setTimeout((()=>this.open(t,e)),{timeout:s,label:"tooltip"})}open(t,e){this.container.classList.add("jodit-tooltip_visible"),this.container.innerHTML=e,this.isOpened=!0,this.setPosition(t)}setPosition(t){const e=t();(0,g.css)(this.container,{left:e.x,top:e.y})}close(){this.j.async.clearTimeout(this.delayShowTimeout),this.isOpened&&(this.isOpened=!1,this.container.classList.remove("jodit-tooltip_visible"),(0,g.css)(this.container,{left:-5e3}))}beforeDestruct(t){null==t||t.e.off(".tooltip"),this.close(),M.i.safeRemove(this.container)}}(0,n.gn)([q.autobind],Zs.prototype,"delayOpen",null),(0,n.gn)([q.autobind],Zs.prototype,"close",null),r.D.prototype.tab={tabInsideLiInsertNewList:!0};class Js extends X{afterInit(t){}onTab(t){if(t.key===a.KEY_TAB&&(t=>{if(!t.o.tab.tabInsideLiInsertNewList||!t.s.isCollapsed())return!1;const e=t.createInside.fake();t.s.insertNode(e);const s=M.i.closest(e,"li",t.editor);if(s&&t.s.cursorOnTheLeft(s)&&M.i.isTag(s.previousElementSibling,"li")){const i=M.i.closest(s,["ol","ul"],t.editor);if(i){const o=t.createInside.element(i.tagName),n=s.previousElementSibling;return o.appendChild(s),n.appendChild(o),t.s.setCursorAfter(e),M.i.safeRemove(e),!0}}return M.i.safeRemove(e),!1})(this.j))return!1}beforeDestruct(t){}}function Qs(t){t.registerButton({name:"preview"}),t.registerCommand("preview",((e,s,i)=>{const o=new $({language:t.o.language,theme:t.o.theme});o.setSize(1024,600).open("",t.i18n("Preview")).setModal(!0),((t,e,s="px",i=null)=>{const o=((t,e)=>{const s=[];try{(0,g.$$)("img",t.editor).forEach((i=>{const o=[(0,g.attr)(i,"width"),(0,g.attr)(i,"height"),i.src];(0,g.attr)(i,{width:i.offsetWidth+e,height:i.offsetHeight+e});const n=t.createInside.a();t.ed.body.appendChild(n),n.href=i.src,i.src=n.href,M.i.safeRemove(n),s.push((()=>{var t;i.src=null!==(t=o[2])&&void 0!==t?t:"",(0,g.attr)(i,{width:o[0]||null,height:o[1]||null})}))}))}catch(t){throw s.forEach((t=>t())),s.length=0,t}return s})(t,s);try{const n=t.e.fire("beforePreviewBox",e,s);if(null!=n)return n;let r=t.c.div("jodit__preview-box");i&&i.appendChild(r),(0,g.css)(r,{position:"relative",padding:16});const a=t.value||`
${t.i18n("Empty")}
`;if(t.iframe){const e=t.create.element("iframe");(0,g.css)(e,{minWidth:800,minHeight:600,border:0}),r.appendChild(e);const s=e.contentWindow;s&&(t.e.fire("generateDocumentStructure.iframe",s.document,t),r=s.document.body)}else(0,g.css)(r,{minWidth:1024,minHeight:600,border:0});const l=(e,s)=>{const i=(0,g.isString)(s)?t.c.div():s;(0,g.isString)(s)&&(i.innerHTML=s);for(let t=0;i.children.length>t;t+=1){const s=i.children[t],o=e.ownerDocument.createElement(s.nodeName);for(let t=0;s.attributes.length>t;t+=1)(0,g.attr)(o,s.attributes[t].nodeName,s.attributes[t].nodeValue);0===s.children.length||M.i.isTag(s,["table"])?"SCRIPT"===s.nodeName?s.textContent&&(o.textContent=s.textContent):s.innerHTML&&(o.innerHTML=s.innerHTML):l(o,s);try{e.appendChild(o)}catch(t){}}};l(r,a),t.e.fire("afterPreviewBox",r)}finally{o.forEach((t=>t()))}})(t,i,"px",o.getElm("content"))}))}function ti(t){t.registerButton({name:"print"})}(0,n.gn)([(0,q.watch)(":keydown.tab")],Js.prototype,"onTab",null),r.D.prototype.controls.preview={icon:"eye",command:"preview",mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Preview"},r.D.prototype.controls.print={exec(t){const e=t.create.element("iframe");Object.assign(e.style,{position:"fixed",right:0,bottom:0,width:0,height:0,border:0}),(0,_.ZO)(t,r.D).appendChild(e);const s=()=>{t.e.off(t.ow,"mousemove",s),M.i.safeRemove(e)},i=e.contentWindow;if(i){t.e.on(i,"onbeforeunload onafterprint",s).on(t.ow,"mousemove",s),t.o.iframe?(t.e.fire("generateDocumentStructure.iframe",i.document,t),i.document.body.innerHTML=t.value):(i.document.write(''+t.value+""),i.document.close());const e=i.document.createElement("style");e.innerHTML="@media print {\n\t\t\t\t\tbody {\n\t\t\t\t\t\t\t-webkit-print-color-adjust: exact;\n\t\t\t\t\t}\n\t\t\t}",i.document.head.appendChild(e),i.focus(),i.print()}},mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Print"},r.D.prototype.showXPathInStatusbar=!0;class ei extends X{constructor(){super(...arguments),this.onContext=(t,e)=>(this.menu||(this.menu=new E(this.j)),this.menu.show(e.clientX,e.clientY,[{icon:"bin",title:t===this.j.editor?"Clear":"Remove",exec:()=>{t!==this.j.editor?M.i.safeRemove(t):this.j.value="",this.j.synchronizeValues()}},{icon:"select-all",title:"Select",exec:()=>{this.j.s.select(t)}}]),!1),this.onSelectPath=(t,e)=>{this.j.s.focus();const s=(0,g.attr)(e.target,"-path")||"/";if("/"===s)return this.j.execCommand("selectall"),!1;try{const t=this.j.ed.evaluate(s,this.j.editor,null,XPathResult.ANY_TYPE,null).iterateNext();if(t)return this.j.s.select(t),!1}catch(t){}return this.j.s.select(t),!1},this.tpl=(t,e,s,i)=>{const o=this.j.c.fromHTML(`${(0,g.trim)(s)}`),n=o.firstChild;return this.j.e.on(n,"click",this.onSelectPath.bind(this,t)).on(n,"contextmenu",this.onContext.bind(this,t)),o},this.removeSelectAll=()=>{this.selectAllButton&&(this.selectAllButton.destruct(),delete this.selectAllButton)},this.appendSelectAll=()=>{this.removeSelectAll(),this.selectAllButton=H(this.j,{name:"selectall",...this.j.o.controls.selectall}),this.selectAllButton.state.size="tiny",this.container&&this.container.insertBefore(this.selectAllButton.container,this.container.firstChild)},this.calcPathImd=()=>{if(this.isDestructed)return;const t=this.j.s.current();if(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),t){let e,s,i;M.i.up(t,(t=>{t&&this.j.editor!==t&&!M.i.isText(t)&&(e=t.nodeName.toLowerCase(),s=(0,g.getXPathByElement)(t,this.j.editor).replace(/^\//,""),i=this.tpl(t,s,e,this.j.i18n("Select %s",e)),this.container&&this.container.insertBefore(i,this.container.firstChild))}),this.j.editor)}this.appendSelectAll()},this.calcPath=this.j.async.debounce(this.calcPathImd,2*this.j.defaultTimeout)}afterInit(){this.j.o.showXPathInStatusbar&&(this.container=this.j.c.div("jodit-xpath"),this.j.e.off(".xpath").on("mouseup.xpath change.xpath keydown.xpath changeSelection.xpath",this.calcPath).on("afterSetMode.xpath afterInit.xpath changePlace.xpath",(()=>{this.j.o.showXPathInStatusbar&&this.container&&(this.j.statusbar.append(this.container),this.j.getRealMode()===a.MODE_WYSIWYG?this.calcPath():(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),this.appendSelectAll()))})),this.calcPath())}beforeDestruct(){this.j&&this.j.events&&this.j.e.off(".xpath"),this.removeSelectAll(),this.menu&&this.menu.destruct(),M.i.safeRemove(this.container),delete this.menu,delete this.container}}var si=s(67),ii=s(68),oi=s(69),ni=s(70),ri=s(71),ai=s(72),li=s(73),ci=s(74),hi=s(75),di=s(76),ui=s(77),pi=s(78),fi=s(79),mi=s(80),gi=s(81),vi=s(82),bi=s(83),wi=s(84),yi=s(85),Ci=s(86),xi=s(87),Ei=s(88),ji=s(89),Si=s(90),ki=s(91),Ti=s(92),Ii=s(93),_i=s(94),qi=s(95),Li=s(96),zi=s(97),Mi=s(98),Ni=s(99),Pi=s(100),Di=s(101),Ri=s(102),Ai=s(103),Bi=s(104),Oi=s(105),Hi=s(106),Fi=s(107),Wi=s(108),$i=s(109),Vi=s(110),Yi=s(111),Ui=s(112),Gi=s(113),Xi=s(114),Ki=s(115),Zi=s(116),Ji=s(117),Qi=s(118),to=s(119),eo=s(120),so=s(121),io=s(122),oo=s(123),no=s(124),ro=s(125),ao=s(126),lo=s(127),co=s(128),ho=s(129),uo=s(130),po=s(131),fo=s(132),mo=s(133),go=s(134),vo=s(135),bo=s(136),wo=s(137),yo=s(138),Co=s(139),xo=s(140),Eo=s(141),jo=s(142),So=s(143),ko=s(144),To=s(145),Io=s(146),_o=s(147),qo=s(148),Lo=s(149);Object.keys(a).forEach((t=>{Jodit[t]=a[t]}));const zo=t=>"__esModule"!==t;Object.keys(o).filter(zo).forEach((t=>{N.JO.set(t.replace("_","-"),o[t])})),Object.keys(t).filter(zo).forEach((e=>{Jodit.modules[e]=t[e]})),Object.keys(q).filter(zo).forEach((t=>{Jodit.decorators[t]=q[t]})),["Confirm","Alert","Prompt"].forEach((e=>{Jodit[e]=t[e]})),Object.keys(e).filter(zo).forEach((t=>{Jodit.plugins.add(t,e[t])})),Object.keys(Xt).filter(zo).forEach((t=>{Jodit.lang[t]=Xt[t]}))}(),i}()})); \ No newline at end of file +((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}})(self,(function(){return function(){var t=[,function(t,e,s){"use strict";s.d(e,{D:()=>o});var i=s(2);class o{constructor(){this.defaultTimeout=100,this.namespace="",this.safeMode=!1,this.safePluginsList=["about","enter","backspace"],this.license="",this.preset="custom",this.presets={inline:{inline:!0,toolbar:!1,toolbarInline:!0,toolbarInlineForSelection:!0,showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,showPlaceholder:!1}},this.ownerDocument="undefined"!=typeof document?document:null,this.ownerWindow="undefined"!=typeof window?window:null,this.shadowRoot=null,this.styleValues={},this.zIndex=0,this.readonly=!1,this.disabled=!1,this.activeButtonsInReadOnly=["source","fullsize","print","about","dots","selectall"],this.toolbarButtonSize="middle",this.allowTabNavigation=!1,this.inline=!1,this.theme="default",this.saveModeInStorage=!1,this.editorCssClass=!1,this.style=!1,this.triggerChangeEvent=!0,this.direction="",this.language="auto",this.debugLanguage=!1,this.i18n=!1,this.tabIndex=-1,this.toolbar=!0,this.statusbar=!0,this.showTooltip=!0,this.showTooltipDelay=1e3,this.useNativeTooltip=!1,this.enter=i.PARAGRAPH,this.enterBlock="br"!==this.enter?this.enter:i.PARAGRAPH,this.defaultMode=i.MODE_WYSIWYG,this.useSplitMode=!1,this.colors={greyscale:["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF"],palette:["#980000","#FF0000","#FF9900","#FFFF00","#00F0F0","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF"],full:["#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#733554","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"]},this.colorPickerDefaultTab="background",this.imageDefaultWidth=300,this.removeButtons=[],this.disablePlugins=[],this.extraPlugins=[],this.extraButtons=[],this.extraIcons={},this.createAttributes={},this.sizeLG=900,this.sizeMD=700,this.sizeSM=400,this.buttons=[{group:"font-style",buttons:[]},{group:"list",buttons:[]},{group:"font",buttons:[]},"---",{group:"script",buttons:[]},{group:"media",buttons:[]},"\n",{group:"state",buttons:[]},{group:"clipboard",buttons:[]},{group:"insert",buttons:[]},{group:"indent",buttons:[]},{group:"color",buttons:[]},{group:"form",buttons:[]},"---",{group:"history",buttons:[]},{group:"search",buttons:[]},{group:"source",buttons:[]},{group:"other",buttons:[]},{group:"info",buttons:[]}],this.buttonsMD=["bold","italic","|","ul","ol","eraser","|","font","fontsize","---","image","table","|","link","\n","brush","paragraph","align","|","hr","copyformat","fullsize","---","undo","redo","|","dots"],this.buttonsSM=["bold","italic","|","ul","ol","eraser","|","fontsize","brush","paragraph","---","image","table","\n","link","|","align","|","undo","redo","|","copyformat","fullsize","---","dots"],this.buttonsXS=["bold","brush","paragraph","eraser","|","fontsize","---","image","\n","align","undo","redo","|","link","table","---","dots"],this.events={},this.textIcons=!1,this.showBrowserColorPicker=!0}static get defaultOptions(){return o.__defaultOptions||(o.__defaultOptions=new o),o.__defaultOptions}}o.prototype.controls={}},(t,e,s)=>{"use strict";s.r(e),s.d(e,{ACCURACY:()=>T,BASE_PATH:()=>U,BR:()=>_,COMMAND_KEYS:()=>I,EMULATE_DBLCLICK_TIMEOUT:()=>B,INSEPARABLE_TAGS:()=>p,INSERT_AS_HTML:()=>O,INSERT_AS_TEXT:()=>F,INSERT_CLEAR_HTML:()=>H,INSERT_ONLY_TEXT:()=>W,INVISIBLE_SPACE:()=>i,INVISIBLE_SPACE_REG_EXP:()=>n,INVISIBLE_SPACE_REG_EXP_END:()=>r,INVISIBLE_SPACE_REG_EXP_START:()=>a,IS_BLOCK:()=>d,IS_IE:()=>N,IS_INLINE:()=>u,IS_MAC:()=>V,KEY_ALIASES:()=>Y,KEY_BACKSPACE:()=>m,KEY_DELETE:()=>j,KEY_DOWN:()=>x,KEY_ENTER:()=>v,KEY_ESC:()=>b,KEY_F3:()=>S,KEY_LEFT:()=>w,KEY_RIGHT:()=>C,KEY_SPACE:()=>E,KEY_TAB:()=>g,KEY_UP:()=>y,MARKER_CLASS:()=>A,MAY_BE_REMOVED_WITH_KEY:()=>f,MODE_SOURCE:()=>z,MODE_SPLIT:()=>M,MODE_WYSIWYG:()=>L,NBSP_SPACE:()=>o,NEARBY:()=>k,PARAGRAPH:()=>q,SAFE_COUNT_CHANGE_CALL:()=>$,SPACE_REG_EXP:()=>l,SPACE_REG_EXP_END:()=>h,SPACE_REG_EXP_START:()=>c,TEMP_ATTR:()=>G,TEXT_HTML:()=>D,TEXT_PLAIN:()=>P,TEXT_RTF:()=>R});const i="\ufeff",o=" ",n=()=>/[\uFEFF]/g,r=()=>/[\uFEFF]+$/g,a=()=>/^[\uFEFF]+/g,l=()=>/[\s\n\t\r\uFEFF\u200b]+/g,c=()=>/^[\s\n\t\r\uFEFF\u200b]+/g,h=()=>/[\s\n\t\r\uFEFF\u200b]+$/g,d=/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CANVAS|DD|DFN|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[1-6]|HEADER|HGROUP|HR|LI|MAIN|NAV|NOSCRIPT|OUTPUT|P|PRE|RUBY|SCRIPT|STYLE|OBJECT|OL|SECTION|IFRAME|JODIT|JODIT-MEDIA|UL|TR|TD|TH|TBODY|THEAD|TFOOT|TABLE|BODY|HTML|VIDEO)$/i,u=/^(STRONG|SPAN|I|EM|B|SUP|SUB|A|U)$/i,p=["img","br","video","iframe","script","input","textarea","hr","link","jodit","jodit-media"],f=RegExp(`^${p.join("|")}$`,"i"),m="Backspace",g="Tab",v="Enter",b="Escape",w="ArrowLeft",y="ArrowUp",C="ArrowRight",x="ArrowDown",E="Space",j="Delete",S="F3",k=5,T=10,I=[m,j,y,x,C,w,v,b,S,g],_="br",q="p",L=1,z=2,M=3,N="undefined"!=typeof navigator&&(-1!==navigator.userAgent.indexOf("MSIE")||/rv:11.0/i.test(navigator.userAgent)),P=N?"text":"text/plain",D=N?"html":"text/html",R=N?"rtf":"text/rtf",A="jodit-selection_marker",B=300,O="insert_as_html",H="insert_clear_html",F="insert_as_text",W="insert_only_text",$=10,V="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Y={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:V?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},U=(()=>{if("undefined"==typeof document)return"";const t=document.currentScript,e=t=>{const e=t.split("/");return/\.js/.test(e[e.length-1])?e.slice(0,e.length-1).join("/")+"/":t};if(t)return e(t.src);const s=document.querySelectorAll("script[src]");return s&&s.length?e(s[s.length-1].src):window.location.href})(),G="data-jodit-temp"},function(t,e,s){"use strict";s.d(e,{vp:()=>c,DG:()=>o,aN:()=>h.a,rO:()=>i,LO:()=>m});const i="JoditEventDefaultNamespace";class o{constructor(){this.__store={}}get(t,e){if(void 0!==this.__store[e])return this.__store[e][t]}indexOf(t,e,s){const i=this.get(t,e);if(i)for(let t=0;i.length>t;t+=1)if(i[t].originalCallback===s)return t;return!1}namespaces(t=!1){const e=Object.keys(this.__store);return t?e.filter((t=>t!==i)):e}events(t){return this.__store[t]?Object.keys(this.__store[t]):[]}set(t,e,s,i=!1){void 0===this.__store[e]&&(this.__store[e]={}),void 0===this.__store[e][t]&&(this.__store[e][t]=[]),i?this.__store[e][t].unshift(s):this.__store[e][t].push(s)}clear(){this.__store={}}}var n=s(5),r=s(6),a=s(7),l=s(4);class c{constructor(t){this.mutedEvents=new Set,this.__key="__JoditEventEmitterNamespaces",this.doc=document,this.prepareEvent=t=>{t.cancelBubble||(t.type.match(/^touch/)&&t.changedTouches&&t.changedTouches.length&&["clientX","clientY","pageX","pageY"].forEach((e=>{Object.defineProperty(t,e,{value:t.changedTouches[0][e],configurable:!0,enumerable:!0})})),t.originalEvent||(t.originalEvent=t),"paste"===t.type&&void 0===t.clipboardData&&this.doc.defaultView.clipboardData&&Object.defineProperty(t,"clipboardData",{get:()=>this.doc.defaultView.clipboardData,configurable:!0,enumerable:!0}))},this.currents=[],this.__stopped=[],this.isDestructed=!1,t&&(this.doc=t),this.__key+=(new Date).getTime()}mute(t){return this.mutedEvents.add(null!=t?t:"*"),this}isMuted(t){return!(!t||!this.mutedEvents.has(t))||this.mutedEvents.has("*")}unmute(t){return this.mutedEvents.delete(null!=t?t:"*"),this}eachEvent(t,e){t.split(/[\s,]+/).forEach((t=>{const s=t.split(".");e.call(this,s[0],s[1]||i)}))}getStore(t){if(!t)throw(0,l.v)("Need subject");if(void 0===t[this.__key]){const e=new o;Object.defineProperty(t,this.__key,{enumerable:!1,configurable:!0,value:e})}return t[this.__key]}clearStore(t){void 0!==t[this.__key]&&delete t[this.__key]}triggerNativeEvent(t,e){const s=this.doc.createEvent("HTMLEvents");"string"==typeof e?s.initEvent(e,!0,!0):(s.initEvent(e.type,e.bubbles,e.cancelable),["screenX","screenY","clientX","clientY","target","srcElement","currentTarget","timeStamp","which","keyCode"].forEach((t=>{Object.defineProperty(s,t,{value:e[t],enumerable:!0})})),Object.defineProperty(s,"originalEvent",{value:e,enumerable:!0})),t.dispatchEvent(s)}get current(){return this.currents[this.currents.length-1]}on(t,e,s,i=!1){const o=(0,n.H)(t)?this:t,c=(0,n.H)(e)?e:t;let h=s;void 0===h&&(0,r.m)(e)&&(h=e);const d=this.getStore(o);if(!(0,n.H)(c)||""===c)throw(0,l.v)("Need events names");if(!(0,r.m)(h))throw(0,l.v)("Need event handler");if((0,a.k)(o))return o.forEach((t=>{this.on(t,c,h,i)})),this;const u=(0,r.m)(o.addEventListener),p=this;let f=function(t,...e){if(!p.isMuted(t))return h&&h.call(this,...e)};return u&&(f=function(t){if(!p.isMuted(t.type))return p.prepareEvent(t),h&&!1===h.call(this,t)?(t.preventDefault(),t.stopImmediatePropagation(),!1):void 0}),this.eachEvent(c,((t,e)=>{if(""===t)throw(0,l.v)("Need event name");if(!1===d.indexOf(t,e,h)&&(d.set(t,e,{event:t,originalCallback:h,syntheticCallback:f},i),u)){const e=!!["touchstart","touchend","scroll","mousewheel","mousemove","touchmove"].includes(t)&&{passive:!0};o.addEventListener(t,f,e)}})),this}one(t,e,s,i=!1){const o=(0,n.H)(t)?this:t,a=(0,n.H)(e)?e:t;let l=s;void 0===l&&(0,r.m)(e)&&(l=e);const c=(...t)=>(this.off(o,a,c),l(...t));return this.on(o,a,c,i),this}off(t,e,s){const o=(0,n.H)(t)?this:t,a=(0,n.H)(e)?e:t,l=this.getStore(o);let c=s;if(!(0,n.H)(a)||!a)return l.namespaces().forEach((t=>{this.off(o,"."+t)})),this.clearStore(o),this;void 0===c&&(0,r.m)(e)&&(c=e);const h=(0,r.m)(o.removeEventListener),d=t=>{h&&o.removeEventListener(t.event,t.syntheticCallback,!1)},u=(t,e)=>{if(""!==t){const s=l.get(t,e);if(s&&s.length)if((0,r.m)(c)){const i=l.indexOf(t,e,c);!1!==i&&(d(s[i]),s.splice(i,1))}else s.forEach(d),s.length=0}else l.events(e).forEach((t=>{""!==t&&u(t,e)}))};return this.eachEvent(a,((t,e)=>{e===i?l.namespaces().forEach((e=>{u(t,e)})):u(t,e)})),this}stopPropagation(t,e){const s=(0,n.H)(t)?this:t,o=(0,n.H)(t)?t:e;if("string"!=typeof o)throw(0,l.v)("Need event names");const r=this.getStore(s);this.eachEvent(o,((t,e)=>{const o=r.get(t,e);o&&this.__stopped.push(o),e===i&&r.namespaces(!0).forEach((e=>this.stopPropagation(s,t+"."+e)))}))}removeStop(t){if(t){const e=this.__stopped.indexOf(t);-1!==e&&this.__stopped.splice(0,e+1)}}isStopped(t){return void 0!==t&&-1!==this.__stopped.indexOf(t)}fire(t,e,...s){let o,a;const c=(0,n.H)(t)?this:t,h=(0,n.H)(t)?t:e,d=(0,n.H)(t)?[e,...s]:s,u=(0,r.m)(c.dispatchEvent);if(!u&&!(0,n.H)(h))throw(0,l.v)("Need events names");const p=this.getStore(c);return!(0,n.H)(h)&&u?this.triggerNativeEvent(c,e):this.eachEvent(h,((t,e)=>{if(u)this.triggerNativeEvent(c,t);else{const s=p.get(t,e);if(s)try{[...s].every((e=>!this.isStopped(s)&&(this.currents.push(t),a=e.syntheticCallback.call(c,t,...d),this.currents.pop(),void 0!==a&&(o=a),!0)))}finally{this.removeStop(s)}e!==i||u||p.namespaces().filter((t=>t!==e)).forEach((e=>{const s=this.fire.call(this,c,t+"."+e,...d);void 0!==s&&(o=s)}))}})),o}destruct(){this.isDestructed&&(this.isDestructed=!0,this.off(this),this.getStore(this).clear(),delete this[this.__key])}}var h=s(8),d=s(9),u=s(19);const p=Symbol("observable-object");function f(t){return void 0!==t[p]}function m(t){if(f(t))return t;const e={},s={},i=(e,o)=>(0,d.isArray)(e)?(e.map((t=>i(t,o))),t):(s[e]||(s[e]=[]),s[e].push(o),t),o=(i,...n)=>{if((0,d.isArray)(i))i.map((t=>o(t,...n)));else try{!e[i]&&s[i]&&(e[i]=!0,s[i].forEach((e=>e.call(t,...n))))}finally{e[i]=!1}},n=(e,s=[])=>{const r={};f(e)||(Object.defineProperty(e,p,{enumerable:!1,value:!0}),Object.keys(e).forEach((i=>{const a=i,l=s.concat(a).filter((t=>t.length));r[a]=e[a];const c=(0,u.getPropertyDescriptor)(e,a);Object.defineProperty(e,a,{set(e){const s=r[a];if(!(0,d.isFastEqual)(r[a],e)){o(["beforeChange","beforeChange."+l.join(".")],a,e),(0,d.isPlainObject)(e)&&n(e,l),c&&c.set?c.set.call(t,e):r[a]=e;const i=[];o(["change",...l.reduce(((t,e)=>(i.push(e),t.push("change."+i.join(".")),t)),[])],l.join("."),s,(null==e?void 0:e.valueOf)?e.valueOf():e)}},get:()=>c&&c.get?c.get.call(t):r[a],enumerable:!0,configurable:!0}),(0,d.isPlainObject)(r[a])&&n(r[a],l)})),Object.defineProperty(t,"on",{value:i}))};return n(t),t}},(t,e,s)=>{"use strict";function i(t){return new TypeError(t)}s.d(e,{v:()=>i})},(t,e,s)=>{"use strict";function i(t){return"string"==typeof t}s.d(e,{H:()=>i})},(t,e,s)=>{"use strict";function i(t){return"function"==typeof t}s.d(e,{m:()=>i})},(t,e,s)=>{"use strict";function i(t){return Array.isArray(t)}s.d(e,{k:()=>i})},function(t,e,s){"use strict";s.d(e,{a:()=>i});class i{constructor(){this.map=new Map}on(t,e){var s;return this.map.has(t)||this.map.set(t,new Set),null===(s=this.map.get(t))||void 0===s||s.add(e),this}off(t,e){var s;return this.map.has(t)&&(null===(s=this.map.get(t))||void 0===s||s.delete(e)),this}emit(t,...e){var s;let i;return this.map.has(t)&&(null===(s=this.map.get(t))||void 0===s||s.forEach((t=>{i=t(...e)}))),i}}},(t,e,s)=>{"use strict";s.r(e),s.d(e,{$$:()=>i.$$,CamelCaseToKebabCase:()=>c.gP,ConfigFlatten:()=>i.tp,ConfigProto:()=>i.II,LimitedStack:()=>i.lI,appendScript:()=>i.uR,appendScriptAsync:()=>i.JL,appendStyleAsync:()=>i.Nf,applyStyles:()=>d,asArray:()=>o._2,assert:()=>i.hu,attr:()=>i.Lj,browser:()=>i.Xh,buildQuery:()=>i.XP,call:()=>i.RE,callPromise:()=>i.C6,camelCase:()=>c.eV,cleanFromWord:()=>f,clearCenterAlign:()=>i.bI,clearTimeout:()=>n.g,cns:()=>i.H5,colorToHex:()=>a.h,completeUrl:()=>i.WO,convertMediaUrlToVideoEmbed:()=>i.UU,css:()=>i.iv,cssPath:()=>i.iN,ctrlKey:()=>i.kT,dataBind:()=>i.qI,defaultLanguage:()=>i.X9,error:()=>i.vU,fastClone:()=>i.V8,fuzzySearchIndex:()=>c.Qy,get:()=>i.U2,getClassName:()=>i.gj,getContentWidth:()=>C,getScrollParent:()=>x,getXPathByElement:()=>i.BR,hasBrowserColorPicker:()=>r.EO,hasContainer:()=>r.Zt,htmlspecialchars:()=>m,humanSizeToBytes:()=>i.wx,i18n:()=>c.ag,inView:()=>i.jF,innerWidth:()=>E,isArray:()=>r.kJ,isAtom:()=>i.J8,isBoolean:()=>r.jn,isDestructable:()=>r.Z$,isEqual:()=>r.Xy,isFastEqual:()=>r.LP,isFunction:()=>r.mf,isHTML:()=>r.FP,isHtmlFromWord:()=>r.I4,isInitable:()=>r.Gu,isInt:()=>r.GN,isJoditObject:()=>r.Zu,isLicense:()=>r.A1,isNativeFunction:()=>r.QC,isNumber:()=>r.hj,isNumeric:()=>r.kE,isPlainObject:()=>r.PO,isPromise:()=>r.tI,isString:()=>r.HD,isURL:()=>r.PX,isValidName:()=>r.r1,isViewObject:()=>r.f2,isVoid:()=>r.nj,isWindow:()=>r.FJ,kebabCase:()=>c.GL,keepNames:()=>i.kc,keys:()=>i.am,loadImage:()=>i.po,loadNext:()=>i.wY,loadNextStyle:()=>i.GX,markAsAtomic:()=>i.XT,markDeprecated:()=>i.Q8,markOwner:()=>i.MN,memorizeExec:()=>i.u3,nl2br:()=>w,normalizeColor:()=>y.ut,normalizeCssValue:()=>y.Zh,normalizeKeyAliases:()=>y.T2,normalizeLicense:()=>y.Pd,normalizeNode:()=>y.Tz,normalizePath:()=>y.AH,normalizeRelativePath:()=>y.Jf,normalizeSize:()=>y.aC,normalizeUrl:()=>y.D5,offset:()=>j,parseQuery:()=>i.mB,position:()=>S,refs:()=>i.xL,reset:()=>i.mc,resolveElement:()=>i.W2,safeHTML:()=>b,scrollIntoViewIfNeeded:()=>i.n5,set:()=>i.t8,setTimeout:()=>n.i,size:()=>k,splitArray:()=>o.C1,sprintf:()=>c.gB,stringify:()=>c.Pz,stripTags:()=>v,toArray:()=>o.qo,trim:()=>c.fy,trimInv:()=>c.as,ucfirst:()=>c.Ps,val:()=>i.P0});var i=s(10),o=s(43),n=s(56),r=s(20),a=s(40),l=s(16),c=s(34);function h(t){return t.replace(/mso-[a-z-]+:[\s]*[^;]+;/gi,"").replace(/mso-[a-z-]+:[\s]*[^";']+$/gi,"").replace(/border[a-z-]*:[\s]*[^;]+;/gi,"").replace(/([0-9.]+)(pt|cm)/gi,((t,e,s)=>{switch(s.toLowerCase()){case"pt":return(1.328*parseFloat(e)).toFixed(0)+"px";case"cm":return(.02645833*parseFloat(e)).toFixed(0)+"px"}return t}))}function d(t){if(-1===t.indexOf("")+7);const e=document.createElement("iframe");e.style.display="none",document.body.appendChild(e);let s="",o=[];try{const n=e.contentDocument||(e.contentWindow?e.contentWindow.document:null);if(n){n.open(),n.write(t),n.close();try{for(let t=0;n.styleSheets.length>t;t+=1){const e=n.styleSheets[t].cssRules;for(let t=0;e.length>t;t+=1)""!==e[t].selectorText&&(o=(0,i.$$)(e[t].selectorText,n.body),o.forEach((s=>{s.style.cssText=h(e[t].style.cssText+";"+s.style.cssText)})))}}catch(t){}l.i.each(n.body,(t=>{if(l.i.isElement(t)){const e=t,s=e.getAttribute("style");s&&(e.style.cssText=h(s)),e.hasAttribute("style")&&!e.getAttribute("style")&&e.removeAttribute("style")}})),s=n.firstChild?(0,c.fy)(n.body.innerHTML):""}}catch(t){}finally{l.i.safeRemove(e)}return s&&(t=s),(0,c.fy)(t.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g,"").replace(//i);-1!==e&&(t=t.substring(e+20));const s=t.search(//i);return-1!==s&&(t=t.substring(0,s)),t})(s)),e.s.insertHTML(s)}function we(t,e,s,i,o){if(!1===t.e.fire("beforeOpenPasteDialog",e,s,i,o))return;const n=U(`
${t.i18n(e)}
`,t.i18n(s));n.bindDestruct(t),(0,ge.MN)(t,n.container);const r=o.map((({text:e,value:s})=>(0,N.zx)(t,{text:e,name:e.toLowerCase(),tabIndex:0}).onAction((()=>i(s))))),a=(0,N.zx)(t,{text:"Cancel",tabIndex:0});return n.setFooter([...r,a].map((t=>t.onAction((()=>n.close()))))),r[0].focus(),r[0].state.variant="primary",t.e.fire("afterOpenPasteDialog",n,e,s,i,o),n}const ye="clipboard";class Ce{constructor(){this.buttons=[{name:"cut",group:"clipboard"},{name:"copy",group:"clipboard"},{name:"paste",group:"clipboard"},{name:"selectall",group:"clipboard"}]}init(t){var e;null===(e=this.buttons)||void 0===e||e.forEach((e=>t.registerButton(e))),t.e.off("copy.clipboard cut.clipboard").on("copy.clipboard cut.clipboard",(e=>{var s;const i=t.s.html,o=ve(e)||ve(t.ew)||ve(e.originalEvent);o&&(o.setData(a.TEXT_PLAIN,(0,g.stripTags)(i)),o.setData(a.TEXT_HTML,i)),t.buffer.set(ye,i),t.e.fire("pasteStack",{html:i,action:t.o.defaultActionOnPaste}),"cut"===e.type&&(t.s.remove(),t.s.focus()),e.preventDefault(),null===(s=null==t?void 0:t.events)||void 0===s||s.fire("afterCopy",i)}))}destruct(t){var e,s;null===(e=null==t?void 0:t.buffer)||void 0===e||e.set(ye,""),null===(s=null==t?void 0:t.events)||void 0===s||s.off(".clipboard")}}r.D.prototype.askBeforePasteHTML=!0,r.D.prototype.processPasteHTML=!0,r.D.prototype.pasteHTMLActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Insert as Text"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}],r.D.prototype.memorizeChoiceWhenPasteFragment=!1,r.D.prototype.nl2brInPlainText=!0,r.D.prototype.defaultActionOnPaste=a.INSERT_AS_HTML,r.D.prototype.draggableTags=["img","jodit-media","jodit"];const xe="pasteStorage";r.D.prototype.controls.paste={tooltip:"Paste from clipboard",async exec(t,e,{control:s}){if(s.name===xe)return void t.execCommand("showPasteStorage");t.s.focus();let i="",o=!0;if(navigator.clipboard){try{const t=await navigator.clipboard.read();if(t&&t.length){const e=await t[0].getType(a.TEXT_PLAIN);i=await new Response(e).text()}o=!1}catch(t){}if(o)try{i=await navigator.clipboard.readText(),o=!1}catch(t){}}o&&(i=t.buffer.get(ye)||"",o=0===i.length);const n=t.value;o?(t.ed.execCommand("paste"),o=n===t.value,!o&&t.e.fire("afterPaste")):i.length?(be(null,t,i),t.e.fire("afterPaste")):o&&V(t.i18n("Your browser doesn't support direct access to the clipboard."),(()=>{t.s.focus()})).bindDestruct(t)},list:{[xe]:"Paste Storage"},isChildDisabled(t){return 2>t.e.fire("pasteStorageList")}};class Ee extends X{constructor(){super(...arguments),this.pasteStack=new g.LimitedStack(20)}afterInit(t){t.e.on("paste.paste",this.onPaste).on("pasteStack.paste",(t=>this.pasteStack.push(t))),t.o.nl2brInPlainText&&this.j.e.on("processPaste.paste",this.onProcessPasteReplaceNl2Br)}onPaste(t){try{if(!1===this.customPasteProcess(t)||!1===this.j.e.fire("beforePaste",t))return t.preventDefault(),!1;this.defaultPasteProcess(t)}finally{this.j.e.fire("afterPaste",t)}}customPasteProcess(t){if(!this.j.o.processPasteHTML)return;const e=ve(t),s={html:null==e?void 0:e.getData(a.TEXT_HTML),plain:null==e?void 0:e.getData(a.TEXT_PLAIN),rtf:null==e?void 0:e.getData(a.TEXT_RTF)};let i;for(i in s){const e=s[i];if((0,g.isHTML)(e)&&(this.j.e.fire("processHTML",t,e,s)||this.processHTML(t,e)))return!1}}defaultPasteProcess(t){const e=ve(t);let s=(null==e?void 0:e.getData(a.TEXT_HTML))||(null==e?void 0:e.getData(a.TEXT_PLAIN));if(e&&s&&""!==(0,g.trim)(s)){const i=this.j.e.fire("processPaste",t,s,(t=>{const e=t.types;let s="";if((0,x.kJ)(e)||"[object DOMStringList]"==={}.toString.call(e))for(let t=0;e.length>t;t+=1)s+=e[t]+";";else s=(e||a.TEXT_PLAIN)+";";return s})(e));void 0!==i&&(s=i),((0,g.isString)(s)||M.i.isNode(s))&&this.insertByType(t,s,this.j.o.defaultActionOnPaste),t.preventDefault(),t.stopPropagation()}}processHTML(t,e){if(this.j.o.askBeforePasteHTML){if(this.j.o.memorizeChoiceWhenPasteFragment){const s=this.pasteStack.find((t=>t.html===e));if(s)return this.insertByType(t,e,s.action||this.j.o.defaultActionOnPaste),!0}return we(this.j,"Your code is similar to HTML. Keep as HTML?","Paste as HTML",(s=>{this.insertByType(t,e,s)}),this.j.o.pasteHTMLActionList),!0}return!1}insertByType(t,e,s){if(this.pasteStack.push({html:e,action:s}),(0,g.isString)(e))switch(this.j.buffer.set(ye,e),s){case a.INSERT_CLEAR_HTML:e=(0,g.cleanFromWord)(e);break;case a.INSERT_ONLY_TEXT:e=(0,g.stripTags)(e);break;case a.INSERT_AS_TEXT:e=(0,g.htmlspecialchars)(e)}be(t,this.j,e)}onProcessPasteReplaceNl2Br(t,e,s){if(s===a.TEXT_PLAIN+";"&&!(0,g.isHTML)(e))return(0,g.nl2br)(e)}beforeDestruct(t){t.e.off("paste.paste",this.onPaste)}}(0,n.gn)([q.autobind],Ee.prototype,"onPaste",null),(0,n.gn)([q.autobind],Ee.prototype,"onProcessPasteReplaceNl2Br",null),r.D.prototype.askBeforePasteFromWord=!0,r.D.prototype.processPasteFromWord=!0,r.D.prototype.defaultActionOnPasteFromWord=null,r.D.prototype.pasteFromWordActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Clean"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}];class je extends X{afterInit(t){}beforeDestruct(t){}processWordHTML(t,e,s){const{j:i}=this,{processPasteFromWord:o,askBeforePasteFromWord:n,defaultActionOnPasteFromWord:r,defaultActionOnPaste:a,pasteFromWordActionList:l}=i.o;return!(!o||!(0,g.isHtmlFromWord)(e)||(n?we(i,"The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","Word Paste Detected",(i=>{this.insertFromWordByType(t,e,i,s)}),l):this.insertFromWordByType(t,e,r||a,s),0))}insertFromWordByType(t,e,s,i){var o;switch(s){case a.INSERT_AS_HTML:if(e=(0,g.applyStyles)(e),this.j.o.beautifyHTML){const t=null===(o=this.j.events)||void 0===o?void 0:o.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}break;case a.INSERT_AS_TEXT:e=(0,g.cleanFromWord)(e);break;case a.INSERT_ONLY_TEXT:e=(0,g.stripTags)((0,g.cleanFromWord)(e))}be(t,this.j,e)}}(0,n.gn)([(0,q.watch)(":processHTML")],je.prototype,"processWordHTML",null);class Se extends X{constructor(){super(...arguments),this.currentIndex=0,this.list=[],this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.paste=()=>{if(this.j.s.focus(),this.j.s.insertHTML(this.list[this.currentIndex]),0!==this.currentIndex){const t=this.list[0];this.list[0]=this.list[this.currentIndex],this.list[this.currentIndex]=t}this.dialog&&this.dialog.close(),this.j.synchronizeValues(),this.j.e.fire("afterPaste")},this.onKeyDown=t=>{let e=this.currentIndex;-1!==[a.KEY_UP,a.KEY_DOWN,a.KEY_ENTER].indexOf(t.key)&&(t.key===a.KEY_UP&&(0===e?e=this.list.length-1:e-=1),t.key===a.KEY_DOWN&&(e===this.list.length-1?e=0:e+=1),t.key!==a.KEY_ENTER?(e!==this.currentIndex&&this.selectIndex(e),t.stopImmediatePropagation(),t.preventDefault()):this.paste())},this.selectIndex=t=>{this.listBox&&(0,g.toArray)(this.listBox.childNodes).forEach(((e,s)=>{e.classList.remove("jodit_active"),t===s&&this.previewBox&&(e.classList.add("jodit_active"),this.previewBox.innerHTML=this.list[t],e.focus())})),this.currentIndex=t},this.showDialog=()=>{2>this.list.length||(this.dialog||this.createDialog(),this.listBox&&(this.listBox.innerHTML=""),this.previewBox&&(this.previewBox.innerHTML=""),this.list.forEach(((t,e)=>{const s=this.j.c.element("a");s.textContent=e+1+". "+t.replace((0,a.SPACE_REG_EXP)(),""),this.j.e.on(s,"keydown",this.onKeyDown),(0,g.attr)(s,"href","#"),(0,g.attr)(s,"data-index",""+e),(0,g.attr)(s,"tab-index","-1"),this.listBox&&this.listBox.appendChild(s)})),this.dialog&&this.dialog.open(),this.j.async.setTimeout((()=>{this.selectIndex(0)}),100))}}createDialog(){this.dialog=new $({language:this.j.o.language});const t=(0,N.zx)(this.j,"paste","Paste","primary");t.onAction(this.paste);const e=(0,N.zx)(this.j,"","Cancel");e.onAction(this.dialog.close),this.container=this.j.c.div(),this.container.classList.add("jodit-paste-storage"),this.listBox=this.j.c.div(),this.previewBox=this.j.c.div(),this.container.appendChild(this.listBox),this.container.appendChild(this.previewBox),this.dialog.setHeader(this.j.i18n("Choose Content to Paste")),this.dialog.setContent(this.container),this.dialog.setFooter([t,e]),this.j.e.on(this.listBox,"click dblclick",(t=>{const e=t.target;return M.i.isTag(e,"a")&&e.hasAttribute("data-index")&&this.selectIndex(parseInt((0,g.attr)(e,"-index")||"0",10)),"dblclick"===t.type&&this.paste(),!1}))}afterInit(){this.j.e.off("afterCopy.paste-storage").on("pasteStorageList.paste-storage",(()=>this.list.length)).on("afterCopy.paste-storage",(t=>{-1!==this.list.indexOf(t)&&this.list.splice(this.list.indexOf(t),1),this.list.unshift(t),this.list.length>5&&(this.list.length=5)})),this.j.registerCommand("showPasteStorage",{exec:this.showDialog,hotkeys:["ctrl+shift+v","cmd+shift+v"]})}beforeDestruct(){this.dialog&&this.dialog.destruct(),this.j.e.off(".paste-storage"),M.i.safeRemove(this.previewBox),M.i.safeRemove(this.listBox),M.i.safeRemove(this.container),this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.list=[]}}const ke="copyformat",Te=["fontWeight","fontStyle","fontSize","color","margin","padding","borderWidth","borderStyle","borderColor","borderRadius","backgroundColor","textDecorationLine","fontFamily"],Ie=(t,e,s,i)=>{let o=(0,g.css)(s,e);return o===i[e]&&(o=s.parentNode&&s!==t.editor&&s.parentNode!==t.editor?Ie(t,e,s.parentNode,i):void 0),o};function _e(t){t.registerButton({name:"copyformat",group:"clipboard"})}r.D.prototype.controls.copyformat={exec(t,e,{button:s}){if(e){if(t.buffer.exists(ke))t.buffer.delete(ke),t.e.off(t.editor,"mouseup.copyformat");else{const s={},i=M.i.up(e,(t=>t&&!M.i.isText(t)),t.editor)||t.editor,o=t.createInside.span();t.editor.appendChild(o),Te.forEach((t=>{s[t]=(0,g.css)(o,t)})),o!==t.editor&&M.i.safeRemove(o);const n=((t,e,s)=>{const i={};return e&&Te.forEach((o=>{i[o]=Ie(t,o,e,s),o.match(/border(Style|Color)/)&&!i.borderWidth&&(i[o]=void 0)})),i})(t,i,s),r=()=>{t.buffer.delete(ke);const e=t.s.current();e&&(M.i.isTag(e,"img")?(0,g.css)(e,n):t.s.applyStyle(n)),t.e.off(t.editor,"mouseup.copyformat")};t.e.on(t.editor,"mouseup.copyformat",r),t.buffer.set(ke,!0)}s.update()}},isActive:t=>t.buffer.exists(ke),tooltip:"Paint format"};var qe,Le=s(59);function ze(t){t.registerButton({name:"brush",group:"color"});const e=(e,s,i)=>{const o=(0,g.normalizeColor)(i);switch(e){case"background":t.s.applyStyle({backgroundColor:o||""});break;case"forecolor":t.s.applyStyle({color:o||""})}return t.synchronizeValues(),!1};t.registerCommand("forecolor",e).registerCommand("background",e)}r.D.prototype.controls.brush={update(t){const e=(0,g.dataBind)(t,"color"),s=t.j,i=(e,i)=>{i&&i!==""+(0,g.css)(s.editor,e)&&(t.state.icon.fill=i)};if(e){const s=(0,g.dataBind)(t,"color");return void i("color"===s?s:"background-color",e)}const o=s.s.current();if(o&&!t.state.disabled){const t=M.i.closest(o,M.i.isElement,s.editor)||s.editor;i("color",""+(0,g.css)(t,"color")),i("background-color",""+(0,g.css)(t,"background-color"))}t.state.icon.fill="",t.state.activated=!1},popup(t,e,s,i,o){let n="",r="",a=[],l=null;return e&&e!==t.editor&&M.i.isNode(e)&&(M.i.isElement(e)&&t.s.isCollapsed()&&!M.i.isTag(e,["br","hr"])&&(l=e),M.i.up(e,(t=>{if(M.i.isHTMLElement(t)){const e=(0,g.css)(t,"color",!0),s=(0,g.css)(t,"background-color",!0);if(e)return n=""+e,!0;if(s)return r=""+s,!0}}),t.editor)),a=[{name:"Background",content:(0,Le.YW)(t,(e=>{l?l.style.backgroundColor=e:t.execCommand("background",!1,e),(0,g.dataBind)(o,"color",e),(0,g.dataBind)(o,"color-mode","background"),i()}),r)},{name:"Text",content:(0,Le.YW)(t,(e=>{l?l.style.color=e:t.execCommand("forecolor",!1,e),(0,g.dataBind)(o,"color",e),(0,g.dataBind)(o,"color-mode","color"),i()}),n)}],"background"!==t.o.colorPickerDefaultTab&&(a=a.reverse()),(0,Le.IL)(t,a,l)},exec(t,e,{button:s}){const i=(0,g.dataBind)(s,"color-mode"),o=(0,g.dataBind)(s,"color");if(!i)return!1;if(e&&e!==t.editor&&M.i.isNode(e)&&M.i.isElement(e))switch(i){case"color":e.style.color=o;break;case"background":e.style.backgroundColor=o}else t.execCommand("background"===i?i:"forecolor",!1,o)},tooltip:"Fill color or set the text color"};class Me extends X{constructor(){super(...arguments),this.isFragmentFromEditor=!1,this.isCopyMode=!1,this.startDragPoint={x:0,y:0},this.draggable=null,this.bufferRange=null,this.getText=t=>{const e=ve(t);return e?e.getData(a.TEXT_HTML)||e.getData(a.TEXT_PLAIN):null}}afterInit(){this.j.e.on([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}onDragStart(t){let e=t.target;if(this.onDragEnd(),this.isFragmentFromEditor=M.i.isOrContains(this.j.editor,e,!0),this.isCopyMode=!this.isFragmentFromEditor||(0,g.ctrlKey)(t),this.isFragmentFromEditor){const t=this.j.s.sel,e=t&&t.rangeCount?t.getRangeAt(0):null;e&&(this.bufferRange=e.cloneRange())}else this.bufferRange=null;this.startDragPoint.x=t.clientX,this.startDragPoint.y=t.clientY,Tt(e)&&(e=e.querySelector("img")),M.i.isTag(e,"img")&&(this.draggable=e.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",e)),this.addDragListeners()}addDragListeners(){this.j.e.on("dragover",this.onDrag).on("drop.DragAndDrop",this.onDrop).on(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}removeDragListeners(){this.j.e.off("dragover",this.onDrag).off("drop.DragAndDrop",this.onDrop).off(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}onDrag(t){this.draggable&&(this.j.e.fire("hidePopup"),this.j.s.insertCursorAtPoint(t.clientX,t.clientY),t.preventDefault(),t.stopPropagation())}onDragEnd(){this.draggable&&(M.i.safeRemove(this.draggable),this.draggable=null),this.isCopyMode=!1,this.removeDragListeners()}onDrop(t){if(!t.dataTransfer||!t.dataTransfer.files||!t.dataTransfer.files.length){if(!this.isFragmentFromEditor&&!this.draggable)return this.j.e.fire("paste",t),t.preventDefault(),t.stopPropagation(),!1;const e=this.j.s.sel,s=this.bufferRange||(e&&e.rangeCount?e.getRangeAt(0):null);let i=null;if(!this.draggable&&s)i=this.isCopyMode?s.cloneContents():s.extractContents();else if(this.draggable)if(this.isCopyMode){const[t,e]="1"===(0,g.attr)(this.draggable,"-is-file")?["a","href"]:["img","src"];i=this.j.createInside.element(t),i.setAttribute(e,(0,g.attr)(this.draggable,"data-src")||(0,g.attr)(this.draggable,"src")||""),"a"===t&&(i.textContent=(0,g.attr)(i,e)||"")}else i=(0,g.dataBind)(this.draggable,"target");else this.getText(t)&&(i=this.j.createInside.fromHTML(this.getText(t)));e&&e.removeAllRanges(),this.j.s.insertCursorAtPoint(t.clientX,t.clientY),i&&(this.j.s.insertNode(i,!1,!1),s&&i.firstChild&&i.lastChild&&(s.setStartBefore(i.firstChild),s.setEndAfter(i.lastChild),this.j.s.selectRange(s),this.j.e.fire("synchro")),M.i.isTag(i,"img")&&this.j.events&&this.j.e.fire("afterInsertImage",i)),t.preventDefault(),t.stopPropagation()}this.isFragmentFromEditor=!1,this.removeDragListeners()}beforeDestruct(){this.onDragEnd(),this.j.e.off(window,".DragAndDrop").off(".DragAndDrop").off([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}}(0,n.gn)([q.autobind],Me.prototype,"onDragStart",null),(0,n.gn)([(0,q.throttle)((t=>t.j.defaultTimeout/10))],Me.prototype,"onDrag",null),(0,n.gn)([q.autobind],Me.prototype,"onDragEnd",null),(0,n.gn)([q.autobind],Me.prototype,"onDrop",null),(t=>{t[t.IDLE=0]="IDLE",t[t.WAIT_DRAGGING=1]="WAIT_DRAGGING",t[t.DRAGGING=2]="DRAGGING"})(qe||(qe={}));class Ne extends X{constructor(){super(...arguments),this.dragList=[],this.draggable=null,this.isCopyMode=!1,this.diffStep=10,this.startX=0,this.startY=0,this.state=qe.IDLE}afterInit(){this.dragList=this.j.o.draggableTags?(0,g.splitArray)(this.j.o.draggableTags).filter(Boolean).map((t=>t.toLowerCase())):[],this.dragList.length&&this.j.e.on("mousedown dragstart",this.onDragStart)}onDragStart(t){if("dragstart"===t.type&&this.draggable)return!1;if(this.state>qe.IDLE)return;const e=t.target;if(!this.dragList.length||!e)return;const s=t=>!(!t||!this.dragList.includes(t.nodeName.toLowerCase()));let i=M.i.furthest(e,s,this.j.editor)||(s(e)?e:null);i&&(M.i.isTag(i.parentElement,"a")&&i.parentElement.firstChild===i&&i.parentElement.lastChild===i&&(i=i.parentElement),this.startX=t.clientX,this.startY=t.clientY,this.isCopyMode=(0,g.ctrlKey)(t),this.draggable=i.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",i),this.state=qe.WAIT_DRAGGING,this.addDragListeners())}onDrag(t){var e,s;if(!this.draggable||this.state===qe.IDLE)return;const i=t.clientY;if(this.state!==qe.WAIT_DRAGGING||Math.sqrt(Math.pow(t.clientX-this.startX,2)+Math.pow(i-this.startY,2))>=this.diffStep){if(this.state===qe.WAIT_DRAGGING&&(this.j.lock("drag-and-drop-element"),this.state=qe.DRAGGING),this.j.e.fire("hidePopup hideResizer"),!this.draggable.parentNode){const i=(0,g.dataBind)(this.draggable,"target");(0,g.css)(this.draggable,{zIndex:1e13,pointerEvents:"none",pointer:"drag",position:"fixed",opacity:.7,display:"inline-block",left:t.clientX,top:t.clientY,width:null!==(e=null==i?void 0:i.offsetWidth)&&void 0!==e?e:100,height:null!==(s=null==i?void 0:i.offsetHeight)&&void 0!==s?s:100}),(0,_.ZO)(this.j,Ne).appendChild(this.draggable)}(0,g.css)(this.draggable,{left:t.clientX,top:t.clientY}),this.j.s.insertCursorAtPoint(t.clientX,t.clientY)}}onDragEnd(){this.isInDestruct||(this.removeDragListeners(),this.j.unlock(),this.state=qe.IDLE,this.draggable&&(M.i.safeRemove(this.draggable),this.draggable=null))}onDrop(){if(!this.draggable||qe.DRAGGING>this.state)return void this.onDragEnd();let t=(0,g.dataBind)(this.draggable,"target");this.onDragEnd(),this.isCopyMode&&(t=t.cloneNode(!0));const{parentElement:e}=t;this.j.s.insertNode(t,!0,!1),e&&M.i.isEmpty(e)&&!M.i.isTag(e,["td","th"])&&M.i.safeRemove(e),M.i.isTag(t,"img")&&this.j.e&&this.j.e.fire("afterInsertImage",t),this.j.e.fire("synchro")}addDragListeners(){this.j.e.on(this.j.editor,"mousemove",this.onDrag).on("mouseup",this.onDrop).on([this.j.ew,this.ow],"mouseup",this.onDragEnd)}removeDragListeners(){this.j.e.off(this.j.editor,"mousemove",this.onDrag).off("mouseup",this.onDrop).off([this.j.ew,this.ow],"mouseup",this.onDragEnd)}beforeDestruct(){this.onDragEnd(),this.j.e.off("mousedown dragstart",this.onDragStart),this.removeDragListeners()}}(0,n.gn)([q.autobind],Ne.prototype,"onDragStart",null),(0,n.gn)([(0,q.throttle)((t=>t.j.defaultTimeout/10))],Ne.prototype,"onDrag",null),(0,n.gn)([q.autobind],Ne.prototype,"onDragEnd",null),(0,n.gn)([q.autobind],Ne.prototype,"onDrop",null);const Pe=(t,e,s,i)=>{var o;const n=t.createInside.element(s),r=t.createInside.element("br");n.appendChild(r),i&&i.cssText&&n.setAttribute("style",i.cssText),t.s.insertNode(n,!1,!1),t.s.setCursorBefore(r);const a=t.s.createRange();return a.setStartBefore("br"!==s.toLowerCase()?r:n),a.collapse(!0),t.s.selectRange(a),M.i.safeRemove(e),(0,g.scrollIntoViewIfNeeded)(n,t.editor,t.ed),null===(o=t.events)||void 0===o||o.fire("synchro"),n};class De extends X{constructor(){super(...arguments),this.brMode=!1,this.defaultTag=a.PARAGRAPH}afterInit(t){this.defaultTag=t.o.enter.toLowerCase(),this.brMode=this.defaultTag===a.BR.toLowerCase(),t.o.enterBlock||(t.o.enterBlock=this.brMode?a.PARAGRAPH:this.defaultTag),t.e.off(".enter").on("keydown.enter",(e=>{if(e.key===a.KEY_ENTER){const s=t.e.fire("beforeEnter",e);return void 0!==s?s:(t.s.isCollapsed()||t.execCommand("Delete"),t.s.focus(),this.onEnter(e),!1)}}))}onEnter(t){const e=this.j,s=e.selection,i=this.defaultTag;let o=s.current(!1);o&&o!==e.editor||(o=e.createInside.text(a.INVISIBLE_SPACE),s.insertNode(o),s.select(o));let n=this.getBlockWrapper(o);const r=M.i.isTag(n,"li");if((!r||t.shiftKey)&&!this.checkBR(o,t.shiftKey))return!1;if(n||this.hasPreviousBlock(o)||(n=this.wrapText(o)),!n||n===o)return Pe(e,null,r?"li":i),!1;if(!this.checkUnsplittableBox(n))return!1;if(r&&M.i.isEmpty(n))return this.enterInsideEmptyLIelement(n),!1;const l=n.tagName.toLowerCase()===this.defaultTag||r,c=s.cursorOnTheRight(n),h=s.cursorOnTheLeft(n);if(!l&&(c||h)){let t=null;return t=c?s.setCursorAfter(n):s.setCursorBefore(n),Pe(e,t,this.defaultTag),void(h&&!c&&s.setCursorIn(n,!0))}s.splitSelection(n)}getBlockWrapper(t,e=a.IS_BLOCK){let s=t;const i=this.j.editor;do{if(!s||s===i)break;if(e.test(s.nodeName))return M.i.isTag(s,"li")?s:this.getBlockWrapper(s.parentNode,/^li$/i)||s;s=s.parentNode}while(s&&s!==i);return null}checkBR(t,e){const s=M.i.closest(t,["pre","blockquote"],this.j.editor);if(this.brMode||e&&!s||!e&&s){const t=this.j.createInside.element("br");return this.j.s.insertNode(t,!0),(0,g.scrollIntoViewIfNeeded)(t,this.j.editor,this.j.ed),!1}return!0}wrapText(t){let e=t;M.i.up(e,(t=>{t&&t.hasChildNodes()&&t!==this.j.editor&&(e=t)}),this.j.editor);const s=M.i.wrapInline(e,this.j.o.enter,this.j);if(M.i.isEmpty(s)){const t=this.j.createInside.element("br");s.appendChild(t),this.j.s.setCursorBefore(t)}return s}hasPreviousBlock(t){return!!M.i.prev(t,(t=>M.i.isBlock(t)||M.i.isImage(t)),this.j.editor)}checkUnsplittableBox(t){const e=this.j,s=e.selection;if(!M.i.canSplitBlock(t)){const t=e.createInside.element("br");return s.insertNode(t,!1),s.setCursorAfter(t),!1}return!0}enterInsideEmptyLIelement(t){let e=null;const s=M.i.closest(t,["ol","ul"],this.j.editor);if(s){if(M.i.prev(t,(t=>M.i.isTag(t,"li")),s))if(M.i.next(t,(t=>M.i.isTag(t,"li")),s)){const i=this.j.s.createRange();i.setStartBefore(s),i.setEndAfter(t);const o=i.extractContents();s.parentNode&&s.parentNode.insertBefore(o,s),e=this.j.s.setCursorBefore(s)}else e=this.j.s.setCursorAfter(s);else e=this.j.s.setCursorBefore(s);M.i.safeRemove(t),Pe(this.j,e,this.defaultTag),(0,g.$$)("li",s).length||M.i.safeRemove(s)}}beforeDestruct(t){t.e.off("keydown.enter")}}class Re extends X{afterInit(t){}beforeDestruct(t){}onKeyDownArrow(t){var e;if(t.key!==a.KEY_RIGHT||!this.j.selection.isCollapsed())return;const{endContainer:s,endOffset:i}=this.j.selection.range;if(M.i.isText(s)&&(null===(e=s.nodeValue)||void 0===e?void 0:e.length)===i){const{parentNode:t}=s;M.i.isInlineBlock(t)&&!ie(t,!1,this.j.editor)&&M.i.after(t,this.j.createInside.text(a.NBSP_SPACE))}}}(0,n.gn)([(0,q.watch)(":keydown")],Re.prototype,"onKeyDownArrow",null),r.D.prototype.showMessageErrors=!0,r.D.prototype.showMessageErrorTime=3e3,r.D.prototype.showMessageErrorOffsetPx=3;const Ae="error-box-for-messages";function Be(t){if(t.o.showMessageErrors){const e=t.getFullElName(Ae,"active",!0),s=t.c.div(t.getFullElName(Ae)),i=()=>{let e=5;(0,g.toArray)(s.childNodes).forEach((s=>{(0,g.css)(s,"bottom",e+"px"),e+=s.offsetHeight+t.o.showMessageErrorOffsetPx}))};t.e.on("beforeDestruct",(()=>{M.i.safeRemove(s)})).on("errorMessage",((o,n,r)=>{t.workplace.appendChild(s);const a=t.c.div(e,o);a.classList.add(t.getFullElName(Ae,"type",n)),s.appendChild(a),i(),t.async.setTimeout((()=>{a.classList.remove(e),t.async.setTimeout((()=>{M.i.safeRemove(a),i()}),300)}),r||t.o.showMessageErrorTime)}))}}function Oe(t){t.registerButton({name:"font",group:"font"}).registerButton({name:"fontsize",group:"font"});const e=(e,s,i)=>{switch(e){case"fontsize":t.s.applyStyle({fontSize:(0,g.normalizeSize)(i)});break;case"fontname":t.s.applyStyle({fontFamily:i})}return t.e.fire("synchro"),!1};t.registerCommand("fontsize",e).registerCommand("fontname",e)}function He(t){t.registerButton({name:"paragraph",group:"font"}),t.registerCommand("formatblock",((e,s,i)=>(t.s.applyStyle(void 0,{element:i}),t.synchronizeValues(),!1)))}function Fe(t){t.registerButton({name:"fullsize"});let e=!1,s=0,i=0,o=!1;const n=()=>{const{container:n,events:r}=t;r&&(e?(s=(0,g.css)(n,"height",!0),i=(0,g.css)(n,"width",!0),(0,g.css)(n,{height:t.ow.innerHeight,width:t.ow.innerWidth}),o=!0):o&&(0,g.css)(n,{height:s||"auto",width:i||"auto"}))},r=s=>{const{container:i,events:o}=t;if(i){if(void 0===s&&(s=!i.classList.contains("jodit_fullsize")),t.setMod("fullsize",s),t.o.fullsize=s,e=s,i.classList.toggle("jodit_fullsize",s),t.toolbar&&((0,g.isJoditObject)(t)&&t.toolbarContainer.appendChild(t.toolbar.container),(0,g.css)(t.toolbar.container,"width","auto")),t.o.globalFullSize){let t=i.parentNode;for(;t&&t.nodeType!==Node.DOCUMENT_NODE;)t.classList.toggle("jodit_fullsize-box_true",s),t=t.parentNode;n()}o.fire("afterResize")}};t.o.globalFullSize&&t.e.on(t.ow,"resize",n),t.e.on("afterInit afterOpen",(()=>{var e;t.toggleFullSize(null===(e=null==t?void 0:t.options)||void 0===e?void 0:e.fullsize)})).on("toggleFullSize",r).on("beforeDestruct",(()=>{e&&r(!1)})).on("beforeDestruct",(()=>{t.events&&t.e.off(t.ow,"resize",n)}))}r.D.prototype.defaultFontSizePoints="px",r.D.prototype.controls.fontsize={command:"fontSize",data:{cssRule:"font-size"},list:["8","9","10","11","12","14","16","18","24","30","36","48","60","72","96"],exec:(t,e,{control:s})=>(0,g.memorizeExec)(t,e,{control:s},(e=>{var i;return"fontsize"===(null===(i=s.command)||void 0===i?void 0:i.toLowerCase())?`${e}${t.o.defaultFontSizePoints}`:e})),childTemplate:(t,e,s)=>`${s}${t.o.defaultFontSizePoints}`,tooltip:"Font size",isChildActive(t,e){var s,i;const o=t.s.current(),n=(null===(s=e.data)||void 0===s?void 0:s.cssRule)||"font-size",r=(null===(i=e.data)||void 0===i?void 0:i.normalize)||(e=>/pt$/i.test(e)&&"pt"===t.o.defaultFontSizePoints?e.replace(/pt$/i,""):e);if(o){const s=M.i.closest(o,M.i.isElement,t.editor)||t.editor,i=(0,g.css)(s,n);return!(!i||!e.args||r(""+e.args[0])!==r(""+i))}return!1}},r.D.prototype.controls.font={...r.D.prototype.controls.fontsize,command:"fontname",list:{"":"Default","Helvetica,sans-serif":"Helvetica","Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma","Times New Roman,Times,serif":"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},childTemplate(t,e,s){let i=!1;try{i=-1===e.indexOf("dings")&&document.fonts.check("16px "+e,s)}catch(t){}return`${s}`},data:{cssRule:"font-family",normalize:t=>t.toLowerCase().replace(/['"]+/g,"").replace(/[^a-z0-9]+/g,",")},tooltip:"Font family"},r.D.prototype.controls.paragraph={command:"formatBlock",update(t){const e=t.j,s=t.control,i=e.s.current();if(i&&e.o.textIcons){const o=(M.i.closest(i,M.i.isBlock,e.editor)||e.editor).nodeName.toLowerCase(),n=s.list;t&&s.data&&s.data.currentValue!==o&&n&&n[o]&&(e.o.textIcons?t.state.text=o:t.state.icon.name=o,s.data.currentValue=o)}return!1},exec:g.memorizeExec,data:{currentValue:"left"},list:{p:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",blockquote:"Quote",pre:"Code"},isChildActive(t,e){const s=t.s.current();if(s){const i=M.i.closest(s,M.i.isBlock,t.editor);return!(!i||i===t.editor||void 0===e.args||i.nodeName.toLowerCase()!==e.args[0])}return!1},isActive(t,e){const s=t.s.current();if(s){const i=M.i.closest(s,M.i.isBlock,t.editor);return!(!i||i===t.editor||void 0===e.list||M.i.isTag(i,"p")||void 0===e.list[i.nodeName.toLowerCase()])}return!1},childTemplate:(t,e,s)=>`<${e} style="margin:0;padding:0">${t.i18n(s)}`,tooltip:"Insert format block"},r.D.prototype.fullsize=!1,r.D.prototype.globalFullSize=!0,r.D.prototype.controls.fullsize={exec(t){t.toggleFullSize()},update(t){const e=t.j,s=e.isFullSize?"shrink":"fullsize";t.state.activated=e.isFullSize,e.o.textIcons?t.state.text=s:t.state.icon.name=s},tooltip:"Open editor in fullsize",mode:a.MODE_SOURCE+a.MODE_WYSIWYG},r.D.prototype.commandToHotkeys={removeFormat:["ctrl+shift+m","cmd+shift+m"],insertOrderedList:["ctrl+shift+7","cmd+shift+7"],insertUnorderedList:["ctrl+shift+8, cmd+shift+8"],selectall:["ctrl+a","cmd+a"]};class We extends X{constructor(){super(...arguments),this.onKeyPress=t=>{const e=this.specialKeys[t.which],s=(t.key||String.fromCharCode(t.which)).toLowerCase(),i=[e||s];return["alt","ctrl","shift","meta"].forEach((s=>{t[s+"Key"]&&e!==s&&i.push(s)})),(0,g.normalizeKeyAliases)(i.join("+"))},this.specialKeys={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",91:"meta",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}}afterInit(t){(0,g.keys)(t.o.commandToHotkeys,!1).forEach((e=>{const s=t.o.commandToHotkeys[e];s&&((0,g.isArray)(s)||(0,g.isString)(s))&&t.registerHotkeyToCommand(s,e)}));let e=!1;t.e.off(".hotkeys").on([t.ow,t.ew],"keydown.hotkeys",(t=>{if(t.key===a.KEY_ESC)return this.j.e.fire("escape",t)})).on("keydown.hotkeys",(s=>{const i=this.onKeyPress(s),o={shouldStop:!0};if(!1===this.j.e.fire(i+".hotkey",s.type,o)){if(o.shouldStop)return e=!0,t.e.stopPropagation("keydown"),!1;s.preventDefault()}}),void 0,!0).on("keyup.hotkeys",(()=>{if(e)return e=!1,t.e.stopPropagation("keyup"),!1}),void 0,!0)}beforeDestruct(t){t.events&&t.e.off(".hotkeys")}}function $e(t){const e=t.options;t.e.on("afterSetMode",(()=>{t.isEditorMode()&&t.s.focus()})).on("generateDocumentStructure.iframe",((t,s)=>{const i=t||s.iframe.contentWindow.document;if(i.open(),i.write(e.iframeDoctype+``+`${e.iframeTitle}`+(e.iframeBaseUrl?``:"")+''),i.close(),e.iframeCSSLinks&&e.iframeCSSLinks.forEach((t=>{const e=i.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),i.head&&i.head.appendChild(e)})),e.iframeStyle){const t=i.createElement("style");t.innerHTML=e.iframeStyle,i.head&&i.head.appendChild(t)}})).on("createEditor",(()=>{if(!e.iframe)return;const s=t.c.element("iframe");s.style.display="block",s.src="about:blank",s.className="jodit-wysiwyg_iframe",s.setAttribute("allowtransparency","true"),s.setAttribute("tabindex",""+e.tabIndex),s.setAttribute("frameborder","0"),t.workplace.appendChild(s),t.iframe=s;const i=t.e.fire("generateDocumentStructure.iframe",null,t);return(0,g.callPromise)(i,(()=>{if(!t.iframe)return!1;const s=t.iframe.contentWindow.document;t.editorWindow=t.iframe.contentWindow;const i=()=>{(0,g.attr)(s.body,"contenteditable",t.getMode()!==a.MODE_SOURCE&&!t.getReadOnly()||null)},o=t=>{const e=//im,s="{%%BODY%%}",i=e.exec(t);return i&&(t=t.replace(e,s).replace(/]*?)>(.*?)<\/span>/gim,"").replace(/<span([^&]*?)>(.*?)<\/span>/gim,"").replace(s,i[0].replace(/(]+?)min-height["'\s]*:[\s"']*[0-9]+(px|%)/im,"$1").replace(/(]+?)([\s]*["'])?contenteditable["'\s]*=[\s"']*true["']?/im,"$1").replace(/<(style|script|span)[^>]+jodit[^>]+>.*?<\/\1>/g,"")).replace(/(class\s*=\s*)(['"])([^"']*)(jodit-wysiwyg|jodit)([^"']*\2)/g,"$1$2$3$5").replace(/(<[^<]+?)\sclass="[\s]*"/gim,"$1").replace(/(<[^<]+?)\sstyle="[\s;]*"/gim,"$1").replace(/(<[^<]+?)\sdir="[\s]*"/gim,"$1")),t};if(e.editHTMLDocumentMode){const e=t.element.tagName;if("TEXTAREA"!==e&&"INPUT"!==e)throw(0,g.error)("If enable `editHTMLDocumentMode` - source element should be INPUT or TEXTAREA");t.e.on("beforeGetNativeEditorValue",(()=>o(t.o.iframeDoctype+s.documentElement.outerHTML))).on("beforeSetNativeEditorValue",(({value:e})=>!t.isLocked&&(/<(html|body)/i.test(e)?o(s.documentElement.outerHTML)!==o(e)&&(s.open(),s.write(t.o.iframeDoctype+o(e)),s.close(),t.editor=s.body,t.e.fire("safeHTML",t.editor),i(),t.e.fire("prepareWYSIWYGEditor"),t.e.stopPropagation("beforeSetNativeEditorValue")):s.body.innerHTML=e,!0)),void 0,!0)}if(t.editor=s.body,t.e.on("afterSetMode afterInit afterAddPlace",i),"auto"===e.height){s.documentElement&&(s.documentElement.style.overflowY="hidden");const i=t.async.throttle((()=>{if(t.editor&&t.iframe&&"auto"===e.height){const e=t.ew.getComputedStyle(t.editor);(0,g.css)(t.iframe,"height",t.editor.offsetHeight+(parseInt(e.marginTop||"0",10)+parseInt(e.marginBottom||"0",10)))}}),t.defaultTimeout/2);t.e.on("change afterInit afterSetMode resize",i).on([t.iframe,t.ew,s.documentElement],"load",i).on(s,"readystatechange DOMContentLoaded",i)}return s.documentElement&&t.e.on(s.documentElement,"mousedown touchend",(()=>{t.s.isFocused()||(t.s.focus(),t.editor===s.body&&t.s.setCursorIn(s.body))})).on(t.ew,"mousedown touchstart keydown keyup touchend click mouseup mousemove scroll",(e=>{var s;null===(s=t.events)||void 0===s||s.fire(t.ow,e)})),!1}))}))}function Ve(t){const e=t.o,s=t.i18n.bind(t),i=N.JO.get.bind(N.JO),o=e.filebrowser.ajax.url||e.uploader.url,n=e.image.useImageEditor;return t.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t${i("image")}\n\t\t\t\t\t\t${i("crop")}\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t
`)}function Ye(t){const e=t.o,s=t.i18n.bind(t),i=N.JO.get.bind(N.JO);return t.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t${i("lock")}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t`)}r.D.prototype.iframe=!1,r.D.prototype.iframeBaseUrl="",r.D.prototype.iframeTitle="Jodit Editor",r.D.prototype.iframeDoctype="",r.D.prototype.iframeDefaultSrc="about:blank",r.D.prototype.iframeStyle='html{margin:0;padding:0;min-height: 100%;}body{box-sizing:border-box;font-size:13px;line-height:1.6;padding:10px;margin:0;background:transparent;color:#000;position:relative;z-index:2;user-select:auto;margin:0px;overflow:auto;outline:none;}table{width:100%;border:none;border-collapse:collapse;empty-cells: show;max-width: 100%;}th,td{padding: 2px 5px;border:1px solid #ccc;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}p{margin-top:0;}.jodit_editor .jodit_iframe_wrapper{display: block;clear: both;user-select: none;position: relative;}.jodit_editor .jodit_iframe_wrapper:after {position:absolute;content:"";z-index:1;top:0;left:0;right: 0;bottom: 0;cursor: pointer;display: block;background: rgba(0, 0, 0, 0);} .jodit_disabled{user-select: none;-o-user-select: none;-moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-ms-user-select: none}',r.D.prototype.iframeCSSLinks=[],r.D.prototype.editHTMLDocumentMode=!1;var Ue=s(60);r.D.prototype.image={dialogWidth:600,openOnDblClick:!0,editSrc:!0,useImageEditor:!0,editTitle:!0,editAlt:!0,editLink:!0,editSize:!0,editBorderRadius:!0,editMargins:!0,editClass:!0,editStyle:!0,editId:!0,editAlign:!0,showPreview:!0,selectImageAfterClose:!0};const Ge=t=>(t=(0,g.trim)(t),/^[0-9]+$/.test(t)?t+"px":t),Xe=t=>/^[-+]?[0-9.]+px$/.test(""+t)?parseFloat(""+t):t;class Ke extends X{constructor(){super(...arguments),this.state={image:new Image,get ratio(){return this.image.naturalWidth/this.image.naturalHeight||1},sizeIsLocked:!0,marginIsLocked:!0},this.activeTabState={__activeTab:"Image"}}onChangeMarginIsLocked(){if(!this.form)return;const{marginRight:t,marginBottom:e,marginLeft:s,lockMargin:i}=(0,g.refs)(this.form);[t,e,s].forEach((t=>{(0,g.attr)(t,"disabled",this.state.marginIsLocked||null)})),i.innerHTML=N.JO.get(this.state.marginIsLocked?"lock":"unlock")}onChangeSizeIsLocked(){if(!this.form)return;const{lockSize:t,imageWidth:e}=(0,g.refs)(this.form);t.innerHTML=N.JO.get(this.state.sizeIsLocked?"lock":"unlock"),t.classList.remove("jodit-properties__lock"),t.classList.remove("jodit-properties__unlock"),t.classList.add(this.state.sizeIsLocked?"jodit-properties__lock":"jodit-properties__unlock"),this.j.e.fire(e,"change")}open(){return this.makeForm(),this.activeTabState.__activeTab="Image",this.j.e.fire("hidePopup"),(0,g.markOwner)(this.j,this.dialog.container),this.state.marginIsLocked=!0,this.state.sizeIsLocked=!0,this.onChangeMarginIsLocked(),this.onChangeSizeIsLocked(),this.updateValues(),this.dialog.open().setModal(!0).setPosition(),!1}makeForm(){if(this.dialog)return;this.dialog=new $({fullsize:this.j.o.fullsize,globalFullSize:this.j.o.globalFullSize,theme:this.j.o.theme,language:this.j.o.language,minWidth:Math.min(400,screen.width),minHeight:590,buttons:["fullsize","dialog.close"]});const t=this.j,e=t.o,s=t.i18n.bind(t),i={check:(0,C.zx)(t,"ok","Apply","primary"),remove:(0,C.zx)(t,"bin","Delete")};t.e.on(this.dialog,"afterClose",(()=>{this.state.image.parentNode&&e.image.selectImageAfterClose&&t.s.select(this.state.image)})),i.remove.onAction((()=>{t.s.removeNode(this.state.image),this.dialog.close()}));const{dialog:o}=this;o.setHeader(s("Image properties"));const n=(t=>{const{showPreview:e,editSize:s}=t.o.image,i=N.JO.get.bind(N.JO);return t.c.fromHTML(`
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t${i("lock")}\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t
`)})(t);this.form=n,o.setContent(n);const{tabsBox:r}=(0,g.refs)(this.form);r&&r.appendChild((0,Le.IL)(t,[{name:"Image",content:Ve(t)},{name:"Advanced",content:Ye(t)}],this.activeTabState)),i.check.onAction(this.onApply);const{changeImage:a,editImage:l}=(0,g.refs)(this.form);t.e.on(a,"click",this.openImagePopup),e.image.useImageEditor&&t.e.on(l,"click",this.openImageEditor);const{lockSize:c,lockMargin:h,imageWidth:d,imageHeight:u}=(0,g.refs)(n);c&&t.e.on(c,"click",(()=>{this.state.sizeIsLocked=!this.state.sizeIsLocked})),t.e.on(h,"click",(t=>{this.state.marginIsLocked=!this.state.marginIsLocked,t.preventDefault()}));const p=t=>{if(!(0,g.isNumeric)(d.value)||!(0,g.isNumeric)(u.value))return;const e=parseFloat(d.value),s=parseFloat(u.value);t.target===d?u.value=""+Math.round(e/this.state.ratio):d.value=""+Math.round(s*this.state.ratio)};t.e.on([d,u],"change keydown mousedown paste",(e=>{this.state.sizeIsLocked&&t.async.setTimeout(p.bind(this,e),{timeout:t.defaultTimeout,label:"image-properties-changeSize"})})),o.setFooter([i.remove,i.check]),o.setSize(this.j.o.image.dialogWidth)}updateValues(){const t=this.j.o,{image:e}=this.state,{marginTop:s,marginRight:i,marginBottom:o,marginLeft:n,lockMargin:r,imageSrc:a,id:l,classes:c,align:h,style:d,imageTitle:u,imageAlt:p,borderRadius:f,imageLink:m,imageWidth:v,imageHeight:b,imageLinkOpenInNewTab:w,imageViewSrc:y,lockSize:C}=(0,g.refs)(this.form);(()=>{r.checked=this.state.marginIsLocked,C.checked=this.state.sizeIsLocked})(),a.value=(0,g.attr)(e,"src")||"",y&&(0,g.attr)(y,"src",(0,g.attr)(e,"src")||""),(()=>{u.value=(0,g.attr)(e,"title")||"",p.value=(0,g.attr)(e,"alt")||"";const t=M.i.closest(e,"a",this.j.editor);t?(m.value=(0,g.attr)(t,"href")||"",w.checked="_blank"===(0,g.attr)(t,"target")):(m.value="",w.checked=!1)})(),(()=>{const t=(0,g.attr)(e,"width")||(0,g.css)(e,"width",!0)||!1,s=(0,g.attr)(e,"height")||(0,g.css)(e,"height",!0)||!1;v.value=!1!==t?""+Xe(t):""+e.offsetWidth,b.value=!1!==s?""+Xe(s):""+e.offsetHeight,this.state.sizeIsLocked=(()=>!(!(0,g.isNumeric)(v.value)||!(0,g.isNumeric)(b.value))&&1>Math.abs(parseFloat(v.value)-parseFloat(b.value)*this.state.ratio))()})(),(()=>{if(!t.image.editMargins)return;let r=!0,a=!1;[s,i,o,n].forEach((t=>{const i=(0,g.attr)(t,"data-ref")||"";let o=e.style.getPropertyValue((0,g.kebabCase)(i));if(!o)return a=!0,void(t.value="");/^[0-9]+(px)?$/.test(o)&&(o=parseInt(o,10)),t.value=""+o||"",(a&&t.value||r&&"marginTop"!==i&&t.value!==s.value)&&(r=!1)})),this.state.marginIsLocked=r})(),c.value=((0,g.attr)(e,"class")||"").replace(/jodit_focused_image[\s]*/,""),l.value=(0,g.attr)(e,"id")||"",f.value=""+(parseInt(e.style.borderRadius||"0",10)||"0"),e.style.cssFloat&&-1!==["left","right"].indexOf(e.style.cssFloat.toLowerCase())?h.value=(0,g.css)(e,"float"):"block"===(0,g.css)(e,"display")&&"auto"===e.style.marginLeft&&"auto"===e.style.marginRight&&(h.value="center"),d.value=(0,g.attr)(e,"style")||""}onApply(){const{style:t,imageSrc:e,borderRadius:s,imageTitle:i,imageAlt:o,imageLink:n,imageWidth:r,imageHeight:a,marginTop:l,marginRight:c,marginBottom:h,marginLeft:d,imageLinkOpenInNewTab:u,align:p,classes:f,id:m}=(0,g.refs)(this.form),v=this.j.o,{image:b}=this.state;if(v.image.editStyle&&(0,g.attr)(b,"style",t.value||null),!e.value)return M.i.safeRemove(b),void this.dialog.close();(0,g.attr)(b,"src",e.value),b.style.borderRadius="0"!==s.value&&/^[0-9]+$/.test(s.value)?s.value+"px":"",(0,g.attr)(b,"title",i.value||null),(0,g.attr)(b,"alt",o.value||null);let w=M.i.closest(b,"a",this.j.editor);if(n.value?(w||(w=M.i.wrap(b,"a",this.j.createInside)),(0,g.attr)(w,"href",n.value),(0,g.attr)(w,"target",u.checked?"_blank":null)):w&&w.parentNode&&w.parentNode.replaceChild(b,w),r.value!==""+b.offsetWidth||a.value!==""+b.offsetHeight){const t=(0,g.trim)(r.value)?Ge(r.value):null,e=(0,g.trim)(a.value)?Ge(a.value):null;(0,g.css)(b,{width:t,height:e}),(0,g.attr)(b,"width",(0,g.attr)(b,"width")?t:null),(0,g.attr)(b,"height",(0,g.attr)(b,"height")?e:null)}const y=[l,c,h,d];v.image.editMargins&&(this.state.marginIsLocked?(0,g.css)(b,"margin",Ge(l.value)):y.forEach((t=>{const e=(0,g.attr)(t,"data-ref")||"";(0,g.css)(b,e,Ge(t.value))}))),v.image.editClass&&(0,g.attr)(b,"class",f.value||null),v.image.editId&&(0,g.attr)(b,"id",m.value||null),v.image.editAlign&&(0,Ue.z)(b,p.value),this.j.synchronizeValues(),this.dialog.close()}openImageEditor(){const t=(0,g.attr)(this.state.image,"src")||"",e=this.j.c.element("a"),s=()=>{e.host===location.host||U(this.j.i18n("You can only edit your own images. Download this image on the host?"),(t=>{t&&this.j.uploader&&this.j.uploader.uploadRemoteImage(""+e.href,(t=>{V(this.j.i18n("The image has been successfully uploaded to the host!"),(()=>{(0,g.isString)(t.newfilename)&&((0,g.attr)(this.state.image,"src",t.baseurl+t.newfilename),this.updateValues())})).bindDestruct(this.j)}),(t=>{V(this.j.i18n("There was an error loading %s",t.message)).bindDestruct(this.j)}))})).bindDestruct(this.j)};e.href=t,this.j.filebrowser.dataProvider.getPathByUrl(""+e.href).then((s=>{mt.call(this.j.filebrowser,e.href,s.name,s.path,s.source,(()=>{const e=(new Date).getTime();(0,g.attr)(this.state.image,"src",t+(-1!==t.indexOf("?")?"":"?")+"&_tmp="+e),this.updateValues()}),(t=>{V(t.message).bindDestruct(this.j)}))})).catch((t=>{V(t.message,s).bindDestruct(this.j)}))}openImagePopup(t){const e=new N.GI(this.j),{changeImage:s}=(0,g.refs)(this.form);e.setZIndex(this.dialog.getZIndex()+1),e.setContent((0,Le.ov)(this.j,{upload:t=>{t.files&&t.files.length&&(0,g.attr)(this.state.image,"src",t.baseurl+t.files[0]),this.updateValues(),e.close()},filebrowser:t=>{t&&(0,g.isArray)(t.files)&&t.files.length&&((0,g.attr)(this.state.image,"src",t.files[0]),e.close(),this.updateValues())}},this.state.image,e.close)).open((()=>(0,g.position)(s))),t.stopPropagation()}afterInit(t){const e=this;t.e.on("afterConstructor changePlace",(()=>{t.e.off(t.editor,".imageproperties").on(t.editor,"dblclick.imageproperties",(s=>{const i=s.target;if(M.i.isTag(i,"img"))if(t.o.image.openOnDblClick){if(!1===this.j.e.fire("openOnDblClick",i))return;e.state.image=i,t.o.readonly||(s.stopImmediatePropagation(),s.preventDefault(),e.open())}else s.stopImmediatePropagation(),t.s.select(i)}))})).on("openImageProperties.imageproperties",(t=>{this.state.image=t,this.open()}))}beforeDestruct(t){this.dialog&&this.dialog.destruct(),t.e.off(t.editor,".imageproperties").off(".imageproperties")}}(0,n.gn)([(0,q.watch)("state.marginIsLocked")],Ke.prototype,"onChangeMarginIsLocked",null),(0,n.gn)([(0,q.watch)("state.sizeIsLocked")],Ke.prototype,"onChangeSizeIsLocked",null),(0,n.gn)([q.autobind],Ke.prototype,"onApply",null),(0,n.gn)([q.autobind],Ke.prototype,"openImageEditor",null),(0,n.gn)([q.autobind],Ke.prototype,"openImagePopup",null);const Ze="__jodit_imageprocessor_binded";function Je(t){t.e.on("change afterInit changePlace",t.async.debounce((()=>{t.editor&&(0,g.$$)("img",t.editor).forEach((e=>{(0,g.dataBind)(e,Ze)||((0,g.dataBind)(e,Ze,!0),e.complete||t.e.on(e,"load",(function s(){var i;!t.isInDestruct&&(null===(i=t.e)||void 0===i||i.fire("resize")),t.e.off(e,"load",s)})),t.e.on(e,"mousedown touchstart",(()=>{t.s.select(e)})))}))}),t.defaultTimeout))}function Qe(t){t.registerButton({name:"image",group:"media"})}r.D.prototype.controls.image={popup(t,e,s,i){let o=null;return e&&!M.i.isText(e)&&M.i.isHTMLElement(e)&&(M.i.isTag(e,"img")||(0,g.$$)("img",e).length)&&(o=M.i.isTag(e,"img")?e:(0,g.$$)("img",e)[0]),t.s.save(),(0,Le.ov)(t,{filebrowser(e){t.s.restore(),e.files&&e.files.forEach((s=>t.s.insertImage(e.baseurl+s,null,t.o.imageDefaultWidth))),i()},upload:!0,async url(e,s){t.s.restore();const n=o||t.createInside.element("img");n.setAttribute("src",e),n.setAttribute("alt",s),o||await t.s.insertImage(n,null,t.o.imageDefaultWidth),i()}},o,i)},tags:["img"],tooltip:"Insert Image"},r.D.prototype.controls.indent={tooltip:"Increase Indent"};const ts=(t,e)=>`${M.i.isCell(e)?"padding":"margin"}${"rtl"===t?"Right":"Left"}`;function es(t){t.registerButton({name:"indent",group:"indent"}).registerButton({name:"outdent",group:"indent"});const e=e=>{const s=[];return t.s.eachSelection((i=>{t.s.save();let o=!!i&&M.i.up(i,M.i.isBlock,t.editor);const{enter:n}=t.o;if(!o&&i&&(o=M.i.wrapInline(i,n!==a.BR?n:a.PARAGRAPH,t)),!o)return t.s.restore(),!1;const r=s.includes(o);if(o&&!r){const i=ts(t.o.direction,o);s.push(o);let n=o.style[i]?parseInt(o.style[i],10):0;n+=t.o.indentMargin*("outdent"===e?-1:1),o.style[i]=n>0?n+"px":"",(0,g.attr)(o,"style")||(0,g.attr)(o,"style",null)}t.s.restore()})),t.synchronizeValues(),!1};t.registerCommand("indent",{exec:e,hotkeys:["ctrl+]","cmd+]"]}),t.registerCommand("outdent",{exec:e,hotkeys:["ctrl+[","cmd+["]})}function ss(t){t.registerButton({name:"hr",group:"insert"}),t.registerCommand("insertHorizontalRule",(()=>{const e=t.createInside.element("hr");t.s.insertNode(e,!1,!1);const s=M.i.closest(e.parentElement,M.i.isBlock,t.editor);s&&M.i.isEmpty(s)&&s!==t.editor&&(M.i.after(s,e),M.i.safeRemove(s));let i=M.i.next(e,M.i.isBlock,t.editor,!1);return i||(i=t.createInside.element(t.o.enter),M.i.after(e,i)),t.s.setCursorIn(i),!1}))}r.D.prototype.controls.outdent={isDisabled(t){const e=t.s.current();if(e){const s=M.i.closest(e,M.i.isBlock,t.editor);if(s){const e=ts(t.o.direction,s);return!s.style[e]||0>=parseInt(s.style[e],10)}}return!0},tooltip:"Decrease Indent"},r.D.prototype.indentMargin=10,r.D.prototype.controls.hr={command:"insertHorizontalRule",tags:["hr"],tooltip:"Insert Horizontal Line"},r.D.prototype.toolbarInline=!0,r.D.prototype.toolbarInlineForSelection=!1,r.D.prototype.toolbarInlineDisableFor=[],r.D.prototype.toolbarInlineDisabledButtons=["source"],r.D.prototype.popup={a:s(61).Z,img:s(62).Z,cells:s(63).Z,toolbar:s(64).Z,jodit:s(65).Z,iframe:s(65).Z,"jodit-media":s(65).Z,selection:["bold","underline","italic","ul","ol","\n","outdent","indent","fontsize","brush","cut","\n","paragraph","link","align","dots"]};class is extends X{constructor(){super(...arguments),this.requires=["select"],this.type=null,this.popup=new y.G(this.jodit,!1),this.toolbar=O(this.jodit,this.popup),this.snapRange=null,this.elmsList=(0,g.keys)(this.j.o.popup,!1).filter((t=>!this.isExcludedTarget(t)))}onClick(t){const e=this.elmsList,s=M.i.isTag(t,"img")?t:M.i.closest(t,e,this.j.editor);if(s&&this.canShowPopupForType(s.nodeName.toLowerCase()))return this.showPopup((()=>(0,g.position)(s,this.j)),s.nodeName.toLowerCase(),s),!1}showPopup(t,e,s){if(e=e.toLowerCase(),!this.canShowPopupForType(e))return!1;if(this.type!==e||s!==this.previousTarget){this.previousTarget=s;const t=this.j.o.popup[e];let i;i=(0,g.isFunction)(t)?t(this.j,s,this.popup.close):t,(0,g.isArray)(i)&&(this.toolbar.build(i,s),this.toolbar.buttonSize=this.j.o.toolbarButtonSize,i=this.toolbar.container),this.popup.setContent(i),this.type=e}return this.popup.open(t),!0}hidePopup(t){(0,g.isString)(t)&&t!==this.type||this.popup.close()}onOutsideClick(){this.popup.close()}canShowPopupForType(t){const e=this.j.o.popup[t.toLowerCase()];return!(this.j.o.readonly||!this.j.o.toolbarInline||!e||this.isExcludedTarget(t))}isExcludedTarget(t){return(0,g.splitArray)(this.j.o.toolbarInlineDisableFor).map((t=>t.toLowerCase())).includes(t.toLowerCase())}afterInit(t){this.j.e.on("getDiffButtons.mobile",(e=>{if(this.toolbar===e){const e=this.toolbar.getButtonsNames();return(0,g.toArray)(t.registeredButtons).filter((t=>!this.j.o.toolbarInlineDisabledButtons.includes(t.name))).filter((t=>{const s=(0,g.isString)(t)?t:t.name;return s&&"|"!==s&&"\n"!==s&&!e.includes(s)}))}})).on("hidePopup",this.hidePopup).on("showInlineToolbar",this.showInlineToolbar).on("showPopup",((t,e,s)=>{this.showPopup(e,s||((0,g.isString)(t)?t:t.nodeName),(0,g.isString)(t)?void 0:t)})).on("mousedown keydown",this.onSelectionStart).on("change",(()=>{this.popup.isOpened&&this.previousTarget&&!this.previousTarget.parentNode&&(this.hidePopup(),this.previousTarget=void 0)})).on([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.addListenersForElements()}onSelectionStart(){this.snapRange=this.j.s.range.cloneRange()}onSelectionEnd(t){if(t&&t.target&&N.u1.closestElement(t.target,y.G))return;const{snapRange:e}=this,{range:s}=this.j.s;e&&!s.collapsed&&s.startContainer===e.startContainer&&s.startOffset===e.startOffset&&s.endContainer===e.endContainer&&s.endOffset===e.endOffset||this.onSelectionChange()}onSelectionChange(){if(!this.j.o.toolbarInlineForSelection)return;const t="selection",e=this.j.s.sel,s=this.j.s.range;(null==e?void 0:e.isCollapsed)||this.isSelectedTarget(s)||this.tableModule.getAllSelectedCells().length?this.type===t&&this.popup.isOpened&&this.hidePopup():this.j.s.current()&&this.showPopup((()=>s.getBoundingClientRect()),t)}isSelectedTarget(t){const e=t.startContainer;return M.i.isElement(e)&&e===t.endContainer&&M.i.isTag(e.childNodes[t.startOffset],(0,g.keys)(this.j.o.popup,!1))&&t.startOffset===t.endOffset-1}get tableModule(){return this.j.getInstance("Table",this.j.o)}beforeDestruct(t){t.e.off("showPopup").off([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.removeListenersForElements()}_eventsList(){const t=this.elmsList;return t.map((t=>(0,g.camelCase)("click_"+t))).concat(t.map((t=>(0,g.camelCase)("touchstart_"+t)))).join(" ")}addListenersForElements(){this.j.e.on(this._eventsList(),this.onClick)}removeListenersForElements(){this.j.e.off(this._eventsList(),this.onClick)}showInlineToolbar(t){this.showPopup((()=>{if(t)return t;const{range:e}=this.j.s;return e.getBoundingClientRect()}),"toolbar")}}(0,n.gn)([q.autobind],is.prototype,"onClick",null),(0,n.gn)([(0,q.wait)((t=>!t.j.isLocked))],is.prototype,"showPopup",null),(0,n.gn)([(0,q.watch)(":clickEditor"),q.autobind],is.prototype,"hidePopup",null),(0,n.gn)([(0,q.watch)(":outsideClick")],is.prototype,"onOutsideClick",null),(0,n.gn)([q.autobind],is.prototype,"onSelectionStart",null),(0,n.gn)([q.autobind],is.prototype,"onSelectionEnd",null),(0,n.gn)([(0,q.debounce)((t=>t.defaultTimeout))],is.prototype,"onSelectionChange",null),(0,n.gn)([q.autobind],is.prototype,"showInlineToolbar",null),r.D.prototype.controls.align={name:"left",tooltip:"Align",update(t){const e=t.j,s=t.control,i=e.s.current();if(i){const o=M.i.closest(i,M.i.isBlock,e.editor)||e.editor;let n=""+(0,g.css)(o,"text-align");s.defaultValue&&-1!==s.defaultValue.indexOf(n)&&(n="left"),s.data&&s.data.currentValue!==n&&s.list&&-1!==s.list.indexOf(n)&&(e.o.textIcons?t.state.text=n:t.state.icon.name=n,s.data.currentValue=n)}},isActive(t,e){const s=t.s.current();if(s&&e.defaultValue){const i=M.i.closest(s,M.i.isBlock,t.editor)||t.editor;return-1===e.defaultValue.indexOf(""+(0,g.css)(i,"text-align"))}return!1},defaultValue:["left","start","inherit"],data:{currentValue:"left"},list:["center","left","right","justify"]},r.D.prototype.controls.center={command:"justifyCenter",css:{"text-align":"center"},tooltip:"Align Center"},r.D.prototype.controls.justify={command:"justifyFull",css:{"text-align":"justify"},tooltip:"Align Justify"},r.D.prototype.controls.left={command:"justifyLeft",css:{"text-align":"left"},tooltip:"Align Left"},r.D.prototype.controls.right={command:"justifyRight",css:{"text-align":"right"},tooltip:"Align Right"};const os=(t,e)=>{if(M.i.isNode(e)&&M.i.isElement(e))switch(M.i.each(e,(t=>{M.i.isHTMLElement(t)&&t.style.textAlign&&(t.style.textAlign="",t.style.cssText.trim().length||t.removeAttribute("style"))})),t.toLowerCase()){case"justifyfull":e.style.textAlign="justify";break;case"justifyright":e.style.textAlign="right";break;case"justifyleft":e.style.textAlign="left";break;case"justifycenter":e.style.textAlign="center"}};function ns(t){t.registerButton({name:"align",group:"indent"});const e=e=>(t.s.focus(),t.s.eachSelection((s=>{if(!s)return;let i=M.i.up(s,M.i.isBlock,t.editor);i||(i=M.i.wrapInline(s,t.o.enterBlock,t)),os(e,i)})),!1);t.registerCommand("justifyfull",e),t.registerCommand("justifyright",e),t.registerCommand("justifyleft",e),t.registerCommand("justifycenter",e)}r.D.prototype.limitWords=!1,r.D.prototype.limitChars=!1,r.D.prototype.limitHTML=!1;class rs extends X{afterInit(t){const{limitWords:e,limitChars:s}=t.o;if(t&&(e||s)){let e=null;t.e.off(".limit").on("beforePaste.limit",(()=>{e=t.history.snapshot.make()})).on("keydown.limit keyup.limit beforeEnter.limit beforePaste.limit",this.checkPreventKeyPressOrPaste).on("change.limit",this.checkPreventChanging).on("afterPaste.limit",(()=>{if(this.shouldPreventInsertHTML()&&e)return t.history.snapshot.restore(e),!1}))}}shouldPreventInsertHTML(t=null,e=""){if(t&&a.COMMAND_KEYS.includes(t.key))return!1;const{jodit:s}=this,{limitWords:i,limitChars:o}=s.o,n=this.splitWords(e||(s.o.limitHTML?s.value:s.text));return!(!i||i>n.length)||!!o&&n.join("").length>=o}checkPreventKeyPressOrPaste(t){if(this.shouldPreventInsertHTML(t))return!1}checkPreventChanging(t,e){const{jodit:s}=this,{limitWords:i,limitChars:o}=s.o,n=s.o.limitHTML?t:(0,g.stripTags)(t),r=this.splitWords(n);(i&&r.length>i||o&&r.join("").length>o)&&(s.value=e)}splitWords(t){return t.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((t=>t.length))}beforeDestruct(t){t.e.off(".limit")}}(0,n.gn)([q.autobind],rs.prototype,"checkPreventKeyPressOrPaste",null),(0,n.gn)([q.autobind],rs.prototype,"checkPreventChanging",null),r.D.prototype.defaultLineHeight=null,r.D.prototype.controls.lineHeight={icon:"line-height",command:"applyLineHeight",tags:["ol"],tooltip:"Line height",list:[1,1.1,1.2,1.3,1.4,1.5,2],exec:(t,e,{control:s})=>(0,g.memorizeExec)(t,e,{control:s},(t=>t))};class as extends X{constructor(){super(...arguments),this.buttons=[{name:"lineHeight",group:"font"}]}afterInit(t){(0,g.css)(t.editor,{lineHeight:t.o.defaultLineHeight}),t.registerCommand("applyLineHeight",this.applyLineHeight)}applyLineHeight(t,e,s){const{s:i,createInside:o,editor:n,o:r}=this.j;let a;i.isFocused()||i.focus(),i.save();const l=t=>{let e=M.i.closest(t,M.i.isBlock,n);e||(e=M.i.wrap(t,r.enter,o));const i=(0,g.css)(e,"lineHeight");void 0===a&&(a=""+i!=""+s),(0,g.css)(e,"lineHeight",a?s:null)};try{if(i.isCollapsed()){const t=o.fake();i.insertNode(t,!1,!1),l(t),M.i.safeRemove(t)}else i.eachSelection(l)}finally{i.restore()}}beforeDestruct(t){(0,g.css)(t.editor,{lineHeight:null})}}(0,n.gn)([q.autobind],as.prototype,"applyLineHeight",null);var ls=s(55);r.D.prototype.link={formTemplate(t){const{openInNewTabCheckbox:e,noFollowCheckbox:s,modeClassName:i,selectSizeClassName:o,selectMultipleClassName:n,selectOptionsClassName:r}=t.o.link;return new ls.x4(t,[new ls.eC(t,[new ls.u3(t,{name:"url",type:"text",ref:"url_input",label:"URL",placeholder:"http://",required:!0})]),new ls.eC(t,[new ls.u3(t,{name:"content",ref:"content_input",label:"Text"})],{ref:"content_input_box"}),i?new ls.eC(t,["input"===i?new ls.u3(t,{name:"className",ref:"className_input",label:"Class name"}):"select"===i?new ls.Cj(t,{name:"className",ref:"className_select",label:"Class name",size:o,multiple:n,options:r}):null]):null,e?new ls.mA(t,{name:"target",ref:"target_checkbox",label:"Open in new tab"}):null,s?new ls.mA(t,{name:"nofollow",ref:"nofollow_checkbox",label:"No follow"}):null,new ls.eC(t,[new C.y3(t,{name:"unlink",variant:"default",text:"Unlink"}),new C.y3(t,{name:"insert",type:"submit",variant:"primary",text:"Insert"})],{align:"full"})])},followOnDblClick:!1,processVideoLink:!0,processPastedLink:!0,noFollowCheckbox:!0,openInNewTabCheckbox:!0,modeClassName:"input",selectMultipleClassName:!0,selectSizeClassName:3,selectOptionsClassName:[],hotkeys:["ctrl+k","cmd+k"]},r.D.prototype.controls.unlink={exec(t,e){const s=M.i.closest(e,"a",t.editor);s&&M.i.unwrap(s),t.synchronizeValues(),t.e.fire("hidePopup")},tooltip:"Unlink"},r.D.prototype.controls.link={isActive(t){const e=t.s.current();return!(!e||!M.i.closest(e,"a",t.editor))},popup:(t,e,s,i)=>t.e.fire("generateLinkForm.link",e,i),tags:["a"],tooltip:"Insert link"};class cs extends X{constructor(){super(...arguments),this.buttons=[{name:"link",group:"insert"}]}afterInit(t){t.o.link.followOnDblClick&&t.e.on("dblclick.link",this.onDblClickOnLink),t.o.link.processPastedLink&&t.e.on("processPaste.link",this.onProcessPasteLink),t.e.on("generateLinkForm.link",this.generateForm),t.registerCommand("openLinkDialog",{exec:()=>{const e=new $({resizable:!1}),s=this.generateForm(t.s.current(),(()=>{e.close()}));s.container.classList.add("jodit-dialog_alert"),e.setContent(s),e.open(),t.async.requestIdleCallback((()=>{const{url_input:t}=(0,g.refs)(s.container);null==t||t.focus()}))},hotkeys:t.o.link.hotkeys})}onDblClickOnLink(t){if(!M.i.isTag(t.target,"a"))return;const e=(0,g.attr)(t.target,"href");e&&(location.href=e,t.preventDefault())}onProcessPasteLink(t,e){const{jodit:s}=this;if((0,g.isURL)(e)){if(s.o.link.processVideoLink){const t=(0,g.convertMediaUrlToVideoEmbed)(e);if(t!==e)return s.e.stopPropagation("processPaste"),s.createInside.fromHTML(t)}const t=s.createInside.element("a");return t.setAttribute("href",e),t.textContent=e,s.e.stopPropagation("processPaste"),t}}generateForm(t,e){const{jodit:s}=this,i=s.i18n.bind(s),{openInNewTabCheckbox:o,noFollowCheckbox:n,formTemplate:r,formClassName:a,modeClassName:l}=s.o.link,c=r(s),h=(0,g.isString)(c)?s.c.fromHTML(c,{target_checkbox_box:o,nofollow_checkbox_box:n}):c,d=M.i.isElement(h)?h:h.container,u=(0,g.refs)(d),{insert:p,unlink:f,content_input_box:m}=u,{target_checkbox:v,nofollow_checkbox:b,url_input:w}=u,y=M.i.isImage(t);let{content_input:C}=u;const{className_input:x}=u,{className_select:E}=u;let j;C||(C=s.c.element("input",{type:"hidden",ref:"content_input"})),a&&d.classList.add(a),y&&M.i.hide(m);const S=()=>j?j.innerText:(0,g.stripTags)(s.s.range.cloneContents(),s.ed);if(j=!(!t||!M.i.closest(t,"a",s.editor))&&M.i.closest(t,"a",s.editor),!y&&t&&(C.value=S()),j){if(w.value=(0,g.attr)(j,"href")||"",l)switch(l){case"input":x&&(x.value=(0,g.attr)(j,"class")||"");break;case"select":if(E){for(let t=0;E.selectedOptions.length>t;t++){const e=E.options.item(t);e&&(e.selected=!1)}((0,g.attr)(j,"class")||"").split(" ").forEach((t=>{if(t)for(let e=0;E.options.length>e;e++){const s=E.options.item(e);(null==s?void 0:s.value)&&s.value===t&&(s.selected=!0)}}))}}o&&v&&(v.checked="_blank"===(0,g.attr)(j,"target")),n&&b&&(b.checked="nofollow"===(0,g.attr)(j,"rel")),p.textContent=i("Update")}else M.i.hide(f);s.editor.normalize();const k=s.history.snapshot.make();f&&s.e.on(f,"click",(t=>{s.s.restore(),s.history.snapshot.restore(k),j&&M.i.unwrap(j),s.synchronizeValues(),e(),t.preventDefault()}));const T=()=>{if(!w.value.trim().length)return w.focus(),w.classList.add("jodit_error"),!1;let t;s.s.restore(),s.s.removeMarkers(),s.editor.normalize(),s.history.snapshot.restore(k);const i=S()!==C.value.trim(),r=s.createInside;if(j)t=[j];else{if(s.s.isCollapsed()){const e=r.element("a");s.s.insertNode(e,!1,!1),t=[e]}else{const e=s.s.current();t=M.i.isTag(e,["img"])?[M.i.wrap(e,"a",r)]:s.s.wrapInTag("a")}t.forEach((t=>s.s.select(t)))}return t.forEach((t=>{var e;if((0,g.attr)(t,"href",w.value),l&&(null!=x?x:E))if("input"===l)""===x.value&&t.hasAttribute("class")&&(0,g.attr)(t,"class",null),""!==x.value&&(0,g.attr)(t,"class",x.value);else if("select"===l){t.hasAttribute("class")&&(0,g.attr)(t,"class",null);for(let s=0;E.selectedOptions.length>s;s++){const i=null===(e=E.selectedOptions.item(s))||void 0===e?void 0:e.value;i&&t.classList.add(i)}}if(!y){let e=t.textContent;C.value.trim().length?i&&(e=C.value):e=w.value,e!==t.textContent&&(t.textContent=e)}o&&v&&(0,g.attr)(t,"target",v.checked?"_blank":null),n&&b&&(0,g.attr)(t,"rel",b.checked?"nofollow":null)})),s.synchronizeValues(),e(),!1};return M.i.isElement(h)?s.e.on(h,"submit",(t=>(t.preventDefault(),t.stopImmediatePropagation(),T(),!1))):h.onSubmit(T),h}beforeDestruct(t){t.e.off("generateLinkForm.link",this.generateForm).off("dblclick.link",this.onDblClickOnLink).off("processPaste.link",this.onProcessPasteLink)}}function hs(t){const e="jodit_fake_wrapper",{mediaFakeTag:s,mediaBlocks:i,mediaInFakeBlock:o}=t.options;o&&t.e.on("afterGetValueFromEditor",(t=>{const i=RegExp(`<${s}[^>]+data-${e}[^>]+>([^]+?)`,"ig");i.test(t.value)&&(t.value=t.value.replace(i,"$1"))})).on("change afterInit afterSetMode changePlace",t.async.debounce((()=>{t.isDestructed||t.getMode()===a.MODE_SOURCE||(0,g.$$)(i.join(","),t.editor).forEach((i=>{(0,g.dataBind)(i,e)||((0,g.dataBind)(i,e,!0),(i=>{if(i.parentNode&&(0,g.attr)(i.parentNode,"data-jodit_iframe_wrapper"))i=i.parentNode;else{const o=t.createInside.fromHTML(`<${s} data-jodit-temp="1" contenteditable="false" draggable="true" data-${e}="1">`);(0,g.attr)(o,"style",(0,g.attr)(i,"style")),o.style.display="inline-block"===i.style.display?"inline-block":"block",o.style.width=i.offsetWidth+"px",o.style.height=i.offsetHeight+"px",i.parentNode&&i.parentNode.insertBefore(o,i),o.appendChild(i),i=o}t.e.off(i,"mousedown.select touchstart.select").on(i,"mousedown.select touchstart.select",(()=>{t.s.setCursorAfter(i)}))})(i))}))}),t.defaultTimeout))}function ds(t){t.registerButton({name:"video",group:"media"})}function us(t){t.registerButton({name:"file",group:"media"})}function ps(t){let e=0,s=(0,g.splitArray)(t.o.buttons);t.o.mobileTapTimeout&&t.e.on("touchend",(s=>{if(s.changedTouches&&s.changedTouches.length){const i=(new Date).getTime(),o=i-e;o>t.o.mobileTapTimeout&&(e=i,1.5*t.o.mobileTapTimeout>o&&t.s.insertCursorAtPoint(s.clientX,s.clientY))}})),t.e.on("getDiffButtons.mobile",(e=>{if(e===t.toolbar){const e=(0,F.q)((0,g.splitArray)(t.o.buttons),t),i=(0,F.q)(s,t);return(0,g.toArray)(e).reduce(((t,e)=>(i.has(e)||t.push(e),t)),[])}})),t.o.toolbarAdaptive&&t.e.on("resize afterInit recalcAdaptive changePlace afterAddPlace",(()=>{var e;if(!t.o.toolbar)return;const i=(null!==(e=t.container.parentElement)&&void 0!==e?e:t.container).offsetWidth,o=(0,g.splitArray)(t.o.sizeLG>i?t.o.sizeMD>i?t.o.sizeSM>i?t.o.buttonsXS:t.o.buttonsSM:t.o.buttonsMD:t.o.buttons);""+o!=""+s&&(s=o,t.e.fire("closeAllPopups"),t.toolbar.setRemoveButtons(t.o.removeButtons).build(s.concat(t.o.extraButtons)))})).on(t.ow,"load resize",(()=>t.e.fire("recalcAdaptive")))}(0,n.gn)([q.autobind],cs.prototype,"onDblClickOnLink",null),(0,n.gn)([q.autobind],cs.prototype,"onProcessPasteLink",null),(0,n.gn)([q.autobind],cs.prototype,"generateForm",null),r.D.prototype.mediaFakeTag="jodit-media",r.D.prototype.mediaInFakeBlock=!0,r.D.prototype.mediaBlocks=["video","audio"],r.D.prototype.controls.video={popup(t,e,s,i){const o=new ls.x4(t,[new ls.eC(t,[new ls.u3(t,{name:"url",required:!0,label:"URL",placeholder:"https://",validators:["url"]})]),new ls.eC(t,[(0,C.zx)(t,"","Insert","primary").onAction((()=>o.submit()))])]),n=new ls.x4(t,[new ls.eC(t,[new ls.GJ(t,{name:"code",required:!0,label:"Embed code"})]),new ls.eC(t,[(0,C.zx)(t,"","Insert","primary").onAction((()=>n.submit()))])]),r=[],a=e=>{t.s.restore(),t.s.insertHTML(e),i()};return t.s.save(),r.push({icon:"link",name:"Link",content:o.container},{icon:"source",name:"Code",content:n.container}),o.onSubmit((t=>{a((0,g.convertMediaUrlToVideoEmbed)(t.url))})),n.onSubmit((t=>{a(t.code)})),(0,Le.IL)(t,r)},tags:["iframe"],tooltip:"Insert youtube/vimeo video"},r.D.prototype.controls.file={popup(t,e,s,i){const o=(e,s="")=>{t.s.insertNode(t.createInside.fromHTML(`${s||e}`))};let n=null;return e&&(M.i.isTag(e,"a")||M.i.closest(e,"a",t.editor))&&(n=M.i.isTag(e,"a")?e:M.i.closest(e,"a",t.editor)),(0,Le.ov)(t,{filebrowser(t){t.files&&t.files.forEach((e=>o(t.baseurl+e))),i()},upload:!0,url(t,e){n?(n.setAttribute("href",t),n.setAttribute("title",e)):o(t,e),i()}},n,i,!1)},tags:["a"],tooltip:"Insert file"},r.D.prototype.mobileTapTimeout=300,r.D.prototype.toolbarAdaptive=!0,r.D.prototype.controls.dots={mode:a.MODE_SOURCE+a.MODE_WYSIWYG,popup(t,e,s,i,o){let n=s.data;return void 0===n&&(n={toolbar:O(t),rebuild(){var e;if(o){const s=t.e.fire("getDiffButtons.mobile",o.closest(N.bz));if(s&&n){n.toolbar.build((0,g.splitArray)(s));const i=(null===(e=t.toolbar.firstButton)||void 0===e?void 0:e.container.offsetWidth)||36;n.toolbar.container.style.width=3*(i+4)+"px"}}}},s.data=n),n.rebuild(),n.toolbar},tooltip:"Show all"};var fs=s(12);const ms=(t,e,{control:s})=>{var i;const o="button"+s.command,n=null!==(i=s.args&&s.args[0])&&void 0!==i?i:(0,fs.q)(t,o);(0,fs.q)(t,o,n),t.execCommand(s.command,!1,"default"===n?null:n)};r.D.prototype.controls.ul={command:"insertUnorderedList",tags:["ul"],tooltip:"Insert Unordered List",list:{default:"Default",circle:"Circle",disc:"Dot",square:"Quadrate"},exec:ms},r.D.prototype.controls.ol={command:"insertOrderedList",tags:["ol"],tooltip:"Insert Ordered List",list:{default:"Default","lower-alpha":"Lower Alpha","lower-greek":"Lower Greek","lower-roman":"Lower Roman","upper-alpha":"Upper Alpha","upper-roman":"Upper Roman"},exec:ms};class gs extends X{constructor(){super(...arguments),this.buttons=[{name:"ul",group:"list"},{name:"ol",group:"list"}]}afterInit(t){t.registerCommand("insertUnorderedList",this.onCommand).registerCommand("insertOrderedList",this.onCommand)}onCommand(t,e,s){return this.jodit.s.applyStyle({listStyleType:null!=s?s:null},{element:"insertunorderedlist"===t?"ul":"ol"}),this.jodit.synchronizeValues(),!1}beforeDestruct(t){}}function vs(t){t.o.hidePoweredByJodit||t.o.inline||!(t.o.showCharsCounter||t.o.showWordsCounter||t.o.showXPathInStatusbar)||t.hookStatus("ready",(()=>{t.statusbar.append(t.create.fromHTML('\n\t\t\t\t\t\t\tPowered by Jodit\n\t\t\t\t\t\t'),!0)}))}(0,n.gn)([q.autobind],gs.prototype,"onCommand",null),r.D.prototype.showPlaceholder=!0,r.D.prototype.placeholder="Type something",r.D.prototype.useInputsPlaceholder=!0;class bs extends X{constructor(){super(...arguments),this.addNativeListeners=()=>{this.j.e.off(this.j.editor,"input.placeholder keydown.placeholder").on(this.j.editor,"input.placeholder keydown.placeholder",this.toggle)},this.addEvents=()=>{const t=this.j;t.o.useInputsPlaceholder&&t.element.hasAttribute("placeholder")&&(this.placeholderElm.innerHTML=(0,g.attr)(t.element,"placeholder")||""),t.e.fire("placeholder",this.placeholderElm.innerHTML),t.e.off(".placeholder").on("changePlace.placeholder",this.addNativeListeners).on("change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder mousedown.placeholder afterSetMode.placeholder changePlace.placeholder",this.toggle).on(window,"load",this.toggle),this.addNativeListeners(),this.toggle()}}afterInit(t){t.o.showPlaceholder&&(this.placeholderElm=t.c.fromHTML(``),"rtl"===t.o.direction&&(this.placeholderElm.style.right="0px",this.placeholderElm.style.direction="rtl"),t.e.on("readonly",(t=>{t?this.hide():this.toggle()})).on("changePlace",this.addEvents),this.addEvents())}show(){const t=this.j;if(t.o.readonly)return;let e=0,s=0;const i=t.s.current(),o=i&&M.i.closest(i,M.i.isBlock,t.editor)||t.editor,n=t.ew.getComputedStyle(o);t.workplace.appendChild(this.placeholderElm);const{firstChild:r}=t.editor;if(M.i.isElement(r)&&!zt.Ph.isMarker(r)){const i=t.ew.getComputedStyle(r);e=parseInt(i.getPropertyValue("margin-top"),10),s=parseInt(i.getPropertyValue("margin-left"),10),this.placeholderElm.style.fontSize=parseInt(i.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=i.getPropertyValue("line-height")}else this.placeholderElm.style.fontSize=parseInt(n.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=n.getPropertyValue("line-height");(0,g.css)(this.placeholderElm,{display:"block",textAlign:n.getPropertyValue("text-align"),marginTop:Math.max(parseInt(n.getPropertyValue("margin-top"),10),e),marginLeft:Math.max(parseInt(n.getPropertyValue("margin-left"),10),s)})}hide(){M.i.safeRemove(this.placeholderElm)}toggle(){const t=this.j;t.editor&&!t.isInDestruct&&(t.getRealMode()===a.MODE_WYSIWYG&&(t=>{if(!t.firstChild)return!0;const e=t.firstChild;if(a.MAY_BE_REMOVED_WITH_KEY.test(e.nodeName)||/^(TABLE)$/i.test(e.nodeName))return!1;const s=M.i.next(e,(t=>t&&!M.i.isEmptyTextNode(t)),t);return M.i.isText(e)&&!s?M.i.isEmptyTextNode(e):!s&&M.i.each(e,(t=>!M.i.isTag(t,["ul","li","ol"])&&(M.i.isEmpty(t)||M.i.isTag(t,"br"))))})(t.editor)?this.show():this.hide())}beforeDestruct(t){this.hide(),t.e.off(".placeholder").off(window,"load",this.toggle)}}(0,n.gn)([(0,q.debounce)((t=>t.defaultTimeout/10),!0)],bs.prototype,"toggle",null),r.D.prototype.controls.redo={mode:a.MODE_SPLIT,isDisabled:t=>!t.history.canRedo(),tooltip:"Redo"},r.D.prototype.controls.undo={mode:a.MODE_SPLIT,isDisabled:t=>!t.history.canUndo(),tooltip:"Undo"};class ws extends X{constructor(){super(...arguments),this.buttons=[{name:"undo",group:"history"},{name:"redo",group:"history"}]}beforeDestruct(){}afterInit(t){const e=e=>(t.history[e](),!1);t.registerCommand("redo",{exec:e,hotkeys:["ctrl+y","ctrl+shift+z","cmd+y","cmd+shift+z"]}),t.registerCommand("undo",{exec:e,hotkeys:["ctrl+z","cmd+z"]})}}r.D.prototype.allowResizeTags=["img","iframe","table","jodit"],r.D.prototype.resizer={showSize:!0,hideSizeTimeout:1e3,forImageChangeAttributes:!0,min_width:10,min_height:10};const ys="__jodit-resizer_binded";class Cs extends X{constructor(){super(...arguments),this.LOCK_KEY="resizer",this.element=null,this.isResized=!1,this.isShown=!1,this.start_x=0,this.start_y=0,this.width=0,this.height=0,this.ratio=0,this.rect=this.j.c.fromHTML('
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t100x100\n\t\t\t
'),this.sizeViewer=this.rect.getElementsByTagName("span")[0],this.onResize=t=>{if(this.isResized){if(!this.element)return;let e,s;if(this.j.options.iframe){const i=this.getWorkplacePosition();e=t.clientX+i.left-this.start_x,s=t.clientY+i.top-this.start_y}else e=t.clientX-this.start_x,s=t.clientY-this.start_y;const i=this.handle.className;let o=0,n=0;M.i.isTag(this.element,"img")?(e?(o=this.width+(i.match(/left/)?-1:1)*e,n=Math.round(o/this.ratio)):(n=this.height+(i.match(/top/)?-1:1)*s,o=Math.round(n*this.ratio)),o>(0,g.innerWidth)(this.j.editor,this.j.ow)&&(o=(0,g.innerWidth)(this.j.editor,this.j.ow),n=Math.round(o/this.ratio))):(o=this.width+(i.match(/left/)?-1:1)*e,n=this.height+(i.match(/top/)?-1:1)*s),o>this.j.o.resizer.min_width&&this.applySize(this.element,"width",this.rect.parentNode.offsetWidth>o?o:"100%"),n>this.j.o.resizer.min_height&&this.applySize(this.element,"height",n),this.updateSize(),this.showSizeViewer(this.element.offsetWidth,this.element.offsetHeight),t.stopImmediatePropagation()}},this.onClickOutside=t=>{this.isShown&&(this.isResized?(this.j.unlock(),this.isResized=!1,this.j.synchronizeValues(),t.stopImmediatePropagation(),this.j.e.off(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)):this.hide())},this.onClickElement=t=>{this.isResized||this.element===t&&this.isShown||(this.element=t,this.show(),M.i.isTag(this.element,"img")&&!this.element.complete&&this.j.e.on(this.element,"load",this.updateSize))},this.updateSize=()=>{if(!this.isInDestruct&&this.isShown&&this.element&&this.rect){const t=this.getWorkplacePosition(),e=(0,g.offset)(this.element,this.j,this.j.ed),s=parseInt(this.rect.style.left||"0",10),i=this.rect.offsetWidth,o=this.rect.offsetHeight,n=e.top-t.top,r=e.left-t.left;parseInt(this.rect.style.top||"0",10)===n&&s===r&&i===this.element.offsetWidth&&o===this.element.offsetHeight||((0,g.css)(this.rect,{top:n,left:r,width:this.element.offsetWidth,height:this.element.offsetHeight}),this.j.events&&(this.j.e.fire(this.element,"changesize"),isNaN(s)||this.j.e.fire("resize")))}},this.hideSizeViewer=()=>{this.sizeViewer.style.opacity="0"}}afterInit(t){(0,g.$$)("div",this.rect).forEach((e=>{t.e.on(e,"mousedown.resizer touchstart.resizer",this.onClickHandle.bind(this,e))})),_.TB.on("hideHelpers",this.hide),t.e.on("readonly",(t=>{t&&this.hide()})).on("afterInit changePlace",this.addEventListeners.bind(this)).on("afterGetValueFromEditor.resizer",(t=>{const e=/]+data-jodit_iframe_wrapper[^>]+>(.*?]*>.*?<\/iframe>.*?)<\/jodit>/gi;e.test(t.value)&&(t.value=t.value.replace(e,"$1"))})).on("hideResizer",this.hide).on("change afterInit afterSetMode",this.onChangeEditor),this.addEventListeners(),this.onChangeEditor()}onEditorClick(t){let e=t.target;const{editor:s,options:{allowResizeTags:i}}=this.j;for(;e&&e!==s;){if(M.i.isTag(e,i))return this.bind(e),void this.onClickElement(e);e=e.parentNode}}addEventListeners(){const t=this.j;t.e.off(t.editor,".resizer").off(t.ow,".resizer").on(t.editor,"keydown.resizer",(t=>{this.isShown&&t.key===a.KEY_DELETE&&this.element&&!M.i.isTag(this.element,"table")&&this.onDelete(t)})).on(t.ow,"resize.resizer",this.updateSize).on("resize.resizer",this.updateSize).on(t.ow,"mouseup.resizer keydown.resizer touchend.resizer",this.onClickOutside).on([t.ow,t.editor],"scroll.resizer",(()=>{this.isShown&&!this.isResized&&this.hide()}))}onClickHandle(t,e){if(!this.element||!this.element.parentNode)return this.hide(),!1;this.handle=t,e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.ratio=this.width/this.height,this.isResized=!0,this.start_x=e.clientX,this.start_y=e.clientY,this.j.e.fire("hidePopup"),this.j.lock(this.LOCK_KEY),this.j.e.on(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)}getWorkplacePosition(){return(0,g.offset)(this.rect.parentNode||this.j.od.documentElement,this.j,this.j.od,!0)}applySize(t,e,s){const i=M.i.isImage(t)&&this.j.o.resizer.forImageChangeAttributes;i&&(0,g.attr)(t,e,s),i&&!t.style[e]||(0,g.css)(t,e,s)}onDelete(t){this.element&&("JODIT"!==this.element.tagName?this.j.s.select(this.element):(M.i.safeRemove(this.element),this.hide(),t.preventDefault()))}onChangeEditor(){this.isShown&&(this.element&&this.element.parentNode?this.updateSize():this.hide()),(0,g.$$)("iframe",this.j.editor).forEach(this.bind)}bind(t){if(!M.i.isHTMLElement(t)||(0,g.dataBind)(t,ys))return;let e;if((0,g.dataBind)(t,ys,!0),M.i.isTag(t,"iframe")){const s=t;M.i.isHTMLElement(t.parentNode)&&(0,g.attr)(t.parentNode,"-jodit_iframe_wrapper")?t=t.parentNode:(e=this.j.createInside.fromHTML(''),(0,g.attr)(e,"style",(0,g.attr)(t,"style")),(0,g.css)(e,{display:"inline-block"===t.style.display?"inline-block":"block",width:t.offsetWidth,height:t.offsetHeight}),t.parentNode&&t.parentNode.insertBefore(e,t),e.appendChild(t),t=e),this.j.e.off(t,"mousedown.select touchstart.select").on(t,"mousedown.select touchstart.select",(()=>{this.j.s.select(t)})).off(t,"changesize").on(t,"changesize",(()=>{s.setAttribute("width",t.offsetWidth+"px"),s.setAttribute("height",t.offsetHeight+"px")}))}this.j.e.on(t,"dragstart",this.hide)}showSizeViewer(t,e){this.j.o.resizer.showSize&&(this.sizeViewer.offsetWidth>t||this.sizeViewer.offsetHeight>e?this.hideSizeViewer():(this.sizeViewer.style.opacity="1",this.sizeViewer.textContent=`${t} x ${e}`,this.j.async.setTimeout(this.hideSizeViewer,{timeout:this.j.o.resizer.hideSizeTimeout,label:"hideSizeViewer"})))}show(){this.j.o.readonly||this.isShown||(this.isShown=!0,this.rect.parentNode||((0,g.markOwner)(this.j,this.rect),this.j.workplace.appendChild(this.rect)),this.j.isFullSize&&(this.rect.style.zIndex=""+(0,g.css)(this.j.container,"zIndex")),this.updateSize())}hide(){this.isResized||(this.isResized=!1,this.isShown=!1,this.element=null,M.i.safeRemove(this.rect))}beforeDestruct(t){this.hide(),_.TB.off("hideHelpers",this.hide),t.e.off(this.j.ow,".resizer").off(".resizer")}}(0,n.gn)([(0,q.watch)(":click")],Cs.prototype,"onEditorClick",null),(0,n.gn)([(0,q.debounce)()],Cs.prototype,"onChangeEditor",null),(0,n.gn)([q.autobind],Cs.prototype,"bind",null),(0,n.gn)([q.autobind],Cs.prototype,"hide",null);var xs=s(36);class Es{constructor(t=xs.Q){this.searchIndex=t,this.queue=[],this.value=""}add(t){var e;const s=(null!==(e=t.nodeValue)&&void 0!==e?e:"").toLowerCase();if(!s.length)return;const i=this.value.length;this.queue.push({startIndex:i,endIndex:i+s.length,node:t}),this.value+=s}ranges(t,e=0){const s=[];let i=e,o=0,n=0;do{if([i,o]=this.searchIndex(t,this.value,i),-1!==i){let t,e,r=0,a=0;for(let s=n;this.queue.length>s;s+=1)if(!t&&this.queue[s].endIndex>i&&(t=this.queue[s].node,r=i-this.queue[s].startIndex),t&&this.queue[s].endIndex>=i+o){e=this.queue[s].node,a=i+o-this.queue[s].startIndex,n=s;break}t&&e&&s.push({startContainer:t,startOffset:r,endContainer:e,endOffset:a}),i+=o}}while(-1!==i);return 0===s.length?null:s}}var js=s(42);const Ss="jd-tmp-selection";function ks(t,e,s,i){if(null==t.startContainer.nodeValue||null==t.endContainer.nodeValue)return;const o=s.element("span",{[Ss]:!0}),n=t.startContainer.nodeValue;let r=0;if(0!==t.startOffset){const e=s.text(n.substring(0,t.startOffset));t.startContainer.nodeValue=n.substring(t.startOffset),M.i.before(t.startContainer,e),t.startContainer===t.endContainer&&(r=t.startOffset,t.endOffset-=r),t.startOffset=0}const a=t.endContainer.nodeValue;if(t.endOffset!==a.length){const i=s.text(a.substring(t.endOffset));t.endContainer.nodeValue=a.substring(0,t.endOffset),M.i.after(t.endContainer,i);for(const s of e){if(s.startContainer!==t.endContainer)break;s.startContainer=i,s.startOffset=s.startOffset-t.endOffset-r,s.endContainer===t.endContainer&&(s.endContainer=i,s.endOffset=s.endOffset-t.endOffset-r)}t.endOffset=t.endContainer.nodeValue.length}let l=t.startContainer;do{if(!l)break;if(!M.i.isText(l)||M.i.isElement(c=l.parentNode)&&c.hasAttribute(Ss)||M.i.wrap(l,o.cloneNode(),s),l===t.endContainer)break;let e=l.firstChild||l.nextSibling;if(!e){for(;l&&!l.nextSibling&&l!==i;)l=l.parentNode;e=null==l?void 0:l.nextSibling}l=e}while(l&&l!==i);var c}function Ts(t){return(0,js.$$)(`[${Ss}]`,t)}function Is(t){Ts(t).forEach((t=>M.i.unwrap(t)))}let _s=class extends N.u1{constructor(t){super(t),this.selInfo=null,this._currentIndex=0,this.isOpened=!1;const{query:e,replace:s,cancel:i,next:o,prev:n,replaceBtn:r,current:l,count:c}=(0,g.refs)(this.container);this.queryInput=e,this.replaceInput=s,this.closeButton=i,this.replaceButton=r,this.currentBox=l,this.countBox=c,t.e.on(this.closeButton,"pointerdown",(()=>(this.close(),!1))).on(this.queryInput,"input",(()=>{this.currentIndex=0})).on(this.queryInput,"pointerdown",(()=>{t.s.isFocused()&&(t.s.removeMarkers(),this.selInfo=t.s.save())})).on(this.replaceButton,"pointerdown",(()=>(t.e.fire(this,"pressReplaceButton"),!1))).on(o,"pointerdown",(()=>(t.e.fire("searchNext"),!1))).on(n,"pointerdown",(()=>(t.e.fire("searchPrevious"),!1))).on(this.queryInput,"input",(()=>{this.setMod("empty-query",!(0,g.trim)(this.queryInput.value).length)})).on(this.queryInput,"keydown",this.j.async.debounce((e=>{e.key===a.KEY_ENTER?(e.preventDefault(),e.stopImmediatePropagation(),t.e.fire("searchNext")&&this.close()):t.e.fire(this,"needUpdateCounters")}),this.j.defaultTimeout))}className(){return"UISearch"}render(){return`
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t0/0\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
`}get currentIndex(){return this._currentIndex}set currentIndex(t){this._currentIndex=t,this.currentBox.innerText=""+t}set count(t){this.countBox.innerText=""+t}get query(){return this.queryInput.value}get replace(){return this.replaceInput.value}onEditorKeyDown(t){if(!this.isOpened)return;const{j:e}=this;if(e.getRealMode()===a.MODE_WYSIWYG)switch(t.key){case a.KEY_ESC:this.close();break;case a.KEY_F3:this.queryInput.value&&(e.e.fire(t.shiftKey?"searchPrevious":"searchNext"),t.preventDefault())}}open(t=!1){this.isOpened||(this.j.workplace.appendChild(this.container),this.isOpened=!0),this.calcSticky(this.j.e.fire("getStickyState.sticky")||!1),this.j.e.fire("hidePopup"),this.setMod("replace",t);const e=""+(this.j.s.sel||"");e&&(this.queryInput.value=e),this.setMod("empty-query",!e.length),this.j.e.fire(this,"needUpdateCounters"),e?this.queryInput.select():this.queryInput.focus()}close(){this.isOpened&&(this.j.s.restore(),M.i.safeRemove(this.container),this.isOpened=!1,this.j.e.fire(this,"afterClose"))}calcSticky(t){if(this.isOpened)if(this.setMod("sticky",t),t){const t=(0,g.position)(this.j.toolbarContainer);(0,g.css)(this.container,{top:t.top+t.height,left:t.left+t.width})}else(0,g.css)(this.container,{top:null,left:null})}};(0,n.gn)([(0,q.watch)([":keydown","queryInput:keydown"])],_s.prototype,"onEditorKeyDown",null),(0,n.gn)([q.autobind],_s.prototype,"open",null),(0,n.gn)([q.autobind],_s.prototype,"close",null),(0,n.gn)([(0,q.watch)(":toggleSticky")],_s.prototype,"calcSticky",null),_s=(0,n.gn)([q.component],_s),r.D.prototype.useSearch=!0,r.D.prototype.search={lazyIdleTimeout:0},r.D.prototype.controls.find={tooltip:"Find",icon:"search",exec(t,e,{control:s}){switch(s.args&&s.args[0]){case"findPrevious":t.e.fire("searchPrevious");break;case"findNext":t.e.fire("searchNext");break;case"replace":t.execCommand("openReplaceDialog");break;default:t.execCommand("openSearchDialog")}},list:{search:"Find",findNext:"Find Next",findPrevious:"Find Previous",replace:"Replace"},childTemplate:(t,e,s)=>s};class qs extends X{constructor(){super(...arguments),this.buttons=[{name:"find",group:"search"}],this.previousQuery="",this.drawPromise=null,this.walker=null,this.walkerCount=null,this.cache={},this.wrapFrameRequest=0}get ui(){return new _s(this.j)}async updateCounters(){this.ui.isOpened&&(this.ui.count=await this.calcCounts(this.ui.query))}onPressReplaceButton(){this.findAndReplace(this.ui.query),this.updateCounters()}tryScrollToElement(t){let e=M.i.closest(t,M.i.isElement,this.j.editor);e||(e=M.i.prev(t,M.i.isElement,this.j.editor)),e&&e!==this.j.editor&&(0,g.scrollIntoViewIfNeeded)(e,this.j.editor,this.j.ed)}async calcCounts(t){return this.walkerCount&&this.walkerCount.break(),this.walkerCount=new M.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout}),(await this.find(this.walkerCount,t)).length}async findAndReplace(t){this.walker&&this.walker.break(),this.walker=new M.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout});const e=this.j.s.range,s=await this.find(this.walker,t);let i=this.findCurrentIndexInRanges(s,e);-1===i&&(i=0);const o=s[i];if(o){try{const t=this.j.ed.createRange();t.setStart(o.startContainer,o.startOffset),t.setEnd(o.endContainer,o.endOffset),t.deleteContents();const e=this.j.createInside.text(this.ui.replace);t.insertNode(e),this.j.s.select(e),this.tryScrollToElement(e),this.cache={},this.j.synchronizeValues()}catch(t){}return this.j.e.fire("afterFindAndReplace"),!0}return!1}async findAndSelect(t,e){var s;this.walker&&this.walker.break(),this.walker=new M.b(this.j.async,{timeout:this.j.defaultTimeout});const i=await this.find(this.walker,t);if(!i.length)return!1;this.previousQuery===t&&Ts(this.j.editor).length||(null===(s=this.drawPromise)||void 0===s||s.rejectCallback(),this.j.async.cancelAnimationFrame(this.wrapFrameRequest),Is(this.j.editor),this.drawPromise=this.drawSelectionRanges(i)),this.previousQuery=t;let o=this.ui.currentIndex-1;o=-1===o?0:e?o===i.length-1?0:o+1:0===o?i.length-1:o-1,this.ui.currentIndex=o+1;const n=i[o];if(n){const t=this.j.ed.createRange();try{t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),this.j.s.selectRange(t)}catch(t){}return this.tryScrollToElement(n.startContainer),await this.updateCounters(),await this.drawPromise,this.j.e.fire("afterFindAndSelect"),!0}return!1}findCurrentIndexInRanges(t,e){return t.findIndex((t=>t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.startContainer&&t.endOffset===e.endOffset))}async isValidCache(t){return(await t).every((t=>{var e,s,i,o;return t.startContainer.isConnected&&t.startOffset<=(null!==(s=null===(e=t.startContainer.nodeValue)||void 0===e?void 0:e.length)&&void 0!==s?s:0)&&t.endContainer.isConnected&&t.endOffset<=(null!==(o=null===(i=t.endContainer.nodeValue)||void 0===i?void 0:i.length)&&void 0!==o?o:0)}))}async find(t,e){if(!e.length)return[];const s=this.cache[e];if(s&&await this.isValidCache(s))return s;const i=new Es(this.j.o.search.fuzzySearch);return this.cache[e]=this.j.async.promise((s=>{t.on("break",(()=>{s([])})).on("visit",(t=>(M.i.isText(t)&&i.add(t),!1))).on("end",(()=>{var t;s(null!==(t=i.ranges(e))&&void 0!==t?t:[])})).setWork(this.j.editor)})),this.cache[e]}drawSelectionRanges(t){const{async:e,createInside:s,editor:i}=this.j;e.cancelAnimationFrame(this.wrapFrameRequest);const o=[...t];let n,r=0;return e.promise((t=>{const a=()=>{do{n=o.shift(),n&&ks(n,o,s,i),r+=1}while(n&&5>=r);o.length?this.wrapFrameRequest=e.requestAnimationFrame(a):t()};a()}))}onAfterGetValueFromEditor(t){t.value=t.value.replace(RegExp(`]+${Ss}[^>]+>(.*?)`,"g"),"$1")}afterInit(t){if(t.o.useSearch){const e=this;t.e.on("beforeSetMode.search",(()=>{this.ui.close()})).on(this.ui,"afterClose",(()=>{Is(t.editor),this.ui.currentIndex=0,this.ui.count=0,this.cache={}})).on("click",(()=>{this.ui.currentIndex=0,Is(t.editor)})).on("change.search",(()=>{this.cache={}})).on("keydown.search mousedown.search",t.async.debounce((()=>{this.ui.selInfo&&(t.s.removeMarkers(),this.ui.selInfo=null),this.ui.isOpened&&this.updateCounters()}),t.defaultTimeout)).on("searchNext.search searchPrevious.search",(()=>(this.ui.isOpened||this.ui.open(),e.findAndSelect(e.ui.query,"searchNext"===t.e.current).catch((()=>{}))))).on("search.search",((t,s=!0)=>(this.ui.currentIndex=0,e.findAndSelect(t||"",s).catch((()=>{}))))),t.registerCommand("search",{exec:(t,s,i=!0)=>(s&&e.findAndSelect(s,i).catch((()=>{})),!1)}).registerCommand("openSearchDialog",{exec:()=>(e.ui.open(),!1),hotkeys:["ctrl+f","cmd+f"]}).registerCommand("openReplaceDialog",{exec:()=>(t.o.readonly||e.ui.open(!0),!1),hotkeys:["ctrl+h","cmd+h"]})}}beforeDestruct(t){this.ui.destruct(),t.e.off(".search")}}(0,n.gn)([q.cache],qs.prototype,"ui",null),(0,n.gn)([(0,q.watch)("ui:needUpdateCounters")],qs.prototype,"updateCounters",null),(0,n.gn)([(0,q.watch)("ui:pressReplaceButton")],qs.prototype,"onPressReplaceButton",null),(0,n.gn)([q.autobind],qs.prototype,"findAndReplace",null),(0,n.gn)([q.autobind],qs.prototype,"findAndSelect",null),(0,n.gn)([q.autobind],qs.prototype,"find",null),(0,n.gn)([(0,q.watch)(":afterGetValueFromEditor")],qs.prototype,"onAfterGetValueFromEditor",null);var Ls=s(35);r.D.prototype.select={normalizeSelectionBeforeCutAndCopy:!0};class zs extends X{constructor(){super(...arguments),this.proxyEventsList=["click","mousedown","touchstart","mouseup","touchend"]}afterInit(t){this.proxyEventsList.forEach((e=>{t.e.on(e+".select",this.onStartSelection)}))}beforeDestruct(t){this.proxyEventsList.forEach((e=>{t.e.on(e+".select",this.onStartSelection)}))}onStartSelection(t){const{j:e}=this;let s,i=t.target;for(;void 0===s&&i&&i!==e.editor;)s=e.e.fire((0,Ls.e)(t.type+"_"+i.nodeName.toLowerCase()),i,t),i=i.parentElement;"click"===t.type&&void 0===s&&i===e.editor&&e.e.fire(t.type+"Editor",i,t)}onOutsideClick(t){const e=t.target;M.i.up(e,(t=>t===this.j.editor))||N.u1.closestElement(e,N.GI)||this.j.e.fire("outsideClick",t)}beforeCommandCut(t){const{s:e}=this.j;if("cut"===t&&!e.isCollapsed()){const t=e.current();t&&M.i.isOrContains(this.j.editor,t)&&this.onCopyNormalizeSelectionBound()}}onCopyNormalizeSelectionBound(t){const{s:e,editor:s,o:i}=this.j;i.select.normalizeSelectionBeforeCutAndCopy&&!e.isCollapsed()&&(!t||t.isTrusted&&M.i.isNode(t.target)&&M.i.isOrContains(s,t.target))&&this.jodit.s.expandSelection()}}(0,n.gn)([q.autobind],zs.prototype,"onStartSelection",null),(0,n.gn)([(0,q.watch)("ow:click")],zs.prototype,"onOutsideClick",null),(0,n.gn)([(0,q.watch)([":beforeCommand"])],zs.prototype,"beforeCommandCut",null),(0,n.gn)([(0,q.watch)([":copy",":cut"])],zs.prototype,"onCopyNormalizeSelectionBound",null),r.D.prototype.width="auto",r.D.prototype.minWidth=200,r.D.prototype.maxWidth="100%",r.D.prototype.allowResizeX=!1,r.D.prototype.allowResizeY=!0,r.D.prototype.height="auto",r.D.prototype.minHeight=200,r.D.prototype.maxHeight="auto",r.D.prototype.saveHeightInStorage=!1;let Ms=class extends X{constructor(){super(...arguments),this.isResized=!1,this.start={x:0,y:0,w:0,h:0},this.handle=this.j.c.div("jodit-editor__resize",N.JO.get("resize_handler"))}afterInit(t){const{height:e,width:s,allowResizeX:i}=t.o;let{allowResizeY:o}=t.o;"auto"===e&&"auto"!==s&&(o=!1),"auto"===e&&"auto"===s||!i&&!o||(t.statusbar.setMod("resize-handle",!0),t.e.on("toggleFullSize.resizeHandler",(()=>{this.handle.style.display=t.isFullSize?"none":"block"})).on(this.handle,"mousedown touchstart",this.onHandleResizeStart).on(t.ow,"mouseup touchend",this.onHandleResizeEnd),t.container.appendChild(this.handle))}onHandleResizeStart(t){this.isResized=!0,this.start.x=t.clientX,this.start.y=t.clientY,this.start.w=this.j.container.offsetWidth,this.start.h=this.j.container.offsetHeight,this.j.lock(),this.j.e.on(this.j.ow,"mousemove touchmove",this.onHandleResize),t.preventDefault()}onHandleResize(t){this.isResized&&(this.j.o.allowResizeY&&this.j.e.fire("setHeight",this.start.h+t.clientY-this.start.y),this.j.o.allowResizeX&&this.j.e.fire("setWidth",this.start.w+t.clientX-this.start.x),this.j.e.fire("resize"))}onHandleResizeEnd(){this.isResized&&(this.isResized=!1,this.j.e.off(this.j.ow,"mousemove touchmove",this.onHandleResize),this.j.unlock())}beforeDestruct(){M.i.safeRemove(this.handle),this.j.e.off(this.j.ow,"mouseup touchsend",this.onHandleResizeEnd)}};Ms.requires=["size"],Ms=(0,n.gn)([q.autobind],Ms);let Ns=class extends X{constructor(){super(...arguments),this.resizeWorkspaces=this.j.async.debounce(this.resizeWorkspaceImd,this.j.defaultTimeout,!0)}afterInit(t){t.e.on("setHeight.size",this.setHeight).on("setWidth.size",this.setWidth).on("afterInit.size changePlace.size",this.initialize,void 0,!0).on(t.ow,"load.size",this.resizeWorkspaces).on("afterInit.size resize.size afterUpdateToolbar.size scroll.size afterResize.size",this.resizeWorkspaces).on("toggleFullSize.size toggleToolbar.size",this.resizeWorkspaceImd),this.initialize()}initialize(){const{j:t}=this;if(t.o.inline)return;let{height:e}=t.o;if(t.o.saveHeightInStorage&&"auto"!==e){const s=t.storage.get("height");s&&(e=s)}(0,g.css)(t.editor,{minHeight:"100%"}),(0,g.css)(t.container,{minHeight:t.o.minHeight,maxHeight:t.o.maxHeight,minWidth:t.o.minWidth,maxWidth:t.o.maxWidth}),this.setHeight(e),this.setWidth(t.o.width)}setHeight(t){if((0,g.isNumber)(t)){const{minHeight:e,maxHeight:s}=this.j.o;(0,g.isNumber)(e)&&e>t&&(t=e),(0,g.isNumber)(s)&&t>s&&(t=s)}(0,g.css)(this.j.container,"height",t),this.j.o.saveHeightInStorage&&this.j.storage.set("height",t),this.resizeWorkspaceImd()}setWidth(t){if((0,g.isNumber)(t)){const{minWidth:e,maxWidth:s}=this.j.o;(0,g.isNumber)(e)&&e>t&&(t=e),(0,g.isNumber)(s)&&t>s&&(t=s)}(0,g.css)(this.j.container,"width",t),this.resizeWorkspaceImd()}getNotWorkHeight(){var t,e;return((null===(t=this.j.toolbarContainer)||void 0===t?void 0:t.offsetHeight)||0)+((null===(e=this.j.statusbar)||void 0===e?void 0:e.getHeight())||0)+2}resizeWorkspaceImd(){if(!this.j||this.j.isDestructed||!this.j.o||this.j.o.inline)return;if(!this.j.container||!this.j.container.parentNode)return;const t=((0,g.css)(this.j.container,"minHeight")||0)-this.getNotWorkHeight();if((0,g.isNumber)(t)&&t>0&&([this.j.workplace,this.j.iframe,this.j.editor].map((e=>{e&&(0,g.css)(e,"minHeight",t)})),this.j.e.fire("setMinHeight",t)),(0,g.isNumber)(this.j.o.maxHeight)){const t=this.j.o.maxHeight-this.getNotWorkHeight();[this.j.workplace,this.j.iframe,this.j.editor].map((e=>{e&&(0,g.css)(e,"maxHeight",t)})),this.j.e.fire("setMaxHeight",t)}this.j.container&&(0,g.css)(this.j.workplace,"height","auto"!==this.j.o.height||this.j.isFullSize?this.j.container.offsetHeight-this.getNotWorkHeight():"auto")}beforeDestruct(t){t.e.off(t.ow,"load.size",this.resizeWorkspaces).off(".size")}};(0,n.gn)([q.autobind],Ns.prototype,"resizeWorkspaceImd",null),Ns=(0,n.gn)([q.autobind],Ns),r.D.prototype.beautifyHTML=!a.IS_IE,r.D.prototype.sourceEditor="ace",r.D.prototype.sourceEditorNativeOptions={showGutter:!0,theme:"ace/theme/idle_fingers",mode:"ace/mode/html",wrap:!0,highlightActiveLine:!0},r.D.prototype.sourceEditorCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"],r.D.prototype.beautifyHTMLCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify.min.js","https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify-html.min.js"],r.D.prototype.controls.source={mode:a.MODE_SPLIT,exec(t){t.toggleMode()},isActive:t=>t.getRealMode()===a.MODE_SOURCE,tooltip:"Change mode"};class Ps{constructor(t,e,s,i){this.jodit=t,this.container=e,this.toWYSIWYG=s,this.fromWYSIWYG=i,this.className="",this.isReady=!1}get j(){return this.jodit}onReady(){this.replaceUndoManager(),this.isReady=!0,this.j.e.fire(this,"ready")}onReadyAlways(t){var e;this.isReady?t():null===(e=this.j.events)||void 0===e||e.on(this,"ready",t)}}class Ds extends Ps{constructor(){super(...arguments),this.autosize=this.j.async.debounce((()=>{this.instance.style.height="auto",this.instance.style.height=this.instance.scrollHeight+"px"}),this.j.defaultTimeout)}init(t){this.instance=t.c.element("textarea",{class:"jodit-source__mirror"}),this.container.appendChild(this.instance),t.e.on(this.instance,"mousedown keydown touchstart input",t.async.debounce(this.toWYSIWYG,t.defaultTimeout)).on("setMinHeight.source",(t=>{(0,g.css)(this.instance,"minHeight",t)})).on(this.instance,"change keydown mousedown touchstart input",this.autosize).on("afterSetMode.source",this.autosize).on(this.instance,"mousedown focus",(e=>{t.e.fire(e.type,e)})),this.autosize(),this.onReady()}destruct(){M.i.safeRemove(this.instance)}getValue(){return this.instance.value}setValue(t){this.instance.value=t}insertRaw(t){const e=this.getValue();if(0>this.getSelectionStart())this.setValue(e+t);else{const s=this.getSelectionStart(),i=this.getSelectionEnd();this.setValue(e.substring(0,s)+t+e.substring(i,e.length))}}getSelectionStart(){return this.instance.selectionStart}getSelectionEnd(){return this.instance.selectionEnd}setSelectionRange(t,e=t){this.instance.setSelectionRange(t,e)}focus(){this.instance.focus()}setPlaceHolder(t){this.instance.setAttribute("placeholder",t)}setReadOnly(t){t?this.instance.setAttribute("readonly","true"):this.instance.removeAttribute("readonly")}selectAll(){this.instance.select()}replaceUndoManager(){const{history:t}=this.jodit;this.j.e.on(this.instance,"keydown",(e=>{if((e.ctrlKey||e.metaKey)&&"z"===e.key)return e.shiftKey?t.redo():t.undo(),this.setSelectionRange(this.getValue().length),!1}))}}class Rs extends Ps{constructor(){super(...arguments),this.className="jodit_ace_editor",this.proxyOnBlur=t=>{this.j.e.fire("blur",t)},this.proxyOnFocus=t=>{this.j.e.fire("focus",t)},this.proxyOnMouseDown=t=>{this.j.e.fire("mousedown",t)}}aceExists(){return void 0!==this.j.ow.ace}getLastColumnIndex(t){return this.instance.session.getLine(t).length}getLastColumnIndices(){const t=this.instance.session.getLength(),e=[];let s=0;for(let i=0;t>i;i++)s+=this.getLastColumnIndex(i),i>0&&(s+=1),e[i]=s;return e}getRowColumnIndices(t){const e=this.getLastColumnIndices();if(e[0]>=t)return{row:0,column:t};let s=1;for(let i=1;e.length>i;i++)t>e[i]&&(s=i+1);return{row:s,column:t-e[s-1]-1}}setSelectionRangeIndices(t,e){const s=this.getRowColumnIndices(t),i=this.getRowColumnIndices(e);this.instance.getSelection().setSelectionRange({start:s,end:i})}getIndexByRowColumn(t,e){return this.getLastColumnIndices()[t]-this.getLastColumnIndex(t)+e}init(t){const e=()=>{if(void 0!==this.instance||!this.aceExists())return;const e=this.j.c.div("jodit-source__mirror-fake");this.container.appendChild(e),this.instance=t.ow.ace.edit(e),this.instance.setTheme(t.o.sourceEditorNativeOptions.theme),this.instance.renderer.setShowGutter(t.o.sourceEditorNativeOptions.showGutter),this.instance.getSession().setMode(t.o.sourceEditorNativeOptions.mode),this.instance.setHighlightActiveLine(t.o.sourceEditorNativeOptions.highlightActiveLine),this.instance.getSession().setUseWrapMode(!0),this.instance.setOption("indentedSoftWrap",!1),this.instance.setOption("wrap",t.o.sourceEditorNativeOptions.wrap),this.instance.getSession().setUseWorker(!1),this.instance.$blockScrolling=1/0,this.instance.on("change",this.toWYSIWYG),this.instance.on("focus",this.proxyOnFocus),this.instance.on("mousedown",this.proxyOnMouseDown),this.instance.on("blur",this.proxyOnBlur),t.getRealMode()!==a.MODE_WYSIWYG&&this.setValue(this.getValue());const s=this.j.async.debounce((()=>{t.isInDestruct||(this.instance.setOption("maxLines","auto"!==t.o.height?t.workplace.offsetHeight/this.instance.renderer.lineHeight:1/0),this.instance.resize())}),2*this.j.defaultTimeout);t.e.on("afterResize afterSetMode",s),s(),this.onReady()};t.e.on("afterSetMode",(()=>{t.getRealMode()!==a.MODE_SOURCE&&t.getMode()!==a.MODE_SPLIT||(this.fromWYSIWYG(),e())})),e(),this.aceExists()||(0,g.loadNext)(t,t.o.sourceEditorCDNUrlsJS).then((()=>{t.isInDestruct||e()}))}destruct(){var t,e;this.instance.off("change",this.toWYSIWYG),this.instance.off("focus",this.proxyOnFocus),this.instance.off("mousedown",this.proxyOnMouseDown),this.instance.destroy(),null===(e=null===(t=this.j)||void 0===t?void 0:t.events)||void 0===e||e.off("aceInited.source")}setValue(t){if(!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const e=this.j.e.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}this.instance.setValue(t),this.instance.clearSelection()}getValue(){return this.instance.getValue()}setReadOnly(t){this.instance.setReadOnly(t)}focus(){this.instance.focus()}getSelectionStart(){const t=this.instance.selection.getRange();return this.getIndexByRowColumn(t.start.row,t.start.column)}getSelectionEnd(){const t=this.instance.selection.getRange();return this.getIndexByRowColumn(t.end.row,t.end.column)}selectAll(){this.instance.selection.selectAll()}insertRaw(t){const e=this.instance.selection.getCursor(),s=this.instance.session.insert(e,t);this.instance.selection.setRange({start:e,end:s},!1)}setSelectionRange(t,e){this.setSelectionRangeIndices(t,e)}setPlaceHolder(t){}replaceUndoManager(){const{history:t}=this.jodit;this.instance.commands.addCommand({name:"Undo",bindKey:{win:"Ctrl-Z",mac:"Command-Z"},exec(){t.undo()}}),this.instance.commands.addCommand({name:"Redo",bindKey:{win:"Ctrl-Shift-Z",mac:"Command-Shift-Z"},exec(){t.redo()}})}}function As(t,e,s,i,o){let n;if((0,g.isFunction)(t))n=t(e);else switch(t){case"ace":if(!e.o.shadowRoot){n=new Rs(e,s,i,o);break}default:n=new Ds(e,s,i,o)}return n.init(e),n.onReadyAlways((()=>{n.setReadOnly(e.o.readonly)})),n}class Bs extends X{constructor(){super(...arguments),this.buttons=[{name:"source",group:"source"}],this.__lock=!1,this.__oldMirrorValue="",this.tempMarkerStart="{start-jodit-selection}",this.tempMarkerStartReg=/{start-jodit-selection}/g,this.tempMarkerEnd="{end-jodit-selection}",this.tempMarkerEndReg=/{end-jodit-selection}/g,this.getSelectionStart=()=>{var t,e;return null!==(e=null===(t=this.sourceEditor)||void 0===t?void 0:t.getSelectionStart())&&void 0!==e?e:0},this.getSelectionEnd=()=>{var t,e;return null!==(e=null===(t=this.sourceEditor)||void 0===t?void 0:t.getSelectionEnd())&&void 0!==e?e:0}}onInsertHTML(t){var e;if(!this.j.o.readonly&&!this.j.isEditorMode())return null===(e=this.sourceEditor)||void 0===e||e.insertRaw(t),this.toWYSIWYG(),!1}fromWYSIWYG(t=!1){if(!this.__lock||!0===t){this.__lock=!0;const t=this.j.getEditorValue(!1,"source-consumer");t!==this.getMirrorValue()&&this.setMirrorValue(t),this.__lock=!1}}toWYSIWYG(){if(this.__lock)return;const t=this.getMirrorValue();t!==this.__oldMirrorValue&&(this.__lock=!0,this.j.value=t,this.__lock=!1,this.__oldMirrorValue=t)}getNormalPosition(t,e){for(e=e.replace(/<(script|style|iframe)[^>]*>[^]*?<\/\1>/im,(t=>{let e="";for(let s=0;t.length>s;s+=1)e+=a.INVISIBLE_SPACE;return e}));t>0&&e[t]===a.INVISIBLE_SPACE;)t--;let s=t;for(;s>0;){if(s--,"<"===e[s]&&void 0!==e[s+1]&&e[s+1].match(/[\w/]+/i))return s;if(">"===e[s])return t}return t}clnInv(t){return t.replace(a.INVISIBLE_SPACE_REG_EXP(),"")}onSelectAll(t){var e;if("selectall"===t.toLowerCase()&&this.j.getRealMode()===a.MODE_SOURCE)return null===(e=this.sourceEditor)||void 0===e||e.selectAll(),!1}getMirrorValue(){var t;return(null===(t=this.sourceEditor)||void 0===t?void 0:t.getValue())||""}setMirrorValue(t){var e;null===(e=this.sourceEditor)||void 0===e||e.setValue(t)}setFocusToMirror(){var t;null===(t=this.sourceEditor)||void 0===t||t.focus()}saveSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)this.j.s.save(),this.j.synchronizeValues(),this.fromWYSIWYG(!0);else{if(this.j.o.editHTMLDocumentMode)return;const t=this.getMirrorValue();if(this.getSelectionStart()===this.getSelectionEnd()){const e=this.j.s.marker(!0),s=this.getNormalPosition(this.getSelectionStart(),this.getMirrorValue());this.setMirrorValue(t.substr(0,s)+this.clnInv(e.outerHTML)+t.substr(s))}else{const e=this.j.s.marker(!0),s=this.j.s.marker(!1),i=this.getNormalPosition(this.getSelectionStart(),t),o=this.getNormalPosition(this.getSelectionEnd(),t);this.setMirrorValue(t.substr(0,i)+this.clnInv(e.outerHTML)+t.substr(i,o-i)+this.clnInv(s.outerHTML)+t.substr(o))}this.toWYSIWYG()}}removeSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)return this.__lock=!0,this.j.s.restore(),void(this.__lock=!1);let t=this.getMirrorValue(),e=0,s=0;try{if(t=t.replace(/]+data-jodit-selection_marker=(["'])start\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerStart).replace(/]+data-jodit-selection_marker=(["'])end\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerEnd),!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const e=this.j.e.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}if(e=t.indexOf(this.tempMarkerStart),s=e,t=t.replace(this.tempMarkerStartReg,""),-1!==e){const e=t.indexOf(this.tempMarkerEnd);-1!==e&&(s=e)}t=t.replace(this.tempMarkerEndReg,"")}finally{t=t.replace(this.tempMarkerEndReg,"").replace(this.tempMarkerStartReg,"")}this.setMirrorValue(t),this.setMirrorSelectionRange(e,s),this.toWYSIWYG(),this.setFocusToMirror()}setMirrorSelectionRange(t,e){var s;null===(s=this.sourceEditor)||void 0===s||s.setSelectionRange(t,e)}onReadonlyReact(){var t;null===(t=this.sourceEditor)||void 0===t||t.setReadOnly(this.j.o.readonly)}afterInit(t){if(this.mirrorContainer=t.c.div("jodit-source"),t.workplace.appendChild(this.mirrorContainer),t.e.on("afterAddPlace changePlace afterInit",(()=>{t.workplace.appendChild(this.mirrorContainer)})),this.sourceEditor=As("area",t,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG),this.onReadonlyReact(),t.e.on("placeholder.source",(t=>{var e;null===(e=this.sourceEditor)||void 0===e||e.setPlaceHolder(t)})).on("change.source",this.syncValueFromWYSIWYG).on("beautifyHTML",(t=>t)),t.o.beautifyHTML){const e=()=>{var e;const s=t.ow.html_beautify;return!(!s||t.isInDestruct||(null===(e=t.events)||void 0===e||e.off("beautifyHTML").on("beautifyHTML",(t=>s(t))),0))};e()||(0,g.loadNext)(t,t.o.beautifyHTMLCDNUrlsJS).then(e)}this.syncValueFromWYSIWYG(!0),this.initSourceEditor(t)}syncValueFromWYSIWYG(t=!1){const e=this.j;e.getMode()!==a.MODE_SPLIT&&e.getMode()!==a.MODE_SOURCE||this.fromWYSIWYG(t)}initSourceEditor(t){var e;if("area"!==t.o.sourceEditor){const e=As(t.o.sourceEditor,t,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG);e.onReadyAlways((()=>{var s,i;null===(s=this.sourceEditor)||void 0===s||s.destruct(),this.sourceEditor=e,this.syncValueFromWYSIWYG(!0),null===(i=t.events)||void 0===i||i.fire("sourceEditorReady",t)}))}else null===(e=this.sourceEditor)||void 0===e||e.onReadyAlways((()=>{var e;this.syncValueFromWYSIWYG(!0),null===(e=t.events)||void 0===e||e.fire("sourceEditorReady",t)}))}beforeDestruct(){this.sourceEditor&&(this.sourceEditor.destruct(),delete this.sourceEditor),M.i.safeRemove(this.mirrorContainer)}}(0,n.gn)([(0,q.watch)(":insertHTML.source")],Bs.prototype,"onInsertHTML",null),(0,n.gn)([q.autobind],Bs.prototype,"fromWYSIWYG",null),(0,n.gn)([q.autobind],Bs.prototype,"toWYSIWYG",null),(0,n.gn)([q.autobind],Bs.prototype,"getNormalPosition",null),(0,n.gn)([(0,q.watch)(":beforeCommand.source")],Bs.prototype,"onSelectAll",null),(0,n.gn)([(0,q.watch)(":beforeSetMode.source")],Bs.prototype,"saveSelection",null),(0,n.gn)([(0,q.watch)(":afterSetMode.source")],Bs.prototype,"removeSelection",null),(0,n.gn)([q.autobind],Bs.prototype,"setMirrorSelectionRange",null),(0,n.gn)([(0,q.watch)(":readonly.source")],Bs.prototype,"onReadonlyReact",null),(0,n.gn)([q.autobind],Bs.prototype,"syncValueFromWYSIWYG",null),r.D.prototype.showCharsCounter=!0,r.D.prototype.countHTMLChars=!1,r.D.prototype.showWordsCounter=!0;class Os extends X{constructor(){super(...arguments),this.charCounter=null,this.wordCounter=null,this.reInit=()=>{this.j.o.showCharsCounter&&this.charCounter&&this.j.statusbar.append(this.charCounter,!0),this.j.o.showWordsCounter&&this.wordCounter&&this.j.statusbar.append(this.wordCounter,!0),this.j.e.off("change keyup",this.calc).on("change keyup",this.calc),this.calc()},this.calc=this.j.async.throttle((()=>{const t=this.j.text;if(this.j.o.showCharsCounter&&this.charCounter){const e=this.j.o.countHTMLChars?this.j.value:t.replace((0,a.SPACE_REG_EXP)(),"");this.charCounter.textContent=this.j.i18n("Chars: %d",e.length)}this.j.o.showWordsCounter&&this.wordCounter&&(this.wordCounter.textContent=this.j.i18n("Words: %d",t.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((t=>t.length)).length))}),this.j.defaultTimeout)}afterInit(){this.charCounter=this.j.c.span(),this.wordCounter=this.j.c.span(),this.j.e.on("afterInit changePlace afterAddPlace",this.reInit),this.reInit()}beforeDestruct(){M.i.safeRemove(this.charCounter),M.i.safeRemove(this.wordCounter),this.j.e.off("afterInit changePlace afterAddPlace",this.reInit),this.charCounter=null,this.wordCounter=null}}r.D.prototype.toolbarSticky=!0,r.D.prototype.toolbarDisableStickyForMobile=!0,r.D.prototype.toolbarStickyOffset=0;class Hs extends X{constructor(){super(...arguments),this.isToolbarSticked=!1,this.createDummy=t=>{},this.addSticky=t=>{this.isToolbarSticked||(this.createDummy(t),this.j.container.classList.add("jodit_sticky"),this.isToolbarSticked=!0),(0,g.css)(t,{top:this.j.o.toolbarStickyOffset||null,width:this.j.container.offsetWidth-2})},this.removeSticky=t=>{this.isToolbarSticked&&((0,g.css)(t,{width:"",top:""}),this.j.container.classList.remove("jodit_sticky"),this.isToolbarSticked=!1)}}afterInit(t){t.e.on(t.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).on("getStickyState.sticky",(()=>this.isToolbarSticked))}onScroll(){const{jodit:t}=this,e=t.ow.pageYOffset||t.od.documentElement&&t.od.documentElement.scrollTop||0,s=(0,g.offset)(t.container,t,t.od,!0),i=t.getMode()===a.MODE_WYSIWYG&&e+t.o.toolbarStickyOffset>s.top&&s.top+s.height>e+t.o.toolbarStickyOffset&&!(t.o.toolbarDisableStickyForMobile&&this.isMobile());if(t.o.toolbarSticky&&!0===t.o.toolbar&&this.isToolbarSticked!==i){const e=t.toolbarContainer;e&&(i?this.addSticky(e):this.removeSticky(e)),t.e.fire("toggleSticky",i)}}isMobile(){return this.j&&this.j.options&&this.j.container&&this.j.o.sizeSM>=this.j.container.offsetWidth}beforeDestruct(t){this.dummyBox&&M.i.safeRemove(this.dummyBox),t.e.off(t.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).off(".sticky")}}(0,n.gn)([(0,q.throttle)()],Hs.prototype,"onScroll",null),r.D.prototype.spellcheck=!1,r.D.prototype.controls.spellcheck={isActive(t){return t.o.spellcheck},icon:s(66),name:"spellcheck",command:"toggleSpellcheck",tooltip:"Spellchecking"};class Fs extends X{constructor(){super(...arguments),this.buttons=[{group:"state",name:"spellcheck"}]}afterInit(t){t.e.on("afterInit afterAddPlace prepareWYSIWYGEditor",this.toggleSpellcheck),this.toggleSpellcheck(),t.registerCommand("toggleSpellcheck",(()=>{this.jodit.o.spellcheck=!this.jodit.o.spellcheck,this.toggleSpellcheck(),this.j.e.fire("updateToolbar")}))}toggleSpellcheck(){(0,ge.Lj)(this.jodit.editor,"spellcheck",this.jodit.o.spellcheck)}beforeDestruct(t){}}(0,n.gn)([q.autobind],Fs.prototype,"toggleSpellcheck",null),r.D.prototype.usePopupForSpecialCharacters=!1,r.D.prototype.specialCharacters=["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","‘","’","“","”","–","—","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","»","¬","®","¯","°","²","³","´","µ","¶","·","¸","¹","º","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Ŵ","Ŷ","ŵ","ŷ","‚","‛","„","…","™","►","•","→","⇒","⇔","♦","≈"],r.D.prototype.controls.symbol={icon:"omega",hotkeys:["ctrl+shift+i","cmd+shift+i"],tooltip:"Insert Special Character",popup(t,e,s,i){const o=t.e.fire("generateSpecialCharactersTable.symbols");if(o){if(t.o.usePopupForSpecialCharacters){const e=t.c.div();return e.classList.add("jodit-symbols"),e.appendChild(o),t.e.on(o,"close_dialog",i),e}{V(o,t.i18n("Select Special Character"),void 0,"jodit-symbols").bindDestruct(t);const e=o.querySelector("a");e&&e.focus()}}}};class Ws extends X{constructor(){super(...arguments),this.buttons=[{name:"symbol",group:"insert"}],this.countInRow=17}afterInit(t){t.e.on("generateSpecialCharactersTable.symbols",(()=>{const e=t.c.fromHTML('
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
'),s=e.querySelector(".jodit-symbols__preview"),i=e.querySelector("table").tBodies[0],o=[];for(let e=0;t.o.specialCharacters.length>e;){const s=t.c.element("tr");for(let i=0;this.countInRow>i&&t.o.specialCharacters.length>e;i+=1,e+=1){const n=t.c.element("td"),r=t.c.fromHTML(`${t.o.specialCharacters[e]}`);o.push(r),n.appendChild(r),s.appendChild(n)}i.appendChild(s)}const n=this;return t.e.on(o,"focus",(function(){s.innerHTML=this.innerHTML})).on(o,"mousedown",(function(e){M.i.isTag(this,"a")&&(t.s.focus(),t.s.insertHTML(this.innerHTML),t.e.fire(this,"close_dialog"),e&&e.preventDefault(),e&&e.stopImmediatePropagation())})).on(o,"mouseenter",(function(){M.i.isTag(this,"a")&&this.focus()})).on(o,"keydown",(e=>{const s=e.target;if(M.i.isTag(s,"a")){const i=parseInt((0,ee.Lj)(s,"-index")||"0",10),r=parseInt((0,ee.Lj)(s,"data-index-j")||"0",10);let l;switch(e.key){case a.KEY_UP:case a.KEY_DOWN:l=e.key===a.KEY_UP?i-n.countInRow:i+n.countInRow,void 0===o[l]&&(l=e.key===a.KEY_UP?Math.floor(o.length/n.countInRow)*n.countInRow+r:r,l>o.length-1&&(l-=n.countInRow)),o[l]&&o[l].focus();break;case a.KEY_RIGHT:case a.KEY_LEFT:l=e.key===a.KEY_LEFT?i-1:i+1,void 0===o[l]&&(l=e.key===a.KEY_LEFT?o.length-1:0),o[l]&&o[l].focus();break;case a.KEY_ENTER:t.e.fire(s,"mousedown"),e.stopImmediatePropagation(),e.preventDefault()}}})),e}))}beforeDestruct(t){t.e.off("generateSpecialCharactersTable.symbols")}}r.D.prototype.table={allowCellSelection:!0,selectionCellStyle:"border: 1px double #1e88e5 !important;",allowCellResize:!0,useExtraClassesOptions:!1},r.D.prototype.controls.table={data:{cols:10,rows:10,classList:{"table table-bordered":"Bootstrap Bordered","table table-striped":"Bootstrap Striped","table table-dark":"Bootstrap Dark"}},popup(t,e,s,i,o){const n=s.data&&s.data.rows?s.data.rows:10,r=s.data&&s.data.cols?s.data.cols:10,a=t.c.fromHTML('
'+(()=>{if(!t.o.table.useExtraClassesOptions)return"";const e=[];if(s.data){const t=s.data.classList;Object.keys(t).forEach((s=>{e.push(``)}))}return e.join("")})()+'
'),l=a.querySelectorAll("span")[0],c=a.querySelectorAll("span")[1],h=a.querySelector(".jodit-form__container"),d=a.querySelector(".jodit-form__options"),u=[],p=n*r;for(let e=0;p>e;e+=1)u[e]||u.push(t.c.element("span",{dataIndex:e}));if(t.e.on(h,"mousemove",((t,e)=>{const s=t.target;if(!M.i.isTag(s,"span"))return;const i=void 0===e||isNaN(e)?parseInt((0,ee.Lj)(s,"-index")||"0",10):e||0,o=Math.ceil((i+1)/r),n=i%r+1;for(let t=0;u.length>t;t+=1)u[t].className=t%r+1>n||Math.ceil((t+1)/r)>o?"":"jodit_hovered";c.textContent=""+n,l.textContent=""+o})).on(h,"touchstart mousedown",(e=>{const s=e.target;if(e.preventDefault(),e.stopImmediatePropagation(),!M.i.isTag(s,"span"))return;const o=parseInt((0,ee.Lj)(s,"-index")||"0",10),n=Math.ceil((o+1)/r),a=o%r+1,l=t.createInside,c=l.element("tbody"),h=l.element("table");h.appendChild(c),h.style.width="100%";let u,p,f=null;for(let t=1;n>=t;t+=1){u=l.element("tr");for(let t=1;a>=t;t+=1)p=l.element("td"),f||(f=p),(0,g.css)(p,"width",(100/a).toFixed(4)+"%"),p.appendChild(l.element("br")),u.appendChild(l.text("\n")),u.appendChild(l.text("\t")),u.appendChild(p);c.appendChild(l.text("\n")),c.appendChild(u)}const m=t.s.current();if(m&&t.s.isCollapsed()){const e=M.i.closest(m,M.i.isBlock,t.editor);e&&e!==t.editor&&!e.nodeName.match(/^TD|TH|TBODY|TABLE|THEADER|TFOOTER$/)&&t.s.setCursorAfter(e)}(0,g.$$)("input[type=checkbox]:checked",d).forEach((t=>{t.value.split(/[\s]+/).forEach((t=>{h.classList.add(t)}))})),t.s.insertNode(l.text("\n")),t.s.insertNode(h,!1),f&&(t.s.setCursorIn(f),(0,g.scrollIntoViewIfNeeded)(f,t.editor,t.ed)),i()})),o&&o.parentElement){for(let e=0;n>e;e+=1){const s=t.c.div();for(let t=0;r>t;t+=1)s.appendChild(u[e*r+t]);h.appendChild(s)}u[0]&&(u[0].className="hovered")}return a},tooltip:"Insert table"};const $s="table_processor_observer-resize";class Vs extends X{constructor(){super(...arguments),this.selectMode=!1,this.resizeDelta=0,this.createResizeHandle=()=>{this.resizeHandler||(this.resizeHandler=this.j.c.div("jodit-table-resizer"),this.j.e.on(this.resizeHandler,"mousedown.table touchstart.table",this.onHandleMouseDown).on(this.resizeHandler,"mouseenter.table",(()=>{this.j.async.clearTimeout(this.hideTimeout)})))},this.hideTimeout=0,this.drag=!1,this.minX=0,this.maxX=0,this.startX=0}get module(){return this.j.getInstance("Table",this.j.o)}get isRTL(){return"rtl"===this.j.o.direction}showResizeHandle(){this.j.async.clearTimeout(this.hideTimeout),this.j.workplace.appendChild(this.resizeHandler)}hideResizeHandle(){this.hideTimeout=this.j.async.setTimeout((()=>{M.i.safeRemove(this.resizeHandler)}),{timeout:this.j.defaultTimeout,label:"hideResizer"})}onHandleMouseDown(t){if(this.j.isLocked)return;this.drag=!0,this.j.e.on(this.j.ow,"mouseup.resize-cells touchend.resize-cells",this.onMouseUp).on(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.startX=t.clientX,this.j.lock($s),this.resizeHandler.classList.add("jodit-table-resizer_moved");let e,s=this.workTable.getBoundingClientRect();if(this.minX=0,this.maxX=1e6,null!=this.wholeTable)s=this.workTable.parentNode.getBoundingClientRect(),this.minX=s.left,this.maxX=this.minX+s.width;else{const t=Pt.formalCoordinate(this.workTable,this.workCell,!0);Pt.formalMatrix(this.workTable,((s,i,o)=>{t[1]===o&&(e=s.getBoundingClientRect(),this.minX=Math.max(e.left+a.NEARBY/2,this.minX)),t[1]+(this.isRTL?-1:1)===o&&(e=s.getBoundingClientRect(),this.maxX=Math.min(e.left+e.width-a.NEARBY/2,this.maxX))}))}return!1}onMouseMove(t){if(!this.drag)return;this.j.e.fire("closeAllPopups");let e=t.clientX;const s=(0,g.offset)(this.resizeHandler.parentNode||this.j.od.documentElement,this.j,this.j.od,!0);this.minX>e&&(e=this.minX),e>this.maxX&&(e=this.maxX),this.resizeDelta=e-this.startX+(this.j.o.iframe?s.left:0),this.resizeHandler.style.left=e-(this.j.o.iframe?0:s.left)+"px";const i=this.j.s.sel;i&&i.removeAllRanges()}onMouseUp(t){(this.selectMode||this.drag)&&(this.selectMode=!1,this.j.unlock()),this.resizeHandler&&this.drag&&(this.drag=!1,this.j.e.off(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.resizeHandler.classList.remove("jodit-table-resizer_moved"),this.startX!==t.clientX&&(null==this.wholeTable?this.resizeColumns():this.resizeTable()),this.j.synchronizeValues(),this.j.s.focus())}resizeColumns(){const t=this.resizeDelta,e=[];Pt.setColumnWidthByDelta(this.workTable,Pt.formalCoordinate(this.workTable,this.workCell,!0)[1],t,!0,e);const s=(0,g.call)(this.isRTL?M.i.prev:M.i.next,this.workCell,M.i.isCell,this.workCell.parentNode);Pt.setColumnWidthByDelta(this.workTable,Pt.formalCoordinate(this.workTable,s)[1],-t,!1,e)}resizeTable(){const t=this.resizeDelta*(this.isRTL?-1:1),e=this.workTable.offsetWidth,s=(0,g.getContentWidth)(this.workTable.parentNode,this.j.ew),i=!this.wholeTable;if(this.isRTL?!i:i)this.workTable.style.width=(e+t)/s*100+"%";else{const i=this.isRTL?"marginRight":"marginLeft",o=parseInt(this.j.ew.getComputedStyle(this.workTable)[i]||"0",10);this.workTable.style.width=(e-t)/s*100+"%",this.workTable.style[i]=(o+t)/s*100+"%"}}setWorkCell(t,e=null){this.wholeTable=e,this.workCell=t,this.workTable=M.i.up(t,(t=>M.i.isTag(t,"table")),this.j.editor)}calcHandlePosition(t,e,s=0,i=0){const o=(0,g.offset)(e,this.j,this.j.ed);if(s>a.NEARBY&&o.width-a.NEARBY>s)return void this.hideResizeHandle();const n=(0,g.offset)(this.j.workplace,this.j,this.j.od,!0),r=(0,g.offset)(t,this.j,this.j.ed);if(this.resizeHandler.style.left=(s>a.NEARBY?o.left+o.width:o.left)-n.left+i+"px",Object.assign(this.resizeHandler.style,{height:r.height+"px",top:r.top-n.top+"px"}),this.showResizeHandle(),s>a.NEARBY){const t=(0,g.call)(this.isRTL?M.i.prev:M.i.next,e,M.i.isCell,e.parentNode);this.setWorkCell(e,!!t&&null)}else{const t=(0,g.call)(this.isRTL?M.i.next:M.i.prev,e,M.i.isCell,e.parentNode);this.setWorkCell(t||e,!t||null)}}afterInit(t){t.o.table.allowCellResize&&t.e.off(this.j.ow,".resize-cells").off(".resize-cells").on("change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells",(()=>{(0,g.$$)("table",t.editor).forEach(this.observe)})).on(this.j.ow,"scroll.resize-cells",(()=>{if(!this.drag)return;const e=M.i.up(this.workCell,(t=>M.i.isTag(t,"table")),t.editor);if(e){const t=e.getBoundingClientRect();this.resizeHandler.style.top=t.top+"px"}})).on("beforeSetMode.resize-cells",(()=>{this.module.getAllSelectedCells().forEach((e=>{this.module.removeSelection(e),Pt.normalizeTable(M.i.closest(e,"table",t.editor))}))}))}observe(t){(0,g.dataBind)(t,$s)||((0,g.dataBind)(t,$s,!0),this.j.e.on(t,"mouseleave.resize-cells",(t=>{this.resizeHandler&&this.resizeHandler!==t.relatedTarget&&this.hideResizeHandle()})).on(t,"mousemove.resize-cells touchmove.resize-cells",this.j.async.throttle((e=>{if(this.j.isLocked)return;const s=M.i.up(e.target,M.i.isCell,t);s&&this.calcHandlePosition(t,s,e.offsetX)}),{timeout:this.j.defaultTimeout})),this.createResizeHandle())}beforeDestruct(t){t.events&&(t.e.off(this.j.ow,".resize-cells"),t.e.off(".resize-cells"))}}(0,n.gn)([q.autobind],Vs.prototype,"onHandleMouseDown",null),(0,n.gn)([q.autobind],Vs.prototype,"onMouseMove",null),(0,n.gn)([q.autobind],Vs.prototype,"onMouseUp",null),(0,n.gn)([q.autobind],Vs.prototype,"observe",null);const Ys="table_processor_observer",Us="onMoveTableSelectCell";class Gs extends X{constructor(){super(...arguments),this.requires=["select"],this.selectedCell=null,this.isSelectionMode=!1}get module(){return this.j.getInstance("Table",this.j.o)}afterInit(t){t.o.table.allowCellSelection&&t.e.on("keydown.select-cells",(t=>{t.key===a.KEY_TAB&&this.unselectCells()})).on("beforeCommand.select-cells",this.onExecCommand).on("afterCommand.select-cells",this.onAfterCommand).on(["clickEditor","mousedownTd","mousedownTh","touchstartTd","touchstartTh"].map((t=>t+".select-cells")).join(" "),this.onStartSelection).on("clickTr clickTbody",(()=>{var t;const e=this.module.getAllSelectedCells().length;if(e)return e>1&&(null===(t=this.j.s.sel)||void 0===t||t.removeAllRanges()),!1}))}onStartSelection(t){if(this.j.o.readonly)return;if(this.unselectCells(),t===this.j.editor)return;const e=M.i.closest(t,"table",this.j.editor);return t&&e?(t.firstChild||t.appendChild(this.j.createInside.element("br")),this.isSelectionMode=!0,this.selectedCell=t,this.module.addSelection(t),this.j.e.on(e,"mousemove.select-cells touchmove.select-cells",this.j.async.throttle(this.onMove.bind(this,e),{label:Us,timeout:this.j.defaultTimeout/2})).on(e,"mouseup.select-cells touchend.select-cells",this.onStopSelection.bind(this,e)),!1):void 0}onOutsideClick(){this.selectedCell=null,this.onRemoveSelection()}onChange(){this.j.isLocked||this.isSelectionMode||this.onRemoveSelection()}onMove(t,e){var s;if(this.j.o.readonly&&!this.j.isLocked)return;if(this.j.isLockedNotBy(Ys))return;const i=this.j.ed.elementFromPoint(e.clientX,e.clientY);if(!i)return;const o=M.i.closest(i,["td","th"],t);if(!o||!this.selectedCell)return;o!==this.selectedCell&&this.j.lock(Ys),this.unselectCells();const n=Pt.getSelectedBound(t,[o,this.selectedCell]),r=Pt.formalMatrix(t);for(let t=n[0][0];n[1][0]>=t;t+=1)for(let e=n[0][1];n[1][1]>=e;e+=1)this.module.addSelection(r[t][e]);this.module.getAllSelectedCells().length>1&&(null===(s=this.j.s.sel)||void 0===s||s.removeAllRanges()),this.j.e.fire("hidePopup"),e.stopPropagation(),(()=>{const t=this.j.createInside.fromHTML('
 
');o.appendChild(t),this.j.async.setTimeout((()=>{var e;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}),this.j.defaultTimeout/5)})()}onRemoveSelection(t){var e;if(!(null===(e=null==t?void 0:t.buffer)||void 0===e?void 0:e.actionTrigger)&&!this.selectedCell&&this.module.getAllSelectedCells().length)return this.j.unlock(),this.unselectCells(),void this.j.e.fire("hidePopup","cells");this.isSelectionMode=!1,this.selectedCell=null}onStopSelection(t,e){if(!this.selectedCell)return;this.isSelectionMode=!1,this.j.unlock();const s=this.j.ed.elementFromPoint(e.clientX,e.clientY);if(!s)return;const i=M.i.closest(s,["td","th"],t);if(!i)return;const o=M.i.closest(i,"table",t);if(o&&o!==t)return;const n=Pt.getSelectedBound(t,[i,this.selectedCell]),r=Pt.formalMatrix(t),a=r[n[1][0]][n[1][1]],l=r[n[0][0]][n[0][1]];this.j.e.fire("showPopup",t,(()=>{const t=(0,g.position)(l,this.j),e=(0,g.position)(a,this.j);return{left:t.left,top:t.top,width:e.left-t.left+e.width,height:e.top-t.top+e.height}}),"cells"),(0,g.$$)("table",this.j.editor).forEach((t=>{this.j.e.off(t,"mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells")})),this.j.async.clearTimeout(Us)}unselectCells(t){const e=this.module,s=e.getAllSelectedCells();s.length&&s.forEach((s=>{t&&t===s||e.removeSelection(s)}))}onExecCommand(t){if(/table(splitv|splitg|merge|empty|bin|binrow|bincolumn|addcolumn|addrow)/.test(t)){t=t.replace("table","");const e=this.module.getAllSelectedCells();if(e.length){const[s]=e;if(!s)return;const i=M.i.closest(s,"table",this.j.editor);if(!i)return;switch(t){case"splitv":Pt.splitVertical(i,this.j);break;case"splitg":Pt.splitHorizontal(i,this.j);break;case"merge":Pt.mergeSelected(i,this.j);break;case"empty":e.forEach((t=>M.i.detach(t)));break;case"bin":M.i.safeRemove(i);break;case"binrow":new Set(e.map((t=>t.parentNode))).forEach((t=>{Pt.removeRow(i,t.rowIndex)}));break;case"bincolumn":{const t=new Set;e.reduce(((e,s)=>(t.has(s.cellIndex)||(e.push(s),t.add(s.cellIndex)),e)),[]).forEach((t=>{Pt.removeColumn(i,t.cellIndex)}))}break;case"addcolumnafter":case"addcolumnbefore":Pt.appendColumn(i,s.cellIndex,"addcolumnafter"===t,this.j.createInside);break;case"addrowafter":case"addrowbefore":Pt.appendRow(i,s.parentNode,"addrowafter"===t,this.j.createInside)}}return!1}}onAfterCommand(t){/^justify/.test(t)&&this.module.getAllSelectedCells().forEach((e=>os(t,e)))}beforeDestruct(t){this.onRemoveSelection(),t.e.off(".select-cells")}}function Xs(t){t.e.off(".tableKeyboardNavigation").on("keydown.tableKeyboardNavigation",(e=>{let s,i;if(e.key!==a.KEY_TAB&&e.key!==a.KEY_LEFT&&e.key!==a.KEY_RIGHT&&e.key!==a.KEY_UP&&e.key!==a.KEY_DOWN)return;{if(s=t.s.current(),i=M.i.up(s,(t=>t&&t.nodeName&&/^td|th$/i.test(t.nodeName)),t.editor),!i)return;const o=t.s.range;if(e.key!==a.KEY_TAB&&s!==i&&((e.key===a.KEY_LEFT||e.key===a.KEY_UP)&&(M.i.prev(s,(t=>e.key===a.KEY_UP?M.i.isTag(t,"br"):!!t),i)||e.key!==a.KEY_UP&&M.i.isText(s)&&0!==o.startOffset)||(e.key===a.KEY_RIGHT||e.key===a.KEY_DOWN)&&(M.i.next(s,(t=>e.key===a.KEY_DOWN?M.i.isTag(t,"br"):!!t),i)||e.key!==a.KEY_DOWN&&M.i.isText(s)&&s.nodeValue&&o.startOffset!==s.nodeValue.length)))return}const o=M.i.up(i,(t=>t&&/^table$/i.test(t.nodeName)),t.editor);let n=null;switch(e.key){case a.KEY_TAB:case a.KEY_LEFT:{const s=e.key===a.KEY_LEFT||e.shiftKey?"prev":"next";n=M.i[s](i,(t=>t&&/^td|th$/i.test(t.tagName)),o),n||(Pt.appendRow(o,"next"!==s&&o.querySelector("tr"),"next"===s,t.createInside),n=M.i[s](i,M.i.isCell,o));break}case a.KEY_UP:case a.KEY_DOWN:{let t=0,s=0;const r=Pt.formalMatrix(o,((e,o,n)=>{e===i&&(t=o,s=n)}));e.key===a.KEY_UP?void 0!==r[t-1]&&(n=r[t-1][s]):void 0!==r[t+1]&&(n=r[t+1][s])}}if(n){if(n.firstChild)e.key===a.KEY_TAB?t.s.select(n,!0):t.s.setCursorIn(n,e.key===a.KEY_RIGHT||e.key===a.KEY_DOWN);else{const e=t.createInside.element("br");n.appendChild(e),t.s.setCursorBefore(e)}return!1}}))}function Ks(t){t.registerButton({name:"table",group:"insert"})}(0,n.gn)([q.autobind],Gs.prototype,"onStartSelection",null),(0,n.gn)([(0,q.watch)(":outsideClick")],Gs.prototype,"onOutsideClick",null),(0,n.gn)([(0,q.watch)(":change")],Gs.prototype,"onChange",null),(0,n.gn)([q.autobind],Gs.prototype,"onRemoveSelection",null),(0,n.gn)([q.autobind],Gs.prototype,"onStopSelection",null),(0,n.gn)([q.autobind],Gs.prototype,"onExecCommand",null),(0,n.gn)([q.autobind],Gs.prototype,"onAfterCommand",null);class Zs extends X{constructor(){super(...arguments),this.isOpened=!1,this.delayShowTimeout=0}afterInit(t){this.container=t.c.div("jodit-tooltip"),(0,_.ZO)(this.j,Zs).appendChild(this.container);let e=0;t.e.off(".tooltip").on("showTooltip.tooltip",((s,i)=>{t.async.clearTimeout(e),this.open(s,i)})).on("delayShowTooltip.tooltip",this.delayOpen).on("escape.tooltip",this.close).on("hideTooltip.tooltip change.tooltip scroll.tooltip changePlace.tooltip hidePopup.tooltip closeAllPopups.tooltip",(()=>{this.j.async.clearTimeout(this.delayShowTimeout),e=t.async.setTimeout(this.close,this.j.defaultTimeout)}))}delayOpen(t,e){const s=this.j.o.showTooltipDelay||this.j.defaultTimeout;this.j.async.clearTimeout(this.delayShowTimeout),this.delayShowTimeout=this.j.async.setTimeout((()=>this.open(t,e)),{timeout:s,label:"tooltip"})}open(t,e){this.container.classList.add("jodit-tooltip_visible"),this.container.innerHTML=e,this.isOpened=!0,this.setPosition(t)}setPosition(t){const e=t();(0,g.css)(this.container,{left:e.x,top:e.y})}close(){this.j.async.clearTimeout(this.delayShowTimeout),this.isOpened&&(this.isOpened=!1,this.container.classList.remove("jodit-tooltip_visible"),(0,g.css)(this.container,{left:-5e3}))}beforeDestruct(t){null==t||t.e.off(".tooltip"),this.close(),M.i.safeRemove(this.container)}}(0,n.gn)([q.autobind],Zs.prototype,"delayOpen",null),(0,n.gn)([q.autobind],Zs.prototype,"close",null),r.D.prototype.tab={tabInsideLiInsertNewList:!0};class Js extends X{afterInit(t){}onTab(t){if(t.key===a.KEY_TAB&&(t=>{if(!t.o.tab.tabInsideLiInsertNewList||!t.s.isCollapsed())return!1;const e=t.createInside.fake();t.s.insertNode(e);const s=M.i.closest(e,"li",t.editor);if(s&&t.s.cursorOnTheLeft(s)&&M.i.isTag(s.previousElementSibling,"li")){const i=M.i.closest(s,["ol","ul"],t.editor);if(i){const o=t.createInside.element(i.tagName),n=s.previousElementSibling;return o.appendChild(s),n.appendChild(o),t.s.setCursorAfter(e),M.i.safeRemove(e),!0}}return M.i.safeRemove(e),!1})(this.j))return!1}beforeDestruct(t){}}function Qs(t){t.registerButton({name:"preview"}),t.registerCommand("preview",((e,s,i)=>{const o=new $({language:t.o.language,theme:t.o.theme});o.setSize(1024,600).open("",t.i18n("Preview")).setModal(!0),((t,e,s="px",i=null)=>{const o=((t,e)=>{const s=[];try{(0,g.$$)("img",t.editor).forEach((i=>{const o=[(0,g.attr)(i,"width"),(0,g.attr)(i,"height"),i.src];(0,g.attr)(i,{width:i.offsetWidth+e,height:i.offsetHeight+e});const n=t.createInside.a();t.ed.body.appendChild(n),n.href=i.src,i.src=n.href,M.i.safeRemove(n),s.push((()=>{var t;i.src=null!==(t=o[2])&&void 0!==t?t:"",(0,g.attr)(i,{width:o[0]||null,height:o[1]||null})}))}))}catch(t){throw s.forEach((t=>t())),s.length=0,t}return s})(t,s);try{const n=t.e.fire("beforePreviewBox",e,s);if(null!=n)return n;let r=t.c.div("jodit__preview-box");i&&i.appendChild(r),(0,g.css)(r,{position:"relative",padding:16});const a=t.value||`
${t.i18n("Empty")}
`;if(t.iframe){const e=t.create.element("iframe");(0,g.css)(e,{minWidth:800,minHeight:600,border:0}),r.appendChild(e);const s=e.contentWindow;s&&(t.e.fire("generateDocumentStructure.iframe",s.document,t),r=s.document.body)}else(0,g.css)(r,{minWidth:1024,minHeight:600,border:0});const l=(e,s)=>{const i=(0,g.isString)(s)?t.c.div():s;(0,g.isString)(s)&&(i.innerHTML=s);for(let t=0;i.children.length>t;t+=1){const s=i.children[t],o=e.ownerDocument.createElement(s.nodeName);for(let t=0;s.attributes.length>t;t+=1)(0,g.attr)(o,s.attributes[t].nodeName,s.attributes[t].nodeValue);0===s.children.length||M.i.isTag(s,["table"])?"SCRIPT"===s.nodeName?s.textContent&&(o.textContent=s.textContent):s.innerHTML&&(o.innerHTML=s.innerHTML):l(o,s);try{e.appendChild(o)}catch(t){}}};l(r,a),t.e.fire("afterPreviewBox",r)}finally{o.forEach((t=>t()))}})(t,i,"px",o.getElm("content"))}))}function ti(t){t.registerButton({name:"print"})}(0,n.gn)([(0,q.watch)(":keydown.tab")],Js.prototype,"onTab",null),r.D.prototype.controls.preview={icon:"eye",command:"preview",mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Preview"},r.D.prototype.controls.print={exec(t){const e=t.create.element("iframe");Object.assign(e.style,{position:"fixed",right:0,bottom:0,width:0,height:0,border:0}),(0,_.ZO)(t,r.D).appendChild(e);const s=()=>{t.e.off(t.ow,"mousemove",s),M.i.safeRemove(e)},i=e.contentWindow;if(i){t.e.on(i,"onbeforeunload onafterprint",s).on(t.ow,"mousemove",s),t.o.iframe?(t.e.fire("generateDocumentStructure.iframe",i.document,t),i.document.body.innerHTML=t.value):(i.document.write(''+t.value+""),i.document.close());const e=i.document.createElement("style");e.innerHTML="@media print {\n\t\t\t\t\tbody {\n\t\t\t\t\t\t\t-webkit-print-color-adjust: exact;\n\t\t\t\t\t}\n\t\t\t}",i.document.head.appendChild(e),i.focus(),i.print()}},mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Print"},r.D.prototype.showXPathInStatusbar=!0;class ei extends X{constructor(){super(...arguments),this.onContext=(t,e)=>(this.menu||(this.menu=new E(this.j)),this.menu.show(e.clientX,e.clientY,[{icon:"bin",title:t===this.j.editor?"Clear":"Remove",exec:()=>{t!==this.j.editor?M.i.safeRemove(t):this.j.value="",this.j.synchronizeValues()}},{icon:"select-all",title:"Select",exec:()=>{this.j.s.select(t)}}]),!1),this.onSelectPath=(t,e)=>{this.j.s.focus();const s=(0,g.attr)(e.target,"-path")||"/";if("/"===s)return this.j.execCommand("selectall"),!1;try{const t=this.j.ed.evaluate(s,this.j.editor,null,XPathResult.ANY_TYPE,null).iterateNext();if(t)return this.j.s.select(t),!1}catch(t){}return this.j.s.select(t),!1},this.tpl=(t,e,s,i)=>{const o=this.j.c.fromHTML(`${(0,g.trim)(s)}`),n=o.firstChild;return this.j.e.on(n,"click",this.onSelectPath.bind(this,t)).on(n,"contextmenu",this.onContext.bind(this,t)),o},this.removeSelectAll=()=>{this.selectAllButton&&(this.selectAllButton.destruct(),delete this.selectAllButton)},this.appendSelectAll=()=>{this.removeSelectAll(),this.selectAllButton=H(this.j,{name:"selectall",...this.j.o.controls.selectall}),this.selectAllButton.state.size="tiny",this.container&&this.container.insertBefore(this.selectAllButton.container,this.container.firstChild)},this.calcPathImd=()=>{if(this.isDestructed)return;const t=this.j.s.current();if(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),t){let e,s,i;M.i.up(t,(t=>{t&&this.j.editor!==t&&!M.i.isText(t)&&(e=t.nodeName.toLowerCase(),s=(0,g.getXPathByElement)(t,this.j.editor).replace(/^\//,""),i=this.tpl(t,s,e,this.j.i18n("Select %s",e)),this.container&&this.container.insertBefore(i,this.container.firstChild))}),this.j.editor)}this.appendSelectAll()},this.calcPath=this.j.async.debounce(this.calcPathImd,2*this.j.defaultTimeout)}afterInit(){this.j.o.showXPathInStatusbar&&(this.container=this.j.c.div("jodit-xpath"),this.j.e.off(".xpath").on("mouseup.xpath change.xpath keydown.xpath changeSelection.xpath",this.calcPath).on("afterSetMode.xpath afterInit.xpath changePlace.xpath",(()=>{this.j.o.showXPathInStatusbar&&this.container&&(this.j.statusbar.append(this.container),this.j.getRealMode()===a.MODE_WYSIWYG?this.calcPath():(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),this.appendSelectAll()))})),this.calcPath())}beforeDestruct(){this.j&&this.j.events&&this.j.e.off(".xpath"),this.removeSelectAll(),this.menu&&this.menu.destruct(),M.i.safeRemove(this.container),delete this.menu,delete this.container}}var si=s(67),ii=s(68),oi=s(69),ni=s(70),ri=s(71),ai=s(72),li=s(73),ci=s(74),hi=s(75),di=s(76),ui=s(77),pi=s(78),fi=s(79),mi=s(80),gi=s(81),vi=s(82),bi=s(83),wi=s(84),yi=s(85),Ci=s(86),xi=s(87),Ei=s(88),ji=s(89),Si=s(90),ki=s(91),Ti=s(92),Ii=s(93),_i=s(94),qi=s(95),Li=s(96),zi=s(97),Mi=s(98),Ni=s(99),Pi=s(100),Di=s(101),Ri=s(102),Ai=s(103),Bi=s(104),Oi=s(105),Hi=s(106),Fi=s(107),Wi=s(108),$i=s(109),Vi=s(110),Yi=s(111),Ui=s(112),Gi=s(113),Xi=s(114),Ki=s(115),Zi=s(116),Ji=s(117),Qi=s(118),to=s(119),eo=s(120),so=s(121),io=s(122),oo=s(123),no=s(124),ro=s(125),ao=s(126),lo=s(127),co=s(128),ho=s(129),uo=s(130),po=s(131),fo=s(132),mo=s(133),go=s(134),vo=s(135),bo=s(136),wo=s(137),yo=s(138),Co=s(139),xo=s(140),Eo=s(141),jo=s(142),So=s(143),ko=s(144),To=s(145),Io=s(146),_o=s(147),qo=s(148),Lo=s(149);Object.keys(a).forEach((t=>{Jodit[t]=a[t]}));const zo=t=>"__esModule"!==t;Object.keys(o).filter(zo).forEach((t=>{N.JO.set(t.replace("_","-"),o[t])})),Object.keys(t).filter(zo).forEach((e=>{Jodit.modules[e]=t[e]})),Object.keys(q).filter(zo).forEach((t=>{Jodit.decorators[t]=q[t]})),["Confirm","Alert","Prompt"].forEach((e=>{Jodit[e]=t[e]})),Object.keys(e).filter(zo).forEach((t=>{Jodit.plugins.add(t,e[t])})),Object.keys(Xt).filter(zo).forEach((t=>{Jodit.lang[t]=Xt[t]}))}(),i}()})); \ No newline at end of file diff --git a/build/jodit.es2018.js b/build/jodit.es2018.js index 5e6bebb9e..3c4cc148f 100644 --- a/build/jodit.es2018.js +++ b/build/jodit.es2018.js @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ @@ -5384,7 +5384,7 @@ function hook(status) { throw (0,error/* error */.v)('Handler must be a Function'); } target.hookStatus(status, (component) => { - target[propertyKey].call(component); + component[propertyKey].call(component); }); }; } @@ -5446,7 +5446,8 @@ function persistent(target, propertyKey) { function wait(condition) { return (target, propertyKey) => { - if (!(0,helpers.isFunction)(target[propertyKey])) { + const fn = target[propertyKey]; + if (!(0,helpers.isFunction)(fn)) { throw (0,helpers.error)('Handler must be a Function'); } target.hookStatus(core_component/* STATUSES.ready */.n$.ready, (component) => { @@ -5455,15 +5456,18 @@ function wait(condition) { : component.j.async; const realMethod = component[propertyKey]; let timeout = 0; - component[propertyKey] = function callProxy(...args) { - async.clearTimeout(timeout); - if (condition(component)) { - realMethod.apply(component, args); - } - else { - timeout = async.setTimeout(() => callProxy(...args), 10); + Object.defineProperty(component, propertyKey, { + configurable: true, + value: function callProxy(...args) { + async.clearTimeout(timeout); + if (condition(component)) { + realMethod.apply(component, args); + } + else { + timeout = async.setTimeout(() => callProxy(...args), 10); + } } - }; + }); }); }; } @@ -15987,7 +15991,7 @@ class View extends component/* Component */.wA { this.isView = true; this.mods = {}; this.components = new Set(); - this.version = "3.16.2"; + this.version = "3.16.3"; this.async = new Async(); this.buffer = Storage.makeStorage(); this.storage = Storage.makeStorage(true, this.componentName); @@ -16085,10 +16089,10 @@ class View extends component/* Component */.wA { return this.__isFullSize; } getVersion() { - return "3.16.2"; + return "3.16.3"; } static getVersion() { - return "3.16.2"; + return "3.16.3"; } initOptions(options) { this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions)); diff --git a/build/jodit.es2018.min.js b/build/jodit.es2018.min.js index d39ad2786..a96aacb60 100644 --- a/build/jodit.es2018.min.js +++ b/build/jodit.es2018.min.js @@ -1 +1 @@ -((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}})(self,(function(){return function(){var e=[,function(e,t,i){"use strict";i.d(t,{D:()=>s});var o=i(2);class s{constructor(){this.defaultTimeout=100,this.namespace="",this.safeMode=!1,this.safePluginsList=["about","enter","backspace"],this.license="",this.preset="custom",this.presets={inline:{inline:!0,toolbar:!1,toolbarInline:!0,toolbarInlineForSelection:!0,showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,showPlaceholder:!1}},this.ownerDocument="undefined"!=typeof document?document:null,this.ownerWindow="undefined"!=typeof window?window:null,this.shadowRoot=null,this.styleValues={},this.zIndex=0,this.readonly=!1,this.disabled=!1,this.activeButtonsInReadOnly=["source","fullsize","print","about","dots","selectall"],this.toolbarButtonSize="middle",this.allowTabNavigation=!1,this.inline=!1,this.theme="default",this.saveModeInStorage=!1,this.editorCssClass=!1,this.style=!1,this.triggerChangeEvent=!0,this.direction="",this.language="auto",this.debugLanguage=!1,this.i18n=!1,this.tabIndex=-1,this.toolbar=!0,this.statusbar=!0,this.showTooltip=!0,this.showTooltipDelay=1e3,this.useNativeTooltip=!1,this.enter=o.PARAGRAPH,this.enterBlock="br"!==this.enter?this.enter:o.PARAGRAPH,this.defaultMode=o.MODE_WYSIWYG,this.useSplitMode=!1,this.colors={greyscale:["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF"],palette:["#980000","#FF0000","#FF9900","#FFFF00","#00F0F0","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF"],full:["#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#733554","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"]},this.colorPickerDefaultTab="background",this.imageDefaultWidth=300,this.removeButtons=[],this.disablePlugins=[],this.extraPlugins=[],this.extraButtons=[],this.extraIcons={},this.createAttributes={},this.sizeLG=900,this.sizeMD=700,this.sizeSM=400,this.buttons=[{group:"font-style",buttons:[]},{group:"list",buttons:[]},{group:"font",buttons:[]},"---",{group:"script",buttons:[]},{group:"media",buttons:[]},"\n",{group:"state",buttons:[]},{group:"clipboard",buttons:[]},{group:"insert",buttons:[]},{group:"indent",buttons:[]},{group:"color",buttons:[]},{group:"form",buttons:[]},"---",{group:"history",buttons:[]},{group:"search",buttons:[]},{group:"source",buttons:[]},{group:"other",buttons:[]},{group:"info",buttons:[]}],this.buttonsMD=["bold","italic","|","ul","ol","eraser","|","font","fontsize","---","image","table","|","link","\n","brush","paragraph","align","|","hr","copyformat","fullsize","---","undo","redo","|","dots"],this.buttonsSM=["bold","italic","|","ul","ol","eraser","|","fontsize","brush","paragraph","---","image","table","\n","link","|","align","|","undo","redo","|","copyformat","fullsize","---","dots"],this.buttonsXS=["bold","brush","paragraph","eraser","|","fontsize","---","image","\n","align","undo","redo","|","link","table","---","dots"],this.events={},this.textIcons=!1,this.showBrowserColorPicker=!0}static get defaultOptions(){return s.__defaultOptions||(s.__defaultOptions=new s),s.__defaultOptions}}s.prototype.controls={}},(e,t,i)=>{"use strict";i.r(t),i.d(t,{ACCURACY:()=>z,BASE_PATH:()=>Y,BR:()=>j,COMMAND_KEYS:()=>T,EMULATE_DBLCLICK_TIMEOUT:()=>B,INSEPARABLE_TAGS:()=>p,INSERT_AS_HTML:()=>H,INSERT_AS_TEXT:()=>F,INSERT_CLEAR_HTML:()=>O,INSERT_ONLY_TEXT:()=>W,INVISIBLE_SPACE:()=>o,INVISIBLE_SPACE_REG_EXP:()=>r,INVISIBLE_SPACE_REG_EXP_END:()=>n,INVISIBLE_SPACE_REG_EXP_START:()=>a,IS_BLOCK:()=>h,IS_IE:()=>P,IS_INLINE:()=>u,IS_MAC:()=>U,KEY_ALIASES:()=>$,KEY_BACKSPACE:()=>f,KEY_DELETE:()=>E,KEY_DOWN:()=>C,KEY_ENTER:()=>v,KEY_ESC:()=>b,KEY_F3:()=>I,KEY_LEFT:()=>y,KEY_RIGHT:()=>k,KEY_SPACE:()=>S,KEY_TAB:()=>g,KEY_UP:()=>w,MARKER_CLASS:()=>q,MAY_BE_REMOVED_WITH_KEY:()=>m,MODE_SOURCE:()=>M,MODE_SPLIT:()=>D,MODE_WYSIWYG:()=>A,NBSP_SPACE:()=>s,NEARBY:()=>x,PARAGRAPH:()=>L,SAFE_COUNT_CHANGE_CALL:()=>V,SPACE_REG_EXP:()=>l,SPACE_REG_EXP_END:()=>d,SPACE_REG_EXP_START:()=>c,TEMP_ATTR:()=>K,TEXT_HTML:()=>R,TEXT_PLAIN:()=>_,TEXT_RTF:()=>N});const o="\ufeff",s=" ",r=()=>/[\uFEFF]/g,n=()=>/[\uFEFF]+$/g,a=()=>/^[\uFEFF]+/g,l=()=>/[\s\n\t\r\uFEFF\u200b]+/g,c=()=>/^[\s\n\t\r\uFEFF\u200b]+/g,d=()=>/[\s\n\t\r\uFEFF\u200b]+$/g,h=/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CANVAS|DD|DFN|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[1-6]|HEADER|HGROUP|HR|LI|MAIN|NAV|NOSCRIPT|OUTPUT|P|PRE|RUBY|SCRIPT|STYLE|OBJECT|OL|SECTION|IFRAME|JODIT|JODIT-MEDIA|UL|TR|TD|TH|TBODY|THEAD|TFOOT|TABLE|BODY|HTML|VIDEO)$/i,u=/^(STRONG|SPAN|I|EM|B|SUP|SUB|A|U)$/i,p=["img","br","video","iframe","script","input","textarea","hr","link","jodit","jodit-media"],m=RegExp(`^${p.join("|")}$`,"i"),f="Backspace",g="Tab",v="Enter",b="Escape",y="ArrowLeft",w="ArrowUp",k="ArrowRight",C="ArrowDown",S="Space",E="Delete",I="F3",x=5,z=10,T=[f,E,w,C,k,y,v,b,I,g],j="br",L="p",A=1,M=2,D=3,P="undefined"!=typeof navigator&&(-1!==navigator.userAgent.indexOf("MSIE")||/rv:11.0/i.test(navigator.userAgent)),_=P?"text":"text/plain",R=P?"html":"text/html",N=P?"rtf":"text/rtf",q="jodit-selection_marker",B=300,H="insert_as_html",O="insert_clear_html",F="insert_as_text",W="insert_only_text",V=10,U="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),$={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:U?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Y=(()=>{if("undefined"==typeof document)return"";const e=document.currentScript,t=e=>{const t=e.split("/");return/\.js/.test(t[t.length-1])?t.slice(0,t.length-1).join("/")+"/":e};if(e)return t(e.src);const i=document.querySelectorAll("script[src]");return i&&i.length?t(i[i.length-1].src):window.location.href})(),K="data-jodit-temp"},function(e,t,i){"use strict";i.d(t,{vp:()=>c,DG:()=>s,aN:()=>d.a,rO:()=>o,LO:()=>f});const o="JoditEventDefaultNamespace";class s{constructor(){this.__store={}}get(e,t){if(void 0!==this.__store[t])return this.__store[t][e]}indexOf(e,t,i){const o=this.get(e,t);if(o)for(let e=0;o.length>e;e+=1)if(o[e].originalCallback===i)return e;return!1}namespaces(e=!1){const t=Object.keys(this.__store);return e?t.filter((e=>e!==o)):t}events(e){return this.__store[e]?Object.keys(this.__store[e]):[]}set(e,t,i,o=!1){void 0===this.__store[t]&&(this.__store[t]={}),void 0===this.__store[t][e]&&(this.__store[t][e]=[]),o?this.__store[t][e].unshift(i):this.__store[t][e].push(i)}clear(){this.__store={}}}var r=i(5),n=i(6),a=i(7),l=i(4);class c{constructor(e){this.mutedEvents=new Set,this.__key="__JoditEventEmitterNamespaces",this.doc=document,this.prepareEvent=e=>{e.cancelBubble||(e.type.match(/^touch/)&&e.changedTouches&&e.changedTouches.length&&["clientX","clientY","pageX","pageY"].forEach((t=>{Object.defineProperty(e,t,{value:e.changedTouches[0][t],configurable:!0,enumerable:!0})})),e.originalEvent||(e.originalEvent=e),"paste"===e.type&&void 0===e.clipboardData&&this.doc.defaultView.clipboardData&&Object.defineProperty(e,"clipboardData",{get:()=>this.doc.defaultView.clipboardData,configurable:!0,enumerable:!0}))},this.currents=[],this.__stopped=[],this.isDestructed=!1,e&&(this.doc=e),this.__key+=(new Date).getTime()}mute(e){return this.mutedEvents.add(null!=e?e:"*"),this}isMuted(e){return!(!e||!this.mutedEvents.has(e))||this.mutedEvents.has("*")}unmute(e){return this.mutedEvents.delete(null!=e?e:"*"),this}eachEvent(e,t){e.split(/[\s,]+/).forEach((e=>{const i=e.split(".");t.call(this,i[0],i[1]||o)}))}getStore(e){if(!e)throw(0,l.v)("Need subject");if(void 0===e[this.__key]){const t=new s;Object.defineProperty(e,this.__key,{enumerable:!1,configurable:!0,value:t})}return e[this.__key]}clearStore(e){void 0!==e[this.__key]&&delete e[this.__key]}triggerNativeEvent(e,t){const i=this.doc.createEvent("HTMLEvents");"string"==typeof t?i.initEvent(t,!0,!0):(i.initEvent(t.type,t.bubbles,t.cancelable),["screenX","screenY","clientX","clientY","target","srcElement","currentTarget","timeStamp","which","keyCode"].forEach((e=>{Object.defineProperty(i,e,{value:t[e],enumerable:!0})})),Object.defineProperty(i,"originalEvent",{value:t,enumerable:!0})),e.dispatchEvent(i)}get current(){return this.currents[this.currents.length-1]}on(e,t,i,o=!1){const s=(0,r.H)(e)?this:e,c=(0,r.H)(t)?t:e;let d=i;void 0===d&&(0,n.m)(t)&&(d=t);const h=this.getStore(s);if(!(0,r.H)(c)||""===c)throw(0,l.v)("Need events names");if(!(0,n.m)(d))throw(0,l.v)("Need event handler");if((0,a.k)(s))return s.forEach((e=>{this.on(e,c,d,o)})),this;const u=(0,n.m)(s.addEventListener),p=this;let m=function(e,...t){if(!p.isMuted(e))return d&&d.call(this,...t)};return u&&(m=function(e){if(!p.isMuted(e.type))return p.prepareEvent(e),d&&!1===d.call(this,e)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}),this.eachEvent(c,((e,t)=>{if(""===e)throw(0,l.v)("Need event name");if(!1===h.indexOf(e,t,d)&&(h.set(e,t,{event:e,originalCallback:d,syntheticCallback:m},o),u)){const t=!!["touchstart","touchend","scroll","mousewheel","mousemove","touchmove"].includes(e)&&{passive:!0};s.addEventListener(e,m,t)}})),this}one(e,t,i,o=!1){const s=(0,r.H)(e)?this:e,a=(0,r.H)(t)?t:e;let l=i;void 0===l&&(0,n.m)(t)&&(l=t);const c=(...e)=>(this.off(s,a,c),l(...e));return this.on(s,a,c,o),this}off(e,t,i){const s=(0,r.H)(e)?this:e,a=(0,r.H)(t)?t:e,l=this.getStore(s);let c=i;if(!(0,r.H)(a)||!a)return l.namespaces().forEach((e=>{this.off(s,"."+e)})),this.clearStore(s),this;void 0===c&&(0,n.m)(t)&&(c=t);const d=(0,n.m)(s.removeEventListener),h=e=>{d&&s.removeEventListener(e.event,e.syntheticCallback,!1)},u=(e,t)=>{if(""!==e){const i=l.get(e,t);if(i&&i.length)if((0,n.m)(c)){const o=l.indexOf(e,t,c);!1!==o&&(h(i[o]),i.splice(o,1))}else i.forEach(h),i.length=0}else l.events(t).forEach((e=>{""!==e&&u(e,t)}))};return this.eachEvent(a,((e,t)=>{t===o?l.namespaces().forEach((t=>{u(e,t)})):u(e,t)})),this}stopPropagation(e,t){const i=(0,r.H)(e)?this:e,s=(0,r.H)(e)?e:t;if("string"!=typeof s)throw(0,l.v)("Need event names");const n=this.getStore(i);this.eachEvent(s,((e,t)=>{const s=n.get(e,t);s&&this.__stopped.push(s),t===o&&n.namespaces(!0).forEach((t=>this.stopPropagation(i,e+"."+t)))}))}removeStop(e){if(e){const t=this.__stopped.indexOf(e);-1!==t&&this.__stopped.splice(0,t+1)}}isStopped(e){return void 0!==e&&-1!==this.__stopped.indexOf(e)}fire(e,t,...i){let s,a;const c=(0,r.H)(e)?this:e,d=(0,r.H)(e)?e:t,h=(0,r.H)(e)?[t,...i]:i,u=(0,n.m)(c.dispatchEvent);if(!u&&!(0,r.H)(d))throw(0,l.v)("Need events names");const p=this.getStore(c);return!(0,r.H)(d)&&u?this.triggerNativeEvent(c,t):this.eachEvent(d,((e,t)=>{if(u)this.triggerNativeEvent(c,e);else{const i=p.get(e,t);if(i)try{[...i].every((t=>!this.isStopped(i)&&(this.currents.push(e),a=t.syntheticCallback.call(c,e,...h),this.currents.pop(),void 0!==a&&(s=a),!0)))}finally{this.removeStop(i)}t!==o||u||p.namespaces().filter((e=>e!==t)).forEach((t=>{const i=this.fire.call(this,c,e+"."+t,...h);void 0!==i&&(s=i)}))}})),s}destruct(){this.isDestructed&&(this.isDestructed=!0,this.off(this),this.getStore(this).clear(),delete this[this.__key])}}var d=i(8),h=i(9),u=i(19);const p=Symbol("observable-object");function m(e){return void 0!==e[p]}function f(e){if(m(e))return e;const t={},i={},o=(t,s)=>(0,h.isArray)(t)?(t.map((e=>o(e,s))),e):(i[t]||(i[t]=[]),i[t].push(s),e),s=(o,...r)=>{if((0,h.isArray)(o))o.map((e=>s(e,...r)));else try{!t[o]&&i[o]&&(t[o]=!0,i[o].forEach((t=>t.call(e,...r))))}finally{t[o]=!1}},r=(t,i=[])=>{const n={};m(t)||(Object.defineProperty(t,p,{enumerable:!1,value:!0}),Object.keys(t).forEach((o=>{const a=o,l=i.concat(a).filter((e=>e.length));n[a]=t[a];const c=(0,u.getPropertyDescriptor)(t,a);Object.defineProperty(t,a,{set(t){const i=n[a];if(!(0,h.isFastEqual)(n[a],t)){s(["beforeChange","beforeChange."+l.join(".")],a,t),(0,h.isPlainObject)(t)&&r(t,l),c&&c.set?c.set.call(e,t):n[a]=t;const o=[];s(["change",...l.reduce(((e,t)=>(o.push(t),e.push("change."+o.join(".")),e)),[])],l.join("."),i,(null==t?void 0:t.valueOf)?t.valueOf():t)}},get:()=>c&&c.get?c.get.call(e):n[a],enumerable:!0,configurable:!0}),(0,h.isPlainObject)(n[a])&&r(n[a],l)})),Object.defineProperty(e,"on",{value:o}))};return r(e),e}},(e,t,i)=>{"use strict";function o(e){return new TypeError(e)}i.d(t,{v:()=>o})},(e,t,i)=>{"use strict";function o(e){return"string"==typeof e}i.d(t,{H:()=>o})},(e,t,i)=>{"use strict";function o(e){return"function"==typeof e}i.d(t,{m:()=>o})},(e,t,i)=>{"use strict";function o(e){return Array.isArray(e)}i.d(t,{k:()=>o})},function(e,t,i){"use strict";i.d(t,{a:()=>o});class o{constructor(){this.map=new Map}on(e,t){var i;return this.map.has(e)||this.map.set(e,new Set),null===(i=this.map.get(e))||void 0===i||i.add(t),this}off(e,t){var i;return this.map.has(e)&&(null===(i=this.map.get(e))||void 0===i||i.delete(t)),this}emit(e,...t){var i;let o;return this.map.has(e)&&(null===(i=this.map.get(e))||void 0===i||i.forEach((e=>{o=e(...t)}))),o}}},(e,t,i)=>{"use strict";i.r(t),i.d(t,{$$:()=>o.$$,CamelCaseToKebabCase:()=>c.gP,ConfigFlatten:()=>o.tp,ConfigProto:()=>o.II,LimitedStack:()=>o.lI,appendScript:()=>o.uR,appendScriptAsync:()=>o.JL,appendStyleAsync:()=>o.Nf,applyStyles:()=>h,asArray:()=>s._2,assert:()=>o.hu,attr:()=>o.Lj,browser:()=>o.Xh,buildQuery:()=>o.XP,call:()=>o.RE,callPromise:()=>o.C6,camelCase:()=>c.eV,cleanFromWord:()=>m,clearCenterAlign:()=>o.bI,clearTimeout:()=>r.g,cns:()=>o.H5,colorToHex:()=>a.h,completeUrl:()=>o.WO,convertMediaUrlToVideoEmbed:()=>o.UU,css:()=>o.iv,cssPath:()=>o.iN,ctrlKey:()=>o.kT,dataBind:()=>o.qI,defaultLanguage:()=>o.X9,error:()=>o.vU,fastClone:()=>o.V8,fuzzySearchIndex:()=>c.Qy,get:()=>o.U2,getClassName:()=>o.gj,getContentWidth:()=>k,getScrollParent:()=>C,getXPathByElement:()=>o.BR,hasBrowserColorPicker:()=>n.EO,hasContainer:()=>n.Zt,htmlspecialchars:()=>f,humanSizeToBytes:()=>o.wx,i18n:()=>c.ag,inView:()=>o.jF,innerWidth:()=>S,isArray:()=>n.kJ,isAtom:()=>o.J8,isBoolean:()=>n.jn,isDestructable:()=>n.Z$,isEqual:()=>n.Xy,isFastEqual:()=>n.LP,isFunction:()=>n.mf,isHTML:()=>n.FP,isHtmlFromWord:()=>n.I4,isInitable:()=>n.Gu,isInt:()=>n.GN,isJoditObject:()=>n.Zu,isLicense:()=>n.A1,isNativeFunction:()=>n.QC,isNumber:()=>n.hj,isNumeric:()=>n.kE,isPlainObject:()=>n.PO,isPromise:()=>n.tI,isString:()=>n.HD,isURL:()=>n.PX,isValidName:()=>n.r1,isViewObject:()=>n.f2,isVoid:()=>n.nj,isWindow:()=>n.FJ,kebabCase:()=>c.GL,keepNames:()=>o.kc,keys:()=>o.am,loadImage:()=>o.po,loadNext:()=>o.wY,loadNextStyle:()=>o.GX,markAsAtomic:()=>o.XT,markDeprecated:()=>o.Q8,markOwner:()=>o.MN,memorizeExec:()=>o.u3,nl2br:()=>y,normalizeColor:()=>w.ut,normalizeCssValue:()=>w.Zh,normalizeKeyAliases:()=>w.T2,normalizeLicense:()=>w.Pd,normalizeNode:()=>w.Tz,normalizePath:()=>w.AH,normalizeRelativePath:()=>w.Jf,normalizeSize:()=>w.aC,normalizeUrl:()=>w.D5,offset:()=>E,parseQuery:()=>o.mB,position:()=>I,refs:()=>o.xL,reset:()=>o.mc,resolveElement:()=>o.W2,safeHTML:()=>b,scrollIntoViewIfNeeded:()=>o.n5,set:()=>o.t8,setTimeout:()=>r.i,size:()=>x,splitArray:()=>s.C1,sprintf:()=>c.gB,stringify:()=>c.Pz,stripTags:()=>v,toArray:()=>s.qo,trim:()=>c.fy,trimInv:()=>c.as,ucfirst:()=>c.Ps,val:()=>o.P0});var o=i(10),s=i(43),r=i(56),n=i(20),a=i(40),l=i(16),c=i(34);function d(e){return e.replace(/mso-[a-z-]+:[\s]*[^;]+;/gi,"").replace(/mso-[a-z-]+:[\s]*[^";']+$/gi,"").replace(/border[a-z-]*:[\s]*[^;]+;/gi,"").replace(/([0-9.]+)(pt|cm)/gi,((e,t,i)=>{switch(i.toLowerCase()){case"pt":return(1.328*parseFloat(t)).toFixed(0)+"px";case"cm":return(.02645833*parseFloat(t)).toFixed(0)+"px"}return e}))}function h(e){if(-1===e.indexOf("")+7);const t=document.createElement("iframe");t.style.display="none",document.body.appendChild(t);let i="",s=[];try{const r=t.contentDocument||(t.contentWindow?t.contentWindow.document:null);if(r){r.open(),r.write(e),r.close();try{for(let e=0;r.styleSheets.length>e;e+=1){const t=r.styleSheets[e].cssRules;for(let e=0;t.length>e;e+=1)""!==t[e].selectorText&&(s=(0,o.$$)(t[e].selectorText,r.body),s.forEach((i=>{i.style.cssText=d(t[e].style.cssText+";"+i.style.cssText)})))}}catch(e){}l.i.each(r.body,(e=>{if(l.i.isElement(e)){const t=e,i=t.getAttribute("style");i&&(t.style.cssText=d(i)),t.hasAttribute("style")&&!t.getAttribute("style")&&t.removeAttribute("style")}})),i=r.firstChild?(0,c.fy)(r.body.innerHTML):""}}catch(e){}finally{l.i.safeRemove(t)}return i&&(e=i),(0,c.fy)(e.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g,"").replace(//i);-1!==t&&(e=e.substring(t+20));const i=e.search(//i);return-1!==i&&(e=e.substring(0,i)),e})(i)),t.s.insertHTML(i)}function yt(e,t,i,o,s){if(!1===e.e.fire("beforeOpenPasteDialog",t,i,o,s))return;const r=Y(`
${e.i18n(t)}
`,e.i18n(i));r.bindDestruct(e),(0,gt.MN)(e,r.container);const n=s.map((({text:t,value:i})=>(0,P.zx)(e,{text:t,name:t.toLowerCase(),tabIndex:0}).onAction((()=>o(i))))),a=(0,P.zx)(e,{text:"Cancel",tabIndex:0});return r.setFooter([...n,a].map((e=>e.onAction((()=>r.close()))))),n[0].focus(),n[0].state.variant="primary",e.e.fire("afterOpenPasteDialog",r,t,i,o,s),r}const wt="clipboard";class kt{constructor(){this.buttons=[{name:"cut",group:"clipboard"},{name:"copy",group:"clipboard"},{name:"paste",group:"clipboard"},{name:"selectall",group:"clipboard"}]}init(e){var t;null===(t=this.buttons)||void 0===t||t.forEach((t=>e.registerButton(t))),e.e.off("copy.clipboard cut.clipboard").on("copy.clipboard cut.clipboard",(t=>{var i;const o=e.s.html,s=vt(t)||vt(e.ew)||vt(t.originalEvent);s&&(s.setData(a.TEXT_PLAIN,(0,g.stripTags)(o)),s.setData(a.TEXT_HTML,o)),e.buffer.set(wt,o),e.e.fire("pasteStack",{html:o,action:e.o.defaultActionOnPaste}),"cut"===t.type&&(e.s.remove(),e.s.focus()),t.preventDefault(),null===(i=null==e?void 0:e.events)||void 0===i||i.fire("afterCopy",o)}))}destruct(e){var t,i;null===(t=null==e?void 0:e.buffer)||void 0===t||t.set(wt,""),null===(i=null==e?void 0:e.events)||void 0===i||i.off(".clipboard")}}n.D.prototype.askBeforePasteHTML=!0,n.D.prototype.processPasteHTML=!0,n.D.prototype.pasteHTMLActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Insert as Text"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}],n.D.prototype.memorizeChoiceWhenPasteFragment=!1,n.D.prototype.nl2brInPlainText=!0,n.D.prototype.defaultActionOnPaste=a.INSERT_AS_HTML,n.D.prototype.draggableTags=["img","jodit-media","jodit"];const Ct="pasteStorage";n.D.prototype.controls.paste={tooltip:"Paste from clipboard",async exec(e,t,{control:i}){if(i.name===Ct)return void e.execCommand("showPasteStorage");e.s.focus();let o="",s=!0;if(navigator.clipboard){try{const e=await navigator.clipboard.read();if(e&&e.length){const t=await e[0].getType(a.TEXT_PLAIN);o=await new Response(t).text()}s=!1}catch(e){}if(s)try{o=await navigator.clipboard.readText(),s=!1}catch(e){}}s&&(o=e.buffer.get(wt)||"",s=0===o.length);const r=e.value;s?(e.ed.execCommand("paste"),s=r===e.value,!s&&e.e.fire("afterPaste")):o.length?(bt(null,e,o),e.e.fire("afterPaste")):s&&U(e.i18n("Your browser doesn't support direct access to the clipboard."),(()=>{e.s.focus()})).bindDestruct(e)},list:{[Ct]:"Paste Storage"},isChildDisabled(e){return 2>e.e.fire("pasteStorageList")}};class St extends G{constructor(){super(...arguments),this.pasteStack=new g.LimitedStack(20)}afterInit(e){e.e.on("paste.paste",this.onPaste).on("pasteStack.paste",(e=>this.pasteStack.push(e))),e.o.nl2brInPlainText&&this.j.e.on("processPaste.paste",this.onProcessPasteReplaceNl2Br)}onPaste(e){try{if(!1===this.customPasteProcess(e)||!1===this.j.e.fire("beforePaste",e))return e.preventDefault(),!1;this.defaultPasteProcess(e)}finally{this.j.e.fire("afterPaste",e)}}customPasteProcess(e){if(!this.j.o.processPasteHTML)return;const t=vt(e),i={html:null==t?void 0:t.getData(a.TEXT_HTML),plain:null==t?void 0:t.getData(a.TEXT_PLAIN),rtf:null==t?void 0:t.getData(a.TEXT_RTF)};let o;for(o in i){const t=i[o];if((0,g.isHTML)(t)&&(this.j.e.fire("processHTML",e,t,i)||this.processHTML(e,t)))return!1}}defaultPasteProcess(e){const t=vt(e);let i=(null==t?void 0:t.getData(a.TEXT_HTML))||(null==t?void 0:t.getData(a.TEXT_PLAIN));if(t&&i&&""!==(0,g.trim)(i)){const o=this.j.e.fire("processPaste",e,i,(e=>{const t=e.types;let i="";if((0,C.kJ)(t)||"[object DOMStringList]"==={}.toString.call(t))for(let e=0;t.length>e;e+=1)i+=t[e]+";";else i=(t||a.TEXT_PLAIN)+";";return i})(t));void 0!==o&&(i=o),((0,g.isString)(i)||D.i.isNode(i))&&this.insertByType(e,i,this.j.o.defaultActionOnPaste),e.preventDefault(),e.stopPropagation()}}processHTML(e,t){if(this.j.o.askBeforePasteHTML){if(this.j.o.memorizeChoiceWhenPasteFragment){const i=this.pasteStack.find((e=>e.html===t));if(i)return this.insertByType(e,t,i.action||this.j.o.defaultActionOnPaste),!0}return yt(this.j,"Your code is similar to HTML. Keep as HTML?","Paste as HTML",(i=>{this.insertByType(e,t,i)}),this.j.o.pasteHTMLActionList),!0}return!1}insertByType(e,t,i){if(this.pasteStack.push({html:t,action:i}),(0,g.isString)(t))switch(this.j.buffer.set(wt,t),i){case a.INSERT_CLEAR_HTML:t=(0,g.cleanFromWord)(t);break;case a.INSERT_ONLY_TEXT:t=(0,g.stripTags)(t);break;case a.INSERT_AS_TEXT:t=(0,g.htmlspecialchars)(t)}bt(e,this.j,t)}onProcessPasteReplaceNl2Br(e,t,i){if(i===a.TEXT_PLAIN+";"&&!(0,g.isHTML)(t))return(0,g.nl2br)(t)}beforeDestruct(e){e.e.off("paste.paste",this.onPaste)}}(0,r.gn)([L.autobind],St.prototype,"onPaste",null),(0,r.gn)([L.autobind],St.prototype,"onProcessPasteReplaceNl2Br",null),n.D.prototype.askBeforePasteFromWord=!0,n.D.prototype.processPasteFromWord=!0,n.D.prototype.defaultActionOnPasteFromWord=null,n.D.prototype.pasteFromWordActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Clean"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}];class Et extends G{afterInit(e){}beforeDestruct(e){}processWordHTML(e,t,i){const{j:o}=this,{processPasteFromWord:s,askBeforePasteFromWord:r,defaultActionOnPasteFromWord:n,defaultActionOnPaste:a,pasteFromWordActionList:l}=o.o;return!(!s||!(0,g.isHtmlFromWord)(t)||(r?yt(o,"The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","Word Paste Detected",(o=>{this.insertFromWordByType(e,t,o,i)}),l):this.insertFromWordByType(e,t,n||a,i),0))}insertFromWordByType(e,t,i,o){var s;switch(i){case a.INSERT_AS_HTML:if(t=(0,g.applyStyles)(t),this.j.o.beautifyHTML){const e=null===(s=this.j.events)||void 0===s?void 0:s.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}break;case a.INSERT_AS_TEXT:t=(0,g.cleanFromWord)(t);break;case a.INSERT_ONLY_TEXT:t=(0,g.stripTags)((0,g.cleanFromWord)(t))}bt(e,this.j,t)}}(0,r.gn)([(0,L.watch)(":processHTML")],Et.prototype,"processWordHTML",null);class It extends G{constructor(){super(...arguments),this.currentIndex=0,this.list=[],this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.paste=()=>{if(this.j.s.focus(),this.j.s.insertHTML(this.list[this.currentIndex]),0!==this.currentIndex){const e=this.list[0];this.list[0]=this.list[this.currentIndex],this.list[this.currentIndex]=e}this.dialog&&this.dialog.close(),this.j.synchronizeValues(),this.j.e.fire("afterPaste")},this.onKeyDown=e=>{let t=this.currentIndex;-1!==[a.KEY_UP,a.KEY_DOWN,a.KEY_ENTER].indexOf(e.key)&&(e.key===a.KEY_UP&&(0===t?t=this.list.length-1:t-=1),e.key===a.KEY_DOWN&&(t===this.list.length-1?t=0:t+=1),e.key!==a.KEY_ENTER?(t!==this.currentIndex&&this.selectIndex(t),e.stopImmediatePropagation(),e.preventDefault()):this.paste())},this.selectIndex=e=>{this.listBox&&(0,g.toArray)(this.listBox.childNodes).forEach(((t,i)=>{t.classList.remove("jodit_active"),e===i&&this.previewBox&&(t.classList.add("jodit_active"),this.previewBox.innerHTML=this.list[e],t.focus())})),this.currentIndex=e},this.showDialog=()=>{2>this.list.length||(this.dialog||this.createDialog(),this.listBox&&(this.listBox.innerHTML=""),this.previewBox&&(this.previewBox.innerHTML=""),this.list.forEach(((e,t)=>{const i=this.j.c.element("a");i.textContent=t+1+". "+e.replace((0,a.SPACE_REG_EXP)(),""),this.j.e.on(i,"keydown",this.onKeyDown),(0,g.attr)(i,"href","#"),(0,g.attr)(i,"data-index",""+t),(0,g.attr)(i,"tab-index","-1"),this.listBox&&this.listBox.appendChild(i)})),this.dialog&&this.dialog.open(),this.j.async.setTimeout((()=>{this.selectIndex(0)}),100))}}createDialog(){this.dialog=new V({language:this.j.o.language});const e=(0,P.zx)(this.j,"paste","Paste","primary");e.onAction(this.paste);const t=(0,P.zx)(this.j,"","Cancel");t.onAction(this.dialog.close),this.container=this.j.c.div(),this.container.classList.add("jodit-paste-storage"),this.listBox=this.j.c.div(),this.previewBox=this.j.c.div(),this.container.appendChild(this.listBox),this.container.appendChild(this.previewBox),this.dialog.setHeader(this.j.i18n("Choose Content to Paste")),this.dialog.setContent(this.container),this.dialog.setFooter([e,t]),this.j.e.on(this.listBox,"click dblclick",(e=>{const t=e.target;return D.i.isTag(t,"a")&&t.hasAttribute("data-index")&&this.selectIndex(parseInt((0,g.attr)(t,"-index")||"0",10)),"dblclick"===e.type&&this.paste(),!1}))}afterInit(){this.j.e.off("afterCopy.paste-storage").on("pasteStorageList.paste-storage",(()=>this.list.length)).on("afterCopy.paste-storage",(e=>{-1!==this.list.indexOf(e)&&this.list.splice(this.list.indexOf(e),1),this.list.unshift(e),this.list.length>5&&(this.list.length=5)})),this.j.registerCommand("showPasteStorage",{exec:this.showDialog,hotkeys:["ctrl+shift+v","cmd+shift+v"]})}beforeDestruct(){this.dialog&&this.dialog.destruct(),this.j.e.off(".paste-storage"),D.i.safeRemove(this.previewBox),D.i.safeRemove(this.listBox),D.i.safeRemove(this.container),this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.list=[]}}const xt="copyformat",zt=["fontWeight","fontStyle","fontSize","color","margin","padding","borderWidth","borderStyle","borderColor","borderRadius","backgroundColor","textDecorationLine","fontFamily"],Tt=(e,t,i,o)=>{let s=(0,g.css)(i,t);return s===o[t]&&(s=i.parentNode&&i!==e.editor&&i.parentNode!==e.editor?Tt(e,t,i.parentNode,o):void 0),s};function jt(e){e.registerButton({name:"copyformat",group:"clipboard"})}n.D.prototype.controls.copyformat={exec(e,t,{button:i}){if(t){if(e.buffer.exists(xt))e.buffer.delete(xt),e.e.off(e.editor,"mouseup.copyformat");else{const i={},o=D.i.up(t,(e=>e&&!D.i.isText(e)),e.editor)||e.editor,s=e.createInside.span();e.editor.appendChild(s),zt.forEach((e=>{i[e]=(0,g.css)(s,e)})),s!==e.editor&&D.i.safeRemove(s);const r=((e,t,i)=>{const o={};return t&&zt.forEach((s=>{o[s]=Tt(e,s,t,i),s.match(/border(Style|Color)/)&&!o.borderWidth&&(o[s]=void 0)})),o})(e,o,i),n=()=>{e.buffer.delete(xt);const t=e.s.current();t&&(D.i.isTag(t,"img")?(0,g.css)(t,r):e.s.applyStyle(r)),e.e.off(e.editor,"mouseup.copyformat")};e.e.on(e.editor,"mouseup.copyformat",n),e.buffer.set(xt,!0)}i.update()}},isActive:e=>e.buffer.exists(xt),tooltip:"Paint format"};var Lt,At=i(77);function Mt(e){e.registerButton({name:"brush",group:"color"});const t=(t,i,o)=>{const s=(0,g.normalizeColor)(o);switch(t){case"background":e.s.applyStyle({backgroundColor:s||""});break;case"forecolor":e.s.applyStyle({color:s||""})}return e.synchronizeValues(),!1};e.registerCommand("forecolor",t).registerCommand("background",t)}n.D.prototype.controls.brush={update(e){const t=(0,g.dataBind)(e,"color"),i=e.j,o=(t,o)=>{o&&o!==""+(0,g.css)(i.editor,t)&&(e.state.icon.fill=o)};if(t){const i=(0,g.dataBind)(e,"color");return void o("color"===i?i:"background-color",t)}const s=i.s.current();if(s&&!e.state.disabled){const e=D.i.closest(s,D.i.isElement,i.editor)||i.editor;o("color",""+(0,g.css)(e,"color")),o("background-color",""+(0,g.css)(e,"background-color"))}e.state.icon.fill="",e.state.activated=!1},popup(e,t,i,o,s){let r="",n="",a=[],l=null;return t&&t!==e.editor&&D.i.isNode(t)&&(D.i.isElement(t)&&e.s.isCollapsed()&&!D.i.isTag(t,["br","hr"])&&(l=t),D.i.up(t,(e=>{if(D.i.isHTMLElement(e)){const t=(0,g.css)(e,"color",!0),i=(0,g.css)(e,"background-color",!0);if(t)return r=""+t,!0;if(i)return n=""+i,!0}}),e.editor)),a=[{name:"Background",content:(0,At.YW)(e,(t=>{l?l.style.backgroundColor=t:e.execCommand("background",!1,t),(0,g.dataBind)(s,"color",t),(0,g.dataBind)(s,"color-mode","background"),o()}),n)},{name:"Text",content:(0,At.YW)(e,(t=>{l?l.style.color=t:e.execCommand("forecolor",!1,t),(0,g.dataBind)(s,"color",t),(0,g.dataBind)(s,"color-mode","color"),o()}),r)}],"background"!==e.o.colorPickerDefaultTab&&(a=a.reverse()),(0,At.IL)(e,a,l)},exec(e,t,{button:i}){const o=(0,g.dataBind)(i,"color-mode"),s=(0,g.dataBind)(i,"color");if(!o)return!1;if(t&&t!==e.editor&&D.i.isNode(t)&&D.i.isElement(t))switch(o){case"color":t.style.color=s;break;case"background":t.style.backgroundColor=s}else e.execCommand("background"===o?o:"forecolor",!1,s)},tooltip:"Fill color or set the text color"};class Dt extends G{constructor(){super(...arguments),this.isFragmentFromEditor=!1,this.isCopyMode=!1,this.startDragPoint={x:0,y:0},this.draggable=null,this.bufferRange=null,this.getText=e=>{const t=vt(e);return t?t.getData(a.TEXT_HTML)||t.getData(a.TEXT_PLAIN):null}}afterInit(){this.j.e.on([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}onDragStart(e){let t=e.target;if(this.onDragEnd(),this.isFragmentFromEditor=D.i.isOrContains(this.j.editor,t,!0),this.isCopyMode=!this.isFragmentFromEditor||(0,g.ctrlKey)(e),this.isFragmentFromEditor){const e=this.j.s.sel,t=e&&e.rangeCount?e.getRangeAt(0):null;t&&(this.bufferRange=t.cloneRange())}else this.bufferRange=null;this.startDragPoint.x=e.clientX,this.startDragPoint.y=e.clientY,ze(t)&&(t=t.querySelector("img")),D.i.isTag(t,"img")&&(this.draggable=t.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",t)),this.addDragListeners()}addDragListeners(){this.j.e.on("dragover",this.onDrag).on("drop.DragAndDrop",this.onDrop).on(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}removeDragListeners(){this.j.e.off("dragover",this.onDrag).off("drop.DragAndDrop",this.onDrop).off(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}onDrag(e){this.draggable&&(this.j.e.fire("hidePopup"),this.j.s.insertCursorAtPoint(e.clientX,e.clientY),e.preventDefault(),e.stopPropagation())}onDragEnd(){this.draggable&&(D.i.safeRemove(this.draggable),this.draggable=null),this.isCopyMode=!1,this.removeDragListeners()}onDrop(e){if(!e.dataTransfer||!e.dataTransfer.files||!e.dataTransfer.files.length){if(!this.isFragmentFromEditor&&!this.draggable)return this.j.e.fire("paste",e),e.preventDefault(),e.stopPropagation(),!1;const t=this.j.s.sel,i=this.bufferRange||(t&&t.rangeCount?t.getRangeAt(0):null);let o=null;if(!this.draggable&&i)o=this.isCopyMode?i.cloneContents():i.extractContents();else if(this.draggable)if(this.isCopyMode){const[e,t]="1"===(0,g.attr)(this.draggable,"-is-file")?["a","href"]:["img","src"];o=this.j.createInside.element(e),o.setAttribute(t,(0,g.attr)(this.draggable,"data-src")||(0,g.attr)(this.draggable,"src")||""),"a"===e&&(o.textContent=(0,g.attr)(o,t)||"")}else o=(0,g.dataBind)(this.draggable,"target");else this.getText(e)&&(o=this.j.createInside.fromHTML(this.getText(e)));t&&t.removeAllRanges(),this.j.s.insertCursorAtPoint(e.clientX,e.clientY),o&&(this.j.s.insertNode(o,!1,!1),i&&o.firstChild&&o.lastChild&&(i.setStartBefore(o.firstChild),i.setEndAfter(o.lastChild),this.j.s.selectRange(i),this.j.e.fire("synchro")),D.i.isTag(o,"img")&&this.j.events&&this.j.e.fire("afterInsertImage",o)),e.preventDefault(),e.stopPropagation()}this.isFragmentFromEditor=!1,this.removeDragListeners()}beforeDestruct(){this.onDragEnd(),this.j.e.off(window,".DragAndDrop").off(".DragAndDrop").off([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}}(0,r.gn)([L.autobind],Dt.prototype,"onDragStart",null),(0,r.gn)([(0,L.throttle)((e=>e.j.defaultTimeout/10))],Dt.prototype,"onDrag",null),(0,r.gn)([L.autobind],Dt.prototype,"onDragEnd",null),(0,r.gn)([L.autobind],Dt.prototype,"onDrop",null),(e=>{e[e.IDLE=0]="IDLE",e[e.WAIT_DRAGGING=1]="WAIT_DRAGGING",e[e.DRAGGING=2]="DRAGGING"})(Lt||(Lt={}));class Pt extends G{constructor(){super(...arguments),this.dragList=[],this.draggable=null,this.isCopyMode=!1,this.diffStep=10,this.startX=0,this.startY=0,this.state=Lt.IDLE}afterInit(){this.dragList=this.j.o.draggableTags?(0,g.splitArray)(this.j.o.draggableTags).filter(Boolean).map((e=>e.toLowerCase())):[],this.dragList.length&&this.j.e.on("mousedown dragstart",this.onDragStart)}onDragStart(e){if("dragstart"===e.type&&this.draggable)return!1;if(this.state>Lt.IDLE)return;const t=e.target;if(!this.dragList.length||!t)return;const i=e=>!(!e||!this.dragList.includes(e.nodeName.toLowerCase()));let o=D.i.furthest(t,i,this.j.editor)||(i(t)?t:null);o&&(D.i.isTag(o.parentElement,"a")&&o.parentElement.firstChild===o&&o.parentElement.lastChild===o&&(o=o.parentElement),this.startX=e.clientX,this.startY=e.clientY,this.isCopyMode=(0,g.ctrlKey)(e),this.draggable=o.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",o),this.state=Lt.WAIT_DRAGGING,this.addDragListeners())}onDrag(e){var t,i;if(!this.draggable||this.state===Lt.IDLE)return;const o=e.clientY;if(this.state!==Lt.WAIT_DRAGGING||Math.sqrt(Math.pow(e.clientX-this.startX,2)+Math.pow(o-this.startY,2))>=this.diffStep){if(this.state===Lt.WAIT_DRAGGING&&(this.j.lock("drag-and-drop-element"),this.state=Lt.DRAGGING),this.j.e.fire("hidePopup hideResizer"),!this.draggable.parentNode){const o=(0,g.dataBind)(this.draggable,"target");(0,g.css)(this.draggable,{zIndex:1e13,pointerEvents:"none",pointer:"drag",position:"fixed",opacity:.7,display:"inline-block",left:e.clientX,top:e.clientY,width:null!==(t=null==o?void 0:o.offsetWidth)&&void 0!==t?t:100,height:null!==(i=null==o?void 0:o.offsetHeight)&&void 0!==i?i:100}),(0,j.ZO)(this.j,Pt).appendChild(this.draggable)}(0,g.css)(this.draggable,{left:e.clientX,top:e.clientY}),this.j.s.insertCursorAtPoint(e.clientX,e.clientY)}}onDragEnd(){this.isInDestruct||(this.removeDragListeners(),this.j.unlock(),this.state=Lt.IDLE,this.draggable&&(D.i.safeRemove(this.draggable),this.draggable=null))}onDrop(){if(!this.draggable||Lt.DRAGGING>this.state)return void this.onDragEnd();let e=(0,g.dataBind)(this.draggable,"target");this.onDragEnd(),this.isCopyMode&&(e=e.cloneNode(!0));const{parentElement:t}=e;this.j.s.insertNode(e,!0,!1),t&&D.i.isEmpty(t)&&!D.i.isTag(t,["td","th"])&&D.i.safeRemove(t),D.i.isTag(e,"img")&&this.j.e&&this.j.e.fire("afterInsertImage",e),this.j.e.fire("synchro")}addDragListeners(){this.j.e.on(this.j.editor,"mousemove",this.onDrag).on("mouseup",this.onDrop).on([this.j.ew,this.ow],"mouseup",this.onDragEnd)}removeDragListeners(){this.j.e.off(this.j.editor,"mousemove",this.onDrag).off("mouseup",this.onDrop).off([this.j.ew,this.ow],"mouseup",this.onDragEnd)}beforeDestruct(){this.onDragEnd(),this.j.e.off("mousedown dragstart",this.onDragStart),this.removeDragListeners()}}(0,r.gn)([L.autobind],Pt.prototype,"onDragStart",null),(0,r.gn)([(0,L.throttle)((e=>e.j.defaultTimeout/10))],Pt.prototype,"onDrag",null),(0,r.gn)([L.autobind],Pt.prototype,"onDragEnd",null),(0,r.gn)([L.autobind],Pt.prototype,"onDrop",null);const _t=(e,t,i,o)=>{var s;const r=e.createInside.element(i),n=e.createInside.element("br");r.appendChild(n),o&&o.cssText&&r.setAttribute("style",o.cssText),e.s.insertNode(r,!1,!1),e.s.setCursorBefore(n);const a=e.s.createRange();return a.setStartBefore("br"!==i.toLowerCase()?n:r),a.collapse(!0),e.s.selectRange(a),D.i.safeRemove(t),(0,g.scrollIntoViewIfNeeded)(r,e.editor,e.ed),null===(s=e.events)||void 0===s||s.fire("synchro"),r};class Rt extends G{constructor(){super(...arguments),this.brMode=!1,this.defaultTag=a.PARAGRAPH}afterInit(e){this.defaultTag=e.o.enter.toLowerCase(),this.brMode=this.defaultTag===a.BR.toLowerCase(),e.o.enterBlock||(e.o.enterBlock=this.brMode?a.PARAGRAPH:this.defaultTag),e.e.off(".enter").on("keydown.enter",(t=>{if(t.key===a.KEY_ENTER){const i=e.e.fire("beforeEnter",t);return void 0!==i?i:(e.s.isCollapsed()||e.execCommand("Delete"),e.s.focus(),this.onEnter(t),!1)}}))}onEnter(e){const t=this.j,i=t.selection,o=this.defaultTag;let s=i.current(!1);s&&s!==t.editor||(s=t.createInside.text(a.INVISIBLE_SPACE),i.insertNode(s),i.select(s));let r=this.getBlockWrapper(s);const n=D.i.isTag(r,"li");if((!n||e.shiftKey)&&!this.checkBR(s,e.shiftKey))return!1;if(r||this.hasPreviousBlock(s)||(r=this.wrapText(s)),!r||r===s)return _t(t,null,n?"li":o),!1;if(!this.checkUnsplittableBox(r))return!1;if(n&&D.i.isEmpty(r))return this.enterInsideEmptyLIelement(r),!1;const l=r.tagName.toLowerCase()===this.defaultTag||n,c=i.cursorOnTheRight(r),d=i.cursorOnTheLeft(r);if(!l&&(c||d)){let e=null;return e=c?i.setCursorAfter(r):i.setCursorBefore(r),_t(t,e,this.defaultTag),void(d&&!c&&i.setCursorIn(r,!0))}i.splitSelection(r)}getBlockWrapper(e,t=a.IS_BLOCK){let i=e;const o=this.j.editor;do{if(!i||i===o)break;if(t.test(i.nodeName))return D.i.isTag(i,"li")?i:this.getBlockWrapper(i.parentNode,/^li$/i)||i;i=i.parentNode}while(i&&i!==o);return null}checkBR(e,t){const i=D.i.closest(e,["pre","blockquote"],this.j.editor);if(this.brMode||t&&!i||!t&&i){const e=this.j.createInside.element("br");return this.j.s.insertNode(e,!0),(0,g.scrollIntoViewIfNeeded)(e,this.j.editor,this.j.ed),!1}return!0}wrapText(e){let t=e;D.i.up(t,(e=>{e&&e.hasChildNodes()&&e!==this.j.editor&&(t=e)}),this.j.editor);const i=D.i.wrapInline(t,this.j.o.enter,this.j);if(D.i.isEmpty(i)){const e=this.j.createInside.element("br");i.appendChild(e),this.j.s.setCursorBefore(e)}return i}hasPreviousBlock(e){return!!D.i.prev(e,(e=>D.i.isBlock(e)||D.i.isImage(e)),this.j.editor)}checkUnsplittableBox(e){const t=this.j,i=t.selection;if(!D.i.canSplitBlock(e)){const e=t.createInside.element("br");return i.insertNode(e,!1),i.setCursorAfter(e),!1}return!0}enterInsideEmptyLIelement(e){let t=null;const i=D.i.closest(e,["ol","ul"],this.j.editor);if(i){if(D.i.prev(e,(e=>D.i.isTag(e,"li")),i))if(D.i.next(e,(e=>D.i.isTag(e,"li")),i)){const o=this.j.s.createRange();o.setStartBefore(i),o.setEndAfter(e);const s=o.extractContents();i.parentNode&&i.parentNode.insertBefore(s,i),t=this.j.s.setCursorBefore(i)}else t=this.j.s.setCursorAfter(i);else t=this.j.s.setCursorBefore(i);D.i.safeRemove(e),_t(this.j,t,this.defaultTag),(0,g.$$)("li",i).length||D.i.safeRemove(i)}}beforeDestruct(e){e.e.off("keydown.enter")}}class Nt extends G{afterInit(e){}beforeDestruct(e){}onKeyDownArrow(e){var t;if(e.key!==a.KEY_RIGHT||!this.j.selection.isCollapsed())return;const{endContainer:i,endOffset:o}=this.j.selection.range;if(D.i.isText(i)&&(null===(t=i.nodeValue)||void 0===t?void 0:t.length)===o){const{parentNode:e}=i;D.i.isInlineBlock(e)&&!ot(e,!1,this.j.editor)&&D.i.after(e,this.j.createInside.text(a.NBSP_SPACE))}}}(0,r.gn)([(0,L.watch)(":keydown")],Nt.prototype,"onKeyDownArrow",null),n.D.prototype.showMessageErrors=!0,n.D.prototype.showMessageErrorTime=3e3,n.D.prototype.showMessageErrorOffsetPx=3;const qt="error-box-for-messages";function Bt(e){if(e.o.showMessageErrors){const t=e.getFullElName(qt,"active",!0),i=e.c.div(e.getFullElName(qt)),o=()=>{let t=5;(0,g.toArray)(i.childNodes).forEach((i=>{(0,g.css)(i,"bottom",t+"px"),t+=i.offsetHeight+e.o.showMessageErrorOffsetPx}))};e.e.on("beforeDestruct",(()=>{D.i.safeRemove(i)})).on("errorMessage",((s,r,n)=>{e.workplace.appendChild(i);const a=e.c.div(t,s);a.classList.add(e.getFullElName(qt,"type",r)),i.appendChild(a),o(),e.async.setTimeout((()=>{a.classList.remove(t),e.async.setTimeout((()=>{D.i.safeRemove(a),o()}),300)}),n||e.o.showMessageErrorTime)}))}}function Ht(e){e.registerButton({name:"font",group:"font"}).registerButton({name:"fontsize",group:"font"});const t=(t,i,o)=>{switch(t){case"fontsize":e.s.applyStyle({fontSize:(0,g.normalizeSize)(o)});break;case"fontname":e.s.applyStyle({fontFamily:o})}return e.e.fire("synchro"),!1};e.registerCommand("fontsize",t).registerCommand("fontname",t)}function Ot(e){e.registerButton({name:"paragraph",group:"font"}),e.registerCommand("formatblock",((t,i,o)=>(e.s.applyStyle(void 0,{element:o}),e.synchronizeValues(),!1)))}function Ft(e){e.registerButton({name:"fullsize"});let t=!1,i=0,o=0,s=!1;const r=()=>{const{container:r,events:n}=e;n&&(t?(i=(0,g.css)(r,"height",!0),o=(0,g.css)(r,"width",!0),(0,g.css)(r,{height:e.ow.innerHeight,width:e.ow.innerWidth}),s=!0):s&&(0,g.css)(r,{height:i||"auto",width:o||"auto"}))},n=i=>{const{container:o,events:s}=e;if(o){if(void 0===i&&(i=!o.classList.contains("jodit_fullsize")),e.setMod("fullsize",i),e.o.fullsize=i,t=i,o.classList.toggle("jodit_fullsize",i),e.toolbar&&((0,g.isJoditObject)(e)&&e.toolbarContainer.appendChild(e.toolbar.container),(0,g.css)(e.toolbar.container,"width","auto")),e.o.globalFullSize){let e=o.parentNode;for(;e&&e.nodeType!==Node.DOCUMENT_NODE;)e.classList.toggle("jodit_fullsize-box_true",i),e=e.parentNode;r()}s.fire("afterResize")}};e.o.globalFullSize&&e.e.on(e.ow,"resize",r),e.e.on("afterInit afterOpen",(()=>{var t;e.toggleFullSize(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.fullsize)})).on("toggleFullSize",n).on("beforeDestruct",(()=>{t&&n(!1)})).on("beforeDestruct",(()=>{e.events&&e.e.off(e.ow,"resize",r)}))}n.D.prototype.defaultFontSizePoints="px",n.D.prototype.controls.fontsize={command:"fontSize",data:{cssRule:"font-size"},list:["8","9","10","11","12","14","16","18","24","30","36","48","60","72","96"],exec:(e,t,{control:i})=>(0,g.memorizeExec)(e,t,{control:i},(t=>{var o;return"fontsize"===(null===(o=i.command)||void 0===o?void 0:o.toLowerCase())?`${t}${e.o.defaultFontSizePoints}`:t})),childTemplate:(e,t,i)=>`${i}${e.o.defaultFontSizePoints}`,tooltip:"Font size",isChildActive(e,t){var i,o;const s=e.s.current(),r=(null===(i=t.data)||void 0===i?void 0:i.cssRule)||"font-size",n=(null===(o=t.data)||void 0===o?void 0:o.normalize)||(t=>/pt$/i.test(t)&&"pt"===e.o.defaultFontSizePoints?t.replace(/pt$/i,""):t);if(s){const i=D.i.closest(s,D.i.isElement,e.editor)||e.editor,o=(0,g.css)(i,r);return!(!o||!t.args||n(""+t.args[0])!==n(""+o))}return!1}},n.D.prototype.controls.font={...n.D.prototype.controls.fontsize,command:"fontname",list:{"":"Default","Helvetica,sans-serif":"Helvetica","Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma","Times New Roman,Times,serif":"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},childTemplate(e,t,i){let o=!1;try{o=-1===t.indexOf("dings")&&document.fonts.check("16px "+t,i)}catch(e){}return`${i}`},data:{cssRule:"font-family",normalize:e=>e.toLowerCase().replace(/['"]+/g,"").replace(/[^a-z0-9]+/g,",")},tooltip:"Font family"},n.D.prototype.controls.paragraph={command:"formatBlock",update(e){const t=e.j,i=e.control,o=t.s.current();if(o&&t.o.textIcons){const s=(D.i.closest(o,D.i.isBlock,t.editor)||t.editor).nodeName.toLowerCase(),r=i.list;e&&i.data&&i.data.currentValue!==s&&r&&r[s]&&(t.o.textIcons?e.state.text=s:e.state.icon.name=s,i.data.currentValue=s)}return!1},exec:g.memorizeExec,data:{currentValue:"left"},list:{p:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",blockquote:"Quote",pre:"Code"},isChildActive(e,t){const i=e.s.current();if(i){const o=D.i.closest(i,D.i.isBlock,e.editor);return!(!o||o===e.editor||void 0===t.args||o.nodeName.toLowerCase()!==t.args[0])}return!1},isActive(e,t){const i=e.s.current();if(i){const o=D.i.closest(i,D.i.isBlock,e.editor);return!(!o||o===e.editor||void 0===t.list||D.i.isTag(o,"p")||void 0===t.list[o.nodeName.toLowerCase()])}return!1},childTemplate:(e,t,i)=>`<${t} style="margin:0;padding:0">${e.i18n(i)}`,tooltip:"Insert format block"},n.D.prototype.fullsize=!1,n.D.prototype.globalFullSize=!0,n.D.prototype.controls.fullsize={exec(e){e.toggleFullSize()},update(e){const t=e.j,i=t.isFullSize?"shrink":"fullsize";e.state.activated=t.isFullSize,t.o.textIcons?e.state.text=i:e.state.icon.name=i},tooltip:"Open editor in fullsize",mode:a.MODE_SOURCE+a.MODE_WYSIWYG},n.D.prototype.commandToHotkeys={removeFormat:["ctrl+shift+m","cmd+shift+m"],insertOrderedList:["ctrl+shift+7","cmd+shift+7"],insertUnorderedList:["ctrl+shift+8, cmd+shift+8"],selectall:["ctrl+a","cmd+a"]};class Wt extends G{constructor(){super(...arguments),this.onKeyPress=e=>{const t=this.specialKeys[e.which],i=(e.key||String.fromCharCode(e.which)).toLowerCase(),o=[t||i];return["alt","ctrl","shift","meta"].forEach((i=>{e[i+"Key"]&&t!==i&&o.push(i)})),(0,g.normalizeKeyAliases)(o.join("+"))},this.specialKeys={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",91:"meta",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}}afterInit(e){(0,g.keys)(e.o.commandToHotkeys,!1).forEach((t=>{const i=e.o.commandToHotkeys[t];i&&((0,g.isArray)(i)||(0,g.isString)(i))&&e.registerHotkeyToCommand(i,t)}));let t=!1;e.e.off(".hotkeys").on([e.ow,e.ew],"keydown.hotkeys",(e=>{if(e.key===a.KEY_ESC)return this.j.e.fire("escape",e)})).on("keydown.hotkeys",(i=>{const o=this.onKeyPress(i),s={shouldStop:!0};if(!1===this.j.e.fire(o+".hotkey",i.type,s)){if(s.shouldStop)return t=!0,e.e.stopPropagation("keydown"),!1;i.preventDefault()}}),void 0,!0).on("keyup.hotkeys",(()=>{if(t)return t=!1,e.e.stopPropagation("keyup"),!1}),void 0,!0)}beforeDestruct(e){e.events&&e.e.off(".hotkeys")}}function Vt(e){const t=e.options;e.e.on("afterSetMode",(()=>{e.isEditorMode()&&e.s.focus()})).on("generateDocumentStructure.iframe",((e,i)=>{const o=e||i.iframe.contentWindow.document;if(o.open(),o.write(t.iframeDoctype+``+`${t.iframeTitle}`+(t.iframeBaseUrl?``:"")+''),o.close(),t.iframeCSSLinks&&t.iframeCSSLinks.forEach((e=>{const t=o.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),o.head&&o.head.appendChild(t)})),t.iframeStyle){const e=o.createElement("style");e.innerHTML=t.iframeStyle,o.head&&o.head.appendChild(e)}})).on("createEditor",(()=>{if(!t.iframe)return;const i=e.c.element("iframe");i.style.display="block",i.src="about:blank",i.className="jodit-wysiwyg_iframe",i.setAttribute("allowtransparency","true"),i.setAttribute("tabindex",""+t.tabIndex),i.setAttribute("frameborder","0"),e.workplace.appendChild(i),e.iframe=i;const o=e.e.fire("generateDocumentStructure.iframe",null,e);return(0,g.callPromise)(o,(()=>{if(!e.iframe)return!1;const i=e.iframe.contentWindow.document;e.editorWindow=e.iframe.contentWindow;const o=()=>{(0,g.attr)(i.body,"contenteditable",e.getMode()!==a.MODE_SOURCE&&!e.getReadOnly()||null)},s=e=>{const t=//im,i="{%%BODY%%}",o=t.exec(e);return o&&(e=e.replace(t,i).replace(/]*?)>(.*?)<\/span>/gim,"").replace(/<span([^&]*?)>(.*?)<\/span>/gim,"").replace(i,o[0].replace(/(]+?)min-height["'\s]*:[\s"']*[0-9]+(px|%)/im,"$1").replace(/(]+?)([\s]*["'])?contenteditable["'\s]*=[\s"']*true["']?/im,"$1").replace(/<(style|script|span)[^>]+jodit[^>]+>.*?<\/\1>/g,"")).replace(/(class\s*=\s*)(['"])([^"']*)(jodit-wysiwyg|jodit)([^"']*\2)/g,"$1$2$3$5").replace(/(<[^<]+?)\sclass="[\s]*"/gim,"$1").replace(/(<[^<]+?)\sstyle="[\s;]*"/gim,"$1").replace(/(<[^<]+?)\sdir="[\s]*"/gim,"$1")),e};if(t.editHTMLDocumentMode){const t=e.element.tagName;if("TEXTAREA"!==t&&"INPUT"!==t)throw(0,g.error)("If enable `editHTMLDocumentMode` - source element should be INPUT or TEXTAREA");e.e.on("beforeGetNativeEditorValue",(()=>s(e.o.iframeDoctype+i.documentElement.outerHTML))).on("beforeSetNativeEditorValue",(({value:t})=>!e.isLocked&&(/<(html|body)/i.test(t)?s(i.documentElement.outerHTML)!==s(t)&&(i.open(),i.write(e.o.iframeDoctype+s(t)),i.close(),e.editor=i.body,e.e.fire("safeHTML",e.editor),o(),e.e.fire("prepareWYSIWYGEditor"),e.e.stopPropagation("beforeSetNativeEditorValue")):i.body.innerHTML=t,!0)),void 0,!0)}if(e.editor=i.body,e.e.on("afterSetMode afterInit afterAddPlace",o),"auto"===t.height){i.documentElement&&(i.documentElement.style.overflowY="hidden");const o=e.async.throttle((()=>{if(e.editor&&e.iframe&&"auto"===t.height){const t=e.ew.getComputedStyle(e.editor);(0,g.css)(e.iframe,"height",e.editor.offsetHeight+(parseInt(t.marginTop||"0",10)+parseInt(t.marginBottom||"0",10)))}}),e.defaultTimeout/2);e.e.on("change afterInit afterSetMode resize",o).on([e.iframe,e.ew,i.documentElement],"load",o).on(i,"readystatechange DOMContentLoaded",o)}return i.documentElement&&e.e.on(i.documentElement,"mousedown touchend",(()=>{e.s.isFocused()||(e.s.focus(),e.editor===i.body&&e.s.setCursorIn(i.body))})).on(e.ew,"mousedown touchstart keydown keyup touchend click mouseup mousemove scroll",(t=>{var i;null===(i=e.events)||void 0===i||i.fire(e.ow,t)})),!1}))}))}function Ut(e){const t=e.o,i=e.i18n.bind(e),o=P.JO.get.bind(P.JO),s=t.filebrowser.ajax.url||t.uploader.url,r=t.image.useImageEditor;return e.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t${o("image")}\n\t\t\t\t\t\t${o("crop")}\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t
`)}function $t(e){const t=e.o,i=e.i18n.bind(e),o=P.JO.get.bind(P.JO);return e.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t${o("lock")}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t`)}n.D.prototype.iframe=!1,n.D.prototype.iframeBaseUrl="",n.D.prototype.iframeTitle="Jodit Editor",n.D.prototype.iframeDoctype="",n.D.prototype.iframeDefaultSrc="about:blank",n.D.prototype.iframeStyle='html{margin:0;padding:0;min-height: 100%;}body{box-sizing:border-box;font-size:13px;line-height:1.6;padding:10px;margin:0;background:transparent;color:#000;position:relative;z-index:2;user-select:auto;margin:0px;overflow:auto;outline:none;}table{width:100%;border:none;border-collapse:collapse;empty-cells: show;max-width: 100%;}th,td{padding: 2px 5px;border:1px solid #ccc;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}p{margin-top:0;}.jodit_editor .jodit_iframe_wrapper{display: block;clear: both;user-select: none;position: relative;}.jodit_editor .jodit_iframe_wrapper:after {position:absolute;content:"";z-index:1;top:0;left:0;right: 0;bottom: 0;cursor: pointer;display: block;background: rgba(0, 0, 0, 0);} .jodit_disabled{user-select: none;-o-user-select: none;-moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-ms-user-select: none}',n.D.prototype.iframeCSSLinks=[],n.D.prototype.editHTMLDocumentMode=!1;var Yt=i(78);n.D.prototype.image={dialogWidth:600,openOnDblClick:!0,editSrc:!0,useImageEditor:!0,editTitle:!0,editAlt:!0,editLink:!0,editSize:!0,editBorderRadius:!0,editMargins:!0,editClass:!0,editStyle:!0,editId:!0,editAlign:!0,showPreview:!0,selectImageAfterClose:!0};const Kt=e=>(e=(0,g.trim)(e),/^[0-9]+$/.test(e)?e+"px":e),Gt=e=>/^[-+]?[0-9.]+px$/.test(""+e)?parseFloat(""+e):e;class Jt extends G{constructor(){super(...arguments),this.state={image:new Image,get ratio(){return this.image.naturalWidth/this.image.naturalHeight||1},sizeIsLocked:!0,marginIsLocked:!0},this.activeTabState={__activeTab:"Image"}}onChangeMarginIsLocked(){if(!this.form)return;const{marginRight:e,marginBottom:t,marginLeft:i,lockMargin:o}=(0,g.refs)(this.form);[e,t,i].forEach((e=>{(0,g.attr)(e,"disabled",this.state.marginIsLocked||null)})),o.innerHTML=P.JO.get(this.state.marginIsLocked?"lock":"unlock")}onChangeSizeIsLocked(){if(!this.form)return;const{lockSize:e,imageWidth:t}=(0,g.refs)(this.form);e.innerHTML=P.JO.get(this.state.sizeIsLocked?"lock":"unlock"),e.classList.remove("jodit-properties__lock"),e.classList.remove("jodit-properties__unlock"),e.classList.add(this.state.sizeIsLocked?"jodit-properties__lock":"jodit-properties__unlock"),this.j.e.fire(t,"change")}open(){return this.makeForm(),this.activeTabState.__activeTab="Image",this.j.e.fire("hidePopup"),(0,g.markOwner)(this.j,this.dialog.container),this.state.marginIsLocked=!0,this.state.sizeIsLocked=!0,this.onChangeMarginIsLocked(),this.onChangeSizeIsLocked(),this.updateValues(),this.dialog.open().setModal(!0).setPosition(),!1}makeForm(){if(this.dialog)return;this.dialog=new V({fullsize:this.j.o.fullsize,globalFullSize:this.j.o.globalFullSize,theme:this.j.o.theme,language:this.j.o.language,minWidth:Math.min(400,screen.width),minHeight:590,buttons:["fullsize","dialog.close"]});const e=this.j,t=e.o,i=e.i18n.bind(e),o={check:(0,k.zx)(e,"ok","Apply","primary"),remove:(0,k.zx)(e,"bin","Delete")};e.e.on(this.dialog,"afterClose",(()=>{this.state.image.parentNode&&t.image.selectImageAfterClose&&e.s.select(this.state.image)})),o.remove.onAction((()=>{e.s.removeNode(this.state.image),this.dialog.close()}));const{dialog:s}=this;s.setHeader(i("Image properties"));const r=(e=>{const{showPreview:t,editSize:i}=e.o.image,o=P.JO.get.bind(P.JO);return e.c.fromHTML(`
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t${o("lock")}\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t
`)})(e);this.form=r,s.setContent(r);const{tabsBox:n}=(0,g.refs)(this.form);n&&n.appendChild((0,At.IL)(e,[{name:"Image",content:Ut(e)},{name:"Advanced",content:$t(e)}],this.activeTabState)),o.check.onAction(this.onApply);const{changeImage:a,editImage:l}=(0,g.refs)(this.form);e.e.on(a,"click",this.openImagePopup),t.image.useImageEditor&&e.e.on(l,"click",this.openImageEditor);const{lockSize:c,lockMargin:d,imageWidth:h,imageHeight:u}=(0,g.refs)(r);c&&e.e.on(c,"click",(()=>{this.state.sizeIsLocked=!this.state.sizeIsLocked})),e.e.on(d,"click",(e=>{this.state.marginIsLocked=!this.state.marginIsLocked,e.preventDefault()}));const p=e=>{if(!(0,g.isNumeric)(h.value)||!(0,g.isNumeric)(u.value))return;const t=parseFloat(h.value),i=parseFloat(u.value);e.target===h?u.value=""+Math.round(t/this.state.ratio):h.value=""+Math.round(i*this.state.ratio)};e.e.on([h,u],"change keydown mousedown paste",(t=>{this.state.sizeIsLocked&&e.async.setTimeout(p.bind(this,t),{timeout:e.defaultTimeout,label:"image-properties-changeSize"})})),s.setFooter([o.remove,o.check]),s.setSize(this.j.o.image.dialogWidth)}updateValues(){const e=this.j.o,{image:t}=this.state,{marginTop:i,marginRight:o,marginBottom:s,marginLeft:r,lockMargin:n,imageSrc:a,id:l,classes:c,align:d,style:h,imageTitle:u,imageAlt:p,borderRadius:m,imageLink:f,imageWidth:v,imageHeight:b,imageLinkOpenInNewTab:y,imageViewSrc:w,lockSize:k}=(0,g.refs)(this.form);(()=>{n.checked=this.state.marginIsLocked,k.checked=this.state.sizeIsLocked})(),a.value=(0,g.attr)(t,"src")||"",w&&(0,g.attr)(w,"src",(0,g.attr)(t,"src")||""),(()=>{u.value=(0,g.attr)(t,"title")||"",p.value=(0,g.attr)(t,"alt")||"";const e=D.i.closest(t,"a",this.j.editor);e?(f.value=(0,g.attr)(e,"href")||"",y.checked="_blank"===(0,g.attr)(e,"target")):(f.value="",y.checked=!1)})(),(()=>{const e=(0,g.attr)(t,"width")||(0,g.css)(t,"width",!0)||!1,i=(0,g.attr)(t,"height")||(0,g.css)(t,"height",!0)||!1;v.value=!1!==e?""+Gt(e):""+t.offsetWidth,b.value=!1!==i?""+Gt(i):""+t.offsetHeight,this.state.sizeIsLocked=(()=>!(!(0,g.isNumeric)(v.value)||!(0,g.isNumeric)(b.value))&&1>Math.abs(parseFloat(v.value)-parseFloat(b.value)*this.state.ratio))()})(),(()=>{if(!e.image.editMargins)return;let n=!0,a=!1;[i,o,s,r].forEach((e=>{const o=(0,g.attr)(e,"data-ref")||"";let s=t.style.getPropertyValue((0,g.kebabCase)(o));if(!s)return a=!0,void(e.value="");/^[0-9]+(px)?$/.test(s)&&(s=parseInt(s,10)),e.value=""+s||"",(a&&e.value||n&&"marginTop"!==o&&e.value!==i.value)&&(n=!1)})),this.state.marginIsLocked=n})(),c.value=((0,g.attr)(t,"class")||"").replace(/jodit_focused_image[\s]*/,""),l.value=(0,g.attr)(t,"id")||"",m.value=""+(parseInt(t.style.borderRadius||"0",10)||"0"),t.style.cssFloat&&-1!==["left","right"].indexOf(t.style.cssFloat.toLowerCase())?d.value=(0,g.css)(t,"float"):"block"===(0,g.css)(t,"display")&&"auto"===t.style.marginLeft&&"auto"===t.style.marginRight&&(d.value="center"),h.value=(0,g.attr)(t,"style")||""}onApply(){const{style:e,imageSrc:t,borderRadius:i,imageTitle:o,imageAlt:s,imageLink:r,imageWidth:n,imageHeight:a,marginTop:l,marginRight:c,marginBottom:d,marginLeft:h,imageLinkOpenInNewTab:u,align:p,classes:m,id:f}=(0,g.refs)(this.form),v=this.j.o,{image:b}=this.state;if(v.image.editStyle&&(0,g.attr)(b,"style",e.value||null),!t.value)return D.i.safeRemove(b),void this.dialog.close();(0,g.attr)(b,"src",t.value),b.style.borderRadius="0"!==i.value&&/^[0-9]+$/.test(i.value)?i.value+"px":"",(0,g.attr)(b,"title",o.value||null),(0,g.attr)(b,"alt",s.value||null);let y=D.i.closest(b,"a",this.j.editor);if(r.value?(y||(y=D.i.wrap(b,"a",this.j.createInside)),(0,g.attr)(y,"href",r.value),(0,g.attr)(y,"target",u.checked?"_blank":null)):y&&y.parentNode&&y.parentNode.replaceChild(b,y),n.value!==""+b.offsetWidth||a.value!==""+b.offsetHeight){const e=(0,g.trim)(n.value)?Kt(n.value):null,t=(0,g.trim)(a.value)?Kt(a.value):null;(0,g.css)(b,{width:e,height:t}),(0,g.attr)(b,"width",(0,g.attr)(b,"width")?e:null),(0,g.attr)(b,"height",(0,g.attr)(b,"height")?t:null)}const w=[l,c,d,h];v.image.editMargins&&(this.state.marginIsLocked?(0,g.css)(b,"margin",Kt(l.value)):w.forEach((e=>{const t=(0,g.attr)(e,"data-ref")||"";(0,g.css)(b,t,Kt(e.value))}))),v.image.editClass&&(0,g.attr)(b,"class",m.value||null),v.image.editId&&(0,g.attr)(b,"id",f.value||null),v.image.editAlign&&(0,Yt.z)(b,p.value),this.j.synchronizeValues(),this.dialog.close()}openImageEditor(){const e=(0,g.attr)(this.state.image,"src")||"",t=this.j.c.element("a"),i=()=>{t.host===location.host||Y(this.j.i18n("You can only edit your own images. Download this image on the host?"),(e=>{e&&this.j.uploader&&this.j.uploader.uploadRemoteImage(""+t.href,(e=>{U(this.j.i18n("The image has been successfully uploaded to the host!"),(()=>{(0,g.isString)(e.newfilename)&&((0,g.attr)(this.state.image,"src",e.baseurl+e.newfilename),this.updateValues())})).bindDestruct(this.j)}),(e=>{U(this.j.i18n("There was an error loading %s",e.message)).bindDestruct(this.j)}))})).bindDestruct(this.j)};t.href=e,this.j.filebrowser.dataProvider.getPathByUrl(""+t.href).then((i=>{fe.call(this.j.filebrowser,t.href,i.name,i.path,i.source,(()=>{const t=(new Date).getTime();(0,g.attr)(this.state.image,"src",e+(-1!==e.indexOf("?")?"":"?")+"&_tmp="+t),this.updateValues()}),(e=>{U(e.message).bindDestruct(this.j)}))})).catch((e=>{U(e.message,i).bindDestruct(this.j)}))}openImagePopup(e){const t=new P.GI(this.j),{changeImage:i}=(0,g.refs)(this.form);t.setZIndex(this.dialog.getZIndex()+1),t.setContent((0,At.ov)(this.j,{upload:e=>{e.files&&e.files.length&&(0,g.attr)(this.state.image,"src",e.baseurl+e.files[0]),this.updateValues(),t.close()},filebrowser:e=>{e&&(0,g.isArray)(e.files)&&e.files.length&&((0,g.attr)(this.state.image,"src",e.files[0]),t.close(),this.updateValues())}},this.state.image,t.close)).open((()=>(0,g.position)(i))),e.stopPropagation()}afterInit(e){const t=this;e.e.on("afterConstructor changePlace",(()=>{e.e.off(e.editor,".imageproperties").on(e.editor,"dblclick.imageproperties",(i=>{const o=i.target;if(D.i.isTag(o,"img"))if(e.o.image.openOnDblClick){if(!1===this.j.e.fire("openOnDblClick",o))return;t.state.image=o,e.o.readonly||(i.stopImmediatePropagation(),i.preventDefault(),t.open())}else i.stopImmediatePropagation(),e.s.select(o)}))})).on("openImageProperties.imageproperties",(e=>{this.state.image=e,this.open()}))}beforeDestruct(e){this.dialog&&this.dialog.destruct(),e.e.off(e.editor,".imageproperties").off(".imageproperties")}}(0,r.gn)([(0,L.watch)("state.marginIsLocked")],Jt.prototype,"onChangeMarginIsLocked",null),(0,r.gn)([(0,L.watch)("state.sizeIsLocked")],Jt.prototype,"onChangeSizeIsLocked",null),(0,r.gn)([L.autobind],Jt.prototype,"onApply",null),(0,r.gn)([L.autobind],Jt.prototype,"openImageEditor",null),(0,r.gn)([L.autobind],Jt.prototype,"openImagePopup",null);const Xt="__jodit_imageprocessor_binded";function Zt(e){e.e.on("change afterInit changePlace",e.async.debounce((()=>{e.editor&&(0,g.$$)("img",e.editor).forEach((t=>{(0,g.dataBind)(t,Xt)||((0,g.dataBind)(t,Xt,!0),t.complete||e.e.on(t,"load",(function i(){var o;!e.isInDestruct&&(null===(o=e.e)||void 0===o||o.fire("resize")),e.e.off(t,"load",i)})),e.e.on(t,"mousedown touchstart",(()=>{e.s.select(t)})))}))}),e.defaultTimeout))}function Qt(e){e.registerButton({name:"image",group:"media"})}n.D.prototype.controls.image={popup(e,t,i,o){let s=null;return t&&!D.i.isText(t)&&D.i.isHTMLElement(t)&&(D.i.isTag(t,"img")||(0,g.$$)("img",t).length)&&(s=D.i.isTag(t,"img")?t:(0,g.$$)("img",t)[0]),e.s.save(),(0,At.ov)(e,{filebrowser(t){e.s.restore(),t.files&&t.files.forEach((i=>e.s.insertImage(t.baseurl+i,null,e.o.imageDefaultWidth))),o()},upload:!0,async url(t,i){e.s.restore();const r=s||e.createInside.element("img");r.setAttribute("src",t),r.setAttribute("alt",i),s||await e.s.insertImage(r,null,e.o.imageDefaultWidth),o()}},s,o)},tags:["img"],tooltip:"Insert Image"},n.D.prototype.controls.indent={tooltip:"Increase Indent"};const ei=(e,t)=>`${D.i.isCell(t)?"padding":"margin"}${"rtl"===e?"Right":"Left"}`;function ti(e){e.registerButton({name:"indent",group:"indent"}).registerButton({name:"outdent",group:"indent"});const t=t=>{const i=[];return e.s.eachSelection((o=>{e.s.save();let s=!!o&&D.i.up(o,D.i.isBlock,e.editor);const{enter:r}=e.o;if(!s&&o&&(s=D.i.wrapInline(o,r!==a.BR?r:a.PARAGRAPH,e)),!s)return e.s.restore(),!1;const n=i.includes(s);if(s&&!n){const o=ei(e.o.direction,s);i.push(s);let r=s.style[o]?parseInt(s.style[o],10):0;r+=e.o.indentMargin*("outdent"===t?-1:1),s.style[o]=r>0?r+"px":"",(0,g.attr)(s,"style")||(0,g.attr)(s,"style",null)}e.s.restore()})),e.synchronizeValues(),!1};e.registerCommand("indent",{exec:t,hotkeys:["ctrl+]","cmd+]"]}),e.registerCommand("outdent",{exec:t,hotkeys:["ctrl+[","cmd+["]})}function ii(e){e.registerButton({name:"hr",group:"insert"}),e.registerCommand("insertHorizontalRule",(()=>{const t=e.createInside.element("hr");e.s.insertNode(t,!1,!1);const i=D.i.closest(t.parentElement,D.i.isBlock,e.editor);i&&D.i.isEmpty(i)&&i!==e.editor&&(D.i.after(i,t),D.i.safeRemove(i));let o=D.i.next(t,D.i.isBlock,e.editor,!1);return o||(o=e.createInside.element(e.o.enter),D.i.after(t,o)),e.s.setCursorIn(o),!1}))}n.D.prototype.controls.outdent={isDisabled(e){const t=e.s.current();if(t){const i=D.i.closest(t,D.i.isBlock,e.editor);if(i){const t=ei(e.o.direction,i);return!i.style[t]||0>=parseInt(i.style[t],10)}}return!0},tooltip:"Decrease Indent"},n.D.prototype.indentMargin=10,n.D.prototype.controls.hr={command:"insertHorizontalRule",tags:["hr"],tooltip:"Insert Horizontal Line"},n.D.prototype.toolbarInline=!0,n.D.prototype.toolbarInlineForSelection=!1,n.D.prototype.toolbarInlineDisableFor=[],n.D.prototype.toolbarInlineDisabledButtons=["source"],n.D.prototype.popup={a:i(79).Z,img:i(80).Z,cells:i(81).Z,toolbar:i(82).Z,jodit:i(83).Z,iframe:i(83).Z,"jodit-media":i(83).Z,selection:["bold","underline","italic","ul","ol","\n","outdent","indent","fontsize","brush","cut","\n","paragraph","link","align","dots"]};class oi extends G{constructor(){super(...arguments),this.requires=["select"],this.type=null,this.popup=new w.G(this.jodit,!1),this.toolbar=H(this.jodit,this.popup),this.snapRange=null,this.elmsList=(0,g.keys)(this.j.o.popup,!1).filter((e=>!this.isExcludedTarget(e)))}onClick(e){const t=this.elmsList,i=D.i.isTag(e,"img")?e:D.i.closest(e,t,this.j.editor);if(i&&this.canShowPopupForType(i.nodeName.toLowerCase()))return this.showPopup((()=>(0,g.position)(i,this.j)),i.nodeName.toLowerCase(),i),!1}showPopup(e,t,i){if(t=t.toLowerCase(),!this.canShowPopupForType(t))return!1;if(this.type!==t||i!==this.previousTarget){this.previousTarget=i;const e=this.j.o.popup[t];let o;o=(0,g.isFunction)(e)?e(this.j,i,this.popup.close):e,(0,g.isArray)(o)&&(this.toolbar.build(o,i),this.toolbar.buttonSize=this.j.o.toolbarButtonSize,o=this.toolbar.container),this.popup.setContent(o),this.type=t}return this.popup.open(e),!0}hidePopup(e){(0,g.isString)(e)&&e!==this.type||this.popup.close()}onOutsideClick(){this.popup.close()}canShowPopupForType(e){const t=this.j.o.popup[e.toLowerCase()];return!(this.j.o.readonly||!this.j.o.toolbarInline||!t||this.isExcludedTarget(e))}isExcludedTarget(e){return(0,g.splitArray)(this.j.o.toolbarInlineDisableFor).map((e=>e.toLowerCase())).includes(e.toLowerCase())}afterInit(e){this.j.e.on("getDiffButtons.mobile",(t=>{if(this.toolbar===t){const t=this.toolbar.getButtonsNames();return(0,g.toArray)(e.registeredButtons).filter((e=>!this.j.o.toolbarInlineDisabledButtons.includes(e.name))).filter((e=>{const i=(0,g.isString)(e)?e:e.name;return i&&"|"!==i&&"\n"!==i&&!t.includes(i)}))}})).on("hidePopup",this.hidePopup).on("showInlineToolbar",this.showInlineToolbar).on("showPopup",((e,t,i)=>{this.showPopup(t,i||((0,g.isString)(e)?e:e.nodeName),(0,g.isString)(e)?void 0:e)})).on("mousedown keydown",this.onSelectionStart).on("change",(()=>{this.popup.isOpened&&this.previousTarget&&!this.previousTarget.parentNode&&(this.hidePopup(),this.previousTarget=void 0)})).on([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.addListenersForElements()}onSelectionStart(){this.snapRange=this.j.s.range.cloneRange()}onSelectionEnd(e){if(e&&e.target&&P.u1.closestElement(e.target,w.G))return;const{snapRange:t}=this,{range:i}=this.j.s;t&&!i.collapsed&&i.startContainer===t.startContainer&&i.startOffset===t.startOffset&&i.endContainer===t.endContainer&&i.endOffset===t.endOffset||this.onSelectionChange()}onSelectionChange(){if(!this.j.o.toolbarInlineForSelection)return;const e="selection",t=this.j.s.sel,i=this.j.s.range;(null==t?void 0:t.isCollapsed)||this.isSelectedTarget(i)||this.tableModule.getAllSelectedCells().length?this.type===e&&this.popup.isOpened&&this.hidePopup():this.j.s.current()&&this.showPopup((()=>i.getBoundingClientRect()),e)}isSelectedTarget(e){const t=e.startContainer;return D.i.isElement(t)&&t===e.endContainer&&D.i.isTag(t.childNodes[e.startOffset],(0,g.keys)(this.j.o.popup,!1))&&e.startOffset===e.endOffset-1}get tableModule(){return this.j.getInstance("Table",this.j.o)}beforeDestruct(e){e.e.off("showPopup").off([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.removeListenersForElements()}_eventsList(){const e=this.elmsList;return e.map((e=>(0,g.camelCase)("click_"+e))).concat(e.map((e=>(0,g.camelCase)("touchstart_"+e)))).join(" ")}addListenersForElements(){this.j.e.on(this._eventsList(),this.onClick)}removeListenersForElements(){this.j.e.off(this._eventsList(),this.onClick)}showInlineToolbar(e){this.showPopup((()=>{if(e)return e;const{range:t}=this.j.s;return t.getBoundingClientRect()}),"toolbar")}}(0,r.gn)([L.autobind],oi.prototype,"onClick",null),(0,r.gn)([(0,L.wait)((e=>!e.j.isLocked))],oi.prototype,"showPopup",null),(0,r.gn)([(0,L.watch)(":clickEditor"),L.autobind],oi.prototype,"hidePopup",null),(0,r.gn)([(0,L.watch)(":outsideClick")],oi.prototype,"onOutsideClick",null),(0,r.gn)([L.autobind],oi.prototype,"onSelectionStart",null),(0,r.gn)([L.autobind],oi.prototype,"onSelectionEnd",null),(0,r.gn)([(0,L.debounce)((e=>e.defaultTimeout))],oi.prototype,"onSelectionChange",null),(0,r.gn)([L.autobind],oi.prototype,"showInlineToolbar",null),n.D.prototype.controls.align={name:"left",tooltip:"Align",update(e){const t=e.j,i=e.control,o=t.s.current();if(o){const s=D.i.closest(o,D.i.isBlock,t.editor)||t.editor;let r=""+(0,g.css)(s,"text-align");i.defaultValue&&-1!==i.defaultValue.indexOf(r)&&(r="left"),i.data&&i.data.currentValue!==r&&i.list&&-1!==i.list.indexOf(r)&&(t.o.textIcons?e.state.text=r:e.state.icon.name=r,i.data.currentValue=r)}},isActive(e,t){const i=e.s.current();if(i&&t.defaultValue){const o=D.i.closest(i,D.i.isBlock,e.editor)||e.editor;return-1===t.defaultValue.indexOf(""+(0,g.css)(o,"text-align"))}return!1},defaultValue:["left","start","inherit"],data:{currentValue:"left"},list:["center","left","right","justify"]},n.D.prototype.controls.center={command:"justifyCenter",css:{"text-align":"center"},tooltip:"Align Center"},n.D.prototype.controls.justify={command:"justifyFull",css:{"text-align":"justify"},tooltip:"Align Justify"},n.D.prototype.controls.left={command:"justifyLeft",css:{"text-align":"left"},tooltip:"Align Left"},n.D.prototype.controls.right={command:"justifyRight",css:{"text-align":"right"},tooltip:"Align Right"};const si=(e,t)=>{if(D.i.isNode(t)&&D.i.isElement(t))switch(D.i.each(t,(e=>{D.i.isHTMLElement(e)&&e.style.textAlign&&(e.style.textAlign="",e.style.cssText.trim().length||e.removeAttribute("style"))})),e.toLowerCase()){case"justifyfull":t.style.textAlign="justify";break;case"justifyright":t.style.textAlign="right";break;case"justifyleft":t.style.textAlign="left";break;case"justifycenter":t.style.textAlign="center"}};function ri(e){e.registerButton({name:"align",group:"indent"});const t=t=>(e.s.focus(),e.s.eachSelection((i=>{if(!i)return;let o=D.i.up(i,D.i.isBlock,e.editor);o||(o=D.i.wrapInline(i,e.o.enterBlock,e)),si(t,o)})),!1);e.registerCommand("justifyfull",t),e.registerCommand("justifyright",t),e.registerCommand("justifyleft",t),e.registerCommand("justifycenter",t)}n.D.prototype.limitWords=!1,n.D.prototype.limitChars=!1,n.D.prototype.limitHTML=!1;class ni extends G{afterInit(e){const{limitWords:t,limitChars:i}=e.o;if(e&&(t||i)){let t=null;e.e.off(".limit").on("beforePaste.limit",(()=>{t=e.history.snapshot.make()})).on("keydown.limit keyup.limit beforeEnter.limit beforePaste.limit",this.checkPreventKeyPressOrPaste).on("change.limit",this.checkPreventChanging).on("afterPaste.limit",(()=>{if(this.shouldPreventInsertHTML()&&t)return e.history.snapshot.restore(t),!1}))}}shouldPreventInsertHTML(e=null,t=""){if(e&&a.COMMAND_KEYS.includes(e.key))return!1;const{jodit:i}=this,{limitWords:o,limitChars:s}=i.o,r=this.splitWords(t||(i.o.limitHTML?i.value:i.text));return!(!o||o>r.length)||!!s&&r.join("").length>=s}checkPreventKeyPressOrPaste(e){if(this.shouldPreventInsertHTML(e))return!1}checkPreventChanging(e,t){const{jodit:i}=this,{limitWords:o,limitChars:s}=i.o,r=i.o.limitHTML?e:(0,g.stripTags)(e),n=this.splitWords(r);(o&&n.length>o||s&&n.join("").length>s)&&(i.value=t)}splitWords(e){return e.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((e=>e.length))}beforeDestruct(e){e.e.off(".limit")}}(0,r.gn)([L.autobind],ni.prototype,"checkPreventKeyPressOrPaste",null),(0,r.gn)([L.autobind],ni.prototype,"checkPreventChanging",null),n.D.prototype.defaultLineHeight=null,n.D.prototype.controls.lineHeight={icon:"line-height",command:"applyLineHeight",tags:["ol"],tooltip:"Line height",list:[1,1.1,1.2,1.3,1.4,1.5,2],exec:(e,t,{control:i})=>(0,g.memorizeExec)(e,t,{control:i},(e=>e))};class ai extends G{constructor(){super(...arguments),this.buttons=[{name:"lineHeight",group:"font"}]}afterInit(e){(0,g.css)(e.editor,{lineHeight:e.o.defaultLineHeight}),e.registerCommand("applyLineHeight",this.applyLineHeight)}applyLineHeight(e,t,i){const{s:o,createInside:s,editor:r,o:n}=this.j;let a;o.isFocused()||o.focus(),o.save();const l=e=>{let t=D.i.closest(e,D.i.isBlock,r);t||(t=D.i.wrap(e,n.enter,s));const o=(0,g.css)(t,"lineHeight");void 0===a&&(a=""+o!=""+i),(0,g.css)(t,"lineHeight",a?i:null)};try{if(o.isCollapsed()){const e=s.fake();o.insertNode(e,!1,!1),l(e),D.i.safeRemove(e)}else o.eachSelection(l)}finally{o.restore()}}beforeDestruct(e){(0,g.css)(e.editor,{lineHeight:null})}}(0,r.gn)([L.autobind],ai.prototype,"applyLineHeight",null);var li=i(55);n.D.prototype.link={formTemplate(e){const{openInNewTabCheckbox:t,noFollowCheckbox:i,modeClassName:o,selectSizeClassName:s,selectMultipleClassName:r,selectOptionsClassName:n}=e.o.link;return new li.x4(e,[new li.eC(e,[new li.u3(e,{name:"url",type:"text",ref:"url_input",label:"URL",placeholder:"http://",required:!0})]),new li.eC(e,[new li.u3(e,{name:"content",ref:"content_input",label:"Text"})],{ref:"content_input_box"}),o?new li.eC(e,["input"===o?new li.u3(e,{name:"className",ref:"className_input",label:"Class name"}):"select"===o?new li.Cj(e,{name:"className",ref:"className_select",label:"Class name",size:s,multiple:r,options:n}):null]):null,t?new li.mA(e,{name:"target",ref:"target_checkbox",label:"Open in new tab"}):null,i?new li.mA(e,{name:"nofollow",ref:"nofollow_checkbox",label:"No follow"}):null,new li.eC(e,[new k.y3(e,{name:"unlink",variant:"default",text:"Unlink"}),new k.y3(e,{name:"insert",type:"submit",variant:"primary",text:"Insert"})],{align:"full"})])},followOnDblClick:!1,processVideoLink:!0,processPastedLink:!0,noFollowCheckbox:!0,openInNewTabCheckbox:!0,modeClassName:"input",selectMultipleClassName:!0,selectSizeClassName:3,selectOptionsClassName:[],hotkeys:["ctrl+k","cmd+k"]},n.D.prototype.controls.unlink={exec(e,t){const i=D.i.closest(t,"a",e.editor);i&&D.i.unwrap(i),e.synchronizeValues(),e.e.fire("hidePopup")},tooltip:"Unlink"},n.D.prototype.controls.link={isActive(e){const t=e.s.current();return!(!t||!D.i.closest(t,"a",e.editor))},popup:(e,t,i,o)=>e.e.fire("generateLinkForm.link",t,o),tags:["a"],tooltip:"Insert link"};class ci extends G{constructor(){super(...arguments),this.buttons=[{name:"link",group:"insert"}]}afterInit(e){e.o.link.followOnDblClick&&e.e.on("dblclick.link",this.onDblClickOnLink),e.o.link.processPastedLink&&e.e.on("processPaste.link",this.onProcessPasteLink),e.e.on("generateLinkForm.link",this.generateForm),e.registerCommand("openLinkDialog",{exec:()=>{const t=new V({resizable:!1}),i=this.generateForm(e.s.current(),(()=>{t.close()}));i.container.classList.add("jodit-dialog_alert"),t.setContent(i),t.open(),e.async.requestIdleCallback((()=>{const{url_input:e}=(0,g.refs)(i.container);null==e||e.focus()}))},hotkeys:e.o.link.hotkeys})}onDblClickOnLink(e){if(!D.i.isTag(e.target,"a"))return;const t=(0,g.attr)(e.target,"href");t&&(location.href=t,e.preventDefault())}onProcessPasteLink(e,t){const{jodit:i}=this;if((0,g.isURL)(t)){if(i.o.link.processVideoLink){const e=(0,g.convertMediaUrlToVideoEmbed)(t);if(e!==t)return i.e.stopPropagation("processPaste"),i.createInside.fromHTML(e)}const e=i.createInside.element("a");return e.setAttribute("href",t),e.textContent=t,i.e.stopPropagation("processPaste"),e}}generateForm(e,t){const{jodit:i}=this,o=i.i18n.bind(i),{openInNewTabCheckbox:s,noFollowCheckbox:r,formTemplate:n,formClassName:a,modeClassName:l}=i.o.link,c=n(i),d=(0,g.isString)(c)?i.c.fromHTML(c,{target_checkbox_box:s,nofollow_checkbox_box:r}):c,h=D.i.isElement(d)?d:d.container,u=(0,g.refs)(h),{insert:p,unlink:m,content_input_box:f}=u,{target_checkbox:v,nofollow_checkbox:b,url_input:y}=u,w=D.i.isImage(e);let{content_input:k}=u;const{className_input:C}=u,{className_select:S}=u;let E;k||(k=i.c.element("input",{type:"hidden",ref:"content_input"})),a&&h.classList.add(a),w&&D.i.hide(f);const I=()=>E?E.innerText:(0,g.stripTags)(i.s.range.cloneContents(),i.ed);if(E=!(!e||!D.i.closest(e,"a",i.editor))&&D.i.closest(e,"a",i.editor),!w&&e&&(k.value=I()),E){if(y.value=(0,g.attr)(E,"href")||"",l)switch(l){case"input":C&&(C.value=(0,g.attr)(E,"class")||"");break;case"select":if(S){for(let e=0;S.selectedOptions.length>e;e++){const t=S.options.item(e);t&&(t.selected=!1)}((0,g.attr)(E,"class")||"").split(" ").forEach((e=>{if(e)for(let t=0;S.options.length>t;t++){const i=S.options.item(t);(null==i?void 0:i.value)&&i.value===e&&(i.selected=!0)}}))}}s&&v&&(v.checked="_blank"===(0,g.attr)(E,"target")),r&&b&&(b.checked="nofollow"===(0,g.attr)(E,"rel")),p.textContent=o("Update")}else D.i.hide(m);i.editor.normalize();const x=i.history.snapshot.make();m&&i.e.on(m,"click",(e=>{i.s.restore(),i.history.snapshot.restore(x),E&&D.i.unwrap(E),i.synchronizeValues(),t(),e.preventDefault()}));const z=()=>{if(!y.value.trim().length)return y.focus(),y.classList.add("jodit_error"),!1;let e;i.s.restore(),i.s.removeMarkers(),i.editor.normalize(),i.history.snapshot.restore(x);const o=I()!==k.value.trim(),n=i.createInside;if(E)e=[E];else{if(i.s.isCollapsed()){const t=n.element("a");i.s.insertNode(t,!1,!1),e=[t]}else{const t=i.s.current();e=D.i.isTag(t,["img"])?[D.i.wrap(t,"a",n)]:i.s.wrapInTag("a")}e.forEach((e=>i.s.select(e)))}return e.forEach((e=>{var t;if((0,g.attr)(e,"href",y.value),l&&(null!=C?C:S))if("input"===l)""===C.value&&e.hasAttribute("class")&&(0,g.attr)(e,"class",null),""!==C.value&&(0,g.attr)(e,"class",C.value);else if("select"===l){e.hasAttribute("class")&&(0,g.attr)(e,"class",null);for(let i=0;S.selectedOptions.length>i;i++){const o=null===(t=S.selectedOptions.item(i))||void 0===t?void 0:t.value;o&&e.classList.add(o)}}if(!w){let t=e.textContent;k.value.trim().length?o&&(t=k.value):t=y.value,t!==e.textContent&&(e.textContent=t)}s&&v&&(0,g.attr)(e,"target",v.checked?"_blank":null),r&&b&&(0,g.attr)(e,"rel",b.checked?"nofollow":null)})),i.synchronizeValues(),t(),!1};return D.i.isElement(d)?i.e.on(d,"submit",(e=>(e.preventDefault(),e.stopImmediatePropagation(),z(),!1))):d.onSubmit(z),d}beforeDestruct(e){e.e.off("generateLinkForm.link",this.generateForm).off("dblclick.link",this.onDblClickOnLink).off("processPaste.link",this.onProcessPasteLink)}}function di(e){const t="jodit_fake_wrapper",{mediaFakeTag:i,mediaBlocks:o,mediaInFakeBlock:s}=e.options;s&&e.e.on("afterGetValueFromEditor",(e=>{const o=RegExp(`<${i}[^>]+data-${t}[^>]+>([^]+?)`,"ig");o.test(e.value)&&(e.value=e.value.replace(o,"$1"))})).on("change afterInit afterSetMode changePlace",e.async.debounce((()=>{e.isDestructed||e.getMode()===a.MODE_SOURCE||(0,g.$$)(o.join(","),e.editor).forEach((o=>{(0,g.dataBind)(o,t)||((0,g.dataBind)(o,t,!0),(o=>{if(o.parentNode&&(0,g.attr)(o.parentNode,"data-jodit_iframe_wrapper"))o=o.parentNode;else{const s=e.createInside.fromHTML(`<${i} data-jodit-temp="1" contenteditable="false" draggable="true" data-${t}="1">`);(0,g.attr)(s,"style",(0,g.attr)(o,"style")),s.style.display="inline-block"===o.style.display?"inline-block":"block",s.style.width=o.offsetWidth+"px",s.style.height=o.offsetHeight+"px",o.parentNode&&o.parentNode.insertBefore(s,o),s.appendChild(o),o=s}e.e.off(o,"mousedown.select touchstart.select").on(o,"mousedown.select touchstart.select",(()=>{e.s.setCursorAfter(o)}))})(o))}))}),e.defaultTimeout))}function hi(e){e.registerButton({name:"video",group:"media"})}function ui(e){e.registerButton({name:"file",group:"media"})}function pi(e){let t=0,i=(0,g.splitArray)(e.o.buttons);e.o.mobileTapTimeout&&e.e.on("touchend",(i=>{if(i.changedTouches&&i.changedTouches.length){const o=(new Date).getTime(),s=o-t;s>e.o.mobileTapTimeout&&(t=o,1.5*e.o.mobileTapTimeout>s&&e.s.insertCursorAtPoint(i.clientX,i.clientY))}})),e.e.on("getDiffButtons.mobile",(t=>{if(t===e.toolbar){const t=(0,F.q)((0,g.splitArray)(e.o.buttons),e),o=(0,F.q)(i,e);return(0,g.toArray)(t).reduce(((e,t)=>(o.has(t)||e.push(t),e)),[])}})),e.o.toolbarAdaptive&&e.e.on("resize afterInit recalcAdaptive changePlace afterAddPlace",(()=>{var t;if(!e.o.toolbar)return;const o=(null!==(t=e.container.parentElement)&&void 0!==t?t:e.container).offsetWidth,s=(0,g.splitArray)(e.o.sizeLG>o?e.o.sizeMD>o?e.o.sizeSM>o?e.o.buttonsXS:e.o.buttonsSM:e.o.buttonsMD:e.o.buttons);""+s!=""+i&&(i=s,e.e.fire("closeAllPopups"),e.toolbar.setRemoveButtons(e.o.removeButtons).build(i.concat(e.o.extraButtons)))})).on(e.ow,"load resize",(()=>e.e.fire("recalcAdaptive")))}(0,r.gn)([L.autobind],ci.prototype,"onDblClickOnLink",null),(0,r.gn)([L.autobind],ci.prototype,"onProcessPasteLink",null),(0,r.gn)([L.autobind],ci.prototype,"generateForm",null),n.D.prototype.mediaFakeTag="jodit-media",n.D.prototype.mediaInFakeBlock=!0,n.D.prototype.mediaBlocks=["video","audio"],n.D.prototype.controls.video={popup(e,t,i,o){const s=new li.x4(e,[new li.eC(e,[new li.u3(e,{name:"url",required:!0,label:"URL",placeholder:"https://",validators:["url"]})]),new li.eC(e,[(0,k.zx)(e,"","Insert","primary").onAction((()=>s.submit()))])]),r=new li.x4(e,[new li.eC(e,[new li.GJ(e,{name:"code",required:!0,label:"Embed code"})]),new li.eC(e,[(0,k.zx)(e,"","Insert","primary").onAction((()=>r.submit()))])]),n=[],a=t=>{e.s.restore(),e.s.insertHTML(t),o()};return e.s.save(),n.push({icon:"link",name:"Link",content:s.container},{icon:"source",name:"Code",content:r.container}),s.onSubmit((e=>{a((0,g.convertMediaUrlToVideoEmbed)(e.url))})),r.onSubmit((e=>{a(e.code)})),(0,At.IL)(e,n)},tags:["iframe"],tooltip:"Insert youtube/vimeo video"},n.D.prototype.controls.file={popup(e,t,i,o){const s=(t,i="")=>{e.s.insertNode(e.createInside.fromHTML(`${i||t}`))};let r=null;return t&&(D.i.isTag(t,"a")||D.i.closest(t,"a",e.editor))&&(r=D.i.isTag(t,"a")?t:D.i.closest(t,"a",e.editor)),(0,At.ov)(e,{filebrowser(e){e.files&&e.files.forEach((t=>s(e.baseurl+t))),o()},upload:!0,url(e,t){r?(r.setAttribute("href",e),r.setAttribute("title",t)):s(e,t),o()}},r,o,!1)},tags:["a"],tooltip:"Insert file"},n.D.prototype.mobileTapTimeout=300,n.D.prototype.toolbarAdaptive=!0,n.D.prototype.controls.dots={mode:a.MODE_SOURCE+a.MODE_WYSIWYG,popup(e,t,i,o,s){let r=i.data;return void 0===r&&(r={toolbar:H(e),rebuild(){var t;if(s){const i=e.e.fire("getDiffButtons.mobile",s.closest(P.bz));if(i&&r){r.toolbar.build((0,g.splitArray)(i));const o=(null===(t=e.toolbar.firstButton)||void 0===t?void 0:t.container.offsetWidth)||36;r.toolbar.container.style.width=3*(o+4)+"px"}}}},i.data=r),r.rebuild(),r.toolbar},tooltip:"Show all"};var mi=i(12);const fi=(e,t,{control:i})=>{var o;const s="button"+i.command,r=null!==(o=i.args&&i.args[0])&&void 0!==o?o:(0,mi.q)(e,s);(0,mi.q)(e,s,r),e.execCommand(i.command,!1,"default"===r?null:r)};n.D.prototype.controls.ul={command:"insertUnorderedList",tags:["ul"],tooltip:"Insert Unordered List",list:{default:"Default",circle:"Circle",disc:"Dot",square:"Quadrate"},exec:fi},n.D.prototype.controls.ol={command:"insertOrderedList",tags:["ol"],tooltip:"Insert Ordered List",list:{default:"Default","lower-alpha":"Lower Alpha","lower-greek":"Lower Greek","lower-roman":"Lower Roman","upper-alpha":"Upper Alpha","upper-roman":"Upper Roman"},exec:fi};class gi extends G{constructor(){super(...arguments),this.buttons=[{name:"ul",group:"list"},{name:"ol",group:"list"}]}afterInit(e){e.registerCommand("insertUnorderedList",this.onCommand).registerCommand("insertOrderedList",this.onCommand)}onCommand(e,t,i){return this.jodit.s.applyStyle({listStyleType:null!=i?i:null},{element:"insertunorderedlist"===e?"ul":"ol"}),this.jodit.synchronizeValues(),!1}beforeDestruct(e){}}function vi(e){e.o.hidePoweredByJodit||e.o.inline||!(e.o.showCharsCounter||e.o.showWordsCounter||e.o.showXPathInStatusbar)||e.hookStatus("ready",(()=>{e.statusbar.append(e.create.fromHTML('\n\t\t\t\t\t\t\tPowered by Jodit\n\t\t\t\t\t\t'),!0)}))}(0,r.gn)([L.autobind],gi.prototype,"onCommand",null),n.D.prototype.showPlaceholder=!0,n.D.prototype.placeholder="Type something",n.D.prototype.useInputsPlaceholder=!0;class bi extends G{constructor(){super(...arguments),this.addNativeListeners=()=>{this.j.e.off(this.j.editor,"input.placeholder keydown.placeholder").on(this.j.editor,"input.placeholder keydown.placeholder",this.toggle)},this.addEvents=()=>{const e=this.j;e.o.useInputsPlaceholder&&e.element.hasAttribute("placeholder")&&(this.placeholderElm.innerHTML=(0,g.attr)(e.element,"placeholder")||""),e.e.fire("placeholder",this.placeholderElm.innerHTML),e.e.off(".placeholder").on("changePlace.placeholder",this.addNativeListeners).on("change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder mousedown.placeholder afterSetMode.placeholder changePlace.placeholder",this.toggle).on(window,"load",this.toggle),this.addNativeListeners(),this.toggle()}}afterInit(e){e.o.showPlaceholder&&(this.placeholderElm=e.c.fromHTML(``),"rtl"===e.o.direction&&(this.placeholderElm.style.right="0px",this.placeholderElm.style.direction="rtl"),e.e.on("readonly",(e=>{e?this.hide():this.toggle()})).on("changePlace",this.addEvents),this.addEvents())}show(){const e=this.j;if(e.o.readonly)return;let t=0,i=0;const o=e.s.current(),s=o&&D.i.closest(o,D.i.isBlock,e.editor)||e.editor,r=e.ew.getComputedStyle(s);e.workplace.appendChild(this.placeholderElm);const{firstChild:n}=e.editor;if(D.i.isElement(n)&&!Me.Ph.isMarker(n)){const o=e.ew.getComputedStyle(n);t=parseInt(o.getPropertyValue("margin-top"),10),i=parseInt(o.getPropertyValue("margin-left"),10),this.placeholderElm.style.fontSize=parseInt(o.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=o.getPropertyValue("line-height")}else this.placeholderElm.style.fontSize=parseInt(r.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=r.getPropertyValue("line-height");(0,g.css)(this.placeholderElm,{display:"block",textAlign:r.getPropertyValue("text-align"),marginTop:Math.max(parseInt(r.getPropertyValue("margin-top"),10),t),marginLeft:Math.max(parseInt(r.getPropertyValue("margin-left"),10),i)})}hide(){D.i.safeRemove(this.placeholderElm)}toggle(){const e=this.j;e.editor&&!e.isInDestruct&&(e.getRealMode()===a.MODE_WYSIWYG&&(e=>{if(!e.firstChild)return!0;const t=e.firstChild;if(a.MAY_BE_REMOVED_WITH_KEY.test(t.nodeName)||/^(TABLE)$/i.test(t.nodeName))return!1;const i=D.i.next(t,(e=>e&&!D.i.isEmptyTextNode(e)),e);return D.i.isText(t)&&!i?D.i.isEmptyTextNode(t):!i&&D.i.each(t,(e=>!D.i.isTag(e,["ul","li","ol"])&&(D.i.isEmpty(e)||D.i.isTag(e,"br"))))})(e.editor)?this.show():this.hide())}beforeDestruct(e){this.hide(),e.e.off(".placeholder").off(window,"load",this.toggle)}}(0,r.gn)([(0,L.debounce)((e=>e.defaultTimeout/10),!0)],bi.prototype,"toggle",null),n.D.prototype.controls.redo={mode:a.MODE_SPLIT,isDisabled:e=>!e.history.canRedo(),tooltip:"Redo"},n.D.prototype.controls.undo={mode:a.MODE_SPLIT,isDisabled:e=>!e.history.canUndo(),tooltip:"Undo"};class yi extends G{constructor(){super(...arguments),this.buttons=[{name:"undo",group:"history"},{name:"redo",group:"history"}]}beforeDestruct(){}afterInit(e){const t=t=>(e.history[t](),!1);e.registerCommand("redo",{exec:t,hotkeys:["ctrl+y","ctrl+shift+z","cmd+y","cmd+shift+z"]}),e.registerCommand("undo",{exec:t,hotkeys:["ctrl+z","cmd+z"]})}}n.D.prototype.allowResizeTags=["img","iframe","table","jodit"],n.D.prototype.resizer={showSize:!0,hideSizeTimeout:1e3,forImageChangeAttributes:!0,min_width:10,min_height:10};const wi="__jodit-resizer_binded";class ki extends G{constructor(){super(...arguments),this.LOCK_KEY="resizer",this.element=null,this.isResized=!1,this.isShown=!1,this.start_x=0,this.start_y=0,this.width=0,this.height=0,this.ratio=0,this.rect=this.j.c.fromHTML('
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t100x100\n\t\t\t
'),this.sizeViewer=this.rect.getElementsByTagName("span")[0],this.onResize=e=>{if(this.isResized){if(!this.element)return;let t,i;if(this.j.options.iframe){const o=this.getWorkplacePosition();t=e.clientX+o.left-this.start_x,i=e.clientY+o.top-this.start_y}else t=e.clientX-this.start_x,i=e.clientY-this.start_y;const o=this.handle.className;let s=0,r=0;D.i.isTag(this.element,"img")?(t?(s=this.width+(o.match(/left/)?-1:1)*t,r=Math.round(s/this.ratio)):(r=this.height+(o.match(/top/)?-1:1)*i,s=Math.round(r*this.ratio)),s>(0,g.innerWidth)(this.j.editor,this.j.ow)&&(s=(0,g.innerWidth)(this.j.editor,this.j.ow),r=Math.round(s/this.ratio))):(s=this.width+(o.match(/left/)?-1:1)*t,r=this.height+(o.match(/top/)?-1:1)*i),s>this.j.o.resizer.min_width&&this.applySize(this.element,"width",this.rect.parentNode.offsetWidth>s?s:"100%"),r>this.j.o.resizer.min_height&&this.applySize(this.element,"height",r),this.updateSize(),this.showSizeViewer(this.element.offsetWidth,this.element.offsetHeight),e.stopImmediatePropagation()}},this.onClickOutside=e=>{this.isShown&&(this.isResized?(this.j.unlock(),this.isResized=!1,this.j.synchronizeValues(),e.stopImmediatePropagation(),this.j.e.off(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)):this.hide())},this.onClickElement=e=>{this.isResized||this.element===e&&this.isShown||(this.element=e,this.show(),D.i.isTag(this.element,"img")&&!this.element.complete&&this.j.e.on(this.element,"load",this.updateSize))},this.updateSize=()=>{if(!this.isInDestruct&&this.isShown&&this.element&&this.rect){const e=this.getWorkplacePosition(),t=(0,g.offset)(this.element,this.j,this.j.ed),i=parseInt(this.rect.style.left||"0",10),o=this.rect.offsetWidth,s=this.rect.offsetHeight,r=t.top-e.top,n=t.left-e.left;parseInt(this.rect.style.top||"0",10)===r&&i===n&&o===this.element.offsetWidth&&s===this.element.offsetHeight||((0,g.css)(this.rect,{top:r,left:n,width:this.element.offsetWidth,height:this.element.offsetHeight}),this.j.events&&(this.j.e.fire(this.element,"changesize"),isNaN(i)||this.j.e.fire("resize")))}},this.hideSizeViewer=()=>{this.sizeViewer.style.opacity="0"}}afterInit(e){(0,g.$$)("div",this.rect).forEach((t=>{e.e.on(t,"mousedown.resizer touchstart.resizer",this.onClickHandle.bind(this,t))})),j.TB.on("hideHelpers",this.hide),e.e.on("readonly",(e=>{e&&this.hide()})).on("afterInit changePlace",this.addEventListeners.bind(this)).on("afterGetValueFromEditor.resizer",(e=>{const t=/]+data-jodit_iframe_wrapper[^>]+>(.*?]*>.*?<\/iframe>.*?)<\/jodit>/gi;t.test(e.value)&&(e.value=e.value.replace(t,"$1"))})).on("hideResizer",this.hide).on("change afterInit afterSetMode",this.onChangeEditor),this.addEventListeners(),this.onChangeEditor()}onEditorClick(e){let t=e.target;const{editor:i,options:{allowResizeTags:o}}=this.j;for(;t&&t!==i;){if(D.i.isTag(t,o))return this.bind(t),void this.onClickElement(t);t=t.parentNode}}addEventListeners(){const e=this.j;e.e.off(e.editor,".resizer").off(e.ow,".resizer").on(e.editor,"keydown.resizer",(e=>{this.isShown&&e.key===a.KEY_DELETE&&this.element&&!D.i.isTag(this.element,"table")&&this.onDelete(e)})).on(e.ow,"resize.resizer",this.updateSize).on("resize.resizer",this.updateSize).on(e.ow,"mouseup.resizer keydown.resizer touchend.resizer",this.onClickOutside).on([e.ow,e.editor],"scroll.resizer",(()=>{this.isShown&&!this.isResized&&this.hide()}))}onClickHandle(e,t){if(!this.element||!this.element.parentNode)return this.hide(),!1;this.handle=e,t.cancelable&&t.preventDefault(),t.stopImmediatePropagation(),this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.ratio=this.width/this.height,this.isResized=!0,this.start_x=t.clientX,this.start_y=t.clientY,this.j.e.fire("hidePopup"),this.j.lock(this.LOCK_KEY),this.j.e.on(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)}getWorkplacePosition(){return(0,g.offset)(this.rect.parentNode||this.j.od.documentElement,this.j,this.j.od,!0)}applySize(e,t,i){const o=D.i.isImage(e)&&this.j.o.resizer.forImageChangeAttributes;o&&(0,g.attr)(e,t,i),o&&!e.style[t]||(0,g.css)(e,t,i)}onDelete(e){this.element&&("JODIT"!==this.element.tagName?this.j.s.select(this.element):(D.i.safeRemove(this.element),this.hide(),e.preventDefault()))}onChangeEditor(){this.isShown&&(this.element&&this.element.parentNode?this.updateSize():this.hide()),(0,g.$$)("iframe",this.j.editor).forEach(this.bind)}bind(e){if(!D.i.isHTMLElement(e)||(0,g.dataBind)(e,wi))return;let t;if((0,g.dataBind)(e,wi,!0),D.i.isTag(e,"iframe")){const i=e;D.i.isHTMLElement(e.parentNode)&&(0,g.attr)(e.parentNode,"-jodit_iframe_wrapper")?e=e.parentNode:(t=this.j.createInside.fromHTML(''),(0,g.attr)(t,"style",(0,g.attr)(e,"style")),(0,g.css)(t,{display:"inline-block"===e.style.display?"inline-block":"block",width:e.offsetWidth,height:e.offsetHeight}),e.parentNode&&e.parentNode.insertBefore(t,e),t.appendChild(e),e=t),this.j.e.off(e,"mousedown.select touchstart.select").on(e,"mousedown.select touchstart.select",(()=>{this.j.s.select(e)})).off(e,"changesize").on(e,"changesize",(()=>{i.setAttribute("width",e.offsetWidth+"px"),i.setAttribute("height",e.offsetHeight+"px")}))}this.j.e.on(e,"dragstart",this.hide)}showSizeViewer(e,t){this.j.o.resizer.showSize&&(this.sizeViewer.offsetWidth>e||this.sizeViewer.offsetHeight>t?this.hideSizeViewer():(this.sizeViewer.style.opacity="1",this.sizeViewer.textContent=`${e} x ${t}`,this.j.async.setTimeout(this.hideSizeViewer,{timeout:this.j.o.resizer.hideSizeTimeout,label:"hideSizeViewer"})))}show(){this.j.o.readonly||this.isShown||(this.isShown=!0,this.rect.parentNode||((0,g.markOwner)(this.j,this.rect),this.j.workplace.appendChild(this.rect)),this.j.isFullSize&&(this.rect.style.zIndex=""+(0,g.css)(this.j.container,"zIndex")),this.updateSize())}hide(){this.isResized||(this.isResized=!1,this.isShown=!1,this.element=null,D.i.safeRemove(this.rect))}beforeDestruct(e){this.hide(),j.TB.off("hideHelpers",this.hide),e.e.off(this.j.ow,".resizer").off(".resizer")}}(0,r.gn)([(0,L.watch)(":click")],ki.prototype,"onEditorClick",null),(0,r.gn)([(0,L.debounce)()],ki.prototype,"onChangeEditor",null),(0,r.gn)([L.autobind],ki.prototype,"bind",null),(0,r.gn)([L.autobind],ki.prototype,"hide",null);var Ci=i(36);class Si{constructor(e=Ci.Q){this.searchIndex=e,this.queue=[],this.value=""}add(e){var t;const i=(null!==(t=e.nodeValue)&&void 0!==t?t:"").toLowerCase();if(!i.length)return;const o=this.value.length;this.queue.push({startIndex:o,endIndex:o+i.length,node:e}),this.value+=i}ranges(e,t=0){const i=[];let o=t,s=0,r=0;do{if([o,s]=this.searchIndex(e,this.value,o),-1!==o){let e,t,n=0,a=0;for(let i=r;this.queue.length>i;i+=1)if(!e&&this.queue[i].endIndex>o&&(e=this.queue[i].node,n=o-this.queue[i].startIndex),e&&this.queue[i].endIndex>=o+s){t=this.queue[i].node,a=o+s-this.queue[i].startIndex,r=i;break}e&&t&&i.push({startContainer:e,startOffset:n,endContainer:t,endOffset:a}),o+=s}}while(-1!==o);return 0===i.length?null:i}}var Ei=i(42);const Ii="jd-tmp-selection";function xi(e,t,i,o){if(null==e.startContainer.nodeValue||null==e.endContainer.nodeValue)return;const s=i.element("span",{[Ii]:!0}),r=e.startContainer.nodeValue;let n=0;if(0!==e.startOffset){const t=i.text(r.substring(0,e.startOffset));e.startContainer.nodeValue=r.substring(e.startOffset),D.i.before(e.startContainer,t),e.startContainer===e.endContainer&&(n=e.startOffset,e.endOffset-=n),e.startOffset=0}const a=e.endContainer.nodeValue;if(e.endOffset!==a.length){const o=i.text(a.substring(e.endOffset));e.endContainer.nodeValue=a.substring(0,e.endOffset),D.i.after(e.endContainer,o);for(const i of t){if(i.startContainer!==e.endContainer)break;i.startContainer=o,i.startOffset=i.startOffset-e.endOffset-n,i.endContainer===e.endContainer&&(i.endContainer=o,i.endOffset=i.endOffset-e.endOffset-n)}e.endOffset=e.endContainer.nodeValue.length}let l=e.startContainer;do{if(!l)break;if(!D.i.isText(l)||D.i.isElement(c=l.parentNode)&&c.hasAttribute(Ii)||D.i.wrap(l,s.cloneNode(),i),l===e.endContainer)break;let t=l.firstChild||l.nextSibling;if(!t){for(;l&&!l.nextSibling&&l!==o;)l=l.parentNode;t=null==l?void 0:l.nextSibling}l=t}while(l&&l!==o);var c}function zi(e){return(0,Ei.$$)(`[${Ii}]`,e)}function Ti(e){zi(e).forEach((e=>D.i.unwrap(e)))}let ji=class extends P.u1{constructor(e){super(e),this.selInfo=null,this._currentIndex=0,this.isOpened=!1;const{query:t,replace:i,cancel:o,next:s,prev:r,replaceBtn:n,current:l,count:c}=(0,g.refs)(this.container);this.queryInput=t,this.replaceInput=i,this.closeButton=o,this.replaceButton=n,this.currentBox=l,this.countBox=c,e.e.on(this.closeButton,"pointerdown",(()=>(this.close(),!1))).on(this.queryInput,"input",(()=>{this.currentIndex=0})).on(this.queryInput,"pointerdown",(()=>{e.s.isFocused()&&(e.s.removeMarkers(),this.selInfo=e.s.save())})).on(this.replaceButton,"pointerdown",(()=>(e.e.fire(this,"pressReplaceButton"),!1))).on(s,"pointerdown",(()=>(e.e.fire("searchNext"),!1))).on(r,"pointerdown",(()=>(e.e.fire("searchPrevious"),!1))).on(this.queryInput,"input",(()=>{this.setMod("empty-query",!(0,g.trim)(this.queryInput.value).length)})).on(this.queryInput,"keydown",this.j.async.debounce((t=>{t.key===a.KEY_ENTER?(t.preventDefault(),t.stopImmediatePropagation(),e.e.fire("searchNext")&&this.close()):e.e.fire(this,"needUpdateCounters")}),this.j.defaultTimeout))}className(){return"UISearch"}render(){return`
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t0/0\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
`}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e,this.currentBox.innerText=""+e}set count(e){this.countBox.innerText=""+e}get query(){return this.queryInput.value}get replace(){return this.replaceInput.value}onEditorKeyDown(e){if(!this.isOpened)return;const{j:t}=this;if(t.getRealMode()===a.MODE_WYSIWYG)switch(e.key){case a.KEY_ESC:this.close();break;case a.KEY_F3:this.queryInput.value&&(t.e.fire(e.shiftKey?"searchPrevious":"searchNext"),e.preventDefault())}}open(e=!1){this.isOpened||(this.j.workplace.appendChild(this.container),this.isOpened=!0),this.calcSticky(this.j.e.fire("getStickyState.sticky")||!1),this.j.e.fire("hidePopup"),this.setMod("replace",e);const t=""+(this.j.s.sel||"");t&&(this.queryInput.value=t),this.setMod("empty-query",!t.length),this.j.e.fire(this,"needUpdateCounters"),t?this.queryInput.select():this.queryInput.focus()}close(){this.isOpened&&(this.j.s.restore(),D.i.safeRemove(this.container),this.isOpened=!1,this.j.e.fire(this,"afterClose"))}calcSticky(e){if(this.isOpened)if(this.setMod("sticky",e),e){const e=(0,g.position)(this.j.toolbarContainer);(0,g.css)(this.container,{top:e.top+e.height,left:e.left+e.width})}else(0,g.css)(this.container,{top:null,left:null})}};(0,r.gn)([(0,L.watch)([":keydown","queryInput:keydown"])],ji.prototype,"onEditorKeyDown",null),(0,r.gn)([L.autobind],ji.prototype,"open",null),(0,r.gn)([L.autobind],ji.prototype,"close",null),(0,r.gn)([(0,L.watch)(":toggleSticky")],ji.prototype,"calcSticky",null),ji=(0,r.gn)([L.component],ji),n.D.prototype.useSearch=!0,n.D.prototype.search={lazyIdleTimeout:0},n.D.prototype.controls.find={tooltip:"Find",icon:"search",exec(e,t,{control:i}){switch(i.args&&i.args[0]){case"findPrevious":e.e.fire("searchPrevious");break;case"findNext":e.e.fire("searchNext");break;case"replace":e.execCommand("openReplaceDialog");break;default:e.execCommand("openSearchDialog")}},list:{search:"Find",findNext:"Find Next",findPrevious:"Find Previous",replace:"Replace"},childTemplate:(e,t,i)=>i};class Li extends G{constructor(){super(...arguments),this.buttons=[{name:"find",group:"search"}],this.previousQuery="",this.drawPromise=null,this.walker=null,this.walkerCount=null,this.cache={},this.wrapFrameRequest=0}get ui(){return new ji(this.j)}async updateCounters(){this.ui.isOpened&&(this.ui.count=await this.calcCounts(this.ui.query))}onPressReplaceButton(){this.findAndReplace(this.ui.query),this.updateCounters()}tryScrollToElement(e){let t=D.i.closest(e,D.i.isElement,this.j.editor);t||(t=D.i.prev(e,D.i.isElement,this.j.editor)),t&&t!==this.j.editor&&(0,g.scrollIntoViewIfNeeded)(t,this.j.editor,this.j.ed)}async calcCounts(e){return this.walkerCount&&this.walkerCount.break(),this.walkerCount=new D.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout}),(await this.find(this.walkerCount,e)).length}async findAndReplace(e){this.walker&&this.walker.break(),this.walker=new D.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout});const t=this.j.s.range,i=await this.find(this.walker,e);let o=this.findCurrentIndexInRanges(i,t);-1===o&&(o=0);const s=i[o];if(s){try{const e=this.j.ed.createRange();e.setStart(s.startContainer,s.startOffset),e.setEnd(s.endContainer,s.endOffset),e.deleteContents();const t=this.j.createInside.text(this.ui.replace);e.insertNode(t),this.j.s.select(t),this.tryScrollToElement(t),this.cache={},this.j.synchronizeValues()}catch(e){}return this.j.e.fire("afterFindAndReplace"),!0}return!1}async findAndSelect(e,t){var i;this.walker&&this.walker.break(),this.walker=new D.b(this.j.async,{timeout:this.j.defaultTimeout});const o=await this.find(this.walker,e);if(!o.length)return!1;this.previousQuery===e&&zi(this.j.editor).length||(null===(i=this.drawPromise)||void 0===i||i.rejectCallback(),this.j.async.cancelAnimationFrame(this.wrapFrameRequest),Ti(this.j.editor),this.drawPromise=this.drawSelectionRanges(o)),this.previousQuery=e;let s=this.ui.currentIndex-1;s=-1===s?0:t?s===o.length-1?0:s+1:0===s?o.length-1:s-1,this.ui.currentIndex=s+1;const r=o[s];if(r){const e=this.j.ed.createRange();try{e.setStart(r.startContainer,r.startOffset),e.setEnd(r.endContainer,r.endOffset),this.j.s.selectRange(e)}catch(e){}return this.tryScrollToElement(r.startContainer),await this.updateCounters(),await this.drawPromise,this.j.e.fire("afterFindAndSelect"),!0}return!1}findCurrentIndexInRanges(e,t){return e.findIndex((e=>e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.startContainer&&e.endOffset===t.endOffset))}async isValidCache(e){return(await e).every((e=>{var t,i,o,s;return e.startContainer.isConnected&&e.startOffset<=(null!==(i=null===(t=e.startContainer.nodeValue)||void 0===t?void 0:t.length)&&void 0!==i?i:0)&&e.endContainer.isConnected&&e.endOffset<=(null!==(s=null===(o=e.endContainer.nodeValue)||void 0===o?void 0:o.length)&&void 0!==s?s:0)}))}async find(e,t){if(!t.length)return[];const i=this.cache[t];if(i&&await this.isValidCache(i))return i;const o=new Si(this.j.o.search.fuzzySearch);return this.cache[t]=this.j.async.promise((i=>{e.on("break",(()=>{i([])})).on("visit",(e=>(D.i.isText(e)&&o.add(e),!1))).on("end",(()=>{var e;i(null!==(e=o.ranges(t))&&void 0!==e?e:[])})).setWork(this.j.editor)})),this.cache[t]}drawSelectionRanges(e){const{async:t,createInside:i,editor:o}=this.j;t.cancelAnimationFrame(this.wrapFrameRequest);const s=[...e];let r,n=0;return t.promise((e=>{const a=()=>{do{r=s.shift(),r&&xi(r,s,i,o),n+=1}while(r&&5>=n);s.length?this.wrapFrameRequest=t.requestAnimationFrame(a):e()};a()}))}onAfterGetValueFromEditor(e){e.value=e.value.replace(RegExp(`]+${Ii}[^>]+>(.*?)`,"g"),"$1")}afterInit(e){if(e.o.useSearch){const t=this;e.e.on("beforeSetMode.search",(()=>{this.ui.close()})).on(this.ui,"afterClose",(()=>{Ti(e.editor),this.ui.currentIndex=0,this.ui.count=0,this.cache={}})).on("click",(()=>{this.ui.currentIndex=0,Ti(e.editor)})).on("change.search",(()=>{this.cache={}})).on("keydown.search mousedown.search",e.async.debounce((()=>{this.ui.selInfo&&(e.s.removeMarkers(),this.ui.selInfo=null),this.ui.isOpened&&this.updateCounters()}),e.defaultTimeout)).on("searchNext.search searchPrevious.search",(()=>(this.ui.isOpened||this.ui.open(),t.findAndSelect(t.ui.query,"searchNext"===e.e.current).catch((()=>{}))))).on("search.search",((e,i=!0)=>(this.ui.currentIndex=0,t.findAndSelect(e||"",i).catch((()=>{}))))),e.registerCommand("search",{exec:(e,i,o=!0)=>(i&&t.findAndSelect(i,o).catch((()=>{})),!1)}).registerCommand("openSearchDialog",{exec:()=>(t.ui.open(),!1),hotkeys:["ctrl+f","cmd+f"]}).registerCommand("openReplaceDialog",{exec:()=>(e.o.readonly||t.ui.open(!0),!1),hotkeys:["ctrl+h","cmd+h"]})}}beforeDestruct(e){this.ui.destruct(),e.e.off(".search")}}(0,r.gn)([L.cache],Li.prototype,"ui",null),(0,r.gn)([(0,L.watch)("ui:needUpdateCounters")],Li.prototype,"updateCounters",null),(0,r.gn)([(0,L.watch)("ui:pressReplaceButton")],Li.prototype,"onPressReplaceButton",null),(0,r.gn)([L.autobind],Li.prototype,"findAndReplace",null),(0,r.gn)([L.autobind],Li.prototype,"findAndSelect",null),(0,r.gn)([L.autobind],Li.prototype,"find",null),(0,r.gn)([(0,L.watch)(":afterGetValueFromEditor")],Li.prototype,"onAfterGetValueFromEditor",null);var Ai=i(35);n.D.prototype.select={normalizeSelectionBeforeCutAndCopy:!0};class Mi extends G{constructor(){super(...arguments),this.proxyEventsList=["click","mousedown","touchstart","mouseup","touchend"]}afterInit(e){this.proxyEventsList.forEach((t=>{e.e.on(t+".select",this.onStartSelection)}))}beforeDestruct(e){this.proxyEventsList.forEach((t=>{e.e.on(t+".select",this.onStartSelection)}))}onStartSelection(e){const{j:t}=this;let i,o=e.target;for(;void 0===i&&o&&o!==t.editor;)i=t.e.fire((0,Ai.e)(e.type+"_"+o.nodeName.toLowerCase()),o,e),o=o.parentElement;"click"===e.type&&void 0===i&&o===t.editor&&t.e.fire(e.type+"Editor",o,e)}onOutsideClick(e){const t=e.target;D.i.up(t,(e=>e===this.j.editor))||P.u1.closestElement(t,P.GI)||this.j.e.fire("outsideClick",e)}beforeCommandCut(e){const{s:t}=this.j;if("cut"===e&&!t.isCollapsed()){const e=t.current();e&&D.i.isOrContains(this.j.editor,e)&&this.onCopyNormalizeSelectionBound()}}onCopyNormalizeSelectionBound(e){const{s:t,editor:i,o}=this.j;o.select.normalizeSelectionBeforeCutAndCopy&&!t.isCollapsed()&&(!e||e.isTrusted&&D.i.isNode(e.target)&&D.i.isOrContains(i,e.target))&&this.jodit.s.expandSelection()}}(0,r.gn)([L.autobind],Mi.prototype,"onStartSelection",null),(0,r.gn)([(0,L.watch)("ow:click")],Mi.prototype,"onOutsideClick",null),(0,r.gn)([(0,L.watch)([":beforeCommand"])],Mi.prototype,"beforeCommandCut",null),(0,r.gn)([(0,L.watch)([":copy",":cut"])],Mi.prototype,"onCopyNormalizeSelectionBound",null),n.D.prototype.width="auto",n.D.prototype.minWidth=200,n.D.prototype.maxWidth="100%",n.D.prototype.allowResizeX=!1,n.D.prototype.allowResizeY=!0,n.D.prototype.height="auto",n.D.prototype.minHeight=200,n.D.prototype.maxHeight="auto",n.D.prototype.saveHeightInStorage=!1;let Di=class extends G{constructor(){super(...arguments),this.isResized=!1,this.start={x:0,y:0,w:0,h:0},this.handle=this.j.c.div("jodit-editor__resize",P.JO.get("resize_handler"))}afterInit(e){const{height:t,width:i,allowResizeX:o}=e.o;let{allowResizeY:s}=e.o;"auto"===t&&"auto"!==i&&(s=!1),"auto"===t&&"auto"===i||!o&&!s||(e.statusbar.setMod("resize-handle",!0),e.e.on("toggleFullSize.resizeHandler",(()=>{this.handle.style.display=e.isFullSize?"none":"block"})).on(this.handle,"mousedown touchstart",this.onHandleResizeStart).on(e.ow,"mouseup touchend",this.onHandleResizeEnd),e.container.appendChild(this.handle))}onHandleResizeStart(e){this.isResized=!0,this.start.x=e.clientX,this.start.y=e.clientY,this.start.w=this.j.container.offsetWidth,this.start.h=this.j.container.offsetHeight,this.j.lock(),this.j.e.on(this.j.ow,"mousemove touchmove",this.onHandleResize),e.preventDefault()}onHandleResize(e){this.isResized&&(this.j.o.allowResizeY&&this.j.e.fire("setHeight",this.start.h+e.clientY-this.start.y),this.j.o.allowResizeX&&this.j.e.fire("setWidth",this.start.w+e.clientX-this.start.x),this.j.e.fire("resize"))}onHandleResizeEnd(){this.isResized&&(this.isResized=!1,this.j.e.off(this.j.ow,"mousemove touchmove",this.onHandleResize),this.j.unlock())}beforeDestruct(){D.i.safeRemove(this.handle),this.j.e.off(this.j.ow,"mouseup touchsend",this.onHandleResizeEnd)}};Di.requires=["size"],Di=(0,r.gn)([L.autobind],Di);let Pi=class extends G{constructor(){super(...arguments),this.resizeWorkspaces=this.j.async.debounce(this.resizeWorkspaceImd,this.j.defaultTimeout,!0)}afterInit(e){e.e.on("setHeight.size",this.setHeight).on("setWidth.size",this.setWidth).on("afterInit.size changePlace.size",this.initialize,void 0,!0).on(e.ow,"load.size",this.resizeWorkspaces).on("afterInit.size resize.size afterUpdateToolbar.size scroll.size afterResize.size",this.resizeWorkspaces).on("toggleFullSize.size toggleToolbar.size",this.resizeWorkspaceImd),this.initialize()}initialize(){const{j:e}=this;if(e.o.inline)return;let{height:t}=e.o;if(e.o.saveHeightInStorage&&"auto"!==t){const i=e.storage.get("height");i&&(t=i)}(0,g.css)(e.editor,{minHeight:"100%"}),(0,g.css)(e.container,{minHeight:e.o.minHeight,maxHeight:e.o.maxHeight,minWidth:e.o.minWidth,maxWidth:e.o.maxWidth}),this.setHeight(t),this.setWidth(e.o.width)}setHeight(e){if((0,g.isNumber)(e)){const{minHeight:t,maxHeight:i}=this.j.o;(0,g.isNumber)(t)&&t>e&&(e=t),(0,g.isNumber)(i)&&e>i&&(e=i)}(0,g.css)(this.j.container,"height",e),this.j.o.saveHeightInStorage&&this.j.storage.set("height",e),this.resizeWorkspaceImd()}setWidth(e){if((0,g.isNumber)(e)){const{minWidth:t,maxWidth:i}=this.j.o;(0,g.isNumber)(t)&&t>e&&(e=t),(0,g.isNumber)(i)&&e>i&&(e=i)}(0,g.css)(this.j.container,"width",e),this.resizeWorkspaceImd()}getNotWorkHeight(){var e,t;return((null===(e=this.j.toolbarContainer)||void 0===e?void 0:e.offsetHeight)||0)+((null===(t=this.j.statusbar)||void 0===t?void 0:t.getHeight())||0)+2}resizeWorkspaceImd(){if(!this.j||this.j.isDestructed||!this.j.o||this.j.o.inline)return;if(!this.j.container||!this.j.container.parentNode)return;const e=((0,g.css)(this.j.container,"minHeight")||0)-this.getNotWorkHeight();if((0,g.isNumber)(e)&&e>0&&([this.j.workplace,this.j.iframe,this.j.editor].map((t=>{t&&(0,g.css)(t,"minHeight",e)})),this.j.e.fire("setMinHeight",e)),(0,g.isNumber)(this.j.o.maxHeight)){const e=this.j.o.maxHeight-this.getNotWorkHeight();[this.j.workplace,this.j.iframe,this.j.editor].map((t=>{t&&(0,g.css)(t,"maxHeight",e)})),this.j.e.fire("setMaxHeight",e)}this.j.container&&(0,g.css)(this.j.workplace,"height","auto"!==this.j.o.height||this.j.isFullSize?this.j.container.offsetHeight-this.getNotWorkHeight():"auto")}beforeDestruct(e){e.e.off(e.ow,"load.size",this.resizeWorkspaces).off(".size")}};(0,r.gn)([L.autobind],Pi.prototype,"resizeWorkspaceImd",null),Pi=(0,r.gn)([L.autobind],Pi),n.D.prototype.beautifyHTML=!a.IS_IE,n.D.prototype.sourceEditor="ace",n.D.prototype.sourceEditorNativeOptions={showGutter:!0,theme:"ace/theme/idle_fingers",mode:"ace/mode/html",wrap:!0,highlightActiveLine:!0},n.D.prototype.sourceEditorCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"],n.D.prototype.beautifyHTMLCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify.min.js","https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify-html.min.js"],n.D.prototype.controls.source={mode:a.MODE_SPLIT,exec(e){e.toggleMode()},isActive:e=>e.getRealMode()===a.MODE_SOURCE,tooltip:"Change mode"};class _i{constructor(e,t,i,o){this.jodit=e,this.container=t,this.toWYSIWYG=i,this.fromWYSIWYG=o,this.className="",this.isReady=!1}get j(){return this.jodit}onReady(){this.replaceUndoManager(),this.isReady=!0,this.j.e.fire(this,"ready")}onReadyAlways(e){var t;this.isReady?e():null===(t=this.j.events)||void 0===t||t.on(this,"ready",e)}}class Ri extends _i{constructor(){super(...arguments),this.autosize=this.j.async.debounce((()=>{this.instance.style.height="auto",this.instance.style.height=this.instance.scrollHeight+"px"}),this.j.defaultTimeout)}init(e){this.instance=e.c.element("textarea",{class:"jodit-source__mirror"}),this.container.appendChild(this.instance),e.e.on(this.instance,"mousedown keydown touchstart input",e.async.debounce(this.toWYSIWYG,e.defaultTimeout)).on("setMinHeight.source",(e=>{(0,g.css)(this.instance,"minHeight",e)})).on(this.instance,"change keydown mousedown touchstart input",this.autosize).on("afterSetMode.source",this.autosize).on(this.instance,"mousedown focus",(t=>{e.e.fire(t.type,t)})),this.autosize(),this.onReady()}destruct(){D.i.safeRemove(this.instance)}getValue(){return this.instance.value}setValue(e){this.instance.value=e}insertRaw(e){const t=this.getValue();if(0>this.getSelectionStart())this.setValue(t+e);else{const i=this.getSelectionStart(),o=this.getSelectionEnd();this.setValue(t.substring(0,i)+e+t.substring(o,t.length))}}getSelectionStart(){return this.instance.selectionStart}getSelectionEnd(){return this.instance.selectionEnd}setSelectionRange(e,t=e){this.instance.setSelectionRange(e,t)}focus(){this.instance.focus()}setPlaceHolder(e){this.instance.setAttribute("placeholder",e)}setReadOnly(e){e?this.instance.setAttribute("readonly","true"):this.instance.removeAttribute("readonly")}selectAll(){this.instance.select()}replaceUndoManager(){const{history:e}=this.jodit;this.j.e.on(this.instance,"keydown",(t=>{if((t.ctrlKey||t.metaKey)&&"z"===t.key)return t.shiftKey?e.redo():e.undo(),this.setSelectionRange(this.getValue().length),!1}))}}class Ni extends _i{constructor(){super(...arguments),this.className="jodit_ace_editor",this.proxyOnBlur=e=>{this.j.e.fire("blur",e)},this.proxyOnFocus=e=>{this.j.e.fire("focus",e)},this.proxyOnMouseDown=e=>{this.j.e.fire("mousedown",e)}}aceExists(){return void 0!==this.j.ow.ace}getLastColumnIndex(e){return this.instance.session.getLine(e).length}getLastColumnIndices(){const e=this.instance.session.getLength(),t=[];let i=0;for(let o=0;e>o;o++)i+=this.getLastColumnIndex(o),o>0&&(i+=1),t[o]=i;return t}getRowColumnIndices(e){const t=this.getLastColumnIndices();if(t[0]>=e)return{row:0,column:e};let i=1;for(let o=1;t.length>o;o++)e>t[o]&&(i=o+1);return{row:i,column:e-t[i-1]-1}}setSelectionRangeIndices(e,t){const i=this.getRowColumnIndices(e),o=this.getRowColumnIndices(t);this.instance.getSelection().setSelectionRange({start:i,end:o})}getIndexByRowColumn(e,t){return this.getLastColumnIndices()[e]-this.getLastColumnIndex(e)+t}init(e){const t=()=>{if(void 0!==this.instance||!this.aceExists())return;const t=this.j.c.div("jodit-source__mirror-fake");this.container.appendChild(t),this.instance=e.ow.ace.edit(t),this.instance.setTheme(e.o.sourceEditorNativeOptions.theme),this.instance.renderer.setShowGutter(e.o.sourceEditorNativeOptions.showGutter),this.instance.getSession().setMode(e.o.sourceEditorNativeOptions.mode),this.instance.setHighlightActiveLine(e.o.sourceEditorNativeOptions.highlightActiveLine),this.instance.getSession().setUseWrapMode(!0),this.instance.setOption("indentedSoftWrap",!1),this.instance.setOption("wrap",e.o.sourceEditorNativeOptions.wrap),this.instance.getSession().setUseWorker(!1),this.instance.$blockScrolling=1/0,this.instance.on("change",this.toWYSIWYG),this.instance.on("focus",this.proxyOnFocus),this.instance.on("mousedown",this.proxyOnMouseDown),this.instance.on("blur",this.proxyOnBlur),e.getRealMode()!==a.MODE_WYSIWYG&&this.setValue(this.getValue());const i=this.j.async.debounce((()=>{e.isInDestruct||(this.instance.setOption("maxLines","auto"!==e.o.height?e.workplace.offsetHeight/this.instance.renderer.lineHeight:1/0),this.instance.resize())}),2*this.j.defaultTimeout);e.e.on("afterResize afterSetMode",i),i(),this.onReady()};e.e.on("afterSetMode",(()=>{e.getRealMode()!==a.MODE_SOURCE&&e.getMode()!==a.MODE_SPLIT||(this.fromWYSIWYG(),t())})),t(),this.aceExists()||(0,g.loadNext)(e,e.o.sourceEditorCDNUrlsJS).then((()=>{e.isInDestruct||t()}))}destruct(){var e,t;this.instance.off("change",this.toWYSIWYG),this.instance.off("focus",this.proxyOnFocus),this.instance.off("mousedown",this.proxyOnMouseDown),this.instance.destroy(),null===(t=null===(e=this.j)||void 0===e?void 0:e.events)||void 0===t||t.off("aceInited.source")}setValue(e){if(!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const t=this.j.e.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}this.instance.setValue(e),this.instance.clearSelection()}getValue(){return this.instance.getValue()}setReadOnly(e){this.instance.setReadOnly(e)}focus(){this.instance.focus()}getSelectionStart(){const e=this.instance.selection.getRange();return this.getIndexByRowColumn(e.start.row,e.start.column)}getSelectionEnd(){const e=this.instance.selection.getRange();return this.getIndexByRowColumn(e.end.row,e.end.column)}selectAll(){this.instance.selection.selectAll()}insertRaw(e){const t=this.instance.selection.getCursor(),i=this.instance.session.insert(t,e);this.instance.selection.setRange({start:t,end:i},!1)}setSelectionRange(e,t){this.setSelectionRangeIndices(e,t)}setPlaceHolder(e){}replaceUndoManager(){const{history:e}=this.jodit;this.instance.commands.addCommand({name:"Undo",bindKey:{win:"Ctrl-Z",mac:"Command-Z"},exec(){e.undo()}}),this.instance.commands.addCommand({name:"Redo",bindKey:{win:"Ctrl-Shift-Z",mac:"Command-Shift-Z"},exec(){e.redo()}})}}function qi(e,t,i,o,s){let r;if((0,g.isFunction)(e))r=e(t);else switch(e){case"ace":if(!t.o.shadowRoot){r=new Ni(t,i,o,s);break}default:r=new Ri(t,i,o,s)}return r.init(t),r.onReadyAlways((()=>{r.setReadOnly(t.o.readonly)})),r}class Bi extends G{constructor(){super(...arguments),this.buttons=[{name:"source",group:"source"}],this.__lock=!1,this.__oldMirrorValue="",this.tempMarkerStart="{start-jodit-selection}",this.tempMarkerStartReg=/{start-jodit-selection}/g,this.tempMarkerEnd="{end-jodit-selection}",this.tempMarkerEndReg=/{end-jodit-selection}/g,this.getSelectionStart=()=>{var e,t;return null!==(t=null===(e=this.sourceEditor)||void 0===e?void 0:e.getSelectionStart())&&void 0!==t?t:0},this.getSelectionEnd=()=>{var e,t;return null!==(t=null===(e=this.sourceEditor)||void 0===e?void 0:e.getSelectionEnd())&&void 0!==t?t:0}}onInsertHTML(e){var t;if(!this.j.o.readonly&&!this.j.isEditorMode())return null===(t=this.sourceEditor)||void 0===t||t.insertRaw(e),this.toWYSIWYG(),!1}fromWYSIWYG(e=!1){if(!this.__lock||!0===e){this.__lock=!0;const e=this.j.getEditorValue(!1,"source-consumer");e!==this.getMirrorValue()&&this.setMirrorValue(e),this.__lock=!1}}toWYSIWYG(){if(this.__lock)return;const e=this.getMirrorValue();e!==this.__oldMirrorValue&&(this.__lock=!0,this.j.value=e,this.__lock=!1,this.__oldMirrorValue=e)}getNormalPosition(e,t){for(t=t.replace(/<(script|style|iframe)[^>]*>[^]*?<\/\1>/im,(e=>{let t="";for(let i=0;e.length>i;i+=1)t+=a.INVISIBLE_SPACE;return t}));e>0&&t[e]===a.INVISIBLE_SPACE;)e--;let i=e;for(;i>0;){if(i--,"<"===t[i]&&void 0!==t[i+1]&&t[i+1].match(/[\w/]+/i))return i;if(">"===t[i])return e}return e}clnInv(e){return e.replace(a.INVISIBLE_SPACE_REG_EXP(),"")}onSelectAll(e){var t;if("selectall"===e.toLowerCase()&&this.j.getRealMode()===a.MODE_SOURCE)return null===(t=this.sourceEditor)||void 0===t||t.selectAll(),!1}getMirrorValue(){var e;return(null===(e=this.sourceEditor)||void 0===e?void 0:e.getValue())||""}setMirrorValue(e){var t;null===(t=this.sourceEditor)||void 0===t||t.setValue(e)}setFocusToMirror(){var e;null===(e=this.sourceEditor)||void 0===e||e.focus()}saveSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)this.j.s.save(),this.j.synchronizeValues(),this.fromWYSIWYG(!0);else{if(this.j.o.editHTMLDocumentMode)return;const e=this.getMirrorValue();if(this.getSelectionStart()===this.getSelectionEnd()){const t=this.j.s.marker(!0),i=this.getNormalPosition(this.getSelectionStart(),this.getMirrorValue());this.setMirrorValue(e.substr(0,i)+this.clnInv(t.outerHTML)+e.substr(i))}else{const t=this.j.s.marker(!0),i=this.j.s.marker(!1),o=this.getNormalPosition(this.getSelectionStart(),e),s=this.getNormalPosition(this.getSelectionEnd(),e);this.setMirrorValue(e.substr(0,o)+this.clnInv(t.outerHTML)+e.substr(o,s-o)+this.clnInv(i.outerHTML)+e.substr(s))}this.toWYSIWYG()}}removeSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)return this.__lock=!0,this.j.s.restore(),void(this.__lock=!1);let e=this.getMirrorValue(),t=0,i=0;try{if(e=e.replace(/]+data-jodit-selection_marker=(["'])start\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerStart).replace(/]+data-jodit-selection_marker=(["'])end\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerEnd),!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const t=this.j.e.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}if(t=e.indexOf(this.tempMarkerStart),i=t,e=e.replace(this.tempMarkerStartReg,""),-1!==t){const t=e.indexOf(this.tempMarkerEnd);-1!==t&&(i=t)}e=e.replace(this.tempMarkerEndReg,"")}finally{e=e.replace(this.tempMarkerEndReg,"").replace(this.tempMarkerStartReg,"")}this.setMirrorValue(e),this.setMirrorSelectionRange(t,i),this.toWYSIWYG(),this.setFocusToMirror()}setMirrorSelectionRange(e,t){var i;null===(i=this.sourceEditor)||void 0===i||i.setSelectionRange(e,t)}onReadonlyReact(){var e;null===(e=this.sourceEditor)||void 0===e||e.setReadOnly(this.j.o.readonly)}afterInit(e){if(this.mirrorContainer=e.c.div("jodit-source"),e.workplace.appendChild(this.mirrorContainer),e.e.on("afterAddPlace changePlace afterInit",(()=>{e.workplace.appendChild(this.mirrorContainer)})),this.sourceEditor=qi("area",e,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG),this.onReadonlyReact(),e.e.on("placeholder.source",(e=>{var t;null===(t=this.sourceEditor)||void 0===t||t.setPlaceHolder(e)})).on("change.source",this.syncValueFromWYSIWYG).on("beautifyHTML",(e=>e)),e.o.beautifyHTML){const t=()=>{var t;const i=e.ow.html_beautify;return!(!i||e.isInDestruct||(null===(t=e.events)||void 0===t||t.off("beautifyHTML").on("beautifyHTML",(e=>i(e))),0))};t()||(0,g.loadNext)(e,e.o.beautifyHTMLCDNUrlsJS).then(t)}this.syncValueFromWYSIWYG(!0),this.initSourceEditor(e)}syncValueFromWYSIWYG(e=!1){const t=this.j;t.getMode()!==a.MODE_SPLIT&&t.getMode()!==a.MODE_SOURCE||this.fromWYSIWYG(e)}initSourceEditor(e){var t;if("area"!==e.o.sourceEditor){const t=qi(e.o.sourceEditor,e,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG);t.onReadyAlways((()=>{var i,o;null===(i=this.sourceEditor)||void 0===i||i.destruct(),this.sourceEditor=t,this.syncValueFromWYSIWYG(!0),null===(o=e.events)||void 0===o||o.fire("sourceEditorReady",e)}))}else null===(t=this.sourceEditor)||void 0===t||t.onReadyAlways((()=>{var t;this.syncValueFromWYSIWYG(!0),null===(t=e.events)||void 0===t||t.fire("sourceEditorReady",e)}))}beforeDestruct(){this.sourceEditor&&(this.sourceEditor.destruct(),delete this.sourceEditor),D.i.safeRemove(this.mirrorContainer)}}(0,r.gn)([(0,L.watch)(":insertHTML.source")],Bi.prototype,"onInsertHTML",null),(0,r.gn)([L.autobind],Bi.prototype,"fromWYSIWYG",null),(0,r.gn)([L.autobind],Bi.prototype,"toWYSIWYG",null),(0,r.gn)([L.autobind],Bi.prototype,"getNormalPosition",null),(0,r.gn)([(0,L.watch)(":beforeCommand.source")],Bi.prototype,"onSelectAll",null),(0,r.gn)([(0,L.watch)(":beforeSetMode.source")],Bi.prototype,"saveSelection",null),(0,r.gn)([(0,L.watch)(":afterSetMode.source")],Bi.prototype,"removeSelection",null),(0,r.gn)([L.autobind],Bi.prototype,"setMirrorSelectionRange",null),(0,r.gn)([(0,L.watch)(":readonly.source")],Bi.prototype,"onReadonlyReact",null),(0,r.gn)([L.autobind],Bi.prototype,"syncValueFromWYSIWYG",null),n.D.prototype.showCharsCounter=!0,n.D.prototype.countHTMLChars=!1,n.D.prototype.showWordsCounter=!0;class Hi extends G{constructor(){super(...arguments),this.charCounter=null,this.wordCounter=null,this.reInit=()=>{this.j.o.showCharsCounter&&this.charCounter&&this.j.statusbar.append(this.charCounter,!0),this.j.o.showWordsCounter&&this.wordCounter&&this.j.statusbar.append(this.wordCounter,!0),this.j.e.off("change keyup",this.calc).on("change keyup",this.calc),this.calc()},this.calc=this.j.async.throttle((()=>{const e=this.j.text;if(this.j.o.showCharsCounter&&this.charCounter){const t=this.j.o.countHTMLChars?this.j.value:e.replace((0,a.SPACE_REG_EXP)(),"");this.charCounter.textContent=this.j.i18n("Chars: %d",t.length)}this.j.o.showWordsCounter&&this.wordCounter&&(this.wordCounter.textContent=this.j.i18n("Words: %d",e.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((e=>e.length)).length))}),this.j.defaultTimeout)}afterInit(){this.charCounter=this.j.c.span(),this.wordCounter=this.j.c.span(),this.j.e.on("afterInit changePlace afterAddPlace",this.reInit),this.reInit()}beforeDestruct(){D.i.safeRemove(this.charCounter),D.i.safeRemove(this.wordCounter),this.j.e.off("afterInit changePlace afterAddPlace",this.reInit),this.charCounter=null,this.wordCounter=null}}n.D.prototype.toolbarSticky=!0,n.D.prototype.toolbarDisableStickyForMobile=!0,n.D.prototype.toolbarStickyOffset=0;class Oi extends G{constructor(){super(...arguments),this.isToolbarSticked=!1,this.createDummy=e=>{},this.addSticky=e=>{this.isToolbarSticked||(this.createDummy(e),this.j.container.classList.add("jodit_sticky"),this.isToolbarSticked=!0),(0,g.css)(e,{top:this.j.o.toolbarStickyOffset||null,width:this.j.container.offsetWidth-2})},this.removeSticky=e=>{this.isToolbarSticked&&((0,g.css)(e,{width:"",top:""}),this.j.container.classList.remove("jodit_sticky"),this.isToolbarSticked=!1)}}afterInit(e){e.e.on(e.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).on("getStickyState.sticky",(()=>this.isToolbarSticked))}onScroll(){const{jodit:e}=this,t=e.ow.pageYOffset||e.od.documentElement&&e.od.documentElement.scrollTop||0,i=(0,g.offset)(e.container,e,e.od,!0),o=e.getMode()===a.MODE_WYSIWYG&&t+e.o.toolbarStickyOffset>i.top&&i.top+i.height>t+e.o.toolbarStickyOffset&&!(e.o.toolbarDisableStickyForMobile&&this.isMobile());if(e.o.toolbarSticky&&!0===e.o.toolbar&&this.isToolbarSticked!==o){const t=e.toolbarContainer;t&&(o?this.addSticky(t):this.removeSticky(t)),e.e.fire("toggleSticky",o)}}isMobile(){return this.j&&this.j.options&&this.j.container&&this.j.o.sizeSM>=this.j.container.offsetWidth}beforeDestruct(e){this.dummyBox&&D.i.safeRemove(this.dummyBox),e.e.off(e.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).off(".sticky")}}(0,r.gn)([(0,L.throttle)()],Oi.prototype,"onScroll",null),n.D.prototype.spellcheck=!1,n.D.prototype.controls.spellcheck={isActive(e){return e.o.spellcheck},icon:i(84),name:"spellcheck",command:"toggleSpellcheck",tooltip:"Spellchecking"};class Fi extends G{constructor(){super(...arguments),this.buttons=[{group:"state",name:"spellcheck"}]}afterInit(e){e.e.on("afterInit afterAddPlace prepareWYSIWYGEditor",this.toggleSpellcheck),this.toggleSpellcheck(),e.registerCommand("toggleSpellcheck",(()=>{this.jodit.o.spellcheck=!this.jodit.o.spellcheck,this.toggleSpellcheck(),this.j.e.fire("updateToolbar")}))}toggleSpellcheck(){(0,gt.Lj)(this.jodit.editor,"spellcheck",this.jodit.o.spellcheck)}beforeDestruct(e){}}(0,r.gn)([L.autobind],Fi.prototype,"toggleSpellcheck",null),n.D.prototype.usePopupForSpecialCharacters=!1,n.D.prototype.specialCharacters=["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","‘","’","“","”","–","—","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","»","¬","®","¯","°","²","³","´","µ","¶","·","¸","¹","º","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Ŵ","Ŷ","ŵ","ŷ","‚","‛","„","…","™","►","•","→","⇒","⇔","♦","≈"],n.D.prototype.controls.symbol={icon:"omega",hotkeys:["ctrl+shift+i","cmd+shift+i"],tooltip:"Insert Special Character",popup(e,t,i,o){const s=e.e.fire("generateSpecialCharactersTable.symbols");if(s){if(e.o.usePopupForSpecialCharacters){const t=e.c.div();return t.classList.add("jodit-symbols"),t.appendChild(s),e.e.on(s,"close_dialog",o),t}{U(s,e.i18n("Select Special Character"),void 0,"jodit-symbols").bindDestruct(e);const t=s.querySelector("a");t&&t.focus()}}}};class Wi extends G{constructor(){super(...arguments),this.buttons=[{name:"symbol",group:"insert"}],this.countInRow=17}afterInit(e){e.e.on("generateSpecialCharactersTable.symbols",(()=>{const t=e.c.fromHTML('
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
'),i=t.querySelector(".jodit-symbols__preview"),o=t.querySelector("table").tBodies[0],s=[];for(let t=0;e.o.specialCharacters.length>t;){const i=e.c.element("tr");for(let o=0;this.countInRow>o&&e.o.specialCharacters.length>t;o+=1,t+=1){const r=e.c.element("td"),n=e.c.fromHTML(`${e.o.specialCharacters[t]}`);s.push(n),r.appendChild(n),i.appendChild(r)}o.appendChild(i)}const r=this;return e.e.on(s,"focus",(function(){i.innerHTML=this.innerHTML})).on(s,"mousedown",(function(t){D.i.isTag(this,"a")&&(e.s.focus(),e.s.insertHTML(this.innerHTML),e.e.fire(this,"close_dialog"),t&&t.preventDefault(),t&&t.stopImmediatePropagation())})).on(s,"mouseenter",(function(){D.i.isTag(this,"a")&&this.focus()})).on(s,"keydown",(t=>{const i=t.target;if(D.i.isTag(i,"a")){const o=parseInt((0,tt.Lj)(i,"-index")||"0",10),n=parseInt((0,tt.Lj)(i,"data-index-j")||"0",10);let l;switch(t.key){case a.KEY_UP:case a.KEY_DOWN:l=t.key===a.KEY_UP?o-r.countInRow:o+r.countInRow,void 0===s[l]&&(l=t.key===a.KEY_UP?Math.floor(s.length/r.countInRow)*r.countInRow+n:n,l>s.length-1&&(l-=r.countInRow)),s[l]&&s[l].focus();break;case a.KEY_RIGHT:case a.KEY_LEFT:l=t.key===a.KEY_LEFT?o-1:o+1,void 0===s[l]&&(l=t.key===a.KEY_LEFT?s.length-1:0),s[l]&&s[l].focus();break;case a.KEY_ENTER:e.e.fire(i,"mousedown"),t.stopImmediatePropagation(),t.preventDefault()}}})),t}))}beforeDestruct(e){e.e.off("generateSpecialCharactersTable.symbols")}}n.D.prototype.table={allowCellSelection:!0,selectionCellStyle:"border: 1px double #1e88e5 !important;",allowCellResize:!0,useExtraClassesOptions:!1},n.D.prototype.controls.table={data:{cols:10,rows:10,classList:{"table table-bordered":"Bootstrap Bordered","table table-striped":"Bootstrap Striped","table table-dark":"Bootstrap Dark"}},popup(e,t,i,o,s){const r=i.data&&i.data.rows?i.data.rows:10,n=i.data&&i.data.cols?i.data.cols:10,a=e.c.fromHTML('
'+(()=>{if(!e.o.table.useExtraClassesOptions)return"";const t=[];if(i.data){const e=i.data.classList;Object.keys(e).forEach((i=>{t.push(``)}))}return t.join("")})()+'
'),l=a.querySelectorAll("span")[0],c=a.querySelectorAll("span")[1],d=a.querySelector(".jodit-form__container"),h=a.querySelector(".jodit-form__options"),u=[],p=r*n;for(let t=0;p>t;t+=1)u[t]||u.push(e.c.element("span",{dataIndex:t}));if(e.e.on(d,"mousemove",((e,t)=>{const i=e.target;if(!D.i.isTag(i,"span"))return;const o=void 0===t||isNaN(t)?parseInt((0,tt.Lj)(i,"-index")||"0",10):t||0,s=Math.ceil((o+1)/n),r=o%n+1;for(let e=0;u.length>e;e+=1)u[e].className=e%n+1>r||Math.ceil((e+1)/n)>s?"":"jodit_hovered";c.textContent=""+r,l.textContent=""+s})).on(d,"touchstart mousedown",(t=>{const i=t.target;if(t.preventDefault(),t.stopImmediatePropagation(),!D.i.isTag(i,"span"))return;const s=parseInt((0,tt.Lj)(i,"-index")||"0",10),r=Math.ceil((s+1)/n),a=s%n+1,l=e.createInside,c=l.element("tbody"),d=l.element("table");d.appendChild(c),d.style.width="100%";let u,p,m=null;for(let e=1;r>=e;e+=1){u=l.element("tr");for(let e=1;a>=e;e+=1)p=l.element("td"),m||(m=p),(0,g.css)(p,"width",(100/a).toFixed(4)+"%"),p.appendChild(l.element("br")),u.appendChild(l.text("\n")),u.appendChild(l.text("\t")),u.appendChild(p);c.appendChild(l.text("\n")),c.appendChild(u)}const f=e.s.current();if(f&&e.s.isCollapsed()){const t=D.i.closest(f,D.i.isBlock,e.editor);t&&t!==e.editor&&!t.nodeName.match(/^TD|TH|TBODY|TABLE|THEADER|TFOOTER$/)&&e.s.setCursorAfter(t)}(0,g.$$)("input[type=checkbox]:checked",h).forEach((e=>{e.value.split(/[\s]+/).forEach((e=>{d.classList.add(e)}))})),e.s.insertNode(l.text("\n")),e.s.insertNode(d,!1),m&&(e.s.setCursorIn(m),(0,g.scrollIntoViewIfNeeded)(m,e.editor,e.ed)),o()})),s&&s.parentElement){for(let t=0;r>t;t+=1){const i=e.c.div();for(let e=0;n>e;e+=1)i.appendChild(u[t*n+e]);d.appendChild(i)}u[0]&&(u[0].className="hovered")}return a},tooltip:"Insert table"};const Vi="table_processor_observer-resize";class Ui extends G{constructor(){super(...arguments),this.selectMode=!1,this.resizeDelta=0,this.createResizeHandle=()=>{this.resizeHandler||(this.resizeHandler=this.j.c.div("jodit-table-resizer"),this.j.e.on(this.resizeHandler,"mousedown.table touchstart.table",this.onHandleMouseDown).on(this.resizeHandler,"mouseenter.table",(()=>{this.j.async.clearTimeout(this.hideTimeout)})))},this.hideTimeout=0,this.drag=!1,this.minX=0,this.maxX=0,this.startX=0}get module(){return this.j.getInstance("Table",this.j.o)}get isRTL(){return"rtl"===this.j.o.direction}showResizeHandle(){this.j.async.clearTimeout(this.hideTimeout),this.j.workplace.appendChild(this.resizeHandler)}hideResizeHandle(){this.hideTimeout=this.j.async.setTimeout((()=>{D.i.safeRemove(this.resizeHandler)}),{timeout:this.j.defaultTimeout,label:"hideResizer"})}onHandleMouseDown(e){if(this.j.isLocked)return;this.drag=!0,this.j.e.on(this.j.ow,"mouseup.resize-cells touchend.resize-cells",this.onMouseUp).on(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.startX=e.clientX,this.j.lock(Vi),this.resizeHandler.classList.add("jodit-table-resizer_moved");let t,i=this.workTable.getBoundingClientRect();if(this.minX=0,this.maxX=1e6,null!=this.wholeTable)i=this.workTable.parentNode.getBoundingClientRect(),this.minX=i.left,this.maxX=this.minX+i.width;else{const e=_e.formalCoordinate(this.workTable,this.workCell,!0);_e.formalMatrix(this.workTable,((i,o,s)=>{e[1]===s&&(t=i.getBoundingClientRect(),this.minX=Math.max(t.left+a.NEARBY/2,this.minX)),e[1]+(this.isRTL?-1:1)===s&&(t=i.getBoundingClientRect(),this.maxX=Math.min(t.left+t.width-a.NEARBY/2,this.maxX))}))}return!1}onMouseMove(e){if(!this.drag)return;this.j.e.fire("closeAllPopups");let t=e.clientX;const i=(0,g.offset)(this.resizeHandler.parentNode||this.j.od.documentElement,this.j,this.j.od,!0);this.minX>t&&(t=this.minX),t>this.maxX&&(t=this.maxX),this.resizeDelta=t-this.startX+(this.j.o.iframe?i.left:0),this.resizeHandler.style.left=t-(this.j.o.iframe?0:i.left)+"px";const o=this.j.s.sel;o&&o.removeAllRanges()}onMouseUp(e){(this.selectMode||this.drag)&&(this.selectMode=!1,this.j.unlock()),this.resizeHandler&&this.drag&&(this.drag=!1,this.j.e.off(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.resizeHandler.classList.remove("jodit-table-resizer_moved"),this.startX!==e.clientX&&(null==this.wholeTable?this.resizeColumns():this.resizeTable()),this.j.synchronizeValues(),this.j.s.focus())}resizeColumns(){const e=this.resizeDelta,t=[];_e.setColumnWidthByDelta(this.workTable,_e.formalCoordinate(this.workTable,this.workCell,!0)[1],e,!0,t);const i=(0,g.call)(this.isRTL?D.i.prev:D.i.next,this.workCell,D.i.isCell,this.workCell.parentNode);_e.setColumnWidthByDelta(this.workTable,_e.formalCoordinate(this.workTable,i)[1],-e,!1,t)}resizeTable(){const e=this.resizeDelta*(this.isRTL?-1:1),t=this.workTable.offsetWidth,i=(0,g.getContentWidth)(this.workTable.parentNode,this.j.ew),o=!this.wholeTable;if(this.isRTL?!o:o)this.workTable.style.width=(t+e)/i*100+"%";else{const o=this.isRTL?"marginRight":"marginLeft",s=parseInt(this.j.ew.getComputedStyle(this.workTable)[o]||"0",10);this.workTable.style.width=(t-e)/i*100+"%",this.workTable.style[o]=(s+e)/i*100+"%"}}setWorkCell(e,t=null){this.wholeTable=t,this.workCell=e,this.workTable=D.i.up(e,(e=>D.i.isTag(e,"table")),this.j.editor)}calcHandlePosition(e,t,i=0,o=0){const s=(0,g.offset)(t,this.j,this.j.ed);if(i>a.NEARBY&&s.width-a.NEARBY>i)return void this.hideResizeHandle();const r=(0,g.offset)(this.j.workplace,this.j,this.j.od,!0),n=(0,g.offset)(e,this.j,this.j.ed);if(this.resizeHandler.style.left=(i>a.NEARBY?s.left+s.width:s.left)-r.left+o+"px",Object.assign(this.resizeHandler.style,{height:n.height+"px",top:n.top-r.top+"px"}),this.showResizeHandle(),i>a.NEARBY){const e=(0,g.call)(this.isRTL?D.i.prev:D.i.next,t,D.i.isCell,t.parentNode);this.setWorkCell(t,!!e&&null)}else{const e=(0,g.call)(this.isRTL?D.i.next:D.i.prev,t,D.i.isCell,t.parentNode);this.setWorkCell(e||t,!e||null)}}afterInit(e){e.o.table.allowCellResize&&e.e.off(this.j.ow,".resize-cells").off(".resize-cells").on("change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells",(()=>{(0,g.$$)("table",e.editor).forEach(this.observe)})).on(this.j.ow,"scroll.resize-cells",(()=>{if(!this.drag)return;const t=D.i.up(this.workCell,(e=>D.i.isTag(e,"table")),e.editor);if(t){const e=t.getBoundingClientRect();this.resizeHandler.style.top=e.top+"px"}})).on("beforeSetMode.resize-cells",(()=>{this.module.getAllSelectedCells().forEach((t=>{this.module.removeSelection(t),_e.normalizeTable(D.i.closest(t,"table",e.editor))}))}))}observe(e){(0,g.dataBind)(e,Vi)||((0,g.dataBind)(e,Vi,!0),this.j.e.on(e,"mouseleave.resize-cells",(e=>{this.resizeHandler&&this.resizeHandler!==e.relatedTarget&&this.hideResizeHandle()})).on(e,"mousemove.resize-cells touchmove.resize-cells",this.j.async.throttle((t=>{if(this.j.isLocked)return;const i=D.i.up(t.target,D.i.isCell,e);i&&this.calcHandlePosition(e,i,t.offsetX)}),{timeout:this.j.defaultTimeout})),this.createResizeHandle())}beforeDestruct(e){e.events&&(e.e.off(this.j.ow,".resize-cells"),e.e.off(".resize-cells"))}}(0,r.gn)([L.autobind],Ui.prototype,"onHandleMouseDown",null),(0,r.gn)([L.autobind],Ui.prototype,"onMouseMove",null),(0,r.gn)([L.autobind],Ui.prototype,"onMouseUp",null),(0,r.gn)([L.autobind],Ui.prototype,"observe",null);const $i="table_processor_observer",Yi="onMoveTableSelectCell";class Ki extends G{constructor(){super(...arguments),this.requires=["select"],this.selectedCell=null,this.isSelectionMode=!1}get module(){return this.j.getInstance("Table",this.j.o)}afterInit(e){e.o.table.allowCellSelection&&e.e.on("keydown.select-cells",(e=>{e.key===a.KEY_TAB&&this.unselectCells()})).on("beforeCommand.select-cells",this.onExecCommand).on("afterCommand.select-cells",this.onAfterCommand).on(["clickEditor","mousedownTd","mousedownTh","touchstartTd","touchstartTh"].map((e=>e+".select-cells")).join(" "),this.onStartSelection).on("clickTr clickTbody",(()=>{var e;const t=this.module.getAllSelectedCells().length;if(t)return t>1&&(null===(e=this.j.s.sel)||void 0===e||e.removeAllRanges()),!1}))}onStartSelection(e){if(this.j.o.readonly)return;if(this.unselectCells(),e===this.j.editor)return;const t=D.i.closest(e,"table",this.j.editor);return e&&t?(e.firstChild||e.appendChild(this.j.createInside.element("br")),this.isSelectionMode=!0,this.selectedCell=e,this.module.addSelection(e),this.j.e.on(t,"mousemove.select-cells touchmove.select-cells",this.j.async.throttle(this.onMove.bind(this,t),{label:Yi,timeout:this.j.defaultTimeout/2})).on(t,"mouseup.select-cells touchend.select-cells",this.onStopSelection.bind(this,t)),!1):void 0}onOutsideClick(){this.selectedCell=null,this.onRemoveSelection()}onChange(){this.j.isLocked||this.isSelectionMode||this.onRemoveSelection()}onMove(e,t){var i;if(this.j.o.readonly&&!this.j.isLocked)return;if(this.j.isLockedNotBy($i))return;const o=this.j.ed.elementFromPoint(t.clientX,t.clientY);if(!o)return;const s=D.i.closest(o,["td","th"],e);if(!s||!this.selectedCell)return;s!==this.selectedCell&&this.j.lock($i),this.unselectCells();const r=_e.getSelectedBound(e,[s,this.selectedCell]),n=_e.formalMatrix(e);for(let e=r[0][0];r[1][0]>=e;e+=1)for(let t=r[0][1];r[1][1]>=t;t+=1)this.module.addSelection(n[e][t]);this.module.getAllSelectedCells().length>1&&(null===(i=this.j.s.sel)||void 0===i||i.removeAllRanges()),this.j.e.fire("hidePopup"),t.stopPropagation(),(()=>{const e=this.j.createInside.fromHTML('
 
');s.appendChild(e),this.j.async.setTimeout((()=>{var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)}),this.j.defaultTimeout/5)})()}onRemoveSelection(e){var t;if(!(null===(t=null==e?void 0:e.buffer)||void 0===t?void 0:t.actionTrigger)&&!this.selectedCell&&this.module.getAllSelectedCells().length)return this.j.unlock(),this.unselectCells(),void this.j.e.fire("hidePopup","cells");this.isSelectionMode=!1,this.selectedCell=null}onStopSelection(e,t){if(!this.selectedCell)return;this.isSelectionMode=!1,this.j.unlock();const i=this.j.ed.elementFromPoint(t.clientX,t.clientY);if(!i)return;const o=D.i.closest(i,["td","th"],e);if(!o)return;const s=D.i.closest(o,"table",e);if(s&&s!==e)return;const r=_e.getSelectedBound(e,[o,this.selectedCell]),n=_e.formalMatrix(e),a=n[r[1][0]][r[1][1]],l=n[r[0][0]][r[0][1]];this.j.e.fire("showPopup",e,(()=>{const e=(0,g.position)(l,this.j),t=(0,g.position)(a,this.j);return{left:e.left,top:e.top,width:t.left-e.left+t.width,height:t.top-e.top+t.height}}),"cells"),(0,g.$$)("table",this.j.editor).forEach((e=>{this.j.e.off(e,"mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells")})),this.j.async.clearTimeout(Yi)}unselectCells(e){const t=this.module,i=t.getAllSelectedCells();i.length&&i.forEach((i=>{e&&e===i||t.removeSelection(i)}))}onExecCommand(e){if(/table(splitv|splitg|merge|empty|bin|binrow|bincolumn|addcolumn|addrow)/.test(e)){e=e.replace("table","");const t=this.module.getAllSelectedCells();if(t.length){const[i]=t;if(!i)return;const o=D.i.closest(i,"table",this.j.editor);if(!o)return;switch(e){case"splitv":_e.splitVertical(o,this.j);break;case"splitg":_e.splitHorizontal(o,this.j);break;case"merge":_e.mergeSelected(o,this.j);break;case"empty":t.forEach((e=>D.i.detach(e)));break;case"bin":D.i.safeRemove(o);break;case"binrow":new Set(t.map((e=>e.parentNode))).forEach((e=>{_e.removeRow(o,e.rowIndex)}));break;case"bincolumn":{const e=new Set;t.reduce(((t,i)=>(e.has(i.cellIndex)||(t.push(i),e.add(i.cellIndex)),t)),[]).forEach((e=>{_e.removeColumn(o,e.cellIndex)}))}break;case"addcolumnafter":case"addcolumnbefore":_e.appendColumn(o,i.cellIndex,"addcolumnafter"===e,this.j.createInside);break;case"addrowafter":case"addrowbefore":_e.appendRow(o,i.parentNode,"addrowafter"===e,this.j.createInside)}}return!1}}onAfterCommand(e){/^justify/.test(e)&&this.module.getAllSelectedCells().forEach((t=>si(e,t)))}beforeDestruct(e){this.onRemoveSelection(),e.e.off(".select-cells")}}function Gi(e){e.e.off(".tableKeyboardNavigation").on("keydown.tableKeyboardNavigation",(t=>{let i,o;if(t.key!==a.KEY_TAB&&t.key!==a.KEY_LEFT&&t.key!==a.KEY_RIGHT&&t.key!==a.KEY_UP&&t.key!==a.KEY_DOWN)return;{if(i=e.s.current(),o=D.i.up(i,(e=>e&&e.nodeName&&/^td|th$/i.test(e.nodeName)),e.editor),!o)return;const s=e.s.range;if(t.key!==a.KEY_TAB&&i!==o&&((t.key===a.KEY_LEFT||t.key===a.KEY_UP)&&(D.i.prev(i,(e=>t.key===a.KEY_UP?D.i.isTag(e,"br"):!!e),o)||t.key!==a.KEY_UP&&D.i.isText(i)&&0!==s.startOffset)||(t.key===a.KEY_RIGHT||t.key===a.KEY_DOWN)&&(D.i.next(i,(e=>t.key===a.KEY_DOWN?D.i.isTag(e,"br"):!!e),o)||t.key!==a.KEY_DOWN&&D.i.isText(i)&&i.nodeValue&&s.startOffset!==i.nodeValue.length)))return}const s=D.i.up(o,(e=>e&&/^table$/i.test(e.nodeName)),e.editor);let r=null;switch(t.key){case a.KEY_TAB:case a.KEY_LEFT:{const i=t.key===a.KEY_LEFT||t.shiftKey?"prev":"next";r=D.i[i](o,(e=>e&&/^td|th$/i.test(e.tagName)),s),r||(_e.appendRow(s,"next"!==i&&s.querySelector("tr"),"next"===i,e.createInside),r=D.i[i](o,D.i.isCell,s));break}case a.KEY_UP:case a.KEY_DOWN:{let e=0,i=0;const n=_e.formalMatrix(s,((t,s,r)=>{t===o&&(e=s,i=r)}));t.key===a.KEY_UP?void 0!==n[e-1]&&(r=n[e-1][i]):void 0!==n[e+1]&&(r=n[e+1][i])}}if(r){if(r.firstChild)t.key===a.KEY_TAB?e.s.select(r,!0):e.s.setCursorIn(r,t.key===a.KEY_RIGHT||t.key===a.KEY_DOWN);else{const t=e.createInside.element("br");r.appendChild(t),e.s.setCursorBefore(t)}return!1}}))}function Ji(e){e.registerButton({name:"table",group:"insert"})}(0,r.gn)([L.autobind],Ki.prototype,"onStartSelection",null),(0,r.gn)([(0,L.watch)(":outsideClick")],Ki.prototype,"onOutsideClick",null),(0,r.gn)([(0,L.watch)(":change")],Ki.prototype,"onChange",null),(0,r.gn)([L.autobind],Ki.prototype,"onRemoveSelection",null),(0,r.gn)([L.autobind],Ki.prototype,"onStopSelection",null),(0,r.gn)([L.autobind],Ki.prototype,"onExecCommand",null),(0,r.gn)([L.autobind],Ki.prototype,"onAfterCommand",null);class Xi extends G{constructor(){super(...arguments),this.isOpened=!1,this.delayShowTimeout=0}afterInit(e){this.container=e.c.div("jodit-tooltip"),(0,j.ZO)(this.j,Xi).appendChild(this.container);let t=0;e.e.off(".tooltip").on("showTooltip.tooltip",((i,o)=>{e.async.clearTimeout(t),this.open(i,o)})).on("delayShowTooltip.tooltip",this.delayOpen).on("escape.tooltip",this.close).on("hideTooltip.tooltip change.tooltip scroll.tooltip changePlace.tooltip hidePopup.tooltip closeAllPopups.tooltip",(()=>{this.j.async.clearTimeout(this.delayShowTimeout),t=e.async.setTimeout(this.close,this.j.defaultTimeout)}))}delayOpen(e,t){const i=this.j.o.showTooltipDelay||this.j.defaultTimeout;this.j.async.clearTimeout(this.delayShowTimeout),this.delayShowTimeout=this.j.async.setTimeout((()=>this.open(e,t)),{timeout:i,label:"tooltip"})}open(e,t){this.container.classList.add("jodit-tooltip_visible"),this.container.innerHTML=t,this.isOpened=!0,this.setPosition(e)}setPosition(e){const t=e();(0,g.css)(this.container,{left:t.x,top:t.y})}close(){this.j.async.clearTimeout(this.delayShowTimeout),this.isOpened&&(this.isOpened=!1,this.container.classList.remove("jodit-tooltip_visible"),(0,g.css)(this.container,{left:-5e3}))}beforeDestruct(e){null==e||e.e.off(".tooltip"),this.close(),D.i.safeRemove(this.container)}}(0,r.gn)([L.autobind],Xi.prototype,"delayOpen",null),(0,r.gn)([L.autobind],Xi.prototype,"close",null),n.D.prototype.tab={tabInsideLiInsertNewList:!0};class Zi extends G{afterInit(e){}onTab(e){if(e.key===a.KEY_TAB&&(e=>{if(!e.o.tab.tabInsideLiInsertNewList||!e.s.isCollapsed())return!1;const t=e.createInside.fake();e.s.insertNode(t);const i=D.i.closest(t,"li",e.editor);if(i&&e.s.cursorOnTheLeft(i)&&D.i.isTag(i.previousElementSibling,"li")){const o=D.i.closest(i,["ol","ul"],e.editor);if(o){const s=e.createInside.element(o.tagName),r=i.previousElementSibling;return s.appendChild(i),r.appendChild(s),e.s.setCursorAfter(t),D.i.safeRemove(t),!0}}return D.i.safeRemove(t),!1})(this.j))return!1}beforeDestruct(e){}}function Qi(e){e.registerButton({name:"preview"}),e.registerCommand("preview",((t,i,o)=>{const s=new V({language:e.o.language,theme:e.o.theme});s.setSize(1024,600).open("",e.i18n("Preview")).setModal(!0),((e,t,i="px",o=null)=>{const s=((e,t)=>{const i=[];try{(0,g.$$)("img",e.editor).forEach((o=>{const s=[(0,g.attr)(o,"width"),(0,g.attr)(o,"height"),o.src];(0,g.attr)(o,{width:o.offsetWidth+t,height:o.offsetHeight+t});const r=e.createInside.a();e.ed.body.appendChild(r),r.href=o.src,o.src=r.href,D.i.safeRemove(r),i.push((()=>{var e;o.src=null!==(e=s[2])&&void 0!==e?e:"",(0,g.attr)(o,{width:s[0]||null,height:s[1]||null})}))}))}catch(e){throw i.forEach((e=>e())),i.length=0,e}return i})(e,i);try{const r=e.e.fire("beforePreviewBox",t,i);if(null!=r)return r;let n=e.c.div("jodit__preview-box");o&&o.appendChild(n),(0,g.css)(n,{position:"relative",padding:16});const a=e.value||`
${e.i18n("Empty")}
`;if(e.iframe){const t=e.create.element("iframe");(0,g.css)(t,{minWidth:800,minHeight:600,border:0}),n.appendChild(t);const i=t.contentWindow;i&&(e.e.fire("generateDocumentStructure.iframe",i.document,e),n=i.document.body)}else(0,g.css)(n,{minWidth:1024,minHeight:600,border:0});const l=(t,i)=>{const o=(0,g.isString)(i)?e.c.div():i;(0,g.isString)(i)&&(o.innerHTML=i);for(let e=0;o.children.length>e;e+=1){const i=o.children[e],s=t.ownerDocument.createElement(i.nodeName);for(let e=0;i.attributes.length>e;e+=1)(0,g.attr)(s,i.attributes[e].nodeName,i.attributes[e].nodeValue);0===i.children.length||D.i.isTag(i,["table"])?"SCRIPT"===i.nodeName?i.textContent&&(s.textContent=i.textContent):i.innerHTML&&(s.innerHTML=i.innerHTML):l(s,i);try{t.appendChild(s)}catch(e){}}};l(n,a),e.e.fire("afterPreviewBox",n)}finally{s.forEach((e=>e()))}})(e,o,"px",s.getElm("content"))}))}function eo(e){e.registerButton({name:"print"})}(0,r.gn)([(0,L.watch)(":keydown.tab")],Zi.prototype,"onTab",null),n.D.prototype.controls.preview={icon:"eye",command:"preview",mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Preview"},n.D.prototype.controls.print={exec(e){const t=e.create.element("iframe");Object.assign(t.style,{position:"fixed",right:0,bottom:0,width:0,height:0,border:0}),(0,j.ZO)(e,n.D).appendChild(t);const i=()=>{e.e.off(e.ow,"mousemove",i),D.i.safeRemove(t)},o=t.contentWindow;if(o){e.e.on(o,"onbeforeunload onafterprint",i).on(e.ow,"mousemove",i),e.o.iframe?(e.e.fire("generateDocumentStructure.iframe",o.document,e),o.document.body.innerHTML=e.value):(o.document.write(''+e.value+""),o.document.close());const t=o.document.createElement("style");t.innerHTML="@media print {\n\t\t\t\t\tbody {\n\t\t\t\t\t\t\t-webkit-print-color-adjust: exact;\n\t\t\t\t\t}\n\t\t\t}",o.document.head.appendChild(t),o.focus(),o.print()}},mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Print"},n.D.prototype.showXPathInStatusbar=!0;class to extends G{constructor(){super(...arguments),this.onContext=(e,t)=>(this.menu||(this.menu=new S(this.j)),this.menu.show(t.clientX,t.clientY,[{icon:"bin",title:e===this.j.editor?"Clear":"Remove",exec:()=>{e!==this.j.editor?D.i.safeRemove(e):this.j.value="",this.j.synchronizeValues()}},{icon:"select-all",title:"Select",exec:()=>{this.j.s.select(e)}}]),!1),this.onSelectPath=(e,t)=>{this.j.s.focus();const i=(0,g.attr)(t.target,"-path")||"/";if("/"===i)return this.j.execCommand("selectall"),!1;try{const e=this.j.ed.evaluate(i,this.j.editor,null,XPathResult.ANY_TYPE,null).iterateNext();if(e)return this.j.s.select(e),!1}catch(e){}return this.j.s.select(e),!1},this.tpl=(e,t,i,o)=>{const s=this.j.c.fromHTML(`${(0,g.trim)(i)}`),r=s.firstChild;return this.j.e.on(r,"click",this.onSelectPath.bind(this,e)).on(r,"contextmenu",this.onContext.bind(this,e)),s},this.removeSelectAll=()=>{this.selectAllButton&&(this.selectAllButton.destruct(),delete this.selectAllButton)},this.appendSelectAll=()=>{this.removeSelectAll(),this.selectAllButton=O(this.j,{name:"selectall",...this.j.o.controls.selectall}),this.selectAllButton.state.size="tiny",this.container&&this.container.insertBefore(this.selectAllButton.container,this.container.firstChild)},this.calcPathImd=()=>{if(this.isDestructed)return;const e=this.j.s.current();if(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),e){let t,i,o;D.i.up(e,(e=>{e&&this.j.editor!==e&&!D.i.isText(e)&&(t=e.nodeName.toLowerCase(),i=(0,g.getXPathByElement)(e,this.j.editor).replace(/^\//,""),o=this.tpl(e,i,t,this.j.i18n("Select %s",t)),this.container&&this.container.insertBefore(o,this.container.firstChild))}),this.j.editor)}this.appendSelectAll()},this.calcPath=this.j.async.debounce(this.calcPathImd,2*this.j.defaultTimeout)}afterInit(){this.j.o.showXPathInStatusbar&&(this.container=this.j.c.div("jodit-xpath"),this.j.e.off(".xpath").on("mouseup.xpath change.xpath keydown.xpath changeSelection.xpath",this.calcPath).on("afterSetMode.xpath afterInit.xpath changePlace.xpath",(()=>{this.j.o.showXPathInStatusbar&&this.container&&(this.j.statusbar.append(this.container),this.j.getRealMode()===a.MODE_WYSIWYG?this.calcPath():(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),this.appendSelectAll()))})),this.calcPath())}beforeDestruct(){this.j&&this.j.events&&this.j.e.off(".xpath"),this.removeSelectAll(),this.menu&&this.menu.destruct(),D.i.safeRemove(this.container),delete this.menu,delete this.container}}var io=i(85),oo=i(86),so=i(87),ro=i(88),no=i(89),ao=i(90),lo=i(91),co=i(92),ho=i(93),uo=i(94),po=i(95),mo=i(96),fo=i(97),go=i(98),vo=i(99),bo=i(100),yo=i(101),wo=i(102),ko=i(103),Co=i(104),So=i(105),Eo=i(106),Io=i(107),xo=i(108),zo=i(109),To=i(110),jo=i(111),Lo=i(112),Ao=i(113),Mo=i(114),Do=i(115),Po=i(116),_o=i(117),Ro=i(118),No=i(119),qo=i(120),Bo=i(121),Ho=i(122),Oo=i(123),Fo=i(124),Wo=i(125),Vo=i(126),Uo=i(127),$o=i(128),Yo=i(129),Ko=i(130),Go=i(131),Jo=i(132),Xo=i(133),Zo=i(134),Qo=i(135),es=i(136),ts=i(137),is=i(138),os=i(139),ss=i(140),rs=i(141),ns=i(142),as=i(143),ls=i(144),cs=i(145),ds=i(146),hs=i(147),us=i(148),ps=i(149),ms=i(150),fs=i(151),gs=i(152),vs=i(153),bs=i(154),ys=i(155),ws=i(156),ks=i(157),Cs=i(158),Ss=i(159),Es=i(160),Is=i(161),xs=i(162),zs=i(163),Ts=i(164),js=i(165),Ls=i(166),As=i(167);Object.keys(a).forEach((e=>{Jodit[e]=a[e]}));const Ms=e=>"__esModule"!==e;Object.keys(s).filter(Ms).forEach((e=>{P.JO.set(e.replace("_","-"),s[e])})),Object.keys(e).filter(Ms).forEach((t=>{Jodit.modules[t]=e[t]})),Object.keys(L).filter(Ms).forEach((e=>{Jodit.decorators[e]=L[e]})),["Confirm","Alert","Prompt"].forEach((t=>{Jodit[t]=e[t]})),Object.keys(t).filter(Ms).forEach((e=>{Jodit.plugins.add(e,t[e])})),Object.keys(Ge).filter(Ms).forEach((e=>{Jodit.lang[e]=Ge[e]}))}(),o}()})); \ No newline at end of file +((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}})(self,(function(){return function(){var e=[,function(e,t,i){"use strict";i.d(t,{D:()=>s});var o=i(2);class s{constructor(){this.defaultTimeout=100,this.namespace="",this.safeMode=!1,this.safePluginsList=["about","enter","backspace"],this.license="",this.preset="custom",this.presets={inline:{inline:!0,toolbar:!1,toolbarInline:!0,toolbarInlineForSelection:!0,showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,showPlaceholder:!1}},this.ownerDocument="undefined"!=typeof document?document:null,this.ownerWindow="undefined"!=typeof window?window:null,this.shadowRoot=null,this.styleValues={},this.zIndex=0,this.readonly=!1,this.disabled=!1,this.activeButtonsInReadOnly=["source","fullsize","print","about","dots","selectall"],this.toolbarButtonSize="middle",this.allowTabNavigation=!1,this.inline=!1,this.theme="default",this.saveModeInStorage=!1,this.editorCssClass=!1,this.style=!1,this.triggerChangeEvent=!0,this.direction="",this.language="auto",this.debugLanguage=!1,this.i18n=!1,this.tabIndex=-1,this.toolbar=!0,this.statusbar=!0,this.showTooltip=!0,this.showTooltipDelay=1e3,this.useNativeTooltip=!1,this.enter=o.PARAGRAPH,this.enterBlock="br"!==this.enter?this.enter:o.PARAGRAPH,this.defaultMode=o.MODE_WYSIWYG,this.useSplitMode=!1,this.colors={greyscale:["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF"],palette:["#980000","#FF0000","#FF9900","#FFFF00","#00F0F0","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF"],full:["#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#733554","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"]},this.colorPickerDefaultTab="background",this.imageDefaultWidth=300,this.removeButtons=[],this.disablePlugins=[],this.extraPlugins=[],this.extraButtons=[],this.extraIcons={},this.createAttributes={},this.sizeLG=900,this.sizeMD=700,this.sizeSM=400,this.buttons=[{group:"font-style",buttons:[]},{group:"list",buttons:[]},{group:"font",buttons:[]},"---",{group:"script",buttons:[]},{group:"media",buttons:[]},"\n",{group:"state",buttons:[]},{group:"clipboard",buttons:[]},{group:"insert",buttons:[]},{group:"indent",buttons:[]},{group:"color",buttons:[]},{group:"form",buttons:[]},"---",{group:"history",buttons:[]},{group:"search",buttons:[]},{group:"source",buttons:[]},{group:"other",buttons:[]},{group:"info",buttons:[]}],this.buttonsMD=["bold","italic","|","ul","ol","eraser","|","font","fontsize","---","image","table","|","link","\n","brush","paragraph","align","|","hr","copyformat","fullsize","---","undo","redo","|","dots"],this.buttonsSM=["bold","italic","|","ul","ol","eraser","|","fontsize","brush","paragraph","---","image","table","\n","link","|","align","|","undo","redo","|","copyformat","fullsize","---","dots"],this.buttonsXS=["bold","brush","paragraph","eraser","|","fontsize","---","image","\n","align","undo","redo","|","link","table","---","dots"],this.events={},this.textIcons=!1,this.showBrowserColorPicker=!0}static get defaultOptions(){return s.__defaultOptions||(s.__defaultOptions=new s),s.__defaultOptions}}s.prototype.controls={}},(e,t,i)=>{"use strict";i.r(t),i.d(t,{ACCURACY:()=>z,BASE_PATH:()=>Y,BR:()=>j,COMMAND_KEYS:()=>T,EMULATE_DBLCLICK_TIMEOUT:()=>B,INSEPARABLE_TAGS:()=>p,INSERT_AS_HTML:()=>H,INSERT_AS_TEXT:()=>F,INSERT_CLEAR_HTML:()=>O,INSERT_ONLY_TEXT:()=>W,INVISIBLE_SPACE:()=>o,INVISIBLE_SPACE_REG_EXP:()=>r,INVISIBLE_SPACE_REG_EXP_END:()=>n,INVISIBLE_SPACE_REG_EXP_START:()=>a,IS_BLOCK:()=>h,IS_IE:()=>P,IS_INLINE:()=>u,IS_MAC:()=>U,KEY_ALIASES:()=>$,KEY_BACKSPACE:()=>f,KEY_DELETE:()=>E,KEY_DOWN:()=>C,KEY_ENTER:()=>v,KEY_ESC:()=>b,KEY_F3:()=>I,KEY_LEFT:()=>y,KEY_RIGHT:()=>k,KEY_SPACE:()=>S,KEY_TAB:()=>g,KEY_UP:()=>w,MARKER_CLASS:()=>q,MAY_BE_REMOVED_WITH_KEY:()=>m,MODE_SOURCE:()=>M,MODE_SPLIT:()=>D,MODE_WYSIWYG:()=>A,NBSP_SPACE:()=>s,NEARBY:()=>x,PARAGRAPH:()=>L,SAFE_COUNT_CHANGE_CALL:()=>V,SPACE_REG_EXP:()=>l,SPACE_REG_EXP_END:()=>d,SPACE_REG_EXP_START:()=>c,TEMP_ATTR:()=>K,TEXT_HTML:()=>R,TEXT_PLAIN:()=>_,TEXT_RTF:()=>N});const o="\ufeff",s=" ",r=()=>/[\uFEFF]/g,n=()=>/[\uFEFF]+$/g,a=()=>/^[\uFEFF]+/g,l=()=>/[\s\n\t\r\uFEFF\u200b]+/g,c=()=>/^[\s\n\t\r\uFEFF\u200b]+/g,d=()=>/[\s\n\t\r\uFEFF\u200b]+$/g,h=/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CANVAS|DD|DFN|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[1-6]|HEADER|HGROUP|HR|LI|MAIN|NAV|NOSCRIPT|OUTPUT|P|PRE|RUBY|SCRIPT|STYLE|OBJECT|OL|SECTION|IFRAME|JODIT|JODIT-MEDIA|UL|TR|TD|TH|TBODY|THEAD|TFOOT|TABLE|BODY|HTML|VIDEO)$/i,u=/^(STRONG|SPAN|I|EM|B|SUP|SUB|A|U)$/i,p=["img","br","video","iframe","script","input","textarea","hr","link","jodit","jodit-media"],m=RegExp(`^${p.join("|")}$`,"i"),f="Backspace",g="Tab",v="Enter",b="Escape",y="ArrowLeft",w="ArrowUp",k="ArrowRight",C="ArrowDown",S="Space",E="Delete",I="F3",x=5,z=10,T=[f,E,w,C,k,y,v,b,I,g],j="br",L="p",A=1,M=2,D=3,P="undefined"!=typeof navigator&&(-1!==navigator.userAgent.indexOf("MSIE")||/rv:11.0/i.test(navigator.userAgent)),_=P?"text":"text/plain",R=P?"html":"text/html",N=P?"rtf":"text/rtf",q="jodit-selection_marker",B=300,H="insert_as_html",O="insert_clear_html",F="insert_as_text",W="insert_only_text",V=10,U="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),$={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:U?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Y=(()=>{if("undefined"==typeof document)return"";const e=document.currentScript,t=e=>{const t=e.split("/");return/\.js/.test(t[t.length-1])?t.slice(0,t.length-1).join("/")+"/":e};if(e)return t(e.src);const i=document.querySelectorAll("script[src]");return i&&i.length?t(i[i.length-1].src):window.location.href})(),K="data-jodit-temp"},function(e,t,i){"use strict";i.d(t,{vp:()=>c,DG:()=>s,aN:()=>d.a,rO:()=>o,LO:()=>f});const o="JoditEventDefaultNamespace";class s{constructor(){this.__store={}}get(e,t){if(void 0!==this.__store[t])return this.__store[t][e]}indexOf(e,t,i){const o=this.get(e,t);if(o)for(let e=0;o.length>e;e+=1)if(o[e].originalCallback===i)return e;return!1}namespaces(e=!1){const t=Object.keys(this.__store);return e?t.filter((e=>e!==o)):t}events(e){return this.__store[e]?Object.keys(this.__store[e]):[]}set(e,t,i,o=!1){void 0===this.__store[t]&&(this.__store[t]={}),void 0===this.__store[t][e]&&(this.__store[t][e]=[]),o?this.__store[t][e].unshift(i):this.__store[t][e].push(i)}clear(){this.__store={}}}var r=i(5),n=i(6),a=i(7),l=i(4);class c{constructor(e){this.mutedEvents=new Set,this.__key="__JoditEventEmitterNamespaces",this.doc=document,this.prepareEvent=e=>{e.cancelBubble||(e.type.match(/^touch/)&&e.changedTouches&&e.changedTouches.length&&["clientX","clientY","pageX","pageY"].forEach((t=>{Object.defineProperty(e,t,{value:e.changedTouches[0][t],configurable:!0,enumerable:!0})})),e.originalEvent||(e.originalEvent=e),"paste"===e.type&&void 0===e.clipboardData&&this.doc.defaultView.clipboardData&&Object.defineProperty(e,"clipboardData",{get:()=>this.doc.defaultView.clipboardData,configurable:!0,enumerable:!0}))},this.currents=[],this.__stopped=[],this.isDestructed=!1,e&&(this.doc=e),this.__key+=(new Date).getTime()}mute(e){return this.mutedEvents.add(null!=e?e:"*"),this}isMuted(e){return!(!e||!this.mutedEvents.has(e))||this.mutedEvents.has("*")}unmute(e){return this.mutedEvents.delete(null!=e?e:"*"),this}eachEvent(e,t){e.split(/[\s,]+/).forEach((e=>{const i=e.split(".");t.call(this,i[0],i[1]||o)}))}getStore(e){if(!e)throw(0,l.v)("Need subject");if(void 0===e[this.__key]){const t=new s;Object.defineProperty(e,this.__key,{enumerable:!1,configurable:!0,value:t})}return e[this.__key]}clearStore(e){void 0!==e[this.__key]&&delete e[this.__key]}triggerNativeEvent(e,t){const i=this.doc.createEvent("HTMLEvents");"string"==typeof t?i.initEvent(t,!0,!0):(i.initEvent(t.type,t.bubbles,t.cancelable),["screenX","screenY","clientX","clientY","target","srcElement","currentTarget","timeStamp","which","keyCode"].forEach((e=>{Object.defineProperty(i,e,{value:t[e],enumerable:!0})})),Object.defineProperty(i,"originalEvent",{value:t,enumerable:!0})),e.dispatchEvent(i)}get current(){return this.currents[this.currents.length-1]}on(e,t,i,o=!1){const s=(0,r.H)(e)?this:e,c=(0,r.H)(t)?t:e;let d=i;void 0===d&&(0,n.m)(t)&&(d=t);const h=this.getStore(s);if(!(0,r.H)(c)||""===c)throw(0,l.v)("Need events names");if(!(0,n.m)(d))throw(0,l.v)("Need event handler");if((0,a.k)(s))return s.forEach((e=>{this.on(e,c,d,o)})),this;const u=(0,n.m)(s.addEventListener),p=this;let m=function(e,...t){if(!p.isMuted(e))return d&&d.call(this,...t)};return u&&(m=function(e){if(!p.isMuted(e.type))return p.prepareEvent(e),d&&!1===d.call(this,e)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}),this.eachEvent(c,((e,t)=>{if(""===e)throw(0,l.v)("Need event name");if(!1===h.indexOf(e,t,d)&&(h.set(e,t,{event:e,originalCallback:d,syntheticCallback:m},o),u)){const t=!!["touchstart","touchend","scroll","mousewheel","mousemove","touchmove"].includes(e)&&{passive:!0};s.addEventListener(e,m,t)}})),this}one(e,t,i,o=!1){const s=(0,r.H)(e)?this:e,a=(0,r.H)(t)?t:e;let l=i;void 0===l&&(0,n.m)(t)&&(l=t);const c=(...e)=>(this.off(s,a,c),l(...e));return this.on(s,a,c,o),this}off(e,t,i){const s=(0,r.H)(e)?this:e,a=(0,r.H)(t)?t:e,l=this.getStore(s);let c=i;if(!(0,r.H)(a)||!a)return l.namespaces().forEach((e=>{this.off(s,"."+e)})),this.clearStore(s),this;void 0===c&&(0,n.m)(t)&&(c=t);const d=(0,n.m)(s.removeEventListener),h=e=>{d&&s.removeEventListener(e.event,e.syntheticCallback,!1)},u=(e,t)=>{if(""!==e){const i=l.get(e,t);if(i&&i.length)if((0,n.m)(c)){const o=l.indexOf(e,t,c);!1!==o&&(h(i[o]),i.splice(o,1))}else i.forEach(h),i.length=0}else l.events(t).forEach((e=>{""!==e&&u(e,t)}))};return this.eachEvent(a,((e,t)=>{t===o?l.namespaces().forEach((t=>{u(e,t)})):u(e,t)})),this}stopPropagation(e,t){const i=(0,r.H)(e)?this:e,s=(0,r.H)(e)?e:t;if("string"!=typeof s)throw(0,l.v)("Need event names");const n=this.getStore(i);this.eachEvent(s,((e,t)=>{const s=n.get(e,t);s&&this.__stopped.push(s),t===o&&n.namespaces(!0).forEach((t=>this.stopPropagation(i,e+"."+t)))}))}removeStop(e){if(e){const t=this.__stopped.indexOf(e);-1!==t&&this.__stopped.splice(0,t+1)}}isStopped(e){return void 0!==e&&-1!==this.__stopped.indexOf(e)}fire(e,t,...i){let s,a;const c=(0,r.H)(e)?this:e,d=(0,r.H)(e)?e:t,h=(0,r.H)(e)?[t,...i]:i,u=(0,n.m)(c.dispatchEvent);if(!u&&!(0,r.H)(d))throw(0,l.v)("Need events names");const p=this.getStore(c);return!(0,r.H)(d)&&u?this.triggerNativeEvent(c,t):this.eachEvent(d,((e,t)=>{if(u)this.triggerNativeEvent(c,e);else{const i=p.get(e,t);if(i)try{[...i].every((t=>!this.isStopped(i)&&(this.currents.push(e),a=t.syntheticCallback.call(c,e,...h),this.currents.pop(),void 0!==a&&(s=a),!0)))}finally{this.removeStop(i)}t!==o||u||p.namespaces().filter((e=>e!==t)).forEach((t=>{const i=this.fire.call(this,c,e+"."+t,...h);void 0!==i&&(s=i)}))}})),s}destruct(){this.isDestructed&&(this.isDestructed=!0,this.off(this),this.getStore(this).clear(),delete this[this.__key])}}var d=i(8),h=i(9),u=i(19);const p=Symbol("observable-object");function m(e){return void 0!==e[p]}function f(e){if(m(e))return e;const t={},i={},o=(t,s)=>(0,h.isArray)(t)?(t.map((e=>o(e,s))),e):(i[t]||(i[t]=[]),i[t].push(s),e),s=(o,...r)=>{if((0,h.isArray)(o))o.map((e=>s(e,...r)));else try{!t[o]&&i[o]&&(t[o]=!0,i[o].forEach((t=>t.call(e,...r))))}finally{t[o]=!1}},r=(t,i=[])=>{const n={};m(t)||(Object.defineProperty(t,p,{enumerable:!1,value:!0}),Object.keys(t).forEach((o=>{const a=o,l=i.concat(a).filter((e=>e.length));n[a]=t[a];const c=(0,u.getPropertyDescriptor)(t,a);Object.defineProperty(t,a,{set(t){const i=n[a];if(!(0,h.isFastEqual)(n[a],t)){s(["beforeChange","beforeChange."+l.join(".")],a,t),(0,h.isPlainObject)(t)&&r(t,l),c&&c.set?c.set.call(e,t):n[a]=t;const o=[];s(["change",...l.reduce(((e,t)=>(o.push(t),e.push("change."+o.join(".")),e)),[])],l.join("."),i,(null==t?void 0:t.valueOf)?t.valueOf():t)}},get:()=>c&&c.get?c.get.call(e):n[a],enumerable:!0,configurable:!0}),(0,h.isPlainObject)(n[a])&&r(n[a],l)})),Object.defineProperty(e,"on",{value:o}))};return r(e),e}},(e,t,i)=>{"use strict";function o(e){return new TypeError(e)}i.d(t,{v:()=>o})},(e,t,i)=>{"use strict";function o(e){return"string"==typeof e}i.d(t,{H:()=>o})},(e,t,i)=>{"use strict";function o(e){return"function"==typeof e}i.d(t,{m:()=>o})},(e,t,i)=>{"use strict";function o(e){return Array.isArray(e)}i.d(t,{k:()=>o})},function(e,t,i){"use strict";i.d(t,{a:()=>o});class o{constructor(){this.map=new Map}on(e,t){var i;return this.map.has(e)||this.map.set(e,new Set),null===(i=this.map.get(e))||void 0===i||i.add(t),this}off(e,t){var i;return this.map.has(e)&&(null===(i=this.map.get(e))||void 0===i||i.delete(t)),this}emit(e,...t){var i;let o;return this.map.has(e)&&(null===(i=this.map.get(e))||void 0===i||i.forEach((e=>{o=e(...t)}))),o}}},(e,t,i)=>{"use strict";i.r(t),i.d(t,{$$:()=>o.$$,CamelCaseToKebabCase:()=>c.gP,ConfigFlatten:()=>o.tp,ConfigProto:()=>o.II,LimitedStack:()=>o.lI,appendScript:()=>o.uR,appendScriptAsync:()=>o.JL,appendStyleAsync:()=>o.Nf,applyStyles:()=>h,asArray:()=>s._2,assert:()=>o.hu,attr:()=>o.Lj,browser:()=>o.Xh,buildQuery:()=>o.XP,call:()=>o.RE,callPromise:()=>o.C6,camelCase:()=>c.eV,cleanFromWord:()=>m,clearCenterAlign:()=>o.bI,clearTimeout:()=>r.g,cns:()=>o.H5,colorToHex:()=>a.h,completeUrl:()=>o.WO,convertMediaUrlToVideoEmbed:()=>o.UU,css:()=>o.iv,cssPath:()=>o.iN,ctrlKey:()=>o.kT,dataBind:()=>o.qI,defaultLanguage:()=>o.X9,error:()=>o.vU,fastClone:()=>o.V8,fuzzySearchIndex:()=>c.Qy,get:()=>o.U2,getClassName:()=>o.gj,getContentWidth:()=>k,getScrollParent:()=>C,getXPathByElement:()=>o.BR,hasBrowserColorPicker:()=>n.EO,hasContainer:()=>n.Zt,htmlspecialchars:()=>f,humanSizeToBytes:()=>o.wx,i18n:()=>c.ag,inView:()=>o.jF,innerWidth:()=>S,isArray:()=>n.kJ,isAtom:()=>o.J8,isBoolean:()=>n.jn,isDestructable:()=>n.Z$,isEqual:()=>n.Xy,isFastEqual:()=>n.LP,isFunction:()=>n.mf,isHTML:()=>n.FP,isHtmlFromWord:()=>n.I4,isInitable:()=>n.Gu,isInt:()=>n.GN,isJoditObject:()=>n.Zu,isLicense:()=>n.A1,isNativeFunction:()=>n.QC,isNumber:()=>n.hj,isNumeric:()=>n.kE,isPlainObject:()=>n.PO,isPromise:()=>n.tI,isString:()=>n.HD,isURL:()=>n.PX,isValidName:()=>n.r1,isViewObject:()=>n.f2,isVoid:()=>n.nj,isWindow:()=>n.FJ,kebabCase:()=>c.GL,keepNames:()=>o.kc,keys:()=>o.am,loadImage:()=>o.po,loadNext:()=>o.wY,loadNextStyle:()=>o.GX,markAsAtomic:()=>o.XT,markDeprecated:()=>o.Q8,markOwner:()=>o.MN,memorizeExec:()=>o.u3,nl2br:()=>y,normalizeColor:()=>w.ut,normalizeCssValue:()=>w.Zh,normalizeKeyAliases:()=>w.T2,normalizeLicense:()=>w.Pd,normalizeNode:()=>w.Tz,normalizePath:()=>w.AH,normalizeRelativePath:()=>w.Jf,normalizeSize:()=>w.aC,normalizeUrl:()=>w.D5,offset:()=>E,parseQuery:()=>o.mB,position:()=>I,refs:()=>o.xL,reset:()=>o.mc,resolveElement:()=>o.W2,safeHTML:()=>b,scrollIntoViewIfNeeded:()=>o.n5,set:()=>o.t8,setTimeout:()=>r.i,size:()=>x,splitArray:()=>s.C1,sprintf:()=>c.gB,stringify:()=>c.Pz,stripTags:()=>v,toArray:()=>s.qo,trim:()=>c.fy,trimInv:()=>c.as,ucfirst:()=>c.Ps,val:()=>o.P0});var o=i(10),s=i(43),r=i(56),n=i(20),a=i(40),l=i(16),c=i(34);function d(e){return e.replace(/mso-[a-z-]+:[\s]*[^;]+;/gi,"").replace(/mso-[a-z-]+:[\s]*[^";']+$/gi,"").replace(/border[a-z-]*:[\s]*[^;]+;/gi,"").replace(/([0-9.]+)(pt|cm)/gi,((e,t,i)=>{switch(i.toLowerCase()){case"pt":return(1.328*parseFloat(t)).toFixed(0)+"px";case"cm":return(.02645833*parseFloat(t)).toFixed(0)+"px"}return e}))}function h(e){if(-1===e.indexOf("")+7);const t=document.createElement("iframe");t.style.display="none",document.body.appendChild(t);let i="",s=[];try{const r=t.contentDocument||(t.contentWindow?t.contentWindow.document:null);if(r){r.open(),r.write(e),r.close();try{for(let e=0;r.styleSheets.length>e;e+=1){const t=r.styleSheets[e].cssRules;for(let e=0;t.length>e;e+=1)""!==t[e].selectorText&&(s=(0,o.$$)(t[e].selectorText,r.body),s.forEach((i=>{i.style.cssText=d(t[e].style.cssText+";"+i.style.cssText)})))}}catch(e){}l.i.each(r.body,(e=>{if(l.i.isElement(e)){const t=e,i=t.getAttribute("style");i&&(t.style.cssText=d(i)),t.hasAttribute("style")&&!t.getAttribute("style")&&t.removeAttribute("style")}})),i=r.firstChild?(0,c.fy)(r.body.innerHTML):""}}catch(e){}finally{l.i.safeRemove(t)}return i&&(e=i),(0,c.fy)(e.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g,"").replace(//i);-1!==t&&(e=e.substring(t+20));const i=e.search(//i);return-1!==i&&(e=e.substring(0,i)),e})(i)),t.s.insertHTML(i)}function yt(e,t,i,o,s){if(!1===e.e.fire("beforeOpenPasteDialog",t,i,o,s))return;const r=Y(`
${e.i18n(t)}
`,e.i18n(i));r.bindDestruct(e),(0,gt.MN)(e,r.container);const n=s.map((({text:t,value:i})=>(0,P.zx)(e,{text:t,name:t.toLowerCase(),tabIndex:0}).onAction((()=>o(i))))),a=(0,P.zx)(e,{text:"Cancel",tabIndex:0});return r.setFooter([...n,a].map((e=>e.onAction((()=>r.close()))))),n[0].focus(),n[0].state.variant="primary",e.e.fire("afterOpenPasteDialog",r,t,i,o,s),r}const wt="clipboard";class kt{constructor(){this.buttons=[{name:"cut",group:"clipboard"},{name:"copy",group:"clipboard"},{name:"paste",group:"clipboard"},{name:"selectall",group:"clipboard"}]}init(e){var t;null===(t=this.buttons)||void 0===t||t.forEach((t=>e.registerButton(t))),e.e.off("copy.clipboard cut.clipboard").on("copy.clipboard cut.clipboard",(t=>{var i;const o=e.s.html,s=vt(t)||vt(e.ew)||vt(t.originalEvent);s&&(s.setData(a.TEXT_PLAIN,(0,g.stripTags)(o)),s.setData(a.TEXT_HTML,o)),e.buffer.set(wt,o),e.e.fire("pasteStack",{html:o,action:e.o.defaultActionOnPaste}),"cut"===t.type&&(e.s.remove(),e.s.focus()),t.preventDefault(),null===(i=null==e?void 0:e.events)||void 0===i||i.fire("afterCopy",o)}))}destruct(e){var t,i;null===(t=null==e?void 0:e.buffer)||void 0===t||t.set(wt,""),null===(i=null==e?void 0:e.events)||void 0===i||i.off(".clipboard")}}n.D.prototype.askBeforePasteHTML=!0,n.D.prototype.processPasteHTML=!0,n.D.prototype.pasteHTMLActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Insert as Text"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}],n.D.prototype.memorizeChoiceWhenPasteFragment=!1,n.D.prototype.nl2brInPlainText=!0,n.D.prototype.defaultActionOnPaste=a.INSERT_AS_HTML,n.D.prototype.draggableTags=["img","jodit-media","jodit"];const Ct="pasteStorage";n.D.prototype.controls.paste={tooltip:"Paste from clipboard",async exec(e,t,{control:i}){if(i.name===Ct)return void e.execCommand("showPasteStorage");e.s.focus();let o="",s=!0;if(navigator.clipboard){try{const e=await navigator.clipboard.read();if(e&&e.length){const t=await e[0].getType(a.TEXT_PLAIN);o=await new Response(t).text()}s=!1}catch(e){}if(s)try{o=await navigator.clipboard.readText(),s=!1}catch(e){}}s&&(o=e.buffer.get(wt)||"",s=0===o.length);const r=e.value;s?(e.ed.execCommand("paste"),s=r===e.value,!s&&e.e.fire("afterPaste")):o.length?(bt(null,e,o),e.e.fire("afterPaste")):s&&U(e.i18n("Your browser doesn't support direct access to the clipboard."),(()=>{e.s.focus()})).bindDestruct(e)},list:{[Ct]:"Paste Storage"},isChildDisabled(e){return 2>e.e.fire("pasteStorageList")}};class St extends G{constructor(){super(...arguments),this.pasteStack=new g.LimitedStack(20)}afterInit(e){e.e.on("paste.paste",this.onPaste).on("pasteStack.paste",(e=>this.pasteStack.push(e))),e.o.nl2brInPlainText&&this.j.e.on("processPaste.paste",this.onProcessPasteReplaceNl2Br)}onPaste(e){try{if(!1===this.customPasteProcess(e)||!1===this.j.e.fire("beforePaste",e))return e.preventDefault(),!1;this.defaultPasteProcess(e)}finally{this.j.e.fire("afterPaste",e)}}customPasteProcess(e){if(!this.j.o.processPasteHTML)return;const t=vt(e),i={html:null==t?void 0:t.getData(a.TEXT_HTML),plain:null==t?void 0:t.getData(a.TEXT_PLAIN),rtf:null==t?void 0:t.getData(a.TEXT_RTF)};let o;for(o in i){const t=i[o];if((0,g.isHTML)(t)&&(this.j.e.fire("processHTML",e,t,i)||this.processHTML(e,t)))return!1}}defaultPasteProcess(e){const t=vt(e);let i=(null==t?void 0:t.getData(a.TEXT_HTML))||(null==t?void 0:t.getData(a.TEXT_PLAIN));if(t&&i&&""!==(0,g.trim)(i)){const o=this.j.e.fire("processPaste",e,i,(e=>{const t=e.types;let i="";if((0,C.kJ)(t)||"[object DOMStringList]"==={}.toString.call(t))for(let e=0;t.length>e;e+=1)i+=t[e]+";";else i=(t||a.TEXT_PLAIN)+";";return i})(t));void 0!==o&&(i=o),((0,g.isString)(i)||D.i.isNode(i))&&this.insertByType(e,i,this.j.o.defaultActionOnPaste),e.preventDefault(),e.stopPropagation()}}processHTML(e,t){if(this.j.o.askBeforePasteHTML){if(this.j.o.memorizeChoiceWhenPasteFragment){const i=this.pasteStack.find((e=>e.html===t));if(i)return this.insertByType(e,t,i.action||this.j.o.defaultActionOnPaste),!0}return yt(this.j,"Your code is similar to HTML. Keep as HTML?","Paste as HTML",(i=>{this.insertByType(e,t,i)}),this.j.o.pasteHTMLActionList),!0}return!1}insertByType(e,t,i){if(this.pasteStack.push({html:t,action:i}),(0,g.isString)(t))switch(this.j.buffer.set(wt,t),i){case a.INSERT_CLEAR_HTML:t=(0,g.cleanFromWord)(t);break;case a.INSERT_ONLY_TEXT:t=(0,g.stripTags)(t);break;case a.INSERT_AS_TEXT:t=(0,g.htmlspecialchars)(t)}bt(e,this.j,t)}onProcessPasteReplaceNl2Br(e,t,i){if(i===a.TEXT_PLAIN+";"&&!(0,g.isHTML)(t))return(0,g.nl2br)(t)}beforeDestruct(e){e.e.off("paste.paste",this.onPaste)}}(0,r.gn)([L.autobind],St.prototype,"onPaste",null),(0,r.gn)([L.autobind],St.prototype,"onProcessPasteReplaceNl2Br",null),n.D.prototype.askBeforePasteFromWord=!0,n.D.prototype.processPasteFromWord=!0,n.D.prototype.defaultActionOnPasteFromWord=null,n.D.prototype.pasteFromWordActionList=[{value:a.INSERT_AS_HTML,text:"Keep"},{value:a.INSERT_AS_TEXT,text:"Clean"},{value:a.INSERT_ONLY_TEXT,text:"Insert only Text"}];class Et extends G{afterInit(e){}beforeDestruct(e){}processWordHTML(e,t,i){const{j:o}=this,{processPasteFromWord:s,askBeforePasteFromWord:r,defaultActionOnPasteFromWord:n,defaultActionOnPaste:a,pasteFromWordActionList:l}=o.o;return!(!s||!(0,g.isHtmlFromWord)(t)||(r?yt(o,"The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","Word Paste Detected",(o=>{this.insertFromWordByType(e,t,o,i)}),l):this.insertFromWordByType(e,t,n||a,i),0))}insertFromWordByType(e,t,i,o){var s;switch(i){case a.INSERT_AS_HTML:if(t=(0,g.applyStyles)(t),this.j.o.beautifyHTML){const e=null===(s=this.j.events)||void 0===s?void 0:s.fire("beautifyHTML",t);(0,g.isString)(e)&&(t=e)}break;case a.INSERT_AS_TEXT:t=(0,g.cleanFromWord)(t);break;case a.INSERT_ONLY_TEXT:t=(0,g.stripTags)((0,g.cleanFromWord)(t))}bt(e,this.j,t)}}(0,r.gn)([(0,L.watch)(":processHTML")],Et.prototype,"processWordHTML",null);class It extends G{constructor(){super(...arguments),this.currentIndex=0,this.list=[],this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.paste=()=>{if(this.j.s.focus(),this.j.s.insertHTML(this.list[this.currentIndex]),0!==this.currentIndex){const e=this.list[0];this.list[0]=this.list[this.currentIndex],this.list[this.currentIndex]=e}this.dialog&&this.dialog.close(),this.j.synchronizeValues(),this.j.e.fire("afterPaste")},this.onKeyDown=e=>{let t=this.currentIndex;-1!==[a.KEY_UP,a.KEY_DOWN,a.KEY_ENTER].indexOf(e.key)&&(e.key===a.KEY_UP&&(0===t?t=this.list.length-1:t-=1),e.key===a.KEY_DOWN&&(t===this.list.length-1?t=0:t+=1),e.key!==a.KEY_ENTER?(t!==this.currentIndex&&this.selectIndex(t),e.stopImmediatePropagation(),e.preventDefault()):this.paste())},this.selectIndex=e=>{this.listBox&&(0,g.toArray)(this.listBox.childNodes).forEach(((t,i)=>{t.classList.remove("jodit_active"),e===i&&this.previewBox&&(t.classList.add("jodit_active"),this.previewBox.innerHTML=this.list[e],t.focus())})),this.currentIndex=e},this.showDialog=()=>{2>this.list.length||(this.dialog||this.createDialog(),this.listBox&&(this.listBox.innerHTML=""),this.previewBox&&(this.previewBox.innerHTML=""),this.list.forEach(((e,t)=>{const i=this.j.c.element("a");i.textContent=t+1+". "+e.replace((0,a.SPACE_REG_EXP)(),""),this.j.e.on(i,"keydown",this.onKeyDown),(0,g.attr)(i,"href","#"),(0,g.attr)(i,"data-index",""+t),(0,g.attr)(i,"tab-index","-1"),this.listBox&&this.listBox.appendChild(i)})),this.dialog&&this.dialog.open(),this.j.async.setTimeout((()=>{this.selectIndex(0)}),100))}}createDialog(){this.dialog=new V({language:this.j.o.language});const e=(0,P.zx)(this.j,"paste","Paste","primary");e.onAction(this.paste);const t=(0,P.zx)(this.j,"","Cancel");t.onAction(this.dialog.close),this.container=this.j.c.div(),this.container.classList.add("jodit-paste-storage"),this.listBox=this.j.c.div(),this.previewBox=this.j.c.div(),this.container.appendChild(this.listBox),this.container.appendChild(this.previewBox),this.dialog.setHeader(this.j.i18n("Choose Content to Paste")),this.dialog.setContent(this.container),this.dialog.setFooter([e,t]),this.j.e.on(this.listBox,"click dblclick",(e=>{const t=e.target;return D.i.isTag(t,"a")&&t.hasAttribute("data-index")&&this.selectIndex(parseInt((0,g.attr)(t,"-index")||"0",10)),"dblclick"===e.type&&this.paste(),!1}))}afterInit(){this.j.e.off("afterCopy.paste-storage").on("pasteStorageList.paste-storage",(()=>this.list.length)).on("afterCopy.paste-storage",(e=>{-1!==this.list.indexOf(e)&&this.list.splice(this.list.indexOf(e),1),this.list.unshift(e),this.list.length>5&&(this.list.length=5)})),this.j.registerCommand("showPasteStorage",{exec:this.showDialog,hotkeys:["ctrl+shift+v","cmd+shift+v"]})}beforeDestruct(){this.dialog&&this.dialog.destruct(),this.j.e.off(".paste-storage"),D.i.safeRemove(this.previewBox),D.i.safeRemove(this.listBox),D.i.safeRemove(this.container),this.container=null,this.listBox=null,this.previewBox=null,this.dialog=null,this.list=[]}}const xt="copyformat",zt=["fontWeight","fontStyle","fontSize","color","margin","padding","borderWidth","borderStyle","borderColor","borderRadius","backgroundColor","textDecorationLine","fontFamily"],Tt=(e,t,i,o)=>{let s=(0,g.css)(i,t);return s===o[t]&&(s=i.parentNode&&i!==e.editor&&i.parentNode!==e.editor?Tt(e,t,i.parentNode,o):void 0),s};function jt(e){e.registerButton({name:"copyformat",group:"clipboard"})}n.D.prototype.controls.copyformat={exec(e,t,{button:i}){if(t){if(e.buffer.exists(xt))e.buffer.delete(xt),e.e.off(e.editor,"mouseup.copyformat");else{const i={},o=D.i.up(t,(e=>e&&!D.i.isText(e)),e.editor)||e.editor,s=e.createInside.span();e.editor.appendChild(s),zt.forEach((e=>{i[e]=(0,g.css)(s,e)})),s!==e.editor&&D.i.safeRemove(s);const r=((e,t,i)=>{const o={};return t&&zt.forEach((s=>{o[s]=Tt(e,s,t,i),s.match(/border(Style|Color)/)&&!o.borderWidth&&(o[s]=void 0)})),o})(e,o,i),n=()=>{e.buffer.delete(xt);const t=e.s.current();t&&(D.i.isTag(t,"img")?(0,g.css)(t,r):e.s.applyStyle(r)),e.e.off(e.editor,"mouseup.copyformat")};e.e.on(e.editor,"mouseup.copyformat",n),e.buffer.set(xt,!0)}i.update()}},isActive:e=>e.buffer.exists(xt),tooltip:"Paint format"};var Lt,At=i(77);function Mt(e){e.registerButton({name:"brush",group:"color"});const t=(t,i,o)=>{const s=(0,g.normalizeColor)(o);switch(t){case"background":e.s.applyStyle({backgroundColor:s||""});break;case"forecolor":e.s.applyStyle({color:s||""})}return e.synchronizeValues(),!1};e.registerCommand("forecolor",t).registerCommand("background",t)}n.D.prototype.controls.brush={update(e){const t=(0,g.dataBind)(e,"color"),i=e.j,o=(t,o)=>{o&&o!==""+(0,g.css)(i.editor,t)&&(e.state.icon.fill=o)};if(t){const i=(0,g.dataBind)(e,"color");return void o("color"===i?i:"background-color",t)}const s=i.s.current();if(s&&!e.state.disabled){const e=D.i.closest(s,D.i.isElement,i.editor)||i.editor;o("color",""+(0,g.css)(e,"color")),o("background-color",""+(0,g.css)(e,"background-color"))}e.state.icon.fill="",e.state.activated=!1},popup(e,t,i,o,s){let r="",n="",a=[],l=null;return t&&t!==e.editor&&D.i.isNode(t)&&(D.i.isElement(t)&&e.s.isCollapsed()&&!D.i.isTag(t,["br","hr"])&&(l=t),D.i.up(t,(e=>{if(D.i.isHTMLElement(e)){const t=(0,g.css)(e,"color",!0),i=(0,g.css)(e,"background-color",!0);if(t)return r=""+t,!0;if(i)return n=""+i,!0}}),e.editor)),a=[{name:"Background",content:(0,At.YW)(e,(t=>{l?l.style.backgroundColor=t:e.execCommand("background",!1,t),(0,g.dataBind)(s,"color",t),(0,g.dataBind)(s,"color-mode","background"),o()}),n)},{name:"Text",content:(0,At.YW)(e,(t=>{l?l.style.color=t:e.execCommand("forecolor",!1,t),(0,g.dataBind)(s,"color",t),(0,g.dataBind)(s,"color-mode","color"),o()}),r)}],"background"!==e.o.colorPickerDefaultTab&&(a=a.reverse()),(0,At.IL)(e,a,l)},exec(e,t,{button:i}){const o=(0,g.dataBind)(i,"color-mode"),s=(0,g.dataBind)(i,"color");if(!o)return!1;if(t&&t!==e.editor&&D.i.isNode(t)&&D.i.isElement(t))switch(o){case"color":t.style.color=s;break;case"background":t.style.backgroundColor=s}else e.execCommand("background"===o?o:"forecolor",!1,s)},tooltip:"Fill color or set the text color"};class Dt extends G{constructor(){super(...arguments),this.isFragmentFromEditor=!1,this.isCopyMode=!1,this.startDragPoint={x:0,y:0},this.draggable=null,this.bufferRange=null,this.getText=e=>{const t=vt(e);return t?t.getData(a.TEXT_HTML)||t.getData(a.TEXT_PLAIN):null}}afterInit(){this.j.e.on([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}onDragStart(e){let t=e.target;if(this.onDragEnd(),this.isFragmentFromEditor=D.i.isOrContains(this.j.editor,t,!0),this.isCopyMode=!this.isFragmentFromEditor||(0,g.ctrlKey)(e),this.isFragmentFromEditor){const e=this.j.s.sel,t=e&&e.rangeCount?e.getRangeAt(0):null;t&&(this.bufferRange=t.cloneRange())}else this.bufferRange=null;this.startDragPoint.x=e.clientX,this.startDragPoint.y=e.clientY,ze(t)&&(t=t.querySelector("img")),D.i.isTag(t,"img")&&(this.draggable=t.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",t)),this.addDragListeners()}addDragListeners(){this.j.e.on("dragover",this.onDrag).on("drop.DragAndDrop",this.onDrop).on(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}removeDragListeners(){this.j.e.off("dragover",this.onDrag).off("drop.DragAndDrop",this.onDrop).off(window,"dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop",this.onDragEnd)}onDrag(e){this.draggable&&(this.j.e.fire("hidePopup"),this.j.s.insertCursorAtPoint(e.clientX,e.clientY),e.preventDefault(),e.stopPropagation())}onDragEnd(){this.draggable&&(D.i.safeRemove(this.draggable),this.draggable=null),this.isCopyMode=!1,this.removeDragListeners()}onDrop(e){if(!e.dataTransfer||!e.dataTransfer.files||!e.dataTransfer.files.length){if(!this.isFragmentFromEditor&&!this.draggable)return this.j.e.fire("paste",e),e.preventDefault(),e.stopPropagation(),!1;const t=this.j.s.sel,i=this.bufferRange||(t&&t.rangeCount?t.getRangeAt(0):null);let o=null;if(!this.draggable&&i)o=this.isCopyMode?i.cloneContents():i.extractContents();else if(this.draggable)if(this.isCopyMode){const[e,t]="1"===(0,g.attr)(this.draggable,"-is-file")?["a","href"]:["img","src"];o=this.j.createInside.element(e),o.setAttribute(t,(0,g.attr)(this.draggable,"data-src")||(0,g.attr)(this.draggable,"src")||""),"a"===e&&(o.textContent=(0,g.attr)(o,t)||"")}else o=(0,g.dataBind)(this.draggable,"target");else this.getText(e)&&(o=this.j.createInside.fromHTML(this.getText(e)));t&&t.removeAllRanges(),this.j.s.insertCursorAtPoint(e.clientX,e.clientY),o&&(this.j.s.insertNode(o,!1,!1),i&&o.firstChild&&o.lastChild&&(i.setStartBefore(o.firstChild),i.setEndAfter(o.lastChild),this.j.s.selectRange(i),this.j.e.fire("synchro")),D.i.isTag(o,"img")&&this.j.events&&this.j.e.fire("afterInsertImage",o)),e.preventDefault(),e.stopPropagation()}this.isFragmentFromEditor=!1,this.removeDragListeners()}beforeDestruct(){this.onDragEnd(),this.j.e.off(window,".DragAndDrop").off(".DragAndDrop").off([window,this.j.ed,this.j.editor],"dragstart.DragAndDrop",this.onDragStart)}}(0,r.gn)([L.autobind],Dt.prototype,"onDragStart",null),(0,r.gn)([(0,L.throttle)((e=>e.j.defaultTimeout/10))],Dt.prototype,"onDrag",null),(0,r.gn)([L.autobind],Dt.prototype,"onDragEnd",null),(0,r.gn)([L.autobind],Dt.prototype,"onDrop",null),(e=>{e[e.IDLE=0]="IDLE",e[e.WAIT_DRAGGING=1]="WAIT_DRAGGING",e[e.DRAGGING=2]="DRAGGING"})(Lt||(Lt={}));class Pt extends G{constructor(){super(...arguments),this.dragList=[],this.draggable=null,this.isCopyMode=!1,this.diffStep=10,this.startX=0,this.startY=0,this.state=Lt.IDLE}afterInit(){this.dragList=this.j.o.draggableTags?(0,g.splitArray)(this.j.o.draggableTags).filter(Boolean).map((e=>e.toLowerCase())):[],this.dragList.length&&this.j.e.on("mousedown dragstart",this.onDragStart)}onDragStart(e){if("dragstart"===e.type&&this.draggable)return!1;if(this.state>Lt.IDLE)return;const t=e.target;if(!this.dragList.length||!t)return;const i=e=>!(!e||!this.dragList.includes(e.nodeName.toLowerCase()));let o=D.i.furthest(t,i,this.j.editor)||(i(t)?t:null);o&&(D.i.isTag(o.parentElement,"a")&&o.parentElement.firstChild===o&&o.parentElement.lastChild===o&&(o=o.parentElement),this.startX=e.clientX,this.startY=e.clientY,this.isCopyMode=(0,g.ctrlKey)(e),this.draggable=o.cloneNode(!0),(0,g.dataBind)(this.draggable,"target",o),this.state=Lt.WAIT_DRAGGING,this.addDragListeners())}onDrag(e){var t,i;if(!this.draggable||this.state===Lt.IDLE)return;const o=e.clientY;if(this.state!==Lt.WAIT_DRAGGING||Math.sqrt(Math.pow(e.clientX-this.startX,2)+Math.pow(o-this.startY,2))>=this.diffStep){if(this.state===Lt.WAIT_DRAGGING&&(this.j.lock("drag-and-drop-element"),this.state=Lt.DRAGGING),this.j.e.fire("hidePopup hideResizer"),!this.draggable.parentNode){const o=(0,g.dataBind)(this.draggable,"target");(0,g.css)(this.draggable,{zIndex:1e13,pointerEvents:"none",pointer:"drag",position:"fixed",opacity:.7,display:"inline-block",left:e.clientX,top:e.clientY,width:null!==(t=null==o?void 0:o.offsetWidth)&&void 0!==t?t:100,height:null!==(i=null==o?void 0:o.offsetHeight)&&void 0!==i?i:100}),(0,j.ZO)(this.j,Pt).appendChild(this.draggable)}(0,g.css)(this.draggable,{left:e.clientX,top:e.clientY}),this.j.s.insertCursorAtPoint(e.clientX,e.clientY)}}onDragEnd(){this.isInDestruct||(this.removeDragListeners(),this.j.unlock(),this.state=Lt.IDLE,this.draggable&&(D.i.safeRemove(this.draggable),this.draggable=null))}onDrop(){if(!this.draggable||Lt.DRAGGING>this.state)return void this.onDragEnd();let e=(0,g.dataBind)(this.draggable,"target");this.onDragEnd(),this.isCopyMode&&(e=e.cloneNode(!0));const{parentElement:t}=e;this.j.s.insertNode(e,!0,!1),t&&D.i.isEmpty(t)&&!D.i.isTag(t,["td","th"])&&D.i.safeRemove(t),D.i.isTag(e,"img")&&this.j.e&&this.j.e.fire("afterInsertImage",e),this.j.e.fire("synchro")}addDragListeners(){this.j.e.on(this.j.editor,"mousemove",this.onDrag).on("mouseup",this.onDrop).on([this.j.ew,this.ow],"mouseup",this.onDragEnd)}removeDragListeners(){this.j.e.off(this.j.editor,"mousemove",this.onDrag).off("mouseup",this.onDrop).off([this.j.ew,this.ow],"mouseup",this.onDragEnd)}beforeDestruct(){this.onDragEnd(),this.j.e.off("mousedown dragstart",this.onDragStart),this.removeDragListeners()}}(0,r.gn)([L.autobind],Pt.prototype,"onDragStart",null),(0,r.gn)([(0,L.throttle)((e=>e.j.defaultTimeout/10))],Pt.prototype,"onDrag",null),(0,r.gn)([L.autobind],Pt.prototype,"onDragEnd",null),(0,r.gn)([L.autobind],Pt.prototype,"onDrop",null);const _t=(e,t,i,o)=>{var s;const r=e.createInside.element(i),n=e.createInside.element("br");r.appendChild(n),o&&o.cssText&&r.setAttribute("style",o.cssText),e.s.insertNode(r,!1,!1),e.s.setCursorBefore(n);const a=e.s.createRange();return a.setStartBefore("br"!==i.toLowerCase()?n:r),a.collapse(!0),e.s.selectRange(a),D.i.safeRemove(t),(0,g.scrollIntoViewIfNeeded)(r,e.editor,e.ed),null===(s=e.events)||void 0===s||s.fire("synchro"),r};class Rt extends G{constructor(){super(...arguments),this.brMode=!1,this.defaultTag=a.PARAGRAPH}afterInit(e){this.defaultTag=e.o.enter.toLowerCase(),this.brMode=this.defaultTag===a.BR.toLowerCase(),e.o.enterBlock||(e.o.enterBlock=this.brMode?a.PARAGRAPH:this.defaultTag),e.e.off(".enter").on("keydown.enter",(t=>{if(t.key===a.KEY_ENTER){const i=e.e.fire("beforeEnter",t);return void 0!==i?i:(e.s.isCollapsed()||e.execCommand("Delete"),e.s.focus(),this.onEnter(t),!1)}}))}onEnter(e){const t=this.j,i=t.selection,o=this.defaultTag;let s=i.current(!1);s&&s!==t.editor||(s=t.createInside.text(a.INVISIBLE_SPACE),i.insertNode(s),i.select(s));let r=this.getBlockWrapper(s);const n=D.i.isTag(r,"li");if((!n||e.shiftKey)&&!this.checkBR(s,e.shiftKey))return!1;if(r||this.hasPreviousBlock(s)||(r=this.wrapText(s)),!r||r===s)return _t(t,null,n?"li":o),!1;if(!this.checkUnsplittableBox(r))return!1;if(n&&D.i.isEmpty(r))return this.enterInsideEmptyLIelement(r),!1;const l=r.tagName.toLowerCase()===this.defaultTag||n,c=i.cursorOnTheRight(r),d=i.cursorOnTheLeft(r);if(!l&&(c||d)){let e=null;return e=c?i.setCursorAfter(r):i.setCursorBefore(r),_t(t,e,this.defaultTag),void(d&&!c&&i.setCursorIn(r,!0))}i.splitSelection(r)}getBlockWrapper(e,t=a.IS_BLOCK){let i=e;const o=this.j.editor;do{if(!i||i===o)break;if(t.test(i.nodeName))return D.i.isTag(i,"li")?i:this.getBlockWrapper(i.parentNode,/^li$/i)||i;i=i.parentNode}while(i&&i!==o);return null}checkBR(e,t){const i=D.i.closest(e,["pre","blockquote"],this.j.editor);if(this.brMode||t&&!i||!t&&i){const e=this.j.createInside.element("br");return this.j.s.insertNode(e,!0),(0,g.scrollIntoViewIfNeeded)(e,this.j.editor,this.j.ed),!1}return!0}wrapText(e){let t=e;D.i.up(t,(e=>{e&&e.hasChildNodes()&&e!==this.j.editor&&(t=e)}),this.j.editor);const i=D.i.wrapInline(t,this.j.o.enter,this.j);if(D.i.isEmpty(i)){const e=this.j.createInside.element("br");i.appendChild(e),this.j.s.setCursorBefore(e)}return i}hasPreviousBlock(e){return!!D.i.prev(e,(e=>D.i.isBlock(e)||D.i.isImage(e)),this.j.editor)}checkUnsplittableBox(e){const t=this.j,i=t.selection;if(!D.i.canSplitBlock(e)){const e=t.createInside.element("br");return i.insertNode(e,!1),i.setCursorAfter(e),!1}return!0}enterInsideEmptyLIelement(e){let t=null;const i=D.i.closest(e,["ol","ul"],this.j.editor);if(i){if(D.i.prev(e,(e=>D.i.isTag(e,"li")),i))if(D.i.next(e,(e=>D.i.isTag(e,"li")),i)){const o=this.j.s.createRange();o.setStartBefore(i),o.setEndAfter(e);const s=o.extractContents();i.parentNode&&i.parentNode.insertBefore(s,i),t=this.j.s.setCursorBefore(i)}else t=this.j.s.setCursorAfter(i);else t=this.j.s.setCursorBefore(i);D.i.safeRemove(e),_t(this.j,t,this.defaultTag),(0,g.$$)("li",i).length||D.i.safeRemove(i)}}beforeDestruct(e){e.e.off("keydown.enter")}}class Nt extends G{afterInit(e){}beforeDestruct(e){}onKeyDownArrow(e){var t;if(e.key!==a.KEY_RIGHT||!this.j.selection.isCollapsed())return;const{endContainer:i,endOffset:o}=this.j.selection.range;if(D.i.isText(i)&&(null===(t=i.nodeValue)||void 0===t?void 0:t.length)===o){const{parentNode:e}=i;D.i.isInlineBlock(e)&&!ot(e,!1,this.j.editor)&&D.i.after(e,this.j.createInside.text(a.NBSP_SPACE))}}}(0,r.gn)([(0,L.watch)(":keydown")],Nt.prototype,"onKeyDownArrow",null),n.D.prototype.showMessageErrors=!0,n.D.prototype.showMessageErrorTime=3e3,n.D.prototype.showMessageErrorOffsetPx=3;const qt="error-box-for-messages";function Bt(e){if(e.o.showMessageErrors){const t=e.getFullElName(qt,"active",!0),i=e.c.div(e.getFullElName(qt)),o=()=>{let t=5;(0,g.toArray)(i.childNodes).forEach((i=>{(0,g.css)(i,"bottom",t+"px"),t+=i.offsetHeight+e.o.showMessageErrorOffsetPx}))};e.e.on("beforeDestruct",(()=>{D.i.safeRemove(i)})).on("errorMessage",((s,r,n)=>{e.workplace.appendChild(i);const a=e.c.div(t,s);a.classList.add(e.getFullElName(qt,"type",r)),i.appendChild(a),o(),e.async.setTimeout((()=>{a.classList.remove(t),e.async.setTimeout((()=>{D.i.safeRemove(a),o()}),300)}),n||e.o.showMessageErrorTime)}))}}function Ht(e){e.registerButton({name:"font",group:"font"}).registerButton({name:"fontsize",group:"font"});const t=(t,i,o)=>{switch(t){case"fontsize":e.s.applyStyle({fontSize:(0,g.normalizeSize)(o)});break;case"fontname":e.s.applyStyle({fontFamily:o})}return e.e.fire("synchro"),!1};e.registerCommand("fontsize",t).registerCommand("fontname",t)}function Ot(e){e.registerButton({name:"paragraph",group:"font"}),e.registerCommand("formatblock",((t,i,o)=>(e.s.applyStyle(void 0,{element:o}),e.synchronizeValues(),!1)))}function Ft(e){e.registerButton({name:"fullsize"});let t=!1,i=0,o=0,s=!1;const r=()=>{const{container:r,events:n}=e;n&&(t?(i=(0,g.css)(r,"height",!0),o=(0,g.css)(r,"width",!0),(0,g.css)(r,{height:e.ow.innerHeight,width:e.ow.innerWidth}),s=!0):s&&(0,g.css)(r,{height:i||"auto",width:o||"auto"}))},n=i=>{const{container:o,events:s}=e;if(o){if(void 0===i&&(i=!o.classList.contains("jodit_fullsize")),e.setMod("fullsize",i),e.o.fullsize=i,t=i,o.classList.toggle("jodit_fullsize",i),e.toolbar&&((0,g.isJoditObject)(e)&&e.toolbarContainer.appendChild(e.toolbar.container),(0,g.css)(e.toolbar.container,"width","auto")),e.o.globalFullSize){let e=o.parentNode;for(;e&&e.nodeType!==Node.DOCUMENT_NODE;)e.classList.toggle("jodit_fullsize-box_true",i),e=e.parentNode;r()}s.fire("afterResize")}};e.o.globalFullSize&&e.e.on(e.ow,"resize",r),e.e.on("afterInit afterOpen",(()=>{var t;e.toggleFullSize(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.fullsize)})).on("toggleFullSize",n).on("beforeDestruct",(()=>{t&&n(!1)})).on("beforeDestruct",(()=>{e.events&&e.e.off(e.ow,"resize",r)}))}n.D.prototype.defaultFontSizePoints="px",n.D.prototype.controls.fontsize={command:"fontSize",data:{cssRule:"font-size"},list:["8","9","10","11","12","14","16","18","24","30","36","48","60","72","96"],exec:(e,t,{control:i})=>(0,g.memorizeExec)(e,t,{control:i},(t=>{var o;return"fontsize"===(null===(o=i.command)||void 0===o?void 0:o.toLowerCase())?`${t}${e.o.defaultFontSizePoints}`:t})),childTemplate:(e,t,i)=>`${i}${e.o.defaultFontSizePoints}`,tooltip:"Font size",isChildActive(e,t){var i,o;const s=e.s.current(),r=(null===(i=t.data)||void 0===i?void 0:i.cssRule)||"font-size",n=(null===(o=t.data)||void 0===o?void 0:o.normalize)||(t=>/pt$/i.test(t)&&"pt"===e.o.defaultFontSizePoints?t.replace(/pt$/i,""):t);if(s){const i=D.i.closest(s,D.i.isElement,e.editor)||e.editor,o=(0,g.css)(i,r);return!(!o||!t.args||n(""+t.args[0])!==n(""+o))}return!1}},n.D.prototype.controls.font={...n.D.prototype.controls.fontsize,command:"fontname",list:{"":"Default","Helvetica,sans-serif":"Helvetica","Arial,Helvetica,sans-serif":"Arial","Georgia,serif":"Georgia","Impact,Charcoal,sans-serif":"Impact","Tahoma,Geneva,sans-serif":"Tahoma","Times New Roman,Times,serif":"Times New Roman","Verdana,Geneva,sans-serif":"Verdana"},childTemplate(e,t,i){let o=!1;try{o=-1===t.indexOf("dings")&&document.fonts.check("16px "+t,i)}catch(e){}return`${i}`},data:{cssRule:"font-family",normalize:e=>e.toLowerCase().replace(/['"]+/g,"").replace(/[^a-z0-9]+/g,",")},tooltip:"Font family"},n.D.prototype.controls.paragraph={command:"formatBlock",update(e){const t=e.j,i=e.control,o=t.s.current();if(o&&t.o.textIcons){const s=(D.i.closest(o,D.i.isBlock,t.editor)||t.editor).nodeName.toLowerCase(),r=i.list;e&&i.data&&i.data.currentValue!==s&&r&&r[s]&&(t.o.textIcons?e.state.text=s:e.state.icon.name=s,i.data.currentValue=s)}return!1},exec:g.memorizeExec,data:{currentValue:"left"},list:{p:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",blockquote:"Quote",pre:"Code"},isChildActive(e,t){const i=e.s.current();if(i){const o=D.i.closest(i,D.i.isBlock,e.editor);return!(!o||o===e.editor||void 0===t.args||o.nodeName.toLowerCase()!==t.args[0])}return!1},isActive(e,t){const i=e.s.current();if(i){const o=D.i.closest(i,D.i.isBlock,e.editor);return!(!o||o===e.editor||void 0===t.list||D.i.isTag(o,"p")||void 0===t.list[o.nodeName.toLowerCase()])}return!1},childTemplate:(e,t,i)=>`<${t} style="margin:0;padding:0">${e.i18n(i)}`,tooltip:"Insert format block"},n.D.prototype.fullsize=!1,n.D.prototype.globalFullSize=!0,n.D.prototype.controls.fullsize={exec(e){e.toggleFullSize()},update(e){const t=e.j,i=t.isFullSize?"shrink":"fullsize";e.state.activated=t.isFullSize,t.o.textIcons?e.state.text=i:e.state.icon.name=i},tooltip:"Open editor in fullsize",mode:a.MODE_SOURCE+a.MODE_WYSIWYG},n.D.prototype.commandToHotkeys={removeFormat:["ctrl+shift+m","cmd+shift+m"],insertOrderedList:["ctrl+shift+7","cmd+shift+7"],insertUnorderedList:["ctrl+shift+8, cmd+shift+8"],selectall:["ctrl+a","cmd+a"]};class Wt extends G{constructor(){super(...arguments),this.onKeyPress=e=>{const t=this.specialKeys[e.which],i=(e.key||String.fromCharCode(e.which)).toLowerCase(),o=[t||i];return["alt","ctrl","shift","meta"].forEach((i=>{e[i+"Key"]&&t!==i&&o.push(i)})),(0,g.normalizeKeyAliases)(o.join("+"))},this.specialKeys={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",91:"meta",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}}afterInit(e){(0,g.keys)(e.o.commandToHotkeys,!1).forEach((t=>{const i=e.o.commandToHotkeys[t];i&&((0,g.isArray)(i)||(0,g.isString)(i))&&e.registerHotkeyToCommand(i,t)}));let t=!1;e.e.off(".hotkeys").on([e.ow,e.ew],"keydown.hotkeys",(e=>{if(e.key===a.KEY_ESC)return this.j.e.fire("escape",e)})).on("keydown.hotkeys",(i=>{const o=this.onKeyPress(i),s={shouldStop:!0};if(!1===this.j.e.fire(o+".hotkey",i.type,s)){if(s.shouldStop)return t=!0,e.e.stopPropagation("keydown"),!1;i.preventDefault()}}),void 0,!0).on("keyup.hotkeys",(()=>{if(t)return t=!1,e.e.stopPropagation("keyup"),!1}),void 0,!0)}beforeDestruct(e){e.events&&e.e.off(".hotkeys")}}function Vt(e){const t=e.options;e.e.on("afterSetMode",(()=>{e.isEditorMode()&&e.s.focus()})).on("generateDocumentStructure.iframe",((e,i)=>{const o=e||i.iframe.contentWindow.document;if(o.open(),o.write(t.iframeDoctype+``+`${t.iframeTitle}`+(t.iframeBaseUrl?``:"")+''),o.close(),t.iframeCSSLinks&&t.iframeCSSLinks.forEach((e=>{const t=o.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),o.head&&o.head.appendChild(t)})),t.iframeStyle){const e=o.createElement("style");e.innerHTML=t.iframeStyle,o.head&&o.head.appendChild(e)}})).on("createEditor",(()=>{if(!t.iframe)return;const i=e.c.element("iframe");i.style.display="block",i.src="about:blank",i.className="jodit-wysiwyg_iframe",i.setAttribute("allowtransparency","true"),i.setAttribute("tabindex",""+t.tabIndex),i.setAttribute("frameborder","0"),e.workplace.appendChild(i),e.iframe=i;const o=e.e.fire("generateDocumentStructure.iframe",null,e);return(0,g.callPromise)(o,(()=>{if(!e.iframe)return!1;const i=e.iframe.contentWindow.document;e.editorWindow=e.iframe.contentWindow;const o=()=>{(0,g.attr)(i.body,"contenteditable",e.getMode()!==a.MODE_SOURCE&&!e.getReadOnly()||null)},s=e=>{const t=//im,i="{%%BODY%%}",o=t.exec(e);return o&&(e=e.replace(t,i).replace(/]*?)>(.*?)<\/span>/gim,"").replace(/<span([^&]*?)>(.*?)<\/span>/gim,"").replace(i,o[0].replace(/(]+?)min-height["'\s]*:[\s"']*[0-9]+(px|%)/im,"$1").replace(/(]+?)([\s]*["'])?contenteditable["'\s]*=[\s"']*true["']?/im,"$1").replace(/<(style|script|span)[^>]+jodit[^>]+>.*?<\/\1>/g,"")).replace(/(class\s*=\s*)(['"])([^"']*)(jodit-wysiwyg|jodit)([^"']*\2)/g,"$1$2$3$5").replace(/(<[^<]+?)\sclass="[\s]*"/gim,"$1").replace(/(<[^<]+?)\sstyle="[\s;]*"/gim,"$1").replace(/(<[^<]+?)\sdir="[\s]*"/gim,"$1")),e};if(t.editHTMLDocumentMode){const t=e.element.tagName;if("TEXTAREA"!==t&&"INPUT"!==t)throw(0,g.error)("If enable `editHTMLDocumentMode` - source element should be INPUT or TEXTAREA");e.e.on("beforeGetNativeEditorValue",(()=>s(e.o.iframeDoctype+i.documentElement.outerHTML))).on("beforeSetNativeEditorValue",(({value:t})=>!e.isLocked&&(/<(html|body)/i.test(t)?s(i.documentElement.outerHTML)!==s(t)&&(i.open(),i.write(e.o.iframeDoctype+s(t)),i.close(),e.editor=i.body,e.e.fire("safeHTML",e.editor),o(),e.e.fire("prepareWYSIWYGEditor"),e.e.stopPropagation("beforeSetNativeEditorValue")):i.body.innerHTML=t,!0)),void 0,!0)}if(e.editor=i.body,e.e.on("afterSetMode afterInit afterAddPlace",o),"auto"===t.height){i.documentElement&&(i.documentElement.style.overflowY="hidden");const o=e.async.throttle((()=>{if(e.editor&&e.iframe&&"auto"===t.height){const t=e.ew.getComputedStyle(e.editor);(0,g.css)(e.iframe,"height",e.editor.offsetHeight+(parseInt(t.marginTop||"0",10)+parseInt(t.marginBottom||"0",10)))}}),e.defaultTimeout/2);e.e.on("change afterInit afterSetMode resize",o).on([e.iframe,e.ew,i.documentElement],"load",o).on(i,"readystatechange DOMContentLoaded",o)}return i.documentElement&&e.e.on(i.documentElement,"mousedown touchend",(()=>{e.s.isFocused()||(e.s.focus(),e.editor===i.body&&e.s.setCursorIn(i.body))})).on(e.ew,"mousedown touchstart keydown keyup touchend click mouseup mousemove scroll",(t=>{var i;null===(i=e.events)||void 0===i||i.fire(e.ow,t)})),!1}))}))}function Ut(e){const t=e.o,i=e.i18n.bind(e),o=P.JO.get.bind(P.JO),s=t.filebrowser.ajax.url||t.uploader.url,r=t.image.useImageEditor;return e.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t${o("image")}\n\t\t\t\t\t\t${o("crop")}\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t
`)}function $t(e){const t=e.o,i=e.i18n.bind(e),o=P.JO.get.bind(P.JO);return e.c.fromHTML(`
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t${o("lock")}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t`)}n.D.prototype.iframe=!1,n.D.prototype.iframeBaseUrl="",n.D.prototype.iframeTitle="Jodit Editor",n.D.prototype.iframeDoctype="",n.D.prototype.iframeDefaultSrc="about:blank",n.D.prototype.iframeStyle='html{margin:0;padding:0;min-height: 100%;}body{box-sizing:border-box;font-size:13px;line-height:1.6;padding:10px;margin:0;background:transparent;color:#000;position:relative;z-index:2;user-select:auto;margin:0px;overflow:auto;outline:none;}table{width:100%;border:none;border-collapse:collapse;empty-cells: show;max-width: 100%;}th,td{padding: 2px 5px;border:1px solid #ccc;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}p{margin-top:0;}.jodit_editor .jodit_iframe_wrapper{display: block;clear: both;user-select: none;position: relative;}.jodit_editor .jodit_iframe_wrapper:after {position:absolute;content:"";z-index:1;top:0;left:0;right: 0;bottom: 0;cursor: pointer;display: block;background: rgba(0, 0, 0, 0);} .jodit_disabled{user-select: none;-o-user-select: none;-moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-ms-user-select: none}',n.D.prototype.iframeCSSLinks=[],n.D.prototype.editHTMLDocumentMode=!1;var Yt=i(78);n.D.prototype.image={dialogWidth:600,openOnDblClick:!0,editSrc:!0,useImageEditor:!0,editTitle:!0,editAlt:!0,editLink:!0,editSize:!0,editBorderRadius:!0,editMargins:!0,editClass:!0,editStyle:!0,editId:!0,editAlign:!0,showPreview:!0,selectImageAfterClose:!0};const Kt=e=>(e=(0,g.trim)(e),/^[0-9]+$/.test(e)?e+"px":e),Gt=e=>/^[-+]?[0-9.]+px$/.test(""+e)?parseFloat(""+e):e;class Jt extends G{constructor(){super(...arguments),this.state={image:new Image,get ratio(){return this.image.naturalWidth/this.image.naturalHeight||1},sizeIsLocked:!0,marginIsLocked:!0},this.activeTabState={__activeTab:"Image"}}onChangeMarginIsLocked(){if(!this.form)return;const{marginRight:e,marginBottom:t,marginLeft:i,lockMargin:o}=(0,g.refs)(this.form);[e,t,i].forEach((e=>{(0,g.attr)(e,"disabled",this.state.marginIsLocked||null)})),o.innerHTML=P.JO.get(this.state.marginIsLocked?"lock":"unlock")}onChangeSizeIsLocked(){if(!this.form)return;const{lockSize:e,imageWidth:t}=(0,g.refs)(this.form);e.innerHTML=P.JO.get(this.state.sizeIsLocked?"lock":"unlock"),e.classList.remove("jodit-properties__lock"),e.classList.remove("jodit-properties__unlock"),e.classList.add(this.state.sizeIsLocked?"jodit-properties__lock":"jodit-properties__unlock"),this.j.e.fire(t,"change")}open(){return this.makeForm(),this.activeTabState.__activeTab="Image",this.j.e.fire("hidePopup"),(0,g.markOwner)(this.j,this.dialog.container),this.state.marginIsLocked=!0,this.state.sizeIsLocked=!0,this.onChangeMarginIsLocked(),this.onChangeSizeIsLocked(),this.updateValues(),this.dialog.open().setModal(!0).setPosition(),!1}makeForm(){if(this.dialog)return;this.dialog=new V({fullsize:this.j.o.fullsize,globalFullSize:this.j.o.globalFullSize,theme:this.j.o.theme,language:this.j.o.language,minWidth:Math.min(400,screen.width),minHeight:590,buttons:["fullsize","dialog.close"]});const e=this.j,t=e.o,i=e.i18n.bind(e),o={check:(0,k.zx)(e,"ok","Apply","primary"),remove:(0,k.zx)(e,"bin","Delete")};e.e.on(this.dialog,"afterClose",(()=>{this.state.image.parentNode&&t.image.selectImageAfterClose&&e.s.select(this.state.image)})),o.remove.onAction((()=>{e.s.removeNode(this.state.image),this.dialog.close()}));const{dialog:s}=this;s.setHeader(i("Image properties"));const r=(e=>{const{showPreview:t,editSize:i}=e.o.image,o=P.JO.get.bind(P.JO);return e.c.fromHTML(`
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t${o("lock")}\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t
`)})(e);this.form=r,s.setContent(r);const{tabsBox:n}=(0,g.refs)(this.form);n&&n.appendChild((0,At.IL)(e,[{name:"Image",content:Ut(e)},{name:"Advanced",content:$t(e)}],this.activeTabState)),o.check.onAction(this.onApply);const{changeImage:a,editImage:l}=(0,g.refs)(this.form);e.e.on(a,"click",this.openImagePopup),t.image.useImageEditor&&e.e.on(l,"click",this.openImageEditor);const{lockSize:c,lockMargin:d,imageWidth:h,imageHeight:u}=(0,g.refs)(r);c&&e.e.on(c,"click",(()=>{this.state.sizeIsLocked=!this.state.sizeIsLocked})),e.e.on(d,"click",(e=>{this.state.marginIsLocked=!this.state.marginIsLocked,e.preventDefault()}));const p=e=>{if(!(0,g.isNumeric)(h.value)||!(0,g.isNumeric)(u.value))return;const t=parseFloat(h.value),i=parseFloat(u.value);e.target===h?u.value=""+Math.round(t/this.state.ratio):h.value=""+Math.round(i*this.state.ratio)};e.e.on([h,u],"change keydown mousedown paste",(t=>{this.state.sizeIsLocked&&e.async.setTimeout(p.bind(this,t),{timeout:e.defaultTimeout,label:"image-properties-changeSize"})})),s.setFooter([o.remove,o.check]),s.setSize(this.j.o.image.dialogWidth)}updateValues(){const e=this.j.o,{image:t}=this.state,{marginTop:i,marginRight:o,marginBottom:s,marginLeft:r,lockMargin:n,imageSrc:a,id:l,classes:c,align:d,style:h,imageTitle:u,imageAlt:p,borderRadius:m,imageLink:f,imageWidth:v,imageHeight:b,imageLinkOpenInNewTab:y,imageViewSrc:w,lockSize:k}=(0,g.refs)(this.form);(()=>{n.checked=this.state.marginIsLocked,k.checked=this.state.sizeIsLocked})(),a.value=(0,g.attr)(t,"src")||"",w&&(0,g.attr)(w,"src",(0,g.attr)(t,"src")||""),(()=>{u.value=(0,g.attr)(t,"title")||"",p.value=(0,g.attr)(t,"alt")||"";const e=D.i.closest(t,"a",this.j.editor);e?(f.value=(0,g.attr)(e,"href")||"",y.checked="_blank"===(0,g.attr)(e,"target")):(f.value="",y.checked=!1)})(),(()=>{const e=(0,g.attr)(t,"width")||(0,g.css)(t,"width",!0)||!1,i=(0,g.attr)(t,"height")||(0,g.css)(t,"height",!0)||!1;v.value=!1!==e?""+Gt(e):""+t.offsetWidth,b.value=!1!==i?""+Gt(i):""+t.offsetHeight,this.state.sizeIsLocked=(()=>!(!(0,g.isNumeric)(v.value)||!(0,g.isNumeric)(b.value))&&1>Math.abs(parseFloat(v.value)-parseFloat(b.value)*this.state.ratio))()})(),(()=>{if(!e.image.editMargins)return;let n=!0,a=!1;[i,o,s,r].forEach((e=>{const o=(0,g.attr)(e,"data-ref")||"";let s=t.style.getPropertyValue((0,g.kebabCase)(o));if(!s)return a=!0,void(e.value="");/^[0-9]+(px)?$/.test(s)&&(s=parseInt(s,10)),e.value=""+s||"",(a&&e.value||n&&"marginTop"!==o&&e.value!==i.value)&&(n=!1)})),this.state.marginIsLocked=n})(),c.value=((0,g.attr)(t,"class")||"").replace(/jodit_focused_image[\s]*/,""),l.value=(0,g.attr)(t,"id")||"",m.value=""+(parseInt(t.style.borderRadius||"0",10)||"0"),t.style.cssFloat&&-1!==["left","right"].indexOf(t.style.cssFloat.toLowerCase())?d.value=(0,g.css)(t,"float"):"block"===(0,g.css)(t,"display")&&"auto"===t.style.marginLeft&&"auto"===t.style.marginRight&&(d.value="center"),h.value=(0,g.attr)(t,"style")||""}onApply(){const{style:e,imageSrc:t,borderRadius:i,imageTitle:o,imageAlt:s,imageLink:r,imageWidth:n,imageHeight:a,marginTop:l,marginRight:c,marginBottom:d,marginLeft:h,imageLinkOpenInNewTab:u,align:p,classes:m,id:f}=(0,g.refs)(this.form),v=this.j.o,{image:b}=this.state;if(v.image.editStyle&&(0,g.attr)(b,"style",e.value||null),!t.value)return D.i.safeRemove(b),void this.dialog.close();(0,g.attr)(b,"src",t.value),b.style.borderRadius="0"!==i.value&&/^[0-9]+$/.test(i.value)?i.value+"px":"",(0,g.attr)(b,"title",o.value||null),(0,g.attr)(b,"alt",s.value||null);let y=D.i.closest(b,"a",this.j.editor);if(r.value?(y||(y=D.i.wrap(b,"a",this.j.createInside)),(0,g.attr)(y,"href",r.value),(0,g.attr)(y,"target",u.checked?"_blank":null)):y&&y.parentNode&&y.parentNode.replaceChild(b,y),n.value!==""+b.offsetWidth||a.value!==""+b.offsetHeight){const e=(0,g.trim)(n.value)?Kt(n.value):null,t=(0,g.trim)(a.value)?Kt(a.value):null;(0,g.css)(b,{width:e,height:t}),(0,g.attr)(b,"width",(0,g.attr)(b,"width")?e:null),(0,g.attr)(b,"height",(0,g.attr)(b,"height")?t:null)}const w=[l,c,d,h];v.image.editMargins&&(this.state.marginIsLocked?(0,g.css)(b,"margin",Kt(l.value)):w.forEach((e=>{const t=(0,g.attr)(e,"data-ref")||"";(0,g.css)(b,t,Kt(e.value))}))),v.image.editClass&&(0,g.attr)(b,"class",m.value||null),v.image.editId&&(0,g.attr)(b,"id",f.value||null),v.image.editAlign&&(0,Yt.z)(b,p.value),this.j.synchronizeValues(),this.dialog.close()}openImageEditor(){const e=(0,g.attr)(this.state.image,"src")||"",t=this.j.c.element("a"),i=()=>{t.host===location.host||Y(this.j.i18n("You can only edit your own images. Download this image on the host?"),(e=>{e&&this.j.uploader&&this.j.uploader.uploadRemoteImage(""+t.href,(e=>{U(this.j.i18n("The image has been successfully uploaded to the host!"),(()=>{(0,g.isString)(e.newfilename)&&((0,g.attr)(this.state.image,"src",e.baseurl+e.newfilename),this.updateValues())})).bindDestruct(this.j)}),(e=>{U(this.j.i18n("There was an error loading %s",e.message)).bindDestruct(this.j)}))})).bindDestruct(this.j)};t.href=e,this.j.filebrowser.dataProvider.getPathByUrl(""+t.href).then((i=>{fe.call(this.j.filebrowser,t.href,i.name,i.path,i.source,(()=>{const t=(new Date).getTime();(0,g.attr)(this.state.image,"src",e+(-1!==e.indexOf("?")?"":"?")+"&_tmp="+t),this.updateValues()}),(e=>{U(e.message).bindDestruct(this.j)}))})).catch((e=>{U(e.message,i).bindDestruct(this.j)}))}openImagePopup(e){const t=new P.GI(this.j),{changeImage:i}=(0,g.refs)(this.form);t.setZIndex(this.dialog.getZIndex()+1),t.setContent((0,At.ov)(this.j,{upload:e=>{e.files&&e.files.length&&(0,g.attr)(this.state.image,"src",e.baseurl+e.files[0]),this.updateValues(),t.close()},filebrowser:e=>{e&&(0,g.isArray)(e.files)&&e.files.length&&((0,g.attr)(this.state.image,"src",e.files[0]),t.close(),this.updateValues())}},this.state.image,t.close)).open((()=>(0,g.position)(i))),e.stopPropagation()}afterInit(e){const t=this;e.e.on("afterConstructor changePlace",(()=>{e.e.off(e.editor,".imageproperties").on(e.editor,"dblclick.imageproperties",(i=>{const o=i.target;if(D.i.isTag(o,"img"))if(e.o.image.openOnDblClick){if(!1===this.j.e.fire("openOnDblClick",o))return;t.state.image=o,e.o.readonly||(i.stopImmediatePropagation(),i.preventDefault(),t.open())}else i.stopImmediatePropagation(),e.s.select(o)}))})).on("openImageProperties.imageproperties",(e=>{this.state.image=e,this.open()}))}beforeDestruct(e){this.dialog&&this.dialog.destruct(),e.e.off(e.editor,".imageproperties").off(".imageproperties")}}(0,r.gn)([(0,L.watch)("state.marginIsLocked")],Jt.prototype,"onChangeMarginIsLocked",null),(0,r.gn)([(0,L.watch)("state.sizeIsLocked")],Jt.prototype,"onChangeSizeIsLocked",null),(0,r.gn)([L.autobind],Jt.prototype,"onApply",null),(0,r.gn)([L.autobind],Jt.prototype,"openImageEditor",null),(0,r.gn)([L.autobind],Jt.prototype,"openImagePopup",null);const Xt="__jodit_imageprocessor_binded";function Zt(e){e.e.on("change afterInit changePlace",e.async.debounce((()=>{e.editor&&(0,g.$$)("img",e.editor).forEach((t=>{(0,g.dataBind)(t,Xt)||((0,g.dataBind)(t,Xt,!0),t.complete||e.e.on(t,"load",(function i(){var o;!e.isInDestruct&&(null===(o=e.e)||void 0===o||o.fire("resize")),e.e.off(t,"load",i)})),e.e.on(t,"mousedown touchstart",(()=>{e.s.select(t)})))}))}),e.defaultTimeout))}function Qt(e){e.registerButton({name:"image",group:"media"})}n.D.prototype.controls.image={popup(e,t,i,o){let s=null;return t&&!D.i.isText(t)&&D.i.isHTMLElement(t)&&(D.i.isTag(t,"img")||(0,g.$$)("img",t).length)&&(s=D.i.isTag(t,"img")?t:(0,g.$$)("img",t)[0]),e.s.save(),(0,At.ov)(e,{filebrowser(t){e.s.restore(),t.files&&t.files.forEach((i=>e.s.insertImage(t.baseurl+i,null,e.o.imageDefaultWidth))),o()},upload:!0,async url(t,i){e.s.restore();const r=s||e.createInside.element("img");r.setAttribute("src",t),r.setAttribute("alt",i),s||await e.s.insertImage(r,null,e.o.imageDefaultWidth),o()}},s,o)},tags:["img"],tooltip:"Insert Image"},n.D.prototype.controls.indent={tooltip:"Increase Indent"};const ei=(e,t)=>`${D.i.isCell(t)?"padding":"margin"}${"rtl"===e?"Right":"Left"}`;function ti(e){e.registerButton({name:"indent",group:"indent"}).registerButton({name:"outdent",group:"indent"});const t=t=>{const i=[];return e.s.eachSelection((o=>{e.s.save();let s=!!o&&D.i.up(o,D.i.isBlock,e.editor);const{enter:r}=e.o;if(!s&&o&&(s=D.i.wrapInline(o,r!==a.BR?r:a.PARAGRAPH,e)),!s)return e.s.restore(),!1;const n=i.includes(s);if(s&&!n){const o=ei(e.o.direction,s);i.push(s);let r=s.style[o]?parseInt(s.style[o],10):0;r+=e.o.indentMargin*("outdent"===t?-1:1),s.style[o]=r>0?r+"px":"",(0,g.attr)(s,"style")||(0,g.attr)(s,"style",null)}e.s.restore()})),e.synchronizeValues(),!1};e.registerCommand("indent",{exec:t,hotkeys:["ctrl+]","cmd+]"]}),e.registerCommand("outdent",{exec:t,hotkeys:["ctrl+[","cmd+["]})}function ii(e){e.registerButton({name:"hr",group:"insert"}),e.registerCommand("insertHorizontalRule",(()=>{const t=e.createInside.element("hr");e.s.insertNode(t,!1,!1);const i=D.i.closest(t.parentElement,D.i.isBlock,e.editor);i&&D.i.isEmpty(i)&&i!==e.editor&&(D.i.after(i,t),D.i.safeRemove(i));let o=D.i.next(t,D.i.isBlock,e.editor,!1);return o||(o=e.createInside.element(e.o.enter),D.i.after(t,o)),e.s.setCursorIn(o),!1}))}n.D.prototype.controls.outdent={isDisabled(e){const t=e.s.current();if(t){const i=D.i.closest(t,D.i.isBlock,e.editor);if(i){const t=ei(e.o.direction,i);return!i.style[t]||0>=parseInt(i.style[t],10)}}return!0},tooltip:"Decrease Indent"},n.D.prototype.indentMargin=10,n.D.prototype.controls.hr={command:"insertHorizontalRule",tags:["hr"],tooltip:"Insert Horizontal Line"},n.D.prototype.toolbarInline=!0,n.D.prototype.toolbarInlineForSelection=!1,n.D.prototype.toolbarInlineDisableFor=[],n.D.prototype.toolbarInlineDisabledButtons=["source"],n.D.prototype.popup={a:i(79).Z,img:i(80).Z,cells:i(81).Z,toolbar:i(82).Z,jodit:i(83).Z,iframe:i(83).Z,"jodit-media":i(83).Z,selection:["bold","underline","italic","ul","ol","\n","outdent","indent","fontsize","brush","cut","\n","paragraph","link","align","dots"]};class oi extends G{constructor(){super(...arguments),this.requires=["select"],this.type=null,this.popup=new w.G(this.jodit,!1),this.toolbar=H(this.jodit,this.popup),this.snapRange=null,this.elmsList=(0,g.keys)(this.j.o.popup,!1).filter((e=>!this.isExcludedTarget(e)))}onClick(e){const t=this.elmsList,i=D.i.isTag(e,"img")?e:D.i.closest(e,t,this.j.editor);if(i&&this.canShowPopupForType(i.nodeName.toLowerCase()))return this.showPopup((()=>(0,g.position)(i,this.j)),i.nodeName.toLowerCase(),i),!1}showPopup(e,t,i){if(t=t.toLowerCase(),!this.canShowPopupForType(t))return!1;if(this.type!==t||i!==this.previousTarget){this.previousTarget=i;const e=this.j.o.popup[t];let o;o=(0,g.isFunction)(e)?e(this.j,i,this.popup.close):e,(0,g.isArray)(o)&&(this.toolbar.build(o,i),this.toolbar.buttonSize=this.j.o.toolbarButtonSize,o=this.toolbar.container),this.popup.setContent(o),this.type=t}return this.popup.open(e),!0}hidePopup(e){(0,g.isString)(e)&&e!==this.type||this.popup.close()}onOutsideClick(){this.popup.close()}canShowPopupForType(e){const t=this.j.o.popup[e.toLowerCase()];return!(this.j.o.readonly||!this.j.o.toolbarInline||!t||this.isExcludedTarget(e))}isExcludedTarget(e){return(0,g.splitArray)(this.j.o.toolbarInlineDisableFor).map((e=>e.toLowerCase())).includes(e.toLowerCase())}afterInit(e){this.j.e.on("getDiffButtons.mobile",(t=>{if(this.toolbar===t){const t=this.toolbar.getButtonsNames();return(0,g.toArray)(e.registeredButtons).filter((e=>!this.j.o.toolbarInlineDisabledButtons.includes(e.name))).filter((e=>{const i=(0,g.isString)(e)?e:e.name;return i&&"|"!==i&&"\n"!==i&&!t.includes(i)}))}})).on("hidePopup",this.hidePopup).on("showInlineToolbar",this.showInlineToolbar).on("showPopup",((e,t,i)=>{this.showPopup(t,i||((0,g.isString)(e)?e:e.nodeName),(0,g.isString)(e)?void 0:e)})).on("mousedown keydown",this.onSelectionStart).on("change",(()=>{this.popup.isOpened&&this.previousTarget&&!this.previousTarget.parentNode&&(this.hidePopup(),this.previousTarget=void 0)})).on([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.addListenersForElements()}onSelectionStart(){this.snapRange=this.j.s.range.cloneRange()}onSelectionEnd(e){if(e&&e.target&&P.u1.closestElement(e.target,w.G))return;const{snapRange:t}=this,{range:i}=this.j.s;t&&!i.collapsed&&i.startContainer===t.startContainer&&i.startOffset===t.startOffset&&i.endContainer===t.endContainer&&i.endOffset===t.endOffset||this.onSelectionChange()}onSelectionChange(){if(!this.j.o.toolbarInlineForSelection)return;const e="selection",t=this.j.s.sel,i=this.j.s.range;(null==t?void 0:t.isCollapsed)||this.isSelectedTarget(i)||this.tableModule.getAllSelectedCells().length?this.type===e&&this.popup.isOpened&&this.hidePopup():this.j.s.current()&&this.showPopup((()=>i.getBoundingClientRect()),e)}isSelectedTarget(e){const t=e.startContainer;return D.i.isElement(t)&&t===e.endContainer&&D.i.isTag(t.childNodes[e.startOffset],(0,g.keys)(this.j.o.popup,!1))&&e.startOffset===e.endOffset-1}get tableModule(){return this.j.getInstance("Table",this.j.o)}beforeDestruct(e){e.e.off("showPopup").off([this.j.ew,this.j.ow],"mouseup keyup",this.onSelectionEnd),this.removeListenersForElements()}_eventsList(){const e=this.elmsList;return e.map((e=>(0,g.camelCase)("click_"+e))).concat(e.map((e=>(0,g.camelCase)("touchstart_"+e)))).join(" ")}addListenersForElements(){this.j.e.on(this._eventsList(),this.onClick)}removeListenersForElements(){this.j.e.off(this._eventsList(),this.onClick)}showInlineToolbar(e){this.showPopup((()=>{if(e)return e;const{range:t}=this.j.s;return t.getBoundingClientRect()}),"toolbar")}}(0,r.gn)([L.autobind],oi.prototype,"onClick",null),(0,r.gn)([(0,L.wait)((e=>!e.j.isLocked))],oi.prototype,"showPopup",null),(0,r.gn)([(0,L.watch)(":clickEditor"),L.autobind],oi.prototype,"hidePopup",null),(0,r.gn)([(0,L.watch)(":outsideClick")],oi.prototype,"onOutsideClick",null),(0,r.gn)([L.autobind],oi.prototype,"onSelectionStart",null),(0,r.gn)([L.autobind],oi.prototype,"onSelectionEnd",null),(0,r.gn)([(0,L.debounce)((e=>e.defaultTimeout))],oi.prototype,"onSelectionChange",null),(0,r.gn)([L.autobind],oi.prototype,"showInlineToolbar",null),n.D.prototype.controls.align={name:"left",tooltip:"Align",update(e){const t=e.j,i=e.control,o=t.s.current();if(o){const s=D.i.closest(o,D.i.isBlock,t.editor)||t.editor;let r=""+(0,g.css)(s,"text-align");i.defaultValue&&-1!==i.defaultValue.indexOf(r)&&(r="left"),i.data&&i.data.currentValue!==r&&i.list&&-1!==i.list.indexOf(r)&&(t.o.textIcons?e.state.text=r:e.state.icon.name=r,i.data.currentValue=r)}},isActive(e,t){const i=e.s.current();if(i&&t.defaultValue){const o=D.i.closest(i,D.i.isBlock,e.editor)||e.editor;return-1===t.defaultValue.indexOf(""+(0,g.css)(o,"text-align"))}return!1},defaultValue:["left","start","inherit"],data:{currentValue:"left"},list:["center","left","right","justify"]},n.D.prototype.controls.center={command:"justifyCenter",css:{"text-align":"center"},tooltip:"Align Center"},n.D.prototype.controls.justify={command:"justifyFull",css:{"text-align":"justify"},tooltip:"Align Justify"},n.D.prototype.controls.left={command:"justifyLeft",css:{"text-align":"left"},tooltip:"Align Left"},n.D.prototype.controls.right={command:"justifyRight",css:{"text-align":"right"},tooltip:"Align Right"};const si=(e,t)=>{if(D.i.isNode(t)&&D.i.isElement(t))switch(D.i.each(t,(e=>{D.i.isHTMLElement(e)&&e.style.textAlign&&(e.style.textAlign="",e.style.cssText.trim().length||e.removeAttribute("style"))})),e.toLowerCase()){case"justifyfull":t.style.textAlign="justify";break;case"justifyright":t.style.textAlign="right";break;case"justifyleft":t.style.textAlign="left";break;case"justifycenter":t.style.textAlign="center"}};function ri(e){e.registerButton({name:"align",group:"indent"});const t=t=>(e.s.focus(),e.s.eachSelection((i=>{if(!i)return;let o=D.i.up(i,D.i.isBlock,e.editor);o||(o=D.i.wrapInline(i,e.o.enterBlock,e)),si(t,o)})),!1);e.registerCommand("justifyfull",t),e.registerCommand("justifyright",t),e.registerCommand("justifyleft",t),e.registerCommand("justifycenter",t)}n.D.prototype.limitWords=!1,n.D.prototype.limitChars=!1,n.D.prototype.limitHTML=!1;class ni extends G{afterInit(e){const{limitWords:t,limitChars:i}=e.o;if(e&&(t||i)){let t=null;e.e.off(".limit").on("beforePaste.limit",(()=>{t=e.history.snapshot.make()})).on("keydown.limit keyup.limit beforeEnter.limit beforePaste.limit",this.checkPreventKeyPressOrPaste).on("change.limit",this.checkPreventChanging).on("afterPaste.limit",(()=>{if(this.shouldPreventInsertHTML()&&t)return e.history.snapshot.restore(t),!1}))}}shouldPreventInsertHTML(e=null,t=""){if(e&&a.COMMAND_KEYS.includes(e.key))return!1;const{jodit:i}=this,{limitWords:o,limitChars:s}=i.o,r=this.splitWords(t||(i.o.limitHTML?i.value:i.text));return!(!o||o>r.length)||!!s&&r.join("").length>=s}checkPreventKeyPressOrPaste(e){if(this.shouldPreventInsertHTML(e))return!1}checkPreventChanging(e,t){const{jodit:i}=this,{limitWords:o,limitChars:s}=i.o,r=i.o.limitHTML?e:(0,g.stripTags)(e),n=this.splitWords(r);(o&&n.length>o||s&&n.join("").length>s)&&(i.value=t)}splitWords(e){return e.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((e=>e.length))}beforeDestruct(e){e.e.off(".limit")}}(0,r.gn)([L.autobind],ni.prototype,"checkPreventKeyPressOrPaste",null),(0,r.gn)([L.autobind],ni.prototype,"checkPreventChanging",null),n.D.prototype.defaultLineHeight=null,n.D.prototype.controls.lineHeight={icon:"line-height",command:"applyLineHeight",tags:["ol"],tooltip:"Line height",list:[1,1.1,1.2,1.3,1.4,1.5,2],exec:(e,t,{control:i})=>(0,g.memorizeExec)(e,t,{control:i},(e=>e))};class ai extends G{constructor(){super(...arguments),this.buttons=[{name:"lineHeight",group:"font"}]}afterInit(e){(0,g.css)(e.editor,{lineHeight:e.o.defaultLineHeight}),e.registerCommand("applyLineHeight",this.applyLineHeight)}applyLineHeight(e,t,i){const{s:o,createInside:s,editor:r,o:n}=this.j;let a;o.isFocused()||o.focus(),o.save();const l=e=>{let t=D.i.closest(e,D.i.isBlock,r);t||(t=D.i.wrap(e,n.enter,s));const o=(0,g.css)(t,"lineHeight");void 0===a&&(a=""+o!=""+i),(0,g.css)(t,"lineHeight",a?i:null)};try{if(o.isCollapsed()){const e=s.fake();o.insertNode(e,!1,!1),l(e),D.i.safeRemove(e)}else o.eachSelection(l)}finally{o.restore()}}beforeDestruct(e){(0,g.css)(e.editor,{lineHeight:null})}}(0,r.gn)([L.autobind],ai.prototype,"applyLineHeight",null);var li=i(55);n.D.prototype.link={formTemplate(e){const{openInNewTabCheckbox:t,noFollowCheckbox:i,modeClassName:o,selectSizeClassName:s,selectMultipleClassName:r,selectOptionsClassName:n}=e.o.link;return new li.x4(e,[new li.eC(e,[new li.u3(e,{name:"url",type:"text",ref:"url_input",label:"URL",placeholder:"http://",required:!0})]),new li.eC(e,[new li.u3(e,{name:"content",ref:"content_input",label:"Text"})],{ref:"content_input_box"}),o?new li.eC(e,["input"===o?new li.u3(e,{name:"className",ref:"className_input",label:"Class name"}):"select"===o?new li.Cj(e,{name:"className",ref:"className_select",label:"Class name",size:s,multiple:r,options:n}):null]):null,t?new li.mA(e,{name:"target",ref:"target_checkbox",label:"Open in new tab"}):null,i?new li.mA(e,{name:"nofollow",ref:"nofollow_checkbox",label:"No follow"}):null,new li.eC(e,[new k.y3(e,{name:"unlink",variant:"default",text:"Unlink"}),new k.y3(e,{name:"insert",type:"submit",variant:"primary",text:"Insert"})],{align:"full"})])},followOnDblClick:!1,processVideoLink:!0,processPastedLink:!0,noFollowCheckbox:!0,openInNewTabCheckbox:!0,modeClassName:"input",selectMultipleClassName:!0,selectSizeClassName:3,selectOptionsClassName:[],hotkeys:["ctrl+k","cmd+k"]},n.D.prototype.controls.unlink={exec(e,t){const i=D.i.closest(t,"a",e.editor);i&&D.i.unwrap(i),e.synchronizeValues(),e.e.fire("hidePopup")},tooltip:"Unlink"},n.D.prototype.controls.link={isActive(e){const t=e.s.current();return!(!t||!D.i.closest(t,"a",e.editor))},popup:(e,t,i,o)=>e.e.fire("generateLinkForm.link",t,o),tags:["a"],tooltip:"Insert link"};class ci extends G{constructor(){super(...arguments),this.buttons=[{name:"link",group:"insert"}]}afterInit(e){e.o.link.followOnDblClick&&e.e.on("dblclick.link",this.onDblClickOnLink),e.o.link.processPastedLink&&e.e.on("processPaste.link",this.onProcessPasteLink),e.e.on("generateLinkForm.link",this.generateForm),e.registerCommand("openLinkDialog",{exec:()=>{const t=new V({resizable:!1}),i=this.generateForm(e.s.current(),(()=>{t.close()}));i.container.classList.add("jodit-dialog_alert"),t.setContent(i),t.open(),e.async.requestIdleCallback((()=>{const{url_input:e}=(0,g.refs)(i.container);null==e||e.focus()}))},hotkeys:e.o.link.hotkeys})}onDblClickOnLink(e){if(!D.i.isTag(e.target,"a"))return;const t=(0,g.attr)(e.target,"href");t&&(location.href=t,e.preventDefault())}onProcessPasteLink(e,t){const{jodit:i}=this;if((0,g.isURL)(t)){if(i.o.link.processVideoLink){const e=(0,g.convertMediaUrlToVideoEmbed)(t);if(e!==t)return i.e.stopPropagation("processPaste"),i.createInside.fromHTML(e)}const e=i.createInside.element("a");return e.setAttribute("href",t),e.textContent=t,i.e.stopPropagation("processPaste"),e}}generateForm(e,t){const{jodit:i}=this,o=i.i18n.bind(i),{openInNewTabCheckbox:s,noFollowCheckbox:r,formTemplate:n,formClassName:a,modeClassName:l}=i.o.link,c=n(i),d=(0,g.isString)(c)?i.c.fromHTML(c,{target_checkbox_box:s,nofollow_checkbox_box:r}):c,h=D.i.isElement(d)?d:d.container,u=(0,g.refs)(h),{insert:p,unlink:m,content_input_box:f}=u,{target_checkbox:v,nofollow_checkbox:b,url_input:y}=u,w=D.i.isImage(e);let{content_input:k}=u;const{className_input:C}=u,{className_select:S}=u;let E;k||(k=i.c.element("input",{type:"hidden",ref:"content_input"})),a&&h.classList.add(a),w&&D.i.hide(f);const I=()=>E?E.innerText:(0,g.stripTags)(i.s.range.cloneContents(),i.ed);if(E=!(!e||!D.i.closest(e,"a",i.editor))&&D.i.closest(e,"a",i.editor),!w&&e&&(k.value=I()),E){if(y.value=(0,g.attr)(E,"href")||"",l)switch(l){case"input":C&&(C.value=(0,g.attr)(E,"class")||"");break;case"select":if(S){for(let e=0;S.selectedOptions.length>e;e++){const t=S.options.item(e);t&&(t.selected=!1)}((0,g.attr)(E,"class")||"").split(" ").forEach((e=>{if(e)for(let t=0;S.options.length>t;t++){const i=S.options.item(t);(null==i?void 0:i.value)&&i.value===e&&(i.selected=!0)}}))}}s&&v&&(v.checked="_blank"===(0,g.attr)(E,"target")),r&&b&&(b.checked="nofollow"===(0,g.attr)(E,"rel")),p.textContent=o("Update")}else D.i.hide(m);i.editor.normalize();const x=i.history.snapshot.make();m&&i.e.on(m,"click",(e=>{i.s.restore(),i.history.snapshot.restore(x),E&&D.i.unwrap(E),i.synchronizeValues(),t(),e.preventDefault()}));const z=()=>{if(!y.value.trim().length)return y.focus(),y.classList.add("jodit_error"),!1;let e;i.s.restore(),i.s.removeMarkers(),i.editor.normalize(),i.history.snapshot.restore(x);const o=I()!==k.value.trim(),n=i.createInside;if(E)e=[E];else{if(i.s.isCollapsed()){const t=n.element("a");i.s.insertNode(t,!1,!1),e=[t]}else{const t=i.s.current();e=D.i.isTag(t,["img"])?[D.i.wrap(t,"a",n)]:i.s.wrapInTag("a")}e.forEach((e=>i.s.select(e)))}return e.forEach((e=>{var t;if((0,g.attr)(e,"href",y.value),l&&(null!=C?C:S))if("input"===l)""===C.value&&e.hasAttribute("class")&&(0,g.attr)(e,"class",null),""!==C.value&&(0,g.attr)(e,"class",C.value);else if("select"===l){e.hasAttribute("class")&&(0,g.attr)(e,"class",null);for(let i=0;S.selectedOptions.length>i;i++){const o=null===(t=S.selectedOptions.item(i))||void 0===t?void 0:t.value;o&&e.classList.add(o)}}if(!w){let t=e.textContent;k.value.trim().length?o&&(t=k.value):t=y.value,t!==e.textContent&&(e.textContent=t)}s&&v&&(0,g.attr)(e,"target",v.checked?"_blank":null),r&&b&&(0,g.attr)(e,"rel",b.checked?"nofollow":null)})),i.synchronizeValues(),t(),!1};return D.i.isElement(d)?i.e.on(d,"submit",(e=>(e.preventDefault(),e.stopImmediatePropagation(),z(),!1))):d.onSubmit(z),d}beforeDestruct(e){e.e.off("generateLinkForm.link",this.generateForm).off("dblclick.link",this.onDblClickOnLink).off("processPaste.link",this.onProcessPasteLink)}}function di(e){const t="jodit_fake_wrapper",{mediaFakeTag:i,mediaBlocks:o,mediaInFakeBlock:s}=e.options;s&&e.e.on("afterGetValueFromEditor",(e=>{const o=RegExp(`<${i}[^>]+data-${t}[^>]+>([^]+?)`,"ig");o.test(e.value)&&(e.value=e.value.replace(o,"$1"))})).on("change afterInit afterSetMode changePlace",e.async.debounce((()=>{e.isDestructed||e.getMode()===a.MODE_SOURCE||(0,g.$$)(o.join(","),e.editor).forEach((o=>{(0,g.dataBind)(o,t)||((0,g.dataBind)(o,t,!0),(o=>{if(o.parentNode&&(0,g.attr)(o.parentNode,"data-jodit_iframe_wrapper"))o=o.parentNode;else{const s=e.createInside.fromHTML(`<${i} data-jodit-temp="1" contenteditable="false" draggable="true" data-${t}="1">`);(0,g.attr)(s,"style",(0,g.attr)(o,"style")),s.style.display="inline-block"===o.style.display?"inline-block":"block",s.style.width=o.offsetWidth+"px",s.style.height=o.offsetHeight+"px",o.parentNode&&o.parentNode.insertBefore(s,o),s.appendChild(o),o=s}e.e.off(o,"mousedown.select touchstart.select").on(o,"mousedown.select touchstart.select",(()=>{e.s.setCursorAfter(o)}))})(o))}))}),e.defaultTimeout))}function hi(e){e.registerButton({name:"video",group:"media"})}function ui(e){e.registerButton({name:"file",group:"media"})}function pi(e){let t=0,i=(0,g.splitArray)(e.o.buttons);e.o.mobileTapTimeout&&e.e.on("touchend",(i=>{if(i.changedTouches&&i.changedTouches.length){const o=(new Date).getTime(),s=o-t;s>e.o.mobileTapTimeout&&(t=o,1.5*e.o.mobileTapTimeout>s&&e.s.insertCursorAtPoint(i.clientX,i.clientY))}})),e.e.on("getDiffButtons.mobile",(t=>{if(t===e.toolbar){const t=(0,F.q)((0,g.splitArray)(e.o.buttons),e),o=(0,F.q)(i,e);return(0,g.toArray)(t).reduce(((e,t)=>(o.has(t)||e.push(t),e)),[])}})),e.o.toolbarAdaptive&&e.e.on("resize afterInit recalcAdaptive changePlace afterAddPlace",(()=>{var t;if(!e.o.toolbar)return;const o=(null!==(t=e.container.parentElement)&&void 0!==t?t:e.container).offsetWidth,s=(0,g.splitArray)(e.o.sizeLG>o?e.o.sizeMD>o?e.o.sizeSM>o?e.o.buttonsXS:e.o.buttonsSM:e.o.buttonsMD:e.o.buttons);""+s!=""+i&&(i=s,e.e.fire("closeAllPopups"),e.toolbar.setRemoveButtons(e.o.removeButtons).build(i.concat(e.o.extraButtons)))})).on(e.ow,"load resize",(()=>e.e.fire("recalcAdaptive")))}(0,r.gn)([L.autobind],ci.prototype,"onDblClickOnLink",null),(0,r.gn)([L.autobind],ci.prototype,"onProcessPasteLink",null),(0,r.gn)([L.autobind],ci.prototype,"generateForm",null),n.D.prototype.mediaFakeTag="jodit-media",n.D.prototype.mediaInFakeBlock=!0,n.D.prototype.mediaBlocks=["video","audio"],n.D.prototype.controls.video={popup(e,t,i,o){const s=new li.x4(e,[new li.eC(e,[new li.u3(e,{name:"url",required:!0,label:"URL",placeholder:"https://",validators:["url"]})]),new li.eC(e,[(0,k.zx)(e,"","Insert","primary").onAction((()=>s.submit()))])]),r=new li.x4(e,[new li.eC(e,[new li.GJ(e,{name:"code",required:!0,label:"Embed code"})]),new li.eC(e,[(0,k.zx)(e,"","Insert","primary").onAction((()=>r.submit()))])]),n=[],a=t=>{e.s.restore(),e.s.insertHTML(t),o()};return e.s.save(),n.push({icon:"link",name:"Link",content:s.container},{icon:"source",name:"Code",content:r.container}),s.onSubmit((e=>{a((0,g.convertMediaUrlToVideoEmbed)(e.url))})),r.onSubmit((e=>{a(e.code)})),(0,At.IL)(e,n)},tags:["iframe"],tooltip:"Insert youtube/vimeo video"},n.D.prototype.controls.file={popup(e,t,i,o){const s=(t,i="")=>{e.s.insertNode(e.createInside.fromHTML(`${i||t}`))};let r=null;return t&&(D.i.isTag(t,"a")||D.i.closest(t,"a",e.editor))&&(r=D.i.isTag(t,"a")?t:D.i.closest(t,"a",e.editor)),(0,At.ov)(e,{filebrowser(e){e.files&&e.files.forEach((t=>s(e.baseurl+t))),o()},upload:!0,url(e,t){r?(r.setAttribute("href",e),r.setAttribute("title",t)):s(e,t),o()}},r,o,!1)},tags:["a"],tooltip:"Insert file"},n.D.prototype.mobileTapTimeout=300,n.D.prototype.toolbarAdaptive=!0,n.D.prototype.controls.dots={mode:a.MODE_SOURCE+a.MODE_WYSIWYG,popup(e,t,i,o,s){let r=i.data;return void 0===r&&(r={toolbar:H(e),rebuild(){var t;if(s){const i=e.e.fire("getDiffButtons.mobile",s.closest(P.bz));if(i&&r){r.toolbar.build((0,g.splitArray)(i));const o=(null===(t=e.toolbar.firstButton)||void 0===t?void 0:t.container.offsetWidth)||36;r.toolbar.container.style.width=3*(o+4)+"px"}}}},i.data=r),r.rebuild(),r.toolbar},tooltip:"Show all"};var mi=i(12);const fi=(e,t,{control:i})=>{var o;const s="button"+i.command,r=null!==(o=i.args&&i.args[0])&&void 0!==o?o:(0,mi.q)(e,s);(0,mi.q)(e,s,r),e.execCommand(i.command,!1,"default"===r?null:r)};n.D.prototype.controls.ul={command:"insertUnorderedList",tags:["ul"],tooltip:"Insert Unordered List",list:{default:"Default",circle:"Circle",disc:"Dot",square:"Quadrate"},exec:fi},n.D.prototype.controls.ol={command:"insertOrderedList",tags:["ol"],tooltip:"Insert Ordered List",list:{default:"Default","lower-alpha":"Lower Alpha","lower-greek":"Lower Greek","lower-roman":"Lower Roman","upper-alpha":"Upper Alpha","upper-roman":"Upper Roman"},exec:fi};class gi extends G{constructor(){super(...arguments),this.buttons=[{name:"ul",group:"list"},{name:"ol",group:"list"}]}afterInit(e){e.registerCommand("insertUnorderedList",this.onCommand).registerCommand("insertOrderedList",this.onCommand)}onCommand(e,t,i){return this.jodit.s.applyStyle({listStyleType:null!=i?i:null},{element:"insertunorderedlist"===e?"ul":"ol"}),this.jodit.synchronizeValues(),!1}beforeDestruct(e){}}function vi(e){e.o.hidePoweredByJodit||e.o.inline||!(e.o.showCharsCounter||e.o.showWordsCounter||e.o.showXPathInStatusbar)||e.hookStatus("ready",(()=>{e.statusbar.append(e.create.fromHTML('\n\t\t\t\t\t\t\tPowered by Jodit\n\t\t\t\t\t\t'),!0)}))}(0,r.gn)([L.autobind],gi.prototype,"onCommand",null),n.D.prototype.showPlaceholder=!0,n.D.prototype.placeholder="Type something",n.D.prototype.useInputsPlaceholder=!0;class bi extends G{constructor(){super(...arguments),this.addNativeListeners=()=>{this.j.e.off(this.j.editor,"input.placeholder keydown.placeholder").on(this.j.editor,"input.placeholder keydown.placeholder",this.toggle)},this.addEvents=()=>{const e=this.j;e.o.useInputsPlaceholder&&e.element.hasAttribute("placeholder")&&(this.placeholderElm.innerHTML=(0,g.attr)(e.element,"placeholder")||""),e.e.fire("placeholder",this.placeholderElm.innerHTML),e.e.off(".placeholder").on("changePlace.placeholder",this.addNativeListeners).on("change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder mousedown.placeholder afterSetMode.placeholder changePlace.placeholder",this.toggle).on(window,"load",this.toggle),this.addNativeListeners(),this.toggle()}}afterInit(e){e.o.showPlaceholder&&(this.placeholderElm=e.c.fromHTML(``),"rtl"===e.o.direction&&(this.placeholderElm.style.right="0px",this.placeholderElm.style.direction="rtl"),e.e.on("readonly",(e=>{e?this.hide():this.toggle()})).on("changePlace",this.addEvents),this.addEvents())}show(){const e=this.j;if(e.o.readonly)return;let t=0,i=0;const o=e.s.current(),s=o&&D.i.closest(o,D.i.isBlock,e.editor)||e.editor,r=e.ew.getComputedStyle(s);e.workplace.appendChild(this.placeholderElm);const{firstChild:n}=e.editor;if(D.i.isElement(n)&&!Me.Ph.isMarker(n)){const o=e.ew.getComputedStyle(n);t=parseInt(o.getPropertyValue("margin-top"),10),i=parseInt(o.getPropertyValue("margin-left"),10),this.placeholderElm.style.fontSize=parseInt(o.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=o.getPropertyValue("line-height")}else this.placeholderElm.style.fontSize=parseInt(r.getPropertyValue("font-size"),10)+"px",this.placeholderElm.style.lineHeight=r.getPropertyValue("line-height");(0,g.css)(this.placeholderElm,{display:"block",textAlign:r.getPropertyValue("text-align"),marginTop:Math.max(parseInt(r.getPropertyValue("margin-top"),10),t),marginLeft:Math.max(parseInt(r.getPropertyValue("margin-left"),10),i)})}hide(){D.i.safeRemove(this.placeholderElm)}toggle(){const e=this.j;e.editor&&!e.isInDestruct&&(e.getRealMode()===a.MODE_WYSIWYG&&(e=>{if(!e.firstChild)return!0;const t=e.firstChild;if(a.MAY_BE_REMOVED_WITH_KEY.test(t.nodeName)||/^(TABLE)$/i.test(t.nodeName))return!1;const i=D.i.next(t,(e=>e&&!D.i.isEmptyTextNode(e)),e);return D.i.isText(t)&&!i?D.i.isEmptyTextNode(t):!i&&D.i.each(t,(e=>!D.i.isTag(e,["ul","li","ol"])&&(D.i.isEmpty(e)||D.i.isTag(e,"br"))))})(e.editor)?this.show():this.hide())}beforeDestruct(e){this.hide(),e.e.off(".placeholder").off(window,"load",this.toggle)}}(0,r.gn)([(0,L.debounce)((e=>e.defaultTimeout/10),!0)],bi.prototype,"toggle",null),n.D.prototype.controls.redo={mode:a.MODE_SPLIT,isDisabled:e=>!e.history.canRedo(),tooltip:"Redo"},n.D.prototype.controls.undo={mode:a.MODE_SPLIT,isDisabled:e=>!e.history.canUndo(),tooltip:"Undo"};class yi extends G{constructor(){super(...arguments),this.buttons=[{name:"undo",group:"history"},{name:"redo",group:"history"}]}beforeDestruct(){}afterInit(e){const t=t=>(e.history[t](),!1);e.registerCommand("redo",{exec:t,hotkeys:["ctrl+y","ctrl+shift+z","cmd+y","cmd+shift+z"]}),e.registerCommand("undo",{exec:t,hotkeys:["ctrl+z","cmd+z"]})}}n.D.prototype.allowResizeTags=["img","iframe","table","jodit"],n.D.prototype.resizer={showSize:!0,hideSizeTimeout:1e3,forImageChangeAttributes:!0,min_width:10,min_height:10};const wi="__jodit-resizer_binded";class ki extends G{constructor(){super(...arguments),this.LOCK_KEY="resizer",this.element=null,this.isResized=!1,this.isShown=!1,this.start_x=0,this.start_y=0,this.width=0,this.height=0,this.ratio=0,this.rect=this.j.c.fromHTML('
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t100x100\n\t\t\t
'),this.sizeViewer=this.rect.getElementsByTagName("span")[0],this.onResize=e=>{if(this.isResized){if(!this.element)return;let t,i;if(this.j.options.iframe){const o=this.getWorkplacePosition();t=e.clientX+o.left-this.start_x,i=e.clientY+o.top-this.start_y}else t=e.clientX-this.start_x,i=e.clientY-this.start_y;const o=this.handle.className;let s=0,r=0;D.i.isTag(this.element,"img")?(t?(s=this.width+(o.match(/left/)?-1:1)*t,r=Math.round(s/this.ratio)):(r=this.height+(o.match(/top/)?-1:1)*i,s=Math.round(r*this.ratio)),s>(0,g.innerWidth)(this.j.editor,this.j.ow)&&(s=(0,g.innerWidth)(this.j.editor,this.j.ow),r=Math.round(s/this.ratio))):(s=this.width+(o.match(/left/)?-1:1)*t,r=this.height+(o.match(/top/)?-1:1)*i),s>this.j.o.resizer.min_width&&this.applySize(this.element,"width",this.rect.parentNode.offsetWidth>s?s:"100%"),r>this.j.o.resizer.min_height&&this.applySize(this.element,"height",r),this.updateSize(),this.showSizeViewer(this.element.offsetWidth,this.element.offsetHeight),e.stopImmediatePropagation()}},this.onClickOutside=e=>{this.isShown&&(this.isResized?(this.j.unlock(),this.isResized=!1,this.j.synchronizeValues(),e.stopImmediatePropagation(),this.j.e.off(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)):this.hide())},this.onClickElement=e=>{this.isResized||this.element===e&&this.isShown||(this.element=e,this.show(),D.i.isTag(this.element,"img")&&!this.element.complete&&this.j.e.on(this.element,"load",this.updateSize))},this.updateSize=()=>{if(!this.isInDestruct&&this.isShown&&this.element&&this.rect){const e=this.getWorkplacePosition(),t=(0,g.offset)(this.element,this.j,this.j.ed),i=parseInt(this.rect.style.left||"0",10),o=this.rect.offsetWidth,s=this.rect.offsetHeight,r=t.top-e.top,n=t.left-e.left;parseInt(this.rect.style.top||"0",10)===r&&i===n&&o===this.element.offsetWidth&&s===this.element.offsetHeight||((0,g.css)(this.rect,{top:r,left:n,width:this.element.offsetWidth,height:this.element.offsetHeight}),this.j.events&&(this.j.e.fire(this.element,"changesize"),isNaN(i)||this.j.e.fire("resize")))}},this.hideSizeViewer=()=>{this.sizeViewer.style.opacity="0"}}afterInit(e){(0,g.$$)("div",this.rect).forEach((t=>{e.e.on(t,"mousedown.resizer touchstart.resizer",this.onClickHandle.bind(this,t))})),j.TB.on("hideHelpers",this.hide),e.e.on("readonly",(e=>{e&&this.hide()})).on("afterInit changePlace",this.addEventListeners.bind(this)).on("afterGetValueFromEditor.resizer",(e=>{const t=/]+data-jodit_iframe_wrapper[^>]+>(.*?]*>.*?<\/iframe>.*?)<\/jodit>/gi;t.test(e.value)&&(e.value=e.value.replace(t,"$1"))})).on("hideResizer",this.hide).on("change afterInit afterSetMode",this.onChangeEditor),this.addEventListeners(),this.onChangeEditor()}onEditorClick(e){let t=e.target;const{editor:i,options:{allowResizeTags:o}}=this.j;for(;t&&t!==i;){if(D.i.isTag(t,o))return this.bind(t),void this.onClickElement(t);t=t.parentNode}}addEventListeners(){const e=this.j;e.e.off(e.editor,".resizer").off(e.ow,".resizer").on(e.editor,"keydown.resizer",(e=>{this.isShown&&e.key===a.KEY_DELETE&&this.element&&!D.i.isTag(this.element,"table")&&this.onDelete(e)})).on(e.ow,"resize.resizer",this.updateSize).on("resize.resizer",this.updateSize).on(e.ow,"mouseup.resizer keydown.resizer touchend.resizer",this.onClickOutside).on([e.ow,e.editor],"scroll.resizer",(()=>{this.isShown&&!this.isResized&&this.hide()}))}onClickHandle(e,t){if(!this.element||!this.element.parentNode)return this.hide(),!1;this.handle=e,t.cancelable&&t.preventDefault(),t.stopImmediatePropagation(),this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.ratio=this.width/this.height,this.isResized=!0,this.start_x=t.clientX,this.start_y=t.clientY,this.j.e.fire("hidePopup"),this.j.lock(this.LOCK_KEY),this.j.e.on(this.j.ow,"mousemove.resizer touchmove.resizer",this.onResize)}getWorkplacePosition(){return(0,g.offset)(this.rect.parentNode||this.j.od.documentElement,this.j,this.j.od,!0)}applySize(e,t,i){const o=D.i.isImage(e)&&this.j.o.resizer.forImageChangeAttributes;o&&(0,g.attr)(e,t,i),o&&!e.style[t]||(0,g.css)(e,t,i)}onDelete(e){this.element&&("JODIT"!==this.element.tagName?this.j.s.select(this.element):(D.i.safeRemove(this.element),this.hide(),e.preventDefault()))}onChangeEditor(){this.isShown&&(this.element&&this.element.parentNode?this.updateSize():this.hide()),(0,g.$$)("iframe",this.j.editor).forEach(this.bind)}bind(e){if(!D.i.isHTMLElement(e)||(0,g.dataBind)(e,wi))return;let t;if((0,g.dataBind)(e,wi,!0),D.i.isTag(e,"iframe")){const i=e;D.i.isHTMLElement(e.parentNode)&&(0,g.attr)(e.parentNode,"-jodit_iframe_wrapper")?e=e.parentNode:(t=this.j.createInside.fromHTML(''),(0,g.attr)(t,"style",(0,g.attr)(e,"style")),(0,g.css)(t,{display:"inline-block"===e.style.display?"inline-block":"block",width:e.offsetWidth,height:e.offsetHeight}),e.parentNode&&e.parentNode.insertBefore(t,e),t.appendChild(e),e=t),this.j.e.off(e,"mousedown.select touchstart.select").on(e,"mousedown.select touchstart.select",(()=>{this.j.s.select(e)})).off(e,"changesize").on(e,"changesize",(()=>{i.setAttribute("width",e.offsetWidth+"px"),i.setAttribute("height",e.offsetHeight+"px")}))}this.j.e.on(e,"dragstart",this.hide)}showSizeViewer(e,t){this.j.o.resizer.showSize&&(this.sizeViewer.offsetWidth>e||this.sizeViewer.offsetHeight>t?this.hideSizeViewer():(this.sizeViewer.style.opacity="1",this.sizeViewer.textContent=`${e} x ${t}`,this.j.async.setTimeout(this.hideSizeViewer,{timeout:this.j.o.resizer.hideSizeTimeout,label:"hideSizeViewer"})))}show(){this.j.o.readonly||this.isShown||(this.isShown=!0,this.rect.parentNode||((0,g.markOwner)(this.j,this.rect),this.j.workplace.appendChild(this.rect)),this.j.isFullSize&&(this.rect.style.zIndex=""+(0,g.css)(this.j.container,"zIndex")),this.updateSize())}hide(){this.isResized||(this.isResized=!1,this.isShown=!1,this.element=null,D.i.safeRemove(this.rect))}beforeDestruct(e){this.hide(),j.TB.off("hideHelpers",this.hide),e.e.off(this.j.ow,".resizer").off(".resizer")}}(0,r.gn)([(0,L.watch)(":click")],ki.prototype,"onEditorClick",null),(0,r.gn)([(0,L.debounce)()],ki.prototype,"onChangeEditor",null),(0,r.gn)([L.autobind],ki.prototype,"bind",null),(0,r.gn)([L.autobind],ki.prototype,"hide",null);var Ci=i(36);class Si{constructor(e=Ci.Q){this.searchIndex=e,this.queue=[],this.value=""}add(e){var t;const i=(null!==(t=e.nodeValue)&&void 0!==t?t:"").toLowerCase();if(!i.length)return;const o=this.value.length;this.queue.push({startIndex:o,endIndex:o+i.length,node:e}),this.value+=i}ranges(e,t=0){const i=[];let o=t,s=0,r=0;do{if([o,s]=this.searchIndex(e,this.value,o),-1!==o){let e,t,n=0,a=0;for(let i=r;this.queue.length>i;i+=1)if(!e&&this.queue[i].endIndex>o&&(e=this.queue[i].node,n=o-this.queue[i].startIndex),e&&this.queue[i].endIndex>=o+s){t=this.queue[i].node,a=o+s-this.queue[i].startIndex,r=i;break}e&&t&&i.push({startContainer:e,startOffset:n,endContainer:t,endOffset:a}),o+=s}}while(-1!==o);return 0===i.length?null:i}}var Ei=i(42);const Ii="jd-tmp-selection";function xi(e,t,i,o){if(null==e.startContainer.nodeValue||null==e.endContainer.nodeValue)return;const s=i.element("span",{[Ii]:!0}),r=e.startContainer.nodeValue;let n=0;if(0!==e.startOffset){const t=i.text(r.substring(0,e.startOffset));e.startContainer.nodeValue=r.substring(e.startOffset),D.i.before(e.startContainer,t),e.startContainer===e.endContainer&&(n=e.startOffset,e.endOffset-=n),e.startOffset=0}const a=e.endContainer.nodeValue;if(e.endOffset!==a.length){const o=i.text(a.substring(e.endOffset));e.endContainer.nodeValue=a.substring(0,e.endOffset),D.i.after(e.endContainer,o);for(const i of t){if(i.startContainer!==e.endContainer)break;i.startContainer=o,i.startOffset=i.startOffset-e.endOffset-n,i.endContainer===e.endContainer&&(i.endContainer=o,i.endOffset=i.endOffset-e.endOffset-n)}e.endOffset=e.endContainer.nodeValue.length}let l=e.startContainer;do{if(!l)break;if(!D.i.isText(l)||D.i.isElement(c=l.parentNode)&&c.hasAttribute(Ii)||D.i.wrap(l,s.cloneNode(),i),l===e.endContainer)break;let t=l.firstChild||l.nextSibling;if(!t){for(;l&&!l.nextSibling&&l!==o;)l=l.parentNode;t=null==l?void 0:l.nextSibling}l=t}while(l&&l!==o);var c}function zi(e){return(0,Ei.$$)(`[${Ii}]`,e)}function Ti(e){zi(e).forEach((e=>D.i.unwrap(e)))}let ji=class extends P.u1{constructor(e){super(e),this.selInfo=null,this._currentIndex=0,this.isOpened=!1;const{query:t,replace:i,cancel:o,next:s,prev:r,replaceBtn:n,current:l,count:c}=(0,g.refs)(this.container);this.queryInput=t,this.replaceInput=i,this.closeButton=o,this.replaceButton=n,this.currentBox=l,this.countBox=c,e.e.on(this.closeButton,"pointerdown",(()=>(this.close(),!1))).on(this.queryInput,"input",(()=>{this.currentIndex=0})).on(this.queryInput,"pointerdown",(()=>{e.s.isFocused()&&(e.s.removeMarkers(),this.selInfo=e.s.save())})).on(this.replaceButton,"pointerdown",(()=>(e.e.fire(this,"pressReplaceButton"),!1))).on(s,"pointerdown",(()=>(e.e.fire("searchNext"),!1))).on(r,"pointerdown",(()=>(e.e.fire("searchPrevious"),!1))).on(this.queryInput,"input",(()=>{this.setMod("empty-query",!(0,g.trim)(this.queryInput.value).length)})).on(this.queryInput,"keydown",this.j.async.debounce((t=>{t.key===a.KEY_ENTER?(t.preventDefault(),t.stopImmediatePropagation(),e.e.fire("searchNext")&&this.close()):e.e.fire(this,"needUpdateCounters")}),this.j.defaultTimeout))}className(){return"UISearch"}render(){return`
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t0/0\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
`}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e,this.currentBox.innerText=""+e}set count(e){this.countBox.innerText=""+e}get query(){return this.queryInput.value}get replace(){return this.replaceInput.value}onEditorKeyDown(e){if(!this.isOpened)return;const{j:t}=this;if(t.getRealMode()===a.MODE_WYSIWYG)switch(e.key){case a.KEY_ESC:this.close();break;case a.KEY_F3:this.queryInput.value&&(t.e.fire(e.shiftKey?"searchPrevious":"searchNext"),e.preventDefault())}}open(e=!1){this.isOpened||(this.j.workplace.appendChild(this.container),this.isOpened=!0),this.calcSticky(this.j.e.fire("getStickyState.sticky")||!1),this.j.e.fire("hidePopup"),this.setMod("replace",e);const t=""+(this.j.s.sel||"");t&&(this.queryInput.value=t),this.setMod("empty-query",!t.length),this.j.e.fire(this,"needUpdateCounters"),t?this.queryInput.select():this.queryInput.focus()}close(){this.isOpened&&(this.j.s.restore(),D.i.safeRemove(this.container),this.isOpened=!1,this.j.e.fire(this,"afterClose"))}calcSticky(e){if(this.isOpened)if(this.setMod("sticky",e),e){const e=(0,g.position)(this.j.toolbarContainer);(0,g.css)(this.container,{top:e.top+e.height,left:e.left+e.width})}else(0,g.css)(this.container,{top:null,left:null})}};(0,r.gn)([(0,L.watch)([":keydown","queryInput:keydown"])],ji.prototype,"onEditorKeyDown",null),(0,r.gn)([L.autobind],ji.prototype,"open",null),(0,r.gn)([L.autobind],ji.prototype,"close",null),(0,r.gn)([(0,L.watch)(":toggleSticky")],ji.prototype,"calcSticky",null),ji=(0,r.gn)([L.component],ji),n.D.prototype.useSearch=!0,n.D.prototype.search={lazyIdleTimeout:0},n.D.prototype.controls.find={tooltip:"Find",icon:"search",exec(e,t,{control:i}){switch(i.args&&i.args[0]){case"findPrevious":e.e.fire("searchPrevious");break;case"findNext":e.e.fire("searchNext");break;case"replace":e.execCommand("openReplaceDialog");break;default:e.execCommand("openSearchDialog")}},list:{search:"Find",findNext:"Find Next",findPrevious:"Find Previous",replace:"Replace"},childTemplate:(e,t,i)=>i};class Li extends G{constructor(){super(...arguments),this.buttons=[{name:"find",group:"search"}],this.previousQuery="",this.drawPromise=null,this.walker=null,this.walkerCount=null,this.cache={},this.wrapFrameRequest=0}get ui(){return new ji(this.j)}async updateCounters(){this.ui.isOpened&&(this.ui.count=await this.calcCounts(this.ui.query))}onPressReplaceButton(){this.findAndReplace(this.ui.query),this.updateCounters()}tryScrollToElement(e){let t=D.i.closest(e,D.i.isElement,this.j.editor);t||(t=D.i.prev(e,D.i.isElement,this.j.editor)),t&&t!==this.j.editor&&(0,g.scrollIntoViewIfNeeded)(t,this.j.editor,this.j.ed)}async calcCounts(e){return this.walkerCount&&this.walkerCount.break(),this.walkerCount=new D.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout}),(await this.find(this.walkerCount,e)).length}async findAndReplace(e){this.walker&&this.walker.break(),this.walker=new D.b(this.j.async,{timeout:this.j.o.search.lazyIdleTimeout});const t=this.j.s.range,i=await this.find(this.walker,e);let o=this.findCurrentIndexInRanges(i,t);-1===o&&(o=0);const s=i[o];if(s){try{const e=this.j.ed.createRange();e.setStart(s.startContainer,s.startOffset),e.setEnd(s.endContainer,s.endOffset),e.deleteContents();const t=this.j.createInside.text(this.ui.replace);e.insertNode(t),this.j.s.select(t),this.tryScrollToElement(t),this.cache={},this.j.synchronizeValues()}catch(e){}return this.j.e.fire("afterFindAndReplace"),!0}return!1}async findAndSelect(e,t){var i;this.walker&&this.walker.break(),this.walker=new D.b(this.j.async,{timeout:this.j.defaultTimeout});const o=await this.find(this.walker,e);if(!o.length)return!1;this.previousQuery===e&&zi(this.j.editor).length||(null===(i=this.drawPromise)||void 0===i||i.rejectCallback(),this.j.async.cancelAnimationFrame(this.wrapFrameRequest),Ti(this.j.editor),this.drawPromise=this.drawSelectionRanges(o)),this.previousQuery=e;let s=this.ui.currentIndex-1;s=-1===s?0:t?s===o.length-1?0:s+1:0===s?o.length-1:s-1,this.ui.currentIndex=s+1;const r=o[s];if(r){const e=this.j.ed.createRange();try{e.setStart(r.startContainer,r.startOffset),e.setEnd(r.endContainer,r.endOffset),this.j.s.selectRange(e)}catch(e){}return this.tryScrollToElement(r.startContainer),await this.updateCounters(),await this.drawPromise,this.j.e.fire("afterFindAndSelect"),!0}return!1}findCurrentIndexInRanges(e,t){return e.findIndex((e=>e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.startContainer&&e.endOffset===t.endOffset))}async isValidCache(e){return(await e).every((e=>{var t,i,o,s;return e.startContainer.isConnected&&e.startOffset<=(null!==(i=null===(t=e.startContainer.nodeValue)||void 0===t?void 0:t.length)&&void 0!==i?i:0)&&e.endContainer.isConnected&&e.endOffset<=(null!==(s=null===(o=e.endContainer.nodeValue)||void 0===o?void 0:o.length)&&void 0!==s?s:0)}))}async find(e,t){if(!t.length)return[];const i=this.cache[t];if(i&&await this.isValidCache(i))return i;const o=new Si(this.j.o.search.fuzzySearch);return this.cache[t]=this.j.async.promise((i=>{e.on("break",(()=>{i([])})).on("visit",(e=>(D.i.isText(e)&&o.add(e),!1))).on("end",(()=>{var e;i(null!==(e=o.ranges(t))&&void 0!==e?e:[])})).setWork(this.j.editor)})),this.cache[t]}drawSelectionRanges(e){const{async:t,createInside:i,editor:o}=this.j;t.cancelAnimationFrame(this.wrapFrameRequest);const s=[...e];let r,n=0;return t.promise((e=>{const a=()=>{do{r=s.shift(),r&&xi(r,s,i,o),n+=1}while(r&&5>=n);s.length?this.wrapFrameRequest=t.requestAnimationFrame(a):e()};a()}))}onAfterGetValueFromEditor(e){e.value=e.value.replace(RegExp(`]+${Ii}[^>]+>(.*?)`,"g"),"$1")}afterInit(e){if(e.o.useSearch){const t=this;e.e.on("beforeSetMode.search",(()=>{this.ui.close()})).on(this.ui,"afterClose",(()=>{Ti(e.editor),this.ui.currentIndex=0,this.ui.count=0,this.cache={}})).on("click",(()=>{this.ui.currentIndex=0,Ti(e.editor)})).on("change.search",(()=>{this.cache={}})).on("keydown.search mousedown.search",e.async.debounce((()=>{this.ui.selInfo&&(e.s.removeMarkers(),this.ui.selInfo=null),this.ui.isOpened&&this.updateCounters()}),e.defaultTimeout)).on("searchNext.search searchPrevious.search",(()=>(this.ui.isOpened||this.ui.open(),t.findAndSelect(t.ui.query,"searchNext"===e.e.current).catch((()=>{}))))).on("search.search",((e,i=!0)=>(this.ui.currentIndex=0,t.findAndSelect(e||"",i).catch((()=>{}))))),e.registerCommand("search",{exec:(e,i,o=!0)=>(i&&t.findAndSelect(i,o).catch((()=>{})),!1)}).registerCommand("openSearchDialog",{exec:()=>(t.ui.open(),!1),hotkeys:["ctrl+f","cmd+f"]}).registerCommand("openReplaceDialog",{exec:()=>(e.o.readonly||t.ui.open(!0),!1),hotkeys:["ctrl+h","cmd+h"]})}}beforeDestruct(e){this.ui.destruct(),e.e.off(".search")}}(0,r.gn)([L.cache],Li.prototype,"ui",null),(0,r.gn)([(0,L.watch)("ui:needUpdateCounters")],Li.prototype,"updateCounters",null),(0,r.gn)([(0,L.watch)("ui:pressReplaceButton")],Li.prototype,"onPressReplaceButton",null),(0,r.gn)([L.autobind],Li.prototype,"findAndReplace",null),(0,r.gn)([L.autobind],Li.prototype,"findAndSelect",null),(0,r.gn)([L.autobind],Li.prototype,"find",null),(0,r.gn)([(0,L.watch)(":afterGetValueFromEditor")],Li.prototype,"onAfterGetValueFromEditor",null);var Ai=i(35);n.D.prototype.select={normalizeSelectionBeforeCutAndCopy:!0};class Mi extends G{constructor(){super(...arguments),this.proxyEventsList=["click","mousedown","touchstart","mouseup","touchend"]}afterInit(e){this.proxyEventsList.forEach((t=>{e.e.on(t+".select",this.onStartSelection)}))}beforeDestruct(e){this.proxyEventsList.forEach((t=>{e.e.on(t+".select",this.onStartSelection)}))}onStartSelection(e){const{j:t}=this;let i,o=e.target;for(;void 0===i&&o&&o!==t.editor;)i=t.e.fire((0,Ai.e)(e.type+"_"+o.nodeName.toLowerCase()),o,e),o=o.parentElement;"click"===e.type&&void 0===i&&o===t.editor&&t.e.fire(e.type+"Editor",o,e)}onOutsideClick(e){const t=e.target;D.i.up(t,(e=>e===this.j.editor))||P.u1.closestElement(t,P.GI)||this.j.e.fire("outsideClick",e)}beforeCommandCut(e){const{s:t}=this.j;if("cut"===e&&!t.isCollapsed()){const e=t.current();e&&D.i.isOrContains(this.j.editor,e)&&this.onCopyNormalizeSelectionBound()}}onCopyNormalizeSelectionBound(e){const{s:t,editor:i,o}=this.j;o.select.normalizeSelectionBeforeCutAndCopy&&!t.isCollapsed()&&(!e||e.isTrusted&&D.i.isNode(e.target)&&D.i.isOrContains(i,e.target))&&this.jodit.s.expandSelection()}}(0,r.gn)([L.autobind],Mi.prototype,"onStartSelection",null),(0,r.gn)([(0,L.watch)("ow:click")],Mi.prototype,"onOutsideClick",null),(0,r.gn)([(0,L.watch)([":beforeCommand"])],Mi.prototype,"beforeCommandCut",null),(0,r.gn)([(0,L.watch)([":copy",":cut"])],Mi.prototype,"onCopyNormalizeSelectionBound",null),n.D.prototype.width="auto",n.D.prototype.minWidth=200,n.D.prototype.maxWidth="100%",n.D.prototype.allowResizeX=!1,n.D.prototype.allowResizeY=!0,n.D.prototype.height="auto",n.D.prototype.minHeight=200,n.D.prototype.maxHeight="auto",n.D.prototype.saveHeightInStorage=!1;let Di=class extends G{constructor(){super(...arguments),this.isResized=!1,this.start={x:0,y:0,w:0,h:0},this.handle=this.j.c.div("jodit-editor__resize",P.JO.get("resize_handler"))}afterInit(e){const{height:t,width:i,allowResizeX:o}=e.o;let{allowResizeY:s}=e.o;"auto"===t&&"auto"!==i&&(s=!1),"auto"===t&&"auto"===i||!o&&!s||(e.statusbar.setMod("resize-handle",!0),e.e.on("toggleFullSize.resizeHandler",(()=>{this.handle.style.display=e.isFullSize?"none":"block"})).on(this.handle,"mousedown touchstart",this.onHandleResizeStart).on(e.ow,"mouseup touchend",this.onHandleResizeEnd),e.container.appendChild(this.handle))}onHandleResizeStart(e){this.isResized=!0,this.start.x=e.clientX,this.start.y=e.clientY,this.start.w=this.j.container.offsetWidth,this.start.h=this.j.container.offsetHeight,this.j.lock(),this.j.e.on(this.j.ow,"mousemove touchmove",this.onHandleResize),e.preventDefault()}onHandleResize(e){this.isResized&&(this.j.o.allowResizeY&&this.j.e.fire("setHeight",this.start.h+e.clientY-this.start.y),this.j.o.allowResizeX&&this.j.e.fire("setWidth",this.start.w+e.clientX-this.start.x),this.j.e.fire("resize"))}onHandleResizeEnd(){this.isResized&&(this.isResized=!1,this.j.e.off(this.j.ow,"mousemove touchmove",this.onHandleResize),this.j.unlock())}beforeDestruct(){D.i.safeRemove(this.handle),this.j.e.off(this.j.ow,"mouseup touchsend",this.onHandleResizeEnd)}};Di.requires=["size"],Di=(0,r.gn)([L.autobind],Di);let Pi=class extends G{constructor(){super(...arguments),this.resizeWorkspaces=this.j.async.debounce(this.resizeWorkspaceImd,this.j.defaultTimeout,!0)}afterInit(e){e.e.on("setHeight.size",this.setHeight).on("setWidth.size",this.setWidth).on("afterInit.size changePlace.size",this.initialize,void 0,!0).on(e.ow,"load.size",this.resizeWorkspaces).on("afterInit.size resize.size afterUpdateToolbar.size scroll.size afterResize.size",this.resizeWorkspaces).on("toggleFullSize.size toggleToolbar.size",this.resizeWorkspaceImd),this.initialize()}initialize(){const{j:e}=this;if(e.o.inline)return;let{height:t}=e.o;if(e.o.saveHeightInStorage&&"auto"!==t){const i=e.storage.get("height");i&&(t=i)}(0,g.css)(e.editor,{minHeight:"100%"}),(0,g.css)(e.container,{minHeight:e.o.minHeight,maxHeight:e.o.maxHeight,minWidth:e.o.minWidth,maxWidth:e.o.maxWidth}),this.setHeight(t),this.setWidth(e.o.width)}setHeight(e){if((0,g.isNumber)(e)){const{minHeight:t,maxHeight:i}=this.j.o;(0,g.isNumber)(t)&&t>e&&(e=t),(0,g.isNumber)(i)&&e>i&&(e=i)}(0,g.css)(this.j.container,"height",e),this.j.o.saveHeightInStorage&&this.j.storage.set("height",e),this.resizeWorkspaceImd()}setWidth(e){if((0,g.isNumber)(e)){const{minWidth:t,maxWidth:i}=this.j.o;(0,g.isNumber)(t)&&t>e&&(e=t),(0,g.isNumber)(i)&&e>i&&(e=i)}(0,g.css)(this.j.container,"width",e),this.resizeWorkspaceImd()}getNotWorkHeight(){var e,t;return((null===(e=this.j.toolbarContainer)||void 0===e?void 0:e.offsetHeight)||0)+((null===(t=this.j.statusbar)||void 0===t?void 0:t.getHeight())||0)+2}resizeWorkspaceImd(){if(!this.j||this.j.isDestructed||!this.j.o||this.j.o.inline)return;if(!this.j.container||!this.j.container.parentNode)return;const e=((0,g.css)(this.j.container,"minHeight")||0)-this.getNotWorkHeight();if((0,g.isNumber)(e)&&e>0&&([this.j.workplace,this.j.iframe,this.j.editor].map((t=>{t&&(0,g.css)(t,"minHeight",e)})),this.j.e.fire("setMinHeight",e)),(0,g.isNumber)(this.j.o.maxHeight)){const e=this.j.o.maxHeight-this.getNotWorkHeight();[this.j.workplace,this.j.iframe,this.j.editor].map((t=>{t&&(0,g.css)(t,"maxHeight",e)})),this.j.e.fire("setMaxHeight",e)}this.j.container&&(0,g.css)(this.j.workplace,"height","auto"!==this.j.o.height||this.j.isFullSize?this.j.container.offsetHeight-this.getNotWorkHeight():"auto")}beforeDestruct(e){e.e.off(e.ow,"load.size",this.resizeWorkspaces).off(".size")}};(0,r.gn)([L.autobind],Pi.prototype,"resizeWorkspaceImd",null),Pi=(0,r.gn)([L.autobind],Pi),n.D.prototype.beautifyHTML=!a.IS_IE,n.D.prototype.sourceEditor="ace",n.D.prototype.sourceEditorNativeOptions={showGutter:!0,theme:"ace/theme/idle_fingers",mode:"ace/mode/html",wrap:!0,highlightActiveLine:!0},n.D.prototype.sourceEditorCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"],n.D.prototype.beautifyHTMLCDNUrlsJS=["https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify.min.js","https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify-html.min.js"],n.D.prototype.controls.source={mode:a.MODE_SPLIT,exec(e){e.toggleMode()},isActive:e=>e.getRealMode()===a.MODE_SOURCE,tooltip:"Change mode"};class _i{constructor(e,t,i,o){this.jodit=e,this.container=t,this.toWYSIWYG=i,this.fromWYSIWYG=o,this.className="",this.isReady=!1}get j(){return this.jodit}onReady(){this.replaceUndoManager(),this.isReady=!0,this.j.e.fire(this,"ready")}onReadyAlways(e){var t;this.isReady?e():null===(t=this.j.events)||void 0===t||t.on(this,"ready",e)}}class Ri extends _i{constructor(){super(...arguments),this.autosize=this.j.async.debounce((()=>{this.instance.style.height="auto",this.instance.style.height=this.instance.scrollHeight+"px"}),this.j.defaultTimeout)}init(e){this.instance=e.c.element("textarea",{class:"jodit-source__mirror"}),this.container.appendChild(this.instance),e.e.on(this.instance,"mousedown keydown touchstart input",e.async.debounce(this.toWYSIWYG,e.defaultTimeout)).on("setMinHeight.source",(e=>{(0,g.css)(this.instance,"minHeight",e)})).on(this.instance,"change keydown mousedown touchstart input",this.autosize).on("afterSetMode.source",this.autosize).on(this.instance,"mousedown focus",(t=>{e.e.fire(t.type,t)})),this.autosize(),this.onReady()}destruct(){D.i.safeRemove(this.instance)}getValue(){return this.instance.value}setValue(e){this.instance.value=e}insertRaw(e){const t=this.getValue();if(0>this.getSelectionStart())this.setValue(t+e);else{const i=this.getSelectionStart(),o=this.getSelectionEnd();this.setValue(t.substring(0,i)+e+t.substring(o,t.length))}}getSelectionStart(){return this.instance.selectionStart}getSelectionEnd(){return this.instance.selectionEnd}setSelectionRange(e,t=e){this.instance.setSelectionRange(e,t)}focus(){this.instance.focus()}setPlaceHolder(e){this.instance.setAttribute("placeholder",e)}setReadOnly(e){e?this.instance.setAttribute("readonly","true"):this.instance.removeAttribute("readonly")}selectAll(){this.instance.select()}replaceUndoManager(){const{history:e}=this.jodit;this.j.e.on(this.instance,"keydown",(t=>{if((t.ctrlKey||t.metaKey)&&"z"===t.key)return t.shiftKey?e.redo():e.undo(),this.setSelectionRange(this.getValue().length),!1}))}}class Ni extends _i{constructor(){super(...arguments),this.className="jodit_ace_editor",this.proxyOnBlur=e=>{this.j.e.fire("blur",e)},this.proxyOnFocus=e=>{this.j.e.fire("focus",e)},this.proxyOnMouseDown=e=>{this.j.e.fire("mousedown",e)}}aceExists(){return void 0!==this.j.ow.ace}getLastColumnIndex(e){return this.instance.session.getLine(e).length}getLastColumnIndices(){const e=this.instance.session.getLength(),t=[];let i=0;for(let o=0;e>o;o++)i+=this.getLastColumnIndex(o),o>0&&(i+=1),t[o]=i;return t}getRowColumnIndices(e){const t=this.getLastColumnIndices();if(t[0]>=e)return{row:0,column:e};let i=1;for(let o=1;t.length>o;o++)e>t[o]&&(i=o+1);return{row:i,column:e-t[i-1]-1}}setSelectionRangeIndices(e,t){const i=this.getRowColumnIndices(e),o=this.getRowColumnIndices(t);this.instance.getSelection().setSelectionRange({start:i,end:o})}getIndexByRowColumn(e,t){return this.getLastColumnIndices()[e]-this.getLastColumnIndex(e)+t}init(e){const t=()=>{if(void 0!==this.instance||!this.aceExists())return;const t=this.j.c.div("jodit-source__mirror-fake");this.container.appendChild(t),this.instance=e.ow.ace.edit(t),this.instance.setTheme(e.o.sourceEditorNativeOptions.theme),this.instance.renderer.setShowGutter(e.o.sourceEditorNativeOptions.showGutter),this.instance.getSession().setMode(e.o.sourceEditorNativeOptions.mode),this.instance.setHighlightActiveLine(e.o.sourceEditorNativeOptions.highlightActiveLine),this.instance.getSession().setUseWrapMode(!0),this.instance.setOption("indentedSoftWrap",!1),this.instance.setOption("wrap",e.o.sourceEditorNativeOptions.wrap),this.instance.getSession().setUseWorker(!1),this.instance.$blockScrolling=1/0,this.instance.on("change",this.toWYSIWYG),this.instance.on("focus",this.proxyOnFocus),this.instance.on("mousedown",this.proxyOnMouseDown),this.instance.on("blur",this.proxyOnBlur),e.getRealMode()!==a.MODE_WYSIWYG&&this.setValue(this.getValue());const i=this.j.async.debounce((()=>{e.isInDestruct||(this.instance.setOption("maxLines","auto"!==e.o.height?e.workplace.offsetHeight/this.instance.renderer.lineHeight:1/0),this.instance.resize())}),2*this.j.defaultTimeout);e.e.on("afterResize afterSetMode",i),i(),this.onReady()};e.e.on("afterSetMode",(()=>{e.getRealMode()!==a.MODE_SOURCE&&e.getMode()!==a.MODE_SPLIT||(this.fromWYSIWYG(),t())})),t(),this.aceExists()||(0,g.loadNext)(e,e.o.sourceEditorCDNUrlsJS).then((()=>{e.isInDestruct||t()}))}destruct(){var e,t;this.instance.off("change",this.toWYSIWYG),this.instance.off("focus",this.proxyOnFocus),this.instance.off("mousedown",this.proxyOnMouseDown),this.instance.destroy(),null===(t=null===(e=this.j)||void 0===e?void 0:e.events)||void 0===t||t.off("aceInited.source")}setValue(e){if(!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const t=this.j.e.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}this.instance.setValue(e),this.instance.clearSelection()}getValue(){return this.instance.getValue()}setReadOnly(e){this.instance.setReadOnly(e)}focus(){this.instance.focus()}getSelectionStart(){const e=this.instance.selection.getRange();return this.getIndexByRowColumn(e.start.row,e.start.column)}getSelectionEnd(){const e=this.instance.selection.getRange();return this.getIndexByRowColumn(e.end.row,e.end.column)}selectAll(){this.instance.selection.selectAll()}insertRaw(e){const t=this.instance.selection.getCursor(),i=this.instance.session.insert(t,e);this.instance.selection.setRange({start:t,end:i},!1)}setSelectionRange(e,t){this.setSelectionRangeIndices(e,t)}setPlaceHolder(e){}replaceUndoManager(){const{history:e}=this.jodit;this.instance.commands.addCommand({name:"Undo",bindKey:{win:"Ctrl-Z",mac:"Command-Z"},exec(){e.undo()}}),this.instance.commands.addCommand({name:"Redo",bindKey:{win:"Ctrl-Shift-Z",mac:"Command-Shift-Z"},exec(){e.redo()}})}}function qi(e,t,i,o,s){let r;if((0,g.isFunction)(e))r=e(t);else switch(e){case"ace":if(!t.o.shadowRoot){r=new Ni(t,i,o,s);break}default:r=new Ri(t,i,o,s)}return r.init(t),r.onReadyAlways((()=>{r.setReadOnly(t.o.readonly)})),r}class Bi extends G{constructor(){super(...arguments),this.buttons=[{name:"source",group:"source"}],this.__lock=!1,this.__oldMirrorValue="",this.tempMarkerStart="{start-jodit-selection}",this.tempMarkerStartReg=/{start-jodit-selection}/g,this.tempMarkerEnd="{end-jodit-selection}",this.tempMarkerEndReg=/{end-jodit-selection}/g,this.getSelectionStart=()=>{var e,t;return null!==(t=null===(e=this.sourceEditor)||void 0===e?void 0:e.getSelectionStart())&&void 0!==t?t:0},this.getSelectionEnd=()=>{var e,t;return null!==(t=null===(e=this.sourceEditor)||void 0===e?void 0:e.getSelectionEnd())&&void 0!==t?t:0}}onInsertHTML(e){var t;if(!this.j.o.readonly&&!this.j.isEditorMode())return null===(t=this.sourceEditor)||void 0===t||t.insertRaw(e),this.toWYSIWYG(),!1}fromWYSIWYG(e=!1){if(!this.__lock||!0===e){this.__lock=!0;const e=this.j.getEditorValue(!1,"source-consumer");e!==this.getMirrorValue()&&this.setMirrorValue(e),this.__lock=!1}}toWYSIWYG(){if(this.__lock)return;const e=this.getMirrorValue();e!==this.__oldMirrorValue&&(this.__lock=!0,this.j.value=e,this.__lock=!1,this.__oldMirrorValue=e)}getNormalPosition(e,t){for(t=t.replace(/<(script|style|iframe)[^>]*>[^]*?<\/\1>/im,(e=>{let t="";for(let i=0;e.length>i;i+=1)t+=a.INVISIBLE_SPACE;return t}));e>0&&t[e]===a.INVISIBLE_SPACE;)e--;let i=e;for(;i>0;){if(i--,"<"===t[i]&&void 0!==t[i+1]&&t[i+1].match(/[\w/]+/i))return i;if(">"===t[i])return e}return e}clnInv(e){return e.replace(a.INVISIBLE_SPACE_REG_EXP(),"")}onSelectAll(e){var t;if("selectall"===e.toLowerCase()&&this.j.getRealMode()===a.MODE_SOURCE)return null===(t=this.sourceEditor)||void 0===t||t.selectAll(),!1}getMirrorValue(){var e;return(null===(e=this.sourceEditor)||void 0===e?void 0:e.getValue())||""}setMirrorValue(e){var t;null===(t=this.sourceEditor)||void 0===t||t.setValue(e)}setFocusToMirror(){var e;null===(e=this.sourceEditor)||void 0===e||e.focus()}saveSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)this.j.s.save(),this.j.synchronizeValues(),this.fromWYSIWYG(!0);else{if(this.j.o.editHTMLDocumentMode)return;const e=this.getMirrorValue();if(this.getSelectionStart()===this.getSelectionEnd()){const t=this.j.s.marker(!0),i=this.getNormalPosition(this.getSelectionStart(),this.getMirrorValue());this.setMirrorValue(e.substr(0,i)+this.clnInv(t.outerHTML)+e.substr(i))}else{const t=this.j.s.marker(!0),i=this.j.s.marker(!1),o=this.getNormalPosition(this.getSelectionStart(),e),s=this.getNormalPosition(this.getSelectionEnd(),e);this.setMirrorValue(e.substr(0,o)+this.clnInv(t.outerHTML)+e.substr(o,s-o)+this.clnInv(i.outerHTML)+e.substr(s))}this.toWYSIWYG()}}removeSelection(){if(this.j.getRealMode()===a.MODE_WYSIWYG)return this.__lock=!0,this.j.s.restore(),void(this.__lock=!1);let e=this.getMirrorValue(),t=0,i=0;try{if(e=e.replace(/]+data-jodit-selection_marker=(["'])start\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerStart).replace(/]+data-jodit-selection_marker=(["'])end\1[^>]*>[<>]*?<\/span>/gim,this.tempMarkerEnd),!this.j.o.editHTMLDocumentMode&&this.j.o.beautifyHTML){const t=this.j.e.fire("beautifyHTML",e);(0,g.isString)(t)&&(e=t)}if(t=e.indexOf(this.tempMarkerStart),i=t,e=e.replace(this.tempMarkerStartReg,""),-1!==t){const t=e.indexOf(this.tempMarkerEnd);-1!==t&&(i=t)}e=e.replace(this.tempMarkerEndReg,"")}finally{e=e.replace(this.tempMarkerEndReg,"").replace(this.tempMarkerStartReg,"")}this.setMirrorValue(e),this.setMirrorSelectionRange(t,i),this.toWYSIWYG(),this.setFocusToMirror()}setMirrorSelectionRange(e,t){var i;null===(i=this.sourceEditor)||void 0===i||i.setSelectionRange(e,t)}onReadonlyReact(){var e;null===(e=this.sourceEditor)||void 0===e||e.setReadOnly(this.j.o.readonly)}afterInit(e){if(this.mirrorContainer=e.c.div("jodit-source"),e.workplace.appendChild(this.mirrorContainer),e.e.on("afterAddPlace changePlace afterInit",(()=>{e.workplace.appendChild(this.mirrorContainer)})),this.sourceEditor=qi("area",e,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG),this.onReadonlyReact(),e.e.on("placeholder.source",(e=>{var t;null===(t=this.sourceEditor)||void 0===t||t.setPlaceHolder(e)})).on("change.source",this.syncValueFromWYSIWYG).on("beautifyHTML",(e=>e)),e.o.beautifyHTML){const t=()=>{var t;const i=e.ow.html_beautify;return!(!i||e.isInDestruct||(null===(t=e.events)||void 0===t||t.off("beautifyHTML").on("beautifyHTML",(e=>i(e))),0))};t()||(0,g.loadNext)(e,e.o.beautifyHTMLCDNUrlsJS).then(t)}this.syncValueFromWYSIWYG(!0),this.initSourceEditor(e)}syncValueFromWYSIWYG(e=!1){const t=this.j;t.getMode()!==a.MODE_SPLIT&&t.getMode()!==a.MODE_SOURCE||this.fromWYSIWYG(e)}initSourceEditor(e){var t;if("area"!==e.o.sourceEditor){const t=qi(e.o.sourceEditor,e,this.mirrorContainer,this.toWYSIWYG,this.fromWYSIWYG);t.onReadyAlways((()=>{var i,o;null===(i=this.sourceEditor)||void 0===i||i.destruct(),this.sourceEditor=t,this.syncValueFromWYSIWYG(!0),null===(o=e.events)||void 0===o||o.fire("sourceEditorReady",e)}))}else null===(t=this.sourceEditor)||void 0===t||t.onReadyAlways((()=>{var t;this.syncValueFromWYSIWYG(!0),null===(t=e.events)||void 0===t||t.fire("sourceEditorReady",e)}))}beforeDestruct(){this.sourceEditor&&(this.sourceEditor.destruct(),delete this.sourceEditor),D.i.safeRemove(this.mirrorContainer)}}(0,r.gn)([(0,L.watch)(":insertHTML.source")],Bi.prototype,"onInsertHTML",null),(0,r.gn)([L.autobind],Bi.prototype,"fromWYSIWYG",null),(0,r.gn)([L.autobind],Bi.prototype,"toWYSIWYG",null),(0,r.gn)([L.autobind],Bi.prototype,"getNormalPosition",null),(0,r.gn)([(0,L.watch)(":beforeCommand.source")],Bi.prototype,"onSelectAll",null),(0,r.gn)([(0,L.watch)(":beforeSetMode.source")],Bi.prototype,"saveSelection",null),(0,r.gn)([(0,L.watch)(":afterSetMode.source")],Bi.prototype,"removeSelection",null),(0,r.gn)([L.autobind],Bi.prototype,"setMirrorSelectionRange",null),(0,r.gn)([(0,L.watch)(":readonly.source")],Bi.prototype,"onReadonlyReact",null),(0,r.gn)([L.autobind],Bi.prototype,"syncValueFromWYSIWYG",null),n.D.prototype.showCharsCounter=!0,n.D.prototype.countHTMLChars=!1,n.D.prototype.showWordsCounter=!0;class Hi extends G{constructor(){super(...arguments),this.charCounter=null,this.wordCounter=null,this.reInit=()=>{this.j.o.showCharsCounter&&this.charCounter&&this.j.statusbar.append(this.charCounter,!0),this.j.o.showWordsCounter&&this.wordCounter&&this.j.statusbar.append(this.wordCounter,!0),this.j.e.off("change keyup",this.calc).on("change keyup",this.calc),this.calc()},this.calc=this.j.async.throttle((()=>{const e=this.j.text;if(this.j.o.showCharsCounter&&this.charCounter){const t=this.j.o.countHTMLChars?this.j.value:e.replace((0,a.SPACE_REG_EXP)(),"");this.charCounter.textContent=this.j.i18n("Chars: %d",t.length)}this.j.o.showWordsCounter&&this.wordCounter&&(this.wordCounter.textContent=this.j.i18n("Words: %d",e.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"").split((0,a.SPACE_REG_EXP)()).filter((e=>e.length)).length))}),this.j.defaultTimeout)}afterInit(){this.charCounter=this.j.c.span(),this.wordCounter=this.j.c.span(),this.j.e.on("afterInit changePlace afterAddPlace",this.reInit),this.reInit()}beforeDestruct(){D.i.safeRemove(this.charCounter),D.i.safeRemove(this.wordCounter),this.j.e.off("afterInit changePlace afterAddPlace",this.reInit),this.charCounter=null,this.wordCounter=null}}n.D.prototype.toolbarSticky=!0,n.D.prototype.toolbarDisableStickyForMobile=!0,n.D.prototype.toolbarStickyOffset=0;class Oi extends G{constructor(){super(...arguments),this.isToolbarSticked=!1,this.createDummy=e=>{},this.addSticky=e=>{this.isToolbarSticked||(this.createDummy(e),this.j.container.classList.add("jodit_sticky"),this.isToolbarSticked=!0),(0,g.css)(e,{top:this.j.o.toolbarStickyOffset||null,width:this.j.container.offsetWidth-2})},this.removeSticky=e=>{this.isToolbarSticked&&((0,g.css)(e,{width:"",top:""}),this.j.container.classList.remove("jodit_sticky"),this.isToolbarSticked=!1)}}afterInit(e){e.e.on(e.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).on("getStickyState.sticky",(()=>this.isToolbarSticked))}onScroll(){const{jodit:e}=this,t=e.ow.pageYOffset||e.od.documentElement&&e.od.documentElement.scrollTop||0,i=(0,g.offset)(e.container,e,e.od,!0),o=e.getMode()===a.MODE_WYSIWYG&&t+e.o.toolbarStickyOffset>i.top&&i.top+i.height>t+e.o.toolbarStickyOffset&&!(e.o.toolbarDisableStickyForMobile&&this.isMobile());if(e.o.toolbarSticky&&!0===e.o.toolbar&&this.isToolbarSticked!==o){const t=e.toolbarContainer;t&&(o?this.addSticky(t):this.removeSticky(t)),e.e.fire("toggleSticky",o)}}isMobile(){return this.j&&this.j.options&&this.j.container&&this.j.o.sizeSM>=this.j.container.offsetWidth}beforeDestruct(e){this.dummyBox&&D.i.safeRemove(this.dummyBox),e.e.off(e.ow,"scroll.sticky wheel.sticky mousewheel.sticky resize.sticky",this.onScroll).off(".sticky")}}(0,r.gn)([(0,L.throttle)()],Oi.prototype,"onScroll",null),n.D.prototype.spellcheck=!1,n.D.prototype.controls.spellcheck={isActive(e){return e.o.spellcheck},icon:i(84),name:"spellcheck",command:"toggleSpellcheck",tooltip:"Spellchecking"};class Fi extends G{constructor(){super(...arguments),this.buttons=[{group:"state",name:"spellcheck"}]}afterInit(e){e.e.on("afterInit afterAddPlace prepareWYSIWYGEditor",this.toggleSpellcheck),this.toggleSpellcheck(),e.registerCommand("toggleSpellcheck",(()=>{this.jodit.o.spellcheck=!this.jodit.o.spellcheck,this.toggleSpellcheck(),this.j.e.fire("updateToolbar")}))}toggleSpellcheck(){(0,gt.Lj)(this.jodit.editor,"spellcheck",this.jodit.o.spellcheck)}beforeDestruct(e){}}(0,r.gn)([L.autobind],Fi.prototype,"toggleSpellcheck",null),n.D.prototype.usePopupForSpecialCharacters=!1,n.D.prototype.specialCharacters=["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","‘","’","“","”","–","—","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","»","¬","®","¯","°","²","³","´","µ","¶","·","¸","¹","º","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Ŵ","Ŷ","ŵ","ŷ","‚","‛","„","…","™","►","•","→","⇒","⇔","♦","≈"],n.D.prototype.controls.symbol={icon:"omega",hotkeys:["ctrl+shift+i","cmd+shift+i"],tooltip:"Insert Special Character",popup(e,t,i,o){const s=e.e.fire("generateSpecialCharactersTable.symbols");if(s){if(e.o.usePopupForSpecialCharacters){const t=e.c.div();return t.classList.add("jodit-symbols"),t.appendChild(s),e.e.on(s,"close_dialog",o),t}{U(s,e.i18n("Select Special Character"),void 0,"jodit-symbols").bindDestruct(e);const t=s.querySelector("a");t&&t.focus()}}}};class Wi extends G{constructor(){super(...arguments),this.buttons=[{name:"symbol",group:"insert"}],this.countInRow=17}afterInit(e){e.e.on("generateSpecialCharactersTable.symbols",(()=>{const t=e.c.fromHTML('
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
'),i=t.querySelector(".jodit-symbols__preview"),o=t.querySelector("table").tBodies[0],s=[];for(let t=0;e.o.specialCharacters.length>t;){const i=e.c.element("tr");for(let o=0;this.countInRow>o&&e.o.specialCharacters.length>t;o+=1,t+=1){const r=e.c.element("td"),n=e.c.fromHTML(`${e.o.specialCharacters[t]}`);s.push(n),r.appendChild(n),i.appendChild(r)}o.appendChild(i)}const r=this;return e.e.on(s,"focus",(function(){i.innerHTML=this.innerHTML})).on(s,"mousedown",(function(t){D.i.isTag(this,"a")&&(e.s.focus(),e.s.insertHTML(this.innerHTML),e.e.fire(this,"close_dialog"),t&&t.preventDefault(),t&&t.stopImmediatePropagation())})).on(s,"mouseenter",(function(){D.i.isTag(this,"a")&&this.focus()})).on(s,"keydown",(t=>{const i=t.target;if(D.i.isTag(i,"a")){const o=parseInt((0,tt.Lj)(i,"-index")||"0",10),n=parseInt((0,tt.Lj)(i,"data-index-j")||"0",10);let l;switch(t.key){case a.KEY_UP:case a.KEY_DOWN:l=t.key===a.KEY_UP?o-r.countInRow:o+r.countInRow,void 0===s[l]&&(l=t.key===a.KEY_UP?Math.floor(s.length/r.countInRow)*r.countInRow+n:n,l>s.length-1&&(l-=r.countInRow)),s[l]&&s[l].focus();break;case a.KEY_RIGHT:case a.KEY_LEFT:l=t.key===a.KEY_LEFT?o-1:o+1,void 0===s[l]&&(l=t.key===a.KEY_LEFT?s.length-1:0),s[l]&&s[l].focus();break;case a.KEY_ENTER:e.e.fire(i,"mousedown"),t.stopImmediatePropagation(),t.preventDefault()}}})),t}))}beforeDestruct(e){e.e.off("generateSpecialCharactersTable.symbols")}}n.D.prototype.table={allowCellSelection:!0,selectionCellStyle:"border: 1px double #1e88e5 !important;",allowCellResize:!0,useExtraClassesOptions:!1},n.D.prototype.controls.table={data:{cols:10,rows:10,classList:{"table table-bordered":"Bootstrap Bordered","table table-striped":"Bootstrap Striped","table table-dark":"Bootstrap Dark"}},popup(e,t,i,o,s){const r=i.data&&i.data.rows?i.data.rows:10,n=i.data&&i.data.cols?i.data.cols:10,a=e.c.fromHTML('
'+(()=>{if(!e.o.table.useExtraClassesOptions)return"";const t=[];if(i.data){const e=i.data.classList;Object.keys(e).forEach((i=>{t.push(``)}))}return t.join("")})()+'
'),l=a.querySelectorAll("span")[0],c=a.querySelectorAll("span")[1],d=a.querySelector(".jodit-form__container"),h=a.querySelector(".jodit-form__options"),u=[],p=r*n;for(let t=0;p>t;t+=1)u[t]||u.push(e.c.element("span",{dataIndex:t}));if(e.e.on(d,"mousemove",((e,t)=>{const i=e.target;if(!D.i.isTag(i,"span"))return;const o=void 0===t||isNaN(t)?parseInt((0,tt.Lj)(i,"-index")||"0",10):t||0,s=Math.ceil((o+1)/n),r=o%n+1;for(let e=0;u.length>e;e+=1)u[e].className=e%n+1>r||Math.ceil((e+1)/n)>s?"":"jodit_hovered";c.textContent=""+r,l.textContent=""+s})).on(d,"touchstart mousedown",(t=>{const i=t.target;if(t.preventDefault(),t.stopImmediatePropagation(),!D.i.isTag(i,"span"))return;const s=parseInt((0,tt.Lj)(i,"-index")||"0",10),r=Math.ceil((s+1)/n),a=s%n+1,l=e.createInside,c=l.element("tbody"),d=l.element("table");d.appendChild(c),d.style.width="100%";let u,p,m=null;for(let e=1;r>=e;e+=1){u=l.element("tr");for(let e=1;a>=e;e+=1)p=l.element("td"),m||(m=p),(0,g.css)(p,"width",(100/a).toFixed(4)+"%"),p.appendChild(l.element("br")),u.appendChild(l.text("\n")),u.appendChild(l.text("\t")),u.appendChild(p);c.appendChild(l.text("\n")),c.appendChild(u)}const f=e.s.current();if(f&&e.s.isCollapsed()){const t=D.i.closest(f,D.i.isBlock,e.editor);t&&t!==e.editor&&!t.nodeName.match(/^TD|TH|TBODY|TABLE|THEADER|TFOOTER$/)&&e.s.setCursorAfter(t)}(0,g.$$)("input[type=checkbox]:checked",h).forEach((e=>{e.value.split(/[\s]+/).forEach((e=>{d.classList.add(e)}))})),e.s.insertNode(l.text("\n")),e.s.insertNode(d,!1),m&&(e.s.setCursorIn(m),(0,g.scrollIntoViewIfNeeded)(m,e.editor,e.ed)),o()})),s&&s.parentElement){for(let t=0;r>t;t+=1){const i=e.c.div();for(let e=0;n>e;e+=1)i.appendChild(u[t*n+e]);d.appendChild(i)}u[0]&&(u[0].className="hovered")}return a},tooltip:"Insert table"};const Vi="table_processor_observer-resize";class Ui extends G{constructor(){super(...arguments),this.selectMode=!1,this.resizeDelta=0,this.createResizeHandle=()=>{this.resizeHandler||(this.resizeHandler=this.j.c.div("jodit-table-resizer"),this.j.e.on(this.resizeHandler,"mousedown.table touchstart.table",this.onHandleMouseDown).on(this.resizeHandler,"mouseenter.table",(()=>{this.j.async.clearTimeout(this.hideTimeout)})))},this.hideTimeout=0,this.drag=!1,this.minX=0,this.maxX=0,this.startX=0}get module(){return this.j.getInstance("Table",this.j.o)}get isRTL(){return"rtl"===this.j.o.direction}showResizeHandle(){this.j.async.clearTimeout(this.hideTimeout),this.j.workplace.appendChild(this.resizeHandler)}hideResizeHandle(){this.hideTimeout=this.j.async.setTimeout((()=>{D.i.safeRemove(this.resizeHandler)}),{timeout:this.j.defaultTimeout,label:"hideResizer"})}onHandleMouseDown(e){if(this.j.isLocked)return;this.drag=!0,this.j.e.on(this.j.ow,"mouseup.resize-cells touchend.resize-cells",this.onMouseUp).on(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.startX=e.clientX,this.j.lock(Vi),this.resizeHandler.classList.add("jodit-table-resizer_moved");let t,i=this.workTable.getBoundingClientRect();if(this.minX=0,this.maxX=1e6,null!=this.wholeTable)i=this.workTable.parentNode.getBoundingClientRect(),this.minX=i.left,this.maxX=this.minX+i.width;else{const e=_e.formalCoordinate(this.workTable,this.workCell,!0);_e.formalMatrix(this.workTable,((i,o,s)=>{e[1]===s&&(t=i.getBoundingClientRect(),this.minX=Math.max(t.left+a.NEARBY/2,this.minX)),e[1]+(this.isRTL?-1:1)===s&&(t=i.getBoundingClientRect(),this.maxX=Math.min(t.left+t.width-a.NEARBY/2,this.maxX))}))}return!1}onMouseMove(e){if(!this.drag)return;this.j.e.fire("closeAllPopups");let t=e.clientX;const i=(0,g.offset)(this.resizeHandler.parentNode||this.j.od.documentElement,this.j,this.j.od,!0);this.minX>t&&(t=this.minX),t>this.maxX&&(t=this.maxX),this.resizeDelta=t-this.startX+(this.j.o.iframe?i.left:0),this.resizeHandler.style.left=t-(this.j.o.iframe?0:i.left)+"px";const o=this.j.s.sel;o&&o.removeAllRanges()}onMouseUp(e){(this.selectMode||this.drag)&&(this.selectMode=!1,this.j.unlock()),this.resizeHandler&&this.drag&&(this.drag=!1,this.j.e.off(this.j.ew,"mousemove.table touchmove.table",this.onMouseMove),this.resizeHandler.classList.remove("jodit-table-resizer_moved"),this.startX!==e.clientX&&(null==this.wholeTable?this.resizeColumns():this.resizeTable()),this.j.synchronizeValues(),this.j.s.focus())}resizeColumns(){const e=this.resizeDelta,t=[];_e.setColumnWidthByDelta(this.workTable,_e.formalCoordinate(this.workTable,this.workCell,!0)[1],e,!0,t);const i=(0,g.call)(this.isRTL?D.i.prev:D.i.next,this.workCell,D.i.isCell,this.workCell.parentNode);_e.setColumnWidthByDelta(this.workTable,_e.formalCoordinate(this.workTable,i)[1],-e,!1,t)}resizeTable(){const e=this.resizeDelta*(this.isRTL?-1:1),t=this.workTable.offsetWidth,i=(0,g.getContentWidth)(this.workTable.parentNode,this.j.ew),o=!this.wholeTable;if(this.isRTL?!o:o)this.workTable.style.width=(t+e)/i*100+"%";else{const o=this.isRTL?"marginRight":"marginLeft",s=parseInt(this.j.ew.getComputedStyle(this.workTable)[o]||"0",10);this.workTable.style.width=(t-e)/i*100+"%",this.workTable.style[o]=(s+e)/i*100+"%"}}setWorkCell(e,t=null){this.wholeTable=t,this.workCell=e,this.workTable=D.i.up(e,(e=>D.i.isTag(e,"table")),this.j.editor)}calcHandlePosition(e,t,i=0,o=0){const s=(0,g.offset)(t,this.j,this.j.ed);if(i>a.NEARBY&&s.width-a.NEARBY>i)return void this.hideResizeHandle();const r=(0,g.offset)(this.j.workplace,this.j,this.j.od,!0),n=(0,g.offset)(e,this.j,this.j.ed);if(this.resizeHandler.style.left=(i>a.NEARBY?s.left+s.width:s.left)-r.left+o+"px",Object.assign(this.resizeHandler.style,{height:n.height+"px",top:n.top-r.top+"px"}),this.showResizeHandle(),i>a.NEARBY){const e=(0,g.call)(this.isRTL?D.i.prev:D.i.next,t,D.i.isCell,t.parentNode);this.setWorkCell(t,!!e&&null)}else{const e=(0,g.call)(this.isRTL?D.i.next:D.i.prev,t,D.i.isCell,t.parentNode);this.setWorkCell(e||t,!e||null)}}afterInit(e){e.o.table.allowCellResize&&e.e.off(this.j.ow,".resize-cells").off(".resize-cells").on("change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells",(()=>{(0,g.$$)("table",e.editor).forEach(this.observe)})).on(this.j.ow,"scroll.resize-cells",(()=>{if(!this.drag)return;const t=D.i.up(this.workCell,(e=>D.i.isTag(e,"table")),e.editor);if(t){const e=t.getBoundingClientRect();this.resizeHandler.style.top=e.top+"px"}})).on("beforeSetMode.resize-cells",(()=>{this.module.getAllSelectedCells().forEach((t=>{this.module.removeSelection(t),_e.normalizeTable(D.i.closest(t,"table",e.editor))}))}))}observe(e){(0,g.dataBind)(e,Vi)||((0,g.dataBind)(e,Vi,!0),this.j.e.on(e,"mouseleave.resize-cells",(e=>{this.resizeHandler&&this.resizeHandler!==e.relatedTarget&&this.hideResizeHandle()})).on(e,"mousemove.resize-cells touchmove.resize-cells",this.j.async.throttle((t=>{if(this.j.isLocked)return;const i=D.i.up(t.target,D.i.isCell,e);i&&this.calcHandlePosition(e,i,t.offsetX)}),{timeout:this.j.defaultTimeout})),this.createResizeHandle())}beforeDestruct(e){e.events&&(e.e.off(this.j.ow,".resize-cells"),e.e.off(".resize-cells"))}}(0,r.gn)([L.autobind],Ui.prototype,"onHandleMouseDown",null),(0,r.gn)([L.autobind],Ui.prototype,"onMouseMove",null),(0,r.gn)([L.autobind],Ui.prototype,"onMouseUp",null),(0,r.gn)([L.autobind],Ui.prototype,"observe",null);const $i="table_processor_observer",Yi="onMoveTableSelectCell";class Ki extends G{constructor(){super(...arguments),this.requires=["select"],this.selectedCell=null,this.isSelectionMode=!1}get module(){return this.j.getInstance("Table",this.j.o)}afterInit(e){e.o.table.allowCellSelection&&e.e.on("keydown.select-cells",(e=>{e.key===a.KEY_TAB&&this.unselectCells()})).on("beforeCommand.select-cells",this.onExecCommand).on("afterCommand.select-cells",this.onAfterCommand).on(["clickEditor","mousedownTd","mousedownTh","touchstartTd","touchstartTh"].map((e=>e+".select-cells")).join(" "),this.onStartSelection).on("clickTr clickTbody",(()=>{var e;const t=this.module.getAllSelectedCells().length;if(t)return t>1&&(null===(e=this.j.s.sel)||void 0===e||e.removeAllRanges()),!1}))}onStartSelection(e){if(this.j.o.readonly)return;if(this.unselectCells(),e===this.j.editor)return;const t=D.i.closest(e,"table",this.j.editor);return e&&t?(e.firstChild||e.appendChild(this.j.createInside.element("br")),this.isSelectionMode=!0,this.selectedCell=e,this.module.addSelection(e),this.j.e.on(t,"mousemove.select-cells touchmove.select-cells",this.j.async.throttle(this.onMove.bind(this,t),{label:Yi,timeout:this.j.defaultTimeout/2})).on(t,"mouseup.select-cells touchend.select-cells",this.onStopSelection.bind(this,t)),!1):void 0}onOutsideClick(){this.selectedCell=null,this.onRemoveSelection()}onChange(){this.j.isLocked||this.isSelectionMode||this.onRemoveSelection()}onMove(e,t){var i;if(this.j.o.readonly&&!this.j.isLocked)return;if(this.j.isLockedNotBy($i))return;const o=this.j.ed.elementFromPoint(t.clientX,t.clientY);if(!o)return;const s=D.i.closest(o,["td","th"],e);if(!s||!this.selectedCell)return;s!==this.selectedCell&&this.j.lock($i),this.unselectCells();const r=_e.getSelectedBound(e,[s,this.selectedCell]),n=_e.formalMatrix(e);for(let e=r[0][0];r[1][0]>=e;e+=1)for(let t=r[0][1];r[1][1]>=t;t+=1)this.module.addSelection(n[e][t]);this.module.getAllSelectedCells().length>1&&(null===(i=this.j.s.sel)||void 0===i||i.removeAllRanges()),this.j.e.fire("hidePopup"),t.stopPropagation(),(()=>{const e=this.j.createInside.fromHTML('
 
');s.appendChild(e),this.j.async.setTimeout((()=>{var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)}),this.j.defaultTimeout/5)})()}onRemoveSelection(e){var t;if(!(null===(t=null==e?void 0:e.buffer)||void 0===t?void 0:t.actionTrigger)&&!this.selectedCell&&this.module.getAllSelectedCells().length)return this.j.unlock(),this.unselectCells(),void this.j.e.fire("hidePopup","cells");this.isSelectionMode=!1,this.selectedCell=null}onStopSelection(e,t){if(!this.selectedCell)return;this.isSelectionMode=!1,this.j.unlock();const i=this.j.ed.elementFromPoint(t.clientX,t.clientY);if(!i)return;const o=D.i.closest(i,["td","th"],e);if(!o)return;const s=D.i.closest(o,"table",e);if(s&&s!==e)return;const r=_e.getSelectedBound(e,[o,this.selectedCell]),n=_e.formalMatrix(e),a=n[r[1][0]][r[1][1]],l=n[r[0][0]][r[0][1]];this.j.e.fire("showPopup",e,(()=>{const e=(0,g.position)(l,this.j),t=(0,g.position)(a,this.j);return{left:e.left,top:e.top,width:t.left-e.left+t.width,height:t.top-e.top+t.height}}),"cells"),(0,g.$$)("table",this.j.editor).forEach((e=>{this.j.e.off(e,"mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells")})),this.j.async.clearTimeout(Yi)}unselectCells(e){const t=this.module,i=t.getAllSelectedCells();i.length&&i.forEach((i=>{e&&e===i||t.removeSelection(i)}))}onExecCommand(e){if(/table(splitv|splitg|merge|empty|bin|binrow|bincolumn|addcolumn|addrow)/.test(e)){e=e.replace("table","");const t=this.module.getAllSelectedCells();if(t.length){const[i]=t;if(!i)return;const o=D.i.closest(i,"table",this.j.editor);if(!o)return;switch(e){case"splitv":_e.splitVertical(o,this.j);break;case"splitg":_e.splitHorizontal(o,this.j);break;case"merge":_e.mergeSelected(o,this.j);break;case"empty":t.forEach((e=>D.i.detach(e)));break;case"bin":D.i.safeRemove(o);break;case"binrow":new Set(t.map((e=>e.parentNode))).forEach((e=>{_e.removeRow(o,e.rowIndex)}));break;case"bincolumn":{const e=new Set;t.reduce(((t,i)=>(e.has(i.cellIndex)||(t.push(i),e.add(i.cellIndex)),t)),[]).forEach((e=>{_e.removeColumn(o,e.cellIndex)}))}break;case"addcolumnafter":case"addcolumnbefore":_e.appendColumn(o,i.cellIndex,"addcolumnafter"===e,this.j.createInside);break;case"addrowafter":case"addrowbefore":_e.appendRow(o,i.parentNode,"addrowafter"===e,this.j.createInside)}}return!1}}onAfterCommand(e){/^justify/.test(e)&&this.module.getAllSelectedCells().forEach((t=>si(e,t)))}beforeDestruct(e){this.onRemoveSelection(),e.e.off(".select-cells")}}function Gi(e){e.e.off(".tableKeyboardNavigation").on("keydown.tableKeyboardNavigation",(t=>{let i,o;if(t.key!==a.KEY_TAB&&t.key!==a.KEY_LEFT&&t.key!==a.KEY_RIGHT&&t.key!==a.KEY_UP&&t.key!==a.KEY_DOWN)return;{if(i=e.s.current(),o=D.i.up(i,(e=>e&&e.nodeName&&/^td|th$/i.test(e.nodeName)),e.editor),!o)return;const s=e.s.range;if(t.key!==a.KEY_TAB&&i!==o&&((t.key===a.KEY_LEFT||t.key===a.KEY_UP)&&(D.i.prev(i,(e=>t.key===a.KEY_UP?D.i.isTag(e,"br"):!!e),o)||t.key!==a.KEY_UP&&D.i.isText(i)&&0!==s.startOffset)||(t.key===a.KEY_RIGHT||t.key===a.KEY_DOWN)&&(D.i.next(i,(e=>t.key===a.KEY_DOWN?D.i.isTag(e,"br"):!!e),o)||t.key!==a.KEY_DOWN&&D.i.isText(i)&&i.nodeValue&&s.startOffset!==i.nodeValue.length)))return}const s=D.i.up(o,(e=>e&&/^table$/i.test(e.nodeName)),e.editor);let r=null;switch(t.key){case a.KEY_TAB:case a.KEY_LEFT:{const i=t.key===a.KEY_LEFT||t.shiftKey?"prev":"next";r=D.i[i](o,(e=>e&&/^td|th$/i.test(e.tagName)),s),r||(_e.appendRow(s,"next"!==i&&s.querySelector("tr"),"next"===i,e.createInside),r=D.i[i](o,D.i.isCell,s));break}case a.KEY_UP:case a.KEY_DOWN:{let e=0,i=0;const n=_e.formalMatrix(s,((t,s,r)=>{t===o&&(e=s,i=r)}));t.key===a.KEY_UP?void 0!==n[e-1]&&(r=n[e-1][i]):void 0!==n[e+1]&&(r=n[e+1][i])}}if(r){if(r.firstChild)t.key===a.KEY_TAB?e.s.select(r,!0):e.s.setCursorIn(r,t.key===a.KEY_RIGHT||t.key===a.KEY_DOWN);else{const t=e.createInside.element("br");r.appendChild(t),e.s.setCursorBefore(t)}return!1}}))}function Ji(e){e.registerButton({name:"table",group:"insert"})}(0,r.gn)([L.autobind],Ki.prototype,"onStartSelection",null),(0,r.gn)([(0,L.watch)(":outsideClick")],Ki.prototype,"onOutsideClick",null),(0,r.gn)([(0,L.watch)(":change")],Ki.prototype,"onChange",null),(0,r.gn)([L.autobind],Ki.prototype,"onRemoveSelection",null),(0,r.gn)([L.autobind],Ki.prototype,"onStopSelection",null),(0,r.gn)([L.autobind],Ki.prototype,"onExecCommand",null),(0,r.gn)([L.autobind],Ki.prototype,"onAfterCommand",null);class Xi extends G{constructor(){super(...arguments),this.isOpened=!1,this.delayShowTimeout=0}afterInit(e){this.container=e.c.div("jodit-tooltip"),(0,j.ZO)(this.j,Xi).appendChild(this.container);let t=0;e.e.off(".tooltip").on("showTooltip.tooltip",((i,o)=>{e.async.clearTimeout(t),this.open(i,o)})).on("delayShowTooltip.tooltip",this.delayOpen).on("escape.tooltip",this.close).on("hideTooltip.tooltip change.tooltip scroll.tooltip changePlace.tooltip hidePopup.tooltip closeAllPopups.tooltip",(()=>{this.j.async.clearTimeout(this.delayShowTimeout),t=e.async.setTimeout(this.close,this.j.defaultTimeout)}))}delayOpen(e,t){const i=this.j.o.showTooltipDelay||this.j.defaultTimeout;this.j.async.clearTimeout(this.delayShowTimeout),this.delayShowTimeout=this.j.async.setTimeout((()=>this.open(e,t)),{timeout:i,label:"tooltip"})}open(e,t){this.container.classList.add("jodit-tooltip_visible"),this.container.innerHTML=t,this.isOpened=!0,this.setPosition(e)}setPosition(e){const t=e();(0,g.css)(this.container,{left:t.x,top:t.y})}close(){this.j.async.clearTimeout(this.delayShowTimeout),this.isOpened&&(this.isOpened=!1,this.container.classList.remove("jodit-tooltip_visible"),(0,g.css)(this.container,{left:-5e3}))}beforeDestruct(e){null==e||e.e.off(".tooltip"),this.close(),D.i.safeRemove(this.container)}}(0,r.gn)([L.autobind],Xi.prototype,"delayOpen",null),(0,r.gn)([L.autobind],Xi.prototype,"close",null),n.D.prototype.tab={tabInsideLiInsertNewList:!0};class Zi extends G{afterInit(e){}onTab(e){if(e.key===a.KEY_TAB&&(e=>{if(!e.o.tab.tabInsideLiInsertNewList||!e.s.isCollapsed())return!1;const t=e.createInside.fake();e.s.insertNode(t);const i=D.i.closest(t,"li",e.editor);if(i&&e.s.cursorOnTheLeft(i)&&D.i.isTag(i.previousElementSibling,"li")){const o=D.i.closest(i,["ol","ul"],e.editor);if(o){const s=e.createInside.element(o.tagName),r=i.previousElementSibling;return s.appendChild(i),r.appendChild(s),e.s.setCursorAfter(t),D.i.safeRemove(t),!0}}return D.i.safeRemove(t),!1})(this.j))return!1}beforeDestruct(e){}}function Qi(e){e.registerButton({name:"preview"}),e.registerCommand("preview",((t,i,o)=>{const s=new V({language:e.o.language,theme:e.o.theme});s.setSize(1024,600).open("",e.i18n("Preview")).setModal(!0),((e,t,i="px",o=null)=>{const s=((e,t)=>{const i=[];try{(0,g.$$)("img",e.editor).forEach((o=>{const s=[(0,g.attr)(o,"width"),(0,g.attr)(o,"height"),o.src];(0,g.attr)(o,{width:o.offsetWidth+t,height:o.offsetHeight+t});const r=e.createInside.a();e.ed.body.appendChild(r),r.href=o.src,o.src=r.href,D.i.safeRemove(r),i.push((()=>{var e;o.src=null!==(e=s[2])&&void 0!==e?e:"",(0,g.attr)(o,{width:s[0]||null,height:s[1]||null})}))}))}catch(e){throw i.forEach((e=>e())),i.length=0,e}return i})(e,i);try{const r=e.e.fire("beforePreviewBox",t,i);if(null!=r)return r;let n=e.c.div("jodit__preview-box");o&&o.appendChild(n),(0,g.css)(n,{position:"relative",padding:16});const a=e.value||`
${e.i18n("Empty")}
`;if(e.iframe){const t=e.create.element("iframe");(0,g.css)(t,{minWidth:800,minHeight:600,border:0}),n.appendChild(t);const i=t.contentWindow;i&&(e.e.fire("generateDocumentStructure.iframe",i.document,e),n=i.document.body)}else(0,g.css)(n,{minWidth:1024,minHeight:600,border:0});const l=(t,i)=>{const o=(0,g.isString)(i)?e.c.div():i;(0,g.isString)(i)&&(o.innerHTML=i);for(let e=0;o.children.length>e;e+=1){const i=o.children[e],s=t.ownerDocument.createElement(i.nodeName);for(let e=0;i.attributes.length>e;e+=1)(0,g.attr)(s,i.attributes[e].nodeName,i.attributes[e].nodeValue);0===i.children.length||D.i.isTag(i,["table"])?"SCRIPT"===i.nodeName?i.textContent&&(s.textContent=i.textContent):i.innerHTML&&(s.innerHTML=i.innerHTML):l(s,i);try{t.appendChild(s)}catch(e){}}};l(n,a),e.e.fire("afterPreviewBox",n)}finally{s.forEach((e=>e()))}})(e,o,"px",s.getElm("content"))}))}function eo(e){e.registerButton({name:"print"})}(0,r.gn)([(0,L.watch)(":keydown.tab")],Zi.prototype,"onTab",null),n.D.prototype.controls.preview={icon:"eye",command:"preview",mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Preview"},n.D.prototype.controls.print={exec(e){const t=e.create.element("iframe");Object.assign(t.style,{position:"fixed",right:0,bottom:0,width:0,height:0,border:0}),(0,j.ZO)(e,n.D).appendChild(t);const i=()=>{e.e.off(e.ow,"mousemove",i),D.i.safeRemove(t)},o=t.contentWindow;if(o){e.e.on(o,"onbeforeunload onafterprint",i).on(e.ow,"mousemove",i),e.o.iframe?(e.e.fire("generateDocumentStructure.iframe",o.document,e),o.document.body.innerHTML=e.value):(o.document.write(''+e.value+""),o.document.close());const t=o.document.createElement("style");t.innerHTML="@media print {\n\t\t\t\t\tbody {\n\t\t\t\t\t\t\t-webkit-print-color-adjust: exact;\n\t\t\t\t\t}\n\t\t\t}",o.document.head.appendChild(t),o.focus(),o.print()}},mode:a.MODE_SOURCE+a.MODE_WYSIWYG,tooltip:"Print"},n.D.prototype.showXPathInStatusbar=!0;class to extends G{constructor(){super(...arguments),this.onContext=(e,t)=>(this.menu||(this.menu=new S(this.j)),this.menu.show(t.clientX,t.clientY,[{icon:"bin",title:e===this.j.editor?"Clear":"Remove",exec:()=>{e!==this.j.editor?D.i.safeRemove(e):this.j.value="",this.j.synchronizeValues()}},{icon:"select-all",title:"Select",exec:()=>{this.j.s.select(e)}}]),!1),this.onSelectPath=(e,t)=>{this.j.s.focus();const i=(0,g.attr)(t.target,"-path")||"/";if("/"===i)return this.j.execCommand("selectall"),!1;try{const e=this.j.ed.evaluate(i,this.j.editor,null,XPathResult.ANY_TYPE,null).iterateNext();if(e)return this.j.s.select(e),!1}catch(e){}return this.j.s.select(e),!1},this.tpl=(e,t,i,o)=>{const s=this.j.c.fromHTML(`${(0,g.trim)(i)}`),r=s.firstChild;return this.j.e.on(r,"click",this.onSelectPath.bind(this,e)).on(r,"contextmenu",this.onContext.bind(this,e)),s},this.removeSelectAll=()=>{this.selectAllButton&&(this.selectAllButton.destruct(),delete this.selectAllButton)},this.appendSelectAll=()=>{this.removeSelectAll(),this.selectAllButton=O(this.j,{name:"selectall",...this.j.o.controls.selectall}),this.selectAllButton.state.size="tiny",this.container&&this.container.insertBefore(this.selectAllButton.container,this.container.firstChild)},this.calcPathImd=()=>{if(this.isDestructed)return;const e=this.j.s.current();if(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),e){let t,i,o;D.i.up(e,(e=>{e&&this.j.editor!==e&&!D.i.isText(e)&&(t=e.nodeName.toLowerCase(),i=(0,g.getXPathByElement)(e,this.j.editor).replace(/^\//,""),o=this.tpl(e,i,t,this.j.i18n("Select %s",t)),this.container&&this.container.insertBefore(o,this.container.firstChild))}),this.j.editor)}this.appendSelectAll()},this.calcPath=this.j.async.debounce(this.calcPathImd,2*this.j.defaultTimeout)}afterInit(){this.j.o.showXPathInStatusbar&&(this.container=this.j.c.div("jodit-xpath"),this.j.e.off(".xpath").on("mouseup.xpath change.xpath keydown.xpath changeSelection.xpath",this.calcPath).on("afterSetMode.xpath afterInit.xpath changePlace.xpath",(()=>{this.j.o.showXPathInStatusbar&&this.container&&(this.j.statusbar.append(this.container),this.j.getRealMode()===a.MODE_WYSIWYG?this.calcPath():(this.container&&(this.container.innerHTML=a.INVISIBLE_SPACE),this.appendSelectAll()))})),this.calcPath())}beforeDestruct(){this.j&&this.j.events&&this.j.e.off(".xpath"),this.removeSelectAll(),this.menu&&this.menu.destruct(),D.i.safeRemove(this.container),delete this.menu,delete this.container}}var io=i(85),oo=i(86),so=i(87),ro=i(88),no=i(89),ao=i(90),lo=i(91),co=i(92),ho=i(93),uo=i(94),po=i(95),mo=i(96),fo=i(97),go=i(98),vo=i(99),bo=i(100),yo=i(101),wo=i(102),ko=i(103),Co=i(104),So=i(105),Eo=i(106),Io=i(107),xo=i(108),zo=i(109),To=i(110),jo=i(111),Lo=i(112),Ao=i(113),Mo=i(114),Do=i(115),Po=i(116),_o=i(117),Ro=i(118),No=i(119),qo=i(120),Bo=i(121),Ho=i(122),Oo=i(123),Fo=i(124),Wo=i(125),Vo=i(126),Uo=i(127),$o=i(128),Yo=i(129),Ko=i(130),Go=i(131),Jo=i(132),Xo=i(133),Zo=i(134),Qo=i(135),es=i(136),ts=i(137),is=i(138),os=i(139),ss=i(140),rs=i(141),ns=i(142),as=i(143),ls=i(144),cs=i(145),ds=i(146),hs=i(147),us=i(148),ps=i(149),ms=i(150),fs=i(151),gs=i(152),vs=i(153),bs=i(154),ys=i(155),ws=i(156),ks=i(157),Cs=i(158),Ss=i(159),Es=i(160),Is=i(161),xs=i(162),zs=i(163),Ts=i(164),js=i(165),Ls=i(166),As=i(167);Object.keys(a).forEach((e=>{Jodit[e]=a[e]}));const Ms=e=>"__esModule"!==e;Object.keys(s).filter(Ms).forEach((e=>{P.JO.set(e.replace("_","-"),s[e])})),Object.keys(e).filter(Ms).forEach((t=>{Jodit.modules[t]=e[t]})),Object.keys(L).filter(Ms).forEach((e=>{Jodit.decorators[e]=L[e]})),["Confirm","Alert","Prompt"].forEach((t=>{Jodit[t]=e[t]})),Object.keys(t).filter(Ms).forEach((e=>{Jodit.plugins.add(e,t[e])})),Object.keys(Ge).filter(Ms).forEach((e=>{Jodit.lang[e]=Ge[e]}))}(),o}()})); \ No newline at end of file diff --git a/build/jodit.js b/build/jodit.js index 3abafe8a6..9059e7d5d 100644 --- a/build/jodit.js +++ b/build/jodit.js @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ @@ -9948,7 +9948,7 @@ function hook(status) { throw (0, error_1.error)('Handler must be a Function'); } target.hookStatus(status, function (component) { - target[propertyKey].call(component); + component[propertyKey].call(component); }); }; } @@ -10038,7 +10038,8 @@ var helpers_1 = __webpack_require__(146); var component_1 = __webpack_require__(154); function wait(condition) { return function (target, propertyKey) { - if (!(0, helpers_1.isFunction)(target[propertyKey])) { + var fn = target[propertyKey]; + if (!(0, helpers_1.isFunction)(fn)) { throw (0, helpers_1.error)('Handler must be a Function'); } target.hookStatus(component_1.STATUSES.ready, function (component) { @@ -10047,19 +10048,22 @@ function wait(condition) { : component.j.async; var realMethod = component[propertyKey]; var timeout = 0; - component[propertyKey] = function callProxy() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - async.clearTimeout(timeout); - if (condition(component)) { - realMethod.apply(component, args); - } - else { - timeout = async.setTimeout(function () { return callProxy.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false)); }, 10); + Object.defineProperty(component, propertyKey, { + configurable: true, + value: function callProxy() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + async.clearTimeout(timeout); + if (condition(component)) { + realMethod.apply(component, args); + } + else { + timeout = async.setTimeout(function () { return callProxy.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false)); }, 10); + } } - }; + }); }); }; } @@ -16303,7 +16307,7 @@ var View = (function (_super) { _this.isView = true; _this.mods = {}; _this.components = new Set(); - _this.version = "3.16.2"; + _this.version = "3.16.3"; _this.async = new async_1.Async(); _this.buffer = storage_1.Storage.makeStorage(); _this.storage = storage_1.Storage.makeStorage(true, _this.componentName); @@ -16450,10 +16454,10 @@ var View = (function (_super) { configurable: true }); View.prototype.getVersion = function () { - return "3.16.2"; + return "3.16.3"; }; View.getVersion = function () { - return "3.16.2"; + return "3.16.3"; }; View.prototype.initOptions = function (options) { this.options = (0, helpers_1.ConfigProto)(options || {}, (0, helpers_1.ConfigProto)(this.options || {}, View.defaultOptions)); diff --git a/build/jodit.min.css b/build/jodit.min.css index dd94bd9e9..2087fbb2f 100644 --- a/build/jodit.min.css +++ b/build/jodit.min.css @@ -1,7 +1,7 @@ /*! * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser * Author: Chupurnov (https://xdsoft.net/) - * Version: v3.16.2 + * Version: v3.16.3 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ diff --git a/build/jodit.min.js b/build/jodit.min.js index f7ef84a1c..c37b0b2d2 100644 --- a/build/jodit.min.js +++ b/build/jodit.min.js @@ -1 +1 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,(function(){return function(){var e=[,function(e,t,o){"use strict";o.r(t)},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),o(3),o(4),o(6),o(113),Array.from||(Array.from=function(e){if(e instanceof Set){var t=[];return e.forEach((function(e){return t.push(e)})),t}return[].slice.call(e)}),Array.prototype.includes||(Array.prototype.includes=function(e){return this.indexOf(e)>-1}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(e),n=1;arguments.length>n;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(o[i]=r[i])}return o},writable:!0,configurable:!0}),Array.prototype.find||(Array.prototype.find=function(e){return this.indexOf(e)>-1?e:void 0}),String.prototype.endsWith||(String.prototype.endsWith=function(e){return this[this.length-1]===e})},function(){"use strict";"document"in window.self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&function(e){if("Element"in e){var t="classList",o=e.Element.prototype,n=Object,r=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},i=Array.prototype.indexOf||function(e){for(var t=0,o=this.length;o>t;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},s=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return i.call(e,t)},l=function(e){for(var t=r.call(e.getAttribute("class")||""),o=t?t.split(/\s+/):[],n=0,i=o.length;i>n;n++)this.push(o[n]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=l.prototype=[],u=function(){return new l(this)};if(a.prototype=Error.prototype,c.item=function(e){return this[e]||null},c.contains=function(e){return-1!==s(this,e+="")},c.add=function(){var e,t=arguments,o=0,n=t.length,r=!1;do{-1===s(this,e=t[o]+"")&&(this.push(e),r=!0)}while(++oo;o++)t.call(this,e=arguments[o])}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:o.call(this,e)}}e=null}())},function(e,t,o){"use strict";e.exports=o(5).polyfill()},function(e,t,o){"use strict";e.exports=function(){function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,r=void 0,i=void 0,a=function(e,t){f[n]=e,f[n+1]=t,2===(n+=2)&&(i?i(h):b())},s="undefined"!=typeof window?window:void 0,l=s||{},c=l.MutationObserver||l.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(h,1)}}var f=new Array(1e3);function h(){for(var e=0;n>e;e+=2)(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0;n=0}var m,v,g,y,b=void 0;function _(e,t){var o=this,n=new this.constructor(C);void 0===n[S]&&A(n);var r=o._state;if(r){var i=arguments[r-1];a((function(){return z(r,n,i,o._result)}))}else P(o,n,e,t);return n}function w(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return E(t,e),t}b=u?function(){return process.nextTick(h)}:c?(v=0,g=new c(h),y=document.createTextNode(""),g.observe(y,{characterData:!0}),function(){y.data=v=++v%2}):d?((m=new MessageChannel).port1.onmessage=h,function(){return m.port2.postMessage(0)}):void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(r=e.runOnLoop||e.runOnContext)?function(){r(h)}:p()}catch(e){return p()}}():p();var S=Math.random().toString(36).substring(2);function C(){}var k=void 0;function j(t,o,n){o.constructor===t.constructor&&n===_&&o.constructor.resolve===w?function(e,t){1===t._state?x(e,t._result):2===t._state?T(e,t._result):P(t,void 0,(function(t){return E(e,t)}),(function(t){return T(e,t)}))}(t,o):void 0===n?x(t,o):e(n)?function(e,t,o){a((function(e){var n=!1,r=function(o,r,i,a){try{o.call(r,(function(o){n||(n=!0,t!==o?E(e,o):x(e,o))}),(function(t){n||(n=!0,T(e,t))}))}catch(e){return e}}(o,t);!n&&r&&(n=!0,T(e,r))}),e)}(t,o,n):x(t,o)}function E(e,t){if(e===t)T(e,new TypeError("You cannot resolve a promise with itself"));else if(r=typeof(n=t),null===n||"object"!==r&&"function"!==r)x(e,t);else{var o=void 0;try{o=t.then}catch(t){return void T(e,t)}j(e,t,o)}var n,r}function I(e){e._onerror&&e._onerror(e._result),D(e)}function x(e,t){e._state===k&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(D,e))}function T(e,t){e._state===k&&(e._state=2,e._result=t,a(I,e))}function P(e,t,o,n){var r=e._subscribers,i=r.length;e._onerror=null,r[i]=t,r[i+1]=o,r[i+2]=n,0===i&&e._state&&a(D,e)}function D(e){var t=e._subscribers,o=e._state;if(0!==t.length){for(var n=void 0,r=void 0,i=e._result,a=0;t.length>a;a+=3)r=t[a+o],(n=t[a])?z(o,n,r,i):r(i);e._subscribers.length=0}}function z(t,o,n,r){var i=e(n),a=void 0,s=void 0,l=!0;if(i){try{a=n(r)}catch(e){l=!1,s=e}if(o===a)return void T(o,new TypeError("A promises callback cannot return that same promise."))}else a=r;o._state!==k||(i&&l?E(o,a):!1===l?T(o,s):1===t?x(o,a):2===t&&T(o,a))}var M=0;function A(e){e[S]=M++,e._state=void 0,e._result=void 0,e._subscribers=[]}var O=function(){function e(e,o){this._instanceConstructor=e,this.promise=new e(C),this.promise[S]||A(this.promise),t(o)?(this.length=o.length,this._remaining=o.length,this._result=new Array(this.length),0===this.length?x(this.promise,this._result):(this.length=this.length||0,this._enumerate(o),0===this._remaining&&x(this.promise,this._result))):T(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===k&&e.length>t;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var o=this._instanceConstructor,n=o.resolve;if(n===w){var r=void 0,i=void 0,a=!1;try{r=e.then}catch(e){a=!0,i=e}if(r===_&&e._state!==k)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(o===L){var s=new o(C);a?T(s,i):j(s,e,r),this._willSettleAt(s,t)}else this._willSettleAt(new o((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,o){var n=this.promise;n._state===k&&(this._remaining--,2===e?T(n,o):this._result[t]=o),0===this._remaining&&x(n,this._result)},e.prototype._willSettleAt=function(e,t){var o=this;P(e,void 0,(function(e){return o._settledAt(1,t,e)}),(function(e){return o._settledAt(2,t,e)}))},e}(),L=function(){function t(e){this[S]=M++,this._result=this._state=void 0,this._subscribers=[],C!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){E(e,t)}),(function(t){T(e,t)}))}catch(t){T(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var o=this,n=o.constructor;return e(t)?o.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){throw e}))})):o.then(t,t)},t}();return L.prototype.then=_,L.all=function(e){return new O(this,e).promise},L.race=function(e){var o=this;return t(e)?new o((function(t,n){for(var r=e.length,i=0;r>i;i++)o.resolve(e[i]).then(t,n)})):new o((function(e,t){return t(new TypeError("You must pass an array to race."))}))},L.resolve=w,L.reject=function(e){var t=new this(C);return T(t,e),t},L._setScheduler=function(e){i=e},L._setAsap=function(e){a=e},L._asap=a,L.polyfill=function(){var e=void 0;if(void 0!==o.g)e=o.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=L},L.Promise=L,L}()},function(e,t,o){"use strict";o(7),o(78),o(80),o(96),o(97),o(98),o(99),o(100),o(101),o(102),o(103),o(104),o(105),o(106),o(107),o(108),o(109),o(110),o(111),o(112);var n=o(92);e.exports=n.Symbol},function(e,t,o){"use strict";var n=o(8),r=o(9),i=o(12),a=o(70),s=o(24),l=o(43),c=o(65),u=o(71),d=o(72),p=o(77),f=o(37),h=o(31),m=f("isConcatSpreadable"),v=9007199254740991,g="Maximum allowed index exceeded",y=r.TypeError,b=h>=51||!i((function(){var e=[];return e[m]=!1,e.concat()[0]!==e})),_=p("concat"),w=function(e){if(!s(e))return!1;var t=e[m];return void 0!==t?!!t:a(e)};n({target:"Array",proto:!0,forced:!b||!_},{concat:function(e){var t,o,n,r,i,a=l(this),s=d(a,0),p=0;for(t=-1,n=arguments.length;n>t;t++)if(w(i=-1===t?a:arguments[t])){if(p+(r=c(i))>v)throw y(g);for(o=0;r>o;o++,p++)o in i&&u(s,p,i[o])}else{if(p>=v)throw y(g);u(s,p++,i)}return s.length=p,s}})},function(e,t,o){"use strict";var n=o(9),r=o(10).f,i=o(47),a=o(51),s=o(41),l=o(58),c=o(69);e.exports=function(e,t){var o,u,d,p,f,h=e.target,m=e.global,v=e.stat;if(o=m?n:v?n[h]||s(h,{}):(n[h]||{}).prototype)for(u in t){if(p=t[u],d=e.noTargetGet?(f=r(o,u))&&f.value:o[u],!c(m?u:h+(v?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(o,u,p,e)}}},function(e,t,o){"use strict";var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof o.g&&o.g)||function(){return this}()||Function("return this")()},function(e,t,o){"use strict";var n=o(11),r=o(13),i=o(15),a=o(16),s=o(17),l=o(22),c=o(42),u=o(45),d=Object.getOwnPropertyDescriptor;t.f=n?d:function(e,t){if(e=s(e),t=l(t),u)try{return d(e,t)}catch(e){}if(c(e,t))return a(!r(i.f,e,t),e[t])}},function(e,t,o){"use strict";var n=o(12);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,o){"use strict";var n=o(14),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},function(e,t,o){"use strict";var n=o(12);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},function(e,t){"use strict";var o={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!o.call({1:2},1);t.f=r?function(e){var t=n(this,e);return!!t&&t.enumerable}:o},function(e){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,o){"use strict";var n=o(18),r=o(21);e.exports=function(e){return n(r(e))}},function(e,t,o){"use strict";var n=o(9),r=o(19),i=o(12),a=o(20),s=n.Object,l=r("".split);e.exports=i((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?l(e,""):s(e)}:s},function(e,t,o){"use strict";var n=o(14),r=Function.prototype,i=r.call,a=n&&r.bind.bind(i,i);e.exports=n?function(e){return e&&a(e)}:function(e){return e&&function(){return i.apply(e,arguments)}}},function(e,t,o){"use strict";var n=o(19),r=n({}.toString),i=n("".slice);e.exports=function(e){return i(r(e),8,-1)}},function(e,t,o){"use strict";var n=o(9).TypeError;e.exports=function(e){if(null==e)throw n("Can't call method on "+e);return e}},function(e,t,o){"use strict";var n=o(23),r=o(26);e.exports=function(e){var t=n(e,"string");return r(t)?t:t+""}},function(e,t,o){"use strict";var n=o(9),r=o(13),i=o(24),a=o(26),s=o(33),l=o(36),c=o(37),u=n.TypeError,d=c("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var o,n=s(e,d);if(n){if(void 0===t&&(t="default"),o=r(n,e,t),!i(o)||a(o))return o;throw u("Can't convert object to primitive value")}return void 0===t&&(t="number"),l(e,t)}},function(e,t,o){"use strict";var n=o(25);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},function(e){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,o){"use strict";var n=o(9),r=o(27),i=o(25),a=o(28),s=o(29),l=n.Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&a(t.prototype,l(e))}},function(e,t,o){"use strict";var n=o(9),r=o(25),i=function(e){return r(e)?e:void 0};e.exports=function(e,t){return 2>arguments.length?i(n[e]):n[e]&&n[e][t]}},function(e,t,o){"use strict";var n=o(19);e.exports=n({}.isPrototypeOf)},function(e,t,o){"use strict";var n=o(30);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,o){"use strict";var n=o(31),r=o(12);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&41>n}))},function(e,t,o){"use strict";var n,r,i=o(9),a=o(32),s=i.process,l=i.Deno,c=s&&s.versions||l&&l.version,u=c&&c.v8;u&&(r=(n=u.split("."))[0]>0&&4>n[0]?1:+(n[0]+n[1])),!r&&a&&((n=a.match(/Edge\/(\d+)/))&&74>n[1]||(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1])),e.exports=r},function(e,t,o){"use strict";var n=o(27);e.exports=n("navigator","userAgent")||""},function(e,t,o){"use strict";var n=o(34);e.exports=function(e,t){var o=e[t];return null==o?void 0:n(o)}},function(e,t,o){"use strict";var n=o(9),r=o(25),i=o(35),a=n.TypeError;e.exports=function(e){if(r(e))return e;throw a(i(e)+" is not a function")}},function(e,t,o){"use strict";var n=o(9).String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},function(e,t,o){"use strict";var n=o(9),r=o(13),i=o(25),a=o(24),s=n.TypeError;e.exports=function(e,t){var o,n;if("string"===t&&i(o=e.toString)&&!a(n=r(o,e)))return n;if(i(o=e.valueOf)&&!a(n=r(o,e)))return n;if("string"!==t&&i(o=e.toString)&&!a(n=r(o,e)))return n;throw s("Can't convert object to primitive value")}},function(e,t,o){"use strict";var n=o(9),r=o(38),i=o(42),a=o(44),s=o(30),l=o(29),c=r("wks"),u=n.Symbol,d=u&&u.for,p=l?u:u&&u.withoutSetter||a;e.exports=function(e){if(!i(c,e)||!s&&"string"!=typeof c[e]){var t="Symbol."+e;c[e]=s&&i(u,e)?u[e]:l&&d?d(t):p(t)}return c[e]}},function(e,t,o){"use strict";var n=o(39),r=o(40);(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.1",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(e){"use strict";e.exports=!1},function(e,t,o){"use strict";var n=o(9),r=o(41),i="__core-js_shared__",a=n[i]||r(i,{});e.exports=a},function(e,t,o){"use strict";var n=o(9),r=Object.defineProperty;e.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch(o){n[e]=t}return t}},function(e,t,o){"use strict";var n=o(19),r=o(43),i=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(r(e),t)}},function(e,t,o){"use strict";var n=o(9),r=o(21),i=n.Object;e.exports=function(e){return i(r(e))}},function(e,t,o){"use strict";var n=o(19),r=0,i=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++r+i,36)}},function(e,t,o){"use strict";var n=o(11),r=o(12),i=o(46);e.exports=!n&&!r((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,o){"use strict";var n=o(9),r=o(24),i=n.document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,o){"use strict";var n=o(11),r=o(48),i=o(16);e.exports=n?function(e,t,o){return r.f(e,t,i(1,o))}:function(e,t,o){return e[t]=o,e}},function(e,t,o){"use strict";var n=o(9),r=o(11),i=o(45),a=o(49),s=o(50),l=o(22),c=n.TypeError,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor;t.f=r?a?function(e,t,o){if(s(e),t=l(t),s(o),"function"==typeof e&&"prototype"===t&&"value"in o&&"writable"in o&&!o.writable){var n=d(e,t);n&&n.writable&&(e[t]=o.value,o={configurable:"configurable"in o?o.configurable:n.configurable,enumerable:"enumerable"in o?o.enumerable:n.enumerable,writable:!1})}return u(e,t,o)}:u:function(e,t,o){if(s(e),t=l(t),s(o),i)try{return u(e,t,o)}catch(e){}if("get"in o||"set"in o)throw c("Accessors not supported");return"value"in o&&(e[t]=o.value),e}},function(e,t,o){"use strict";var n=o(11),r=o(12);e.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(e,t,o){"use strict";var n=o(9),r=o(24),i=n.String,a=n.TypeError;e.exports=function(e){if(r(e))return e;throw a(i(e)+" is not an object")}},function(e,t,o){"use strict";var n=o(9),r=o(25),i=o(42),a=o(47),s=o(41),l=o(52),c=o(53),u=o(57).CONFIGURABLE,d=c.get,p=c.enforce,f=String(String).split("String");(e.exports=function(e,t,o,l){var c,d=!!l&&!!l.unsafe,h=!!l&&!!l.enumerable,m=!!l&&!!l.noTargetGet,v=l&&void 0!==l.name?l.name:t;r(o)&&("Symbol("===String(v).slice(0,7)&&(v="["+String(v).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!i(o,"name")||u&&o.name!==v)&&a(o,"name",v),(c=p(o)).source||(c.source=f.join("string"==typeof v?v:""))),e!==n?(d?!m&&e[t]&&(h=!0):delete e[t],h?e[t]=o:a(e,t,o)):h?e[t]=o:s(t,o)})(Function.prototype,"toString",(function(){return r(this)&&d(this).source||l(this)}))},function(e,t,o){"use strict";var n=o(19),r=o(25),i=o(40),a=n(Function.toString);r(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource},function(e,t,o){"use strict";var n,r,i,a=o(54),s=o(9),l=o(19),c=o(24),u=o(47),d=o(42),p=o(40),f=o(55),h=o(56),m="Object already initialized",v=s.TypeError;if(a||p.state){var g=p.state||(p.state=new(0,s.WeakMap)),y=l(g.get),b=l(g.has),_=l(g.set);n=function(e,t){if(b(g,e))throw new v(m);return t.facade=e,_(g,e,t),t},r=function(e){return y(g,e)||{}},i=function(e){return b(g,e)}}else{var w=f("state");h[w]=!0,n=function(e,t){if(d(e,w))throw new v(m);return t.facade=e,u(e,w,t),t},r=function(e){return d(e,w)?e[w]:{}},i=function(e){return d(e,w)}}e.exports={set:n,get:r,has:i,enforce:function(e){return i(e)?r(e):n(e,{})},getterFor:function(e){return function(t){var o;if(!c(t)||(o=r(t)).type!==e)throw v("Incompatible receiver, "+e+" required");return o}}}},function(e,t,o){"use strict";var n=o(9),r=o(25),i=o(52),a=n.WeakMap;e.exports=r(a)&&/native code/.test(i(a))},function(e,t,o){"use strict";var n=o(38),r=o(44),i=n("keys");e.exports=function(e){return i[e]||(i[e]=r(e))}},function(e){"use strict";e.exports={}},function(e,t,o){"use strict";var n=o(11),r=o(42),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=r(i,"name"),l=s&&"something"===function(){}.name,c=s&&(!n||n&&a(i,"name").configurable);e.exports={EXISTS:s,PROPER:l,CONFIGURABLE:c}},function(e,t,o){"use strict";var n=o(42),r=o(59),i=o(10),a=o(48);e.exports=function(e,t,o){for(var s=r(t),l=a.f,c=i.f,u=0;s.length>u;u++){var d=s[u];n(e,d)||o&&n(o,d)||l(e,d,c(t,d))}}},function(e,t,o){"use strict";var n=o(27),r=o(19),i=o(60),a=o(68),s=o(50),l=r([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=i.f(s(e)),o=a.f;return o?l(t,o(e)):t}},function(e,t,o){"use strict";var n=o(61),r=o(67).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,r)}},function(e,t,o){"use strict";var n=o(19),r=o(42),i=o(17),a=o(62).indexOf,s=o(56),l=n([].push);e.exports=function(e,t){var o,n=i(e),c=0,u=[];for(o in n)!r(s,o)&&r(n,o)&&l(u,o);for(;t.length>c;)r(n,o=t[c++])&&(~a(u,o)||l(u,o));return u}},function(e,t,o){"use strict";var n=o(17),r=o(63),i=o(65),a=function(e){return function(t,o,a){var s,l=n(t),c=i(l),u=r(a,c);if(e&&o!=o){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===o)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,o){"use strict";var n=o(64),r=Math.max,i=Math.min;e.exports=function(e,t){var o=n(e);return 0>o?r(o+t,0):i(o,t)}},function(e){"use strict";var t=Math.ceil,o=Math.floor;e.exports=function(e){var n=+e;return n!=n||0===n?0:(n>0?o:t)(n)}},function(e,t,o){"use strict";var n=o(66);e.exports=function(e){return n(e.length)}},function(e,t,o){"use strict";var n=o(64),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,o){"use strict";var n=o(12),r=o(25),i=/#|\.prototype\./,a=function(e,t){var o=l[s(e)];return o==u||o!=c&&(r(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},l=a.data={},c=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},function(e,t,o){"use strict";var n=o(20);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,o){"use strict";var n=o(22),r=o(48),i=o(16);e.exports=function(e,t,o){var a=n(t);a in e?r.f(e,a,i(0,o)):e[a]=o}},function(e,t,o){"use strict";var n=o(73);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},function(e,t,o){"use strict";var n=o(9),r=o(70),i=o(74),a=o(24),s=o(37)("species"),l=n.Array;e.exports=function(e){var t;return r(e)&&(i(t=e.constructor)&&(t===l||r(t.prototype))||a(t)&&null===(t=t[s]))&&(t=void 0),void 0===t?l:t}},function(e,t,o){"use strict";var n=o(19),r=o(12),i=o(25),a=o(75),s=o(27),l=o(52),c=function(){},u=[],d=s("Reflect","construct"),p=/^\s*(?:class|function)\b/,f=n(p.exec),h=!p.exec(c),m=function(e){if(!i(e))return!1;try{return d(c,u,e),!0}catch(e){return!1}},v=function(e){if(!i(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!f(p,l(e))}catch(e){return!0}};v.sham=!0,e.exports=!d||r((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?v:m},function(e,t,o){"use strict";var n=o(9),r=o(76),i=o(25),a=o(20),s=o(37)("toStringTag"),l=n.Object,c="Arguments"==a(function(){return arguments}());e.exports=r?a:function(e){var t,o,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=function(e,t){try{return e[t]}catch(e){}}(t=l(e),s))?o:c?a(t):"Object"==(n=a(t))&&i(t.callee)?"Arguments":n}},function(e,t,o){"use strict";var n={};n[o(37)("toStringTag")]="z",e.exports="[object z]"===String(n)},function(e,t,o){"use strict";var n=o(12),r=o(37),i=o(31),a=r("species");e.exports=function(e){return i>=51||!n((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,o){"use strict";var n=o(76),r=o(51),i=o(79);n||r(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,o){"use strict";var n=o(76),r=o(75);e.exports=n?{}.toString:function(){return"[object "+r(this)+"]"}},function(e,t,o){"use strict";var n=o(8),r=o(9),i=o(27),a=o(81),s=o(13),l=o(19),c=o(39),u=o(11),d=o(30),p=o(12),f=o(42),h=o(70),m=o(25),v=o(24),g=o(28),y=o(26),b=o(50),_=o(43),w=o(17),S=o(22),C=o(82),k=o(16),j=o(83),E=o(85),I=o(60),x=o(87),T=o(68),P=o(10),D=o(48),z=o(84),M=o(15),A=o(89),O=o(51),L=o(38),N=o(55),B=o(56),R=o(44),q=o(37),H=o(90),F=o(91),U=o(93),W=o(53),V=o(94).forEach,Y=N("hidden"),K="Symbol",G=q("toPrimitive"),J=W.set,X=W.getterFor(K),$=Object.prototype,Z=r.Symbol,Q=Z&&Z.prototype,ee=r.TypeError,te=r.QObject,oe=i("JSON","stringify"),ne=P.f,re=D.f,ie=x.f,ae=M.f,se=l([].push),le=L("symbols"),ce=L("op-symbols"),ue=L("string-to-symbol-registry"),de=L("symbol-to-string-registry"),pe=L("wks"),fe=!te||!te.prototype||!te.prototype.findChild,he=u&&p((function(){return 7!=j(re({},"a",{get:function(){return re(this,"a",{value:7}).a}})).a}))?function(e,t,o){var n=ne($,t);n&&delete $[t],re(e,t,o),n&&e!==$&&re($,t,n)}:re,me=function(e,t){var o=le[e]=j(Q);return J(o,{type:K,tag:e,description:t}),u||(o.description=t),o},ve=function(e,t,o){e===$&&ve(ce,t,o),b(e);var n=S(t);return b(o),f(le,n)?(o.enumerable?(f(e,Y)&&e[Y][n]&&(e[Y][n]=!1),o=j(o,{enumerable:k(0,!1)})):(f(e,Y)||re(e,Y,k(1,{})),e[Y][n]=!0),he(e,n,o)):re(e,n,o)},ge=function(e,t){b(e);var o=w(t),n=E(o).concat(we(o));return V(n,(function(t){u&&!s(ye,o,t)||ve(e,t,o[t])})),e},ye=function(e){var t=S(e),o=s(ae,this,t);return!(this===$&&f(le,t)&&!f(ce,t))&&(!(o||!f(this,t)||!f(le,t)||f(this,Y)&&this[Y][t])||o)},be=function(e,t){var o=w(e),n=S(t);if(o!==$||!f(le,n)||f(ce,n)){var r=ne(o,n);return!r||!f(le,n)||f(o,Y)&&o[Y][n]||(r.enumerable=!0),r}},_e=function(e){var t=ie(w(e)),o=[];return V(t,(function(e){f(le,e)||f(B,e)||se(o,e)})),o},we=function(e){var t=e===$,o=ie(t?ce:w(e)),n=[];return V(o,(function(e){!f(le,e)||t&&!f($,e)||se(n,le[e])})),n};if(d||(Z=function(){if(g(Q,this))throw ee("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?C(arguments[0]):void 0,t=R(e),o=function(e){this===$&&s(o,ce,e),f(this,Y)&&f(this[Y],t)&&(this[Y][t]=!1),he(this,t,k(1,e))};return u&&fe&&he($,t,{configurable:!0,set:o}),me(t,e)},O(Q=Z.prototype,"toString",(function(){return X(this).tag})),O(Z,"withoutSetter",(function(e){return me(R(e),e)})),M.f=ye,D.f=ve,z.f=ge,P.f=be,I.f=x.f=_e,T.f=we,H.f=function(e){return me(q(e),e)},u&&(re(Q,"description",{configurable:!0,get:function(){return X(this).description}}),c||O($,"propertyIsEnumerable",ye,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!d,sham:!d},{Symbol:Z}),V(E(pe),(function(e){F(e)})),n({target:K,stat:!0,forced:!d},{for:function(e){var t=C(e);if(f(ue,t))return ue[t];var o=Z(t);return ue[t]=o,de[o]=t,o},keyFor:function(e){if(!y(e))throw ee(e+" is not a symbol");if(f(de,e))return de[e]},useSetter:function(){fe=!0},useSimple:function(){fe=!1}}),n({target:"Object",stat:!0,forced:!d,sham:!u},{create:function(e,t){return void 0===t?j(e):ge(j(e),t)},defineProperty:ve,defineProperties:ge,getOwnPropertyDescriptor:be}),n({target:"Object",stat:!0,forced:!d},{getOwnPropertyNames:_e,getOwnPropertySymbols:we}),n({target:"Object",stat:!0,forced:p((function(){T.f(1)}))},{getOwnPropertySymbols:function(e){return T.f(_(e))}}),oe&&n({target:"JSON",stat:!0,forced:!d||p((function(){var e=Z();return"[null]"!=oe([e])||"{}"!=oe({a:e})||"{}"!=oe(Object(e))}))},{stringify:function(e,t,o){var n=A(arguments),r=t;if((v(t)||void 0!==e)&&!y(e))return h(t)||(t=function(e,t){if(m(r)&&(t=s(r,this,e,t)),!y(t))return t}),n[1]=t,a(oe,null,n)}}),!Q[G]){var Se=Q.valueOf;O(Q,G,(function(e){return s(Se,this)}))}U(Z,K),B[Y]=!0},function(e,t,o){"use strict";var n=o(14),r=Function.prototype,i=r.apply,a=r.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(i):function(){return a.apply(i,arguments)})},function(e,t,o){"use strict";var n=o(9),r=o(75),i=n.String;e.exports=function(e){if("Symbol"===r(e))throw TypeError("Cannot convert a Symbol value to a string");return i(e)}},function(e,t,o){"use strict";var n,r=o(50),i=o(84),a=o(67),s=o(56),l=o(86),c=o(46),u=o(55)("IE_PROTO"),d=function(){},p=function(e){return"