@lotte-innovate/ui-component-test 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/_virtual/index.mjs +1 -1
  2. package/_virtual/index13.mjs +1 -1
  3. package/_virtual/index15.mjs +1 -1
  4. package/_virtual/index17.mjs +1 -1
  5. package/_virtual/index19.mjs +1 -1
  6. package/_virtual/index2.mjs +1 -1
  7. package/_virtual/index21.mjs +2 -0
  8. package/_virtual/index21.mjs.map +1 -0
  9. package/_virtual/index22.mjs +2 -0
  10. package/_virtual/index22.mjs.map +1 -0
  11. package/_virtual/index3.mjs +1 -1
  12. package/_virtual/index5.mjs +1 -1
  13. package/_virtual/index7.mjs +1 -1
  14. package/_virtual/index9.mjs +1 -1
  15. package/_virtual/jsx-runtime.mjs +2 -0
  16. package/_virtual/jsx-runtime.mjs.map +1 -0
  17. package/_virtual/jsx-runtime2.mjs +2 -0
  18. package/_virtual/jsx-runtime2.mjs.map +1 -0
  19. package/_virtual/react-jsx-runtime.development.mjs +2 -0
  20. package/_virtual/react-jsx-runtime.development.mjs.map +1 -0
  21. package/_virtual/react-jsx-runtime.production.min.mjs +2 -0
  22. package/_virtual/react-jsx-runtime.production.min.mjs.map +1 -0
  23. package/_virtual/react.development.mjs +2 -0
  24. package/_virtual/react.development.mjs.map +1 -0
  25. package/_virtual/react.production.min.mjs +2 -0
  26. package/_virtual/react.production.min.mjs.map +1 -0
  27. package/dist/lib/components/Editor/index.mjs +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +3 -2
  30. package/public/tinymce/icons/default/index.mjs +1 -1
  31. package/public/tinymce/models/dom/index.mjs +1 -1
  32. package/public/tinymce/plugins/advlist/index.mjs +1 -1
  33. package/public/tinymce/plugins/advlist/index.mjs.map +1 -1
  34. package/public/tinymce/plugins/advlist/plugin.mjs +1 -1
  35. package/public/tinymce/plugins/advlist/plugin.mjs.map +1 -1
  36. package/public/tinymce/plugins/code/index.mjs +1 -1
  37. package/public/tinymce/plugins/code/plugin.mjs +1 -1
  38. package/public/tinymce/plugins/codesample/index.mjs +1 -1
  39. package/public/tinymce/plugins/codesample/index.mjs.map +1 -1
  40. package/public/tinymce/plugins/codesample/plugin.mjs +1 -1
  41. package/public/tinymce/plugins/image/index.mjs +1 -1
  42. package/public/tinymce/plugins/image/index.mjs.map +1 -1
  43. package/public/tinymce/plugins/image/plugin.mjs +1 -1
  44. package/public/tinymce/plugins/image/plugin.mjs.map +1 -1
  45. package/public/tinymce/plugins/link/index.mjs +1 -1
  46. package/public/tinymce/plugins/link/index.mjs.map +1 -1
  47. package/public/tinymce/plugins/link/plugin.mjs +1 -1
  48. package/public/tinymce/plugins/lists/index.mjs +1 -1
  49. package/public/tinymce/plugins/lists/plugin.mjs +1 -1
  50. package/public/tinymce/plugins/table/index.mjs +1 -1
  51. package/public/tinymce/plugins/table/plugin.mjs +1 -1
  52. package/public/tinymce/themes/silver/index.mjs +1 -1
@@ -1,2 +1,2 @@
1
- import{__exports as e}from"../../../../_virtual/plugin6.mjs";var t;function n(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,r=(l=String).prototype,r.isPrototypeOf(n)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===l.name)?"string":t;var n,r;var o,l,i})(t)===e,n=e=>t=>typeof t===e,r=t("string"),o=t("object"),l=t("array"),i=(a=null,e=>a===e);var a;const s=n("boolean"),c=e=>!(e=>null==e)(e),u=n("function"),g=(e,t)=>{if(l(e)){for(let n=0,r=e.length;n<r;++n)if(!t(e[n]))return!1;return!0}return!1},d=()=>{},m=(e,t)=>e===t;class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:h.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?h.some(e):h.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}h.singletonNone=new h(!1);const f=Array.prototype.indexOf,p=Array.prototype.push,k=(e,t)=>((e,t)=>f.call(e,t))(e,t)>-1,v=e=>{const t=[];for(let n=0,r=e.length;n<r;++n){if(!l(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);p.apply(t,e[n])}return t},x=(e,t)=>v(((e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r})(e,t)),y=(e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n],n);if(r.isSome())return r}return h.none()},b=(e,t,n=m)=>e.exists((e=>n(e,t))),_=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t},w=(e,t)=>e?h.some(t):h.none(),C=e=>t=>t.options.get(e),O=C("link_assume_external_targets"),N=C("link_context_toolbar"),A=C("link_list"),S=C("link_default_target"),E=C("link_default_protocol"),T=C("link_target_list"),R=C("link_rel_list"),P=C("link_class_list"),L=C("link_title"),M=C("allow_unsafe_link_target"),D=C("link_quicklink");var U=tinymce.util.Tools.resolve("tinymce.util.Tools");const B=e=>r(e.value)?e.value:"",j=(e,t)=>{const n=[];return U.each(e,(e=>{const o=(e=>r(e.text)?e.text:r(e.title)?e.title:"")(e);if(void 0!==e.menu){const r=j(e.menu,t);n.push({text:o,items:r})}else{const r=t(e);n.push({text:o,value:r})}})),n},I=(e=B)=>t=>h.from(t).map((t=>j(t,e))),K={sanitize:e=>I(B)(e),sanitizeWith:I,createUi:(e,t)=>n=>({name:e,type:"listbox",label:t,items:n}),getValue:B},z=Object.keys,q=Object.hasOwnProperty,V=(e,t,n,r)=>{((e,t)=>{const n=z(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}})(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))},F=(e,t)=>q.call(e,t);var W=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$=tinymce.util.Tools.resolve("tinymce.util.URI");const G=e=>c(e)&&"a"===e.nodeName.toLowerCase(),H=e=>G(e)&&!!X(e),J=(e,t)=>{if(e.collapsed)return[];{const n=e.cloneContents(),r=n.firstChild,o=new W(r,n),l=[];let i=r;do{t(i)&&l.push(i)}while(i=o.next());return l}},Q=e=>/^\w+:/i.test(e),X=e=>{var t,n;return null!==(n=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==n?n:""},Y=(e,t)=>{const n=["noopener"],r=e?e.split(/\s+/):[],o=e=>e.filter((e=>-1===U.inArray(n,e))),l=t?(e=>(e=o(e)).length>0?e.concat(n):n)(r):o(r);return l.length>0?(e=>U.trim(e.sort().join(" ")))(l):""},Z=(e,t)=>(t=t||ne(e.selection.getRng())[0]||e.selection.getNode(),ie(t)?h.from(e.dom.select("a[href]",t)[0]):h.from(e.dom.getParent(t,"a[href]"))),ee=(e,t)=>Z(e,t).isSome(),te=(e,t)=>(e=>e.replace(/\uFEFF/g,""))(t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||""))),ne=e=>J(e,H),re=e=>U.grep(e,H),oe=e=>re(e).length>0,le=e=>{const t=e.schema.getTextInlineElements(),n=e=>1===e.nodeType&&!G(e)&&!F(t,e.nodeName.toLowerCase());if(Z(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const r=e.selection.getRng();if(r.collapsed)return!0;return 0===J(r,n).length},ie=e=>c(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ae=(e,t)=>{const n={...t};if(0===R(e).length&&!M(e)){const e=Y(n.rel,"_blank"===n.target);n.rel=e||null}return h.from(n.target).isNone()&&!1===T(e)&&(n.target=S(e)),n.href=((e,t)=>"http"!==t&&"https"!==t||Q(e)?e:t+"://"+e)(n.href,O(e)),n},se=(e,t,n)=>{const r=e.selection.getNode(),o=Z(e,r),l=ae(e,(e=>{return t=["title","rel","class","target"],n=(t,n)=>(e[n].each((e=>{t[n]=e.length>0?e:null})),t),r={href:e.href},((e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)})(t,((e,t)=>{r=n(r,e,t)})),r;var t,n,r})(n));e.undoManager.transact((()=>{n.href===t.href&&t.attach(),o.fold((()=>{((e,t,n,r)=>{const o=e.dom;ie(t)?me(o,t,r):n.fold((()=>{e.execCommand("mceInsertLink",!1,r)}),(t=>{e.insertContent(o.createHTML("a",r,o.encode(t)))}))})(e,r,n.text,l)}),(t=>{e.focus(),((e,t,n,r)=>{n.each((e=>{F(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,r),e.selection.select(t)})(e,t,n.text,l)}))}))},ce=e=>{const{class:t,href:n,rel:r,target:o,text:l,title:a}=e;return((e,t)=>{const n={};var r;return V(e,t,(r=n,(e,t)=>{r[t]=e}),d),n})({class:t.getOrNull(),href:n,rel:r.getOrNull(),target:o.getOrNull(),text:l.getOrNull(),title:a.getOrNull()},((e,t)=>!1===i(e)))},ue=(e,t,n)=>{const r=((e,t)=>{const n=e.options.get,r={allow_html_data_urls:n("allow_html_data_urls"),allow_script_urls:n("allow_script_urls"),allow_svg_data_urls:n("allow_svg_data_urls")},o=t.href;return{...t,href:$.isDomSafe(o,"a",r)?o:""}})(e,n);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,ce(r)):se(e,t,r)},ge=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();ie(t)?de(e,t):(e=>{const t=e.dom,n=e.selection,r=n.getBookmark(),o=n.getRng().cloneRange(),l=t.getParent(o.startContainer,"a[href]",e.getBody()),i=t.getParent(o.endContainer,"a[href]",e.getBody());l&&o.setStartBefore(l),i&&o.setEndAfter(i),n.setRng(o),e.execCommand("unlink"),n.moveToBookmark(r)})(e),e.focus()}))})(e)},de=(e,t)=>{var n;const r=e.dom.select("img",t)[0];if(r){const o=e.dom.getParents(r,"a[href]",t)[0];o&&(null===(n=o.parentNode)||void 0===n||n.insertBefore(r,o),e.dom.remove(o))}},me=(e,t,n)=>{var r;const o=e.select("img",t)[0];if(o){const t=e.create("a",n);null===(r=o.parentNode)||void 0===r||r.insertBefore(t,o),t.appendChild(o)}},he=e=>{return F(t=e,n="items")&&void 0!==t[n]&&null!==t[n];var t,n},fe=(e,t)=>y(t,(t=>he(t)?fe(e,t.items):w(t.value===e,t))),pe=(e,t,n,r)=>{const o=r[t],l=e.length>0;return void 0!==o?fe(o,n).map((t=>({url:{value:t.value,meta:{text:l?e:t.text,attach:d}},text:l?e:t.text}))):h.none()},ke=(e,t)=>{const n={text:e.text,title:e.title},r=e=>{const t=(r=e.url,w(n.text.length<=0,h.from(null===(o=r.meta)||void 0===o?void 0:o.text).getOr(r.value)));var r,o;const l=(e=>{var t;return w(n.title.length<=0,h.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||l.isSome()?h.some({...t.map((e=>({text:e}))).getOr({}),...l.map((e=>({title:e}))).getOr({})}):h.none()},o=(e,r)=>{const o=(l=t,i=r,"link"===i?l.link:"anchor"===i?l.anchor:h.none()).getOr([]);var l,i;return pe(n.text,r,o,e)};return{onChange:(e,t)=>{const l=t.name;return"url"===l?r(e()):k(["anchor","link"],l)?o(e(),l):"text"===l||"title"===l?(n[l]=e()[l],h.none()):h.none()}}};var ve=tinymce.util.Tools.resolve("tinymce.util.Delay");const xe=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?h.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):h.none()},ye=(e,t)=>n=>{const r=n.href;return 1===e&&!Q(r)||0===e&&/^\s*www(\.|\d\.)/i.test(r)?h.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+r})}):h.none()},be=(e,t)=>y([xe,ye(O(e),E(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(n=>new Promise((r=>{((e,t,n)=>{const r=e.selection.getRng();ve.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(r),n(t)}))}))})(e,n.message,(e=>{r(e?n.preprocess(t):t)}))})))),_e=e=>{const t=e.dom.select("a:not([href])"),n=x(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]}));return n.length>0?h.some([{text:"None",value:""}].concat(n)):h.none()},we=e=>{const t=P(e);return t.length>0?K.sanitize(t):h.none()},Ce=e=>{try{return h.some(JSON.parse(e))}catch(e){return h.none()}},Oe=e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),n=A(e);return new Promise((e=>{r(n)?fetch(n).then((e=>e.ok?e.text().then(Ce):Promise.reject())).then(e,(()=>e(h.none()))):u(n)?n((t=>e(h.some(t)))):e(h.from(n))})).then((e=>e.bind(K.sanitizeWith(t)).map((e=>{if(e.length>0){return[{text:"None",value:""}].concat(e)}return e}))))},Ne=(e,t)=>{const n=R(e);if(n.length>0){const r=b(t,"_blank"),o=e=>Y(K.getValue(e),r);return(!1===M(e)?K.sanitizeWith(o):K.sanitize)(n)}return h.none()},Ae=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Se=e=>{const t=T(e);return l(t)?K.sanitize(t).orThunk((()=>h.some(Ae))):!1===t?h.none():h.some(Ae)},Ee=(e,t,n)=>{const r=e.getAttrib(t,n);return null!==r&&r.length>0?h.some(r):h.none()},Te=(e,t)=>Oe(e).then((n=>{const r=((e,t)=>{const n=e.dom,r=le(e)?h.some(te(e.selection,t)):h.none(),o=t.bind((e=>h.from(n.getAttrib(e,"href")))),l=t.bind((e=>h.from(n.getAttrib(e,"target")))),i=t.bind((e=>Ee(n,e,"rel"))),a=t.bind((e=>Ee(n,e,"class")));return{url:o,text:r,title:t.bind((e=>Ee(n,e,"title"))),target:l,rel:i,linkClass:a}})(e,t);return{anchor:r,catalogs:{targets:Se(e),rels:Ne(e,r.target),classes:we(e),anchor:_e(e),link:n},optNode:t,flags:{titleEnabled:L(e)}}})),Re=e=>{const t=(e=>{const t=Z(e);return Te(e,t)})(e);t.then((t=>{const n=((e,t)=>n=>{const r=n.getData();if(!r.url.value)return ge(e),void n.close();const o=e=>h.from(r[e]).filter((n=>!b(t.anchor[e],n))),l={href:r.url.value,text:o("text"),target:o("target"),rel:o("rel"),class:o("linkClass"),title:o("title")},i={href:r.url.value,attach:void 0!==r.url.meta&&r.url.meta.attach?r.url.meta.attach:d};be(e,l).then((t=>{ue(e,i,t)})),n.close()})(e,t);return((e,t,n)=>{const r=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),o=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],l=((e,t)=>{const n=e.anchor,r=n.url.getOr("");return{url:{value:r,meta:{original:{value:r}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:r,link:r,rel:n.rel.getOr(""),target:n.target.or(t).getOr(""),linkClass:n.linkClass.getOr("")}})(e,h.from(S(n))),i=e.catalogs,a=ke(l,i);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:v([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],r,o,_([i.anchor.map(K.createUi("anchor","Anchors")),i.rels.map(K.createUi("rel","Rel")),i.targets.map(K.createUi("target","Open link in...")),i.link.map(K.createUi("link","Link list")),i.classes.map(K.createUi("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onChange:(e,{name:t})=>{a.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,n,e)})).then((t=>{e.windowManager.open(t)}))};var Pe=tinymce.util.Tools.resolve("tinymce.util.VK");const Le=e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,n)},Me=(e,t)=>e.dom.getParent(t,"a[href]"),De=e=>Me(e,e.selection.getStart()),Ue=(e,t)=>{if(t){const n=X(t);if(/^#/.test(n)){const t=e.dom.select(n);t.length&&e.selection.scrollIntoView(t[0],!0)}else Le(t.href)}},Be=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},je=e=>()=>{Ue(e,De(e))},Ie=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Ke=e=>t=>{const n=()=>{t.setActive(!e.mode.isReadOnly()&&ee(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return n(),Ie(e,n)},ze=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return n(),Ie(e,n)},qe=e=>t=>{const n=()=>t.setEnabled((e=>1===(e.selection.isCollapsed()?re(e.dom.getParents(e.selection.getStart())):ne(e.selection.getRng())).length)(e));return n(),Ie(e,n)},Ve=e=>t=>{const n=t=>{return oe(t)||(n=e.selection.getRng(),ne(n).length>0);var n},r=e.dom.getParents(e.selection.getStart()),o=r=>{t.setEnabled(n(r)&&e.selection.isEditable())};return o(r),Ie(e,(e=>o(e.parents)))},Fe=e=>{const t=t=>{const n=e.selection.getNode();return t.setEnabled(ee(e,n)),d};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Ke(e)},label:"Link",predicate:t=>N(e)&&ee(e,t),initValue:()=>{return Z(e).fold((t="",()=>t),X);var t},commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const n=e.selection.getNode();return t.setActive(ee(e,n)),Ke(e)(t)},onAction:t=>{const n=t.getValue(),r=(t=>{const n=Z(e),r=le(e);if(n.isNone()&&r){const r=te(e.selection,n);return w(0===r.length,t)}return h.none()})(n);ue(e,{href:n,attach:d},{href:n,text:r,title:h.none(),rel:h.none(),target:h.none(),class:h.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:t,onAction:t=>{ge(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:t,onAction:t=>{je(e)(),t.hide()}}]})};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=r(e)||s(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>r(e)||u(e)||g(e,o)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>s(e)||g(e,o),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1})})(e),(e=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Be(e),onSetup:Ke(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:je(e),onSetup:qe(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>ge(e),onSetup:Ve(e)})})(e),(e=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:je(e),onSetup:qe(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onSetup:ze(e),onAction:Be(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>ge(e),onSetup:Ve(e)})})(e),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?oe(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),Fe(e),(e=>{e.on("click",(t=>{const n=Me(e,t.target);n&&Pe.metaKeyPressed(t)&&(t.preventDefault(),Ue(e,n))})),e.on("keydown",(t=>{if(!t.isDefaultPrevented()&&13===t.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(t)){const n=De(e);n&&(t.preventDefault(),Ue(e,n))}}))})(e),(e=>{e.addCommand("mceLink",((t,n)=>{!0!==(null==n?void 0:n.dialog)&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Re(e)}))})(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}()),e}export{n as __require};
1
+ import{__exports as e}from"../../../../_virtual/plugin2.mjs";var t;function n(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,r=(l=String).prototype,r.isPrototypeOf(n)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===l.name)?"string":t;var n,r;var o,l,i})(t)===e,n=e=>t=>typeof t===e,r=t("string"),o=t("object"),l=t("array"),i=(a=null,e=>a===e);var a;const s=n("boolean"),c=e=>!(e=>null==e)(e),u=n("function"),g=(e,t)=>{if(l(e)){for(let n=0,r=e.length;n<r;++n)if(!t(e[n]))return!1;return!0}return!1},d=()=>{},m=(e,t)=>e===t;class h{constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:h.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?h.some(e):h.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}h.singletonNone=new h(!1);const f=Array.prototype.indexOf,p=Array.prototype.push,k=(e,t)=>((e,t)=>f.call(e,t))(e,t)>-1,v=e=>{const t=[];for(let n=0,r=e.length;n<r;++n){if(!l(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);p.apply(t,e[n])}return t},x=(e,t)=>v(((e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r})(e,t)),y=(e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n],n);if(r.isSome())return r}return h.none()},b=(e,t,n=m)=>e.exists((e=>n(e,t))),_=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t},w=(e,t)=>e?h.some(t):h.none(),C=e=>t=>t.options.get(e),O=C("link_assume_external_targets"),N=C("link_context_toolbar"),A=C("link_list"),S=C("link_default_target"),E=C("link_default_protocol"),T=C("link_target_list"),R=C("link_rel_list"),P=C("link_class_list"),L=C("link_title"),M=C("allow_unsafe_link_target"),D=C("link_quicklink");var U=tinymce.util.Tools.resolve("tinymce.util.Tools");const B=e=>r(e.value)?e.value:"",j=(e,t)=>{const n=[];return U.each(e,(e=>{const o=(e=>r(e.text)?e.text:r(e.title)?e.title:"")(e);if(void 0!==e.menu){const r=j(e.menu,t);n.push({text:o,items:r})}else{const r=t(e);n.push({text:o,value:r})}})),n},I=(e=B)=>t=>h.from(t).map((t=>j(t,e))),K={sanitize:e=>I(B)(e),sanitizeWith:I,createUi:(e,t)=>n=>({name:e,type:"listbox",label:t,items:n}),getValue:B},z=Object.keys,q=Object.hasOwnProperty,V=(e,t,n,r)=>{((e,t)=>{const n=z(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}})(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))},F=(e,t)=>q.call(e,t);var W=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$=tinymce.util.Tools.resolve("tinymce.util.URI");const G=e=>c(e)&&"a"===e.nodeName.toLowerCase(),H=e=>G(e)&&!!X(e),J=(e,t)=>{if(e.collapsed)return[];{const n=e.cloneContents(),r=n.firstChild,o=new W(r,n),l=[];let i=r;do{t(i)&&l.push(i)}while(i=o.next());return l}},Q=e=>/^\w+:/i.test(e),X=e=>{var t,n;return null!==(n=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==n?n:""},Y=(e,t)=>{const n=["noopener"],r=e?e.split(/\s+/):[],o=e=>e.filter((e=>-1===U.inArray(n,e))),l=t?(e=>(e=o(e)).length>0?e.concat(n):n)(r):o(r);return l.length>0?(e=>U.trim(e.sort().join(" ")))(l):""},Z=(e,t)=>(t=t||ne(e.selection.getRng())[0]||e.selection.getNode(),ie(t)?h.from(e.dom.select("a[href]",t)[0]):h.from(e.dom.getParent(t,"a[href]"))),ee=(e,t)=>Z(e,t).isSome(),te=(e,t)=>(e=>e.replace(/\uFEFF/g,""))(t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||""))),ne=e=>J(e,H),re=e=>U.grep(e,H),oe=e=>re(e).length>0,le=e=>{const t=e.schema.getTextInlineElements(),n=e=>1===e.nodeType&&!G(e)&&!F(t,e.nodeName.toLowerCase());if(Z(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const r=e.selection.getRng();if(r.collapsed)return!0;return 0===J(r,n).length},ie=e=>c(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ae=(e,t)=>{const n={...t};if(0===R(e).length&&!M(e)){const e=Y(n.rel,"_blank"===n.target);n.rel=e||null}return h.from(n.target).isNone()&&!1===T(e)&&(n.target=S(e)),n.href=((e,t)=>"http"!==t&&"https"!==t||Q(e)?e:t+"://"+e)(n.href,O(e)),n},se=(e,t,n)=>{const r=e.selection.getNode(),o=Z(e,r),l=ae(e,(e=>{return t=["title","rel","class","target"],n=(t,n)=>(e[n].each((e=>{t[n]=e.length>0?e:null})),t),r={href:e.href},((e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)})(t,((e,t)=>{r=n(r,e,t)})),r;var t,n,r})(n));e.undoManager.transact((()=>{n.href===t.href&&t.attach(),o.fold((()=>{((e,t,n,r)=>{const o=e.dom;ie(t)?me(o,t,r):n.fold((()=>{e.execCommand("mceInsertLink",!1,r)}),(t=>{e.insertContent(o.createHTML("a",r,o.encode(t)))}))})(e,r,n.text,l)}),(t=>{e.focus(),((e,t,n,r)=>{n.each((e=>{F(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,r),e.selection.select(t)})(e,t,n.text,l)}))}))},ce=e=>{const{class:t,href:n,rel:r,target:o,text:l,title:a}=e;return((e,t)=>{const n={};var r;return V(e,t,(r=n,(e,t)=>{r[t]=e}),d),n})({class:t.getOrNull(),href:n,rel:r.getOrNull(),target:o.getOrNull(),text:l.getOrNull(),title:a.getOrNull()},((e,t)=>!1===i(e)))},ue=(e,t,n)=>{const r=((e,t)=>{const n=e.options.get,r={allow_html_data_urls:n("allow_html_data_urls"),allow_script_urls:n("allow_script_urls"),allow_svg_data_urls:n("allow_svg_data_urls")},o=t.href;return{...t,href:$.isDomSafe(o,"a",r)?o:""}})(e,n);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,ce(r)):se(e,t,r)},ge=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();ie(t)?de(e,t):(e=>{const t=e.dom,n=e.selection,r=n.getBookmark(),o=n.getRng().cloneRange(),l=t.getParent(o.startContainer,"a[href]",e.getBody()),i=t.getParent(o.endContainer,"a[href]",e.getBody());l&&o.setStartBefore(l),i&&o.setEndAfter(i),n.setRng(o),e.execCommand("unlink"),n.moveToBookmark(r)})(e),e.focus()}))})(e)},de=(e,t)=>{var n;const r=e.dom.select("img",t)[0];if(r){const o=e.dom.getParents(r,"a[href]",t)[0];o&&(null===(n=o.parentNode)||void 0===n||n.insertBefore(r,o),e.dom.remove(o))}},me=(e,t,n)=>{var r;const o=e.select("img",t)[0];if(o){const t=e.create("a",n);null===(r=o.parentNode)||void 0===r||r.insertBefore(t,o),t.appendChild(o)}},he=e=>{return F(t=e,n="items")&&void 0!==t[n]&&null!==t[n];var t,n},fe=(e,t)=>y(t,(t=>he(t)?fe(e,t.items):w(t.value===e,t))),pe=(e,t,n,r)=>{const o=r[t],l=e.length>0;return void 0!==o?fe(o,n).map((t=>({url:{value:t.value,meta:{text:l?e:t.text,attach:d}},text:l?e:t.text}))):h.none()},ke=(e,t)=>{const n={text:e.text,title:e.title},r=e=>{const t=(r=e.url,w(n.text.length<=0,h.from(null===(o=r.meta)||void 0===o?void 0:o.text).getOr(r.value)));var r,o;const l=(e=>{var t;return w(n.title.length<=0,h.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||l.isSome()?h.some({...t.map((e=>({text:e}))).getOr({}),...l.map((e=>({title:e}))).getOr({})}):h.none()},o=(e,r)=>{const o=(l=t,i=r,"link"===i?l.link:"anchor"===i?l.anchor:h.none()).getOr([]);var l,i;return pe(n.text,r,o,e)};return{onChange:(e,t)=>{const l=t.name;return"url"===l?r(e()):k(["anchor","link"],l)?o(e(),l):"text"===l||"title"===l?(n[l]=e()[l],h.none()):h.none()}}};var ve=tinymce.util.Tools.resolve("tinymce.util.Delay");const xe=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?h.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):h.none()},ye=(e,t)=>n=>{const r=n.href;return 1===e&&!Q(r)||0===e&&/^\s*www(\.|\d\.)/i.test(r)?h.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+r})}):h.none()},be=(e,t)=>y([xe,ye(O(e),E(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(n=>new Promise((r=>{((e,t,n)=>{const r=e.selection.getRng();ve.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(r),n(t)}))}))})(e,n.message,(e=>{r(e?n.preprocess(t):t)}))})))),_e=e=>{const t=e.dom.select("a:not([href])"),n=x(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]}));return n.length>0?h.some([{text:"None",value:""}].concat(n)):h.none()},we=e=>{const t=P(e);return t.length>0?K.sanitize(t):h.none()},Ce=e=>{try{return h.some(JSON.parse(e))}catch(e){return h.none()}},Oe=e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),n=A(e);return new Promise((e=>{r(n)?fetch(n).then((e=>e.ok?e.text().then(Ce):Promise.reject())).then(e,(()=>e(h.none()))):u(n)?n((t=>e(h.some(t)))):e(h.from(n))})).then((e=>e.bind(K.sanitizeWith(t)).map((e=>{if(e.length>0){return[{text:"None",value:""}].concat(e)}return e}))))},Ne=(e,t)=>{const n=R(e);if(n.length>0){const r=b(t,"_blank"),o=e=>Y(K.getValue(e),r);return(!1===M(e)?K.sanitizeWith(o):K.sanitize)(n)}return h.none()},Ae=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Se=e=>{const t=T(e);return l(t)?K.sanitize(t).orThunk((()=>h.some(Ae))):!1===t?h.none():h.some(Ae)},Ee=(e,t,n)=>{const r=e.getAttrib(t,n);return null!==r&&r.length>0?h.some(r):h.none()},Te=(e,t)=>Oe(e).then((n=>{const r=((e,t)=>{const n=e.dom,r=le(e)?h.some(te(e.selection,t)):h.none(),o=t.bind((e=>h.from(n.getAttrib(e,"href")))),l=t.bind((e=>h.from(n.getAttrib(e,"target")))),i=t.bind((e=>Ee(n,e,"rel"))),a=t.bind((e=>Ee(n,e,"class")));return{url:o,text:r,title:t.bind((e=>Ee(n,e,"title"))),target:l,rel:i,linkClass:a}})(e,t);return{anchor:r,catalogs:{targets:Se(e),rels:Ne(e,r.target),classes:we(e),anchor:_e(e),link:n},optNode:t,flags:{titleEnabled:L(e)}}})),Re=e=>{const t=(e=>{const t=Z(e);return Te(e,t)})(e);t.then((t=>{const n=((e,t)=>n=>{const r=n.getData();if(!r.url.value)return ge(e),void n.close();const o=e=>h.from(r[e]).filter((n=>!b(t.anchor[e],n))),l={href:r.url.value,text:o("text"),target:o("target"),rel:o("rel"),class:o("linkClass"),title:o("title")},i={href:r.url.value,attach:void 0!==r.url.meta&&r.url.meta.attach?r.url.meta.attach:d};be(e,l).then((t=>{ue(e,i,t)})),n.close()})(e,t);return((e,t,n)=>{const r=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),o=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],l=((e,t)=>{const n=e.anchor,r=n.url.getOr("");return{url:{value:r,meta:{original:{value:r}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:r,link:r,rel:n.rel.getOr(""),target:n.target.or(t).getOr(""),linkClass:n.linkClass.getOr("")}})(e,h.from(S(n))),i=e.catalogs,a=ke(l,i);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:v([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],r,o,_([i.anchor.map(K.createUi("anchor","Anchors")),i.rels.map(K.createUi("rel","Rel")),i.targets.map(K.createUi("target","Open link in...")),i.link.map(K.createUi("link","Link list")),i.classes.map(K.createUi("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onChange:(e,{name:t})=>{a.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,n,e)})).then((t=>{e.windowManager.open(t)}))};var Pe=tinymce.util.Tools.resolve("tinymce.util.VK");const Le=e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,n)},Me=(e,t)=>e.dom.getParent(t,"a[href]"),De=e=>Me(e,e.selection.getStart()),Ue=(e,t)=>{if(t){const n=X(t);if(/^#/.test(n)){const t=e.dom.select(n);t.length&&e.selection.scrollIntoView(t[0],!0)}else Le(t.href)}},Be=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},je=e=>()=>{Ue(e,De(e))},Ie=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Ke=e=>t=>{const n=()=>{t.setActive(!e.mode.isReadOnly()&&ee(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return n(),Ie(e,n)},ze=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return n(),Ie(e,n)},qe=e=>t=>{const n=()=>t.setEnabled((e=>1===(e.selection.isCollapsed()?re(e.dom.getParents(e.selection.getStart())):ne(e.selection.getRng())).length)(e));return n(),Ie(e,n)},Ve=e=>t=>{const n=t=>{return oe(t)||(n=e.selection.getRng(),ne(n).length>0);var n},r=e.dom.getParents(e.selection.getStart()),o=r=>{t.setEnabled(n(r)&&e.selection.isEditable())};return o(r),Ie(e,(e=>o(e.parents)))},Fe=e=>{const t=t=>{const n=e.selection.getNode();return t.setEnabled(ee(e,n)),d};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Ke(e)},label:"Link",predicate:t=>N(e)&&ee(e,t),initValue:()=>{return Z(e).fold((t="",()=>t),X);var t},commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const n=e.selection.getNode();return t.setActive(ee(e,n)),Ke(e)(t)},onAction:t=>{const n=t.getValue(),r=(t=>{const n=Z(e),r=le(e);if(n.isNone()&&r){const r=te(e.selection,n);return w(0===r.length,t)}return h.none()})(n);ue(e,{href:n,attach:d},{href:n,text:r,title:h.none(),rel:h.none(),target:h.none(),class:h.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:t,onAction:t=>{ge(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:t,onAction:t=>{je(e)(),t.hide()}}]})};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=r(e)||s(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>r(e)||u(e)||g(e,o)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>s(e)||g(e,o),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1})})(e),(e=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Be(e),onSetup:Ke(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:je(e),onSetup:qe(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>ge(e),onSetup:Ve(e)})})(e),(e=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:je(e),onSetup:qe(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onSetup:ze(e),onAction:Be(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>ge(e),onSetup:Ve(e)})})(e),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?oe(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),Fe(e),(e=>{e.on("click",(t=>{const n=Me(e,t.target);n&&Pe.metaKeyPressed(t)&&(t.preventDefault(),Ue(e,n))})),e.on("keydown",(t=>{if(!t.isDefaultPrevented()&&13===t.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(t)){const n=De(e);n&&(t.preventDefault(),Ue(e,n))}}))})(e),(e=>{e.addCommand("mceLink",((t,n)=>{!0!==(null==n?void 0:n.dialog)&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Re(e)}))})(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}()),e}export{n as __require};
2
2
  //# sourceMappingURL=plugin.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exports as r}from"../../../../_virtual/index12.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
1
+ import{__exports as r}from"../../../../_virtual/index16.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exports as e}from"../../../../_virtual/plugin4.mjs";var t;function n(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,o=(s=String).prototype,o.isPrototypeOf(n)||(null===(i=r.constructor)||void 0===i?void 0:i.name)===s.name)?"string":t;var n,o;var r,s,i})(t)===e,n=e=>t=>typeof t===e,o=t("string"),r=t("object"),s=t("array"),i=n("boolean"),l=e=>!(e=>null==e)(e),a=n("function"),d=n("number"),c=()=>{},m=e=>()=>e,u=(e,t)=>e===t;const p=e=>t=>!e(t),f=m(!1);class g{constructor(e,t){this.tag=e,this.value=t}static some(e){return new g(!0,e)}static none(){return g.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?g.some(e(this.value)):g.none()}bind(e){return this.tag?e(this.value):g.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:g.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?g.some(e):g.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}g.singletonNone=new g(!1);const h=Array.prototype.slice,y=Array.prototype.indexOf,v=Array.prototype.push,C=(e,t)=>{return n=e,o=t,y.call(n,o)>-1;var n,o},b=(e,t)=>{for(let n=0,o=e.length;n<o;n++){if(t(e[n],n))return!0}return!1},N=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},S=(e,t)=>{for(let n=0,o=e.length;n<o;n++){t(e[n],n)}},L=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},D=(e,t,n)=>(S(e,((e,o)=>{n=t(n,e,o)})),n),T=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return g.some(r);if(n(r,o))break}return g.none()},O=(e,t)=>T(e,t,f),x=(e,t)=>(e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!s(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);v.apply(t,e[n])}return t})(N(e,t)),A=e=>{const t=h.call(e,0);return t.reverse(),t},E=(e,t)=>t>=0&&t<e.length?g.some(e[t]):g.none(),w=e=>E(e,0),k=e=>E(e,e.length-1),B=(e,t)=>{const n=[],o=a(t)?e=>b(n,(n=>t(n,e))):e=>C(n,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];o(r)||n.push(r)}return n},P=(e,t,n=u)=>e.exists((e=>n(e,t))),M=(e,t,n)=>e.isSome()&&t.isSome()?g.some(n(e.getOrDie(),t.getOrDie())):g.none(),I=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},R={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return I(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return I(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return I(n)},fromDom:I,fromPoint:(e,t,n)=>g.from(e.dom.elementFromPoint(t,n)).map(I)},U=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},_=(e,t)=>e.dom===t.dom,$=U,H="undefined"!=typeof window?window:Function("return this;")(),F=(e,t)=>((e,t)=>{let n=null!=t?t:H;for(let t=0;t<e.length&&null!=n;++t)n=n[e[t]];return n})(e.split("."),t),V=(e,t)=>{const n=((e,t)=>F(e,t))(e,t);if(null==n)throw new Error(e+" not available on this browser");return n},j=Object.getPrototypeOf,K=e=>{const t=F("ownerDocument.defaultView",e);return r(e)&&((e=>V("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(j(e).constructor.name))},z=e=>e.dom.nodeName.toLowerCase(),Q=e=>e.dom.nodeType,W=e=>t=>Q(t)===e,q=e=>Z(e)&&K(e.dom),Z=W(1),G=W(3),J=W(9),X=W(11),Y=e=>t=>Z(t)&&z(t)===e,ee=e=>g.from(e.dom.parentNode).map(R.fromDom),te=e=>N(e.dom.childNodes,R.fromDom),ne=(e,t)=>{const n=e.dom.childNodes;return g.from(n[t]).map(R.fromDom)},oe=e=>ne(e,0),re=e=>ne(e,e.dom.childNodes.length-1),se=a(Element.prototype.attachShadow)&&a(Node.prototype.getRootNode)?e=>R.fromDom(e.dom.getRootNode()):e=>{return J(e)?e:(t=e,R.fromDom(t.dom.ownerDocument));var t},ie=e=>{const t=se(e);return X(n=t)&&l(n.dom.host)?g.some(t):g.none();var n},le=e=>R.fromDom(e.dom.host),ae=e=>{const t=G(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return ie(R.fromDom(t)).fold((()=>n.body.contains(t)),(o=ae,r=le,e=>o(r(e))));var o,r};var de=(e,t,n,o,r)=>e(n,o)?g.some(n):a(r)&&r(n)?g.none():t(n,o,r);const ce=(e,t,n)=>{let o=e.dom;const r=a(n)?n:f;for(;o.parentNode;){o=o.parentNode;const e=R.fromDom(o);if(t(e))return g.some(e);if(r(e))break}return g.none()},me=(e,t,n)=>de(((e,t)=>t(e)),ce,e,t,n),ue=(e,t,n)=>ce(e,(e=>U(e,t)),n),pe=e=>{return de(((e,t)=>U(e,t)),ue,e,"[contenteditable]",t);var t},fe=e=>e.dom.contentEditable,ge=(e,t)=>{ee(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},he=(e,t)=>{const n=(e=>g.from(e.dom.nextSibling).map(R.fromDom))(e);n.fold((()=>{ee(e).each((e=>{ye(e,t)}))}),(e=>{ge(e,t)}))},ye=(e,t)=>{e.dom.appendChild(t.dom)},ve=(e,t)=>{S(t,(t=>{ye(e,t)}))},Ce=e=>{e.dom.textContent="",S(te(e),(e=>{be(e)}))},be=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)};var Ne=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Se=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Le=tinymce.util.Tools.resolve("tinymce.util.VK");const De=e=>N(e,R.fromDom),Te=Object.keys,Oe=(e,t)=>{const n=Te(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},xe=(e,t)=>{const n={};var o;return((e,t,n,o)=>{Oe(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))})(e,t,(o=n,(e,t)=>{o[t]=e}),c),n},Ae=(e,t)=>{const n=e.dom;Oe(t,((e,t)=>{((e,t,n)=>{if(!(o(n)||i(n)||d(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(n,t,e)}))},Ee=e=>D(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),we=e=>((e,t)=>R.fromDom(e.dom.cloneNode(t)))(e,!0),ke=(e,t)=>{const n=((e,t)=>{const n=R.fromTag(t),o=Ee(e);return Ae(n,o),n})(e,t);he(e,n);const o=te(e);return ve(n,o),be(e),n};var Be=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Pe=tinymce.util.Tools.resolve("tinymce.util.Tools");const Me=e=>t=>l(t)&&t.nodeName.toLowerCase()===e,Ie=e=>t=>l(t)&&e.test(t.nodeName),Re=e=>l(e)&&3===e.nodeType,Ue=e=>l(e)&&1===e.nodeType,_e=Ie(/^(OL|UL|DL)$/),$e=Ie(/^(OL|UL)$/),He=Me("ol"),Fe=Ie(/^(LI|DT|DD)$/),Ve=Ie(/^(DT|DD)$/),je=Ie(/^(TH|TD)$/),Ke=Me("br"),ze=(e,t)=>l(t)&&t.nodeName in e.schema.getTextBlockElements(),Qe=(e,t)=>l(e)&&e.nodeName in t,We=(e,t)=>l(t)&&t.nodeName in e.schema.getVoidElements(),qe=(e,t,n)=>{const o=e.isEmpty(t);return!(n&&e.select("span[data-mce-type=bookmark]",t).length>0)&&o},Ze=(e,t)=>e.isChildOf(t,e.getRoot()),Ge=e=>t=>t.options.get(e),Je=Ge("lists_indent_on_tab"),Xe=Ge("forced_root_block"),Ye=Ge("forced_root_block_attrs"),et=(e,t)=>{const n=e.dom,o=e.schema.getBlockElements(),r=n.createFragment(),s=Xe(e),i=Ye(e);let l,a,d=!1;for(a=n.create(s,i),Qe(t.firstChild,o)||r.appendChild(a);l=t.firstChild;){const e=l.nodeName;d||"SPAN"===e&&"bookmark"===l.getAttribute("data-mce-type")||(d=!0),Qe(l,o)?(r.appendChild(l),a=null):(a||(a=n.create(s,i),r.appendChild(a)),a.appendChild(l))}return!d&&a&&a.appendChild(n.create("br",{"data-mce-bogus":"1"})),r},tt=Be.DOM,nt=(e,t,n)=>{const o=tt.select('span[data-mce-type="bookmark"]',t),r=et(e,n),s=tt.createRng();s.setStartAfter(n),s.setEndAfter(t);const i=s.extractContents();for(let t=i.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){tt.remove(t);break}e.dom.isEmpty(i)||tt.insertAfter(i,t),tt.insertAfter(r,t);const l=n.parentElement;l&&qe(e.dom,l)&&(e=>{const t=e.parentNode;t&&Pe.each(o,(e=>{t.insertBefore(e,n.parentNode)})),tt.remove(e)})(l),tt.remove(n),qe(e.dom,t)&&tt.remove(t)},ot=Y("dd"),rt=Y("dt"),st=(e,t)=>{var n;ot(t)?ke(t,"dt"):rt(t)&&(n=t,g.from(n.dom.parentElement).map(R.fromDom)).each((n=>nt(e,n.dom,t.dom)))},it=e=>{rt(e)&&ke(e,"dd")},lt=(e,t)=>{if(Re(e))return{container:e,offset:t};const n=Ne.getNode(e,t);return Re(n)?{container:n,offset:t>=e.childNodes.length?n.data.length:0}:n.previousSibling&&Re(n.previousSibling)?{container:n.previousSibling,offset:n.previousSibling.data.length}:n.nextSibling&&Re(n.nextSibling)?{container:n.nextSibling,offset:0}:{container:e,offset:t}},at=e=>{const t=e.cloneRange(),n=lt(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);const o=lt(e.endContainer,e.endOffset);return t.setEnd(o.container,o.offset),t},dt=["OL","UL","DL"],ct=dt.join(","),mt=(e,t)=>{const n=t||e.selection.getStart(!0);return e.dom.getParent(n,ct,gt(e,n))},ut=e=>{const t=mt(e),n=e.selection.getSelectedBlocks();return((e,t)=>l(e)&&1===t.length&&t[0]===e)(t,n)?(e=>L(e.querySelectorAll(ct),_e))(t):L(n,(e=>_e(e)&&t!==e))},pt=e=>{const t=e.selection.getSelectedBlocks();return L(((e,t)=>{const n=Pe.map(t,(t=>e.dom.getParent(t,"li,dd,dt",gt(e,t))||t));return B(n)})(e,t),Fe)},ft=(e,t)=>{const n=e.dom.getParents(t,"TD,TH");return n.length>0?n[0]:e.getBody()},gt=(e,t)=>{const n=e.dom.getParents(t,e.dom.isBlock),o=O(n,(t=>{return n=e.schema,!_e(o=t)&&!Fe(o)&&b(dt,(e=>n.isValidChild(o.nodeName,e)));var n,o}));return o.getOr(e.getBody())},ht=(e,t)=>{const n=e.dom.getParents(t,"ol,ul",gt(e,t));return k(n)},yt=e=>{const t=(e=>{const t=ht(e,e.selection.getStart()),n=L(e.selection.getSelectedBlocks(),$e);return t.toArray().concat(n)})(e),n=(e=>{const t=e.selection.getStart();return e.dom.getParents(t,"ol,ul",gt(e,t))})(e);return O(n,(e=>{return t=R.fromDom(e),ee(t).exists((e=>Fe(e.dom)&&oe(e).exists((e=>!_e(e.dom)))&&re(e).exists((e=>!_e(e.dom)))));var t})).fold((()=>vt(e,t)),(e=>[e]))},vt=(e,t)=>{const n=N(t,(t=>ht(e,t).getOr(t)));return B(n)},Ct=e=>/\btox\-/.test(e.className),bt=(e,t)=>T(e,_e,je).exists((e=>e.nodeName===t&&!Ct(e))),Nt=(e,t)=>null!==t&&!e.dom.isEditable(t),St=(e,t)=>{const n=e.dom.getParent(t,"ol,ul,dl");return Nt(e,n)},Lt=(e,t)=>{const n=e.selection.getNode();return t({parents:e.dom.getParents(n),element:n}),e.on("NodeChange",t),()=>e.off("NodeChange",t)},Dt=(e,t)=>{const n=(t||document).createDocumentFragment();return S(e,(e=>{n.appendChild(e.dom)})),R.fromDom(n)},Tt=(e,t,n)=>e.dispatch("ListMutation",{action:t,element:n}),Ot=(xt=/^\s+|\s+$/g,e=>e.replace(xt,""));var xt;const At=(e,t,n)=>{if(!o(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)&&e.style.setProperty(t,n)},Et=(e,t,n)=>{const o=e.dom;At(o,t,n)},wt=e=>$(e,"OL,UL"),kt=e=>oe(e).exists(wt),Bt=e=>"listAttributes"in e,Pt=e=>"isComment"in e,Mt=e=>e.depth>0,It=e=>e.isSelected,Rt=e=>{const t=te(e),n=re(e).exists(wt)?t.slice(0,-1):t;return N(n,we)},Ut=(e,t)=>{ye(e.item,t.list)},_t=(e,t)=>{const n={list:R.fromTag(t,e),item:R.fromTag("li",e)};return ye(n.list,n.item),n},$t=(e,t,n)=>{const o=t.slice(0,n.depth);return k(o).each((t=>{if(Bt(n)){const o=((e,t,n)=>{const o=R.fromTag("li",e);return Ae(o,t),ve(o,n),o})(e,n.itemAttributes,n.content);((e,t)=>{ye(e.list,t),e.item=t})(t,o),((e,t)=>{z(e.list)!==t.listType&&(e.list=ke(e.list,t.listType)),Ae(e.list,t.listAttributes)})(t,n)}else if((e=>"isFragment"in e)(n))ve(t.item,n.content);else{const e=R.fromHtml(`\x3c!--${n.content}--\x3e`);ye(t.list,e)}})),o},Ht=(e,t,n)=>{const o=((e,t,n)=>{const o=[];for(let r=0;r<n;r++)o.push(_t(e,Bt(t)?t.listType:t.parentListType));return o})(e,n,n.depth-t.length);var r;return(e=>{for(let t=1;t<e.length;t++)Ut(e[t-1],e[t])})(o),((e,t)=>{for(let t=0;t<e.length-1;t++)Et(e[t].item,"list-style-type","none");k(e).each((e=>{Bt(t)&&(Ae(e.list,t.listAttributes),Ae(e.item,t.itemAttributes)),ve(e.item,t.content)}))})(o,n),r=o,M(k(t),w(r),Ut),t.concat(o)},Ft=(e,t)=>{let n=g.none();const o=D(t,((t,o,r)=>Pt(o)?0===r?(n=g.some(o),t):$t(e,t,o):o.depth>t.length?Ht(e,t,o):$t(e,t,o)),[]);return n.each((e=>{const t=R.fromHtml(`\x3c!--${e.content}--\x3e`);w(o).each((e=>{((e,t)=>{oe(e).fold((()=>{ye(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))})(e.list,t)}))})),w(o).map((e=>e.list))},Vt=e=>(S(e,((t,n)=>{((e,t)=>{const n=e[t].depth,o=e=>e.depth===n&&!e.dirty,r=e=>e.depth<n;return T(A(e.slice(0,t)),o,r).orThunk((()=>T(e.slice(t+1),o,r)))})(e,n).fold((()=>{t.dirty&&Bt(t)&&(e=>{e.listAttributes=xe(e.listAttributes,((e,t)=>"start"!==t))})(t)}),(e=>{return o=e,void(Bt(n=t)&&Bt(o)&&(n.listType=o.listType,n.listAttributes={...o.listAttributes}));var n,o}))})),e),jt=(e,t,n,o)=>{var r,s;if(8===Q(s=o)||"#comment"===z(s))return[{depth:e+1,content:null!==(r=o.dom.nodeValue)&&void 0!==r?r:"",dirty:!1,isSelected:!1,isComment:!0}];t.each((e=>{_(e.start,o)&&n.set(!0)}));const i=((e,t,n)=>ee(e).filter(Z).map((o=>({depth:t,dirty:!1,isSelected:n,content:Rt(e),itemAttributes:Ee(e),listAttributes:Ee(o),listType:z(o),isInPreviousLi:!1}))))(o,e,n.get());t.each((e=>{_(e.end,o)&&n.set(!1)}));const l=re(o).filter(wt).map((o=>zt(e,t,n,o))).getOr([]);return i.toArray().concat(l)},Kt=(e,t,n,o)=>oe(o).filter(wt).fold((()=>jt(e,t,n,o)),(r=>{const s=D(te(o),((o,s,i)=>{if(0===i)return o;if($(s,"LI"))return o.concat(jt(e,t,n,s));{const t={isFragment:!0,depth:e,content:[s],isSelected:!1,dirty:!1,parentListType:z(r)};return o.concat(t)}}),[]);return zt(e,t,n,r).concat(s)})),zt=(e,t,n,o)=>x(te(o),(o=>(wt(o)?zt:Kt)(e+1,t,n,o))),Qt=(e,t)=>x(((e,t)=>{if(0===e.length)return[];{let n=t(e[0]);const o=[];let r=[];for(let s=0,i=e.length;s<i;s++){const i=e[s],l=t(i);l!==n&&(o.push(r),r=[]),n=l,r.push(i)}return 0!==r.length&&o.push(r),o}})(t,Mt),(t=>w(t).exists(Mt)?((e,t)=>{const n=Vt(t);return Ft(e.contentDocument,n).toArray()})(e,t):((e,t)=>{const n=Vt(t);return N(n,(t=>{const n=Pt(t)?Dt([R.fromHtml(`\x3c!--${t.content}--\x3e`)]):Dt(t.content);return R.fromDom(et(e,n.dom))}))})(e,t))),Wt=(e,t,n)=>{const o=((e,t)=>{const n=(()=>{let e=!1;return{get:()=>e,set:t=>{e=t}}})();return N(e,(e=>({sourceList:e,entries:zt(0,t,n,e)})))})(t,(e=>{const t=N(pt(e),R.fromDom);return M(O(t,p(kt)),O(A(t),p(kt)),((e,t)=>({start:e,end:t})))})(e));S(o,(t=>{((e,t)=>{S(L(e,It),(e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e)))})(t.entries,n);const o=Qt(e,t.entries);var r;S(o,(t=>{Tt(e,"Indent"===n?"IndentList":"OutdentList",t.dom)})),r=t.sourceList,S(o,(e=>{ge(r,e)})),be(t.sourceList)}))},qt=(e,t)=>{const n=De(yt(e)),o=De((e=>L(pt(e),Ve))(e));let r=!1;if(n.length||o.length){const s=e.selection.getBookmark();Wt(e,n,t),((e,t,n)=>{S(n,"Indent"===t?it:t=>st(e,t))})(e,t,o),e.selection.moveToBookmark(s),e.selection.setRng(at(e.selection.getRng())),e.nodeChanged(),r=!0}return r},Zt=(e,t)=>!(e=>{const t=mt(e);return Nt(e,t)})(e)&&qt(e,t),Gt=e=>Zt(e,"Indent"),Jt=e=>Zt(e,"Outdent"),Xt=e=>Zt(e,"Flatten"),Yt=e=>"\ufeff"===e,en=(e,t)=>{return n=e,o=function(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}(_,t),ce(n,o,r).isSome();var n,o,r};var tn=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const nn=Be.DOM,on=e=>{const t={},n=n=>{let o=e[n?"startContainer":"endContainer"],r=e[n?"startOffset":"endOffset"];if(Ue(o)){const e=nn.create("span",{"data-mce-type":"bookmark"});o.hasChildNodes()?(r=Math.min(r,o.childNodes.length-1),n?o.insertBefore(e,o.childNodes[r]):nn.insertAfter(e,o.childNodes[r])):o.appendChild(e),o=e,r=0}t[n?"startContainer":"endContainer"]=o,t[n?"startOffset":"endOffset"]=r};return n(!0),e.collapsed||n(),t},rn=e=>{const t=t=>{let n=e[t?"startContainer":"endContainer"],o=e[t?"startOffset":"endOffset"];if(n){if(Ue(n)&&n.parentNode){const e=n;o=(e=>{var t;let n=null===(t=e.parentNode)||void 0===t?void 0:t.firstChild,o=0;for(;n;){if(n===e)return o;Ue(n)&&"bookmark"===n.getAttribute("data-mce-type")||o++,n=n.nextSibling}return-1})(n),n=n.parentNode,nn.remove(e),!n.hasChildNodes()&&nn.isBlock(n)&&n.appendChild(nn.create("br"))}e[t?"startContainer":"endContainer"]=n,e[t?"startOffset":"endOffset"]=o}};t(!0),t();const n=nn.createRng();return n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),at(n)},sn=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},ln=(e,t)=>{Pe.each(t,((t,n)=>{e.setAttribute(n,t)}))},an=(e,t,n)=>{((e,t,n)=>{const o=n["list-style-type"]?n["list-style-type"]:null;e.setStyle(t,"list-style-type",o)})(e,t,n),((e,t,n)=>{ln(t,n["list-attributes"]),Pe.each(e.select("li",t),(e=>{ln(e,n["list-item-attributes"])}))})(e,t,n)},dn=(e,t)=>l(t)&&!Qe(t,e.schema.getBlockElements()),cn=(e,t,n,o)=>{let r=t[n?"startContainer":"endContainer"];const s=t[n?"startOffset":"endOffset"];Ue(r)&&(r=r.childNodes[Math.min(s,r.childNodes.length-1)]||r),!n&&Ke(r.nextSibling)&&(r=r.nextSibling);const i=(t,n)=>{var r;const s=new Se(t,(t=>{for(;!e.dom.isBlock(t)&&t.parentNode&&o!==t;)t=t.parentNode;return t})(t)),i=n?"next":"prev";let l;for(;l=s[i]();)if(!We(e,l)&&!Yt(l.textContent)&&0!==(null===(r=l.textContent)||void 0===r?void 0:r.length))return g.some(l);return g.none()};if(n&&Re(r))if(Yt(r.textContent))r=i(r,!1).getOr(r);else for(null!==r.parentNode&&dn(e,r.parentNode)&&(r=r.parentNode);null!==r.previousSibling&&(dn(e,r.previousSibling)||Re(r.previousSibling));)r=r.previousSibling;if(!n&&Re(r))if(Yt(r.textContent))r=i(r,!0).getOr(r);else for(null!==r.parentNode&&dn(e,r.parentNode)&&(r=r.parentNode);null!==r.nextSibling&&(dn(e,r.nextSibling)||Re(r.nextSibling));)r=r.nextSibling;for(;r.parentNode!==o;){const t=r.parentNode;if(ze(e,r))return r;if(/^(TD|TH)$/.test(t.nodeName))return r;r=t}return r},mn=(e,t,n)=>{const o=e.selection.getRng();let r="LI";const s=gt(e,((e,t)=>{const n=e.selection.getStart(!0),o=cn(e,t,!0,e.getBody());return en(R.fromDom(o),R.fromDom(t.commonAncestorContainer))?t.commonAncestorContainer:n})(e,o)),i=e.dom;if("false"===i.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(r="DT");const l=on(o),a=L(((e,t,n)=>{const o=[],r=e.dom,s=cn(e,t,!0,n),i=cn(e,t,!1,n);let l;const a=[];for(let e=s;e&&(a.push(e),e!==i);e=e.nextSibling);return Pe.each(a,(t=>{var s;if(ze(e,t))return o.push(t),void(l=null);if(r.isBlock(t)||Ke(t))return Ke(t)&&r.remove(t),void(l=null);const i=t.nextSibling;tn.isBookmarkNode(t)&&(_e(i)||ze(e,i)||!i&&t.parentNode===n)?l=null:(l||(l=r.create("p"),null===(s=t.parentNode)||void 0===s||s.insertBefore(l,t),o.push(l)),l.appendChild(t))})),o})(e,o,s),e.dom.isEditable);Pe.each(a,(o=>{let s;const l=o.previousSibling,a=o.parentNode;Fe(a)||(l&&_e(l)&&l.nodeName===t&&((e,t,n)=>{const o=e.getStyle(t,"list-style-type");let r=n?n["list-style-type"]:"";return r=null===r?"":r,o===r})(i,l,n)?(s=l,o=i.rename(o,r),l.appendChild(o)):(s=i.create(t),a.insertBefore(s,o),s.appendChild(o),o=i.rename(o,r)),((e,t,n)=>{Pe.each(n,(n=>e.setStyle(t,n,"")))})(i,o,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),an(i,s,n),pn(e.dom,s))})),e.selection.setRng(rn(l))},un=(e,t,n)=>{return((e,t)=>_e(e)&&e.nodeName===(null==t?void 0:t.nodeName))(t,n)&&((e,t,n)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(n,"list-style-type",!0))(e,t,n)&&(o=n,t.className===o.className);var o},pn=(e,t)=>{let n,o=t.nextSibling;if(un(e,t,o)){const r=o;for(;n=r.firstChild;)t.appendChild(n);e.remove(r)}if(o=t.previousSibling,un(e,t,o)){const r=o;for(;n=r.lastChild;)t.insertBefore(n,t.firstChild);e.remove(r)}},fn=(e,t,n,o)=>{if(t.nodeName!==n){const r=e.dom.rename(t,n);an(e.dom,r,o),Tt(e,sn(n),r)}else an(e.dom,t,o),Tt(e,sn(n),t)},gn=(e,t,n,o)=>{if(t.classList.forEach(((e,n,o)=>{e.startsWith("tox-")&&(o.remove(e),0===o.length&&t.removeAttribute("class"))})),t.nodeName!==n){const r=e.dom.rename(t,n);an(e.dom,r,o),Tt(e,sn(n),r)}else an(e.dom,t,o),Tt(e,sn(n),t)},hn=e=>"list-style-type"in e,yn=(e,t,n)=>{const o=mt(e);if(St(e,o))return;const s=ut(e),i=r(n)?n:{};s.length>0?((e,t,n,o,r)=>{const s=_e(t);if(!s||t.nodeName!==o||hn(r)||Ct(t)){mn(e,o,r);const i=on(e.selection.getRng()),l=s?[t,...n]:n,a=s&&Ct(t)?gn:fn;Pe.each(l,(t=>{a(e,t,o,r)})),e.selection.setRng(rn(i))}else Xt(e)})(e,o,s,t,i):((e,t,n,o)=>{if(t!==e.getBody())if(t)if(t.nodeName!==n||hn(o)||Ct(t)){const r=on(e.selection.getRng());Ct(t)&&t.classList.forEach(((e,n,o)=>{e.startsWith("tox-")&&(o.remove(e),0===o.length&&t.removeAttribute("class"))})),an(e.dom,t,o);const s=e.dom.rename(t,n);pn(e.dom,s),e.selection.setRng(rn(r)),mn(e,n,o),Tt(e,sn(n),s)}else Xt(e);else mn(e,n,o),Tt(e,sn(n),t)})(e,o,t,i)},vn=Be.DOM,Cn=(e,t)=>{const n=Pe.grep(e.select("ol,ul",t));Pe.each(n,(t=>{((e,t)=>{const n=t.parentElement;if(n&&"LI"===n.nodeName&&n.firstChild===t){const o=n.previousSibling;o&&"LI"===o.nodeName?(o.appendChild(t),qe(e,n)&&vn.remove(n)):vn.setStyle(n,"listStyleType","none")}if(_e(n)){const e=n.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)}))},bn=(e,t,n,o)=>{let r=t.startContainer;const s=t.startOffset;if(Re(r)&&(n?s<r.data.length:s>0))return r;const i=e.schema.getNonEmptyElements();Ue(r)&&(r=Ne.getNode(r,s));const l=new Se(r,o);n&&((e,t)=>!!Ke(t)&&e.isBlock(t.nextSibling)&&!Ke(t.previousSibling))(e.dom,r)&&l.next();const a=n?l.next.bind(l):l.prev2.bind(l);for(;r=a();){if("LI"===r.nodeName&&!r.hasChildNodes())return r;if(i[r.nodeName])return r;if(Re(r)&&r.data.length>0)return r}return null},Nn=(e,t)=>{const n=t.childNodes;return 1===n.length&&!_e(n[0])&&e.isBlock(n[0])},Sn=e=>g.from(e).map(R.fromDom).filter(q).exists((e=>((e,t=!1)=>ae(e)?e.dom.isContentEditable:pe(e).fold(m(t),(e=>"true"===fe(e))))(e)&&!C(["details"],z(e)))),Ln=(e,t,n)=>{let o;const r=Nn(e,n)?n.firstChild:n;if(((e,t)=>{Nn(e,t)&&Sn(t.firstChild)&&e.remove(t.firstChild,!0)})(e,t),!qe(e,t,!0))for(;o=t.firstChild;)r.appendChild(o)},Dn=(e,t,n)=>{let o;const r=t.parentNode;if(!Ze(e,t)||!Ze(e,n))return;_e(n.lastChild)&&(o=n.lastChild),r===n.lastChild&&Ke(r.previousSibling)&&e.remove(r.previousSibling);const s=n.lastChild;s&&Ke(s)&&t.hasChildNodes()&&e.remove(s),qe(e,n,!0)&&Ce(R.fromDom(n)),Ln(e,t,n),o&&n.appendChild(o);const i=((e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)})(R.fromDom(n),R.fromDom(t))?e.getParents(t,_e,n):[];e.remove(t),S(i,(t=>{qe(e,t)&&t!==e.getRoot()&&e.remove(t)}))},Tn=(e,t,n,o)=>{const r=e.dom;if(r.isEmpty(o))((e,t,n)=>{Ce(R.fromDom(n)),Dn(e.dom,t,n),e.selection.setCursorLocation(n,0)})(e,n,o);else{const s=on(t);Dn(r,n,o),e.selection.setRng(rn(s))}},On=(e,t)=>{const n=e.dom,o=e.selection,r=o.getStart(),s=ft(e,r),i=n.getParent(o.getStart(),"LI",s);if(i){const r=i.parentElement;if(r===e.getBody()&&qe(n,r))return!0;const l=at(o.getRng()),a=n.getParent(bn(e,l,t,s),"LI",s),d=a&&(t?n.isChildOf(i,a):n.isChildOf(a,i));if(a&&a!==i&&!d)return e.undoManager.transact((()=>{var n,o;t?Tn(e,l,a,i):(null===(o=(n=i).parentNode)||void 0===o?void 0:o.firstChild)===n?Jt(e):((e,t,n,o)=>{const r=on(t);Dn(e.dom,n,o);const s=rn(r);e.selection.setRng(s)})(e,l,i,a)})),!0;if(d&&!t&&a!==i)return e.undoManager.transact((()=>{if(l.commonAncestorContainer.parentElement){const t=on(l),o=l.commonAncestorContainer.parentElement;Ln(n,l.commonAncestorContainer.parentElement,a),o.remove();const r=rn(t);e.selection.setRng(r)}})),!0;if(!a&&!t&&0===l.startOffset&&0===l.endOffset)return e.undoManager.transact((()=>{Xt(e)})),!0}return!1},xn=(e,t)=>{const n=e.dom,o=e.selection.getStart(),r=ft(e,o),s=n.getParent(o,n.isBlock,r);if(s&&n.isEmpty(s)){const o=at(e.selection.getRng()),i=n.getParent(bn(e,o,t,r),"LI",r);if(i){const l=e=>C(["td","th","caption"],z(e)),a=e=>e.dom===r;return!!((e,t,n=u)=>M(e,t,n).getOr(e.isNone()&&t.isNone()))(me(R.fromDom(i),l,a),me(R.fromDom(o.startContainer),l,a),_)&&(e.undoManager.transact((()=>{const o=i.parentNode;((e,t,n)=>{const o=e.getParent(t.parentNode,e.isBlock,n);e.remove(t),o&&e.isEmpty(o)&&e.remove(o)})(n,s,r),pn(n,o),e.selection.select(i,!0),e.selection.collapse(t)})),!0)}}return!1},An=e=>{const t=e.selection.getStart(),n=ft(e,t);return e.dom.getParent(t,"LI,DT,DD",n)||pt(e).length>0},En=(e,t)=>{const n=e.selection;return!St(e,n.getNode())&&(n.isCollapsed()?((e,t)=>On(e,t)||xn(e,t))(e,t):(e=>!!An(e)&&(e.undoManager.transact((()=>{e.execCommand("Delete"),Cn(e.dom,e.getBody())})),!0))(e))},wn=e=>{const t=A(Ot(e).split("")),n=N(t,((e,t)=>{const n=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*n}));return D(n,((e,t)=>e+t),0)},kn=e=>{if(--e<0)return"";{const t=e%26,n=Math.floor(e/26);return kn(n)+String.fromCharCode("A".charCodeAt(0)+t)}},Bn=e=>{const t=parseInt(e.start,10);return P(e.listStyleType,"upper-alpha")?kn(t):P(e.listStyleType,"lower-alpha")?kn(t).toLowerCase():e.start},Pn=e=>{const t=mt(e);He(t)&&!St(e,t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:Bn({start:e.dom.getAttrib(t,"start","1"),listStyleType:g.from(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:(e=>/^[a-z]+$/.test(e))(e)?1:e.length>0?4:3)(e)){case 2:return g.some({listStyleType:g.none(),start:e});case 0:return g.some({listStyleType:g.some("upper-alpha"),start:wn(e).toString()});case 1:return g.some({listStyleType:g.some("lower-alpha"),start:wn(e).toString()});case 3:return g.some({listStyleType:g.none(),start:""});case 4:return g.none()}})(t.getData().start).each((t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})})),t.close()}})},Mn=(e,t)=>()=>{const n=mt(e);return l(n)&&n.nodeName===t},In=e=>{e.addCommand("mceListProps",(()=>{Pn(e)}))},Rn=e=>{e.on("BeforeExecCommand",(t=>{const n=t.command.toLowerCase();"indent"===n?Gt(e):"outdent"===n&&Jt(e)})),e.addCommand("InsertUnorderedList",((t,n)=>{yn(e,"UL",n)})),e.addCommand("InsertOrderedList",((t,n)=>{yn(e,"OL",n)})),e.addCommand("InsertDefinitionList",((t,n)=>{yn(e,"DL",n)})),e.addCommand("RemoveList",(()=>{Xt(e)})),In(e),e.addCommand("mceListUpdate",((t,n)=>{r(n)&&((e,t)=>{const n=mt(e);null===n||St(e,n)||e.undoManager.transact((()=>{r(t.styles)&&e.dom.setStyles(n,t.styles),r(t.attrs)&&Oe(t.attrs,((t,o)=>e.dom.setAttrib(n,o,t)))}))})(e,n)})),e.addQueryStateHandler("InsertUnorderedList",Mn(e,"UL")),e.addQueryStateHandler("InsertOrderedList",Mn(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",Mn(e,"DL"))};var Un=tinymce.util.Tools.resolve("tinymce.html.Node");const _n=e=>3===e.type,$n=e=>0===e.length,Hn=e=>{const t=(t,n)=>{const o=Un.create("li");S(t,(e=>o.append(e))),n?e.insert(o,n,!0):e.append(o)},n=D(e.children(),((e,n)=>_n(n)?[...e,n]:$n(e)||_n(n)?e:(t(e,n),[])),[]);$n(n)||t(n)},Fn=e=>{Je(e)&&(e=>{e.on("keydown",(t=>{t.keyCode!==Le.TAB||Le.metaKeyPressed(t)||e.undoManager.transact((()=>{(t.shiftKey?Jt(e):Gt(e))&&t.preventDefault()}))}))})(e),(e=>{e.on("ExecCommand",(t=>{const n=t.command.toLowerCase();"delete"!==n&&"forwarddelete"!==n||!An(e)||Cn(e.dom,e.getBody())})),e.on("keydown",(t=>{t.keyCode===Le.BACKSPACE?En(e,!1)&&t.preventDefault():t.keyCode===Le.DELETE&&En(e,!0)&&t.preventDefault()}))})(e)},Vn=(e,t)=>n=>(n.setEnabled(e.selection.isEditable()),Lt(e,(o=>{n.setActive(bt(o.parents,t)),n.setEnabled(!St(e,o.element)&&e.selection.isEditable())}))),jn=(e,t)=>n=>Lt(e,(o=>n.setEnabled(bt(o.parents,t)&&!St(e,o.element))));e.add("lists",(e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),(e=>{e.on("PreInit",(()=>{const{parser:t}=e;t.addNodeFilter("ul,ol",(e=>S(e,Hn)))}))})(e),e.hasPlugin("rtc",!0)?In(e):(Fn(e),Rn(e)),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:Vn(e,"OL")}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:Vn(e,"UL")}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:jn(e,"OL")};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const n=mt(e,t);return He(n)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{En(e,t)}}))(e))))}()),e}export{n as __require};
1
+ import{__exports as e}from"../../../../_virtual/plugin6.mjs";var t;function n(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,o=(s=String).prototype,o.isPrototypeOf(n)||(null===(i=r.constructor)||void 0===i?void 0:i.name)===s.name)?"string":t;var n,o;var r,s,i})(t)===e,n=e=>t=>typeof t===e,o=t("string"),r=t("object"),s=t("array"),i=n("boolean"),l=e=>!(e=>null==e)(e),a=n("function"),d=n("number"),c=()=>{},m=e=>()=>e,u=(e,t)=>e===t;const p=e=>t=>!e(t),f=m(!1);class g{constructor(e,t){this.tag=e,this.value=t}static some(e){return new g(!0,e)}static none(){return g.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?g.some(e(this.value)):g.none()}bind(e){return this.tag?e(this.value):g.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:g.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?g.some(e):g.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}g.singletonNone=new g(!1);const h=Array.prototype.slice,y=Array.prototype.indexOf,v=Array.prototype.push,C=(e,t)=>{return n=e,o=t,y.call(n,o)>-1;var n,o},b=(e,t)=>{for(let n=0,o=e.length;n<o;n++){if(t(e[n],n))return!0}return!1},N=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},S=(e,t)=>{for(let n=0,o=e.length;n<o;n++){t(e[n],n)}},L=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},D=(e,t,n)=>(S(e,((e,o)=>{n=t(n,e,o)})),n),T=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return g.some(r);if(n(r,o))break}return g.none()},O=(e,t)=>T(e,t,f),x=(e,t)=>(e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!s(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);v.apply(t,e[n])}return t})(N(e,t)),A=e=>{const t=h.call(e,0);return t.reverse(),t},E=(e,t)=>t>=0&&t<e.length?g.some(e[t]):g.none(),w=e=>E(e,0),k=e=>E(e,e.length-1),B=(e,t)=>{const n=[],o=a(t)?e=>b(n,(n=>t(n,e))):e=>C(n,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];o(r)||n.push(r)}return n},P=(e,t,n=u)=>e.exists((e=>n(e,t))),M=(e,t,n)=>e.isSome()&&t.isSome()?g.some(n(e.getOrDie(),t.getOrDie())):g.none(),I=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},R={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return I(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return I(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return I(n)},fromDom:I,fromPoint:(e,t,n)=>g.from(e.dom.elementFromPoint(t,n)).map(I)},U=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},_=(e,t)=>e.dom===t.dom,$=U,H="undefined"!=typeof window?window:Function("return this;")(),F=(e,t)=>((e,t)=>{let n=null!=t?t:H;for(let t=0;t<e.length&&null!=n;++t)n=n[e[t]];return n})(e.split("."),t),V=(e,t)=>{const n=((e,t)=>F(e,t))(e,t);if(null==n)throw new Error(e+" not available on this browser");return n},j=Object.getPrototypeOf,K=e=>{const t=F("ownerDocument.defaultView",e);return r(e)&&((e=>V("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(j(e).constructor.name))},z=e=>e.dom.nodeName.toLowerCase(),Q=e=>e.dom.nodeType,W=e=>t=>Q(t)===e,q=e=>Z(e)&&K(e.dom),Z=W(1),G=W(3),J=W(9),X=W(11),Y=e=>t=>Z(t)&&z(t)===e,ee=e=>g.from(e.dom.parentNode).map(R.fromDom),te=e=>N(e.dom.childNodes,R.fromDom),ne=(e,t)=>{const n=e.dom.childNodes;return g.from(n[t]).map(R.fromDom)},oe=e=>ne(e,0),re=e=>ne(e,e.dom.childNodes.length-1),se=a(Element.prototype.attachShadow)&&a(Node.prototype.getRootNode)?e=>R.fromDom(e.dom.getRootNode()):e=>{return J(e)?e:(t=e,R.fromDom(t.dom.ownerDocument));var t},ie=e=>{const t=se(e);return X(n=t)&&l(n.dom.host)?g.some(t):g.none();var n},le=e=>R.fromDom(e.dom.host),ae=e=>{const t=G(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return ie(R.fromDom(t)).fold((()=>n.body.contains(t)),(o=ae,r=le,e=>o(r(e))));var o,r};var de=(e,t,n,o,r)=>e(n,o)?g.some(n):a(r)&&r(n)?g.none():t(n,o,r);const ce=(e,t,n)=>{let o=e.dom;const r=a(n)?n:f;for(;o.parentNode;){o=o.parentNode;const e=R.fromDom(o);if(t(e))return g.some(e);if(r(e))break}return g.none()},me=(e,t,n)=>de(((e,t)=>t(e)),ce,e,t,n),ue=(e,t,n)=>ce(e,(e=>U(e,t)),n),pe=e=>{return de(((e,t)=>U(e,t)),ue,e,"[contenteditable]",t);var t},fe=e=>e.dom.contentEditable,ge=(e,t)=>{ee(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},he=(e,t)=>{const n=(e=>g.from(e.dom.nextSibling).map(R.fromDom))(e);n.fold((()=>{ee(e).each((e=>{ye(e,t)}))}),(e=>{ge(e,t)}))},ye=(e,t)=>{e.dom.appendChild(t.dom)},ve=(e,t)=>{S(t,(t=>{ye(e,t)}))},Ce=e=>{e.dom.textContent="",S(te(e),(e=>{be(e)}))},be=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)};var Ne=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Se=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Le=tinymce.util.Tools.resolve("tinymce.util.VK");const De=e=>N(e,R.fromDom),Te=Object.keys,Oe=(e,t)=>{const n=Te(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},xe=(e,t)=>{const n={};var o;return((e,t,n,o)=>{Oe(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))})(e,t,(o=n,(e,t)=>{o[t]=e}),c),n},Ae=(e,t)=>{const n=e.dom;Oe(t,((e,t)=>{((e,t,n)=>{if(!(o(n)||i(n)||d(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(n,t,e)}))},Ee=e=>D(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),we=e=>((e,t)=>R.fromDom(e.dom.cloneNode(t)))(e,!0),ke=(e,t)=>{const n=((e,t)=>{const n=R.fromTag(t),o=Ee(e);return Ae(n,o),n})(e,t);he(e,n);const o=te(e);return ve(n,o),be(e),n};var Be=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Pe=tinymce.util.Tools.resolve("tinymce.util.Tools");const Me=e=>t=>l(t)&&t.nodeName.toLowerCase()===e,Ie=e=>t=>l(t)&&e.test(t.nodeName),Re=e=>l(e)&&3===e.nodeType,Ue=e=>l(e)&&1===e.nodeType,_e=Ie(/^(OL|UL|DL)$/),$e=Ie(/^(OL|UL)$/),He=Me("ol"),Fe=Ie(/^(LI|DT|DD)$/),Ve=Ie(/^(DT|DD)$/),je=Ie(/^(TH|TD)$/),Ke=Me("br"),ze=(e,t)=>l(t)&&t.nodeName in e.schema.getTextBlockElements(),Qe=(e,t)=>l(e)&&e.nodeName in t,We=(e,t)=>l(t)&&t.nodeName in e.schema.getVoidElements(),qe=(e,t,n)=>{const o=e.isEmpty(t);return!(n&&e.select("span[data-mce-type=bookmark]",t).length>0)&&o},Ze=(e,t)=>e.isChildOf(t,e.getRoot()),Ge=e=>t=>t.options.get(e),Je=Ge("lists_indent_on_tab"),Xe=Ge("forced_root_block"),Ye=Ge("forced_root_block_attrs"),et=(e,t)=>{const n=e.dom,o=e.schema.getBlockElements(),r=n.createFragment(),s=Xe(e),i=Ye(e);let l,a,d=!1;for(a=n.create(s,i),Qe(t.firstChild,o)||r.appendChild(a);l=t.firstChild;){const e=l.nodeName;d||"SPAN"===e&&"bookmark"===l.getAttribute("data-mce-type")||(d=!0),Qe(l,o)?(r.appendChild(l),a=null):(a||(a=n.create(s,i),r.appendChild(a)),a.appendChild(l))}return!d&&a&&a.appendChild(n.create("br",{"data-mce-bogus":"1"})),r},tt=Be.DOM,nt=(e,t,n)=>{const o=tt.select('span[data-mce-type="bookmark"]',t),r=et(e,n),s=tt.createRng();s.setStartAfter(n),s.setEndAfter(t);const i=s.extractContents();for(let t=i.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){tt.remove(t);break}e.dom.isEmpty(i)||tt.insertAfter(i,t),tt.insertAfter(r,t);const l=n.parentElement;l&&qe(e.dom,l)&&(e=>{const t=e.parentNode;t&&Pe.each(o,(e=>{t.insertBefore(e,n.parentNode)})),tt.remove(e)})(l),tt.remove(n),qe(e.dom,t)&&tt.remove(t)},ot=Y("dd"),rt=Y("dt"),st=(e,t)=>{var n;ot(t)?ke(t,"dt"):rt(t)&&(n=t,g.from(n.dom.parentElement).map(R.fromDom)).each((n=>nt(e,n.dom,t.dom)))},it=e=>{rt(e)&&ke(e,"dd")},lt=(e,t)=>{if(Re(e))return{container:e,offset:t};const n=Ne.getNode(e,t);return Re(n)?{container:n,offset:t>=e.childNodes.length?n.data.length:0}:n.previousSibling&&Re(n.previousSibling)?{container:n.previousSibling,offset:n.previousSibling.data.length}:n.nextSibling&&Re(n.nextSibling)?{container:n.nextSibling,offset:0}:{container:e,offset:t}},at=e=>{const t=e.cloneRange(),n=lt(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);const o=lt(e.endContainer,e.endOffset);return t.setEnd(o.container,o.offset),t},dt=["OL","UL","DL"],ct=dt.join(","),mt=(e,t)=>{const n=t||e.selection.getStart(!0);return e.dom.getParent(n,ct,gt(e,n))},ut=e=>{const t=mt(e),n=e.selection.getSelectedBlocks();return((e,t)=>l(e)&&1===t.length&&t[0]===e)(t,n)?(e=>L(e.querySelectorAll(ct),_e))(t):L(n,(e=>_e(e)&&t!==e))},pt=e=>{const t=e.selection.getSelectedBlocks();return L(((e,t)=>{const n=Pe.map(t,(t=>e.dom.getParent(t,"li,dd,dt",gt(e,t))||t));return B(n)})(e,t),Fe)},ft=(e,t)=>{const n=e.dom.getParents(t,"TD,TH");return n.length>0?n[0]:e.getBody()},gt=(e,t)=>{const n=e.dom.getParents(t,e.dom.isBlock),o=O(n,(t=>{return n=e.schema,!_e(o=t)&&!Fe(o)&&b(dt,(e=>n.isValidChild(o.nodeName,e)));var n,o}));return o.getOr(e.getBody())},ht=(e,t)=>{const n=e.dom.getParents(t,"ol,ul",gt(e,t));return k(n)},yt=e=>{const t=(e=>{const t=ht(e,e.selection.getStart()),n=L(e.selection.getSelectedBlocks(),$e);return t.toArray().concat(n)})(e),n=(e=>{const t=e.selection.getStart();return e.dom.getParents(t,"ol,ul",gt(e,t))})(e);return O(n,(e=>{return t=R.fromDom(e),ee(t).exists((e=>Fe(e.dom)&&oe(e).exists((e=>!_e(e.dom)))&&re(e).exists((e=>!_e(e.dom)))));var t})).fold((()=>vt(e,t)),(e=>[e]))},vt=(e,t)=>{const n=N(t,(t=>ht(e,t).getOr(t)));return B(n)},Ct=e=>/\btox\-/.test(e.className),bt=(e,t)=>T(e,_e,je).exists((e=>e.nodeName===t&&!Ct(e))),Nt=(e,t)=>null!==t&&!e.dom.isEditable(t),St=(e,t)=>{const n=e.dom.getParent(t,"ol,ul,dl");return Nt(e,n)},Lt=(e,t)=>{const n=e.selection.getNode();return t({parents:e.dom.getParents(n),element:n}),e.on("NodeChange",t),()=>e.off("NodeChange",t)},Dt=(e,t)=>{const n=(t||document).createDocumentFragment();return S(e,(e=>{n.appendChild(e.dom)})),R.fromDom(n)},Tt=(e,t,n)=>e.dispatch("ListMutation",{action:t,element:n}),Ot=(xt=/^\s+|\s+$/g,e=>e.replace(xt,""));var xt;const At=(e,t,n)=>{if(!o(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)&&e.style.setProperty(t,n)},Et=(e,t,n)=>{const o=e.dom;At(o,t,n)},wt=e=>$(e,"OL,UL"),kt=e=>oe(e).exists(wt),Bt=e=>"listAttributes"in e,Pt=e=>"isComment"in e,Mt=e=>e.depth>0,It=e=>e.isSelected,Rt=e=>{const t=te(e),n=re(e).exists(wt)?t.slice(0,-1):t;return N(n,we)},Ut=(e,t)=>{ye(e.item,t.list)},_t=(e,t)=>{const n={list:R.fromTag(t,e),item:R.fromTag("li",e)};return ye(n.list,n.item),n},$t=(e,t,n)=>{const o=t.slice(0,n.depth);return k(o).each((t=>{if(Bt(n)){const o=((e,t,n)=>{const o=R.fromTag("li",e);return Ae(o,t),ve(o,n),o})(e,n.itemAttributes,n.content);((e,t)=>{ye(e.list,t),e.item=t})(t,o),((e,t)=>{z(e.list)!==t.listType&&(e.list=ke(e.list,t.listType)),Ae(e.list,t.listAttributes)})(t,n)}else if((e=>"isFragment"in e)(n))ve(t.item,n.content);else{const e=R.fromHtml(`\x3c!--${n.content}--\x3e`);ye(t.list,e)}})),o},Ht=(e,t,n)=>{const o=((e,t,n)=>{const o=[];for(let r=0;r<n;r++)o.push(_t(e,Bt(t)?t.listType:t.parentListType));return o})(e,n,n.depth-t.length);var r;return(e=>{for(let t=1;t<e.length;t++)Ut(e[t-1],e[t])})(o),((e,t)=>{for(let t=0;t<e.length-1;t++)Et(e[t].item,"list-style-type","none");k(e).each((e=>{Bt(t)&&(Ae(e.list,t.listAttributes),Ae(e.item,t.itemAttributes)),ve(e.item,t.content)}))})(o,n),r=o,M(k(t),w(r),Ut),t.concat(o)},Ft=(e,t)=>{let n=g.none();const o=D(t,((t,o,r)=>Pt(o)?0===r?(n=g.some(o),t):$t(e,t,o):o.depth>t.length?Ht(e,t,o):$t(e,t,o)),[]);return n.each((e=>{const t=R.fromHtml(`\x3c!--${e.content}--\x3e`);w(o).each((e=>{((e,t)=>{oe(e).fold((()=>{ye(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))})(e.list,t)}))})),w(o).map((e=>e.list))},Vt=e=>(S(e,((t,n)=>{((e,t)=>{const n=e[t].depth,o=e=>e.depth===n&&!e.dirty,r=e=>e.depth<n;return T(A(e.slice(0,t)),o,r).orThunk((()=>T(e.slice(t+1),o,r)))})(e,n).fold((()=>{t.dirty&&Bt(t)&&(e=>{e.listAttributes=xe(e.listAttributes,((e,t)=>"start"!==t))})(t)}),(e=>{return o=e,void(Bt(n=t)&&Bt(o)&&(n.listType=o.listType,n.listAttributes={...o.listAttributes}));var n,o}))})),e),jt=(e,t,n,o)=>{var r,s;if(8===Q(s=o)||"#comment"===z(s))return[{depth:e+1,content:null!==(r=o.dom.nodeValue)&&void 0!==r?r:"",dirty:!1,isSelected:!1,isComment:!0}];t.each((e=>{_(e.start,o)&&n.set(!0)}));const i=((e,t,n)=>ee(e).filter(Z).map((o=>({depth:t,dirty:!1,isSelected:n,content:Rt(e),itemAttributes:Ee(e),listAttributes:Ee(o),listType:z(o),isInPreviousLi:!1}))))(o,e,n.get());t.each((e=>{_(e.end,o)&&n.set(!1)}));const l=re(o).filter(wt).map((o=>zt(e,t,n,o))).getOr([]);return i.toArray().concat(l)},Kt=(e,t,n,o)=>oe(o).filter(wt).fold((()=>jt(e,t,n,o)),(r=>{const s=D(te(o),((o,s,i)=>{if(0===i)return o;if($(s,"LI"))return o.concat(jt(e,t,n,s));{const t={isFragment:!0,depth:e,content:[s],isSelected:!1,dirty:!1,parentListType:z(r)};return o.concat(t)}}),[]);return zt(e,t,n,r).concat(s)})),zt=(e,t,n,o)=>x(te(o),(o=>(wt(o)?zt:Kt)(e+1,t,n,o))),Qt=(e,t)=>x(((e,t)=>{if(0===e.length)return[];{let n=t(e[0]);const o=[];let r=[];for(let s=0,i=e.length;s<i;s++){const i=e[s],l=t(i);l!==n&&(o.push(r),r=[]),n=l,r.push(i)}return 0!==r.length&&o.push(r),o}})(t,Mt),(t=>w(t).exists(Mt)?((e,t)=>{const n=Vt(t);return Ft(e.contentDocument,n).toArray()})(e,t):((e,t)=>{const n=Vt(t);return N(n,(t=>{const n=Pt(t)?Dt([R.fromHtml(`\x3c!--${t.content}--\x3e`)]):Dt(t.content);return R.fromDom(et(e,n.dom))}))})(e,t))),Wt=(e,t,n)=>{const o=((e,t)=>{const n=(()=>{let e=!1;return{get:()=>e,set:t=>{e=t}}})();return N(e,(e=>({sourceList:e,entries:zt(0,t,n,e)})))})(t,(e=>{const t=N(pt(e),R.fromDom);return M(O(t,p(kt)),O(A(t),p(kt)),((e,t)=>({start:e,end:t})))})(e));S(o,(t=>{((e,t)=>{S(L(e,It),(e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e)))})(t.entries,n);const o=Qt(e,t.entries);var r;S(o,(t=>{Tt(e,"Indent"===n?"IndentList":"OutdentList",t.dom)})),r=t.sourceList,S(o,(e=>{ge(r,e)})),be(t.sourceList)}))},qt=(e,t)=>{const n=De(yt(e)),o=De((e=>L(pt(e),Ve))(e));let r=!1;if(n.length||o.length){const s=e.selection.getBookmark();Wt(e,n,t),((e,t,n)=>{S(n,"Indent"===t?it:t=>st(e,t))})(e,t,o),e.selection.moveToBookmark(s),e.selection.setRng(at(e.selection.getRng())),e.nodeChanged(),r=!0}return r},Zt=(e,t)=>!(e=>{const t=mt(e);return Nt(e,t)})(e)&&qt(e,t),Gt=e=>Zt(e,"Indent"),Jt=e=>Zt(e,"Outdent"),Xt=e=>Zt(e,"Flatten"),Yt=e=>"\ufeff"===e,en=(e,t)=>{return n=e,o=function(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}(_,t),ce(n,o,r).isSome();var n,o,r};var tn=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const nn=Be.DOM,on=e=>{const t={},n=n=>{let o=e[n?"startContainer":"endContainer"],r=e[n?"startOffset":"endOffset"];if(Ue(o)){const e=nn.create("span",{"data-mce-type":"bookmark"});o.hasChildNodes()?(r=Math.min(r,o.childNodes.length-1),n?o.insertBefore(e,o.childNodes[r]):nn.insertAfter(e,o.childNodes[r])):o.appendChild(e),o=e,r=0}t[n?"startContainer":"endContainer"]=o,t[n?"startOffset":"endOffset"]=r};return n(!0),e.collapsed||n(),t},rn=e=>{const t=t=>{let n=e[t?"startContainer":"endContainer"],o=e[t?"startOffset":"endOffset"];if(n){if(Ue(n)&&n.parentNode){const e=n;o=(e=>{var t;let n=null===(t=e.parentNode)||void 0===t?void 0:t.firstChild,o=0;for(;n;){if(n===e)return o;Ue(n)&&"bookmark"===n.getAttribute("data-mce-type")||o++,n=n.nextSibling}return-1})(n),n=n.parentNode,nn.remove(e),!n.hasChildNodes()&&nn.isBlock(n)&&n.appendChild(nn.create("br"))}e[t?"startContainer":"endContainer"]=n,e[t?"startOffset":"endOffset"]=o}};t(!0),t();const n=nn.createRng();return n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),at(n)},sn=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},ln=(e,t)=>{Pe.each(t,((t,n)=>{e.setAttribute(n,t)}))},an=(e,t,n)=>{((e,t,n)=>{const o=n["list-style-type"]?n["list-style-type"]:null;e.setStyle(t,"list-style-type",o)})(e,t,n),((e,t,n)=>{ln(t,n["list-attributes"]),Pe.each(e.select("li",t),(e=>{ln(e,n["list-item-attributes"])}))})(e,t,n)},dn=(e,t)=>l(t)&&!Qe(t,e.schema.getBlockElements()),cn=(e,t,n,o)=>{let r=t[n?"startContainer":"endContainer"];const s=t[n?"startOffset":"endOffset"];Ue(r)&&(r=r.childNodes[Math.min(s,r.childNodes.length-1)]||r),!n&&Ke(r.nextSibling)&&(r=r.nextSibling);const i=(t,n)=>{var r;const s=new Se(t,(t=>{for(;!e.dom.isBlock(t)&&t.parentNode&&o!==t;)t=t.parentNode;return t})(t)),i=n?"next":"prev";let l;for(;l=s[i]();)if(!We(e,l)&&!Yt(l.textContent)&&0!==(null===(r=l.textContent)||void 0===r?void 0:r.length))return g.some(l);return g.none()};if(n&&Re(r))if(Yt(r.textContent))r=i(r,!1).getOr(r);else for(null!==r.parentNode&&dn(e,r.parentNode)&&(r=r.parentNode);null!==r.previousSibling&&(dn(e,r.previousSibling)||Re(r.previousSibling));)r=r.previousSibling;if(!n&&Re(r))if(Yt(r.textContent))r=i(r,!0).getOr(r);else for(null!==r.parentNode&&dn(e,r.parentNode)&&(r=r.parentNode);null!==r.nextSibling&&(dn(e,r.nextSibling)||Re(r.nextSibling));)r=r.nextSibling;for(;r.parentNode!==o;){const t=r.parentNode;if(ze(e,r))return r;if(/^(TD|TH)$/.test(t.nodeName))return r;r=t}return r},mn=(e,t,n)=>{const o=e.selection.getRng();let r="LI";const s=gt(e,((e,t)=>{const n=e.selection.getStart(!0),o=cn(e,t,!0,e.getBody());return en(R.fromDom(o),R.fromDom(t.commonAncestorContainer))?t.commonAncestorContainer:n})(e,o)),i=e.dom;if("false"===i.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(r="DT");const l=on(o),a=L(((e,t,n)=>{const o=[],r=e.dom,s=cn(e,t,!0,n),i=cn(e,t,!1,n);let l;const a=[];for(let e=s;e&&(a.push(e),e!==i);e=e.nextSibling);return Pe.each(a,(t=>{var s;if(ze(e,t))return o.push(t),void(l=null);if(r.isBlock(t)||Ke(t))return Ke(t)&&r.remove(t),void(l=null);const i=t.nextSibling;tn.isBookmarkNode(t)&&(_e(i)||ze(e,i)||!i&&t.parentNode===n)?l=null:(l||(l=r.create("p"),null===(s=t.parentNode)||void 0===s||s.insertBefore(l,t),o.push(l)),l.appendChild(t))})),o})(e,o,s),e.dom.isEditable);Pe.each(a,(o=>{let s;const l=o.previousSibling,a=o.parentNode;Fe(a)||(l&&_e(l)&&l.nodeName===t&&((e,t,n)=>{const o=e.getStyle(t,"list-style-type");let r=n?n["list-style-type"]:"";return r=null===r?"":r,o===r})(i,l,n)?(s=l,o=i.rename(o,r),l.appendChild(o)):(s=i.create(t),a.insertBefore(s,o),s.appendChild(o),o=i.rename(o,r)),((e,t,n)=>{Pe.each(n,(n=>e.setStyle(t,n,"")))})(i,o,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),an(i,s,n),pn(e.dom,s))})),e.selection.setRng(rn(l))},un=(e,t,n)=>{return((e,t)=>_e(e)&&e.nodeName===(null==t?void 0:t.nodeName))(t,n)&&((e,t,n)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(n,"list-style-type",!0))(e,t,n)&&(o=n,t.className===o.className);var o},pn=(e,t)=>{let n,o=t.nextSibling;if(un(e,t,o)){const r=o;for(;n=r.firstChild;)t.appendChild(n);e.remove(r)}if(o=t.previousSibling,un(e,t,o)){const r=o;for(;n=r.lastChild;)t.insertBefore(n,t.firstChild);e.remove(r)}},fn=(e,t,n,o)=>{if(t.nodeName!==n){const r=e.dom.rename(t,n);an(e.dom,r,o),Tt(e,sn(n),r)}else an(e.dom,t,o),Tt(e,sn(n),t)},gn=(e,t,n,o)=>{if(t.classList.forEach(((e,n,o)=>{e.startsWith("tox-")&&(o.remove(e),0===o.length&&t.removeAttribute("class"))})),t.nodeName!==n){const r=e.dom.rename(t,n);an(e.dom,r,o),Tt(e,sn(n),r)}else an(e.dom,t,o),Tt(e,sn(n),t)},hn=e=>"list-style-type"in e,yn=(e,t,n)=>{const o=mt(e);if(St(e,o))return;const s=ut(e),i=r(n)?n:{};s.length>0?((e,t,n,o,r)=>{const s=_e(t);if(!s||t.nodeName!==o||hn(r)||Ct(t)){mn(e,o,r);const i=on(e.selection.getRng()),l=s?[t,...n]:n,a=s&&Ct(t)?gn:fn;Pe.each(l,(t=>{a(e,t,o,r)})),e.selection.setRng(rn(i))}else Xt(e)})(e,o,s,t,i):((e,t,n,o)=>{if(t!==e.getBody())if(t)if(t.nodeName!==n||hn(o)||Ct(t)){const r=on(e.selection.getRng());Ct(t)&&t.classList.forEach(((e,n,o)=>{e.startsWith("tox-")&&(o.remove(e),0===o.length&&t.removeAttribute("class"))})),an(e.dom,t,o);const s=e.dom.rename(t,n);pn(e.dom,s),e.selection.setRng(rn(r)),mn(e,n,o),Tt(e,sn(n),s)}else Xt(e);else mn(e,n,o),Tt(e,sn(n),t)})(e,o,t,i)},vn=Be.DOM,Cn=(e,t)=>{const n=Pe.grep(e.select("ol,ul",t));Pe.each(n,(t=>{((e,t)=>{const n=t.parentElement;if(n&&"LI"===n.nodeName&&n.firstChild===t){const o=n.previousSibling;o&&"LI"===o.nodeName?(o.appendChild(t),qe(e,n)&&vn.remove(n)):vn.setStyle(n,"listStyleType","none")}if(_e(n)){const e=n.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)}))},bn=(e,t,n,o)=>{let r=t.startContainer;const s=t.startOffset;if(Re(r)&&(n?s<r.data.length:s>0))return r;const i=e.schema.getNonEmptyElements();Ue(r)&&(r=Ne.getNode(r,s));const l=new Se(r,o);n&&((e,t)=>!!Ke(t)&&e.isBlock(t.nextSibling)&&!Ke(t.previousSibling))(e.dom,r)&&l.next();const a=n?l.next.bind(l):l.prev2.bind(l);for(;r=a();){if("LI"===r.nodeName&&!r.hasChildNodes())return r;if(i[r.nodeName])return r;if(Re(r)&&r.data.length>0)return r}return null},Nn=(e,t)=>{const n=t.childNodes;return 1===n.length&&!_e(n[0])&&e.isBlock(n[0])},Sn=e=>g.from(e).map(R.fromDom).filter(q).exists((e=>((e,t=!1)=>ae(e)?e.dom.isContentEditable:pe(e).fold(m(t),(e=>"true"===fe(e))))(e)&&!C(["details"],z(e)))),Ln=(e,t,n)=>{let o;const r=Nn(e,n)?n.firstChild:n;if(((e,t)=>{Nn(e,t)&&Sn(t.firstChild)&&e.remove(t.firstChild,!0)})(e,t),!qe(e,t,!0))for(;o=t.firstChild;)r.appendChild(o)},Dn=(e,t,n)=>{let o;const r=t.parentNode;if(!Ze(e,t)||!Ze(e,n))return;_e(n.lastChild)&&(o=n.lastChild),r===n.lastChild&&Ke(r.previousSibling)&&e.remove(r.previousSibling);const s=n.lastChild;s&&Ke(s)&&t.hasChildNodes()&&e.remove(s),qe(e,n,!0)&&Ce(R.fromDom(n)),Ln(e,t,n),o&&n.appendChild(o);const i=((e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)})(R.fromDom(n),R.fromDom(t))?e.getParents(t,_e,n):[];e.remove(t),S(i,(t=>{qe(e,t)&&t!==e.getRoot()&&e.remove(t)}))},Tn=(e,t,n,o)=>{const r=e.dom;if(r.isEmpty(o))((e,t,n)=>{Ce(R.fromDom(n)),Dn(e.dom,t,n),e.selection.setCursorLocation(n,0)})(e,n,o);else{const s=on(t);Dn(r,n,o),e.selection.setRng(rn(s))}},On=(e,t)=>{const n=e.dom,o=e.selection,r=o.getStart(),s=ft(e,r),i=n.getParent(o.getStart(),"LI",s);if(i){const r=i.parentElement;if(r===e.getBody()&&qe(n,r))return!0;const l=at(o.getRng()),a=n.getParent(bn(e,l,t,s),"LI",s),d=a&&(t?n.isChildOf(i,a):n.isChildOf(a,i));if(a&&a!==i&&!d)return e.undoManager.transact((()=>{var n,o;t?Tn(e,l,a,i):(null===(o=(n=i).parentNode)||void 0===o?void 0:o.firstChild)===n?Jt(e):((e,t,n,o)=>{const r=on(t);Dn(e.dom,n,o);const s=rn(r);e.selection.setRng(s)})(e,l,i,a)})),!0;if(d&&!t&&a!==i)return e.undoManager.transact((()=>{if(l.commonAncestorContainer.parentElement){const t=on(l),o=l.commonAncestorContainer.parentElement;Ln(n,l.commonAncestorContainer.parentElement,a),o.remove();const r=rn(t);e.selection.setRng(r)}})),!0;if(!a&&!t&&0===l.startOffset&&0===l.endOffset)return e.undoManager.transact((()=>{Xt(e)})),!0}return!1},xn=(e,t)=>{const n=e.dom,o=e.selection.getStart(),r=ft(e,o),s=n.getParent(o,n.isBlock,r);if(s&&n.isEmpty(s)){const o=at(e.selection.getRng()),i=n.getParent(bn(e,o,t,r),"LI",r);if(i){const l=e=>C(["td","th","caption"],z(e)),a=e=>e.dom===r;return!!((e,t,n=u)=>M(e,t,n).getOr(e.isNone()&&t.isNone()))(me(R.fromDom(i),l,a),me(R.fromDom(o.startContainer),l,a),_)&&(e.undoManager.transact((()=>{const o=i.parentNode;((e,t,n)=>{const o=e.getParent(t.parentNode,e.isBlock,n);e.remove(t),o&&e.isEmpty(o)&&e.remove(o)})(n,s,r),pn(n,o),e.selection.select(i,!0),e.selection.collapse(t)})),!0)}}return!1},An=e=>{const t=e.selection.getStart(),n=ft(e,t);return e.dom.getParent(t,"LI,DT,DD",n)||pt(e).length>0},En=(e,t)=>{const n=e.selection;return!St(e,n.getNode())&&(n.isCollapsed()?((e,t)=>On(e,t)||xn(e,t))(e,t):(e=>!!An(e)&&(e.undoManager.transact((()=>{e.execCommand("Delete"),Cn(e.dom,e.getBody())})),!0))(e))},wn=e=>{const t=A(Ot(e).split("")),n=N(t,((e,t)=>{const n=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*n}));return D(n,((e,t)=>e+t),0)},kn=e=>{if(--e<0)return"";{const t=e%26,n=Math.floor(e/26);return kn(n)+String.fromCharCode("A".charCodeAt(0)+t)}},Bn=e=>{const t=parseInt(e.start,10);return P(e.listStyleType,"upper-alpha")?kn(t):P(e.listStyleType,"lower-alpha")?kn(t).toLowerCase():e.start},Pn=e=>{const t=mt(e);He(t)&&!St(e,t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:Bn({start:e.dom.getAttrib(t,"start","1"),listStyleType:g.from(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:(e=>/^[a-z]+$/.test(e))(e)?1:e.length>0?4:3)(e)){case 2:return g.some({listStyleType:g.none(),start:e});case 0:return g.some({listStyleType:g.some("upper-alpha"),start:wn(e).toString()});case 1:return g.some({listStyleType:g.some("lower-alpha"),start:wn(e).toString()});case 3:return g.some({listStyleType:g.none(),start:""});case 4:return g.none()}})(t.getData().start).each((t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})})),t.close()}})},Mn=(e,t)=>()=>{const n=mt(e);return l(n)&&n.nodeName===t},In=e=>{e.addCommand("mceListProps",(()=>{Pn(e)}))},Rn=e=>{e.on("BeforeExecCommand",(t=>{const n=t.command.toLowerCase();"indent"===n?Gt(e):"outdent"===n&&Jt(e)})),e.addCommand("InsertUnorderedList",((t,n)=>{yn(e,"UL",n)})),e.addCommand("InsertOrderedList",((t,n)=>{yn(e,"OL",n)})),e.addCommand("InsertDefinitionList",((t,n)=>{yn(e,"DL",n)})),e.addCommand("RemoveList",(()=>{Xt(e)})),In(e),e.addCommand("mceListUpdate",((t,n)=>{r(n)&&((e,t)=>{const n=mt(e);null===n||St(e,n)||e.undoManager.transact((()=>{r(t.styles)&&e.dom.setStyles(n,t.styles),r(t.attrs)&&Oe(t.attrs,((t,o)=>e.dom.setAttrib(n,o,t)))}))})(e,n)})),e.addQueryStateHandler("InsertUnorderedList",Mn(e,"UL")),e.addQueryStateHandler("InsertOrderedList",Mn(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",Mn(e,"DL"))};var Un=tinymce.util.Tools.resolve("tinymce.html.Node");const _n=e=>3===e.type,$n=e=>0===e.length,Hn=e=>{const t=(t,n)=>{const o=Un.create("li");S(t,(e=>o.append(e))),n?e.insert(o,n,!0):e.append(o)},n=D(e.children(),((e,n)=>_n(n)?[...e,n]:$n(e)||_n(n)?e:(t(e,n),[])),[]);$n(n)||t(n)},Fn=e=>{Je(e)&&(e=>{e.on("keydown",(t=>{t.keyCode!==Le.TAB||Le.metaKeyPressed(t)||e.undoManager.transact((()=>{(t.shiftKey?Jt(e):Gt(e))&&t.preventDefault()}))}))})(e),(e=>{e.on("ExecCommand",(t=>{const n=t.command.toLowerCase();"delete"!==n&&"forwarddelete"!==n||!An(e)||Cn(e.dom,e.getBody())})),e.on("keydown",(t=>{t.keyCode===Le.BACKSPACE?En(e,!1)&&t.preventDefault():t.keyCode===Le.DELETE&&En(e,!0)&&t.preventDefault()}))})(e)},Vn=(e,t)=>n=>(n.setEnabled(e.selection.isEditable()),Lt(e,(o=>{n.setActive(bt(o.parents,t)),n.setEnabled(!St(e,o.element)&&e.selection.isEditable())}))),jn=(e,t)=>n=>Lt(e,(o=>n.setEnabled(bt(o.parents,t)&&!St(e,o.element))));e.add("lists",(e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),(e=>{e.on("PreInit",(()=>{const{parser:t}=e;t.addNodeFilter("ul,ol",(e=>S(e,Hn)))}))})(e),e.hasPlugin("rtc",!0)?In(e):(Fn(e),Rn(e)),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:Vn(e,"OL")}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:Vn(e,"UL")}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:jn(e,"OL")};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const n=mt(e,t);return He(n)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{En(e,t)}}))(e))))}()),e}export{n as __require};
2
2
  //# sourceMappingURL=plugin.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exports as r}from"../../../../_virtual/index10.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
1
+ import{__exports as r}from"../../../../_virtual/index12.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exports as e}from"../../../../_virtual/plugin3.mjs";var t;function o(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,l=(r=String).prototype,l.isPrototypeOf(o)||(null===(a=n.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var o,l;var n,r,a})(t)===e,o=e=>t=>typeof t===e,l=t("string"),n=t("array"),r=o("boolean"),a=(s=void 0,e=>s===e);var s;const c=e=>!(e=>null==e)(e),i=o("function"),m=o("number"),d=()=>{},u=e=>()=>e,p=e=>e,b=(e,t)=>e===t;function g(e,...t){return(...o)=>{const l=t.concat(o);return e.apply(null,l)}}const h=e=>{e()},f=u(!1),y=u(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const S=Object.keys,C=Object.hasOwnProperty,v=(e,t)=>{const o=S(e);for(let l=0,n=o.length;l<n;l++){const n=o[l];t(e[n],n)}},T=(e,t)=>{const o={};var l;return((e,t,o,l)=>{v(e,((e,n)=>{(t(e,n)?o:l)(e,n)}))})(e,t,(l=o,(e,t)=>{l[t]=e}),d),o},x=e=>((e,t)=>{const o=[];return v(e,((e,l)=>{o.push(t(e,l))})),o})(e,p),A=e=>S(e).length,R=(e,t)=>_(e,t)?w.from(e[t]):w.none(),_=(e,t)=>C.call(e,t),O=(e,t)=>_(e,t)&&void 0!==e[t]&&null!==e[t],D=Array.prototype.indexOf,N=Array.prototype.push,I=(e,t)=>((e,t)=>D.call(e,t))(e,t)>-1,M=(e,t)=>{for(let o=0,l=e.length;o<l;o++){if(t(e[o],o))return!0}return!1},P=(e,t)=>{const o=[];for(let l=0;l<e;l++)o.push(t(l));return o},k=(e,t)=>{const o=e.length,l=new Array(o);for(let n=0;n<o;n++){const o=e[n];l[n]=t(o,n)}return l},E=(e,t)=>{for(let o=0,l=e.length;o<l;o++){t(e[o],o)}},B=(e,t)=>{const o=[];for(let l=0,n=e.length;l<n;l++){const n=e[l];t(n,l)&&o.push(n)}return o},F=(e,t,o)=>(E(e,((e,l)=>{o=t(o,e,l)})),o),q=(e,t)=>((e,t,o)=>{for(let l=0,n=e.length;l<n;l++){const n=e[l];if(t(n,l))return w.some(n);if(o(n,l))break}return w.none()})(e,t,f),L=(e,t)=>(e=>{const t=[];for(let o=0,l=e.length;o<l;++o){if(!n(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);N.apply(t,e[o])}return t})(k(e,t)),j=(e,t)=>{for(let o=0,l=e.length;o<l;++o){if(!0!==t(e[o],o))return!1}return!0},H=(e,t)=>t>=0&&t<e.length?w.some(e[t]):w.none(),V=(e,t)=>{for(let o=0;o<e.length;o++){const l=t(e[o],o);if(l.isSome())return l}return w.none()},$=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},W={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return $(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return $(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return $(o)},fromDom:$,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map($)},z=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},U=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,G=(e,t)=>e.dom===t.dom,K=z;"undefined"!=typeof window?window:Function("return this;")();const J=e=>e.dom.nodeName.toLowerCase(),Q=e=>e.dom.nodeType,X=e=>t=>Q(t)===e,Y=e=>8===Q(e)||"#comment"===J(e),Z=X(1),ee=X(3),te=X(9),oe=X(11),le=e=>t=>Z(t)&&J(t)===e,ne=e=>{return te(e)?e:(t=e,W.fromDom(t.dom.ownerDocument));var t},re=e=>w.from(e.dom.parentNode).map(W.fromDom),ae=(e,t)=>{const o=i(t)?t:f;let l=e.dom;const n=[];for(;null!==l.parentNode&&void 0!==l.parentNode;){const e=l.parentNode,t=W.fromDom(e);if(n.push(t),!0===o(t))break;l=e}return n},se=e=>w.from(e.dom.previousSibling).map(W.fromDom),ce=e=>w.from(e.dom.nextSibling).map(W.fromDom),ie=e=>k(e.dom.childNodes,W.fromDom),me=e=>((e,t)=>{const o=e.dom.childNodes;return w.from(o[t]).map(W.fromDom)})(e,0),de=i(Element.prototype.attachShadow)&&i(Node.prototype.getRootNode)?e=>W.fromDom(e.dom.getRootNode()):ne,ue=e=>{const t=de(e);return oe(o=t)&&c(o.dom.host)?w.some(t):w.none();var o},pe=e=>W.fromDom(e.dom.host),be=e=>{const t=ee(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ue(W.fromDom(t)).fold((()=>o.body.contains(t)),(l=be,n=pe,e=>l(n(e))));var l,n};var ge=(e,t,o,l,n)=>e(o,l)?w.some(o):i(n)&&n(o)?w.none():t(o,l,n);const he=(e,t,o)=>{let l=e.dom;const n=i(o)?o:f;for(;l.parentNode;){l=l.parentNode;const e=W.fromDom(l);if(t(e))return w.some(e);if(n(e))break}return w.none()},fe=(e,t,o)=>he(e,(e=>z(e,t)),o),ye=(e,t)=>((e,t)=>q(e.dom.childNodes,(e=>t(W.fromDom(e)))).map(W.fromDom))(e,(e=>z(e,t))),we=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return U(o)?w.none():w.from(o.querySelector(e)).map(W.fromDom)})(t,e),Se=(e,t,o)=>ge(((e,t)=>z(e,t)),fe,e,t,o),Ce=(e,t=!1)=>{return be(e)?e.dom.isContentEditable:(o=e,Se(o,"[contenteditable]")).fold(u(t),(e=>"true"===ve(e)));var o},ve=e=>e.dom.contentEditable,Te=e=>t=>G(t,(e=>W.fromDom(e.getBody()))(e)),xe=e=>/^\d+(\.\d+)?$/.test(e)?e+"px":e,Ae=e=>W.fromDom(e.selection.getStart()),Re=e=>{return(t=e,o=le("table"),ge(((e,t)=>t(e)),he,t,o,l)).forall(Ce);var t,o,l},_e=(e,t)=>{let o=[];return E(ie(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(_e(e,t))})),o},Oe=(e,t)=>((e,t)=>B(ie(e),t))(e,(e=>z(e,t))),De=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return U(o)?[]:k(o.querySelectorAll(e),W.fromDom)})(t,e),Ne=(e,t,o)=>{if(!(l(o)||r(o)||m(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},Ie=(e,t,o)=>{Ne(e.dom,t,o)},Me=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Pe=(e,t)=>w.from(Me(e,t)),ke=(e,t)=>{e.dom.removeAttribute(t)},Ee=(e,t,o=b)=>e.exists((e=>o(e,t))),Be=(e,t,o)=>e.isSome()&&t.isSome()?w.some(o(e.getOrDie(),t.getOrDie())):w.none(),Fe=(e,t)=>((e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t)(e,t,0),qe=(Le=/^\s+|\s+$/g,e=>e.replace(Le,""));var Le;const je=e=>e.length>0,He=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?w.none():w.some(o)},Ve=e=>void 0!==e.style&&i(e.style.getPropertyValue),$e=(e,t,o)=>{((e,t,o)=>{if(!l(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ve(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},We=(e,t)=>{const o=e.dom,l=window.getComputedStyle(o).getPropertyValue(t);return""!==l||be(e)?l:ze(o,t)},ze=(e,t)=>Ve(e)?e.style.getPropertyValue(t):"",Ue=(e,t)=>{const o=e.dom,l=ze(o,t);return w.from(l).filter((e=>e.length>0))},Ge=(e,t)=>{((e,t)=>{Ve(e)&&e.style.removeProperty(t)})(e.dom,t),Ee(Pe(e,"style").map(qe),"")&&ke(e,"style")},Ke=(e,t,o=0)=>Pe(e,t).map((e=>parseInt(e,10))).getOr(o),Je=(e,t)=>Qe(e,t,y),Qe=(e,t,o)=>L(ie(e),(e=>z(e,t)?o(e)?[e]:[]:Qe(e,t,o))),Xe=["tfoot","thead","tbody","colgroup"],Ye=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ze=(e,t,o)=>({element:e,cells:t,section:o}),et=(e,t)=>((e,t,o=f)=>o(t)?w.none():I(e,J(t))?w.some(t):fe(t,e.join(","),(e=>z(e,"table")||o(e))))(["td","th"],e,t),tt=(e,t)=>Se(e,"table",t),ot=e=>Je(e,"tr"),lt=e=>tt(e).fold(u([]),(e=>Oe(e,"colgroup"))),nt=(e,t)=>k(e,(e=>{if("colgroup"===J(e)){const t=k((e=>z(e,"colgroup")?Oe(e,"col"):L(lt(e),(e=>Oe(e,"col"))))(e),(e=>{const t=Ke(e,"span",1);return Ye(e,1,t)}));return Ze(e,t,"colgroup")}{const o=k((e=>Je(e,"th,td"))(e),(e=>{const t=Ke(e,"rowspan",1),o=Ke(e,"colspan",1);return Ye(e,t,o)}));return Ze(e,o,t(e))}})),rt=e=>re(e).map((e=>{const t=J(e);return(e=>I(Xe,e))(t)?t:"tbody"})).getOr("tbody"),at=e=>Pe(e,"data-snooker-locked-cols").bind((e=>w.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let l=0,n=e.length;l<n;l++){const n=e[l];o[String(n)]=t(n,l)}return o})(e,y))),st=(e,t)=>e+","+t,ct=(e,t)=>{const o=L(e.all,(e=>e.cells));return B(o,t)},it=e=>{const t={},o=[];var l;const n=(l=e,H(l,0)).map((e=>e.element)).bind(tt).bind(at).getOr({});let r=0,a=0,s=0;const{pass:c,fail:i}=((e,t)=>{const o=[],l=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];(t(r,n)?o:l).push(r)}return{pass:o,fail:l}})(e,(e=>"colgroup"===e.section));E(i,(e=>{const l=[];E(e.cells,(e=>{let o=0;for(;void 0!==t[st(s,o)];)o++;const r=O(n,o.toString()),c=((e,t,o,l,n,r)=>({element:e,rowspan:t,colspan:o,row:l,column:n,isLocked:r}))(e.element,e.rowspan,e.colspan,s,o,r);for(let l=0;l<e.colspan;l++)for(let n=0;n<e.rowspan;n++){const e=o+l,r=st(s+n,e);t[r]=c,a=Math.max(a,e+1)}l.push(c)})),r++,o.push(Ze(e.element,l,e.section)),s++}));const{columns:m,colgroups:d}=(e=>H(e,e.length-1))(c).map((e=>{const t=(e=>{const t={};let o=0;return E(e.cells,(e=>{const l=e.colspan;P(l,(n=>{const r=o+n;t[r]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,l,r)})),o+=l})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,x(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),u=((e,t)=>({rows:e,columns:t}))(r,a);return{grid:u,access:t,all:o,columns:m,colgroups:d}},mt=e=>{const t=(e=>{const t=ot(e),o=[...lt(e),...t];return nt(o,rt)})(e);return it(t)},dt=(e,t,o)=>w.from(e.access[st(t,o)]),ut=(e,t,o)=>{const l=ct(e,(e=>o(t,e.element)));return l.length>0?w.some(l[0]):w.none()},pt=e=>L(e.all,(e=>e.cells)),bt=(e,t)=>w.from(e.columns[t]);var gt=tinymce.util.Tools.resolve("tinymce.util.Tools");const ht=(e,t,o)=>{const l=e.select("td,th",t);let n;for(let t=0;t<l.length;t++){const r=e.getStyle(l[t],o);if(a(n)&&(n=r),n!==r)return""}return n},ft=(e,t,o)=>{gt.each("left center right".split(" "),(l=>{l!==o&&e.formatter.remove("align"+l,{},t)})),o&&e.formatter.apply("align"+o,{},t)},yt=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},wt=(e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)})(e).getOr(t),St=(e,t,o)=>wt(We(e,t),o),Ct=(e,t)=>{const o=e.dom,l=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?l:((e,t,o,l)=>t-St(e,`padding-${o}`,0)-St(e,`padding-${l}`,0)-St(e,`border-${o}-width`,0)-St(e,`border-${l}-width`,0))(e,l,"left","right")},vt=e=>Ct(e,"content-box");var Tt=tinymce.util.Tools.resolve("tinymce.Env");const xt=P(5,(e=>{const t=`${e+1}px`;return{title:t,value:t}})),At=k(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],(e=>({title:e,value:e.toLowerCase()}))),Rt="100%",_t=e=>{var t;const o=e.dom,l=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return vt(W.fromDom(l))+"px"},Ot=e=>t=>t.options.get(e),Dt=Ot("table_sizing_mode"),Nt=Ot("table_border_widths"),It=Ot("table_border_styles"),Mt=Ot("table_cell_advtab"),Pt=Ot("table_row_advtab"),kt=Ot("table_advtab"),Et=Ot("table_appearance_options"),Bt=Ot("table_grid"),Ft=Ot("table_style_by_css"),qt=Ot("table_cell_class_list"),Lt=Ot("table_row_class_list"),jt=Ot("table_class_list"),Ht=Ot("table_toolbar"),Vt=Ot("table_background_color_map"),$t=Ot("table_border_color_map"),Wt=e=>"fixed"===Dt(e),zt=e=>"responsive"===Dt(e),Ut=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>zt(e)||!Ft(e)?t:Wt(e)?{...t,width:_t(e)}:{...t,width:Rt})(e,o)},Gt=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>zt(e)||Ft(e)?t:Wt(e)?{...t,width:_t(e)}:{...t,width:Rt})(e,o)},Kt=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,Jt=(e,t,o)=>{const l=ut(e,t,G),n=ut(e,o,G);return l.bind((e=>n.map((t=>{return o=e,l=t,n=Math.min(o.row,l.row),r=Math.min(o.column,l.column),a=Math.max(o.row+o.rowspan-1,l.row+l.rowspan-1),s=Math.max(o.column+o.colspan-1,l.column+l.colspan-1),{startRow:n,startCol:r,finishRow:a,finishCol:s};var o,l,n,r,a,s}))))},Qt=(e,t,o)=>Jt(e,t,o).bind((t=>((e,t)=>{let o=!0;const l=g(Kt,t);for(let n=t.startRow;n<=t.finishRow;n++)for(let r=t.startCol;r<=t.finishCol;r++)o=o&&dt(e,n,r).exists(l);return o?w.some(t):w.none()})(e,t))),Xt=mt,Yt=(e,t)=>{re(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Zt=(e,t)=>{ce(e).fold((()=>{re(e).each((e=>{to(e,t)}))}),(e=>{Yt(e,t)}))},eo=(e,t)=>{me(e).fold((()=>{to(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},to=(e,t)=>{e.dom.appendChild(t.dom)},oo=(e,t)=>{Yt(e,t),to(t,e)},lo=(e,t)=>{E(t,((o,l)=>{const n=0===l?e:t[l-1];Zt(n,o)}))},no=(e,t)=>{E(t,(t=>{to(e,t)}))},ro=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},ao=e=>{const t=ie(e);t.length>0&&lo(e,t),ro(e)},so=((e,t)=>{const o=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:l=>{if(!e(l))throw new Error("Can only get "+t+" value of a "+t+" node");return o(l).getOr("")},getOption:o,set:(o,l)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=l}}})(ee,"text"),co=e=>so.get(e),io=(e,t)=>so.set(e,t);var mo=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const uo=(e,t,o,l)=>{const n=t(e,o);return r=(o,l)=>{const n=t(e,l);return po(e,o,n)},a=n,((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(l,((e,t)=>{a=r(a,e,t)})),a;var r,a},po=(e,t,o)=>t.bind((t=>o.filter(g(e.eq,t)))),bo=(e,t,o)=>o.length>0?((e,t,o,l)=>l(e,t,o[0],o.slice(1)))(e,t,o,uo):w.none(),go={up:u({selector:fe,closest:Se,predicate:he,all:ae}),down:u({selector:De,predicate:_e}),styles:u({get:We,getRaw:Ue,set:$e,remove:Ge}),attrs:u({get:Me,set:Ie,remove:ke,copyTo:(e,t)=>{((e,t)=>{const o=e.dom;v(t,((e,t)=>{Ne(o,t,e)}))})(t,F(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:u({before:Yt,after:Zt,afterAll:lo,append:to,appendAll:no,prepend:eo,wrap:oo}),remove:u({unwrap:ao,remove:ro}),create:u({nu:W.fromTag,clone:e=>W.fromDom(e.dom.cloneNode(!1)),text:W.fromText}),query:u({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:se,nextSibling:ce}),property:u({children:ie,name:J,parent:re,document:e=>ne(e).dom,isText:ee,isComment:Y,isElement:Z,isSpecial:e=>{const t=J(e);return I(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Z(e)?Pe(e,"lang"):w.none(),getText:co,setText:io,isBoundary:e=>!!Z(e)&&("body"===J(e)||I(mo,J(e))),isEmptyTag:e=>!!Z(e)&&I(["br","img","hr","input"],J(e)),isNonEditable:e=>Z(e)&&"false"===Me(e,"contenteditable")}),eq:G,is:K},ho=e=>fe(e,"table"),fo=(e,t,o)=>we(e,t).bind((t=>we(e,o).bind((e=>{return(o=ho,l=[t,e],bo(go,((e,t)=>o(t)),l)).map((o=>({first:t,last:e,table:o})));var o,l})))),yo=(e,t)=>((e,t)=>{const o=De(e,t);return o.length>0?w.some(o):w.none()})(e,t),wo=(e,t,o)=>fo(e,t,o).bind((t=>{const o=t=>G(e,t),l="thead,tfoot,tbody,table",n=fe(t.first,l,o),r=fe(t.last,l,o);return n.bind((e=>r.bind((o=>G(e,o)?((e,t,o)=>{const l=Xt(e);return Qt(l,t,o)})(t.table,t.first,t.last):w.none()))))})),So=e=>k(e,W.fromDom),Co="data-mce-selected",vo="data-mce-first-selected",To="data-mce-last-selected",xo={selected:Co,selectedSelector:"td["+Co+"],th["+Co+"]",firstSelected:vo,firstSelectedSelector:"td["+vo+"],th["+vo+"]",lastSelected:To,lastSelectedSelector:"td["+To+"],th["+To+"]"},Ao=e=>(t,o)=>{const l=J(t),n="col"===l||"colgroup"===l?tt(r=t).bind((e=>yo(e,xo.firstSelectedSelector))).fold(u(r),(e=>e[0])):t;var r;return Se(n,e,o)},Ro=Ao("th,td,caption"),_o=Ao("th,td"),Oo=e=>So(e.model.table.getSelectedCells()),Do=(e,t)=>{const o=_o(e),l=o.bind((e=>tt(e))).map((e=>ot(e)));return Be(o,l,((e,o)=>B(o,(o=>M(So(o.dom.cells),(o=>"1"===Me(o,t)||G(o,e))))))).getOr([])},No=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],Io=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Mo=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Po=e=>{return(t=e,o="#",Fe(t,o)?((e,t)=>e.substring(t))(t,o.length):t).toUpperCase();var t,o},ko=e=>(e=>Io.test(e)||Mo.test(e))(e)?w.some({value:Po(e)}):w.none(),Eo=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Bo=e=>(e=>({value:Po(e)}))(Eo(e.red)+Eo(e.green)+Eo(e.blue)),Fo=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,qo=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Lo=(e,t,o,l)=>({red:e,green:t,blue:o,alpha:l}),jo=(e,t,o,l)=>{const n=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),s=parseFloat(l);return Lo(n,r,a,s)},Ho=e=>{if("transparent"===e)return w.some(Lo(0,0,0,0));const t=Fo.exec(e);if(null!==t)return w.some(jo(t[1],t[2],t[3],"1"));const o=qo.exec(e);return null!==o?w.some(jo(o[1],o[2],o[3],o[4])):w.none()},Vo=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},$o=()=>(e=>{const t=Vo(w.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(w.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(w.some(e))}}})((e=>e.unbind())),Wo=(e,t,o)=>l=>{const n=$o(),r=!je(o);const a=()=>{const a=Oo(e),s=l=>e.formatter.match(t,{value:o},l.dom,r);r?(l.setActive(!M(a,s)),n.set(e.formatter.formatChanged(t,(e=>l.setActive(!e)),!0))):(l.setActive(j(a,s)),n.set(e.formatter.formatChanged(t,l.setActive,!1,{value:o})))};return e.initialized?a():e.on("init",a),n.clear},zo=e=>O(e,"menu"),Uo=e=>k(e,(e=>{const t=e.text||e.title||"";return zo(e)?{text:t,items:Uo(e.menu)}:{text:t,value:e.value}})),Go=(e,t,o,l)=>k(t,(t=>{const n=t.text||t.title;return zo(t)?{type:"nestedmenuitem",text:n,getSubmenuItems:()=>Go(e,t.menu,o,l)}:{text:n,type:"togglemenuitem",onAction:()=>l(t.value),onSetup:Wo(e,o,t.value)}})),Ko=(e,t)=>o=>{e.execCommand("mceTableApplyCellStyle",!1,{[t]:o})},Jo=e=>L(e,(e=>zo(e)?[{...e,menu:Jo(e.menu)}]:je(e.value)?[e]:[])),Qo=(e,t,o,l)=>n=>n(Go(e,t,o,l)),Xo=(e,t,o)=>{const l=k(t,(e=>{return{text:e.title,value:"#"+(t=e.value,ko(t).orThunk((()=>Ho(t).map(Bo))).getOrThunk((()=>{const e=document.createElement("canvas");e.height=1,e.width=1;const o=e.getContext("2d");o.clearRect(0,0,e.width,e.height),o.fillStyle="#FFFFFF",o.fillStyle=t,o.fillRect(0,0,1,1);const l=o.getImageData(0,0,1,1).data,n=l[0],r=l[1],a=l[2],s=l[3];return Bo(Lo(n,r,a,s))}))).value,type:"choiceitem"};var t}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:l.length>0?l:void 0,allowCustomColors:!1},onAction:t=>{const l="remove"===t.value?"":t.value;e.execCommand("mceTableApplyCellStyle",!1,{[o]:l})}}]},Yo=e=>()=>{const t="header"===e.queryCommandValue("mceTableRowType")?"body":"header";e.execCommand("mceTableRowType",!1,{type:t})},Zo=e=>()=>{const t="th"===e.queryCommandValue("mceTableColType")?"td":"th";e.execCommand("mceTableColType",!1,{type:t})},el=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:No}],tl=e=>el.concat((e=>{const t=Uo(qt(e));return t.length>0?w.some({name:"class",type:"listbox",label:"Class",items:t}):w.none()})(e).toArray()),ol=(e,t)=>{const o=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(Uo(It(e)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:"cell"===t?[{name:"borderwidth",type:"input",label:"Border width"}].concat(o):o}},ll=(e,t)=>{const o=e.dom;return{setAttrib:(e,l)=>{o.setAttrib(t,e,l)},setStyle:(e,l)=>{o.setStyle(t,e,l)},setFormat:(o,l)=>{""===l?e.formatter.remove(o,{value:null},t,!0):e.formatter.apply(o,{value:l},t)}}},nl=le("th"),rl=(e,t)=>e&&t?"sectionCells":e?"section":"cells",al=e=>{const t=B(e,(e=>nl(e.element)));return 0===t.length?w.some("td"):t.length===e.length?w.some("th"):w.none()},sl=e=>{const t=k(e,(e=>(e=>{const t="thead"===e.section,o=Ee(al(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:rl(t,o)}:{type:"body"}})(e).type)),o=I(t,"header"),l=I(t,"footer");if(o||l){const e=I(t,"body");return!o||e||l?o||e||!l?w.none():w.some("footer"):w.some("header")}return w.some("body")},cl=(e,t)=>V(e.all,(e=>q(e.cells,(e=>G(t,e.element))))),il=(e,t,o)=>{const l=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t})(k(t.selection,(t=>et(t).bind((t=>cl(e,t))).filter(o))));return n=l.length>0,r=l,n?w.some(r):w.none();var n,r},ml=(e,t)=>il(e,t,y),dl=(e,t)=>j(t,(t=>((e,t)=>cl(e,t).exists((e=>!e.isLocked)))(e,t))),ul=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>dl(e,t.cells))),pl=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>dl(e,t))),bl=e=>{if(!n(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return E(e,((l,r)=>{const a=S(l);if(1!==a.length)throw new Error("one and only one name per case");const s=a[0],c=l[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!n(c))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const l=o.length;if(l!==c.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+c.length+" ("+c+"), got "+l);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const l=S(e);if(t.length!==l.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+l.join(","));if(!j(t,(e=>I(l,e))))throw new Error("Not all branches were specified when using match. Specified: "+l.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}})),o},gl=(bl([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),(e,t)=>{const o=mt(e);return ml(o,t).bind((e=>{const t=e[e.length-1],l=e[0].row,n=t.row+t.rowspan,r=o.all.slice(l,n);return sl(r)})).getOr("")}),hl=e=>{return Fe(e,"rgb")?Ho(t=e).map(Bo).map((e=>"#"+e.value)).getOr(t):e;var t},fl=e=>{const t=W.fromDom(e);return{borderwidth:Ue(t,"border-width").getOr(""),borderstyle:Ue(t,"border-style").getOr(""),bordercolor:Ue(t,"border-color").map(hl).getOr(""),backgroundcolor:Ue(t,"background-color").map(hl).getOr("")}},yl=e=>{const t=e[0],o=e.slice(1);return E(o,(e=>{E(S(t),(o=>{v(e,((e,l)=>{const n=t[o];""!==n&&o===l&&n!==e&&(t[o]="")}))}))})),t},wl=(e,t,o,l)=>q(e,(e=>!a(o.formatter.matchNode(l,t+e)))).getOr(""),Sl=g(wl,["left","center","right"],"align"),Cl=g(wl,["top","middle","bottom"],"valign"),vl=e=>tt(W.fromDom(e)).map((t=>{const o={selection:So(e.cells)};return gl(t,o)})).getOr(""),Tl=(e,t)=>{const o=mt(e),l=pt(o),n=B(l,(e=>M(t,(t=>G(e.element,t)))));return k(n,(e=>({element:e.element.dom,column:bt(o,e.column).map((e=>e.element.dom))})))},xl=(e,t,o,l)=>{const n=1===t.length;E(t,(t=>{const r=t.element,a=n?y:l,s=ll(e,r);((e,t,o,l)=>{l("scope")&&e.setAttrib("scope",o.scope),l("class")&&e.setAttrib("class",o.class),l("height")&&e.setStyle("height",xe(o.height)),l("width")&&t.setStyle("width",xe(o.width))})(s,t.column.map((t=>ll(e,t))).getOr(s),o,a),Mt(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setFormat("tablecellbackgroundcolor",t.backgroundcolor),o("bordercolor")&&e.setFormat("tablecellbordercolor",t.bordercolor),o("borderstyle")&&e.setFormat("tablecellborderstyle",t.borderstyle),o("borderwidth")&&e.setFormat("tablecellborderwidth",xe(t.borderwidth))})(s,o,a),l("halign")&&ft(e,r,o.halign),l("valign")&&((e,t,o)=>{gt.each("top middle bottom".split(" "),(l=>{l!==o&&e.formatter.remove("valign"+l,{},t)})),o&&e.formatter.apply("valign"+o,{},t)})(e,r,o.valign)}))},Al=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=T(l,((e,t)=>o[t]!==e));A(n)>0&&t.length>=1&&tt(t[0]).each((o=>{const r=Tl(o,t),a=A(T(n,((e,t)=>"scope"!==t&&"celltype"!==t)))>0,s=_(n,"celltype");(a||_(n,"scope"))&&xl(e,r,l,g(_,n)),s&&((e,t)=>{e.execCommand("mceTableCellType",!1,{type:t.celltype,no_events:!0})})(e,l),yt(e,o.dom,{structure:s,style:a})}))})(e,t,o,n),e.focus()}))},Rl=(e,t)=>{const o=tt(t[0]).map((o=>k(Tl(o,t),(t=>((e,t,o,l)=>{const n=e.dom,r=(e,t)=>n.getStyle(e,t)||n.getAttrib(e,t);return{width:r(l.getOr(t),"width"),height:r(t,"height"),scope:n.getAttrib(t,"scope"),celltype:(a=t,a.nodeName.toLowerCase()),class:n.getAttrib(t,"class",""),halign:Sl(e,t),valign:Cl(e,t),...o?fl(t):{}};var a})(e,t.element,Mt(e),t.column)))));return yl(o.getOrDie())},_l=e=>{const t=Oo(e);if(0===t.length)return;const o=Rl(e,t),l={type:"tabpanel",tabs:[{title:"General",name:"general",items:tl(e)},ol(e,"cell")]},n={type:"panel",items:[{type:"grid",columns:2,items:tl(e)}]};e.windowManager.open({title:"Cell Properties",size:"normal",body:Mt(e)?l:n,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:g(Al,e,t,o)})},Ol=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Dl=e=>Ol.concat((e=>{const t=Uo(Lt(e));return t.length>0?w.some({name:"class",type:"listbox",label:"Class",items:t}):w.none()})(e).toArray()),Nl=(e,t,o,l)=>{const n=1===t.length?y:l;E(t,(t=>{const r=ll(e,t);((e,t,o)=>{o("class")&&e.setAttrib("class",t.class),o("height")&&e.setStyle("height",xe(t.height))})(r,o,n),Pt(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setStyle("background-color",t.backgroundcolor),o("bordercolor")&&e.setStyle("border-color",t.bordercolor),o("borderstyle")&&e.setStyle("border-style",t.borderstyle)})(r,o,n),l("align")&&ft(e,t,o.align)}))},Il=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=T(l,((e,t)=>o[t]!==e));if(A(n)>0){const o=_(n,"type"),r=!o||A(n)>1;r&&Nl(e,t,l,g(_,n)),o&&((e,t)=>{e.execCommand("mceTableRowType",!1,{type:t.type,no_events:!0})})(e,l),tt(W.fromDom(t[0])).each((t=>yt(e,t.dom,{structure:o,style:r})))}})(e,t,o,n),e.focus()}))},Ml=e=>{const t=Do(Ae(e),xo.selected);if(0===t.length)return;const o=k(t,(t=>((e,t,o)=>{const l=e.dom;return{height:l.getStyle(t,"height")||l.getAttrib(t,"height"),class:l.getAttrib(t,"class",""),type:vl(t),align:Sl(e,t),...o?fl(t):{}}})(e,t.dom,Pt(e)))),l=yl(o),n={type:"tabpanel",tabs:[{title:"General",name:"general",items:Dl(e)},ol(e,"row")]},r={type:"panel",items:[{type:"grid",columns:2,items:Dl(e)}]};e.windowManager.open({title:"Row Properties",size:"normal",body:Pt(e)?n:r,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onSubmit:g(Il,e,k(t,(e=>e.dom)),l)})},Pl=(e,t,o)=>{const l=o?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],n=Et(e)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],r=t.length>0?[{type:"listbox",name:"class",label:"Class",items:t}]:[];return l.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(n).concat([{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(r)},kl=(e,t,o,n)=>{if("TD"===t.tagName||"TH"===t.tagName)l(o)&&c(n)?e.setStyle(t,o,n):e.setStyles(t,o);else if(t.children)for(let l=0;l<t.children.length;l++)kl(e,t.children[l],o,n)},El=(e,t,o,l)=>{const n=e.dom,r={},s={},c=Ft(e),i=kt(e);if(a(o.class)||(r.class=o.class),s.height=xe(o.height),c?s.width=xe(o.width):n.getAttrib(t,"width")&&(r.width=(e=>e?e.replace(/px$/,""):"")(o.width)),c?(s["border-width"]=xe(o.border),s["border-spacing"]=xe(o.cellspacing)):(r.border=o.border,r.cellpadding=o.cellpadding,r.cellspacing=o.cellspacing),c&&t.children){const e={};if(l.border&&(e["border-width"]=xe(o.border)),l.cellpadding&&(e.padding=xe(o.cellpadding)),i&&l.bordercolor&&(e["border-color"]=o.bordercolor),!(e=>{for(const t in e)if(C.call(e,t))return!1;return!0})(e))for(let o=0;o<t.children.length;o++)kl(n,t.children[o],e)}if(i){const e=o;s["background-color"]=e.backgroundcolor,s["border-color"]=e.bordercolor,s["border-style"]=e.borderstyle}n.setStyles(t,{...Ut(e),...s}),n.setAttribs(t,{...Gt(e),...r})},Bl=(e,t,o,l)=>{const n=e.dom,r=l.getData(),a=T(r,((e,t)=>o[t]!==e));l.close(),""===r.class&&delete r.class,e.undoManager.transact((()=>{if(!t){const o=He(r.cols).getOr(1),l=He(r.rows).getOr(1);e.execCommand("mceInsertTable",!1,{rows:l,columns:o}),t=_o(Ae(e),Te(e)).bind((t=>tt(t,Te(e)))).map((e=>e.dom)).getOrDie()}if(A(a)>0){const o={border:_(a,"border"),bordercolor:_(a,"bordercolor"),cellpadding:_(a,"cellpadding")};El(e,t,r,o);const l=n.select("caption",t)[0];(l&&!r.caption||!l&&r.caption)&&e.execCommand("mceTableToggleCaption"),ft(e,t,r.align)}if(e.focus(),e.addVisual(),A(a)>0){const o=_(a,"caption"),l=!o||A(a)>1;yt(e,t,{structure:o,style:l})}}))},Fl=(e,t)=>{const o=e.dom;let l,n=((e,t)=>{const o=Ut(e),l=Gt(e),n=t?{borderstyle:R(o,"border-style").getOr(""),bordercolor:hl(R(o,"border-color").getOr("")),backgroundcolor:hl(R(o,"background-color").getOr(""))}:{};return{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:"",...o,...l,...n,...(()=>{const t=o["border-width"];return Ft(e)&&t?{border:t}:R(l,"border").fold((()=>({})),(e=>({border:e})))})(),...{...R(o,"border-spacing").or(R(l,"cellspacing")).fold((()=>({})),(e=>({cellspacing:e}))),...R(o,"border-padding").or(R(l,"cellpadding")).fold((()=>({})),(e=>({cellpadding:e})))}}})(e,kt(e));t?(n.cols="1",n.rows="1",kt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor="")):(l=o.getParent(e.selection.getStart(),"table",e.getBody()),l?n=((e,t,o)=>{const l=e.dom,n=Ft(e)?l.getStyle(t,"border-spacing")||l.getAttrib(t,"cellspacing"):l.getAttrib(t,"cellspacing")||l.getStyle(t,"border-spacing"),r=Ft(e)?ht(l,t,"padding")||l.getAttrib(t,"cellpadding"):l.getAttrib(t,"cellpadding")||ht(l,t,"padding");return{width:l.getStyle(t,"width")||l.getAttrib(t,"width"),height:l.getStyle(t,"height")||l.getAttrib(t,"height"),cellspacing:null!=n?n:"",cellpadding:null!=r?r:"",border:((t,o)=>{const l=Ue(W.fromDom(o),"border-width");return Ft(e)&&l.isSome()?l.getOr(""):t.getAttrib(o,"border")||ht(e.dom,o,"border-width")||ht(e.dom,o,"border")||""})(l,t),caption:!!l.select("caption",t)[0],class:l.getAttrib(t,"class",""),align:Sl(e,t),...o?fl(t):{}}})(e,l,kt(e)):kt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor=""));const r=Uo(jt(e));r.length>0&&n.class&&(n.class=n.class.replace(/\s*mce\-item\-table\s*/g,""));const a={type:"grid",columns:2,items:Pl(e,r,t)},s=kt(e)?{type:"tabpanel",tabs:[{title:"General",name:"general",items:[a]},ol(e,"table")]}:{type:"panel",items:[a]};e.windowManager.open({title:"Table Properties",size:"normal",body:s,onSubmit:g(Bl,e,l,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:n})},ql=e=>{v({mceTableProps:g(Fl,e,!1),mceTableRowProps:g(Ml,e),mceTableCellProps:g(_l,e),mceInsertTableDialog:g(Fl,e,!0)},((t,o)=>e.addCommand(o,(()=>{return o=t,void(Re(Ae(e))&&o());var o}))))},Ll=p,jl=e=>{const t=(e,t)=>Pe(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&j(e,(e=>t(e,"rowspan")||t(e,"colspan")))?w.some(e):w.none()},Hl=(e,t,o)=>t.length<=1?w.none():wo(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),Vl=e=>{const t=Vo(w.none()),o=Vo([]);let l=w.none();const n=le("caption"),r=e=>l.forall((t=>!t[e])),a=()=>Ro((e=>W.fromDom(e.selection.getEnd()))(e),Te(e)),s=()=>Ro(Ae(e),Te(e)).bind((t=>{return o=Be(tt(t),a().bind(tt),((o,l)=>G(o,l)?n(t)?w.some((e=>({element:e,mergable:w.none(),unmergable:w.none(),selection:[e]}))(t)):w.some(((e,t,o)=>({element:o,mergable:Hl(t,e,xo),unmergable:jl(e),selection:Ll(e)}))(Oo(e),o,t)):w.none())),o.bind(p);var o})),c=e=>tt(e.element).map((t=>{const o=mt(t),l=ml(o,e).getOr([]),n=F(l,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:ul(o,e).isSome(),unmergeable:pl(o,e).isSome(),locked:n}})),i=()=>{t.set((e=>{let t,o=!1;return(...l)=>(o||(o=!0,t=e.apply(null,l)),t)})(s)()),l=t.get().bind(c),E(o.get(),h)},m=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(B(o.get(),(t=>t!==e)))}),d=(o,l)=>m((()=>t.get().fold((()=>{o.setEnabled(!1)}),(t=>{o.setEnabled(!l(t)&&e.selection.isEditable())})))),u=(o,l,n)=>m((()=>t.get().fold((()=>{o.setEnabled(!1),o.setActive(!1)}),(t=>{o.setEnabled(!l(t)&&e.selection.isEditable()),o.setActive(n(t))})))),b=e=>l.exists((t=>t.locked[e])),g=(t,o)=>l=>u(l,(e=>n(e.element)),(()=>e.queryCommandValue(t)===o)),y=g("mceTableRowType","header"),S=g("mceTableColType","th");return e.on("NodeChange ExecCommand TableSelectorChange",i),{onSetupTable:e=>d(e,(e=>!1)),onSetupCellOrRow:e=>d(e,(e=>n(e.element))),onSetupColumn:e=>t=>d(t,(t=>n(t.element)||b(e))),onSetupPasteable:e=>t=>d(t,(t=>n(t.element)||e().isNone())),onSetupPasteableColumn:(e,t)=>o=>d(o,(o=>n(o.element)||e().isNone()||b(t))),onSetupMergeable:e=>d(e,(e=>r("mergeable"))),onSetupUnmergeable:e=>d(e,(e=>r("unmergeable"))),resetTargets:i,onSetupTableWithCaption:t=>u(t,f,(t=>tt(t.element,Te(e)).exists((e=>ye(e,"caption").isSome())))),onSetupTableRowHeaders:y,onSetupTableColumnHeaders:S,targets:t.get}};var $l=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const Wl="x-tinymce/dom-table-",zl=Wl+"rows",Ul=Wl+"columns",Gl=e=>{var t;const o=null!==(t=$l.read())&&void 0!==t?t:[];return V(o,(t=>w.from(t.getType(e))))},Kl=()=>Gl(zl),Jl=()=>Gl(Ul),Ql=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}},Xl=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}},Yl=e=>{const t=Vl(e);(e=>{const t=e.options.register;t("table_border_widths",{processor:"object[]",default:xt}),t("table_border_styles",{processor:"object[]",default:At}),t("table_cell_advtab",{processor:"boolean",default:!0}),t("table_row_advtab",{processor:"boolean",default:!0}),t("table_advtab",{processor:"boolean",default:!0}),t("table_appearance_options",{processor:"boolean",default:!0}),t("table_grid",{processor:"boolean",default:!Tt.deviceType.isTouch()}),t("table_cell_class_list",{processor:"object[]",default:[]}),t("table_row_class_list",{processor:"object[]",default:[]}),t("table_class_list",{processor:"object[]",default:[]}),t("table_toolbar",{processor:"string",default:"tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"}),t("table_background_color_map",{processor:"object[]",default:[]}),t("table_border_color_map",{processor:"object[]",default:[]})})(e),ql(e),((e,t)=>{const o=t=>()=>e.execCommand(t),l=(t,l)=>!!e.queryCommandSupported(l.command)&&(e.ui.registry.addMenuItem(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)}),!0),n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleMenuItem(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})},r=t=>{e.execCommand("mceInsertTable",!1,{rows:t.numRows,columns:t.numColumns})},a=[l("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:t.onSetupCellOrRow}),l("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:t.onSetupPasteable(Kl)}),l("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:t.onSetupPasteable(Kl)})],s=[l("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:t.onSetupColumn("onAny")}),l("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:t.onSetupColumn("onAny")}),l("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:t.onSetupPasteableColumn(Jl,"onFirst")}),l("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:t.onSetupPasteableColumn(Jl,"onLast")})],c=[l("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:t.onSetupUnmergeable})];Bt(e)?e.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:r}],onSetup:Xl(e)}):e.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTableDialog"),onSetup:Xl(e)}),e.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTableDialog"),onSetup:Xl(e)}),l("tableprops",{text:"Table properties",onSetup:t.onSetupTable,command:"mceTableProps"}),l("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:t.onSetupTable,command:"mceTableDelete"}),I(a,!0)&&e.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:u("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),I(s,!0)&&e.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:u("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),I(c,!0)&&e.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:u("tablecellprops tablemergecells tablesplitcells")}),e.ui.registry.addContextMenu("table",{update:()=>(t.resetTargets(),t.targets().fold(u(""),(e=>"caption"===J(e.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable")))});const m=Jo(jt(e));0!==m.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>Go(e,m,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const d=Jo(qt(e));0!==d.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>Go(e,d,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>Go(e,No,"tablecellverticalalign",Ko(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>Go(e,Nt(e),"tablecellborderwidth",Ko(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>Go(e,It(e),"tablecellborderstyle",Ko(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>Xo(e,Vt(e),"background-color"),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>Xo(e,$t(e),"border-color"),onSetup:t.onSetupCellOrRow})),n("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:Yo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Zo(e),onSetup:t.onSetupTableRowHeaders})})(e,t),((e,t)=>{e.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",onSetup:Ql(e),fetch:e=>e("inserttable | cell row column | advtablesort | tableprops deletetable")});const o=t=>()=>e.execCommand(t),l=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addButton(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})},n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleButton(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})};l("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:t.onSetupTable}),l("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:t.onSetupTable}),l("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:t.onSetupUnmergeable}),l("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:t.onSetupCellOrRow}),l("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:t.onSetupColumn("onAny")}),l("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:t.onSetupPasteable(Kl)}),l("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:t.onSetupPasteable(Kl)}),l("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:t.onSetupColumn("onAny")}),l("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:t.onSetupPasteableColumn(Jl,"onFirst")}),l("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:t.onSetupPasteableColumn(Jl,"onLast")}),l("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table",onSetup:Ql(e)});const r=Jo(jt(e));0!==r.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:Qo(e,r,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const a=Jo(qt(e));0!==a.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:Qo(e,a,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:Qo(e,No,"tablecellverticalalign",Ko(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:Qo(e,Nt(e),"tablecellborderwidth",Ko(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:Qo(e,It(e),"tablecellborderstyle",Ko(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:t=>t(Xo(e,Vt(e),"background-color")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:t=>t(Xo(e,$t(e),"border-color")),onSetup:t.onSetupCellOrRow})),n("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:Yo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Zo(e),onSetup:t.onSetupTableColumnHeaders})})(e,t),(e=>{const t=t=>e.dom.is(t,"table")&&e.getBody().contains(t)&&e.dom.isEditable(t.parentNode),o=Ht(e);o.length>0&&e.ui.registry.addContextToolbar("table",{predicate:t,items:o,scope:"node",position:"node"})})(e)};e.add("table",Yl)}()),e}export{o as __require};
1
+ import{__exports as e}from"../../../../_virtual/plugin4.mjs";var t;function o(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,l=(r=String).prototype,l.isPrototypeOf(o)||(null===(a=n.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var o,l;var n,r,a})(t)===e,o=e=>t=>typeof t===e,l=t("string"),n=t("array"),r=o("boolean"),a=(s=void 0,e=>s===e);var s;const c=e=>!(e=>null==e)(e),i=o("function"),m=o("number"),d=()=>{},u=e=>()=>e,p=e=>e,b=(e,t)=>e===t;function g(e,...t){return(...o)=>{const l=t.concat(o);return e.apply(null,l)}}const h=e=>{e()},f=u(!1),y=u(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const S=Object.keys,C=Object.hasOwnProperty,v=(e,t)=>{const o=S(e);for(let l=0,n=o.length;l<n;l++){const n=o[l];t(e[n],n)}},T=(e,t)=>{const o={};var l;return((e,t,o,l)=>{v(e,((e,n)=>{(t(e,n)?o:l)(e,n)}))})(e,t,(l=o,(e,t)=>{l[t]=e}),d),o},x=e=>((e,t)=>{const o=[];return v(e,((e,l)=>{o.push(t(e,l))})),o})(e,p),A=e=>S(e).length,R=(e,t)=>_(e,t)?w.from(e[t]):w.none(),_=(e,t)=>C.call(e,t),O=(e,t)=>_(e,t)&&void 0!==e[t]&&null!==e[t],D=Array.prototype.indexOf,N=Array.prototype.push,I=(e,t)=>((e,t)=>D.call(e,t))(e,t)>-1,M=(e,t)=>{for(let o=0,l=e.length;o<l;o++){if(t(e[o],o))return!0}return!1},P=(e,t)=>{const o=[];for(let l=0;l<e;l++)o.push(t(l));return o},k=(e,t)=>{const o=e.length,l=new Array(o);for(let n=0;n<o;n++){const o=e[n];l[n]=t(o,n)}return l},E=(e,t)=>{for(let o=0,l=e.length;o<l;o++){t(e[o],o)}},B=(e,t)=>{const o=[];for(let l=0,n=e.length;l<n;l++){const n=e[l];t(n,l)&&o.push(n)}return o},F=(e,t,o)=>(E(e,((e,l)=>{o=t(o,e,l)})),o),q=(e,t)=>((e,t,o)=>{for(let l=0,n=e.length;l<n;l++){const n=e[l];if(t(n,l))return w.some(n);if(o(n,l))break}return w.none()})(e,t,f),L=(e,t)=>(e=>{const t=[];for(let o=0,l=e.length;o<l;++o){if(!n(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);N.apply(t,e[o])}return t})(k(e,t)),j=(e,t)=>{for(let o=0,l=e.length;o<l;++o){if(!0!==t(e[o],o))return!1}return!0},H=(e,t)=>t>=0&&t<e.length?w.some(e[t]):w.none(),V=(e,t)=>{for(let o=0;o<e.length;o++){const l=t(e[o],o);if(l.isSome())return l}return w.none()},$=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},W={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return $(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return $(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return $(o)},fromDom:$,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map($)},z=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},U=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,G=(e,t)=>e.dom===t.dom,K=z;"undefined"!=typeof window?window:Function("return this;")();const J=e=>e.dom.nodeName.toLowerCase(),Q=e=>e.dom.nodeType,X=e=>t=>Q(t)===e,Y=e=>8===Q(e)||"#comment"===J(e),Z=X(1),ee=X(3),te=X(9),oe=X(11),le=e=>t=>Z(t)&&J(t)===e,ne=e=>{return te(e)?e:(t=e,W.fromDom(t.dom.ownerDocument));var t},re=e=>w.from(e.dom.parentNode).map(W.fromDom),ae=(e,t)=>{const o=i(t)?t:f;let l=e.dom;const n=[];for(;null!==l.parentNode&&void 0!==l.parentNode;){const e=l.parentNode,t=W.fromDom(e);if(n.push(t),!0===o(t))break;l=e}return n},se=e=>w.from(e.dom.previousSibling).map(W.fromDom),ce=e=>w.from(e.dom.nextSibling).map(W.fromDom),ie=e=>k(e.dom.childNodes,W.fromDom),me=e=>((e,t)=>{const o=e.dom.childNodes;return w.from(o[t]).map(W.fromDom)})(e,0),de=i(Element.prototype.attachShadow)&&i(Node.prototype.getRootNode)?e=>W.fromDom(e.dom.getRootNode()):ne,ue=e=>{const t=de(e);return oe(o=t)&&c(o.dom.host)?w.some(t):w.none();var o},pe=e=>W.fromDom(e.dom.host),be=e=>{const t=ee(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ue(W.fromDom(t)).fold((()=>o.body.contains(t)),(l=be,n=pe,e=>l(n(e))));var l,n};var ge=(e,t,o,l,n)=>e(o,l)?w.some(o):i(n)&&n(o)?w.none():t(o,l,n);const he=(e,t,o)=>{let l=e.dom;const n=i(o)?o:f;for(;l.parentNode;){l=l.parentNode;const e=W.fromDom(l);if(t(e))return w.some(e);if(n(e))break}return w.none()},fe=(e,t,o)=>he(e,(e=>z(e,t)),o),ye=(e,t)=>((e,t)=>q(e.dom.childNodes,(e=>t(W.fromDom(e)))).map(W.fromDom))(e,(e=>z(e,t))),we=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return U(o)?w.none():w.from(o.querySelector(e)).map(W.fromDom)})(t,e),Se=(e,t,o)=>ge(((e,t)=>z(e,t)),fe,e,t,o),Ce=(e,t=!1)=>{return be(e)?e.dom.isContentEditable:(o=e,Se(o,"[contenteditable]")).fold(u(t),(e=>"true"===ve(e)));var o},ve=e=>e.dom.contentEditable,Te=e=>t=>G(t,(e=>W.fromDom(e.getBody()))(e)),xe=e=>/^\d+(\.\d+)?$/.test(e)?e+"px":e,Ae=e=>W.fromDom(e.selection.getStart()),Re=e=>{return(t=e,o=le("table"),ge(((e,t)=>t(e)),he,t,o,l)).forall(Ce);var t,o,l},_e=(e,t)=>{let o=[];return E(ie(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(_e(e,t))})),o},Oe=(e,t)=>((e,t)=>B(ie(e),t))(e,(e=>z(e,t))),De=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return U(o)?[]:k(o.querySelectorAll(e),W.fromDom)})(t,e),Ne=(e,t,o)=>{if(!(l(o)||r(o)||m(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},Ie=(e,t,o)=>{Ne(e.dom,t,o)},Me=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Pe=(e,t)=>w.from(Me(e,t)),ke=(e,t)=>{e.dom.removeAttribute(t)},Ee=(e,t,o=b)=>e.exists((e=>o(e,t))),Be=(e,t,o)=>e.isSome()&&t.isSome()?w.some(o(e.getOrDie(),t.getOrDie())):w.none(),Fe=(e,t)=>((e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t)(e,t,0),qe=(Le=/^\s+|\s+$/g,e=>e.replace(Le,""));var Le;const je=e=>e.length>0,He=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?w.none():w.some(o)},Ve=e=>void 0!==e.style&&i(e.style.getPropertyValue),$e=(e,t,o)=>{((e,t,o)=>{if(!l(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ve(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},We=(e,t)=>{const o=e.dom,l=window.getComputedStyle(o).getPropertyValue(t);return""!==l||be(e)?l:ze(o,t)},ze=(e,t)=>Ve(e)?e.style.getPropertyValue(t):"",Ue=(e,t)=>{const o=e.dom,l=ze(o,t);return w.from(l).filter((e=>e.length>0))},Ge=(e,t)=>{((e,t)=>{Ve(e)&&e.style.removeProperty(t)})(e.dom,t),Ee(Pe(e,"style").map(qe),"")&&ke(e,"style")},Ke=(e,t,o=0)=>Pe(e,t).map((e=>parseInt(e,10))).getOr(o),Je=(e,t)=>Qe(e,t,y),Qe=(e,t,o)=>L(ie(e),(e=>z(e,t)?o(e)?[e]:[]:Qe(e,t,o))),Xe=["tfoot","thead","tbody","colgroup"],Ye=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ze=(e,t,o)=>({element:e,cells:t,section:o}),et=(e,t)=>((e,t,o=f)=>o(t)?w.none():I(e,J(t))?w.some(t):fe(t,e.join(","),(e=>z(e,"table")||o(e))))(["td","th"],e,t),tt=(e,t)=>Se(e,"table",t),ot=e=>Je(e,"tr"),lt=e=>tt(e).fold(u([]),(e=>Oe(e,"colgroup"))),nt=(e,t)=>k(e,(e=>{if("colgroup"===J(e)){const t=k((e=>z(e,"colgroup")?Oe(e,"col"):L(lt(e),(e=>Oe(e,"col"))))(e),(e=>{const t=Ke(e,"span",1);return Ye(e,1,t)}));return Ze(e,t,"colgroup")}{const o=k((e=>Je(e,"th,td"))(e),(e=>{const t=Ke(e,"rowspan",1),o=Ke(e,"colspan",1);return Ye(e,t,o)}));return Ze(e,o,t(e))}})),rt=e=>re(e).map((e=>{const t=J(e);return(e=>I(Xe,e))(t)?t:"tbody"})).getOr("tbody"),at=e=>Pe(e,"data-snooker-locked-cols").bind((e=>w.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let l=0,n=e.length;l<n;l++){const n=e[l];o[String(n)]=t(n,l)}return o})(e,y))),st=(e,t)=>e+","+t,ct=(e,t)=>{const o=L(e.all,(e=>e.cells));return B(o,t)},it=e=>{const t={},o=[];var l;const n=(l=e,H(l,0)).map((e=>e.element)).bind(tt).bind(at).getOr({});let r=0,a=0,s=0;const{pass:c,fail:i}=((e,t)=>{const o=[],l=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];(t(r,n)?o:l).push(r)}return{pass:o,fail:l}})(e,(e=>"colgroup"===e.section));E(i,(e=>{const l=[];E(e.cells,(e=>{let o=0;for(;void 0!==t[st(s,o)];)o++;const r=O(n,o.toString()),c=((e,t,o,l,n,r)=>({element:e,rowspan:t,colspan:o,row:l,column:n,isLocked:r}))(e.element,e.rowspan,e.colspan,s,o,r);for(let l=0;l<e.colspan;l++)for(let n=0;n<e.rowspan;n++){const e=o+l,r=st(s+n,e);t[r]=c,a=Math.max(a,e+1)}l.push(c)})),r++,o.push(Ze(e.element,l,e.section)),s++}));const{columns:m,colgroups:d}=(e=>H(e,e.length-1))(c).map((e=>{const t=(e=>{const t={};let o=0;return E(e.cells,(e=>{const l=e.colspan;P(l,(n=>{const r=o+n;t[r]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,l,r)})),o+=l})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,x(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),u=((e,t)=>({rows:e,columns:t}))(r,a);return{grid:u,access:t,all:o,columns:m,colgroups:d}},mt=e=>{const t=(e=>{const t=ot(e),o=[...lt(e),...t];return nt(o,rt)})(e);return it(t)},dt=(e,t,o)=>w.from(e.access[st(t,o)]),ut=(e,t,o)=>{const l=ct(e,(e=>o(t,e.element)));return l.length>0?w.some(l[0]):w.none()},pt=e=>L(e.all,(e=>e.cells)),bt=(e,t)=>w.from(e.columns[t]);var gt=tinymce.util.Tools.resolve("tinymce.util.Tools");const ht=(e,t,o)=>{const l=e.select("td,th",t);let n;for(let t=0;t<l.length;t++){const r=e.getStyle(l[t],o);if(a(n)&&(n=r),n!==r)return""}return n},ft=(e,t,o)=>{gt.each("left center right".split(" "),(l=>{l!==o&&e.formatter.remove("align"+l,{},t)})),o&&e.formatter.apply("align"+o,{},t)},yt=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},wt=(e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)})(e).getOr(t),St=(e,t,o)=>wt(We(e,t),o),Ct=(e,t)=>{const o=e.dom,l=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?l:((e,t,o,l)=>t-St(e,`padding-${o}`,0)-St(e,`padding-${l}`,0)-St(e,`border-${o}-width`,0)-St(e,`border-${l}-width`,0))(e,l,"left","right")},vt=e=>Ct(e,"content-box");var Tt=tinymce.util.Tools.resolve("tinymce.Env");const xt=P(5,(e=>{const t=`${e+1}px`;return{title:t,value:t}})),At=k(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],(e=>({title:e,value:e.toLowerCase()}))),Rt="100%",_t=e=>{var t;const o=e.dom,l=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return vt(W.fromDom(l))+"px"},Ot=e=>t=>t.options.get(e),Dt=Ot("table_sizing_mode"),Nt=Ot("table_border_widths"),It=Ot("table_border_styles"),Mt=Ot("table_cell_advtab"),Pt=Ot("table_row_advtab"),kt=Ot("table_advtab"),Et=Ot("table_appearance_options"),Bt=Ot("table_grid"),Ft=Ot("table_style_by_css"),qt=Ot("table_cell_class_list"),Lt=Ot("table_row_class_list"),jt=Ot("table_class_list"),Ht=Ot("table_toolbar"),Vt=Ot("table_background_color_map"),$t=Ot("table_border_color_map"),Wt=e=>"fixed"===Dt(e),zt=e=>"responsive"===Dt(e),Ut=e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>zt(e)||!Ft(e)?t:Wt(e)?{...t,width:_t(e)}:{...t,width:Rt})(e,o)},Gt=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>zt(e)||Ft(e)?t:Wt(e)?{...t,width:_t(e)}:{...t,width:Rt})(e,o)},Kt=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,Jt=(e,t,o)=>{const l=ut(e,t,G),n=ut(e,o,G);return l.bind((e=>n.map((t=>{return o=e,l=t,n=Math.min(o.row,l.row),r=Math.min(o.column,l.column),a=Math.max(o.row+o.rowspan-1,l.row+l.rowspan-1),s=Math.max(o.column+o.colspan-1,l.column+l.colspan-1),{startRow:n,startCol:r,finishRow:a,finishCol:s};var o,l,n,r,a,s}))))},Qt=(e,t,o)=>Jt(e,t,o).bind((t=>((e,t)=>{let o=!0;const l=g(Kt,t);for(let n=t.startRow;n<=t.finishRow;n++)for(let r=t.startCol;r<=t.finishCol;r++)o=o&&dt(e,n,r).exists(l);return o?w.some(t):w.none()})(e,t))),Xt=mt,Yt=(e,t)=>{re(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Zt=(e,t)=>{ce(e).fold((()=>{re(e).each((e=>{to(e,t)}))}),(e=>{Yt(e,t)}))},eo=(e,t)=>{me(e).fold((()=>{to(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},to=(e,t)=>{e.dom.appendChild(t.dom)},oo=(e,t)=>{Yt(e,t),to(t,e)},lo=(e,t)=>{E(t,((o,l)=>{const n=0===l?e:t[l-1];Zt(n,o)}))},no=(e,t)=>{E(t,(t=>{to(e,t)}))},ro=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},ao=e=>{const t=ie(e);t.length>0&&lo(e,t),ro(e)},so=((e,t)=>{const o=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:l=>{if(!e(l))throw new Error("Can only get "+t+" value of a "+t+" node");return o(l).getOr("")},getOption:o,set:(o,l)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=l}}})(ee,"text"),co=e=>so.get(e),io=(e,t)=>so.set(e,t);var mo=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const uo=(e,t,o,l)=>{const n=t(e,o);return r=(o,l)=>{const n=t(e,l);return po(e,o,n)},a=n,((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(l,((e,t)=>{a=r(a,e,t)})),a;var r,a},po=(e,t,o)=>t.bind((t=>o.filter(g(e.eq,t)))),bo=(e,t,o)=>o.length>0?((e,t,o,l)=>l(e,t,o[0],o.slice(1)))(e,t,o,uo):w.none(),go={up:u({selector:fe,closest:Se,predicate:he,all:ae}),down:u({selector:De,predicate:_e}),styles:u({get:We,getRaw:Ue,set:$e,remove:Ge}),attrs:u({get:Me,set:Ie,remove:ke,copyTo:(e,t)=>{((e,t)=>{const o=e.dom;v(t,((e,t)=>{Ne(o,t,e)}))})(t,F(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:u({before:Yt,after:Zt,afterAll:lo,append:to,appendAll:no,prepend:eo,wrap:oo}),remove:u({unwrap:ao,remove:ro}),create:u({nu:W.fromTag,clone:e=>W.fromDom(e.dom.cloneNode(!1)),text:W.fromText}),query:u({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:se,nextSibling:ce}),property:u({children:ie,name:J,parent:re,document:e=>ne(e).dom,isText:ee,isComment:Y,isElement:Z,isSpecial:e=>{const t=J(e);return I(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Z(e)?Pe(e,"lang"):w.none(),getText:co,setText:io,isBoundary:e=>!!Z(e)&&("body"===J(e)||I(mo,J(e))),isEmptyTag:e=>!!Z(e)&&I(["br","img","hr","input"],J(e)),isNonEditable:e=>Z(e)&&"false"===Me(e,"contenteditable")}),eq:G,is:K},ho=e=>fe(e,"table"),fo=(e,t,o)=>we(e,t).bind((t=>we(e,o).bind((e=>{return(o=ho,l=[t,e],bo(go,((e,t)=>o(t)),l)).map((o=>({first:t,last:e,table:o})));var o,l})))),yo=(e,t)=>((e,t)=>{const o=De(e,t);return o.length>0?w.some(o):w.none()})(e,t),wo=(e,t,o)=>fo(e,t,o).bind((t=>{const o=t=>G(e,t),l="thead,tfoot,tbody,table",n=fe(t.first,l,o),r=fe(t.last,l,o);return n.bind((e=>r.bind((o=>G(e,o)?((e,t,o)=>{const l=Xt(e);return Qt(l,t,o)})(t.table,t.first,t.last):w.none()))))})),So=e=>k(e,W.fromDom),Co="data-mce-selected",vo="data-mce-first-selected",To="data-mce-last-selected",xo={selected:Co,selectedSelector:"td["+Co+"],th["+Co+"]",firstSelected:vo,firstSelectedSelector:"td["+vo+"],th["+vo+"]",lastSelected:To,lastSelectedSelector:"td["+To+"],th["+To+"]"},Ao=e=>(t,o)=>{const l=J(t),n="col"===l||"colgroup"===l?tt(r=t).bind((e=>yo(e,xo.firstSelectedSelector))).fold(u(r),(e=>e[0])):t;var r;return Se(n,e,o)},Ro=Ao("th,td,caption"),_o=Ao("th,td"),Oo=e=>So(e.model.table.getSelectedCells()),Do=(e,t)=>{const o=_o(e),l=o.bind((e=>tt(e))).map((e=>ot(e)));return Be(o,l,((e,o)=>B(o,(o=>M(So(o.dom.cells),(o=>"1"===Me(o,t)||G(o,e))))))).getOr([])},No=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],Io=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Mo=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Po=e=>{return(t=e,o="#",Fe(t,o)?((e,t)=>e.substring(t))(t,o.length):t).toUpperCase();var t,o},ko=e=>(e=>Io.test(e)||Mo.test(e))(e)?w.some({value:Po(e)}):w.none(),Eo=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Bo=e=>(e=>({value:Po(e)}))(Eo(e.red)+Eo(e.green)+Eo(e.blue)),Fo=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,qo=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Lo=(e,t,o,l)=>({red:e,green:t,blue:o,alpha:l}),jo=(e,t,o,l)=>{const n=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),s=parseFloat(l);return Lo(n,r,a,s)},Ho=e=>{if("transparent"===e)return w.some(Lo(0,0,0,0));const t=Fo.exec(e);if(null!==t)return w.some(jo(t[1],t[2],t[3],"1"));const o=qo.exec(e);return null!==o?w.some(jo(o[1],o[2],o[3],o[4])):w.none()},Vo=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},$o=()=>(e=>{const t=Vo(w.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(w.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(w.some(e))}}})((e=>e.unbind())),Wo=(e,t,o)=>l=>{const n=$o(),r=!je(o);const a=()=>{const a=Oo(e),s=l=>e.formatter.match(t,{value:o},l.dom,r);r?(l.setActive(!M(a,s)),n.set(e.formatter.formatChanged(t,(e=>l.setActive(!e)),!0))):(l.setActive(j(a,s)),n.set(e.formatter.formatChanged(t,l.setActive,!1,{value:o})))};return e.initialized?a():e.on("init",a),n.clear},zo=e=>O(e,"menu"),Uo=e=>k(e,(e=>{const t=e.text||e.title||"";return zo(e)?{text:t,items:Uo(e.menu)}:{text:t,value:e.value}})),Go=(e,t,o,l)=>k(t,(t=>{const n=t.text||t.title;return zo(t)?{type:"nestedmenuitem",text:n,getSubmenuItems:()=>Go(e,t.menu,o,l)}:{text:n,type:"togglemenuitem",onAction:()=>l(t.value),onSetup:Wo(e,o,t.value)}})),Ko=(e,t)=>o=>{e.execCommand("mceTableApplyCellStyle",!1,{[t]:o})},Jo=e=>L(e,(e=>zo(e)?[{...e,menu:Jo(e.menu)}]:je(e.value)?[e]:[])),Qo=(e,t,o,l)=>n=>n(Go(e,t,o,l)),Xo=(e,t,o)=>{const l=k(t,(e=>{return{text:e.title,value:"#"+(t=e.value,ko(t).orThunk((()=>Ho(t).map(Bo))).getOrThunk((()=>{const e=document.createElement("canvas");e.height=1,e.width=1;const o=e.getContext("2d");o.clearRect(0,0,e.width,e.height),o.fillStyle="#FFFFFF",o.fillStyle=t,o.fillRect(0,0,1,1);const l=o.getImageData(0,0,1,1).data,n=l[0],r=l[1],a=l[2],s=l[3];return Bo(Lo(n,r,a,s))}))).value,type:"choiceitem"};var t}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:l.length>0?l:void 0,allowCustomColors:!1},onAction:t=>{const l="remove"===t.value?"":t.value;e.execCommand("mceTableApplyCellStyle",!1,{[o]:l})}}]},Yo=e=>()=>{const t="header"===e.queryCommandValue("mceTableRowType")?"body":"header";e.execCommand("mceTableRowType",!1,{type:t})},Zo=e=>()=>{const t="th"===e.queryCommandValue("mceTableColType")?"td":"th";e.execCommand("mceTableColType",!1,{type:t})},el=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:No}],tl=e=>el.concat((e=>{const t=Uo(qt(e));return t.length>0?w.some({name:"class",type:"listbox",label:"Class",items:t}):w.none()})(e).toArray()),ol=(e,t)=>{const o=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(Uo(It(e)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:"cell"===t?[{name:"borderwidth",type:"input",label:"Border width"}].concat(o):o}},ll=(e,t)=>{const o=e.dom;return{setAttrib:(e,l)=>{o.setAttrib(t,e,l)},setStyle:(e,l)=>{o.setStyle(t,e,l)},setFormat:(o,l)=>{""===l?e.formatter.remove(o,{value:null},t,!0):e.formatter.apply(o,{value:l},t)}}},nl=le("th"),rl=(e,t)=>e&&t?"sectionCells":e?"section":"cells",al=e=>{const t=B(e,(e=>nl(e.element)));return 0===t.length?w.some("td"):t.length===e.length?w.some("th"):w.none()},sl=e=>{const t=k(e,(e=>(e=>{const t="thead"===e.section,o=Ee(al(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:rl(t,o)}:{type:"body"}})(e).type)),o=I(t,"header"),l=I(t,"footer");if(o||l){const e=I(t,"body");return!o||e||l?o||e||!l?w.none():w.some("footer"):w.some("header")}return w.some("body")},cl=(e,t)=>V(e.all,(e=>q(e.cells,(e=>G(t,e.element))))),il=(e,t,o)=>{const l=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t})(k(t.selection,(t=>et(t).bind((t=>cl(e,t))).filter(o))));return n=l.length>0,r=l,n?w.some(r):w.none();var n,r},ml=(e,t)=>il(e,t,y),dl=(e,t)=>j(t,(t=>((e,t)=>cl(e,t).exists((e=>!e.isLocked)))(e,t))),ul=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>dl(e,t.cells))),pl=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>dl(e,t))),bl=e=>{if(!n(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return E(e,((l,r)=>{const a=S(l);if(1!==a.length)throw new Error("one and only one name per case");const s=a[0],c=l[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!n(c))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const l=o.length;if(l!==c.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+c.length+" ("+c+"), got "+l);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const l=S(e);if(t.length!==l.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+l.join(","));if(!j(t,(e=>I(l,e))))throw new Error("Not all branches were specified when using match. Specified: "+l.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}})),o},gl=(bl([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),(e,t)=>{const o=mt(e);return ml(o,t).bind((e=>{const t=e[e.length-1],l=e[0].row,n=t.row+t.rowspan,r=o.all.slice(l,n);return sl(r)})).getOr("")}),hl=e=>{return Fe(e,"rgb")?Ho(t=e).map(Bo).map((e=>"#"+e.value)).getOr(t):e;var t},fl=e=>{const t=W.fromDom(e);return{borderwidth:Ue(t,"border-width").getOr(""),borderstyle:Ue(t,"border-style").getOr(""),bordercolor:Ue(t,"border-color").map(hl).getOr(""),backgroundcolor:Ue(t,"background-color").map(hl).getOr("")}},yl=e=>{const t=e[0],o=e.slice(1);return E(o,(e=>{E(S(t),(o=>{v(e,((e,l)=>{const n=t[o];""!==n&&o===l&&n!==e&&(t[o]="")}))}))})),t},wl=(e,t,o,l)=>q(e,(e=>!a(o.formatter.matchNode(l,t+e)))).getOr(""),Sl=g(wl,["left","center","right"],"align"),Cl=g(wl,["top","middle","bottom"],"valign"),vl=e=>tt(W.fromDom(e)).map((t=>{const o={selection:So(e.cells)};return gl(t,o)})).getOr(""),Tl=(e,t)=>{const o=mt(e),l=pt(o),n=B(l,(e=>M(t,(t=>G(e.element,t)))));return k(n,(e=>({element:e.element.dom,column:bt(o,e.column).map((e=>e.element.dom))})))},xl=(e,t,o,l)=>{const n=1===t.length;E(t,(t=>{const r=t.element,a=n?y:l,s=ll(e,r);((e,t,o,l)=>{l("scope")&&e.setAttrib("scope",o.scope),l("class")&&e.setAttrib("class",o.class),l("height")&&e.setStyle("height",xe(o.height)),l("width")&&t.setStyle("width",xe(o.width))})(s,t.column.map((t=>ll(e,t))).getOr(s),o,a),Mt(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setFormat("tablecellbackgroundcolor",t.backgroundcolor),o("bordercolor")&&e.setFormat("tablecellbordercolor",t.bordercolor),o("borderstyle")&&e.setFormat("tablecellborderstyle",t.borderstyle),o("borderwidth")&&e.setFormat("tablecellborderwidth",xe(t.borderwidth))})(s,o,a),l("halign")&&ft(e,r,o.halign),l("valign")&&((e,t,o)=>{gt.each("top middle bottom".split(" "),(l=>{l!==o&&e.formatter.remove("valign"+l,{},t)})),o&&e.formatter.apply("valign"+o,{},t)})(e,r,o.valign)}))},Al=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=T(l,((e,t)=>o[t]!==e));A(n)>0&&t.length>=1&&tt(t[0]).each((o=>{const r=Tl(o,t),a=A(T(n,((e,t)=>"scope"!==t&&"celltype"!==t)))>0,s=_(n,"celltype");(a||_(n,"scope"))&&xl(e,r,l,g(_,n)),s&&((e,t)=>{e.execCommand("mceTableCellType",!1,{type:t.celltype,no_events:!0})})(e,l),yt(e,o.dom,{structure:s,style:a})}))})(e,t,o,n),e.focus()}))},Rl=(e,t)=>{const o=tt(t[0]).map((o=>k(Tl(o,t),(t=>((e,t,o,l)=>{const n=e.dom,r=(e,t)=>n.getStyle(e,t)||n.getAttrib(e,t);return{width:r(l.getOr(t),"width"),height:r(t,"height"),scope:n.getAttrib(t,"scope"),celltype:(a=t,a.nodeName.toLowerCase()),class:n.getAttrib(t,"class",""),halign:Sl(e,t),valign:Cl(e,t),...o?fl(t):{}};var a})(e,t.element,Mt(e),t.column)))));return yl(o.getOrDie())},_l=e=>{const t=Oo(e);if(0===t.length)return;const o=Rl(e,t),l={type:"tabpanel",tabs:[{title:"General",name:"general",items:tl(e)},ol(e,"cell")]},n={type:"panel",items:[{type:"grid",columns:2,items:tl(e)}]};e.windowManager.open({title:"Cell Properties",size:"normal",body:Mt(e)?l:n,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:g(Al,e,t,o)})},Ol=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Dl=e=>Ol.concat((e=>{const t=Uo(Lt(e));return t.length>0?w.some({name:"class",type:"listbox",label:"Class",items:t}):w.none()})(e).toArray()),Nl=(e,t,o,l)=>{const n=1===t.length?y:l;E(t,(t=>{const r=ll(e,t);((e,t,o)=>{o("class")&&e.setAttrib("class",t.class),o("height")&&e.setStyle("height",xe(t.height))})(r,o,n),Pt(e)&&((e,t,o)=>{o("backgroundcolor")&&e.setStyle("background-color",t.backgroundcolor),o("bordercolor")&&e.setStyle("border-color",t.bordercolor),o("borderstyle")&&e.setStyle("border-style",t.borderstyle)})(r,o,n),l("align")&&ft(e,t,o.align)}))},Il=(e,t,o,l)=>{const n=l.getData();l.close(),e.undoManager.transact((()=>{((e,t,o,l)=>{const n=T(l,((e,t)=>o[t]!==e));if(A(n)>0){const o=_(n,"type"),r=!o||A(n)>1;r&&Nl(e,t,l,g(_,n)),o&&((e,t)=>{e.execCommand("mceTableRowType",!1,{type:t.type,no_events:!0})})(e,l),tt(W.fromDom(t[0])).each((t=>yt(e,t.dom,{structure:o,style:r})))}})(e,t,o,n),e.focus()}))},Ml=e=>{const t=Do(Ae(e),xo.selected);if(0===t.length)return;const o=k(t,(t=>((e,t,o)=>{const l=e.dom;return{height:l.getStyle(t,"height")||l.getAttrib(t,"height"),class:l.getAttrib(t,"class",""),type:vl(t),align:Sl(e,t),...o?fl(t):{}}})(e,t.dom,Pt(e)))),l=yl(o),n={type:"tabpanel",tabs:[{title:"General",name:"general",items:Dl(e)},ol(e,"row")]},r={type:"panel",items:[{type:"grid",columns:2,items:Dl(e)}]};e.windowManager.open({title:"Row Properties",size:"normal",body:Pt(e)?n:r,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onSubmit:g(Il,e,k(t,(e=>e.dom)),l)})},Pl=(e,t,o)=>{const l=o?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],n=Et(e)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],r=t.length>0?[{type:"listbox",name:"class",label:"Class",items:t}]:[];return l.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(n).concat([{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(r)},kl=(e,t,o,n)=>{if("TD"===t.tagName||"TH"===t.tagName)l(o)&&c(n)?e.setStyle(t,o,n):e.setStyles(t,o);else if(t.children)for(let l=0;l<t.children.length;l++)kl(e,t.children[l],o,n)},El=(e,t,o,l)=>{const n=e.dom,r={},s={},c=Ft(e),i=kt(e);if(a(o.class)||(r.class=o.class),s.height=xe(o.height),c?s.width=xe(o.width):n.getAttrib(t,"width")&&(r.width=(e=>e?e.replace(/px$/,""):"")(o.width)),c?(s["border-width"]=xe(o.border),s["border-spacing"]=xe(o.cellspacing)):(r.border=o.border,r.cellpadding=o.cellpadding,r.cellspacing=o.cellspacing),c&&t.children){const e={};if(l.border&&(e["border-width"]=xe(o.border)),l.cellpadding&&(e.padding=xe(o.cellpadding)),i&&l.bordercolor&&(e["border-color"]=o.bordercolor),!(e=>{for(const t in e)if(C.call(e,t))return!1;return!0})(e))for(let o=0;o<t.children.length;o++)kl(n,t.children[o],e)}if(i){const e=o;s["background-color"]=e.backgroundcolor,s["border-color"]=e.bordercolor,s["border-style"]=e.borderstyle}n.setStyles(t,{...Ut(e),...s}),n.setAttribs(t,{...Gt(e),...r})},Bl=(e,t,o,l)=>{const n=e.dom,r=l.getData(),a=T(r,((e,t)=>o[t]!==e));l.close(),""===r.class&&delete r.class,e.undoManager.transact((()=>{if(!t){const o=He(r.cols).getOr(1),l=He(r.rows).getOr(1);e.execCommand("mceInsertTable",!1,{rows:l,columns:o}),t=_o(Ae(e),Te(e)).bind((t=>tt(t,Te(e)))).map((e=>e.dom)).getOrDie()}if(A(a)>0){const o={border:_(a,"border"),bordercolor:_(a,"bordercolor"),cellpadding:_(a,"cellpadding")};El(e,t,r,o);const l=n.select("caption",t)[0];(l&&!r.caption||!l&&r.caption)&&e.execCommand("mceTableToggleCaption"),ft(e,t,r.align)}if(e.focus(),e.addVisual(),A(a)>0){const o=_(a,"caption"),l=!o||A(a)>1;yt(e,t,{structure:o,style:l})}}))},Fl=(e,t)=>{const o=e.dom;let l,n=((e,t)=>{const o=Ut(e),l=Gt(e),n=t?{borderstyle:R(o,"border-style").getOr(""),bordercolor:hl(R(o,"border-color").getOr("")),backgroundcolor:hl(R(o,"background-color").getOr(""))}:{};return{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:"",...o,...l,...n,...(()=>{const t=o["border-width"];return Ft(e)&&t?{border:t}:R(l,"border").fold((()=>({})),(e=>({border:e})))})(),...{...R(o,"border-spacing").or(R(l,"cellspacing")).fold((()=>({})),(e=>({cellspacing:e}))),...R(o,"border-padding").or(R(l,"cellpadding")).fold((()=>({})),(e=>({cellpadding:e})))}}})(e,kt(e));t?(n.cols="1",n.rows="1",kt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor="")):(l=o.getParent(e.selection.getStart(),"table",e.getBody()),l?n=((e,t,o)=>{const l=e.dom,n=Ft(e)?l.getStyle(t,"border-spacing")||l.getAttrib(t,"cellspacing"):l.getAttrib(t,"cellspacing")||l.getStyle(t,"border-spacing"),r=Ft(e)?ht(l,t,"padding")||l.getAttrib(t,"cellpadding"):l.getAttrib(t,"cellpadding")||ht(l,t,"padding");return{width:l.getStyle(t,"width")||l.getAttrib(t,"width"),height:l.getStyle(t,"height")||l.getAttrib(t,"height"),cellspacing:null!=n?n:"",cellpadding:null!=r?r:"",border:((t,o)=>{const l=Ue(W.fromDom(o),"border-width");return Ft(e)&&l.isSome()?l.getOr(""):t.getAttrib(o,"border")||ht(e.dom,o,"border-width")||ht(e.dom,o,"border")||""})(l,t),caption:!!l.select("caption",t)[0],class:l.getAttrib(t,"class",""),align:Sl(e,t),...o?fl(t):{}}})(e,l,kt(e)):kt(e)&&(n.borderstyle="",n.bordercolor="",n.backgroundcolor=""));const r=Uo(jt(e));r.length>0&&n.class&&(n.class=n.class.replace(/\s*mce\-item\-table\s*/g,""));const a={type:"grid",columns:2,items:Pl(e,r,t)},s=kt(e)?{type:"tabpanel",tabs:[{title:"General",name:"general",items:[a]},ol(e,"table")]}:{type:"panel",items:[a]};e.windowManager.open({title:"Table Properties",size:"normal",body:s,onSubmit:g(Bl,e,l,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:n})},ql=e=>{v({mceTableProps:g(Fl,e,!1),mceTableRowProps:g(Ml,e),mceTableCellProps:g(_l,e),mceInsertTableDialog:g(Fl,e,!0)},((t,o)=>e.addCommand(o,(()=>{return o=t,void(Re(Ae(e))&&o());var o}))))},Ll=p,jl=e=>{const t=(e,t)=>Pe(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&j(e,(e=>t(e,"rowspan")||t(e,"colspan")))?w.some(e):w.none()},Hl=(e,t,o)=>t.length<=1?w.none():wo(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),Vl=e=>{const t=Vo(w.none()),o=Vo([]);let l=w.none();const n=le("caption"),r=e=>l.forall((t=>!t[e])),a=()=>Ro((e=>W.fromDom(e.selection.getEnd()))(e),Te(e)),s=()=>Ro(Ae(e),Te(e)).bind((t=>{return o=Be(tt(t),a().bind(tt),((o,l)=>G(o,l)?n(t)?w.some((e=>({element:e,mergable:w.none(),unmergable:w.none(),selection:[e]}))(t)):w.some(((e,t,o)=>({element:o,mergable:Hl(t,e,xo),unmergable:jl(e),selection:Ll(e)}))(Oo(e),o,t)):w.none())),o.bind(p);var o})),c=e=>tt(e.element).map((t=>{const o=mt(t),l=ml(o,e).getOr([]),n=F(l,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:ul(o,e).isSome(),unmergeable:pl(o,e).isSome(),locked:n}})),i=()=>{t.set((e=>{let t,o=!1;return(...l)=>(o||(o=!0,t=e.apply(null,l)),t)})(s)()),l=t.get().bind(c),E(o.get(),h)},m=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(B(o.get(),(t=>t!==e)))}),d=(o,l)=>m((()=>t.get().fold((()=>{o.setEnabled(!1)}),(t=>{o.setEnabled(!l(t)&&e.selection.isEditable())})))),u=(o,l,n)=>m((()=>t.get().fold((()=>{o.setEnabled(!1),o.setActive(!1)}),(t=>{o.setEnabled(!l(t)&&e.selection.isEditable()),o.setActive(n(t))})))),b=e=>l.exists((t=>t.locked[e])),g=(t,o)=>l=>u(l,(e=>n(e.element)),(()=>e.queryCommandValue(t)===o)),y=g("mceTableRowType","header"),S=g("mceTableColType","th");return e.on("NodeChange ExecCommand TableSelectorChange",i),{onSetupTable:e=>d(e,(e=>!1)),onSetupCellOrRow:e=>d(e,(e=>n(e.element))),onSetupColumn:e=>t=>d(t,(t=>n(t.element)||b(e))),onSetupPasteable:e=>t=>d(t,(t=>n(t.element)||e().isNone())),onSetupPasteableColumn:(e,t)=>o=>d(o,(o=>n(o.element)||e().isNone()||b(t))),onSetupMergeable:e=>d(e,(e=>r("mergeable"))),onSetupUnmergeable:e=>d(e,(e=>r("unmergeable"))),resetTargets:i,onSetupTableWithCaption:t=>u(t,f,(t=>tt(t.element,Te(e)).exists((e=>ye(e,"caption").isSome())))),onSetupTableRowHeaders:y,onSetupTableColumnHeaders:S,targets:t.get}};var $l=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const Wl="x-tinymce/dom-table-",zl=Wl+"rows",Ul=Wl+"columns",Gl=e=>{var t;const o=null!==(t=$l.read())&&void 0!==t?t:[];return V(o,(t=>w.from(t.getType(e))))},Kl=()=>Gl(zl),Jl=()=>Gl(Ul),Ql=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}},Xl=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}},Yl=e=>{const t=Vl(e);(e=>{const t=e.options.register;t("table_border_widths",{processor:"object[]",default:xt}),t("table_border_styles",{processor:"object[]",default:At}),t("table_cell_advtab",{processor:"boolean",default:!0}),t("table_row_advtab",{processor:"boolean",default:!0}),t("table_advtab",{processor:"boolean",default:!0}),t("table_appearance_options",{processor:"boolean",default:!0}),t("table_grid",{processor:"boolean",default:!Tt.deviceType.isTouch()}),t("table_cell_class_list",{processor:"object[]",default:[]}),t("table_row_class_list",{processor:"object[]",default:[]}),t("table_class_list",{processor:"object[]",default:[]}),t("table_toolbar",{processor:"string",default:"tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"}),t("table_background_color_map",{processor:"object[]",default:[]}),t("table_border_color_map",{processor:"object[]",default:[]})})(e),ql(e),((e,t)=>{const o=t=>()=>e.execCommand(t),l=(t,l)=>!!e.queryCommandSupported(l.command)&&(e.ui.registry.addMenuItem(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)}),!0),n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleMenuItem(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})},r=t=>{e.execCommand("mceInsertTable",!1,{rows:t.numRows,columns:t.numColumns})},a=[l("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:t.onSetupCellOrRow}),l("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:t.onSetupPasteable(Kl)}),l("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:t.onSetupPasteable(Kl)})],s=[l("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:t.onSetupColumn("onAny")}),l("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:t.onSetupColumn("onAny")}),l("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:t.onSetupPasteableColumn(Jl,"onFirst")}),l("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:t.onSetupPasteableColumn(Jl,"onLast")})],c=[l("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:t.onSetupUnmergeable})];Bt(e)?e.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:r}],onSetup:Xl(e)}):e.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTableDialog"),onSetup:Xl(e)}),e.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTableDialog"),onSetup:Xl(e)}),l("tableprops",{text:"Table properties",onSetup:t.onSetupTable,command:"mceTableProps"}),l("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:t.onSetupTable,command:"mceTableDelete"}),I(a,!0)&&e.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:u("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),I(s,!0)&&e.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:u("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),I(c,!0)&&e.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:u("tablecellprops tablemergecells tablesplitcells")}),e.ui.registry.addContextMenu("table",{update:()=>(t.resetTargets(),t.targets().fold(u(""),(e=>"caption"===J(e.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable")))});const m=Jo(jt(e));0!==m.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>Go(e,m,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const d=Jo(qt(e));0!==d.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>Go(e,d,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>Go(e,No,"tablecellverticalalign",Ko(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>Go(e,Nt(e),"tablecellborderwidth",Ko(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>Go(e,It(e),"tablecellborderstyle",Ko(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>Xo(e,Vt(e),"background-color"),onSetup:t.onSetupCellOrRow}),e.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>Xo(e,$t(e),"border-color"),onSetup:t.onSetupCellOrRow})),n("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:Yo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Zo(e),onSetup:t.onSetupTableRowHeaders})})(e,t),((e,t)=>{e.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",onSetup:Ql(e),fetch:e=>e("inserttable | cell row column | advtablesort | tableprops deletetable")});const o=t=>()=>e.execCommand(t),l=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addButton(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})},n=(t,l)=>{e.queryCommandSupported(l.command)&&e.ui.registry.addToggleButton(t,{...l,onAction:i(l.onAction)?l.onAction:o(l.command)})};l("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:t.onSetupTable}),l("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:t.onSetupTable}),l("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:t.onSetupCellOrRow}),l("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:t.onSetupMergeable}),l("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:t.onSetupUnmergeable}),l("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:t.onSetupCellOrRow}),l("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:t.onSetupCellOrRow}),l("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:t.onSetupCellOrRow}),l("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:t.onSetupCellOrRow}),l("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:t.onSetupColumn("onFirst")}),l("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:t.onSetupColumn("onLast")}),l("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:t.onSetupColumn("onAny")}),l("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:t.onSetupCellOrRow}),l("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:t.onSetupCellOrRow}),l("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:t.onSetupPasteable(Kl)}),l("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:t.onSetupPasteable(Kl)}),l("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:t.onSetupColumn("onAny")}),l("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:t.onSetupColumn("onAny")}),l("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:t.onSetupPasteableColumn(Jl,"onFirst")}),l("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:t.onSetupPasteableColumn(Jl,"onLast")}),l("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table",onSetup:Ql(e)});const r=Jo(jt(e));0!==r.length&&e.queryCommandSupported("mceTableToggleClass")&&e.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:Qo(e,r,"tableclass",(t=>e.execCommand("mceTableToggleClass",!1,t))),onSetup:t.onSetupTable});const a=Jo(qt(e));0!==a.length&&e.queryCommandSupported("mceTableCellToggleClass")&&e.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:Qo(e,a,"tablecellclass",(t=>e.execCommand("mceTableCellToggleClass",!1,t))),onSetup:t.onSetupCellOrRow}),e.queryCommandSupported("mceTableApplyCellStyle")&&(e.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:Qo(e,No,"tablecellverticalalign",Ko(e,"vertical-align")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:Qo(e,Nt(e),"tablecellborderwidth",Ko(e,"border-width")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:Qo(e,It(e),"tablecellborderstyle",Ko(e,"border-style")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:t=>t(Xo(e,Vt(e),"background-color")),onSetup:t.onSetupCellOrRow}),e.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:t=>t(Xo(e,$t(e),"border-color")),onSetup:t.onSetupCellOrRow})),n("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:t.onSetupTableWithCaption}),n("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:Yo(e),onSetup:t.onSetupTableRowHeaders}),n("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Zo(e),onSetup:t.onSetupTableColumnHeaders})})(e,t),(e=>{const t=t=>e.dom.is(t,"table")&&e.getBody().contains(t)&&e.dom.isEditable(t.parentNode),o=Ht(e);o.length>0&&e.ui.registry.addContextToolbar("table",{predicate:t,items:o,scope:"node",position:"node"})})(e)};e.add("table",Yl)}()),e}export{o as __require};
2
2
  //# sourceMappingURL=plugin.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exports as r}from"../../../../_virtual/index22.mjs";import{__require as e}from"./theme.mjs";var t;function i(){return t||(t=1,e()),r}export{i as __require};
1
+ import{__exports as r}from"../../../../_virtual/index18.mjs";import{__require as e}from"./theme.mjs";var t;function i(){return t||(t=1,e()),r}export{i as __require};
2
2
  //# sourceMappingURL=index.mjs.map