@ngxviewbuilder/runtime 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/fesm2022/{ngxviewbuilder-runtime-autocomplete-element-D1-b60Yg.mjs → ngxviewbuilder-runtime-autocomplete-element-DWbMobho.mjs} +1 -1
  2. package/fesm2022/{ngxviewbuilder-runtime-avatar-element-BZGgAqHX.mjs → ngxviewbuilder-runtime-avatar-element-98vFX6ZL.mjs} +1 -1
  3. package/fesm2022/{ngxviewbuilder-runtime-badge-element-DwLNvH9z.mjs → ngxviewbuilder-runtime-badge-element-WdHbUp_X.mjs} +1 -1
  4. package/fesm2022/{ngxviewbuilder-runtime-breadcrumbs-element-lBOlvfwd.mjs → ngxviewbuilder-runtime-breadcrumbs-element-qlHbgWfh.mjs} +1 -1
  5. package/fesm2022/{ngxviewbuilder-runtime-button-element-m24BQTuL.mjs → ngxviewbuilder-runtime-button-element-BWI56rGB.mjs} +1 -1
  6. package/fesm2022/{ngxviewbuilder-runtime-chart-element-BSWuWpXQ.mjs → ngxviewbuilder-runtime-chart-element-wN98hSa2.mjs} +1 -1
  7. package/fesm2022/{ngxviewbuilder-runtime-checkbox-element-CuDort0j.mjs → ngxviewbuilder-runtime-checkbox-element-yAUJgMY7.mjs} +1 -1
  8. package/fesm2022/{ngxviewbuilder-runtime-column-q9jO7OA7.mjs → ngxviewbuilder-runtime-column-CEOo23I_.mjs} +1 -1
  9. package/fesm2022/{ngxviewbuilder-runtime-custom-html-element-B2TQNPbK.mjs → ngxviewbuilder-runtime-custom-html-element-D7ezjkGw.mjs} +1 -1
  10. package/fesm2022/{ngxviewbuilder-runtime-date-range-element-DYtVuNvd.mjs → ngxviewbuilder-runtime-date-range-element-kRoWWvXf.mjs} +1 -1
  11. package/fesm2022/{ngxviewbuilder-runtime-datepicker-element-Dx9ryU_V.mjs → ngxviewbuilder-runtime-datepicker-element-Co2_JHM2.mjs} +1 -1
  12. package/fesm2022/{ngxviewbuilder-runtime-divider-element-D4828e5R.mjs → ngxviewbuilder-runtime-divider-element-Bit-YRpc.mjs} +1 -1
  13. package/fesm2022/{ngxviewbuilder-runtime-element-wrapper-BUzRnWUH.mjs → ngxviewbuilder-runtime-element-wrapper-D0lfZvuW.mjs} +1 -1
  14. package/fesm2022/{ngxviewbuilder-runtime-file-upload-element-Bx_JJxsl.mjs → ngxviewbuilder-runtime-file-upload-element-B1sGgTAJ.mjs} +1 -1
  15. package/fesm2022/{ngxviewbuilder-runtime-icon-element-xkaer6fW.mjs → ngxviewbuilder-runtime-icon-element-BBV3IriU.mjs} +1 -1
  16. package/fesm2022/{ngxviewbuilder-runtime-iframe-element-DG-YEOXe.mjs → ngxviewbuilder-runtime-iframe-element-DAKlSTTJ.mjs} +1 -1
  17. package/fesm2022/{ngxviewbuilder-runtime-image-element-sl9NYRt4.mjs → ngxviewbuilder-runtime-image-element-Co9eNt6D.mjs} +1 -1
  18. package/fesm2022/{ngxviewbuilder-runtime-list-box-element-BslR4TlH.mjs → ngxviewbuilder-runtime-list-box-element-BkqVfq4H.mjs} +1 -1
  19. package/fesm2022/{ngxviewbuilder-runtime-list-grid-element-vbn5afuD.mjs → ngxviewbuilder-runtime-list-grid-element-BsVooLf9.mjs} +1 -1
  20. package/fesm2022/{ngxviewbuilder-runtime-message-card-element-DV1boKqd.mjs → ngxviewbuilder-runtime-message-card-element-DOlB-FAw.mjs} +1 -1
  21. package/fesm2022/{ngxviewbuilder-runtime-multi-select-element-DO_dk2mB.mjs → ngxviewbuilder-runtime-multi-select-element-5YHKOX69.mjs} +1 -1
  22. package/fesm2022/{ngxviewbuilder-runtime-number-element-BZouLH-5.mjs → ngxviewbuilder-runtime-number-element-MNO3T8kR.mjs} +1 -1
  23. package/fesm2022/{ngxviewbuilder-runtime-number-stepper-element-WzMSnzXR.mjs → ngxviewbuilder-runtime-number-stepper-element-Jl6DZNAb.mjs} +1 -1
  24. package/fesm2022/{ngxviewbuilder-runtime-nvb-select-xpsQ0a-_.mjs → ngxviewbuilder-runtime-nvb-select-DuPHFQk6.mjs} +1 -1
  25. package/fesm2022/{ngxviewbuilder-runtime-page-title-element-BgA2xImq.mjs → ngxviewbuilder-runtime-page-title-element-BdfBrnaW.mjs} +1 -1
  26. package/fesm2022/{ngxviewbuilder-runtime-phone-input-element-wJDjqRGH.mjs → ngxviewbuilder-runtime-phone-input-element-BDZkscMD.mjs} +1 -1
  27. package/fesm2022/{ngxviewbuilder-runtime-progress-bar-element-Bdr0kdSH.mjs → ngxviewbuilder-runtime-progress-bar-element-Dg7Y6-jq.mjs} +1 -1
  28. package/fesm2022/{ngxviewbuilder-runtime-radio-element-KF9kHkJV.mjs → ngxviewbuilder-runtime-radio-element-xscwN_Hs.mjs} +1 -1
  29. package/fesm2022/{ngxviewbuilder-runtime-rich-text-element-CGJRHzNG.mjs → ngxviewbuilder-runtime-rich-text-element-DAl3vSxG.mjs} +1 -1
  30. package/fesm2022/{ngxviewbuilder-runtime-router-outlet-element-DcIc0_OQ.mjs → ngxviewbuilder-runtime-router-outlet-element-BpGv-kkh.mjs} +1 -1
  31. package/fesm2022/{ngxviewbuilder-runtime-select-button-element-DM0If-wo.mjs → ngxviewbuilder-runtime-select-button-element-BPH_N-fd.mjs} +1 -1
  32. package/fesm2022/{ngxviewbuilder-runtime-select-element-kOJtgDmJ.mjs → ngxviewbuilder-runtime-select-element-B_FOlIzR.mjs} +1 -1
  33. package/fesm2022/{ngxviewbuilder-runtime-signature-pad-element-BDSkjOm4.mjs → ngxviewbuilder-runtime-signature-pad-element-BxZMh4-H.mjs} +1 -1
  34. package/fesm2022/{ngxviewbuilder-runtime-single-checkbox-element-CCLuAW3g.mjs → ngxviewbuilder-runtime-single-checkbox-element-DZiHDP6i.mjs} +1 -1
  35. package/fesm2022/{ngxviewbuilder-runtime-slider-element-DA0m8geD.mjs → ngxviewbuilder-runtime-slider-element-NBbgW-1w.mjs} +1 -1
  36. package/fesm2022/{ngxviewbuilder-runtime-spacer-element-D4KgGuYS.mjs → ngxviewbuilder-runtime-spacer-element-BGJ-ObOf.mjs} +1 -1
  37. package/fesm2022/{ngxviewbuilder-runtime-stats-card-element-Bwt5GL25.mjs → ngxviewbuilder-runtime-stats-card-element-DUxzXyTC.mjs} +1 -1
  38. package/fesm2022/{ngxviewbuilder-runtime-table-element-C0Pcf-Do.mjs → ngxviewbuilder-runtime-table-element-yvDWlU-z.mjs} +1 -1
  39. package/fesm2022/{ngxviewbuilder-runtime-text-element-CVntVjD5.mjs → ngxviewbuilder-runtime-text-element-C9W3pPu7.mjs} +1 -1
  40. package/fesm2022/{ngxviewbuilder-runtime-textarea-element-DkNUQ3Xk.mjs → ngxviewbuilder-runtime-textarea-element-55rqT93w.mjs} +1 -1
  41. package/fesm2022/{ngxviewbuilder-runtime-time-picker-element-CKVMQjZ2.mjs → ngxviewbuilder-runtime-time-picker-element-C1p0lG_4.mjs} +1 -1
  42. package/fesm2022/{ngxviewbuilder-runtime-toast-element-C5TyVsu-.mjs → ngxviewbuilder-runtime-toast-element-Dc8tFqFS.mjs} +1 -1
  43. package/fesm2022/{ngxviewbuilder-runtime-toggle-switch-element-NcB3kYta.mjs → ngxviewbuilder-runtime-toggle-switch-element-DEmC69ye.mjs} +1 -1
  44. package/fesm2022/{ngxviewbuilder-runtime-video-element-D_5W6_Rh.mjs → ngxviewbuilder-runtime-video-element-COR0eePU.mjs} +1 -1
  45. package/fesm2022/ngxviewbuilder-runtime.mjs +1 -1
  46. package/package.json +1 -1
  47. package/types/ngxviewbuilder-runtime.d.ts +6 -0
@@ -1,2 +1,2 @@
1
- import{t as Wt}from"./ngxviewbuilder-runtime-rolldown-runtime-DpJrqANO.mjs";import{d as Ut,g as Zt,gn as q,n as O,on as qt,sn as Kt,t as vt,y as jt}from"./ngxviewbuilder-runtime-dynamic-text.pipe-BUJ4fCqt.mjs";import{ht as gt,i as Gt,o as mt,pt as Xt,r as Jt,rt as Qt,t as ft}from"./ngxviewbuilder-runtime-element-wrapper-BUzRnWUH.mjs";import{t as xt}from"./ngxviewbuilder-runtime-nvb-select-xpsQ0a-_.mjs";import{t as _t}from"./ngxviewbuilder-runtime-nvb-style-outlet-CVovePT_.mjs";import*as h from"@angular/core";import{ChangeDetectionStrategy as K,ChangeDetectorRef as Yt,Component as j,EventEmitter as y,HostListener as S,Output as C,ViewChild as _,ViewEncapsulation as te,computed as f,effect as G,inject as w,input as v,signal as X}from"@angular/core";const L='"Segoe UI", Tahoma, Geneva, Verdana, sans-serif';const J="#1f2937";const wt="nvb-rt-font-system";const ee="14";const ne="nvb-rt-size-14";const ie="1.6";const H="nvb-rt-color-";const Q="nvb-rt-font-";const B="nvb-rt-size-";const yt="nvb-rt-align-";const z="nvb-rt-leading-";const A="nvb-rt-bg-";const D="nvb-rt-indent-";const Ct="#fff3a3";const re=8;const $="nvb-rt-table";const E="nvb-rt-table-border-";const Tt="nvb-rt-valign-";const Y="nvb-rt-task-list";const tt="nvb-rt-task-item";const St="nvb-rt-task-checked";const oe=26;const ae=120;const le=600;const F={top:"nvb-rt-valign-top",middle:"nvb-rt-valign-middle",bottom:"nvb-rt-valign-bottom"};const se=3;const de=3;const ce=8;const he=10;const Rt=["transparent","#f8fafc","#e2e8f0","#cbd5f5","#bfdbfe","#bbf7d0","#fef08a","#fed7aa","#fecaca","#e9d5ff"];const kt=["#fff3a3","#bbf7d0","#bfdbfe","#fecaca","#e9d5ff","#fed7aa","#d9f99d","#f5d0fe"];const Et=["€","£","¥","¢","©","®","™","°","±","×","÷","≠","≤","≥","≈","∞","µ","Ω","π","∑","√","∫","∂","Δ","¼","½","¾","‰","§","¶","†","‡","←","↑","→","↓","↔","⇒","⇔","•","…","–","—","«","»","“","”","‘","’"," ","✓","✗","★","☆","♥","♪"];const T=new Set(["P","DIV","LI","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]);const Mt=new Set(["STRONG","EM","U","S","MARK","CODE","SUB","SUP","A","SPAN","IMG"]);const et=new Set(["UL","OL","PRE","TABLE","HR","FIGURE"]);const nt={[L]:wt,['"IBM Plex Sans", "Segoe UI", sans-serif']:"nvb-rt-font-ibm-plex-sans",['Georgia, "Times New Roman", serif']:"nvb-rt-font-georgia",['"Courier New", Courier, monospace']:"nvb-rt-font-courier"};const it=["8","9","10","11","12","14","16","18","20","24","28","32","36","48","72"];const rt=Object.fromEntries(it.map(s=>[s,`${B}${s}`]));const It={"nvb-rt-size-small":"12","nvb-rt-size-normal":"14","nvb-rt-size-large":"20","nvb-rt-size-xlarge":"28"};const ot=["1","1.15","1.25","1.5","1.6","1.75","2","2.5","3"];const P={left:"nvb-rt-align-left",center:"nvb-rt-align-center",right:"nvb-rt-align-right",justify:"nvb-rt-align-justify"};const V=Object.fromEntries(ot.map(s=>[s,`${z}${s.replace(".","-")}`]));const Lt={"nvb-rt-leading-tight":"1.25","nvb-rt-leading-normal":"1.6","nvb-rt-leading-relaxed":"2"};const Ht={bold:"strong",italic:"em",underline:"u",strikeThrough:"s"};const At=[{value:"undo",label:"Undo"},{value:"redo",label:"Redo"},{value:"heading",label:"Heading"},{value:"font",label:"Font"},{value:"size",label:"Font size"},{value:"lineHeight",label:"Line spacing"},{value:"inlineCode",label:"Inline code"},{value:"subscript",label:"Subscript"},{value:"superscript",label:"Superscript"},{value:"bold",label:"Bold"},{value:"italic",label:"Italic"},{value:"underline",label:"Underline"},{value:"strikeThrough",label:"Strikethrough"},{value:"orderedList",label:"Ordered list"},{value:"unorderedList",label:"Unordered list"},{value:"taskList",label:"Task list"},{value:"indent",label:"Increase indent"},{value:"outdent",label:"Decrease indent"},{value:"blockquote",label:"Quote"},{value:"horizontalRule",label:"Horizontal rule"},{value:"textColor",label:"Text color"},{value:"highlight",label:"Highlight"},{value:"alignLeft",label:"Align left"},{value:"alignCenter",label:"Align center"},{value:"alignRight",label:"Align right"},{value:"alignJustify",label:"Justify"},{value:"link",label:"Link"},{value:"image",label:"Image"},{value:"video",label:"Video"},{value:"embed",label:"Embed"},{value:"table",label:"Table"},{value:"specialCharacter",label:"Special character"},{value:"findReplace",label:"Find and replace"},{value:"sourceCode",label:"Source code"},{value:"unlink",label:"Remove link"},{value:"clearFormatting",label:"Clear formatting"}];const u={bold:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7 5h7a4 4 0 0 1 0 8H7V5Zm0 10h8a3 3 0 1 1 0 6H7v-6Zm3 2v2h4a1 1 0 1 0 0-2h-4Zm0-10v4h3a2 2 0 1 0 0-4h-3Z\"/></svg>",italic:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 5v2h2.21l-3.42 10H6v2h8v-2h-2.21l3.42-10H18V5h-8Z\"/></svg>",underline:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 3h2v7a4 4 0 1 0 8 0V3h2v7a6 6 0 1 1-12 0V3Zm-1 16h14v2H5v-2Z\"/></svg>",strike:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 11h14v2H5v-2Zm7 8c-3.31 0-6-1.79-6-4h2c0 1.03 1.79 2 4 2s4-.97 4-2-1.79-2-4-2c-3.31 0-6-1.79-6-4s2.69-4 6-4 6 1.79 6 4h-2c0-1.03-1.79-2-4-2s-4 .97-4 2 1.79 2 4 2c3.31 0 6 1.79 6 4s-2.69 4-6 4Z\"/></svg>",textColor:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11 4h2l5 14h-2.13l-1.2-3.5H9.33L8.13 18H6l5-14Zm-1 8.5h4L12 6.6l-2 5.9ZM5 20h14v2H5v-2Z\"/></svg>",alignLeft:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm0 4h10v2H4V9Zm0 4h16v2H4v-2Zm0 4h10v2H4v-2Z\"/></svg>",alignCenter:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm3 4h10v2H7V9Zm-3 4h16v2H4v-2Zm3 4h10v2H7v-2Z\"/></svg>",alignRight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm6 4h10v2H10V9ZM4 13h16v2H4v-2Zm6 4h10v2H10v-2Z\"/></svg>",alignJustify:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm0 4h16v2H4V9Zm0 4h16v2H4v-2Zm0 4h16v2H4v-2Z\"/></svg>",lineSpacing:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 7V4l-3 4 3 4V9h12V7H6Zm12 10H6v-3l-3 4 3 4v-3h12v-2Zm2-9h2V6h-2v2Zm0 5h2v-2h-2v2Zm0 5h2v-2h-2v2Z\"/></svg>",link:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10.59 13.41a1.996 1.996 0 0 1 0-2.82l3-3a2 2 0 1 1 2.82 2.82l-1 1 1.41 1.41 1-1a4 4 0 1 0-5.66-5.66l-3 3a4 4 0 0 0 5.66 5.66l.88-.88-1.41-1.41-.88.88a1.996 1.996 0 0 1-2.82 0ZM6.17 18.24a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-.88.88 1.41 1.41.88-.88a2 2 0 1 1 2.82 2.82l-3 3a2 2 0 0 1-2.82-2.82l1-1-1.41-1.41-1 1a4 4 0 0 0 0 5.66Z\"/></svg>",unlink:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m17 7 2 2-2 2-1.41-1.41L17.17 8H14V6h3Zm-7 11H7a4 4 0 0 1 0-8h3v2H7a2 2 0 0 0 0 4h3v2Zm9.19 3.78 1.41-1.41L4.22 4 2.81 5.41 8 10.6V12H9.4l2 2H7a4 4 0 1 0 0 8h7a3.96 3.96 0 0 0 3.19-1.22ZM17 14h-2v-1.17l2-2V14Zm-3-4h-1.17l-2-2H14a4 4 0 1 1 0 8h-3v-2h3a2 2 0 1 0 0-4Z\"/></svg>",undo:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12.5 8A8.5 8.5 0 0 1 21 16.5h-2A6.5 6.5 0 0 0 8.3 11.54L11 14.25H4V7l2.89 2.89A8.47 8.47 0 0 1 12.5 8Z\"/></svg>",redo:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11.5 8A8.47 8.47 0 0 1 17.11 9.89L20 7v7h-7l2.7-2.46A6.5 6.5 0 0 0 5 16.5H3A8.5 8.5 0 0 1 11.5 8Z\"/></svg>",blockquote:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 7h6v6H7v4H5V7Zm8 0h6v6h-4v4h-2V7Z\"/></svg>",horizontalRule:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 11h16v2H4v-2Z\"/></svg>",inlineCode:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m8.59 16.59-4.58-4.59 4.58-4.59L10 8.82 6.82 12 10 15.18l-1.41 1.41Zm6.82 0L14 15.18 17.18 12 14 8.82l1.41-1.41 4.58 4.59-4.58 4.59ZM13.06 4 9.94 20h-2.03L11.03 4h2.03Z\"/></svg>",subscript:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m5.41 5 4.09 5.16L13.59 5H16l-5.29 6.6L16.3 19H13.8l-4.3-5.46L5.2 19H2.7l5.59-7.4L3 5h2.41Zm12.64 10.6c1.26 0 2.05.62 2.05 1.68 0 .47-.16.88-.48 1.25l-1.29 1.47H20V21h-4.1v-.9l1.94-2.21c.18-.2.26-.38.26-.57 0-.32-.23-.5-.63-.5-.38 0-.73.16-1.05.49l-.79-.9c.47-.54 1.16-.81 2.06-.81Z\"/></svg>",superscript:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m5.41 5 4.09 5.16L13.59 5H16l-5.29 6.6L16.3 19H13.8l-4.3-5.46L5.2 19H2.7l5.59-7.4L3 5h2.41Zm12.64.4c1.26 0 2.05.62 2.05 1.68 0 .47-.16.88-.48 1.25L18.33 9.8H20V11h-4.1v-.9l1.94-2.21c.18-.2.26-.38.26-.57 0-.32-.23-.5-.63-.5-.38 0-.73.16-1.05.49l-.79-.9c.47-.54 1.16-.81 2.06-.81Z\"/></svg>",image:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm0 2v12h14V6H5Zm2 10 3-4 2.5 3 2-2.5L17 16H7Zm2-7.5A1.5 1.5 0 1 1 9 11a1.5 1.5 0 0 1 0-3Z\"/></svg>",video:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h11a2 2 0 0 1 2 2v2.4l4-2.4v10l-4-2.4V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Zm0 2v10h11V7H4Z\"/></svg>",embed:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm0 2v3h16V5H4Zm0 5v9h16v-9H4Zm4.4 2.2 1.3 1.3L8.1 15l1.6 1.5-1.3 1.3L5.5 15l2.9-2.8Zm7.2 0L18.5 15l-2.9 2.8-1.3-1.3L15.9 15l-1.6-1.5 1.3-1.3Z\"/></svg>",highlight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 19h16v3H4v-3Zm3.9-4.3 7.8-7.8 2.4 2.4-7.8 7.8H7.9v-2.4Zm9.2-9.2 1.4-1.4a1 1 0 0 1 1.4 0l1 1a1 1 0 0 1 0 1.4l-1.4 1.4-2.4-2.4ZM5.5 13.1h2.4v2.4l-2.4 2.4v-4.8Z\"/></svg>",indent:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 3h18v2H3V3Zm8 4h10v2H11V7Zm0 4h10v2H11v-2Zm0 4h10v2H11v-2ZM3 19h18v2H3v-2ZM3 8l4 4-4 4V8Z\"/></svg>",outdent:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 3h18v2H3V3Zm8 4h10v2H11V7Zm0 4h10v2H11v-2Zm0 4h10v2H11v-2ZM3 19h18v2H3v-2ZM7 8v8l-4-4 4-4Z\"/></svg>",taskList:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11 5h10v2H11V5Zm0 6h10v2H11v-2Zm0 6h10v2H11v-2ZM4.5 8.6 2.3 6.4l1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Zm0 6L2.3 12.4l1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Zm0 6-2.2-2.2 1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Z\"/></svg>",specialCharacter:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 3a7 7 0 0 1 5.1 11.8c-1 1.1-1.6 2-1.8 2.7h3.9V21H13v-2.8c0-1.6.7-3 2.1-4.5A5 5 0 1 0 6.9 13.7C8.3 15.2 9 16.6 9 18.2V21H4.8v-3.5h3.9c-.2-.7-.8-1.6-1.8-2.7A7 7 0 0 1 12 3Z\"/></svg>",findReplace:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 3a7 7 0 0 1 5.5 11.3l5.1 5.1-1.4 1.4-5.1-5.1A7 7 0 1 1 10 3Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm-1 2.2h2v2.3h2.3v2H11v2.3H9v-2.3H6.7v-2H9V7.2Z\"/></svg>",sourceCode:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M8.6 16.6 4 12l4.6-4.6L10 8.8 6.8 12 10 15.2l-1.4 1.4Zm6.8 0L14 15.2 17.2 12 14 8.8l1.4-1.4L20 12l-4.6 4.6Z\"/></svg>",table:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm1 2v3h4V5H5Zm6 0v3h3V5h-3Zm5 0v3h3V5h-3ZM5 10v3h4v-3H5Zm6 0v3h3v-3h-3Zm5 0v3h3v-3h-3ZM5 15v4h4v-4H5Zm6 0v4h3v-4h-3Zm5 0v4h3v-4h-3Z\"/></svg>",tableRowAbove:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 14h18v6H3v-6Zm8-12h2v3h3v2h-3v3h-2V7H8V5h3V2Z\"/></svg>",tableRowBelow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 4h18v6H3V4Zm8 8h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z\"/></svg>",tableColumnLeft:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M14 3h6v18h-6V3ZM5 11V8h2v3h3v2H7v3H5v-3H2v-2h3Z\"/></svg>",tableColumnRight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h6v18H4V3Zm13 8V8h2v3h3v2h-3v3h-2v-3h-3v-2h3Z\"/></svg>",tableDeleteRow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 4h18v5H3V4Zm0 11h18v5H3v-5Zm5-4h8v2H8v-2Z\"/></svg>",tableDeleteColumn:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h5v18H4V3Zm11 0h5v18h-5V3Zm-4.5 8h4v2h-4v-2Z\"/></svg>",tableMergeCells:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h14V6H5Zm2.5 5h3.2L9.3 9.6l1.4-1.4L14.5 12l-3.8 3.8-1.4-1.4L10.7 13H7.5v-2Z\"/></svg>",tableSplitCell:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h14V6H5Zm6 1h2v10h-2V7Z\"/></svg>",tableHeaderRow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v3h14V6H5Zm0 5v7h14v-7H5Z\"/></svg>",tableHeaderColumn:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h4V6H5Zm6 0v12h8V6h-8Z\"/></svg>",tableCellBackground:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M16.6 12.6 7.4 3.4 6 4.8l2 2-4.6 4.6a1 1 0 0 0 0 1.4l6.4 6.4a1 1 0 0 0 1.4 0l5.4-5.4a1 1 0 0 0 0-1.2ZM6.6 12.8 10.4 9l3.8 3.8H6.6ZM19 14s-2 2.2-2 3.5a2 2 0 1 0 4 0c0-1.3-2-3.5-2-3.5Z\"/></svg>",tableDelete:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a1 1 0 0 1 1 1v7h-2V9h-5v2h-2V9H9v3h3v2H9v5h3v2H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm1 2v2h2V5H5Zm4 0v2h4V5H9Zm6 0v2h4V5h-4ZM5 9v3h2V9H5Zm0 5v5h2v-5H5Zm11.2 1.4 2.1-2.1 1.4 1.4-2.1 2.1 2.1 2.1-1.4 1.4-2.1-2.1-2.1 2.1-1.4-1.4 2.1-2.1-2.1-2.1 1.4-1.4 2.1 2.1Z\"/></svg>"};const Pt=["undo","redo","heading","size","bold","italic","underline","strikeThrough","textColor","orderedList","unorderedList","alignLeft","alignCenter","alignRight","link","unlink","image","clearFormatting"];const ue=new Set(["TD","TH"]);function Nt(){const s=document.createElement("p");s.setAttribute("dir","ltr");s.appendChild(document.createElement("br"));return s}function M(s="td"){const t=document.createElement(s);t.appendChild(Nt());return t}function W(s){if(Array.from(s.children).some(e=>["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(e.tagName.toUpperCase())))return;if(!s.childNodes.length){s.appendChild(Nt());return}const t=document.createElement("p");t.setAttribute("dir","ltr");while(s.firstChild)t.appendChild(s.firstChild);s.appendChild(t)}function be(s,t,e){const n=Math.max(1,Math.min(50,Math.round(s)));const i=Math.max(1,Math.min(20,Math.round(t)));const r=document.createElement("table");r.classList.add($,`${E}all`);const o=document.createElement("colgroup");const a=`${(100/i).toFixed(4)}%`;for(let d=0;d<i;d+=1){const c=document.createElement("col");c.style.width=a;o.appendChild(c)}r.appendChild(o);const l=document.createElement("tbody");for(let d=0;d<n;d+=1){const c=document.createElement("tr");const b=e&&d===0?"th":"td";for(let p=0;p<i;p+=1)c.appendChild(M(b));l.appendChild(c)}r.appendChild(l);return r}function Ot(s,t){let e=s;while(e&&e!==t){if(e instanceof HTMLTableCellElement)return e;e=e.parentNode}return null}function U(s,t){let e=s;while(e&&e!==t){if(e instanceof HTMLTableElement)return e;e=e.parentNode}return null}function N(s){return Array.from(s.querySelectorAll("tr")).filter(t=>U(t.parentNode,null)===s)}function m(s){const t=N(s);const e=t.map(()=>[]);t.forEach((i,r)=>{let o=0;Array.from(i.children).forEach(a=>{if(!(a instanceof HTMLTableCellElement)||!ue.has(a.tagName.toUpperCase()))return;while(e[r][o])o+=1;const l=Math.max(1,a.rowSpan||1);const d=Math.max(1,a.colSpan||1);for(let c=0;c<l;c+=1){const b=r+c;if(!e[b])continue;for(let p=0;p<d;p+=1)e[b][o+p]={cell:a,row:r,column:o,rowSpan:l,columnSpan:d,isAnchor:c===0&&p===0}}o+=d})});const n=e.reduce((i,r)=>Math.max(i,r.length),0);e.forEach(i=>{i.length=n});return e}function R(s,t){for(const e of s)for(const n of e)if(n?.cell===t&&n.isAnchor)return n;return null}function k(s){return s.reduce((t,e)=>Math.max(t,e.length),0)}function at(s,t){let e=s.querySelector("colgroup");if(!e){if(t<=0)return null;e=document.createElement("colgroup");s.insertBefore(e,s.firstChild)}const n=Array.from(e.children);for(let i=n.length;i<t;i+=1)e.appendChild(document.createElement("col"));for(let i=n.length-1;i>=t;i-=1)n[i].remove();return e}function lt(s){const t=k(m(s));const e=at(s,t);if(!e||t<=0)return;const n=Array.from(e.children);const i=100/t;const r=n.map(a=>{const l=parseFloat(a.style.width);return Number.isFinite(l)&&l>0?l:i});const o=r.reduce((a,l)=>a+l,0)||100;n.forEach((a,l)=>{a.style.width=`${(r[l]/o*100).toFixed(4)}%`})}function pe(s,t){const e=s.querySelector("colgroup");if(!e)return;const n=Array.from(e.children);const i=document.createElement("col");const r=n[t]??null;e.insertBefore(i,r)}function ve(s,t,e){const n=s.querySelector("colgroup");if(!n)return;Array.from(n.children).slice(t,t+Math.max(1,e)).forEach(i=>i.remove())}function ge(s){const t=k(m(s));const e=at(s,t);if(!e)return[];return Array.from(e.children).map(n=>parseFloat(n.style.width)||100/Math.max(t,1))}function me(s,t){const e=at(s,t.length);if(!e)return;Array.from(e.children).forEach((n,i)=>{n.style.width=`${Math.max(3,t[i]??0).toFixed(4)}%`})}function fe(s,t){const e=M(s.tagName.toUpperCase()==="TH"?"th":"td");e.rowSpan=Math.max(1,s.rowSpan||1);if(t)s.parentNode?.insertBefore(e,s);else s.parentNode?.insertBefore(e,s.nextSibling);return e}function xe(s,t,e){const n=m(s);const i=R(n,t);if(!i)return null;const r=e==="left"?i.column:i.column+i.columnSpan-1;const o=new Set;const a=[];n.forEach(l=>{const d=l[r];if(!d||o.has(d.cell))return;o.add(d.cell);if(e==="left"?d.column===r:d.column+d.columnSpan-1===r){a.push(fe(d.cell,e==="left"));return}d.cell.colSpan=Math.max(1,d.cell.colSpan||1)+1});pe(s,e==="left"?r:r+1);lt(s);return a[0]??null}function _e(s,t){const e=m(s);const n=R(e,t);const i=k(e);if(!n||i<=n.columnSpan)return null;const r=new Set;for(let l=n.column;l<n.column+n.columnSpan;l+=1)e.forEach(d=>{const c=d[l];if(!c||r.has(c.cell))return;r.add(c.cell);if((c.cell.colSpan||1)>1){c.cell.colSpan=Math.max(1,(c.cell.colSpan||1)-n.columnSpan);return}c.cell.remove()});ve(s,n.column,n.columnSpan);lt(s);const o=m(s);const a=Math.min(n.column,k(o)-1);return o[n.row]?.[Math.max(0,a)]?.cell??null}function we(s,t,e){const n=m(s);const i=R(n,t);const r=N(s);if(!i||r.length===0)return null;const o=e==="above"?i.row:i.row+i.rowSpan-1;const a=n[o]??[];const l=k(n);const d=document.createElement("tr");const c=new Set;let b=0;while(b<l){const g=a[b];if(!g){d.appendChild(M("td"));b+=1;continue}if(e==="above"?g.row<o:g.row+g.rowSpan-1>o){if(!c.has(g.cell)){c.add(g.cell);g.cell.rowSpan=Math.max(1,g.cell.rowSpan||1)+1}}else{const x=M(g.cell.tagName.toUpperCase()==="TH"&&e==="above"?"th":"td");x.colSpan=g.columnSpan;d.appendChild(x)}b+=g.columnSpan}const p=r[o];if(!p?.parentNode)return null;if(e==="above")p.parentNode.insertBefore(d,p);else p.parentNode.insertBefore(d,p.nextSibling);return d.querySelector("td, th")??null}function ye(s,t){const e=R(m(s),t);const n=N(s);if(!e||n.length<=e.rowSpan)return null;for(let o=e.rowSpan-1;o>=0;o-=1){const a=e.row+o;const l=m(s);const d=N(s);const c=d[a];if(!c)continue;const b=new Set;(l[a]??[]).forEach((p,g)=>{if(!p||b.has(p.cell))return;b.add(p.cell);if(p.row<a){p.cell.rowSpan=Math.max(1,(p.cell.rowSpan||1)-1);return}if((p.cell.rowSpan||1)>1){const x=d[a+1];if(x){p.cell.rowSpan=Math.max(1,(p.cell.rowSpan||1)-1);const I=(l[a+1]??[]).slice(g+p.columnSpan).find(pt=>pt&&pt.row===a+1);if(I)x.insertBefore(p.cell,I.cell);else x.appendChild(p.cell)}}});c.remove()}const i=m(s);const r=Math.min(e.row,i.length-1);return i[Math.max(0,r)]?.[e.column]?.cell??null}function Bt(s,t,e){return Boolean(zt(s,t,e))}function zt(s,t,e){const n=m(s);const i=R(n,t);if(!i)return null;if(e==="right"){const o=n[i.row]?.[i.column+i.columnSpan];if(!o||o.row!==i.row||o.rowSpan!==i.rowSpan)return null;return o}const r=n[i.row+i.rowSpan]?.[i.column];if(!r||r.column!==i.column||r.columnSpan!==i.columnSpan)return null;return r}function Ce(s,t,e){const n=zt(s,t,e);if(!n)return false;const i=n.cell;if(!!String(i.textContent??"").trim())Array.from(i.childNodes).forEach(o=>t.appendChild(o));if(e==="right")t.colSpan=Math.max(1,t.colSpan||1)+Math.max(1,i.colSpan||1);else t.rowSpan=Math.max(1,t.rowSpan||1)+Math.max(1,i.rowSpan||1);const r=i.parentElement;i.remove();if(r&&!r.querySelector("td, th"))r.remove();W(t);return true}function st(s,t){return t==="horizontal"?Math.max(1,s.colSpan||1)>1:Math.max(1,s.rowSpan||1)>1}function Te(s,t,e){if(!st(t,e))return false;const n=t.tagName.toUpperCase()==="TH"?"th":"td";if(e==="horizontal"){const l=Math.max(1,t.colSpan||1);t.colSpan=1;let d=t;for(let c=1;c<l;c+=1){const b=M(n);b.rowSpan=Math.max(1,t.rowSpan||1);d.parentNode?.insertBefore(b,d.nextSibling);d=b}return true}const i=m(s);const r=R(i,t);const o=N(s);if(!r)return false;const a=Math.max(1,t.rowSpan||1);t.rowSpan=1;for(let l=1;l<a;l+=1){const d=o[r.row+l];if(!d)continue;const c=M(n);c.colSpan=r.columnSpan;const b=(i[r.row+l]??[]).slice(r.column+r.columnSpan).find(p=>p&&p.row===r.row+l);if(b)d.insertBefore(c,b.cell);else d.appendChild(c)}return true}function Dt(s,t){if(s.tagName.toLowerCase()===t)return s;const e=document.createElement(t);Array.from(s.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});while(s.firstChild)e.appendChild(s.firstChild);s.replaceWith(e);return e}function $t(s){const t=(m(s)[0]??[]).filter(Boolean);return t.length>0&&t.every(e=>e.cell.tagName.toUpperCase()==="TH")}function Ft(s){const t=m(s).map(e=>e[0]).filter(Boolean);return t.length>0&&t.every(e=>e.cell.tagName.toUpperCase()==="TH")}function Se(s){const t=!$t(s);const e=m(s);const n=new Set;(e[0]??[]).forEach(i=>{if(!i||n.has(i.cell))return;n.add(i.cell);Dt(i.cell,t?"th":"td")})}function Re(s){const t=!Ft(s);const e=m(s);const n=new Set;e.forEach(i=>{const r=i[0];if(!r||n.has(r.cell))return;n.add(r.cell);Dt(r.cell,t?"th":"td")})}function ke(s){const t=Array.from(s.classList).find(e=>e.startsWith(E))?.slice(20);return t==="none"||t==="outer"?t:"all"}function Ee(s,t){Array.from(s.classList).filter(e=>e.startsWith(E)).forEach(e=>s.classList.remove(e));s.classList.add($,`${E}${t}`)}function Me(s,t){Array.from(s.classList).filter(e=>e.startsWith(Tt)).forEach(e=>s.classList.remove(e));if(t!=="top")s.classList.add(F[t])}function Ie(s){if(s.classList.contains(F.middle))return"middle";if(s.classList.contains(F.bottom))return"bottom";return"top"}function Le(s,t){const e=String(t??"").trim();if(!e||e==="transparent"){s.style.removeProperty("background-color");if(!s.getAttribute("style")?.trim())s.removeAttribute("style");return}s.style.backgroundColor=e}function Vt(s){s.classList.add($);if(!Array.from(s.classList).some(t=>t.startsWith("nvb-rt-table-border-")))s.classList.add(`${E}all`);s.removeAttribute("border");s.removeAttribute("cellpadding");s.removeAttribute("cellspacing");s.querySelectorAll("td, th").forEach(t=>{W(t)});lt(s)}const He=new Set(["a","b","blockquote","br","caption","code","col","colgroup","div","em","font","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","s","small","span","strike","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]);const Ae=new Set(["background-color","color","font-style","font-weight","text-align","text-decoration","vertical-align","width"]);var dt=class ht{linkMarkerAttribute="data-nvb-rich-text-link-marker";html=v("",...ngDevMode?[{debugName:"html"}]:[]);htmlCss=v("",...ngDevMode?[{debugName:"htmlCss"}]:[]);readOnly=v(false,...ngDevMode?[{debugName:"readOnly"}]:[]);showToolbar=v(true,...ngDevMode?[{debugName:"showToolbar"}]:[]);emitOnInput=v(true,...ngDevMode?[{debugName:"emitOnInput"}]:[]);placeholder=v("Write content...",...ngDevMode?[{debugName:"placeholder"}]:[]);minimalViewer=v(false,...ngDevMode?[{debugName:"minimalViewer"}]:[]);showWordCount=v(false,...ngDevMode?[{debugName:"showWordCount"}]:[]);enabledTools=v(null,...ngDevMode?[{debugName:"enabledTools"}]:[]);testId=v("",...ngDevMode?[{debugName:"testId"}]:[]);tid(t,...e){const n=e.map(i=>Gt(i)).filter(Boolean);return[this.testId()||"nvb-rich-text",t,...n].join("-")}isToolEnabled(t){const e=this.enabledTools();if(!Array.isArray(e))return true;return e.includes(t)}hasAnyTool(...t){return t.some(e=>this.isToolEnabled(e))}hasAnyToolbarTool(){return At.some(t=>this.isToolEnabled(t.value))}htmlChange=new y;htmlCssChange=new y;editorFocus=new y;editorBlur=new y;rootRef;editableRef;toolbarRef;imageInputRef;linkPopupRef;linkButtonRef;linkUrlInputRef;mediaUrlInputRef;findInputRef;sourceTextareaRef;headingOptions=[{value:"P",key:"richText.headingParagraph",fallback:"P"},{value:"H1",key:"richText.headingH1",fallback:"H1"},{value:"H2",key:"richText.headingH2",fallback:"H2"},{value:"H3",key:"richText.headingH3",fallback:"H3"},{value:"H4",key:"richText.headingH4",fallback:"H4"}];fontOptions=[{value:L,key:"richText.fontSystem",fallback:"System UI"},{value:'"IBM Plex Sans", "Segoe UI", sans-serif',key:"richText.fontIbmPlexSans",fallback:"IBM Plex Sans"},{value:'Georgia, "Times New Roman", serif',key:"richText.fontGeorgia",fallback:"Georgia"},{value:'"Courier New", Courier, monospace',key:"richText.fontCourier",fallback:"Courier New"}];sizeOptions=it.map(t=>({value:t,label:t}));lineHeightOptions=ot.map(t=>({value:t,label:t}));heading="P";font=L;size="14";lineHeight="1.6";textColor=J;isBold=false;isItalic=false;isUnderline=false;isStrike=false;isInlineCode=false;isSubscript=false;isSuperscript=false;isBlockquote=false;align="left";selectedMediaNode=null;mediaOverlayTop=0;mediaOverlayLeft=0;mediaOverlayWidth=0;mediaOverlayBottom=0;mediaSizePercent=35;mediaResizeHandleLeft=0;mediaResizeHandleTop=0;showLinkPopup=false;linkUrl="";linkPopupTop=0;linkPopupLeft=0;highlightColor=Ct;isHighlighted=false;indentLevel=0;isTaskList=false;highlightSwatches=kt;tableCellBackgroundSwatches=Rt;specialCharacters=Et;tablePickerRowRange=Array.from({length:8},(t,e)=>e);tablePickerColumnRange=Array.from({length:10},(t,e)=>e);showHighlightPopup=false;showTablePicker=false;showSpecialCharacterPopup=false;showFindPopup=false;showMediaPopup=false;showTableCellColorPopup=false;popupTop=0;popupLeft=0;tablePickerRows=0;tablePickerColumns=0;tablePickerWithHeader=true;mediaKind="image";mediaSource="upload";mediaUrl="";mediaAlt="";findQuery="";replaceValue="";findMatchCase=false;findStatus="";isSourceMode=false;sourceDraft="";wordCount=X(0,...ngDevMode?[{debugName:"wordCount"}]:[]);characterCount=X(0,...ngDevMode?[{debugName:"characterCount"}]:[]);activeTable=null;activeTableCell=null;tableOverlayTop=0;tableOverlayLeft=0;tableBorder="all";tableCellVerticalAlign="top";hasTableHeaderRow=false;hasTableHeaderColumn=false;canMergeRight=false;canMergeDown=false;canSplitHorizontally=false;canSplitVertically=false;tableColumnHandles=[];boldIconSvg=u.bold;italicIconSvg=u.italic;underlineIconSvg=u.underline;strikeIconSvg=u.strike;textColorIconSvg=u.textColor;alignLeftIconSvg=u.alignLeft;alignCenterIconSvg=u.alignCenter;alignRightIconSvg=u.alignRight;alignJustifyIconSvg=u.alignJustify;lineSpacingIconSvg=u.lineSpacing;linkIconSvg=u.link;unlinkIconSvg=u.unlink;blockquoteIconSvg=u.blockquote;horizontalRuleIconSvg=u.horizontalRule;inlineCodeIconSvg=u.inlineCode;subscriptIconSvg=u.subscript;superscriptIconSvg=u.superscript;imageIconSvg=u.image;videoIconSvg=u.video;embedIconSvg=u.embed;highlightIconSvg=u.highlight;indentIconSvg=u.indent;outdentIconSvg=u.outdent;taskListIconSvg=u.taskList;specialCharacterIconSvg=u.specialCharacter;findReplaceIconSvg=u.findReplace;sourceCodeIconSvg=u.sourceCode;tableIconSvg=u.table;tableRowAboveIconSvg=u.tableRowAbove;tableRowBelowIconSvg=u.tableRowBelow;tableColumnLeftIconSvg=u.tableColumnLeft;tableColumnRightIconSvg=u.tableColumnRight;tableDeleteRowIconSvg=u.tableDeleteRow;tableDeleteColumnIconSvg=u.tableDeleteColumn;tableMergeCellsIconSvg=u.tableMergeCells;tableSplitCellIconSvg=u.tableSplitCell;tableHeaderRowIconSvg=u.tableHeaderRow;tableHeaderColumnIconSvg=u.tableHeaderColumn;tableCellBackgroundIconSvg=u.tableCellBackground;tableDeleteIconSvg=u.tableDelete;undoIconSvg=u.undo;redoIconSvg=u.redo;savedRange=null;linkSelectionRange=null;skipFocusSelectionSync=false;hasViewInitialized=false;colorClassMap=new Map;uiTranslationService=w(Kt);markupSecurityService=w(gt);isMediaResizeDragging=false;mediaResizeStartX=0;mediaResizeStartPercent=35;draggingMediaNode=null;pendingMediaDropRange=null;showMediaDropCaret=false;mediaDropCaretLeft=0;mediaDropCaretTop=0;mediaDropCaretHeight=0;highlightClassMap=new Map;historyStack=[];historyIndex=-1;historyTimer=null;isRestoringHistory=false;lastHistoryStamp=0;isTableColumnResizing=false;tableResizeColumnIndex=-1;tableResizeStartX=0;tableResizeStartWidths=[];tableResizeTableWidth=1;findMatchIndex=-1;constructor(){G(()=>{this.readOnly();queueMicrotask(()=>{this.applyReadonlyState()})});G(()=>{const t=this.html();if(!this.hasViewInitialized)return;queueMicrotask(()=>{this.syncIncomingHtml(t)})});G(()=>{const t=this.htmlCss();if(!this.hasViewInitialized)return;queueMicrotask(()=>{this.syncIncomingCss(t)})})}ngAfterViewInit(){this.hasViewInitialized=true;this.syncIncomingCss(this.htmlCss());this.syncIncomingHtml(this.html());this.applyReadonlyState();this.resetHistory();this.updateCounts();queueMicrotask(()=>{this.captureSelection();this.refreshToolbarState()})}ngOnDestroy(){this.removeLinkSelectionMarkers();this.clearHistoryTimer()}onToolbarControlMouseDown(t){if(this.readOnly())return;t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow();this.persistLinkSelectionMarkers()}onEditorFocus(){if(this.readOnly()||this.skipFocusSelectionSync)return;this.captureSelection();this.refreshToolbarState();this.editorFocus.emit()}onEditorInput(){if(this.readOnly())return;this.normalizeEditorRootBlocks();this.enforceLtrContext();this.syncSelectedMediaState();this.syncActiveTableState();this.captureSelection();this.refreshToolbarState();this.scheduleHistorySnapshot();if(this.emitOnInput())this.emitCurrentHtml()}onEditorClick(t){const e=t.target;const n=e?.closest?.("a");if(this.toggleTaskItemFromClick(t))return;if(this.readOnly()){this.clearSelectedMedia();if(!n?.href)return;t.preventDefault();t.stopPropagation();window.open(n.href,"_blank","noopener,noreferrer");return}const i=this.findSelectableMediaNode(e);if(i){t.preventDefault();t.stopPropagation();this.selectMediaNode(i);return}if(!n?.href){this.clearSelectedMedia();return}t.preventDefault();t.stopPropagation();window.open(n.href,"_blank","noopener,noreferrer")}onEditorBlur(){if(this.showLinkPopup||this.readOnly())return;const t=this.getCleanHtml();this.editorBlur.emit(t)}onEditorCursorChange(){if(this.readOnly())return;if(!this.selectedMediaNode)this.clearSelectedMedia();this.captureSelection();this.refreshToolbarState();this.syncActiveTableState()}onEditorScroll(){this.syncSelectedMediaState();this.syncActiveTableState()}onEditorDragStart(t){if(this.readOnly())return;const e=t.target;const n=this.findSelectableMediaNode(e);const i=this.editableRef?.nativeElement;if(!n||!i?.contains(n))return;this.selectMediaNode(n);this.draggingMediaNode=n;n.classList.add("nvb-rt-media-dragging");if(t.dataTransfer){t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/plain","nvb-rich-text-media");try{t.dataTransfer.setDragImage(n,Math.min(Math.max(n.clientWidth/2,16),60),Math.min(Math.max(n.clientHeight/2,16),60))}catch{}}}onEditorDragOver(t){this.handleMediaDragOver(t)}onEditorDrop(t){this.handleMediaDrop(t)}onEditorDragEnd(){this.draggingMediaNode?.classList.remove("nvb-rt-media-dragging");this.draggingMediaNode=null;this.pendingMediaDropRange=null;this.clearMediaDropCaret()}onEditorKeyDown(t){if(this.readOnly()){t.preventDefault();return}if((t.ctrlKey||t.metaKey)&&!t.altKey){const e=t.key.toLowerCase();if(e==="z"&&!t.shiftKey){t.preventDefault();this.undo();return}if(e==="y"||e==="z"&&t.shiftKey){t.preventDefault();this.redo();return}if(e==="f"){t.preventDefault();this.openFindPopup();return}}if(t.key==="Tab"){if(this.moveToAdjacentTableCell(t.shiftKey)){t.preventDefault();return}t.preventDefault();if(t.shiftKey)this.outdent();else this.indent();return}if(t.key==="Enter"){const e=this.resolveWorkingRange();const n=e?this.findClosestPre(e.startContainer):null;if(e&&n){t.preventDefault();const i=this.resolveCodeContentElement(n);if(t.ctrlKey||t.metaKey){this.exitCodeBlock(n);return}const r=String(i.textContent??"");const o=this.codeTextOffset(i,e.startContainer,e.startOffset);const a=this.codeTextOffset(i,e.endContainer,e.endOffset);this.runWithRange(()=>{i.textContent=`${r.slice(0,o)}
1
+ import{t as Wt}from"./ngxviewbuilder-runtime-rolldown-runtime-DpJrqANO.mjs";import{d as Ut,g as Zt,gn as q,n as O,on as qt,sn as Kt,t as vt,y as jt}from"./ngxviewbuilder-runtime-dynamic-text.pipe-BUJ4fCqt.mjs";import{ht as gt,i as Gt,o as mt,pt as Xt,r as Jt,rt as Qt,t as ft}from"./ngxviewbuilder-runtime-element-wrapper-D0lfZvuW.mjs";import{t as xt}from"./ngxviewbuilder-runtime-nvb-select-DuPHFQk6.mjs";import{t as _t}from"./ngxviewbuilder-runtime-nvb-style-outlet-CVovePT_.mjs";import*as h from"@angular/core";import{ChangeDetectionStrategy as K,ChangeDetectorRef as Yt,Component as j,EventEmitter as y,HostListener as S,Output as C,ViewChild as _,ViewEncapsulation as te,computed as f,effect as G,inject as w,input as v,signal as X}from"@angular/core";const L='"Segoe UI", Tahoma, Geneva, Verdana, sans-serif';const J="#1f2937";const wt="nvb-rt-font-system";const ee="14";const ne="nvb-rt-size-14";const ie="1.6";const H="nvb-rt-color-";const Q="nvb-rt-font-";const B="nvb-rt-size-";const yt="nvb-rt-align-";const z="nvb-rt-leading-";const A="nvb-rt-bg-";const D="nvb-rt-indent-";const Ct="#fff3a3";const re=8;const $="nvb-rt-table";const E="nvb-rt-table-border-";const Tt="nvb-rt-valign-";const Y="nvb-rt-task-list";const tt="nvb-rt-task-item";const St="nvb-rt-task-checked";const oe=26;const ae=120;const le=600;const F={top:"nvb-rt-valign-top",middle:"nvb-rt-valign-middle",bottom:"nvb-rt-valign-bottom"};const se=3;const de=3;const ce=8;const he=10;const Rt=["transparent","#f8fafc","#e2e8f0","#cbd5f5","#bfdbfe","#bbf7d0","#fef08a","#fed7aa","#fecaca","#e9d5ff"];const kt=["#fff3a3","#bbf7d0","#bfdbfe","#fecaca","#e9d5ff","#fed7aa","#d9f99d","#f5d0fe"];const Et=["€","£","¥","¢","©","®","™","°","±","×","÷","≠","≤","≥","≈","∞","µ","Ω","π","∑","√","∫","∂","Δ","¼","½","¾","‰","§","¶","†","‡","←","↑","→","↓","↔","⇒","⇔","•","…","–","—","«","»","“","”","‘","’"," ","✓","✗","★","☆","♥","♪"];const T=new Set(["P","DIV","LI","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]);const Mt=new Set(["STRONG","EM","U","S","MARK","CODE","SUB","SUP","A","SPAN","IMG"]);const et=new Set(["UL","OL","PRE","TABLE","HR","FIGURE"]);const nt={[L]:wt,['"IBM Plex Sans", "Segoe UI", sans-serif']:"nvb-rt-font-ibm-plex-sans",['Georgia, "Times New Roman", serif']:"nvb-rt-font-georgia",['"Courier New", Courier, monospace']:"nvb-rt-font-courier"};const it=["8","9","10","11","12","14","16","18","20","24","28","32","36","48","72"];const rt=Object.fromEntries(it.map(s=>[s,`${B}${s}`]));const It={"nvb-rt-size-small":"12","nvb-rt-size-normal":"14","nvb-rt-size-large":"20","nvb-rt-size-xlarge":"28"};const ot=["1","1.15","1.25","1.5","1.6","1.75","2","2.5","3"];const P={left:"nvb-rt-align-left",center:"nvb-rt-align-center",right:"nvb-rt-align-right",justify:"nvb-rt-align-justify"};const V=Object.fromEntries(ot.map(s=>[s,`${z}${s.replace(".","-")}`]));const Lt={"nvb-rt-leading-tight":"1.25","nvb-rt-leading-normal":"1.6","nvb-rt-leading-relaxed":"2"};const Ht={bold:"strong",italic:"em",underline:"u",strikeThrough:"s"};const At=[{value:"undo",label:"Undo"},{value:"redo",label:"Redo"},{value:"heading",label:"Heading"},{value:"font",label:"Font"},{value:"size",label:"Font size"},{value:"lineHeight",label:"Line spacing"},{value:"inlineCode",label:"Inline code"},{value:"subscript",label:"Subscript"},{value:"superscript",label:"Superscript"},{value:"bold",label:"Bold"},{value:"italic",label:"Italic"},{value:"underline",label:"Underline"},{value:"strikeThrough",label:"Strikethrough"},{value:"orderedList",label:"Ordered list"},{value:"unorderedList",label:"Unordered list"},{value:"taskList",label:"Task list"},{value:"indent",label:"Increase indent"},{value:"outdent",label:"Decrease indent"},{value:"blockquote",label:"Quote"},{value:"horizontalRule",label:"Horizontal rule"},{value:"textColor",label:"Text color"},{value:"highlight",label:"Highlight"},{value:"alignLeft",label:"Align left"},{value:"alignCenter",label:"Align center"},{value:"alignRight",label:"Align right"},{value:"alignJustify",label:"Justify"},{value:"link",label:"Link"},{value:"image",label:"Image"},{value:"video",label:"Video"},{value:"embed",label:"Embed"},{value:"table",label:"Table"},{value:"specialCharacter",label:"Special character"},{value:"findReplace",label:"Find and replace"},{value:"sourceCode",label:"Source code"},{value:"unlink",label:"Remove link"},{value:"clearFormatting",label:"Clear formatting"}];const u={bold:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7 5h7a4 4 0 0 1 0 8H7V5Zm0 10h8a3 3 0 1 1 0 6H7v-6Zm3 2v2h4a1 1 0 1 0 0-2h-4Zm0-10v4h3a2 2 0 1 0 0-4h-3Z\"/></svg>",italic:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 5v2h2.21l-3.42 10H6v2h8v-2h-2.21l3.42-10H18V5h-8Z\"/></svg>",underline:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 3h2v7a4 4 0 1 0 8 0V3h2v7a6 6 0 1 1-12 0V3Zm-1 16h14v2H5v-2Z\"/></svg>",strike:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 11h14v2H5v-2Zm7 8c-3.31 0-6-1.79-6-4h2c0 1.03 1.79 2 4 2s4-.97 4-2-1.79-2-4-2c-3.31 0-6-1.79-6-4s2.69-4 6-4 6 1.79 6 4h-2c0-1.03-1.79-2-4-2s-4 .97-4 2 1.79 2 4 2c3.31 0 6 1.79 6 4s-2.69 4-6 4Z\"/></svg>",textColor:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11 4h2l5 14h-2.13l-1.2-3.5H9.33L8.13 18H6l5-14Zm-1 8.5h4L12 6.6l-2 5.9ZM5 20h14v2H5v-2Z\"/></svg>",alignLeft:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm0 4h10v2H4V9Zm0 4h16v2H4v-2Zm0 4h10v2H4v-2Z\"/></svg>",alignCenter:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm3 4h10v2H7V9Zm-3 4h16v2H4v-2Zm3 4h10v2H7v-2Z\"/></svg>",alignRight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm6 4h10v2H10V9ZM4 13h16v2H4v-2Zm6 4h10v2H10v-2Z\"/></svg>",alignJustify:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h16v2H4V5Zm0 4h16v2H4V9Zm0 4h16v2H4v-2Zm0 4h16v2H4v-2Z\"/></svg>",lineSpacing:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 7V4l-3 4 3 4V9h12V7H6Zm12 10H6v-3l-3 4 3 4v-3h12v-2Zm2-9h2V6h-2v2Zm0 5h2v-2h-2v2Zm0 5h2v-2h-2v2Z\"/></svg>",link:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10.59 13.41a1.996 1.996 0 0 1 0-2.82l3-3a2 2 0 1 1 2.82 2.82l-1 1 1.41 1.41 1-1a4 4 0 1 0-5.66-5.66l-3 3a4 4 0 0 0 5.66 5.66l.88-.88-1.41-1.41-.88.88a1.996 1.996 0 0 1-2.82 0ZM6.17 18.24a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-.88.88 1.41 1.41.88-.88a2 2 0 1 1 2.82 2.82l-3 3a2 2 0 0 1-2.82-2.82l1-1-1.41-1.41-1 1a4 4 0 0 0 0 5.66Z\"/></svg>",unlink:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m17 7 2 2-2 2-1.41-1.41L17.17 8H14V6h3Zm-7 11H7a4 4 0 0 1 0-8h3v2H7a2 2 0 0 0 0 4h3v2Zm9.19 3.78 1.41-1.41L4.22 4 2.81 5.41 8 10.6V12H9.4l2 2H7a4 4 0 1 0 0 8h7a3.96 3.96 0 0 0 3.19-1.22ZM17 14h-2v-1.17l2-2V14Zm-3-4h-1.17l-2-2H14a4 4 0 1 1 0 8h-3v-2h3a2 2 0 1 0 0-4Z\"/></svg>",undo:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12.5 8A8.5 8.5 0 0 1 21 16.5h-2A6.5 6.5 0 0 0 8.3 11.54L11 14.25H4V7l2.89 2.89A8.47 8.47 0 0 1 12.5 8Z\"/></svg>",redo:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11.5 8A8.47 8.47 0 0 1 17.11 9.89L20 7v7h-7l2.7-2.46A6.5 6.5 0 0 0 5 16.5H3A8.5 8.5 0 0 1 11.5 8Z\"/></svg>",blockquote:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 7h6v6H7v4H5V7Zm8 0h6v6h-4v4h-2V7Z\"/></svg>",horizontalRule:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 11h16v2H4v-2Z\"/></svg>",inlineCode:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m8.59 16.59-4.58-4.59 4.58-4.59L10 8.82 6.82 12 10 15.18l-1.41 1.41Zm6.82 0L14 15.18 17.18 12 14 8.82l1.41-1.41 4.58 4.59-4.58 4.59ZM13.06 4 9.94 20h-2.03L11.03 4h2.03Z\"/></svg>",subscript:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m5.41 5 4.09 5.16L13.59 5H16l-5.29 6.6L16.3 19H13.8l-4.3-5.46L5.2 19H2.7l5.59-7.4L3 5h2.41Zm12.64 10.6c1.26 0 2.05.62 2.05 1.68 0 .47-.16.88-.48 1.25l-1.29 1.47H20V21h-4.1v-.9l1.94-2.21c.18-.2.26-.38.26-.57 0-.32-.23-.5-.63-.5-.38 0-.73.16-1.05.49l-.79-.9c.47-.54 1.16-.81 2.06-.81Z\"/></svg>",superscript:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m5.41 5 4.09 5.16L13.59 5H16l-5.29 6.6L16.3 19H13.8l-4.3-5.46L5.2 19H2.7l5.59-7.4L3 5h2.41Zm12.64.4c1.26 0 2.05.62 2.05 1.68 0 .47-.16.88-.48 1.25L18.33 9.8H20V11h-4.1v-.9l1.94-2.21c.18-.2.26-.38.26-.57 0-.32-.23-.5-.63-.5-.38 0-.73.16-1.05.49l-.79-.9c.47-.54 1.16-.81 2.06-.81Z\"/></svg>",image:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm0 2v12h14V6H5Zm2 10 3-4 2.5 3 2-2.5L17 16H7Zm2-7.5A1.5 1.5 0 1 1 9 11a1.5 1.5 0 0 1 0-3Z\"/></svg>",video:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 5h11a2 2 0 0 1 2 2v2.4l4-2.4v10l-4-2.4V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Zm0 2v10h11V7H4Z\"/></svg>",embed:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm0 2v3h16V5H4Zm0 5v9h16v-9H4Zm4.4 2.2 1.3 1.3L8.1 15l1.6 1.5-1.3 1.3L5.5 15l2.9-2.8Zm7.2 0L18.5 15l-2.9 2.8-1.3-1.3L15.9 15l-1.6-1.5 1.3-1.3Z\"/></svg>",highlight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 19h16v3H4v-3Zm3.9-4.3 7.8-7.8 2.4 2.4-7.8 7.8H7.9v-2.4Zm9.2-9.2 1.4-1.4a1 1 0 0 1 1.4 0l1 1a1 1 0 0 1 0 1.4l-1.4 1.4-2.4-2.4ZM5.5 13.1h2.4v2.4l-2.4 2.4v-4.8Z\"/></svg>",indent:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 3h18v2H3V3Zm8 4h10v2H11V7Zm0 4h10v2H11v-2Zm0 4h10v2H11v-2ZM3 19h18v2H3v-2ZM3 8l4 4-4 4V8Z\"/></svg>",outdent:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 3h18v2H3V3Zm8 4h10v2H11V7Zm0 4h10v2H11v-2Zm0 4h10v2H11v-2ZM3 19h18v2H3v-2ZM7 8v8l-4-4 4-4Z\"/></svg>",taskList:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M11 5h10v2H11V5Zm0 6h10v2H11v-2Zm0 6h10v2H11v-2ZM4.5 8.6 2.3 6.4l1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Zm0 6L2.3 12.4l1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Zm0 6-2.2-2.2 1.4-1.4 0.8 0.8 2.2-2.2 1.4 1.4-3.6 3.6Z\"/></svg>",specialCharacter:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 3a7 7 0 0 1 5.1 11.8c-1 1.1-1.6 2-1.8 2.7h3.9V21H13v-2.8c0-1.6.7-3 2.1-4.5A5 5 0 1 0 6.9 13.7C8.3 15.2 9 16.6 9 18.2V21H4.8v-3.5h3.9c-.2-.7-.8-1.6-1.8-2.7A7 7 0 0 1 12 3Z\"/></svg>",findReplace:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 3a7 7 0 0 1 5.5 11.3l5.1 5.1-1.4 1.4-5.1-5.1A7 7 0 1 1 10 3Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm-1 2.2h2v2.3h2.3v2H11v2.3H9v-2.3H6.7v-2H9V7.2Z\"/></svg>",sourceCode:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M8.6 16.6 4 12l4.6-4.6L10 8.8 6.8 12 10 15.2l-1.4 1.4Zm6.8 0L14 15.2 17.2 12 14 8.8l1.4-1.4L20 12l-4.6 4.6Z\"/></svg>",table:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm1 2v3h4V5H5Zm6 0v3h3V5h-3Zm5 0v3h3V5h-3ZM5 10v3h4v-3H5Zm6 0v3h3v-3h-3Zm5 0v3h3v-3h-3ZM5 15v4h4v-4H5Zm6 0v4h3v-4h-3Zm5 0v4h3v-4h-3Z\"/></svg>",tableRowAbove:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 14h18v6H3v-6Zm8-12h2v3h3v2h-3v3h-2V7H8V5h3V2Z\"/></svg>",tableRowBelow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 4h18v6H3V4Zm8 8h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z\"/></svg>",tableColumnLeft:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M14 3h6v18h-6V3ZM5 11V8h2v3h3v2H7v3H5v-3H2v-2h3Z\"/></svg>",tableColumnRight:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h6v18H4V3Zm13 8V8h2v3h3v2h-3v3h-2v-3h-3v-2h3Z\"/></svg>",tableDeleteRow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 4h18v5H3V4Zm0 11h18v5H3v-5Zm5-4h8v2H8v-2Z\"/></svg>",tableDeleteColumn:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h5v18H4V3Zm11 0h5v18h-5V3Zm-4.5 8h4v2h-4v-2Z\"/></svg>",tableMergeCells:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h14V6H5Zm2.5 5h3.2L9.3 9.6l1.4-1.4L14.5 12l-3.8 3.8-1.4-1.4L10.7 13H7.5v-2Z\"/></svg>",tableSplitCell:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h14V6H5Zm6 1h2v10h-2V7Z\"/></svg>",tableHeaderRow:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v3h14V6H5Zm0 5v7h14v-7H5Z\"/></svg>",tableHeaderColumn:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm1 2v12h4V6H5Zm6 0v12h8V6h-8Z\"/></svg>",tableCellBackground:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M16.6 12.6 7.4 3.4 6 4.8l2 2-4.6 4.6a1 1 0 0 0 0 1.4l6.4 6.4a1 1 0 0 0 1.4 0l5.4-5.4a1 1 0 0 0 0-1.2ZM6.6 12.8 10.4 9l3.8 3.8H6.6ZM19 14s-2 2.2-2 3.5a2 2 0 1 0 4 0c0-1.3-2-3.5-2-3.5Z\"/></svg>",tableDelete:"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 3h16a1 1 0 0 1 1 1v7h-2V9h-5v2h-2V9H9v3h3v2H9v5h3v2H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm1 2v2h2V5H5Zm4 0v2h4V5H9Zm6 0v2h4V5h-4ZM5 9v3h2V9H5Zm0 5v5h2v-5H5Zm11.2 1.4 2.1-2.1 1.4 1.4-2.1 2.1 2.1 2.1-1.4 1.4-2.1-2.1-2.1 2.1-1.4-1.4 2.1-2.1-2.1-2.1 1.4-1.4 2.1 2.1Z\"/></svg>"};const Pt=["undo","redo","heading","size","bold","italic","underline","strikeThrough","textColor","orderedList","unorderedList","alignLeft","alignCenter","alignRight","link","unlink","image","clearFormatting"];const ue=new Set(["TD","TH"]);function Nt(){const s=document.createElement("p");s.setAttribute("dir","ltr");s.appendChild(document.createElement("br"));return s}function M(s="td"){const t=document.createElement(s);t.appendChild(Nt());return t}function W(s){if(Array.from(s.children).some(e=>["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(e.tagName.toUpperCase())))return;if(!s.childNodes.length){s.appendChild(Nt());return}const t=document.createElement("p");t.setAttribute("dir","ltr");while(s.firstChild)t.appendChild(s.firstChild);s.appendChild(t)}function be(s,t,e){const n=Math.max(1,Math.min(50,Math.round(s)));const i=Math.max(1,Math.min(20,Math.round(t)));const r=document.createElement("table");r.classList.add($,`${E}all`);const o=document.createElement("colgroup");const a=`${(100/i).toFixed(4)}%`;for(let d=0;d<i;d+=1){const c=document.createElement("col");c.style.width=a;o.appendChild(c)}r.appendChild(o);const l=document.createElement("tbody");for(let d=0;d<n;d+=1){const c=document.createElement("tr");const b=e&&d===0?"th":"td";for(let p=0;p<i;p+=1)c.appendChild(M(b));l.appendChild(c)}r.appendChild(l);return r}function Ot(s,t){let e=s;while(e&&e!==t){if(e instanceof HTMLTableCellElement)return e;e=e.parentNode}return null}function U(s,t){let e=s;while(e&&e!==t){if(e instanceof HTMLTableElement)return e;e=e.parentNode}return null}function N(s){return Array.from(s.querySelectorAll("tr")).filter(t=>U(t.parentNode,null)===s)}function m(s){const t=N(s);const e=t.map(()=>[]);t.forEach((i,r)=>{let o=0;Array.from(i.children).forEach(a=>{if(!(a instanceof HTMLTableCellElement)||!ue.has(a.tagName.toUpperCase()))return;while(e[r][o])o+=1;const l=Math.max(1,a.rowSpan||1);const d=Math.max(1,a.colSpan||1);for(let c=0;c<l;c+=1){const b=r+c;if(!e[b])continue;for(let p=0;p<d;p+=1)e[b][o+p]={cell:a,row:r,column:o,rowSpan:l,columnSpan:d,isAnchor:c===0&&p===0}}o+=d})});const n=e.reduce((i,r)=>Math.max(i,r.length),0);e.forEach(i=>{i.length=n});return e}function R(s,t){for(const e of s)for(const n of e)if(n?.cell===t&&n.isAnchor)return n;return null}function k(s){return s.reduce((t,e)=>Math.max(t,e.length),0)}function at(s,t){let e=s.querySelector("colgroup");if(!e){if(t<=0)return null;e=document.createElement("colgroup");s.insertBefore(e,s.firstChild)}const n=Array.from(e.children);for(let i=n.length;i<t;i+=1)e.appendChild(document.createElement("col"));for(let i=n.length-1;i>=t;i-=1)n[i].remove();return e}function lt(s){const t=k(m(s));const e=at(s,t);if(!e||t<=0)return;const n=Array.from(e.children);const i=100/t;const r=n.map(a=>{const l=parseFloat(a.style.width);return Number.isFinite(l)&&l>0?l:i});const o=r.reduce((a,l)=>a+l,0)||100;n.forEach((a,l)=>{a.style.width=`${(r[l]/o*100).toFixed(4)}%`})}function pe(s,t){const e=s.querySelector("colgroup");if(!e)return;const n=Array.from(e.children);const i=document.createElement("col");const r=n[t]??null;e.insertBefore(i,r)}function ve(s,t,e){const n=s.querySelector("colgroup");if(!n)return;Array.from(n.children).slice(t,t+Math.max(1,e)).forEach(i=>i.remove())}function ge(s){const t=k(m(s));const e=at(s,t);if(!e)return[];return Array.from(e.children).map(n=>parseFloat(n.style.width)||100/Math.max(t,1))}function me(s,t){const e=at(s,t.length);if(!e)return;Array.from(e.children).forEach((n,i)=>{n.style.width=`${Math.max(3,t[i]??0).toFixed(4)}%`})}function fe(s,t){const e=M(s.tagName.toUpperCase()==="TH"?"th":"td");e.rowSpan=Math.max(1,s.rowSpan||1);if(t)s.parentNode?.insertBefore(e,s);else s.parentNode?.insertBefore(e,s.nextSibling);return e}function xe(s,t,e){const n=m(s);const i=R(n,t);if(!i)return null;const r=e==="left"?i.column:i.column+i.columnSpan-1;const o=new Set;const a=[];n.forEach(l=>{const d=l[r];if(!d||o.has(d.cell))return;o.add(d.cell);if(e==="left"?d.column===r:d.column+d.columnSpan-1===r){a.push(fe(d.cell,e==="left"));return}d.cell.colSpan=Math.max(1,d.cell.colSpan||1)+1});pe(s,e==="left"?r:r+1);lt(s);return a[0]??null}function _e(s,t){const e=m(s);const n=R(e,t);const i=k(e);if(!n||i<=n.columnSpan)return null;const r=new Set;for(let l=n.column;l<n.column+n.columnSpan;l+=1)e.forEach(d=>{const c=d[l];if(!c||r.has(c.cell))return;r.add(c.cell);if((c.cell.colSpan||1)>1){c.cell.colSpan=Math.max(1,(c.cell.colSpan||1)-n.columnSpan);return}c.cell.remove()});ve(s,n.column,n.columnSpan);lt(s);const o=m(s);const a=Math.min(n.column,k(o)-1);return o[n.row]?.[Math.max(0,a)]?.cell??null}function we(s,t,e){const n=m(s);const i=R(n,t);const r=N(s);if(!i||r.length===0)return null;const o=e==="above"?i.row:i.row+i.rowSpan-1;const a=n[o]??[];const l=k(n);const d=document.createElement("tr");const c=new Set;let b=0;while(b<l){const g=a[b];if(!g){d.appendChild(M("td"));b+=1;continue}if(e==="above"?g.row<o:g.row+g.rowSpan-1>o){if(!c.has(g.cell)){c.add(g.cell);g.cell.rowSpan=Math.max(1,g.cell.rowSpan||1)+1}}else{const x=M(g.cell.tagName.toUpperCase()==="TH"&&e==="above"?"th":"td");x.colSpan=g.columnSpan;d.appendChild(x)}b+=g.columnSpan}const p=r[o];if(!p?.parentNode)return null;if(e==="above")p.parentNode.insertBefore(d,p);else p.parentNode.insertBefore(d,p.nextSibling);return d.querySelector("td, th")??null}function ye(s,t){const e=R(m(s),t);const n=N(s);if(!e||n.length<=e.rowSpan)return null;for(let o=e.rowSpan-1;o>=0;o-=1){const a=e.row+o;const l=m(s);const d=N(s);const c=d[a];if(!c)continue;const b=new Set;(l[a]??[]).forEach((p,g)=>{if(!p||b.has(p.cell))return;b.add(p.cell);if(p.row<a){p.cell.rowSpan=Math.max(1,(p.cell.rowSpan||1)-1);return}if((p.cell.rowSpan||1)>1){const x=d[a+1];if(x){p.cell.rowSpan=Math.max(1,(p.cell.rowSpan||1)-1);const I=(l[a+1]??[]).slice(g+p.columnSpan).find(pt=>pt&&pt.row===a+1);if(I)x.insertBefore(p.cell,I.cell);else x.appendChild(p.cell)}}});c.remove()}const i=m(s);const r=Math.min(e.row,i.length-1);return i[Math.max(0,r)]?.[e.column]?.cell??null}function Bt(s,t,e){return Boolean(zt(s,t,e))}function zt(s,t,e){const n=m(s);const i=R(n,t);if(!i)return null;if(e==="right"){const o=n[i.row]?.[i.column+i.columnSpan];if(!o||o.row!==i.row||o.rowSpan!==i.rowSpan)return null;return o}const r=n[i.row+i.rowSpan]?.[i.column];if(!r||r.column!==i.column||r.columnSpan!==i.columnSpan)return null;return r}function Ce(s,t,e){const n=zt(s,t,e);if(!n)return false;const i=n.cell;if(!!String(i.textContent??"").trim())Array.from(i.childNodes).forEach(o=>t.appendChild(o));if(e==="right")t.colSpan=Math.max(1,t.colSpan||1)+Math.max(1,i.colSpan||1);else t.rowSpan=Math.max(1,t.rowSpan||1)+Math.max(1,i.rowSpan||1);const r=i.parentElement;i.remove();if(r&&!r.querySelector("td, th"))r.remove();W(t);return true}function st(s,t){return t==="horizontal"?Math.max(1,s.colSpan||1)>1:Math.max(1,s.rowSpan||1)>1}function Te(s,t,e){if(!st(t,e))return false;const n=t.tagName.toUpperCase()==="TH"?"th":"td";if(e==="horizontal"){const l=Math.max(1,t.colSpan||1);t.colSpan=1;let d=t;for(let c=1;c<l;c+=1){const b=M(n);b.rowSpan=Math.max(1,t.rowSpan||1);d.parentNode?.insertBefore(b,d.nextSibling);d=b}return true}const i=m(s);const r=R(i,t);const o=N(s);if(!r)return false;const a=Math.max(1,t.rowSpan||1);t.rowSpan=1;for(let l=1;l<a;l+=1){const d=o[r.row+l];if(!d)continue;const c=M(n);c.colSpan=r.columnSpan;const b=(i[r.row+l]??[]).slice(r.column+r.columnSpan).find(p=>p&&p.row===r.row+l);if(b)d.insertBefore(c,b.cell);else d.appendChild(c)}return true}function Dt(s,t){if(s.tagName.toLowerCase()===t)return s;const e=document.createElement(t);Array.from(s.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});while(s.firstChild)e.appendChild(s.firstChild);s.replaceWith(e);return e}function $t(s){const t=(m(s)[0]??[]).filter(Boolean);return t.length>0&&t.every(e=>e.cell.tagName.toUpperCase()==="TH")}function Ft(s){const t=m(s).map(e=>e[0]).filter(Boolean);return t.length>0&&t.every(e=>e.cell.tagName.toUpperCase()==="TH")}function Se(s){const t=!$t(s);const e=m(s);const n=new Set;(e[0]??[]).forEach(i=>{if(!i||n.has(i.cell))return;n.add(i.cell);Dt(i.cell,t?"th":"td")})}function Re(s){const t=!Ft(s);const e=m(s);const n=new Set;e.forEach(i=>{const r=i[0];if(!r||n.has(r.cell))return;n.add(r.cell);Dt(r.cell,t?"th":"td")})}function ke(s){const t=Array.from(s.classList).find(e=>e.startsWith(E))?.slice(20);return t==="none"||t==="outer"?t:"all"}function Ee(s,t){Array.from(s.classList).filter(e=>e.startsWith(E)).forEach(e=>s.classList.remove(e));s.classList.add($,`${E}${t}`)}function Me(s,t){Array.from(s.classList).filter(e=>e.startsWith(Tt)).forEach(e=>s.classList.remove(e));if(t!=="top")s.classList.add(F[t])}function Ie(s){if(s.classList.contains(F.middle))return"middle";if(s.classList.contains(F.bottom))return"bottom";return"top"}function Le(s,t){const e=String(t??"").trim();if(!e||e==="transparent"){s.style.removeProperty("background-color");if(!s.getAttribute("style")?.trim())s.removeAttribute("style");return}s.style.backgroundColor=e}function Vt(s){s.classList.add($);if(!Array.from(s.classList).some(t=>t.startsWith("nvb-rt-table-border-")))s.classList.add(`${E}all`);s.removeAttribute("border");s.removeAttribute("cellpadding");s.removeAttribute("cellspacing");s.querySelectorAll("td, th").forEach(t=>{W(t)});lt(s)}const He=new Set(["a","b","blockquote","br","caption","code","col","colgroup","div","em","font","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","s","small","span","strike","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]);const Ae=new Set(["background-color","color","font-style","font-weight","text-align","text-decoration","vertical-align","width"]);var dt=class ht{linkMarkerAttribute="data-nvb-rich-text-link-marker";html=v("",...ngDevMode?[{debugName:"html"}]:[]);htmlCss=v("",...ngDevMode?[{debugName:"htmlCss"}]:[]);readOnly=v(false,...ngDevMode?[{debugName:"readOnly"}]:[]);showToolbar=v(true,...ngDevMode?[{debugName:"showToolbar"}]:[]);emitOnInput=v(true,...ngDevMode?[{debugName:"emitOnInput"}]:[]);placeholder=v("Write content...",...ngDevMode?[{debugName:"placeholder"}]:[]);minimalViewer=v(false,...ngDevMode?[{debugName:"minimalViewer"}]:[]);showWordCount=v(false,...ngDevMode?[{debugName:"showWordCount"}]:[]);enabledTools=v(null,...ngDevMode?[{debugName:"enabledTools"}]:[]);testId=v("",...ngDevMode?[{debugName:"testId"}]:[]);tid(t,...e){const n=e.map(i=>Gt(i)).filter(Boolean);return[this.testId()||"nvb-rich-text",t,...n].join("-")}isToolEnabled(t){const e=this.enabledTools();if(!Array.isArray(e))return true;return e.includes(t)}hasAnyTool(...t){return t.some(e=>this.isToolEnabled(e))}hasAnyToolbarTool(){return At.some(t=>this.isToolEnabled(t.value))}htmlChange=new y;htmlCssChange=new y;editorFocus=new y;editorBlur=new y;rootRef;editableRef;toolbarRef;imageInputRef;linkPopupRef;linkButtonRef;linkUrlInputRef;mediaUrlInputRef;findInputRef;sourceTextareaRef;headingOptions=[{value:"P",key:"richText.headingParagraph",fallback:"P"},{value:"H1",key:"richText.headingH1",fallback:"H1"},{value:"H2",key:"richText.headingH2",fallback:"H2"},{value:"H3",key:"richText.headingH3",fallback:"H3"},{value:"H4",key:"richText.headingH4",fallback:"H4"}];fontOptions=[{value:L,key:"richText.fontSystem",fallback:"System UI"},{value:'"IBM Plex Sans", "Segoe UI", sans-serif',key:"richText.fontIbmPlexSans",fallback:"IBM Plex Sans"},{value:'Georgia, "Times New Roman", serif',key:"richText.fontGeorgia",fallback:"Georgia"},{value:'"Courier New", Courier, monospace',key:"richText.fontCourier",fallback:"Courier New"}];sizeOptions=it.map(t=>({value:t,label:t}));lineHeightOptions=ot.map(t=>({value:t,label:t}));heading="P";font=L;size="14";lineHeight="1.6";textColor=J;isBold=false;isItalic=false;isUnderline=false;isStrike=false;isInlineCode=false;isSubscript=false;isSuperscript=false;isBlockquote=false;align="left";selectedMediaNode=null;mediaOverlayTop=0;mediaOverlayLeft=0;mediaOverlayWidth=0;mediaOverlayBottom=0;mediaSizePercent=35;mediaResizeHandleLeft=0;mediaResizeHandleTop=0;showLinkPopup=false;linkUrl="";linkPopupTop=0;linkPopupLeft=0;highlightColor=Ct;isHighlighted=false;indentLevel=0;isTaskList=false;highlightSwatches=kt;tableCellBackgroundSwatches=Rt;specialCharacters=Et;tablePickerRowRange=Array.from({length:8},(t,e)=>e);tablePickerColumnRange=Array.from({length:10},(t,e)=>e);showHighlightPopup=false;showTablePicker=false;showSpecialCharacterPopup=false;showFindPopup=false;showMediaPopup=false;showTableCellColorPopup=false;popupTop=0;popupLeft=0;tablePickerRows=0;tablePickerColumns=0;tablePickerWithHeader=true;mediaKind="image";mediaSource="upload";mediaUrl="";mediaAlt="";findQuery="";replaceValue="";findMatchCase=false;findStatus="";isSourceMode=false;sourceDraft="";wordCount=X(0,...ngDevMode?[{debugName:"wordCount"}]:[]);characterCount=X(0,...ngDevMode?[{debugName:"characterCount"}]:[]);activeTable=null;activeTableCell=null;tableOverlayTop=0;tableOverlayLeft=0;tableBorder="all";tableCellVerticalAlign="top";hasTableHeaderRow=false;hasTableHeaderColumn=false;canMergeRight=false;canMergeDown=false;canSplitHorizontally=false;canSplitVertically=false;tableColumnHandles=[];boldIconSvg=u.bold;italicIconSvg=u.italic;underlineIconSvg=u.underline;strikeIconSvg=u.strike;textColorIconSvg=u.textColor;alignLeftIconSvg=u.alignLeft;alignCenterIconSvg=u.alignCenter;alignRightIconSvg=u.alignRight;alignJustifyIconSvg=u.alignJustify;lineSpacingIconSvg=u.lineSpacing;linkIconSvg=u.link;unlinkIconSvg=u.unlink;blockquoteIconSvg=u.blockquote;horizontalRuleIconSvg=u.horizontalRule;inlineCodeIconSvg=u.inlineCode;subscriptIconSvg=u.subscript;superscriptIconSvg=u.superscript;imageIconSvg=u.image;videoIconSvg=u.video;embedIconSvg=u.embed;highlightIconSvg=u.highlight;indentIconSvg=u.indent;outdentIconSvg=u.outdent;taskListIconSvg=u.taskList;specialCharacterIconSvg=u.specialCharacter;findReplaceIconSvg=u.findReplace;sourceCodeIconSvg=u.sourceCode;tableIconSvg=u.table;tableRowAboveIconSvg=u.tableRowAbove;tableRowBelowIconSvg=u.tableRowBelow;tableColumnLeftIconSvg=u.tableColumnLeft;tableColumnRightIconSvg=u.tableColumnRight;tableDeleteRowIconSvg=u.tableDeleteRow;tableDeleteColumnIconSvg=u.tableDeleteColumn;tableMergeCellsIconSvg=u.tableMergeCells;tableSplitCellIconSvg=u.tableSplitCell;tableHeaderRowIconSvg=u.tableHeaderRow;tableHeaderColumnIconSvg=u.tableHeaderColumn;tableCellBackgroundIconSvg=u.tableCellBackground;tableDeleteIconSvg=u.tableDelete;undoIconSvg=u.undo;redoIconSvg=u.redo;savedRange=null;linkSelectionRange=null;skipFocusSelectionSync=false;hasViewInitialized=false;colorClassMap=new Map;uiTranslationService=w(Kt);markupSecurityService=w(gt);isMediaResizeDragging=false;mediaResizeStartX=0;mediaResizeStartPercent=35;draggingMediaNode=null;pendingMediaDropRange=null;showMediaDropCaret=false;mediaDropCaretLeft=0;mediaDropCaretTop=0;mediaDropCaretHeight=0;highlightClassMap=new Map;historyStack=[];historyIndex=-1;historyTimer=null;isRestoringHistory=false;lastHistoryStamp=0;isTableColumnResizing=false;tableResizeColumnIndex=-1;tableResizeStartX=0;tableResizeStartWidths=[];tableResizeTableWidth=1;findMatchIndex=-1;constructor(){G(()=>{this.readOnly();queueMicrotask(()=>{this.applyReadonlyState()})});G(()=>{const t=this.html();if(!this.hasViewInitialized)return;queueMicrotask(()=>{this.syncIncomingHtml(t)})});G(()=>{const t=this.htmlCss();if(!this.hasViewInitialized)return;queueMicrotask(()=>{this.syncIncomingCss(t)})})}ngAfterViewInit(){this.hasViewInitialized=true;this.syncIncomingCss(this.htmlCss());this.syncIncomingHtml(this.html());this.applyReadonlyState();this.resetHistory();this.updateCounts();queueMicrotask(()=>{this.captureSelection();this.refreshToolbarState()})}ngOnDestroy(){this.removeLinkSelectionMarkers();this.clearHistoryTimer()}onToolbarControlMouseDown(t){if(this.readOnly())return;t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow();this.persistLinkSelectionMarkers()}onEditorFocus(){if(this.readOnly()||this.skipFocusSelectionSync)return;this.captureSelection();this.refreshToolbarState();this.editorFocus.emit()}onEditorInput(){if(this.readOnly())return;this.normalizeEditorRootBlocks();this.enforceLtrContext();this.syncSelectedMediaState();this.syncActiveTableState();this.captureSelection();this.refreshToolbarState();this.scheduleHistorySnapshot();if(this.emitOnInput())this.emitCurrentHtml()}onEditorClick(t){const e=t.target;const n=e?.closest?.("a");if(this.toggleTaskItemFromClick(t))return;if(this.readOnly()){this.clearSelectedMedia();if(!n?.href)return;t.preventDefault();t.stopPropagation();window.open(n.href,"_blank","noopener,noreferrer");return}const i=this.findSelectableMediaNode(e);if(i){t.preventDefault();t.stopPropagation();this.selectMediaNode(i);return}if(!n?.href){this.clearSelectedMedia();return}t.preventDefault();t.stopPropagation();window.open(n.href,"_blank","noopener,noreferrer")}onEditorBlur(){if(this.showLinkPopup||this.readOnly())return;const t=this.getCleanHtml();this.editorBlur.emit(t)}onEditorCursorChange(){if(this.readOnly())return;if(!this.selectedMediaNode)this.clearSelectedMedia();this.captureSelection();this.refreshToolbarState();this.syncActiveTableState()}onEditorScroll(){this.syncSelectedMediaState();this.syncActiveTableState()}onEditorDragStart(t){if(this.readOnly())return;const e=t.target;const n=this.findSelectableMediaNode(e);const i=this.editableRef?.nativeElement;if(!n||!i?.contains(n))return;this.selectMediaNode(n);this.draggingMediaNode=n;n.classList.add("nvb-rt-media-dragging");if(t.dataTransfer){t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/plain","nvb-rich-text-media");try{t.dataTransfer.setDragImage(n,Math.min(Math.max(n.clientWidth/2,16),60),Math.min(Math.max(n.clientHeight/2,16),60))}catch{}}}onEditorDragOver(t){this.handleMediaDragOver(t)}onEditorDrop(t){this.handleMediaDrop(t)}onEditorDragEnd(){this.draggingMediaNode?.classList.remove("nvb-rt-media-dragging");this.draggingMediaNode=null;this.pendingMediaDropRange=null;this.clearMediaDropCaret()}onEditorKeyDown(t){if(this.readOnly()){t.preventDefault();return}if((t.ctrlKey||t.metaKey)&&!t.altKey){const e=t.key.toLowerCase();if(e==="z"&&!t.shiftKey){t.preventDefault();this.undo();return}if(e==="y"||e==="z"&&t.shiftKey){t.preventDefault();this.redo();return}if(e==="f"){t.preventDefault();this.openFindPopup();return}}if(t.key==="Tab"){if(this.moveToAdjacentTableCell(t.shiftKey)){t.preventDefault();return}t.preventDefault();if(t.shiftKey)this.outdent();else this.indent();return}if(t.key==="Enter"){const e=this.resolveWorkingRange();const n=e?this.findClosestPre(e.startContainer):null;if(e&&n){t.preventDefault();const i=this.resolveCodeContentElement(n);if(t.ctrlKey||t.metaKey){this.exitCodeBlock(n);return}const r=String(i.textContent??"");const o=this.codeTextOffset(i,e.startContainer,e.startOffset);const a=this.codeTextOffset(i,e.endContainer,e.endOffset);this.runWithRange(()=>{i.textContent=`${r.slice(0,o)}
2
2
  ${r.slice(a)}`;return this.codeCaretRange(i,o+1)});return}if(this.exitEmptyTaskItem()){t.preventDefault();return}this.align="left"}}resolveCodeContentElement(t){return t.querySelector("code")??t}codeTextOffset(t,e,n){const i=document.createRange();i.selectNodeContents(t);try{i.setEnd(e,n)}catch{return String(t.textContent??"").length}return i.toString().length}codeCaretRange(t,e){const n=document.createRange();const i=t.firstChild;if(i instanceof Text)n.setStart(i,Math.max(0,Math.min(e,i.length)));else n.selectNodeContents(t);n.collapse(true);return n}exitCodeBlock(t){this.runWithRange(()=>{const e=t.nextElementSibling;const n=e instanceof HTMLParagraphElement&&!String(e.textContent??"").trim()?e:this.createEmptyParagraph();if(n!==e)t.insertAdjacentElement("afterend",n);const i=document.createRange();i.setStart(n,0);i.collapse(true);return i})}createEmptyParagraph(){const t=document.createElement("p");t.setAttribute("dir","ltr");t.appendChild(document.createElement("br"));return t}onEditorPaste(t){if(this.readOnly()){t.preventDefault();return}const e=t.clipboardData;const n=e?.getData("text/plain")??"";if(!n)return;const i=n.replace(/\r\n/g,"\n").replace(/\r/g,"\n");const r=this.resolveWorkingRange();if(r?this.findClosestPre(r.startContainer):null){t.preventDefault();this.runWithRange(a=>{a.deleteContents();const l=document.createTextNode(i);a.insertNode(l);const d=document.createRange();d.setStartAfter(l);d.collapse(true);return d});return}const o=e?.getData("text/html")??"";if(i.includes("\n")){if(/font-family\s*:[^;"']*(mono|consolas|courier|menlo|cascadia|fira\s*code|jetbrains|source\s*code)/i.test(o)){t.preventDefault();this.runWithRange(a=>this.insertCodeBlockAtRange(a,i));return}}if(o.trim()){const a=this.buildPasteFragment(o);if(a&&a.childNodes.length>0){t.preventDefault();this.runWithRange(l=>this.insertPasteFragment(l,a));return}}}buildPasteFragment(t){const e=new DOMParser().parseFromString(String(t??""),"text/html").body;if(!e)return null;e.querySelectorAll("script,style,link,meta,base,object,embed,form,input,select,textarea,button,noscript,svg,math,title").forEach(i=>i.remove());Array.from(e.querySelectorAll("*")).forEach(i=>{if(i.isConnected)this.scrubPastedElement(i)});Array.from(e.querySelectorAll("table")).forEach(i=>{if(i instanceof HTMLTableElement)Vt(i)});const n=document.createDocumentFragment();while(e.firstChild)n.appendChild(e.firstChild);return n}scrubPastedElement(t){const e=String(t.tagName??"").trim().toLowerCase();if(!e||!He.has(e)){this.unwrapElement(t);return}Array.from(t.attributes).forEach(n=>{const i=String(n.name??"").trim().toLowerCase();if(i==="colspan"||i==="rowspan"||i==="dir"||i==="lang")return;if(i==="alt"||i==="width"||i==="height")return;if(i==="href"&&e==="a"){if(!/^(https?:|mailto:|tel:|#|\/)/i.test(n.value.trim()))t.removeAttribute(n.name);return}if(i==="src"&&(e==="img"||e==="video")){if(!/^(https?:|data:image\/)/i.test(n.value.trim()))t.remove();return}if(i==="class"){const r=n.value.split(/\s+/).filter(o=>o.startsWith("nvb-rt-")).join(" ");if(r)t.setAttribute("class",r);else t.removeAttribute("class");return}if(i==="style"){const r=this.scrubPastedStyle(n.value);if(r)t.setAttribute("style",r);else t.removeAttribute("style");return}t.removeAttribute(n.name)})}scrubPastedStyle(t){return String(t??"").split(";").map(e=>e.trim()).filter(Boolean).map(e=>{const n=e.indexOf(":");if(n<=0)return null;const i=e.slice(0,n).trim().toLowerCase();const r=e.slice(n+1).trim();if(!Ae.has(i)||!r)return null;if(/(expression|url\s*\(|javascript:|vbscript:)/i.test(r))return null;return`${i}: ${r}`}).filter(e=>Boolean(e)).join("; ")}insertPasteFragment(t,e){const n=this.editableRef?.nativeElement;if(!n)return null;const i=Array.from(e.childNodes);if(!i.some(l=>l instanceof HTMLElement&&(T.has(l.tagName.toUpperCase())||et.has(l.tagName.toUpperCase())))){const l=t.cloneRange();l.deleteContents();return this.insertNodeRange(l,e)}const r=this.resolveRootLevelNode(t.startContainer);if(r){let l=r;i.forEach(d=>{l.after(d);l=d});if(r instanceof HTMLParagraphElement&&!String(r.textContent??"").trim())r.remove()}else i.forEach(l=>n.appendChild(l));const o=i[i.length-1];if(!o)return null;const a=document.createRange();a.selectNodeContents(o);a.collapse(false);return a}insertCodeBlockAtRange(t,e){t.deleteContents();const n=document.createElement("pre");const i=document.createElement("code");i.textContent=e;n.appendChild(i);const r=this.findClosestBlock(t.startContainer);if(r&&r.tagName!=="LI"){r.insertAdjacentElement("afterend",n);if(!String(r.textContent??"").trim())r.remove()}else t.insertNode(n);const o=document.createRange();o.selectNodeContents(i);o.collapse(false);return o}onHeadingChange(t){if(this.readOnly())return;const e=t.target.value||"P";this.heading=e;this.runWithRange(n=>this.applyHeadingToRange(n,e))}onFontChange(t){if(this.readOnly())return;const e=t.target.value||'"Segoe UI", Tahoma, Geneva, Verdana, sans-serif';this.font=e;this.runWithRange(n=>this.applyTextStyleToRange(n,"font",this.resolveFontClass(e)))}onSizeChange(t){if(this.readOnly())return;const e=t.target.value||"3";this.size=e;this.runWithRange(n=>this.applyTextStyleToRange(n,"size",this.resolveSizeClass(e)))}onLineHeightChange(t){if(this.readOnly())return;const e=t.target.value||"1.6";this.setLineHeight(e)}setLineHeight(t,e){if(this.readOnly())return;if(e)this.prepareToolbarCommand(e);this.lineHeight=t;this.runWithRange(n=>this.applyLineHeightToRange(n,t))}onTextColorChange(t){if(this.readOnly())return;const e=t.target.value||"#1f2937";this.textColor=e;this.runWithRange(n=>this.applyTextStyleToRange(n,"color",this.ensureColorClass(e)))}toggleInline(t,e){if(this.readOnly())return;if(e)this.prepareToolbarCommand(e);this.runWithRange(n=>this.toggleInlineMark(n,Ht[t]))}toggleTag(t,e){if(this.readOnly())return;if(e)this.prepareToolbarCommand(e);if(t==="code"){this.runWithRange(n=>this.toggleCodeAtRange(n));return}this.runWithRange(n=>this.toggleInlineMark(n,t))}setAlignment(t,e){if(this.readOnly())return;if(e)this.prepareToolbarCommand(e);this.align=t;this.runWithRange(n=>this.applyAlignmentToRange(n,t))}toggleBlockquote(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.toggleBlockquoteAtRange(e))}insertHorizontalRule(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.insertHorizontalRuleAtRange(e))}openImagePicker(t){if(this.readOnly())return;this.prepareToolbarCommand(t);this.imageInputRef?.nativeElement.click()}onImageFileSelected(t){const e=t.target;const n=e?.files?.[0];if(!n)return;const i=String(this.mediaAlt??"").trim();const r=this.resolveStoredLinkRange()??this.linkSelectionRange;this.closeMediaPopup();const o=new FileReader;o.onload=()=>{const a=String(o.result??"").trim();if(!a)return;this.runWithRange(l=>this.insertImageAtRange(l,a,i),r);if(e)e.value=""};o.readAsDataURL(n)}setSelectedMediaAlignment(t,e){e.preventDefault();e.stopPropagation();if(!this.selectedMediaNode)return;this.updateMediaAlignment(this.selectedMediaNode,t);this.syncSelectedMediaState();this.captureSelection();this.emitCurrentHtml()}onSelectedMediaSizeInput(t){const e=Number(t.target?.value??35);this.updateSelectedMediaSize(e)}decreaseSelectedMediaSize(t){t.preventDefault();t.stopPropagation();this.updateSelectedMediaSize(this.mediaSizePercent-5)}increaseSelectedMediaSize(t){t.preventDefault();t.stopPropagation();this.updateSelectedMediaSize(this.mediaSizePercent+5)}startMediaResizeDrag(t){t.preventDefault();t.stopPropagation();if(!this.selectedMediaNode)return;this.isMediaResizeDragging=true;this.mediaResizeStartX=t.clientX;this.mediaResizeStartPercent=this.mediaSizePercent}openLinkPopup(t){if(this.readOnly())return;t.preventDefault();t.stopPropagation();this.linkSelectionRange=this.resolveStoredLinkRange();const e=this.findClosestAnchor(this.linkSelectionRange?.commonAncestorContainer??null)?.href||"";this.linkUrl=e==="https://"?"":e;this.positionLinkPopup();this.showLinkPopup=true;queueMicrotask(()=>{this.linkUrlInputRef?.nativeElement?.focus();this.linkUrlInputRef?.nativeElement?.select()})}positionLinkPopup(){const t=this.rootRef?.nativeElement;if(!t){this.linkPopupTop=40;this.linkPopupLeft=8;return}const e=window.getSelection();const n=e?.rangeCount?e.getRangeAt(0):null;if(!n){this.linkPopupTop=40;this.linkPopupLeft=8;return}const i=n.getBoundingClientRect();const r=t.getBoundingClientRect();this.linkPopupTop=Math.max(4,i.bottom-r.top+4);this.linkPopupLeft=Math.max(4,Math.min(i.left-r.left,r.width-352))}normalizeLinkUrl(t){const e=t.trim();if(!e)return null;return/^(https?:|mailto:|tel:)/i.test(e)?e:`https://${e}`}closeLinkPopup(t){if(t){t.preventDefault();t.stopPropagation()}const e=this.restoreLinkSelectionFromMarkers();if(e)this.savedRange=e.cloneRange();this.showLinkPopup=false;this.linkUrl="";this.linkSelectionRange=null;this.focusEditor();this.restoreSelection()}applyLink(t){if(this.readOnly())return;t.preventDefault();t.stopPropagation();const e=this.linkUrl.trim();if(!e){this.closeLinkPopup();return}const n=/^(https?:|mailto:|tel:)/i.test(e)?e:`https://${e}`;this.showLinkPopup=false;this.linkUrl="";this.linkSelectionRange=null;this.focusEditor(true);const i=this.insertLinkFromMarkers(n)??(()=>{const r=this.resolveStoredLinkRange();if(!r||!this.isRangeInsideEditor(r))return null;return this.insertLinkAtRange(r,n)})();this.removeLinkSelectionMarkers();if(!i)return;this.enforceLtrContext();this.decorateLinks();this.savedRange=i.cloneRange();this.applySelectionRange(i);this.refreshToolbarState();this.emitCurrentHtml()}applyLinkFromKeyboard(t){t.preventDefault();t.stopPropagation();this.applyLink(t)}onLinkUrlInput(t){this.linkUrl=t.target.value}unlinkSelection(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);const e=this.resolveStoredLinkRange();if(!e||!this.isRangeInsideEditor(e))return;const n=this.removeLinkFromRange(e);this.enforceLtrContext();this.decorateLinks();if(n){this.savedRange=n.cloneRange();this.applySelectionRange(n)}this.refreshToolbarState();this.emitCurrentHtml()}clearFormatting(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.clearFormattingRange(e))}canUndo(){return this.historyIndex>0||this.historyTimer!==null}canRedo(){return this.historyIndex>=0&&this.historyIndex<this.historyStack.length-1}undo(t){if(this.readOnly())return;if(t){t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow()}this.flushHistory();this.recordHistory();if(this.historyIndex<=0)return;this.historyIndex-=1;this.applyHistoryEntry(this.historyStack[this.historyIndex])}redo(t){if(this.readOnly())return;if(t){t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow()}this.flushHistory();if(this.historyIndex<0||this.historyIndex>=this.historyStack.length-1)return;this.historyIndex+=1;this.applyHistoryEntry(this.historyStack[this.historyIndex])}insertOrderedList(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.toggleList("ol")}insertUnorderedList(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.toggleList("ul")}runCommand(t){if(t==="undo"||t==="redo")document.execCommand?.(t,false)}prepareToolbarCommand(t){t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow();this.persistLinkSelectionMarkers()}persistLinkSelectionMarkers(){this.removeLinkSelectionMarkers();if(!this.savedRange||!this.isRangeInsideEditor(this.savedRange))return;const t=this.savedRange.cloneRange();const e=this.createLinkSelectionMarker("end");const n=this.createLinkSelectionMarker("start");const i=t.cloneRange();i.collapse(false);i.insertNode(e);const r=t.cloneRange();r.collapse(true);r.insertNode(n)}restoreLinkSelectionFromMarkers(){const t=this.editableRef?.nativeElement;if(!t)return null;const e=t.querySelector(`[${this.linkMarkerAttribute}="start"]`);const n=t.querySelector(`[${this.linkMarkerAttribute}="end"]`);if(!e&&!n)return null;const i=document.createRange();if(e)i.setStartAfter(e);else if(n?.parentNode)i.setStartBefore(n);if(n)i.setEndBefore(n);else i.collapse(true);this.removeLinkSelectionMarkers();return i}insertLinkFromMarkers(t){const e=this.editableRef?.nativeElement;if(!e)return null;const n=e.querySelector(`[${this.linkMarkerAttribute}="start"]`);const i=e.querySelector(`[${this.linkMarkerAttribute}="end"]`);if(!n&&!i)return null;const r=document.createRange();if(n)r.setStartAfter(n);else if(i?.parentNode)r.setStartBefore(i);else return null;if(i)r.setEndBefore(i);else r.collapse(true);if(!this.isRangeInsideEditor(r))return null;return this.insertLinkAtRange(r,t)}resolveStoredLinkRange(){const t=this.restoreLinkSelectionFromMarkers();if(t&&this.isRangeInsideEditor(t))return t;if(this.linkSelectionRange&&this.isRangeInsideEditor(this.linkSelectionRange))return this.linkSelectionRange.cloneRange();if(this.savedRange&&this.isRangeInsideEditor(this.savedRange))return this.savedRange.cloneRange();const e=this.getSelectionRangeForEditor();if(e&&this.isRangeInsideEditor(e))return e.cloneRange();return null}getSelectionRangeForEditor(){const t=this.editableRef?.nativeElement;if(!t)return null;const e=t.getRootNode();if(e instanceof ShadowRoot){const i=this.getShadowRootSelection(e);if(i?.rangeCount){const o=i.getRangeAt(0);if(this.isRangeInsideEditor(o))return o.cloneRange()}const r=this.getComposedSelectionRange(e);if(r&&this.isRangeInsideEditor(r))return r}const n=window.getSelection();if(n?.rangeCount){const i=n.getRangeAt(0);if(this.isRangeInsideEditor(i))return i.cloneRange()}return null}getShadowRootSelection(t){const e=t;try{return e.getSelection?.()??null}catch{return null}}getComposedSelectionRange(t){const e=window.getSelection();if(!e||typeof e.getComposedRanges!=="function")return null;let n=[];try{n=e.getComposedRanges({shadowRoots:[t]})}catch{try{n=e.getComposedRanges(t)}catch{n=[]}}const i=n[0];if(!i)return null;return this.createRangeFromAbstractRange(i)}createRangeFromAbstractRange(t){try{const e=document.createRange();e.setStart(t.startContainer,t.startOffset);e.setEnd(t.endContainer,t.endOffset);return e}catch{return null}}getWritableSelection(){const t=this.editableRef?.nativeElement;if(!t)return null;const e=t.getRootNode();if(e instanceof ShadowRoot){const n=this.getShadowRootSelection(e);if(n)return n}return window.getSelection()}removeLinkSelectionMarkers(){const t=this.editableRef?.nativeElement;if(!t)return;t.querySelectorAll(`[${this.linkMarkerAttribute}]`).forEach(e=>e.remove())}createLinkSelectionMarker(t){const e=document.createElement("span");e.setAttribute(this.linkMarkerAttribute,t);e.setAttribute("aria-hidden","true");e.setAttribute("contenteditable","false");e.style.display="none";e.textContent="​";return e}captureSelectionFromWindow(){const t=this.getSelectionRangeForEditor();if(!t||!this.isRangeInsideEditor(t))return;this.savedRange=t.cloneRange()}syncIncomingCss(t){this.colorClassMap.clear();this.highlightClassMap.clear();const e=String(t??"");const n=/\.([a-z0-9_-]+)\s*\{\s*(color|background-color)\s*:\s*([^;]+);?\s*\}/gi;let i=n.exec(e);while(i){const r=String(i[1]??"").trim();const o=String(i[2]??"").trim().toLowerCase();const a=String(i[3]??"").trim();if(a&&o==="color"&&r.startsWith("nvb-rt-color-"))this.colorClassMap.set(r,a);if(a&&o==="background-color"&&r.startsWith("nvb-rt-bg-"))this.highlightClassMap.set(r,a);i=n.exec(e)}}emitCurrentHtmlCss(){const t=Array.from(this.colorClassMap.entries()).map(([n,i])=>`.${n} { color: ${i}; }`);const e=Array.from(this.highlightClassMap.entries()).map(([n,i])=>`.${n} { background-color: ${i}; }`);this.htmlCssChange.emit([...t,...e].join("\n"))}resolveWorkingRange(t){if(t&&this.isRangeInsideEditor(t))return t.cloneRange();const e=this.restoreLinkSelectionFromMarkers();if(e&&this.isRangeInsideEditor(e)){this.savedRange=e.cloneRange();return e}if(this.savedRange&&this.isRangeInsideEditor(this.savedRange))return this.savedRange.cloneRange();const n=this.getSelectionRangeForEditor();if(!n)return null;if(!this.isRangeInsideEditor(n))return null;return n.cloneRange()}runWithRange(t,e){if(this.readOnly())return;this.flushHistory();this.normalizeEditorRootBlocks();const n=this.resolveWorkingRange(e)??this.ensureEditableRange();if(!n)return;const i=t(n.cloneRange());this.enforceLtrContext();const r=(i&&this.isRangeInsideEditor(i)?i:null)??this.resolveWorkingRange();if(r&&this.isRangeInsideEditor(r)){this.savedRange=r.cloneRange();this.focusEditor(true);this.applySelectionRange(r)}this.refreshToolbarState();this.syncActiveTableState();this.updateCounts();this.emitCurrentHtml();this.emitCurrentHtmlCss();this.recordHistory()}resolveFontClass(t){return nt[t]??"nvb-rt-font-system"}resolveSizeClass(t){return rt[t]??"nvb-rt-size-14"}resolveLineHeightClass(t){return V[t]??V["1.6"]}ensureColorClass(t){const e=String(t??"").trim().toLowerCase();if(!e)return`${H}default`;const n=e.replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"");const i=`${H}${n||"value"}`;this.colorClassMap.set(i,e);return i}toggleCodeAtRange(t){const e=this.findClosestPre(t.startContainer)??this.findClosestPre(t.endContainer);if(e)return this.unwrapCodeBlock(e);const n=this.collectBlocksInRange(t).filter(i=>!(i instanceof HTMLPreElement));if(n.length>1||n.length===1&&this.rangeSpansMultipleLines(t))return this.wrapBlocksAsCodeBlock(n);return this.toggleInlineMark(t,"code")}rangeSpansMultipleLines(t){if(t.collapsed)return false;const e=t.cloneContents();if(e.querySelector("br"))return true;if(String(e.textContent??"").includes("\n"))return true;return Array.from(e.children).some(n=>n instanceof HTMLElement&&this.isTopLevelBlock(n))}wrapBlocksAsCodeBlock(t){if(t.length===0)return null;const e=[];t.forEach(d=>e.push(...this.blockTextLines(d)));const n=document.createElement("pre");const i=document.createElement("code");i.textContent=e.join("\n");n.appendChild(i);const r=t[0];const o=r.tagName==="LI"?r.closest("ul,ol")??r:r;o.parentNode?.insertBefore(n,o);const a=new Set;t.forEach(d=>{const c=d.parentElement;d.remove();if(c&&(c.tagName==="UL"||c.tagName==="OL")&&c.childElementCount===0)a.add(c)});a.forEach(d=>d.remove());const l=document.createRange();l.selectNodeContents(i);l.collapse(false);return l}unwrapCodeBlock(t){const e=String(t.textContent??"").split("\n");let n=null;let i=null;e.forEach(r=>{const o=document.createElement("p");if(r)o.textContent=r;else o.appendChild(document.createElement("br"));t.parentNode?.insertBefore(o,t);n=n??o;i=o});t.remove();if(!n||!i)return null;return this.createSelectionRange(n,i)}blockTextLines(t){const e=[];let n="";const i=r=>{if(r instanceof HTMLBRElement){e.push(n);n="";return}if(r instanceof Text){n+=r.textContent??"";return}r.childNodes.forEach(i)};t.childNodes.forEach(i);e.push(n);return e}findClosestPre(t){const e=this.editableRef?.nativeElement;let n=t;while(n&&n!==e){if(n instanceof HTMLElement&&n.tagName==="PRE")return n;n=n.parentNode}return null}toggleInlineMark(t,e){if(t.collapsed)return this.removeInlineMarkAtCaret(t,e)??t;if(this.isRangeFullyMarked(t,e)){const r=this.getNativeInlineCommand(e);if(r){const a=this.executeNativeCommandOnRange(r,t);if(a)return a}const o=t.extractContents();this.unwrapMatchingElementsInNode(o,a=>this.matchesMarkTag(a,e));return this.insertNodeRange(t,o)}const n=t.extractContents();const i=this.wrapFragmentWithInlineFormatter(n,()=>document.createElement(e));return this.insertNodeRange(t,i)}applyTextStyleToRange(t,e,n){if(t.collapsed){if(!n)return t;const a=this.findClosestStyledSpan(t.startContainer,e);if(a&&this.isPendingStyleRun(a)){this.replaceStyleClass(a,e,n);return this.caretInsidePendingRun(a)}if(a?.classList.contains(n))return t;return this.startStyledRunAtCaret(t,n)}const i=t.extractContents();const r=Boolean(n&&this.isRangeFullyStyled(t,e,n));this.removeStyleKindFromNode(i,e);const o=n&&!r?this.wrapFragmentWithInlineFormatter(i,()=>{const a=document.createElement("span");a.classList.add(n);return a}):i;return this.insertNodeRange(t,o)}startStyledRunAtCaret(t,e){const n=document.createElement("span");n.classList.add(e);const i=document.createTextNode("​");n.appendChild(i);t.cloneRange().insertNode(n);const r=document.createRange();r.setStart(i,i.length);r.collapse(true);return r}isPendingStyleRun(t){return!String(t.textContent??"").replace(/\u200b/g,"")}replaceStyleClass(t,e,n){const i=this.getStylePrefixes(e);Array.from(t.classList).filter(r=>i.some(o=>r.startsWith(o))).forEach(r=>t.classList.remove(r));t.classList.add(n)}caretInsidePendingRun(t){const e=document.createRange();const n=t.firstChild;if(n instanceof Text)e.setStart(n,n.length);else e.selectNodeContents(t);e.collapse(true);return e}clearFormattingRange(t){if(t.collapsed)return t;const e=this.executeNativeCommandOnRange("removeFormat",t);if(e)return e;const n=t.extractContents();this.unwrapMatchingElementsInNode(n,i=>{const r=i.tagName.toUpperCase();if(r==="A")return false;if(r==="STRONG"||r==="B"||r==="EM"||r==="I")return true;if(r==="U"||r==="S"||r==="STRIKE")return true;if(r==="MARK"||r==="CODE"||r==="SUB"||r==="SUP")return true;if(r==="SPAN")return Array.from(i.classList).some(o=>o.startsWith("nvb-rt-font-")||o.startsWith("nvb-rt-size-")||o.startsWith("nvb-rt-color-")||o.startsWith("nvb-rt-bg-"));return false});return this.insertNodeRange(t,n)}applyHeadingToRange(t,e){const n=this.findClosestBlock(t.startContainer);const i=this.findClosestBlock(t.endContainer);if(n&&i&&n===i&&!t.collapsed)return this.replaceSelectionWithinSingleBlock(n,t,e.toLowerCase());const r=this.collectBlocksInRange(t);if(r.length===0)return t;const o=this.replaceBlockTag(r[0],e.toLowerCase());let a=o;r.slice(1).forEach(l=>{a=this.replaceBlockTag(l,e.toLowerCase())});return this.createSelectionRange(o,a)}applyAlignmentToRange(t,e){const n=this.collectBlocksInRange(t);if(n.length===0)return t;n.forEach(i=>{Array.from(i.classList).filter(r=>r.startsWith(yt)).forEach(r=>i.classList.remove(r));if(e!=="left")i.classList.add(P[e])});return t.cloneRange()}applyLineHeightToRange(t,e){const n=this.collectBlocksInRange(t);if(n.length===0)return t;const i=this.resolveLineHeightClass(e);n.forEach(r=>{Array.from(r.classList).filter(o=>o.startsWith(z)).forEach(o=>r.classList.remove(o));r.classList.add(i)});return t.cloneRange()}toggleBlockquoteAtRange(t){const e=this.collectBlocksInRange(t);if(e.length===0)return t;const n=e.every(o=>o.tagName.toUpperCase()==="BLOCKQUOTE")?"p":"blockquote";const i=this.replaceBlockTag(e[0],n);let r=i;e.slice(1).forEach(o=>{r=this.replaceBlockTag(o,n)});return this.createSelectionRange(i,r)}insertHorizontalRuleAtRange(t){const e=this.editableRef?.nativeElement;if(!e)return t;const n=this.findClosestBlock(t.startContainer);const i=document.createElement("hr");const r=document.createElement("p");r.setAttribute("dir","ltr");r.appendChild(document.createElement("br"));if(n?.parentNode){n.insertAdjacentElement("afterend",i);i.insertAdjacentElement("afterend",r)}else{e.appendChild(i);e.appendChild(r)}const o=document.createRange();o.selectNodeContents(r);o.collapse(true);return o}toggleListAtRange(t,e){const n=this.collectBlocksInRange(t);if(n.length===0)return t;const i=n[0].parentElement;if((i instanceof HTMLOListElement||i instanceof HTMLUListElement?n.every(a=>a.parentElement===i&&a.tagName==="LI"):false)&&i.tagName.toLowerCase()===e){const a=n.filter(l=>l instanceof HTMLLIElement).map(l=>this.replaceListItemWithParagraph(l));if(i.childElementCount===0)i.remove();return this.createSelectionRange(a[0],a[a.length-1])}const r=document.createElement(e);const o=n[0];o.parentNode?.insertBefore(r,o);n.forEach(a=>{if(a instanceof HTMLLIElement){r.appendChild(a);return}const l=document.createElement("li");while(a.firstChild)l.appendChild(a.firstChild);a.remove();r.appendChild(l)});return this.createSelectionRange(r.firstChild??r,r.lastChild??r)}selectionInsideSingleTag(t,e){const n=this.findClosestMarkTag(t.startContainer,e);const i=this.findClosestMarkTag(t.endContainer,e);return Boolean(n&&n===i)}isFragmentFullyMarked(t,e){const n=this.collectTextNodes(t);if(n.length===0)return false;return n.every(i=>Boolean(this.findClosestMarkTagWithin(i,e,t)))}isRangeFullyMarked(t,e){const n=this.collectLiveTextNodesInRange(t);if(n.length===0)return false;return n.every(i=>Boolean(this.findClosestMarkTag(i,e)))}findClosestMarkTagWithin(t,e,n){let i=t;while(i&&i!==n){if(i instanceof HTMLElement&&this.matchesMarkTag(i,e))return i;i=i.parentNode}return null}isFragmentFullyStyled(t,e,n){const i=this.collectTextNodes(t);if(i.length===0)return false;return i.every(r=>this.findClosestStyledSpanWithin(r,e,t)?.classList.contains(n))}isRangeFullyStyled(t,e,n){const i=this.collectLiveTextNodesInRange(t);if(i.length===0)return false;return i.every(r=>this.findClosestStyledSpan(r,e)?.classList.contains(n))}findClosestStyledSpanWithin(t,e,n){const i=this.getStylePrefixes(e);let r=t;while(r&&r!==n){if(r instanceof HTMLSpanElement&&Array.from(r.classList).some(o=>i.some(a=>o.startsWith(a))))return r;r=r.parentNode}return null}findClosestMarkTag(t,e){const n=this.editableRef?.nativeElement;const i=e==="strong"?["STRONG","B"]:e==="em"?["EM","I"]:e==="s"?["S","STRIKE"]:[e.toUpperCase()];let r=t;while(r&&r!==n){if(r instanceof HTMLElement&&i.includes(r.tagName.toUpperCase()))return r;r=r.parentNode}return null}matchesMarkTag(t,e){const n=e.toUpperCase();if(n==="STRONG")return t.tagName==="STRONG"||t.tagName==="B";if(n==="EM")return t.tagName==="EM"||t.tagName==="I";if(n==="S")return t.tagName==="S"||t.tagName==="STRIKE";return t.tagName===n}wrapFragmentWithInlineFormatter(t,e){if(!this.fragmentContainsBlockNodes(t)){const n=e();n.appendChild(t);return n}this.collectTextNodes(t).forEach(n=>{const i=e();n.parentNode?.insertBefore(i,n);i.appendChild(n)});return t}fragmentContainsBlockNodes(t){return this.collectElements(t).some(e=>T.has(e.tagName.toUpperCase()))}collectTextNodes(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:r=>String(r.textContent??"").replace(/\u200b/g,"").trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});const n=[];let i=e.nextNode();while(i){if(i instanceof Text)n.push(i);i=e.nextNode()}return n}collectLiveTextNodesInRange(t){const e=this.editableRef?.nativeElement;if(!e)return[];const n=t.commonAncestorContainer instanceof Text?t.commonAncestorContainer.parentNode:t.commonAncestorContainer;if(!n)return[];const i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode:a=>{if(!(a instanceof Text))return NodeFilter.FILTER_REJECT;if(!String(a.textContent??"").replace(/\u200b/g,"").trim())return NodeFilter.FILTER_REJECT;if(!e.contains(a))return NodeFilter.FILTER_REJECT;try{return t.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch{return NodeFilter.FILTER_REJECT}}});const r=[];let o=i.nextNode();while(o){if(o instanceof Text)r.push(o);o=i.nextNode()}return r}unwrapMatchingElementsInNode(t,e){this.collectElements(t).filter(e).forEach(n=>this.unwrapElement(n))}removeStyleKindFromNode(t,e){const n=this.getStylePrefixes(e);this.collectElements(t).filter(i=>i instanceof HTMLSpanElement).forEach(i=>{n.forEach(r=>{Array.from(i.classList).filter(o=>o.startsWith(r)).forEach(o=>i.classList.remove(o))});if(i instanceof HTMLSpanElement&&i.classList.length===0&&!i.getAttribute("style"))this.unwrapElement(i)})}collectBlocksInRange(t){const e=this.editableRef?.nativeElement;if(!e)return[];const n=new Set;const i=this.findClosestBlock(t.startContainer);const r=this.findClosestBlock(t.endContainer);if(i)n.add(i);if(r)n.add(r);this.collectElements(e).forEach(l=>{if(!(l instanceof HTMLElement)||!T.has(l.tagName.toUpperCase()))return;try{if(t.intersectsNode(l))n.add(l)}catch{}});const o=Array.from(n).filter(l=>l!==e);if(o.length>0)return o.sort((l,d)=>l===d||l.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);const a=Array.from(e.children).find(l=>l instanceof HTMLElement&&T.has(l.tagName.toUpperCase()));return a?[a]:[]}findClosestBlock(t){const e=this.editableRef?.nativeElement;let n=t;while(n&&n!==e){if(n instanceof HTMLElement&&T.has(n.tagName.toUpperCase()))return n;n=n.parentNode}return null}replaceBlockTag(t,e){if(t.tagName.toLowerCase()===e.toLowerCase())return t;const n=document.createElement(e);Array.from(t.attributes).forEach(i=>{n.setAttribute(i.name,i.value)});while(t.firstChild)n.appendChild(t.firstChild);t.replaceWith(n);return n}replaceListItemWithParagraph(t){const e=document.createElement("p");while(t.firstChild)e.appendChild(t.firstChild);const n=t.parentElement;if(n?.parentNode)n.parentNode.insertBefore(e,n);else t.replaceWith(e);t.remove();return e}insertNodeRange(t,e){const n=e instanceof DocumentFragment?e.firstChild:e;const i=e instanceof DocumentFragment?e.lastChild:e;if(!n||!i)return null;t.insertNode(e);return this.createSelectionRange(n,i)}createSelectionRange(t,e){if(!t.parentNode||!e.parentNode)return null;const n=document.createRange();try{if(t===e&&t instanceof HTMLElement&&Mt.has(t.tagName.toUpperCase()))n.selectNodeContents(t);else{n.setStartBefore(t);n.setEndAfter(e)}return n}catch{try{n.setStartAfter(e);n.collapse(true);return n}catch{return null}}}collectElements(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);const n=[];let i=e.nextNode();while(i){if(i instanceof Element)n.push(i);i=e.nextNode()}return n}unwrapElement(t){const e=t.parentNode;if(!e)return null;let n=null;while(t.firstChild){const i=t.firstChild;e.insertBefore(i,t);n=i}e.removeChild(t);return n??e}findClosestClass(t,e){const n=this.editableRef?.nativeElement;let i=t;while(i&&i!==n){if(i instanceof HTMLElement){const r=Array.from(i.classList).find(o=>o.startsWith(e));if(r)return r}i=i.parentNode}return null}resolveAlignment(t){if(!t)return"left";if(t.classList.contains(P.justify))return"justify";if(t.classList.contains(P.center))return"center";if(t.classList.contains(P.right))return"right";return"left"}resolveLineHeight(t){const e=this.findClosestClass(t,z);if(!e)return"1.6";return Object.entries(V).find(([,n])=>n===e)?.[0]??Lt[e]??"1.6"}resolveFontValue(t){if(!t)return L;return Object.entries(nt).find(([,e])=>e===t)?.[0]??'"Segoe UI", Tahoma, Geneva, Verdana, sans-serif'}resolveSizeValue(t){if(!t)return"14";return Object.entries(rt).find(([,e])=>e===t)?.[0]??It[t]??"14"}getStylePrefixes(t){if(t==="font")return[Q];if(t==="size")return[B];if(t==="highlight")return[A];return[H]}removeInlineMarkAtCaret(t,e){const n=this.findClosestMarkTag(t.startContainer,e);if(!n)return null;return this.unwrapElementAtCaret(n,t)}removeStyleKindAtCaret(t,e){const n=this.findClosestStyledSpan(t.startContainer,e);if(!n)return null;return this.unwrapElementAtCaret(n,t)}findClosestStyledSpan(t,e){const n=this.editableRef?.nativeElement;const i=this.getStylePrefixes(e);let r=t;while(r&&r!==n){if(r instanceof HTMLSpanElement&&Array.from(r.classList).some(o=>i.some(a=>o.startsWith(a))))return r;r=r.parentNode}return null}getNativeInlineCommand(t){if(t==="strong")return"bold";if(t==="em")return"italic";if(t==="u")return"underline";if(t==="s")return"strikeThrough";if(t==="sub")return"subscript";if(t==="sup")return"superscript";return null}executeNativeCommandOnRange(t,e){this.focusEditor(true);this.applySelectionRange(e.cloneRange());try{document.execCommand?.(t,false)}catch{return null}const n=this.getSelectionRangeForEditor();return n&&this.isRangeInsideEditor(n)?n.cloneRange():e.cloneRange()}unwrapElementAtCaret(t,e){const n=document.createTextNode("​");e.cloneRange().insertNode(n);this.unwrapElement(t);const i=document.createRange();i.setStartBefore(n);i.collapse(true);n.parentNode?.removeChild(n);return i}replaceSelectionWithinSingleBlock(t,e,n){if(!t.parentNode)return null;const i=document.createRange();i.selectNodeContents(t);i.setEnd(e.startContainer,e.startOffset);const r=e.cloneRange();const o=document.createRange();o.selectNodeContents(t);o.setStart(e.endContainer,e.endOffset);const a=i.cloneContents();const l=r.cloneContents();const d=o.cloneContents();const c=t.parentNode;const b=this.hasMeaningfulContent(a)?this.createBlockCloneWithContent(t,a):null;const p=this.createBlockElementWithContent(n,l,t);const g=this.hasMeaningfulContent(d)?this.createBlockCloneWithContent(t,d):null;if(b)c.insertBefore(b,t);c.insertBefore(p,t);if(g)c.insertBefore(g,t);t.remove();return this.createSelectionRange(p,p)}createBlockCloneWithContent(t,e){const n=document.createElement(t.tagName.toLowerCase());Array.from(t.attributes).forEach(i=>{n.setAttribute(i.name,i.value)});n.appendChild(e);return n}createBlockElementWithContent(t,e,n){const i=document.createElement(t);if(n)Array.from(n.classList).filter(r=>r.startsWith("nvb-rt-align-")||r.startsWith("nvb-rt-leading-")).forEach(r=>i.classList.add(r));i.appendChild(e);return i}hasMeaningfulContent(t){if(String(t.textContent??"").replace(/\u200b/g,"").trim())return true;return Array.from(t.childNodes).some(e=>{if(e instanceof HTMLBRElement)return false;return e instanceof Element})}runWithSelection(t){if(this.readOnly())return;this.flushHistory();this.focusEditor(true);this.restoreSelection();t();this.enforceLtrContext();this.captureSelection();this.refreshToolbarState();this.syncActiveTableState();this.updateCounts();this.emitCurrentHtml();this.recordHistory()}focusEditor(t=false){if(!this.editableRef?.nativeElement)return;if(t)this.skipFocusSelectionSync=true;this.editableRef.nativeElement.focus();if(t)queueMicrotask(()=>{this.skipFocusSelectionSync=false})}captureSelection(){this.captureSelectionFromWindow()}restoreSelection(){if(!this.savedRange||!this.isRangeInsideEditor(this.savedRange))return;this.applySelectionRange(this.savedRange)}applySelectionRange(t){const e=this.getWritableSelection();if(!e)return;try{e.removeAllRanges();e.addRange(t)}catch{this.savedRange=null}}isRangeInsideEditor(t){const e=this.editableRef?.nativeElement;if(!e)return false;return e.contains(t.startContainer)&&e.contains(t.endContainer)}findSelectableMediaNode(t){const e=this.editableRef?.nativeElement;if(!e||!t)return null;const n=t.closest(".nvb-rt-media-node");if(n instanceof HTMLElement&&e.contains(n))return n;if(this.isMediaContentElement(t)&&e.contains(t))return this.ensureMediaWrapped(t);return null}ensureMediaWrapped(t){const e=t.closest(".nvb-rt-media-node");if(e instanceof HTMLElement)return e;const n=this.createMediaWrapper("center");t.replaceWith(n);n.appendChild(t);return n}isMediaContentElement(t){return Boolean(t&&["IMG","VIDEO","IFRAME"].includes(t.tagName.toUpperCase()))}getMediaContentElement(t){if(!t)return null;if(this.isMediaContentElement(t))return t;return t.querySelector("img, video, iframe")}selectMediaNode(t){if(this.readOnly()||this.minimalViewer()){this.clearSelectedMedia();return}this.selectedMediaNode?.classList.remove("nvb-rt-media-selected");this.selectedMediaNode=t;this.selectedMediaNode.classList.add("nvb-rt-media-selected");this.mediaSizePercent=this.resolveMediaWidthPercent(t);this.syncSelectedMediaState()}clearSelectedMedia(){this.selectedMediaNode?.classList.remove("nvb-rt-media-selected");this.selectedMediaNode=null;this.mediaOverlayTop=0;this.mediaOverlayLeft=0;this.mediaOverlayWidth=0;this.mediaOverlayBottom=0;this.mediaResizeHandleLeft=0;this.mediaResizeHandleTop=0}updateMediaDropCaret(t){const e=this.rootRef?.nativeElement;const n=this.editableRef?.nativeElement;if(!e||!n||!n.contains(t.startContainer)){this.clearMediaDropCaret();return}const i=this.resolveDropCaretRect(t);if(!i){this.clearMediaDropCaret();return}const r=e.getBoundingClientRect();this.mediaDropCaretLeft=i.left-r.left;this.mediaDropCaretTop=i.top-r.top;this.mediaDropCaretHeight=Math.max(i.height,18);this.showMediaDropCaret=true}clearMediaDropCaret(){this.showMediaDropCaret=false;this.mediaDropCaretLeft=0;this.mediaDropCaretTop=0;this.mediaDropCaretHeight=0}resolveDropCaretRect(t){const e=t.getBoundingClientRect();if(e.height>0)return{left:e.left,top:e.top,height:e.height};const n=t.startContainer;const i=t.startOffset;if(n.nodeType===Node.TEXT_NODE){const r=n;const o=r.data.length;if(o>0){const a=r.ownerDocument.createRange();if(i<o){a.setStart(r,i);a.setEnd(r,Math.min(i+1,o));const l=a.getBoundingClientRect();if(l.height>0)return{left:l.left,top:l.top,height:l.height}}if(i>0){a.setStart(r,Math.max(0,i-1));a.setEnd(r,i);const l=a.getBoundingClientRect();if(l.height>0)return{left:l.right,top:l.top,height:l.height}}}}if(n instanceof Element){const r=n.childNodes[i]??null;const o=i>0?n.childNodes[i-1]??null:null;if(r instanceof Element){const l=r.getBoundingClientRect();if(l.height>0)return{left:l.left,top:l.top,height:l.height}}if(o instanceof Element){const l=o.getBoundingClientRect();if(l.height>0)return{left:l.right,top:l.top,height:l.height}}const a=n.getBoundingClientRect();if(a.height>0)return{left:a.left,top:a.top,height:a.height}}return null}syncSelectedMediaState(){const t=this.rootRef?.nativeElement;const e=this.editableRef?.nativeElement;const n=this.selectedMediaNode;if(!t||!e||!n||!e.contains(n)){this.clearSelectedMedia();return}const i=this.getMediaContentElement(n)??n;const r=t.getBoundingClientRect();const o=i.getBoundingClientRect();this.mediaOverlayLeft=o.left-r.left;this.mediaOverlayTop=o.top-r.top;this.mediaOverlayWidth=o.width;this.mediaOverlayBottom=r.bottom-o.bottom;this.mediaResizeHandleLeft=o.right-r.left-10;this.mediaResizeHandleTop=o.bottom-r.top-10;this.mediaSizePercent=this.resolveMediaWidthPercent(n)}isSelectionInsideEditor(t){if(!t||t.rangeCount===0)return false;const e=this.editableRef?.nativeElement;if(!e)return false;const n=t.getRangeAt(0);return e.contains(n.startContainer)&&e.contains(n.endContainer)}applyTextAlignFallback(t){const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=this.editableRef.nativeElement;let i=e.anchorNode;while(i&&i!==n){if(i instanceof HTMLElement&&/^(P|DIV|LI|H1|H2|H3|H4|BLOCKQUOTE)$/i.test(i.tagName)){i.style.textAlign=t;return}i=i.parentNode}n.style.textAlign=t}insertLinkAtRange(t,e){const n=t.cloneRange();const i=this.findClosestAnchor(n.startContainer);const r=this.findClosestAnchor(n.endContainer);if(i&&i===r){this.applyAnchorAttributes(i,e);return this.createCursorRangeAfter(i)}const o=document.createElement("a");this.applyAnchorAttributes(o,e);if(n.collapsed){o.textContent=e;n.insertNode(o)}else try{n.surroundContents(o)}catch{const a=n.extractContents();o.appendChild(a);n.insertNode(o)}return this.createCursorRangeAfter(o)}insertImageAtRange(t,e,n=""){const i=document.createElement("img");i.src=e;i.alt=n;i.loading="lazy";i.width=240;i.classList.add("nvb-rt-image");const r=this.createMediaWrapper("center");r.appendChild(i);const o=t.cloneRange();if(!o.collapsed)o.deleteContents();o.insertNode(r);this.selectMediaNode(r);return this.createCursorRangeAfter(r)}createMediaWrapper(t="center"){const e=document.createElement("span");e.classList.add("nvb-rt-media-node");e.setAttribute("contenteditable","false");e.draggable=true;this.updateMediaAlignment(e,t);return e}updateMediaAlignment(t,e){t.classList.remove("nvb-rt-media-left","nvb-rt-media-center","nvb-rt-media-right","nvb-rt-media-justify");t.classList.add(`nvb-rt-media-${e}`);if(e==="justify")this.setMediaWidth(t,100)}updateSelectedMediaSize(t){if(!this.selectedMediaNode)return;const e=Math.max(20,Math.min(100,Math.round(t/5)*5));this.mediaSizePercent=e;this.setMediaWidth(this.selectedMediaNode,e);this.syncSelectedMediaState();this.emitCurrentHtml()}setMediaWidth(t,e){const n=this.getMediaContentElement(t);const i=this.editableRef?.nativeElement;if(!n||!i)return;const r=Math.max(20,Math.min(100,e));if(t.classList.contains("nvb-rt-media-justify")){n.setAttribute("width",String(i.clientWidth||640));return}const o=Math.max(120,Math.round((i.clientWidth||640)*(r/100)));n.setAttribute("width",String(o))}resolveMediaWidthPercent(t){const e=this.getMediaContentElement(t);const n=this.editableRef?.nativeElement;if(!e||!n)return 35;if(t.classList.contains("nvb-rt-media-justify"))return 100;const i=Number(e.getAttribute("width")??0)||e.clientWidth||240;const r=n.clientWidth||640;return Math.max(20,Math.min(100,Math.round(i/r*100)))}insertLink(t){const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0);const i=this.findClosestAnchor(n.startContainer);const r=this.findClosestAnchor(n.endContainer);if(i&&i===r){this.applyAnchorAttributes(i,t);const l=document.createRange();l.setStartAfter(i);l.collapse(true);e.removeAllRanges();e.addRange(l);return}const o=document.createElement("a");this.applyAnchorAttributes(o,t);if(n.collapsed){o.textContent=t;n.deleteContents();n.insertNode(o)}else try{n.surroundContents(o)}catch{const l=n.extractContents();o.appendChild(l);n.insertNode(o)}const a=document.createRange();a.setStartAfter(o);a.collapse(true);e.removeAllRanges();e.addRange(a)}captureSelectionAsCursorRange(){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0).cloneRange();if(!this.isRangeInsideEditor(e))return null;e.collapse(false);return e}createCursorRangeAfter(t){const e=document.createRange();e.setStartAfter(t);e.collapse(true);return e}applyAnchorAttributes(t,e){t.href=e;t.target="_blank";t.rel="noopener noreferrer";t.classList.add("nvb-rt-link");t.style.removeProperty("color");t.style.removeProperty("text-decoration");t.style.removeProperty("cursor")}findClosestAnchor(t){const e=this.editableRef?.nativeElement;let n=t;while(n&&n!==e){if(n instanceof HTMLAnchorElement)return n;n=n.parentNode}return null}removeLinkFromRange(t){const e=this.collectAnchorsInRange(t);if(e.length===0){const i=this.findClosestAnchor(t.commonAncestorContainer);if(i){const r=this.unwrapAnchor(i);if(r?.parentNode)return this.createCursorRangeAfter(r)}return null}let n=null;e.forEach(i=>{const r=this.unwrapAnchor(i);if(r)n=r});if(n?.parentNode)return this.createCursorRangeAfter(n);return null}collectAnchorsInRange(t){const e=this.editableRef?.nativeElement;if(!e)return[];const n=new Set;const i=this.findClosestAnchor(t.startContainer);const r=this.findClosestAnchor(t.endContainer);if(i)n.add(i);if(r)n.add(r);const o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{if(!(l instanceof HTMLAnchorElement))return NodeFilter.FILTER_SKIP;try{return t.intersectsNode(l)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}catch{return NodeFilter.FILTER_SKIP}}});let a=o.nextNode();while(a){if(a instanceof HTMLAnchorElement)n.add(a);a=o.nextNode()}return Array.from(n)}unwrapAnchor(t){const e=t.parentNode;if(!e)return null;let n=null;while(t.firstChild){const i=t.firstChild;e.insertBefore(i,t);n=i}e.removeChild(t);return n??e}toggleList(t){this.runWithRange(e=>this.toggleListAtRange(e,t))}applyListFallback(t){const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0);const i=String(n.toString()??"").replace(/\u200b/g,"").trim();if(!i)return;const r=document.createElement(t);const o=i.split(/\r?\n+/).map(l=>l.trim()).filter(Boolean);(o.length>0?o:[i]).forEach(l=>{const d=document.createElement("li");d.textContent=l;r.appendChild(d)});n.deleteContents();n.insertNode(r);const a=document.createRange();a.selectNodeContents(r);a.collapse(false);e.removeAllRanges();e.addRange(a)}isSelectionInsideTag(t){const e=window.getSelection();if(!e||!this.isSelectionInsideEditor(e))return false;let n=e.anchorNode;const i=this.editableRef.nativeElement;while(n&&n!==i){if(n instanceof HTMLElement&&n.tagName.toLowerCase()===t.toLowerCase())return true;n=n.parentNode}return false}refreshToolbarState(){const t=this.resolveWorkingRange()?.startContainer??this.editableRef?.nativeElement??null;this.isBold=Boolean(this.findClosestMarkTag(t,"strong"));this.isItalic=Boolean(this.findClosestMarkTag(t,"em"));this.isUnderline=Boolean(this.findClosestMarkTag(t,"u"));this.isStrike=Boolean(this.findClosestMarkTag(t,"s"));this.isInlineCode=Boolean(this.findClosestMarkTag(t,"code"))||Boolean(this.findClosestPre(t));this.isSubscript=Boolean(this.findClosestMarkTag(t,"sub"));this.isSuperscript=Boolean(this.findClosestMarkTag(t,"sup"));const e=this.findClosestBlock(t);this.isBlockquote=e?.tagName.toUpperCase()==="BLOCKQUOTE";this.align=this.resolveAlignment(e);this.lineHeight=this.resolveLineHeight(e);const n=String(e?.tagName??"P").toUpperCase();this.heading=["H1","H2","H3","H4"].includes(n)?n:"P";const i=this.findClosestClass(t,Q);this.font=this.resolveFontValue(i);const r=this.findClosestClass(t,B);this.size=this.resolveSizeValue(r);const o=this.findClosestClass(t,H);this.textColor=o?this.colorClassMap.get(o)??"#1f2937":J;const a=this.findClosestClass(t,A);this.isHighlighted=Boolean(a);if(a)this.highlightColor=this.highlightClassMap.get(a)??this.highlightColor;this.indentLevel=this.resolveIndentLevel(e);this.isTaskList=Boolean(e?.tagName.toUpperCase()==="LI"&&e.classList.contains("nvb-rt-task-item"))}enforceLtrContext(){const t=this.editableRef?.nativeElement;if(!t)return;this.normalizeEditorRootBlocks();t.setAttribute("dir","ltr");t.querySelectorAll("p, h1, h2, h3, h4, h5, h6, div, ul, ol, li, blockquote").forEach(e=>{e.setAttribute("dir","ltr")});this.decorateLists();this.decorateLinks()}decorateLinks(){const t=this.editableRef?.nativeElement;if(!t)return;t.querySelectorAll("a").forEach(e=>{const n=e.getAttribute("href");if(!n)return;this.applyAnchorAttributes(e,n)})}decorateLists(){}emitCurrentHtml(){this.htmlChange.emit(this.getCleanHtml())}normalizeInitialHtml(t){const e=String(t??"").trim();return e?e:"<p><br></p>"}syncIncomingHtml(t){const e=this.editableRef?.nativeElement;if(!e||this.isEditorFocused())return;const n=this.normalizeInitialHtml(this.markupSecurityService.sanitizeRichTextHtml(String(t??"")));if(e.innerHTML!==n){e.innerHTML=n;this.normalizeTables();this.normalizeEditorRootBlocks();this.enforceLtrContext();this.refreshToolbarState();this.updateCounts();this.resetHistory()}}normalizeEditorRootBlocks(){const t=this.editableRef?.nativeElement;if(!t)return;const e=Array.from(t.childNodes);let n=null;const i=r=>{if(n){this.prepareBlockForInlineAppend(n);return n}const o=r?this.findMergeTargetForStrayInlineNode(t,r):null;if(o instanceof HTMLParagraphElement){this.prepareBlockForInlineAppend(o);n=o;return n}n=document.createElement("p");n.setAttribute("dir","ltr");if(r)t.insertBefore(n,r);else t.appendChild(n);return n};e.forEach(r=>{if(r.parentNode!==t)return;if(r instanceof HTMLElement&&this.isTopLevelBlock(r)){n=this.canMergeStrayContentIntoBlock(r)?r:null;return}if(r instanceof Text){if(!String(r.textContent??"").trim()){if(n)n.appendChild(r);else r.remove();return}i(r).appendChild(r);return}if(r instanceof HTMLBRElement||r instanceof HTMLElement){i(r).appendChild(r);return}r.parentNode?.removeChild(r)});if(!t.childNodes.length){t.appendChild(this.createEmptyParagraph());return}if(this.needsSurroundingParagraph(t.firstElementChild))t.insertBefore(this.createEmptyParagraph(),t.firstElementChild);if(this.needsSurroundingParagraph(t.lastElementChild))t.appendChild(this.createEmptyParagraph())}isTopLevelBlock(t){const e=t.tagName.toUpperCase();return T.has(e)||et.has(e)}canMergeStrayContentIntoBlock(t){const e=t.tagName.toUpperCase();return e==="P"||e==="DIV"||e==="BLOCKQUOTE"||/^H[1-6]$/.test(e)}findMergeTargetForStrayInlineNode(t,e){let n=e.previousSibling;while(n){if(n instanceof HTMLElement&&this.isTopLevelBlock(n)&&this.canMergeStrayContentIntoBlock(n))return n;if(n instanceof Text&&String(n.textContent??"").trim())return null;n=n.previousSibling}return null}prepareBlockForInlineAppend(t){if(!(!String(t.textContent??"").replace(/\u200b/g,"").trim()&&Array.from(t.childNodes).every(e=>e instanceof HTMLBRElement||e instanceof Text&&!String(e.textContent??"").trim())))return;while(t.firstChild)t.removeChild(t.firstChild)}getCleanHtml(){const t=this.editableRef?.nativeElement?.innerHTML||"";if(!t.trim())return"";const e=new DOMParser().parseFromString(t,"text/html");e.querySelectorAll("script, style").forEach(i=>i.remove());e.querySelectorAll(`[${this.linkMarkerAttribute}]`).forEach(i=>i.remove());e.querySelectorAll("font").forEach(i=>{const r=e.createElement("span");const o=i.getAttribute("size");const a=i.getAttribute("color");const l=i.getAttribute("face");if(o){const d={"1":"10px","2":"12px","3":"14px","4":"16px","5":"20px","6":"28px","7":"36px"};if(d[o])r.style.fontSize=d[o]}if(a)r.style.color=a;if(l)r.style.fontFamily=l;while(i.firstChild)r.appendChild(i.firstChild);i.replaceWith(r)});e.querySelectorAll("*").forEach(i=>{i.removeAttribute("contenteditable");i.removeAttribute("aria-readonly");i.removeAttribute("data-placeholder");i.removeAttribute("data-nvb-rich-text-scope");i.classList.remove("nvb-rt-media-selected","nvb-rt-media-dragging","nvb-rt-table-active","nvb-rt-find-match");if(i.classList.length===0)i.removeAttribute("class");if(i.tagName.toLowerCase()!=="a"){i.removeAttribute("target");i.removeAttribute("rel")}});e.querySelectorAll("a").forEach(i=>{if(!String(i.textContent??"").replace(/\u200b/g,"").trim()&&i.childElementCount===0){i.remove();return}i.setAttribute("target","_blank");i.setAttribute("rel","noopener noreferrer")});e.querySelectorAll("span").forEach(i=>{if(!String(i.textContent??"").replace(/\u200b/g,"")&&i.childElementCount===0)i.remove()});let n=e.body.innerHTML.trim();n=n.replace(/\u200b/g,"");n=n.replace(/<p><br><\/p>/gi,"<br>");n=n.replace(/<p>([\s&nbsp;]*)<\/p>/gi,"<br>");n=n.replace(/<span style=\"\"><\/span>/gi,"");n=n.replace(/<span><\/span>/gi,"");return n}applyReadonlyState(){const t=this.editableRef?.nativeElement;if(!t)return;const e=this.readOnly();t.contentEditable=e?"false":"true";t.setAttribute("aria-readonly",e?"true":"false");t.spellcheck=!e;t.querySelectorAll(".nvb-rt-media-node").forEach(n=>{n.draggable=!e});if(e){this.showLinkPopup=false;this.closeAuxiliaryPopups();this.clearSelectedMedia();this.clearActiveTable()}}isEditorFocused(){const t=this.rootRef?.nativeElement;const e=this.editableRef?.nativeElement;if(!t||!e)return false;let n=document.activeElement;while(n?.shadowRoot?.activeElement)n=n.shadowRoot.activeElement;if(!n)return false;return n===e||t.contains(n)}updateLinkPopupPosition(){const t=this.rootRef?.nativeElement;const e=this.linkButtonRef?.nativeElement;if(!t||!e)return;const n=t.getBoundingClientRect();const i=e.getBoundingClientRect();const r=340;const o=12;let a=i.left-n.left;if(a+r>n.width-o)a=Math.max(o,n.width-r-o);this.linkPopupLeft=a;this.linkPopupTop=i.bottom-n.top+8}ensureEditableRange(){const t=this.editableRef?.nativeElement;if(!t)return null;this.normalizeEditorRootBlocks();let e=t.lastElementChild;if(!(e instanceof HTMLElement)||!this.canMergeStrayContentIntoBlock(e)){const i=this.createEmptyParagraph();t.appendChild(i);e=i}const n=document.createRange();n.selectNodeContents(e);n.collapse(false);this.savedRange=n.cloneRange();return n}needsSurroundingParagraph(t){if(!(t instanceof HTMLElement))return false;const e=t.tagName.toUpperCase();return e==="PRE"||e==="TABLE"||e==="HR"}resolveRootLevelNode(t){const e=this.editableRef?.nativeElement;if(!e)return null;let n=t;while(n&&n.parentNode&&n.parentNode!==e)n=n.parentNode;return n instanceof HTMLElement&&n.parentNode===e?n:null}clearHistoryTimer(){if(this.historyTimer!==null){clearTimeout(this.historyTimer);this.historyTimer=null}}resetHistory(){this.clearHistoryTimer();const t=this.captureHistoryEntry();this.historyStack=t?[t]:[];this.historyIndex=t?0:-1;this.lastHistoryStamp=0}captureHistoryEntry(){const t=this.editableRef?.nativeElement;if(!t)return null;const e=this.savedRange&&this.isRangeInsideEditor(this.savedRange)?this.savedRange:null;return{html:t.innerHTML,startPath:e?this.buildNodePath(e.startContainer):[],startOffset:e?e.startOffset:-1,endPath:e?this.buildNodePath(e.endContainer):[],endOffset:e?e.endOffset:-1}}recordHistory(t=false){if(this.isRestoringHistory||this.readOnly())return;const e=this.captureHistoryEntry();if(!e)return;const n=this.historyIndex>=0?this.historyStack[this.historyIndex]:null;if(n&&n.html===e.html){this.historyStack[this.historyIndex]=e;return}const i=Date.now();if(n&&t&&i-this.lastHistoryStamp<600){this.historyStack[this.historyIndex]=e;this.lastHistoryStamp=i;return}this.historyStack=this.historyStack.slice(0,this.historyIndex+1);this.historyStack.push(e);if(this.historyStack.length>120)this.historyStack.shift();this.historyIndex=this.historyStack.length-1;this.lastHistoryStamp=i}scheduleHistorySnapshot(){if(this.isRestoringHistory||this.readOnly())return;this.clearHistoryTimer();this.historyTimer=setTimeout(()=>{this.historyTimer=null;this.recordHistory(true);this.updateCounts()},300)}flushHistory(){if(this.historyTimer===null)return;this.clearHistoryTimer();this.recordHistory(true)}applyHistoryEntry(t){const e=this.editableRef?.nativeElement;if(!e||!t)return;this.isRestoringHistory=true;try{this.clearSelectedMedia();this.clearActiveTable();this.closeAuxiliaryPopups();e.innerHTML=t.html;this.enforceLtrContext();const n=this.resolveHistoryRange(t);this.focusEditor(true);if(n){this.savedRange=n.cloneRange();this.applySelectionRange(n)}this.refreshToolbarState();this.syncActiveTableState();this.updateCounts();this.emitCurrentHtml();this.emitCurrentHtmlCss()}finally{this.isRestoringHistory=false}}resolveHistoryRange(t){if(t.startOffset<0)return this.ensureEditableRange();const e=this.resolveNodeFromPath(t.startPath);const n=this.resolveNodeFromPath(t.endPath);if(!e||!n)return this.ensureEditableRange();const i=document.createRange();try{i.setStart(e,Math.min(t.startOffset,this.maxOffsetOf(e)));i.setEnd(n,Math.min(t.endOffset,this.maxOffsetOf(n)))}catch{return this.ensureEditableRange()}return this.isRangeInsideEditor(i)?i:this.ensureEditableRange()}maxOffsetOf(t){return t instanceof Text?t.length:t.childNodes.length}buildNodePath(t){const e=this.editableRef?.nativeElement;if(!e||!t||!e.contains(t))return[];const n=[];let i=t;while(i&&i!==e){const r=i.parentNode;if(!r)return[];n.unshift(Array.prototype.indexOf.call(r.childNodes,i));i=r}return n}resolveNodeFromPath(t){const e=this.editableRef?.nativeElement;if(!e)return null;let n=e;for(const i of t){const r=n.childNodes[i];if(!r)return null;n=r}return n}updateCounts(){const t=this.editableRef?.nativeElement;const e=String(t?.innerText??t?.textContent??"").replace(/\u200b/g,"");this.characterCount.set(e.replace(/\s+/g," ").trim().length);this.wordCount.set(e.split(/\s+/).filter(n=>n.length>0).length)}closeAuxiliaryPopups(){this.showHighlightPopup=false;this.showTablePicker=false;this.showSpecialCharacterPopup=false;this.showMediaPopup=false;this.showTableCellColorPopup=false;this.showFindPopup=false}positionPopupFromButton(t){const e=t.currentTarget??t.target;if(!e)return;const n=e.getBoundingClientRect();this.popupLeft=Math.max(4,Math.min(n.left,window.innerWidth-284));this.popupTop=n.bottom+6;this.keepPopupOnScreen()}keepPopupOnScreen(){const t=this.rootRef?.nativeElement;if(!t)return;queueMicrotask(()=>{const e=t.querySelector(".nvb-rich-text-editor__popup");if(!e)return;const n=e.getBoundingClientRect().height;if(this.popupTop+n+8-window.innerHeight>0)this.popupTop=Math.max(8,this.popupTop-n-40)})}preparePopup(t){t.preventDefault();t.stopPropagation();this.captureSelectionFromWindow();this.closeAuxiliaryPopups();this.showLinkPopup=false;this.positionPopupFromButton(t)}openHighlightPopup(t){if(this.readOnly())return;const e=this.showHighlightPopup;this.preparePopup(t);this.showHighlightPopup=!e}applyHighlight(t,e){if(this.readOnly())return;e?.preventDefault();e?.stopPropagation();this.showHighlightPopup=false;const n=String(t??"").trim();if(!n)return;this.highlightColor=n;this.runWithRange(i=>this.applyTextStyleToRange(i,"highlight",this.ensureHighlightClass(n)))}clearHighlight(t){if(this.readOnly())return;t?.preventDefault();t?.stopPropagation();this.showHighlightPopup=false;this.runWithRange(e=>this.applyTextStyleToRange(e,"highlight",null))}onHighlightColorInput(t){const e=t.target?.value??"";this.applyHighlight(e)}ensureHighlightClass(t){const e=String(t??"").trim().toLowerCase();if(!e)return`${A}default`;const n=e.replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"");const i=`${A}${n||"value"}`;this.highlightClassMap.set(i,e);return i}indent(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.shiftIndentAtRange(e,1))}outdent(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.shiftIndentAtRange(e,-1))}shiftIndentAtRange(t,e){const n=this.collectBlocksInRange(t);if(n.length===0)return t;const i=n.filter(r=>r instanceof HTMLLIElement);if(i.length===n.length&&i.length>0){if(i.map(r=>e>0?this.nestListItem(r):this.unnestListItem(r)).filter(Boolean).length>0)return this.createSelectionRange(i[0],i[i.length-1]);return t.cloneRange()}n.forEach(r=>{const o=this.resolveIndentLevel(r);const a=Math.max(0,Math.min(8,o+e));Array.from(r.classList).filter(l=>l.startsWith(D)).forEach(l=>r.classList.remove(l));if(a>0)r.classList.add(`${D}${a}`)});return t.cloneRange()}resolveIndentLevel(t){if(!t)return 0;const e=Array.from(t.classList).find(i=>i.startsWith(D));const n=Number(e?.slice(14)??0);return Number.isFinite(n)?Math.max(0,Math.min(8,n)):0}nestListItem(t){const e=t.previousElementSibling;const n=t.parentElement;if(!(e instanceof HTMLLIElement)||!n)return false;const i=Array.from(e.children).find(o=>o instanceof HTMLUListElement||o instanceof HTMLOListElement);const r=i??document.createElement(n.tagName.toLowerCase());if(!i){if(n instanceof HTMLUListElement&&n.classList.contains("nvb-rt-task-list"))r.classList.add(Y);e.appendChild(r)}r.appendChild(t);return true}unnestListItem(t){const e=t.parentElement;const n=e?.parentElement;if(!e||!(n instanceof HTMLLIElement)||!n.parentElement)return false;n.parentElement.insertBefore(t,n.nextSibling);if(!e.querySelector("li"))e.remove();return true}toggleTaskList(t){if(this.readOnly())return;if(t)this.prepareToolbarCommand(t);this.runWithRange(e=>this.toggleTaskListAtRange(e))}toggleTaskListAtRange(t){const e=this.collectBlocksInRange(t);if(e.length===0)return t;if(e.every(i=>i instanceof HTMLLIElement&&i.classList.contains("nvb-rt-task-item"))){const i=e.map(r=>this.replaceListItemWithParagraph(r));return this.createSelectionRange(i[0],i[i.length-1])}const n=this.toggleListAtRange(t,"ul")??t;this.collectBlocksInRange(n).filter(i=>i instanceof HTMLLIElement).forEach(i=>{i.classList.add(tt);i.parentElement?.classList.add(Y)});return n}toggleTaskItemFromClick(t){if(this.minimalViewer())return false;const e=t.target?.closest?.(`.${tt}`);if(!(e instanceof HTMLLIElement))return false;const n=e.getBoundingClientRect();if(t.clientX-n.left>26)return false;t.preventDefault();t.stopPropagation();if(this.readOnly())return true;this.flushHistory();e.classList.toggle(St);this.emitCurrentHtml();this.recordHistory();return true}exitEmptyTaskItem(){const t=this.resolveWorkingRange();const e=this.findClosestBlock(t?.startContainer??null);if(!(e instanceof HTMLLIElement)||!e.classList.contains("nvb-rt-task-item")||String(e.textContent??"").trim())return false;this.runWithRange(()=>{const n=this.replaceListItemWithParagraph(e);const i=document.createRange();i.selectNodeContents(n);i.collapse(true);return i});return true}openMediaPopup(t,e){if(this.readOnly())return;const n=this.showMediaPopup&&this.mediaKind===t;this.preparePopup(e);this.linkSelectionRange=this.resolveStoredLinkRange();this.mediaKind=t;this.mediaSource=t==="image"?"upload":"url";this.mediaUrl="";this.mediaAlt="";this.showMediaPopup=!n;if(this.showMediaPopup&&this.mediaSource==="url")queueMicrotask(()=>this.mediaUrlInputRef?.nativeElement?.focus())}closeMediaPopup(t){t?.preventDefault();t?.stopPropagation();this.showMediaPopup=false;this.mediaUrl="";this.mediaAlt=""}setMediaSource(t,e){e?.preventDefault();e?.stopPropagation();this.mediaSource=t;if(t==="upload"){this.imageInputRef?.nativeElement.click();return}queueMicrotask(()=>this.mediaUrlInputRef?.nativeElement?.focus())}onMediaUrlInput(t){this.mediaUrl=t.target?.value??""}onMediaAltInput(t){this.mediaAlt=t.target?.value??""}applyMediaFromPopup(t){t?.preventDefault();t?.stopPropagation();const e=String(this.mediaUrl??"").trim();if(!e){this.closeMediaPopup();return}const n=this.mediaKind;const i=String(this.mediaAlt??"").trim();const r=this.resolveStoredLinkRange()??this.linkSelectionRange;this.closeMediaPopup();const o=n==="image"&&/^data:image\/(png|jpe?g|gif|webp|avif|bmp)[;,]/i.test(e);const a=/^https?:/i.test(e)||o?e:`https://${e.replace(/^[a-z][\w+.-]*:\/*/i,"")}`;this.runWithRange(l=>{if(n==="image")return this.insertImageAtRange(l,a,i);if(n==="video")return this.insertVideoAtRange(l,a);return this.insertEmbedAtRange(l,a)},r)}insertVideoAtRange(t,e){if(this.resolveEmbedUrl(e))return this.insertEmbedAtRange(t,e);const n=document.createElement("video");n.src=e;n.controls=true;n.setAttribute("preload","metadata");n.classList.add("nvb-rt-video");return this.insertMediaNodeAtRange(t,n)}insertEmbedAtRange(t,e){const n=document.createElement("iframe");n.src=this.resolveEmbedUrl(e)??e;n.setAttribute("loading","lazy");n.setAttribute("allowfullscreen","true");n.setAttribute("frameborder","0");n.classList.add("nvb-rt-embed");return this.insertMediaNodeAtRange(t,n)}resolveEmbedUrl(t){const e=String(t??"").trim();const n=e.match(/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{6,})/i);if(n?.[1])return`https://www.youtube.com/embed/${n[1]}`;const i=e.match(/vimeo\.com\/(?:video\/)?(\d{5,})/i);if(i?.[1])return`https://player.vimeo.com/video/${i[1]}`;return null}insertMediaNodeAtRange(t,e){e.setAttribute("width","480");const n=this.createMediaWrapper("center");n.appendChild(e);const i=t.cloneRange();if(!i.collapsed)i.deleteContents();i.insertNode(n);this.selectMediaNode(n);return this.createCursorRangeAfter(n)}openSpecialCharacterPopup(t){if(this.readOnly())return;const e=this.showSpecialCharacterPopup;this.preparePopup(t);this.showSpecialCharacterPopup=!e}insertSpecialCharacter(t,e){if(this.readOnly())return;e?.preventDefault();e?.stopPropagation();this.showSpecialCharacterPopup=false;const n=String(t??"");if(!n)return;this.runWithRange(i=>{i.deleteContents();const r=document.createTextNode(n);i.insertNode(r);const o=document.createRange();o.setStartAfter(r);o.collapse(true);return o})}openFindPopup(t){if(this.readOnly())return;if(t){const e=this.showFindPopup;this.preparePopup(t);this.showFindPopup=!e}else{this.closeAuxiliaryPopups();const e=this.editableRef?.nativeElement?.getBoundingClientRect();this.popupLeft=Math.max(4,Math.min(e?.left??8,window.innerWidth-284));this.popupTop=(e?.top??8)+8;this.showFindPopup=true;this.keepPopupOnScreen()}this.findStatus="";this.findMatchIndex=-1;if(this.showFindPopup)queueMicrotask(()=>this.findInputRef?.nativeElement?.focus())}closeFindPopup(t){t?.preventDefault();t?.stopPropagation();this.showFindPopup=false;this.findStatus="";this.findMatchIndex=-1}onFindQueryInput(t){this.findQuery=t.target?.value??"";this.findMatchIndex=-1;this.findStatus=""}onReplaceValueInput(t){this.replaceValue=t.target?.value??""}toggleFindMatchCase(t){t?.preventDefault();t?.stopPropagation();this.findMatchCase=!this.findMatchCase;this.findMatchIndex=-1}findNext(t,e=false){t?.preventDefault();t?.stopPropagation();const n=this.collectFindMatches();if(n.length===0){this.findStatus=this.uiTranslationService.translate("richText.findNoMatches","No matches");this.findMatchIndex=-1;return}const i=e?-1:1;this.findMatchIndex=(this.findMatchIndex+i+n.length*2)%n.length;this.selectFindMatch(n[this.findMatchIndex]);this.findStatus=`${this.findMatchIndex+1} / ${n.length}`}findPrevious(t){this.findNext(t,true)}replaceCurrent(t){t?.preventDefault();t?.stopPropagation();if(this.readOnly())return;const e=this.collectFindMatches();if(e.length===0){this.findStatus=this.uiTranslationService.translate("richText.findNoMatches","No matches");return}const n=this.findMatchIndex>=0?this.findMatchIndex%e.length:0;this.flushHistory();this.applyReplacement(e[n]);this.findMatchIndex=n-1;this.afterFindMutation();this.findNext()}replaceAll(t){t?.preventDefault();t?.stopPropagation();if(this.readOnly())return;const e=this.collectFindMatches();if(e.length===0){this.findStatus=this.uiTranslationService.translate("richText.findNoMatches","No matches");return}this.flushHistory();e.slice().reverse().forEach(n=>this.applyReplacement(n));this.findMatchIndex=-1;this.afterFindMutation();this.findStatus=`${e.length}`}afterFindMutation(){this.enforceLtrContext();this.refreshToolbarState();this.updateCounts();this.emitCurrentHtml();this.recordHistory()}collectFindMatches(){const t=this.editableRef?.nativeElement;const e=String(this.findQuery??"");if(!t||!e)return[];const n=[];this.collectTextNodes(t).forEach(i=>{const r=this.findMatchCase?i.data:i.data.toLowerCase();const o=this.findMatchCase?e:e.toLowerCase();let a=r.indexOf(o);while(a!==-1){n.push({node:i,start:a,end:a+o.length});a=r.indexOf(o,a+o.length)}});return n}selectFindMatch(t){const e=document.createRange();try{e.setStart(t.node,t.start);e.setEnd(t.node,t.end)}catch{return}this.savedRange=e.cloneRange();this.focusEditor(true);this.applySelectionRange(e);(t.node.parentElement??null)?.scrollIntoView?.({block:"nearest"})}applyReplacement(t){const e=String(this.replaceValue??"");const n=t.node.data;t.node.data=`${n.slice(0,t.start)}${e}${n.slice(t.end)}`}toggleSourceMode(t){if(this.readOnly())return;t?.preventDefault();t?.stopPropagation();if(this.isSourceMode){this.applySourceDraft();return}this.closeAuxiliaryPopups();this.clearSelectedMedia();this.clearActiveTable();this.sourceDraft=this.getCleanHtml();this.isSourceMode=true;queueMicrotask(()=>this.sourceTextareaRef?.nativeElement?.focus())}onSourceInput(t){this.sourceDraft=t.target?.value??""}applySourceDraft(){const t=this.editableRef?.nativeElement;this.isSourceMode=false;if(!t)return;this.flushHistory();t.innerHTML=this.normalizeInitialHtml(this.markupSecurityService.sanitizeRichTextHtml(this.sourceDraft));this.normalizeTables();this.normalizeEditorRootBlocks();this.enforceLtrContext();this.savedRange=null;this.refreshToolbarState();this.updateCounts();this.emitCurrentHtml();this.emitCurrentHtmlCss();this.recordHistory()}openTablePicker(t){if(this.readOnly())return;const e=this.showTablePicker;this.preparePopup(t);this.tablePickerRows=0;this.tablePickerColumns=0;this.showTablePicker=!e}onTablePickerHover(t,e){this.tablePickerRows=t+1;this.tablePickerColumns=e+1}onTablePickerLeave(){this.tablePickerRows=0;this.tablePickerColumns=0}toggleTablePickerHeader(t){t?.preventDefault();t?.stopPropagation();this.tablePickerWithHeader=!this.tablePickerWithHeader}confirmTablePicker(t,e,n){n?.preventDefault();n?.stopPropagation();this.showTablePicker=false;this.insertTable(t+1,e+1)}insertTable(t=3,e=3){if(this.readOnly())return;const n=this.tablePickerWithHeader;this.runWithRange(i=>this.insertTableAtRange(i,t,e,n))}insertTableAtRange(t,e,n,i){const r=this.editableRef?.nativeElement;if(!r)return null;const o=be(e,n,i);const a=this.createEmptyParagraph();const l=this.resolveRootLevelNode(t.startContainer);if(l){l.insertAdjacentElement("afterend",o);o.insertAdjacentElement("afterend",a);if(l instanceof HTMLParagraphElement&&!String(l.textContent??"").trim())l.remove()}else{r.appendChild(o);r.appendChild(a)}const d=o.querySelector("td, th");if(!d)return null;W(d);const c=document.createRange();c.selectNodeContents(d.firstElementChild??d);c.collapse(true);return c}runTableCommand(t,e){if(this.readOnly())return;e?.preventDefault();e?.stopPropagation();const n=this.editableRef?.nativeElement;const i=this.activeTable;const r=this.activeTableCell;if(!n||!i||!r||!n.contains(r))return;this.flushHistory();const o=R(m(i),r);const a=t(i,r)??null;const l=(a&&n.contains(a)?a:null)??(n.contains(r)?r:null)??this.resolveCellAtSlot(i,o?.row??0,o?.column??0);this.normalizeEditorRootBlocks();this.enforceLtrContext();if(l)this.placeCaretInCell(l);else{const d=this.ensureEditableRange();if(d){this.focusEditor(true);this.applySelectionRange(d)}}this.refreshToolbarState();this.syncActiveTableState();this.updateCounts();this.emitCurrentHtml();this.recordHistory()}addTableRow(t,e){this.runTableCommand((n,i)=>we(n,i,t),e)}addTableColumn(t,e){this.runTableCommand((n,i)=>xe(n,i,t),e)}removeTableRow(t){this.runTableCommand((e,n)=>ye(e,n),t)}removeTableColumn(t){this.runTableCommand((e,n)=>_e(e,n),t)}removeTable(t){this.runTableCommand(e=>{e.remove();return null},t)}mergeCells(t,e){this.runTableCommand((n,i)=>{Ce(n,i,t);return i},e)}splitCell(t,e){this.runTableCommand((n,i)=>{Te(n,i,t);return i},e)}toggleHeaderRow(t){this.runTableCommand(e=>{Se(e);return null},t)}resolveCellAtSlot(t,e,n){const i=this.editableRef?.nativeElement;if(!i||!i.contains(t))return null;const r=m(t);const o=Math.max(0,Math.min(e,r.length-1));const a=Math.max(0,Math.min(n,k(r)-1));return r[o]?.[a]?.cell??null}toggleHeaderColumn(t){this.runTableCommand(e=>{Re(e);return null},t)}setTableBorderStyle(t,e){this.runTableCommand((n,i)=>{Ee(n,t);return i},e)}setCellVerticalAlign(t,e){this.runTableCommand((n,i)=>{Me(i,t);return i},e)}openTableCellColorPopup(t){t.preventDefault();t.stopPropagation();this.showTableCellColorPopup=!this.showTableCellColorPopup}applyTableCellColor(t,e){this.showTableCellColorPopup=false;this.runTableCommand((n,i)=>{Le(i,t);return i},e)}placeCaretInCell(t){W(t);const e=t.firstElementChild??t;const n=document.createRange();n.selectNodeContents(e);n.collapse(true);this.savedRange=n.cloneRange();this.focusEditor(true);this.applySelectionRange(n)}moveToAdjacentTableCell(t){const e=this.editableRef?.nativeElement;const n=Ot(this.resolveWorkingRange()?.startContainer??null,e??null);const i=n?U(n,e??null):null;if(!e||!n||!i)return false;const r=Array.from(i.querySelectorAll("td, th")).filter(l=>U(l,e)===i);const o=r.indexOf(n);if(o===-1)return false;const a=o+(t?-1:1);if(a<0)return true;if(a>=r.length){this.activeTable=i;this.activeTableCell=n;this.addTableRow("below");return true}this.placeCaretInCell(r[a]);this.refreshToolbarState();this.syncActiveTableState();return true}clearActiveTable(){this.activeTable?.classList.remove("nvb-rt-table-active");this.activeTable=null;this.activeTableCell=null;this.tableColumnHandles=[];this.showTableCellColorPopup=false}syncActiveTableState(){const t=this.editableRef?.nativeElement;const e=this.rootRef?.nativeElement;if(!t||!e||this.readOnly()||this.isSourceMode){this.clearActiveTable();return}const n=Ot((this.savedRange&&this.isRangeInsideEditor(this.savedRange)?this.savedRange:null)?.startContainer??null,t);const i=n?U(n,t):null;if(!n||!i){this.clearActiveTable();return}if(this.activeTable&&this.activeTable!==i)this.activeTable.classList.remove("nvb-rt-table-active");this.activeTable=i;this.activeTableCell=n;i.classList.add("nvb-rt-table-active");const r=e.getBoundingClientRect();const o=i.getBoundingClientRect();const a=t.getBoundingClientRect();this.tableOverlayLeft=Math.max(4,Math.min(o.left,window.innerWidth-300));const l=o.top-38;this.tableOverlayTop=l>=a.top?l:o.bottom+6;this.tableBorder=ke(i);this.tableCellVerticalAlign=Ie(n);this.hasTableHeaderRow=$t(i);this.hasTableHeaderColumn=Ft(i);this.canMergeRight=Bt(i,n,"right");this.canMergeDown=Bt(i,n,"down");this.canSplitHorizontally=st(n,"horizontal");this.canSplitVertically=st(n,"vertical");this.tableColumnHandles=this.buildTableColumnHandles(i,r,o)}buildTableColumnHandles(t,e,n){const i=m(t);const r=k(i);if(r<2)return[];const o=i[0]??[];const a=[];let l=0;for(let d=0;d<r-1;d+=1){const c=o[d];if(!c)continue;l=c.cell.getBoundingClientRect().right;if(c.column+c.columnSpan-1!==d)continue;a.push({index:d,left:l-e.left-2,top:n.top-e.top,height:n.height})}return a}startTableColumnResize(t,e){if(this.readOnly()||!this.activeTable)return;e.preventDefault();e.stopPropagation();this.flushHistory();this.isTableColumnResizing=true;this.tableResizeColumnIndex=t;this.tableResizeStartX=e.clientX;this.tableResizeStartWidths=ge(this.activeTable);this.tableResizeTableWidth=Math.max(1,this.activeTable.getBoundingClientRect().width)}updateTableColumnResize(t){const e=this.activeTable;const n=this.tableResizeColumnIndex;if(!e||n<0||n>=this.tableResizeStartWidths.length-1)return;const i=(t.clientX-this.tableResizeStartX)/this.tableResizeTableWidth*100;const r=this.tableResizeStartWidths.slice();const o=r[n]+r[n+1];const a=Math.max(5,Math.min(o-5,r[n]+i));r[n]=a;r[n+1]=o-a;me(e,r);this.syncActiveTableState()}normalizeTables(){const t=this.editableRef?.nativeElement;if(!t)return;t.querySelectorAll("table").forEach(e=>{Vt(e)})}onWindowResize(){this.syncSelectedMediaState();this.syncActiveTableState()}onDocumentMouseMove(t){if(this.isTableColumnResizing){this.updateTableColumnResize(t);return}if(!this.isMediaResizeDragging||!this.selectedMediaNode)return;const e=this.editableRef?.nativeElement;if(!e)return;const n=(t.clientX-this.mediaResizeStartX)/Math.max(e.clientWidth||1,1)*100;this.updateSelectedMediaSize(this.mediaResizeStartPercent+n)}onDocumentMouseUp(){this.isMediaResizeDragging=false;if(this.isTableColumnResizing){this.isTableColumnResizing=false;this.tableResizeColumnIndex=-1;this.syncActiveTableState();this.emitCurrentHtml();this.recordHistory()}}onDocumentDragOver(t){if(!this.draggingMediaNode||this.readOnly()||!this.isPointInsideEditor(t.clientX,t.clientY))return;this.handleMediaDragOver(t)}onDocumentDrop(t){if(!this.draggingMediaNode||this.readOnly()||!this.isPointInsideEditor(t.clientX,t.clientY))return;this.handleMediaDrop(t)}handleMediaDragOver(t){if(!this.draggingMediaNode||this.readOnly())return;t.preventDefault();if(t.dataTransfer)t.dataTransfer.dropEffect="move";const e=this.resolveMediaDropRange(t,this.draggingMediaNode);if(!e||!this.editableRef?.nativeElement.contains(e.startContainer)||this.draggingMediaNode.contains(e.startContainer)){this.pendingMediaDropRange=null;this.clearMediaDropCaret();return}this.pendingMediaDropRange=e.cloneRange();this.updateMediaDropCaret(e)}handleMediaDrop(t){const e=this.draggingMediaNode;const n=this.editableRef?.nativeElement;if(!e||!n||this.readOnly())return;t.preventDefault();t.stopPropagation();let i=this.pendingMediaDropRange?.cloneRange()??this.resolveMediaDropRange(t,e);if(!i||!n.contains(i.startContainer)){this.onEditorDragEnd();return}if(e.contains(i.startContainer)){this.onEditorDragEnd();return}i=i.cloneRange();i.collapse(true);e.remove();i.insertNode(e);this.selectMediaNode(e);const r=this.createCursorRangeAfter(e)??i;this.enforceLtrContext();this.savedRange=r.cloneRange();this.applySelectionRange(r);this.refreshToolbarState();this.emitCurrentHtml();this.onEditorDragEnd()}resolveMediaDropRange(t,e){const n=this.editableRef?.nativeElement;if(!n)return null;const i=this.resolvePointTarget(t.clientX,t.clientY)??t.target;const r=this.findSelectableMediaNode(i);if(r&&r!==e){const l=n.ownerDocument.createRange();const d=r.getBoundingClientRect();if(t.clientY<d.top+d.height/2||t.clientX<d.left+d.width/2)l.setStartBefore(r);else l.setStartAfter(r);l.collapse(true);return l}const o=this.createDropRangeFromPoint(t.clientX,t.clientY);if(o&&n.contains(o.startContainer)&&!e.contains(o.startContainer))return o;const a=(i?this.findClosestBlock(i):null)??this.resolveNearestBlockFromPoint(t.clientX,t.clientY);if(a){const l=this.resolveTextDropRange(a,t.clientX,t.clientY);if(l)return l;const d=n.ownerDocument.createRange();const c=a.getBoundingClientRect();if(t.clientY<c.top+c.height/2)d.setStartBefore(a);else d.setStartAfter(a);d.collapse(true);return d}return this.resolveEdgeDropRange(t.clientX,t.clientY)}createDropRangeFromPoint(t,e){const n=this.editableRef?.nativeElement;if(!n)return null;const i=n.ownerDocument;if(typeof i.caretRangeFromPoint==="function")return i.caretRangeFromPoint(t,e);if(typeof i.caretPositionFromPoint==="function"){const r=i.caretPositionFromPoint(t,e);if(!r)return null;const o=i.createRange();o.setStart(r.offsetNode,r.offset);o.collapse(true);return o}return null}resolvePointTarget(t,e){const n=this.editableRef?.nativeElement;const i=this.rootRef?.nativeElement.ownerDocument;if(!n||!i)return null;const r=i.elementFromPoint(t,e);if(r instanceof HTMLElement&&n.contains(r))return r;return null}isPointInsideEditor(t,e){const n=this.editableRef?.nativeElement;if(!n)return false;const i=n.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}resolveNearestBlockFromPoint(t,e){const n=this.editableRef?.nativeElement;if(!n)return null;const i=Array.from(n.children).filter(a=>a instanceof HTMLElement&&T.has(a.tagName.toUpperCase()));if(i.length===0)return null;let r=null;let o=Number.POSITIVE_INFINITY;i.forEach(a=>{const l=a.getBoundingClientRect();const d=l.left+l.width/2;const c=l.top+l.height/2;const b=Math.abs(c-e)*3+Math.abs(d-t);if(b<o){o=b;r=a}});return r}resolveTextDropRange(t,e,n){const i=t.ownerDocument;const r=i.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:b=>{if(!String(b.data??"").replace(/\u200b/g,"").length)return NodeFilter.FILTER_REJECT;return NodeFilter.FILTER_ACCEPT}});let o=null;let a=0;let l=Number.POSITIVE_INFINITY;let d=r.nextNode();while(d){const b=d;const p=b.data??"";for(let g=0;g<=p.length;g+=1){const x=this.measureTextBoundary(b,g);if(!x)continue;const I=(n>=x.top-4&&n<=x.bottom+4?0:Math.abs(x.centerY-n)*4)+Math.abs(x.x-e);if(I<l){l=I;o=b;a=g}}d=r.nextNode()}if(o){const b=i.createRange();b.setStart(o,a);b.collapse(true);return b}const c=i.createRange();c.selectNodeContents(t);c.collapse(n<=t.getBoundingClientRect().top+t.getBoundingClientRect().height/2);return c}measureTextBoundary(t,e){const n=t.ownerDocument;const i=t.data.length;if(i===0)return null;const r=n.createRange();if(e<i){r.setStart(t,e);r.setEnd(t,Math.min(e+1,i));const o=r.getBoundingClientRect();if(o.width>0||o.height>0)return{x:o.left,top:o.top,bottom:o.bottom,centerY:o.top+o.height/2}}if(e>0){r.setStart(t,Math.max(0,e-1));r.setEnd(t,e);const o=r.getBoundingClientRect();if(o.width>0||o.height>0)return{x:o.right,top:o.top,bottom:o.bottom,centerY:o.top+o.height/2}}return null}resolveEdgeDropRange(t,e){const n=this.editableRef?.nativeElement;if(!n)return null;const i=Array.from(n.childNodes).filter(c=>{if(c instanceof Text)return String(c.textContent??"").trim().length>0;return true});const r=n.ownerDocument.createRange();if(i.length===0){r.selectNodeContents(n);r.collapse(true);return r}const o=i[0];const a=i[i.length-1];const l=o instanceof Element?o.getBoundingClientRect():null;const d=a instanceof Element?a.getBoundingClientRect():null;if(l&&(e<l.top||e<=l.bottom&&t<=l.left)){r.setStartBefore(o);r.collapse(true);return r}if(d&&(e>d.bottom||e>=d.top&&t>=d.right)){r.setStartAfter(a);r.collapse(true);return r}r.selectNodeContents(n);r.collapse(false);return r}onDocumentSelectionChange(){if(this.showLinkPopup)return;this.captureSelectionFromWindow()}onDocumentMouseDown(t){const e=t.target;const n=this.toolbarRef?.nativeElement;const i=this.linkPopupRef?.nativeElement;const r=this.editableRef?.nativeElement;const o=this.rootRef?.nativeElement;const a=e&&(n?.contains(e)||i?.contains(e)||r?.contains(e)||Boolean(o?.contains(e)));if(this.showLinkPopup&&!a)this.closeLinkPopup();if(!a)this.closeAuxiliaryPopups();if(this.selectedMediaNode&&!a)this.clearSelectedMedia();if(this.activeTableCell&&!a)this.clearActiveTable()}static ɵfac=h.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:ht,deps:[],target:h.ɵɵFactoryTarget.Component});static ɵcmp=h.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.2.1",type:ht,isStandalone:true,selector:"nvb-rich-text-editor-core",inputs:{html:{classPropertyName:"html",publicName:"html",isSignal:true,isRequired:false,transformFunction:null},htmlCss:{classPropertyName:"htmlCss",publicName:"htmlCss",isSignal:true,isRequired:false,transformFunction:null},readOnly:{classPropertyName:"readOnly",publicName:"readOnly",isSignal:true,isRequired:false,transformFunction:null},showToolbar:{classPropertyName:"showToolbar",publicName:"showToolbar",isSignal:true,isRequired:false,transformFunction:null},emitOnInput:{classPropertyName:"emitOnInput",publicName:"emitOnInput",isSignal:true,isRequired:false,transformFunction:null},placeholder:{classPropertyName:"placeholder",publicName:"placeholder",isSignal:true,isRequired:false,transformFunction:null},minimalViewer:{classPropertyName:"minimalViewer",publicName:"minimalViewer",isSignal:true,isRequired:false,transformFunction:null},showWordCount:{classPropertyName:"showWordCount",publicName:"showWordCount",isSignal:true,isRequired:false,transformFunction:null},enabledTools:{classPropertyName:"enabledTools",publicName:"enabledTools",isSignal:true,isRequired:false,transformFunction:null},testId:{classPropertyName:"testId",publicName:"testId",isSignal:true,isRequired:false,transformFunction:null}},outputs:{htmlChange:"htmlChange",htmlCssChange:"htmlCssChange",editorFocus:"editorFocus",editorBlur:"editorBlur"},host:{listeners:{"window:resize":"onWindowResize()","document:mousemove":"onDocumentMouseMove($event)","document:mouseup":"onDocumentMouseUp()","document:dragover":"onDocumentDragOver($event)","document:drop":"onDocumentDrop($event)","document:selectionchange":"onDocumentSelectionChange()","document:mousedown":"onDocumentMouseDown($event)"}},viewQueries:[{propertyName:"rootRef",first:true,predicate:["rootRef"],descendants:true,static:true},{propertyName:"editableRef",first:true,predicate:["editableRef"],descendants:true,static:true},{propertyName:"toolbarRef",first:true,predicate:["toolbarRef"],descendants:true},{propertyName:"imageInputRef",first:true,predicate:["imageInputRef"],descendants:true},{propertyName:"linkPopupRef",first:true,predicate:["linkPopupRef"],descendants:true},{propertyName:"linkButtonRef",first:true,predicate:["linkButtonRef"],descendants:true},{propertyName:"linkUrlInputRef",first:true,predicate:["linkUrlInputRef"],descendants:true},{propertyName:"mediaUrlInputRef",first:true,predicate:["mediaUrlInputRef"],descendants:true},{propertyName:"findInputRef",first:true,predicate:["findInputRef"],descendants:true},{propertyName:"sourceTextareaRef",first:true,predicate:["sourceTextareaRef"],descendants:true}],ngImport:h,template:"<section\n #rootRef\n class=\"nvb-rich-text-editor\"\n [class.nvb-rich-text-editor--minimal-viewer]=\"minimalViewer() && readOnly()\"\n data-testid=\"rich-text-editor-root\"\n>\n @if (showToolbar() && hasAnyToolbarTool()) {\n <div\n #toolbarRef\n class=\"nvb-rich-text-editor__toolbar\"\n role=\"toolbar\"\n [attr.aria-label]=\"'richText.toolbar' | uiT: 'Formatting'\"\n >\n @if (hasAnyTool('undo', 'redo')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('undo')) {\n <button [attr.data-testid]=\"tid('undo')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly() || !canUndo()\"\n title=\"{{ 'richText.undo' | uiT: 'Undo' }}\"\n (mousedown)=\"undo($event)\"\n >\n <nvb-icon [svg]=\"undoIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('redo')) {\n <button [attr.data-testid]=\"tid('redo')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly() || !canRedo()\"\n title=\"{{ 'richText.redo' | uiT: 'Redo' }}\"\n (mousedown)=\"redo($event)\"\n >\n <nvb-icon [svg]=\"redoIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('heading', 'font', 'size')) {\n <div\n class=\"nvb-rich-text-editor__toolbar-group nvb-rich-text-editor__toolbar-group--selects\"\n >\n @if (isToolEnabled('heading')) {\n <nvb-select [testId]=\"tid('heading-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--heading nvb-select--fit-content\"\n [value]=\"heading\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onHeadingChange($event)\"\n >\n @for (option of headingOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.key | uiT: option.fallback }}</option>\n }\n </nvb-select>\n }\n\n @if (isToolEnabled('font')) {\n <nvb-select [testId]=\"tid('font-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--font nvb-select--fit-content\"\n [value]=\"font\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onFontChange($event)\"\n >\n @for (option of fontOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.key | uiT: option.fallback }}</option>\n }\n </nvb-select>\n }\n\n @if (isToolEnabled('size')) {\n <nvb-select [testId]=\"tid('size-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--size nvb-select--fit-content\"\n [value]=\"size\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onSizeChange($event)\"\n >\n @for (option of sizeOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.label }}</option>\n }\n </nvb-select>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (isToolEnabled('lineHeight')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n <nvb-icon\n class=\"nvb-rich-text-editor__select-icon\"\n [svg]=\"lineSpacingIconSvg\"\n [attr.title]=\"'richText.lineHeight' | uiT: 'Line spacing'\"\n ></nvb-icon>\n <nvb-select [testId]=\"tid('line-height')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--line-height nvb-select--fit-content\"\n [value]=\"lineHeight\"\n [disabled]=\"readOnly()\"\n [attr.aria-label]=\"'richText.lineHeight' | uiT: 'Line spacing'\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onLineHeightChange($event)\"\n >\n @for (option of lineHeightOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.label }}</option>\n }\n </nvb-select>\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('inlineCode', 'subscript', 'superscript')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('inlineCode')) {\n <button [attr.data-testid]=\"tid('inline-code')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isInlineCode\"\n title=\"{{ 'richText.inlineCode' | uiT: 'Inline code' }}\"\n (mousedown)=\"toggleTag('code', $event)\"\n >\n <nvb-icon [svg]=\"inlineCodeIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('subscript')) {\n <button [attr.data-testid]=\"tid('subscript')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSubscript\"\n title=\"{{ 'richText.subscript' | uiT: 'Subscript' }}\"\n (mousedown)=\"toggleTag('sub', $event)\"\n >\n <nvb-icon [svg]=\"subscriptIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('superscript')) {\n <button [attr.data-testid]=\"tid('superscript')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSuperscript\"\n title=\"{{ 'richText.superscript' | uiT: 'Superscript' }}\"\n (mousedown)=\"toggleTag('sup', $event)\"\n >\n <nvb-icon [svg]=\"superscriptIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('bold', 'italic', 'underline', 'strikeThrough')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('bold')) {\n <button [attr.data-testid]=\"tid('bold')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isBold\"\n title=\"{{ 'richText.bold' | uiT: 'Bold' }}\"\n (mousedown)=\"toggleInline('bold', $event)\"\n >\n <nvb-icon [svg]=\"boldIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('italic')) {\n <button [attr.data-testid]=\"tid('italic')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isItalic\"\n title=\"{{ 'richText.italic' | uiT: 'Italic' }}\"\n (mousedown)=\"toggleInline('italic', $event)\"\n >\n <nvb-icon [svg]=\"italicIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('underline')) {\n <button [attr.data-testid]=\"tid('underline')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isUnderline\"\n title=\"{{ 'richText.underline' | uiT: 'Underline' }}\"\n (mousedown)=\"toggleInline('underline', $event)\"\n >\n <nvb-icon [svg]=\"underlineIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('strikeThrough')) {\n <button [attr.data-testid]=\"tid('strike-through')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isStrike\"\n title=\"{{ 'richText.strikeThrough' | uiT: 'Strikethrough' }}\"\n (mousedown)=\"toggleInline('strikeThrough', $event)\"\n >\n <nvb-icon [svg]=\"strikeIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('orderedList', 'unorderedList')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('orderedList')) {\n <button [attr.data-testid]=\"tid('ordered-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.orderedList' | uiT: 'Ordered list' }}\"\n (mousedown)=\"insertOrderedList($event)\"\n >\n <nvb-icon name=\"lists\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('unorderedList')) {\n <button [attr.data-testid]=\"tid('unordered-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.unorderedList' | uiT: 'Unordered list' }}\"\n (mousedown)=\"insertUnorderedList($event)\"\n >\n <nvb-icon name=\"format_list_bulleted\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('taskList')) {\n <button [attr.data-testid]=\"tid('task-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isTaskList\"\n title=\"{{ 'richText.taskList' | uiT: 'Task list' }}\"\n (mousedown)=\"toggleTaskList($event)\"\n >\n <nvb-icon [svg]=\"taskListIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n }\n\n @if (hasAnyTool('outdent', 'indent')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('outdent')) {\n <button [attr.data-testid]=\"tid('outdent')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.outdent' | uiT: 'Decrease indent' }}\"\n (mousedown)=\"outdent($event)\"\n >\n <nvb-icon [svg]=\"outdentIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('indent')) {\n <button [attr.data-testid]=\"tid('indent')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.indent' | uiT: 'Increase indent' }}\"\n (mousedown)=\"indent($event)\"\n >\n <nvb-icon [svg]=\"indentIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n }\n\n @if (hasAnyTool('blockquote', 'horizontalRule', 'textColor')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('blockquote')) {\n <button [attr.data-testid]=\"tid('blockquote')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isBlockquote\"\n title=\"{{ 'richText.blockquote' | uiT: 'Quote' }}\"\n (mousedown)=\"toggleBlockquote($event)\"\n >\n <nvb-icon [svg]=\"blockquoteIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('horizontalRule')) {\n <button [attr.data-testid]=\"tid('horizontal-rule')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.horizontalRule' | uiT: 'Horizontal rule' }}\"\n (mousedown)=\"insertHorizontalRule($event)\"\n >\n <nvb-icon [svg]=\"horizontalRuleIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('textColor')) {\n <label\n class=\"nvb-rich-text-editor__color\"\n title=\"{{ 'richText.textColor' | uiT: 'Text color' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n >\n <nvb-icon [svg]=\"textColorIconSvg\"></nvb-icon>\n <input [attr.data-testid]=\"tid('color-input')\"\n type=\"color\"\n [value]=\"textColor\"\n [disabled]=\"readOnly()\"\n (input)=\"onTextColorChange($event)\"\n />\n </label>\n }\n\n @if (isToolEnabled('highlight')) {\n <button [attr.data-testid]=\"tid('highlight')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isHighlighted\"\n title=\"{{ 'richText.highlight' | uiT: 'Highlight' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openHighlightPopup($event)\"\n >\n <nvb-icon [svg]=\"highlightIconSvg\"></nvb-icon>\n <span\n class=\"nvb-rich-text-editor__button-swatch\"\n [style.background]=\"highlightColor\"\n ></span>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('alignLeft', 'alignCenter', 'alignRight', 'alignJustify')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('alignLeft')) {\n <button [attr.data-testid]=\"tid('align-left')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'left'\"\n title=\"{{ 'richText.alignLeft' | uiT: 'Align left' }}\"\n (mousedown)=\"setAlignment('left', $event)\"\n >\n <nvb-icon [svg]=\"alignLeftIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignCenter')) {\n <button [attr.data-testid]=\"tid('align-center')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'center'\"\n title=\"{{ 'richText.alignCenter' | uiT: 'Align center' }}\"\n (mousedown)=\"setAlignment('center', $event)\"\n >\n <nvb-icon [svg]=\"alignCenterIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignRight')) {\n <button [attr.data-testid]=\"tid('align-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'right'\"\n title=\"{{ 'richText.alignRight' | uiT: 'Align right' }}\"\n (mousedown)=\"setAlignment('right', $event)\"\n >\n <nvb-icon [svg]=\"alignRightIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignJustify')) {\n <button [attr.data-testid]=\"tid('align-justify')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'justify'\"\n title=\"{{ 'richText.alignJustify' | uiT: 'Justify' }}\"\n (mousedown)=\"setAlignment('justify', $event)\"\n >\n <nvb-icon [svg]=\"alignJustifyIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('link', 'image', 'unlink', 'clearFormatting')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('link')) {\n <button [attr.data-testid]=\"tid('link')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.link' | uiT: 'Link' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openLinkPopup($event)\"\n >\n <nvb-icon [svg]=\"linkIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('image')) {\n <button [attr.data-testid]=\"tid('image')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.image' | uiT: 'Image' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('image', $event)\"\n >\n <nvb-icon [svg]=\"imageIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('video')) {\n <button [attr.data-testid]=\"tid('video')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.video' | uiT: 'Video' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('video', $event)\"\n >\n <nvb-icon [svg]=\"videoIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('embed')) {\n <button [attr.data-testid]=\"tid('embed')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.embed' | uiT: 'Embed' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('embed', $event)\"\n >\n <nvb-icon [svg]=\"embedIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('table')) {\n <button\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"showTablePicker || !!activeTableCell\"\n title=\"{{ 'richText.table' | uiT: 'Table' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openTablePicker($event)\"\n data-testid=\"rich-text-table-button\"\n >\n <nvb-icon [svg]=\"tableIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('specialCharacter')) {\n <button [attr.data-testid]=\"tid('special-character')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.specialCharacter' | uiT: 'Special character' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openSpecialCharacterPopup($event)\"\n >\n <nvb-icon [svg]=\"specialCharacterIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('findReplace')) {\n <button [attr.data-testid]=\"tid('find-replace')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"showFindPopup\"\n title=\"{{ 'richText.findReplace' | uiT: 'Find and replace' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openFindPopup($event)\"\n >\n <nvb-icon [svg]=\"findReplaceIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('sourceCode')) {\n <button\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSourceMode\"\n title=\"{{ 'richText.sourceCode' | uiT: 'Source code' }}\"\n (mousedown)=\"toggleSourceMode($event)\"\n data-testid=\"rich-text-source-button\"\n >\n <nvb-icon [svg]=\"sourceCodeIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('unlink')) {\n <button [attr.data-testid]=\"tid('unlink')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.unlink' | uiT: 'Remove link' }}\"\n (mousedown)=\"unlinkSelection($event)\"\n >\n <nvb-icon [svg]=\"unlinkIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('clearFormatting')) {\n <button [attr.data-testid]=\"tid('clear-formatting')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.clearFormatting' | uiT: 'Clear formatting' }}\"\n (mousedown)=\"clearFormatting($event)\"\n >\n <nvb-icon name=\"ink_eraser\"></nvb-icon>\n </button>\n }\n </div>\n }\n </div>\n }\n\n <div [attr.data-testid]=\"tid('edit')\"\n #editableRef\n class=\"nvb-rich-text-editor__editable\"\n [class.nvb-rich-text-editor__editable--hidden]=\"isSourceMode\"\n contenteditable=\"true\"\n dir=\"ltr\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.aria-label]=\"'richText.edit' | uiT: 'Edit'\"\n [attr.data-placeholder]=\"placeholder()\"\n (input)=\"onEditorInput()\"\n (click)=\"onEditorClick($event)\"\n (paste)=\"onEditorPaste($event)\"\n (blur)=\"onEditorBlur()\"\n (focus)=\"onEditorFocus()\"\n (keyup)=\"onEditorCursorChange()\"\n (mouseup)=\"onEditorCursorChange()\"\n (scroll)=\"onEditorScroll()\"\n (keydown)=\"onEditorKeyDown($event)\"\n (dragstart)=\"onEditorDragStart($event)\"\n (dragover)=\"onEditorDragOver($event)\"\n (drop)=\"onEditorDrop($event)\"\n (dragend)=\"onEditorDragEnd()\"\n ></div>\n\n @if (isSourceMode) {\n <textarea\n #sourceTextareaRef\n class=\"nvb-rich-text-editor__source\"\n spellcheck=\"false\"\n [value]=\"sourceDraft\"\n [attr.aria-label]=\"'richText.sourceCode' | uiT: 'Source code'\"\n (input)=\"onSourceInput($event)\"\n data-testid=\"rich-text-source-editor\"\n ></textarea>\n }\n\n @if (activeTableCell && !readOnly() && !isSourceMode) {\n <div\n class=\"nvb-rich-text-editor__table-overlay\"\n [style.top.px]=\"tableOverlayTop\"\n [style.left.px]=\"tableOverlayLeft\"\n (mousedown)=\"$event.preventDefault(); $event.stopPropagation()\"\n data-testid=\"rich-text-table-toolbar\"\n >\n <div class=\"nvb-rich-text-editor__table-toolbar\">\n <button [attr.data-testid]=\"tid('table-row-above')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableRowAbove' | uiT: 'Insert row above' }}\"\n (mousedown)=\"addTableRow('above', $event)\"\n >\n <nvb-icon [svg]=\"tableRowAboveIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-row-below')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableRowBelow' | uiT: 'Insert row below' }}\"\n (mousedown)=\"addTableRow('below', $event)\"\n >\n <nvb-icon [svg]=\"tableRowBelowIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete-row')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableDeleteRow' | uiT: 'Delete row' }}\"\n (mousedown)=\"removeTableRow($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteRowIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-column-left')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableColumnLeft' | uiT: 'Insert column left' }}\"\n (mousedown)=\"addTableColumn('left', $event)\"\n >\n <nvb-icon [svg]=\"tableColumnLeftIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-column-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableColumnRight' | uiT: 'Insert column right' }}\"\n (mousedown)=\"addTableColumn('right', $event)\"\n >\n <nvb-icon [svg]=\"tableColumnRightIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete-column')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableDeleteColumn' | uiT: 'Delete column' }}\"\n (mousedown)=\"removeTableColumn($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteColumnIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-merge-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"!canMergeRight\"\n title=\"{{ 'richText.tableMergeRight' | uiT: 'Merge cell right' }}\"\n (mousedown)=\"mergeCells('right', $event)\"\n >\n <nvb-icon [svg]=\"tableMergeCellsIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-merge-down')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--rotated\"\n [disabled]=\"!canMergeDown\"\n title=\"{{ 'richText.tableMergeDown' | uiT: 'Merge cell down' }}\"\n (mousedown)=\"mergeCells('down', $event)\"\n >\n <nvb-icon [svg]=\"tableMergeCellsIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-split-horizontally')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"!canSplitHorizontally\"\n title=\"{{ 'richText.tableSplitHorizontally' | uiT: 'Split cell horizontally' }}\"\n (mousedown)=\"splitCell('horizontal', $event)\"\n >\n <nvb-icon [svg]=\"tableSplitCellIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-split-vertically')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--rotated\"\n [disabled]=\"!canSplitVertically\"\n title=\"{{ 'richText.tableSplitVertically' | uiT: 'Split cell vertically' }}\"\n (mousedown)=\"splitCell('vertical', $event)\"\n >\n <nvb-icon [svg]=\"tableSplitCellIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-header-row')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"hasTableHeaderRow\"\n title=\"{{ 'richText.tableHeaderRow' | uiT: 'Header row' }}\"\n (mousedown)=\"toggleHeaderRow($event)\"\n >\n <nvb-icon [svg]=\"tableHeaderRowIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-header-column')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"hasTableHeaderColumn\"\n title=\"{{ 'richText.tableHeaderColumn' | uiT: 'Header column' }}\"\n (mousedown)=\"toggleHeaderColumn($event)\"\n >\n <nvb-icon [svg]=\"tableHeaderColumnIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-cell-background')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"showTableCellColorPopup\"\n title=\"{{ 'richText.tableCellBackground' | uiT: 'Cell background' }}\"\n (mousedown)=\"openTableCellColorPopup($event)\"\n >\n <nvb-icon [svg]=\"tableCellBackgroundIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-border-all')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"tableBorder === 'all'\"\n title=\"{{ 'richText.tableBorderAll' | uiT: 'All borders' }}\"\n (mousedown)=\"setTableBorderStyle('all', $event)\"\n >\n <nvb-icon [svg]=\"tableIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-border-none')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"tableBorder === 'none'\"\n title=\"{{ 'richText.tableBorderNone' | uiT: 'No borders' }}\"\n (mousedown)=\"setTableBorderStyle('none', $event)\"\n >\n <nvb-icon name=\"check_box_outline_blank\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--danger\"\n title=\"{{ 'richText.tableDelete' | uiT: 'Delete table' }}\"\n (mousedown)=\"removeTable($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteIconSvg\"></nvb-icon>\n </button>\n </div>\n\n @if (showTableCellColorPopup) {\n <div class=\"nvb-rich-text-editor__swatches nvb-rich-text-editor__swatches--table\">\n @for (swatch of tableCellBackgroundSwatches; track swatch; let tidIndex1 = $index) {\n <button [attr.data-testid]=\"tid('swatch', tidIndex1)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__swatch\"\n [class.nvb-rich-text-editor__swatch--clear]=\"swatch === 'transparent'\"\n [style.background]=\"swatch\"\n [title]=\"swatch\"\n (mousedown)=\"applyTableCellColor(swatch, $event)\"\n ></button>\n }\n </div>\n }\n </div>\n\n @for (handle of tableColumnHandles; track handle.index) {\n <div\n class=\"nvb-rich-text-editor__column-handle\"\n [style.left.px]=\"handle.left\"\n [style.top.px]=\"handle.top\"\n [style.height.px]=\"handle.height\"\n (mousedown)=\"startTableColumnResize(handle.index, $event)\"\n ></div>\n }\n }\n\n @if (showHighlightPopup) {\n <div\n class=\"nvb-rich-text-editor__popup\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <div class=\"nvb-rich-text-editor__swatches\">\n @for (swatch of highlightSwatches; track swatch; let tidIndex2 = $index) {\n <button [attr.data-testid]=\"tid('swatch', tidIndex2)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__swatch\"\n [style.background]=\"swatch\"\n [title]=\"swatch\"\n (mousedown)=\"applyHighlight(swatch, $event)\"\n ></button>\n }\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <label class=\"nvb-rich-text-editor__popup-color\">\n <input [attr.data-testid]=\"tid('color-input-2')\" type=\"color\" [value]=\"highlightColor\" (input)=\"onHighlightColorInput($event)\" />\n <span>{{ 'richText.customColor' | uiT: 'Custom' }}</span>\n </label>\n <button [attr.data-testid]=\"tid('highlight-none')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"clearHighlight($event)\"\n >\n {{ 'richText.removeHighlight' | uiT: 'None' }}\n </button>\n </div>\n </div>\n }\n\n @if (showTablePicker) {\n <div\n class=\"nvb-rich-text-editor__popup\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-table-picker\"\n >\n <div class=\"nvb-rich-text-editor__table-grid\" (mouseleave)=\"onTablePickerLeave()\">\n @for (row of tablePickerRowRange; track row; let tidIndex3 = $index) {\n <div class=\"nvb-rich-text-editor__table-grid-row\">\n @for (column of tablePickerColumnRange; track column; let tidIndex4 = $index) {\n <button [attr.data-testid]=\"tid('table-grid-cell', tidIndex3, tidIndex4)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__table-grid-cell\"\n [class.nvb-rich-text-editor__table-grid-cell--active]=\"\n row < tablePickerRows && column < tablePickerColumns\n \"\n (mouseenter)=\"onTablePickerHover(row, column)\"\n (mousedown)=\"confirmTablePicker(row, column, $event)\"\n ></button>\n }\n </div>\n }\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <span class=\"nvb-rich-text-editor__popup-hint\">\n {{ tablePickerRows || 0 }} &times; {{ tablePickerColumns || 0 }}\n </span>\n <button [attr.data-testid]=\"tid('table-picker-header')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"tablePickerWithHeader\"\n (mousedown)=\"toggleTablePickerHeader($event)\"\n >\n {{ 'richText.tableHeaderRow' | uiT: 'Header row' }}\n </button>\n </div>\n </div>\n }\n\n @if (showSpecialCharacterPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--characters\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @for (character of specialCharacters; track character; let tidIndex5 = $index) {\n <button [attr.data-testid]=\"tid('character', tidIndex5)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__character\"\n (mousedown)=\"insertSpecialCharacter(character, $event)\"\n >\n {{ character }}\n </button>\n }\n </div>\n }\n\n @if (showMediaPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--media\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-media-popup\"\n >\n @if (mediaKind === 'image') {\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('upload')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"mediaSource === 'upload'\"\n (mousedown)=\"setMediaSource('upload', $event)\"\n >\n {{ 'richText.mediaUpload' | uiT: 'Upload' }}\n </button>\n <button [attr.data-testid]=\"tid('url')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"mediaSource === 'url'\"\n (mousedown)=\"setMediaSource('url', $event)\"\n >\n {{ 'richText.mediaUrl' | uiT: 'By URL' }}\n </button>\n </div>\n }\n\n <input [attr.data-testid]=\"tid('media-url')\"\n #mediaUrlInputRef\n type=\"url\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"mediaUrl\"\n [placeholder]=\"\n mediaKind === 'image'\n ? ('richText.imagePrompt' | uiT: 'Enter image URL or data:image base64')\n : mediaKind === 'video'\n ? ('richText.videoPrompt' | uiT: 'Enter video or YouTube URL')\n : ('richText.embedPrompt' | uiT: 'Enter page URL to embed')\n \"\n (input)=\"onMediaUrlInput($event)\"\n (keydown.enter)=\"applyMediaFromPopup($event)\"\n (keydown.escape)=\"closeMediaPopup()\"\n />\n\n @if (mediaKind === 'image') {\n <input [attr.data-testid]=\"tid('media-alt')\"\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"mediaAlt\"\n [placeholder]=\"'richText.imageAlt' | uiT: 'Alternative text'\"\n (input)=\"onMediaAltInput($event)\"\n />\n }\n\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('media-apply')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"applyMediaFromPopup($event)\"\n >\n {{ 'richText.apply' | uiT: 'Apply' }}\n </button>\n <button [attr.data-testid]=\"tid('media-cancel')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"closeMediaPopup($event)\"\n >\n {{ 'richText.cancel' | uiT: 'Cancel' }}\n </button>\n </div>\n </div>\n }\n\n @if (showFindPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--find\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-find-popup\"\n >\n <input [attr.data-testid]=\"tid('find-input')\"\n #findInputRef\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"findQuery\"\n [placeholder]=\"'richText.find' | uiT: 'Find'\"\n (input)=\"onFindQueryInput($event)\"\n (keydown.enter)=\"findNext($event)\"\n (keydown.escape)=\"closeFindPopup()\"\n />\n <input [attr.data-testid]=\"tid('replace-input')\"\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"replaceValue\"\n [placeholder]=\"'richText.replaceWith' | uiT: 'Replace with'\"\n (input)=\"onReplaceValueInput($event)\"\n />\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('find-match-case')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"findMatchCase\"\n (mousedown)=\"toggleFindMatchCase($event)\"\n >\n {{ 'richText.matchCase' | uiT: 'Aa' }}\n </button>\n <button [attr.data-testid]=\"tid('find-previous')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"findPrevious($event)\"\n >\n {{ 'richText.findPrevious' | uiT: 'Previous' }}\n </button>\n <button [attr.data-testid]=\"tid('find-next')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"findNext($event)\"\n >\n {{ 'richText.findNext' | uiT: 'Next' }}\n </button>\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <span class=\"nvb-rich-text-editor__popup-hint\">{{ findStatus }}</span>\n <button [attr.data-testid]=\"tid('replace-current')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"replaceCurrent($event)\"\n >\n {{ 'richText.replace' | uiT: 'Replace' }}\n </button>\n <button [attr.data-testid]=\"tid('replace-all')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"replaceAll($event)\"\n >\n {{ 'richText.replaceAll' | uiT: 'Replace all' }}\n </button>\n </div>\n </div>\n }\n\n @if (selectedMediaNode && !readOnly()) {\n <div\n class=\"nvb-rich-text-editor__media-overlay\"\n [style.top.px]=\"mediaOverlayTop - 36\"\n [style.left.px]=\"mediaOverlayLeft\"\n [style.width.px]=\"mediaOverlayWidth\"\n >\n <div class=\"nvb-rich-text-editor__media-toolbar\">\n <button [attr.data-testid]=\"tid('align-left-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignLeft' | uiT: 'Align left' }}\"\n (mousedown)=\"setSelectedMediaAlignment('left', $event)\"\n >\n <nvb-icon [svg]=\"alignLeftIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-center-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignCenter' | uiT: 'Align center' }}\"\n (mousedown)=\"setSelectedMediaAlignment('center', $event)\"\n >\n <nvb-icon [svg]=\"alignCenterIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-right-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignRight' | uiT: 'Align right' }}\"\n (mousedown)=\"setSelectedMediaAlignment('right', $event)\"\n >\n <nvb-icon [svg]=\"alignRightIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-justify-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignJustify' | uiT: 'Justify' }}\"\n (mousedown)=\"setSelectedMediaAlignment('justify', $event)\"\n >\n <nvb-icon [svg]=\"alignJustifyIconSvg\"></nvb-icon>\n </button>\n </div>\n </div>\n\n <button [attr.data-testid]=\"tid('media-resize-handle')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__media-resize-handle\"\n [style.left.px]=\"mediaResizeHandleLeft\"\n [style.top.px]=\"mediaResizeHandleTop\"\n (mousedown)=\"startMediaResizeDrag($event)\"\n aria-label=\"Resize media\"\n ></button>\n }\n\n @if (showMediaDropCaret && !readOnly()) {\n <div\n class=\"nvb-rich-text-editor__drop-caret\"\n [style.left.px]=\"mediaDropCaretLeft\"\n [style.top.px]=\"mediaDropCaretTop\"\n [style.height.px]=\"mediaDropCaretHeight\"\n ></div>\n }\n\n @if (showLinkPopup) {\n <div\n #linkPopupRef\n class=\"nvb-rich-text-editor__link-popup\"\n [style.top.px]=\"linkPopupTop\"\n [style.left.px]=\"linkPopupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <input [attr.data-testid]=\"tid('link-url')\"\n #linkUrlInputRef\n type=\"url\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"linkUrl\"\n [placeholder]=\"'richText.linkPlaceholder' | uiT: 'https://example.com'\"\n (input)=\"onLinkUrlInput($event)\"\n (keydown.enter)=\"applyLinkFromKeyboard($event)\"\n (keydown.escape)=\"closeLinkPopup()\"\n />\n <button [attr.data-testid]=\"tid('link-apply')\"\n #linkButtonRef\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"applyLink($event)\"\n >\n {{ 'richText.apply' | uiT: 'Apply' }}\n </button>\n <button [attr.data-testid]=\"tid('link-cancel')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"closeLinkPopup($event)\"\n >\n {{ 'richText.cancel' | uiT: 'Cancel' }}\n </button>\n </div>\n }\n\n @if (showWordCount() && !readOnly()) {\n <div class=\"nvb-rich-text-editor__status\" data-testid=\"rich-text-status\">\n <span>{{ 'richText.words' | uiT: 'Words' }}: {{ wordCount() }}</span>\n <span>{{ 'richText.characters' | uiT: 'Characters' }}: {{ characterCount() }}</span>\n </div>\n }\n\n <input [attr.data-testid]=\"tid('image-input')\"\n #imageInputRef\n class=\"nvb-rich-text-editor__image-input\"\n type=\"file\"\n accept=\"image/*\"\n hidden\n (change)=\"onImageFileSelected($event)\"\n />\n</section>\n",styles:['@charset "UTF-8";.nvb-rich-text-editor{position:relative;width:100%;height:100%;min-height:0;max-height:100%;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);overflow:hidden;display:flex;flex-direction:column}.nvb-rich-text-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;align-content:center;gap:2px;padding:4px 6px;border-bottom:1px solid var(--nvb-color-neutral-200);background:var(--nvb-color-neutral-000);position:relative;z-index:2}.nvb-rich-text-editor__toolbar-group{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:0;padding:0;border:0;border-radius:0;background:transparent;min-width:0}.nvb-rich-text-editor__toolbar-group--selects{flex:0 1 auto;gap:2px}.nvb-rich-text-editor__toolbar-divider{width:1px;height:16px;background:var(--nvb-color-neutral-200);flex:0 0 auto;margin:0 2px}.nvb-rich-text-editor__toolbar-divider:first-child,.nvb-rich-text-editor__toolbar-divider:last-child{display:none}.nvb-rich-text-editor__select{min-width:0;max-width:160px;font-size:12px;--nvb-input-height: 26px;--nvb-input-radius: var(--nvb-radius-sm);--nvb-select-fit-min-width: 44px;--nvb-select-fit-menu-max-width: 140px;--nvb-select-trigger-border-color: transparent;--nvb-select-trigger-bg: transparent;--nvb-select-trigger-hover-bg: var(--nvb-color-neutral-100);--nvb-select-trigger-focus-ring: none;--nvb-select-trigger-focus-border-color: var(--nvb-color-primary-500);--nvb-select-trigger-padding-inline-start: 6px;--nvb-select-trigger-padding-inline-end: 20px;--nvb-select-arrow-inset-inline-end: 6px}.nvb-rich-text-editor__select--size{min-width:56px;max-width:64px;--nvb-select-fit-menu-max-width: 90px;--nvb-select-fit-min-width: 56px}.nvb-rich-text-editor__select--line-height{min-width:56px;max-width:68px;--nvb-select-fit-menu-max-width: 90px;--nvb-select-fit-min-width: 56px}.nvb-rich-text-editor__select-icon{display:inline-flex;align-items:center;color:var(--nvb-color-neutral-600);margin-inline-end:2px}.nvb-rich-text-editor__select-icon .nvb-icon-svg{width:17px;height:17px}.nvb-rich-text-editor__select--heading{min-width:52px;max-width:52px;--nvb-select-fit-min-width: 52px;--nvb-select-fit-menu-max-width: 80px}.nvb-rich-text-editor__select--font{min-width:116px;max-width:136px;--nvb-select-fit-min-width: 116px;--nvb-select-fit-menu-max-width: 180px}.nvb-rich-text-editor__select.nvb-select--fit-content{width:fit-content}.nvb-rich-text-editor__button,.nvb-rich-text-editor__color{width:28px;min-width:28px;height:28px;border:1px solid transparent;border-radius:var(--nvb-radius-sm);display:inline-flex;align-items:center;justify-content:center;color:var(--nvb-color-neutral-700);background:transparent;cursor:pointer;padding:0;transition:background-color .1s ease,border-color .1s ease,color .1s ease}.nvb-rich-text-editor__button--text{width:auto;min-width:0;padding:0 8px;font-size:12px;font-weight:500}.nvb-rich-text-editor__button--line-height{width:auto;min-width:0;padding:0 6px;gap:3px}.nvb-rich-text-editor__button-value{min-width:10px;font-size:11px;font-weight:600;line-height:1}.nvb-rich-text-editor__button:hover,.nvb-rich-text-editor__color:hover{background:var(--nvb-color-neutral-100);color:var(--nvb-color-neutral-900)}.nvb-rich-text-editor__button:disabled,.nvb-rich-text-editor__color:has(input:disabled){opacity:.45;cursor:default;background:transparent}.nvb-rich-text-editor__button--active{background:color-mix(in oklch,var(--nvb-color-primary-500) 10%,var(--nvb-color-neutral-000));border-color:color-mix(in oklch,var(--nvb-color-primary-500) 40%,transparent);color:var(--nvb-color-primary-700)}.nvb-rich-text-editor__button .nvb-icon-svg,.nvb-rich-text-editor__color .nvb-icon-svg{font-size:16px}.nvb-rich-text-editor__color{position:relative;overflow:hidden}.nvb-rich-text-editor__color input[type=color]{position:absolute;inset:0;opacity:0;cursor:pointer}.nvb-rich-text-editor__link-popup{position:absolute;z-index:10;display:flex;flex-wrap:nowrap;align-items:center;gap:6px;padding:6px 8px;width:min(340px,100% - 16px);border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);box-shadow:0 2px 8px color-mix(in oklch,var(--nvb-color-neutral-900) 10%,transparent),0 8px 20px color-mix(in oklch,var(--nvb-color-neutral-900) 8%,transparent)}.nvb-rich-text-editor__link-input{flex:1 1 0;min-width:0;height:28px;border:1px solid var(--nvb-color-neutral-300);border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-000);color:var(--nvb-color-neutral-800);padding:0 8px;font-size:12px;outline:none}.nvb-rich-text-editor__link-input:focus{border-color:var(--nvb-color-primary-500);box-shadow:0 0 0 1px color-mix(in oklch,var(--nvb-color-primary-500) 30%,transparent)}.nvb-rich-text-editor__link-button{flex:0 0 auto;height:28px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-sm);padding:0 10px;font-size:12px;font-weight:500;color:var(--nvb-color-neutral-700);background:var(--nvb-color-neutral-050);cursor:pointer;white-space:nowrap;transition:background-color .1s ease,border-color .1s ease}.nvb-rich-text-editor__link-button:hover{background:var(--nvb-color-neutral-100);border-color:var(--nvb-color-neutral-300)}.nvb-rich-text-editor__link-button--primary{background:var(--nvb-color-primary-600);border-color:var(--nvb-color-primary-600);color:#fff}.nvb-rich-text-editor__link-button--primary:hover{background:var(--nvb-color-primary-700);border-color:var(--nvb-color-primary-700)}.nvb-rich-text-editor__editable{min-height:0;flex:1 1 auto;padding:12px 14px;font-family:var(--nvb-font-family, var(--nvb-font-family-base, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif));font-size:14px;font-weight:400;line-height:1.6;color:var(--nvb-color-neutral-800);outline:none;white-space:pre-wrap;word-break:break-word;direction:ltr;unicode-bidi:normal;text-align:left;overflow:auto}.nvb-rich-text-editor__media-overlay{position:absolute;z-index:4;display:flex;justify-content:center;pointer-events:none}.nvb-rich-text-editor__media-toolbar{display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:color-mix(in oklch,var(--nvb-color-neutral-000) 96%,transparent);box-shadow:0 2px 6px color-mix(in oklch,var(--nvb-color-neutral-900) 10%,transparent),0 4px 14px color-mix(in oklch,var(--nvb-color-neutral-900) 6%,transparent);pointer-events:auto}.nvb-rich-text-editor__media-resize-handle{position:absolute;z-index:5;width:18px;height:18px;border:2px solid var(--nvb-color-primary-600);border-radius:50%;background:var(--nvb-color-neutral-000);box-shadow:0 2px 8px color-mix(in oklch,var(--nvb-color-neutral-900) 18%,transparent);cursor:nwse-resize}.nvb-rich-text-editor__drop-caret{position:absolute;z-index:6;width:2px;min-height:18px;border-radius:var(--nvb-radius-full);background:var(--nvb-color-primary-600);box-shadow:0 0 0 1px color-mix(in oklch,var(--nvb-color-neutral-000) 88%,transparent);pointer-events:none}.nvb-rich-text-editor__editable[contenteditable=false]{background:var(--nvb-color-neutral-050);cursor:default}.nvb-rich-text-editor--minimal-viewer{border:0;border-radius:0;background:transparent;overflow:visible;height:auto;min-height:0;max-height:none}.nvb-rich-text-editor--minimal-viewer .nvb-rich-text-editor__editable{padding:0;min-height:0;overflow:visible;background:transparent;border:0}.nvb-rich-text-editor--minimal-viewer .nvb-rich-text-editor__editable[contenteditable=false]{background:transparent}.nvb-rich-text-editor__editable:empty:before{content:attr(data-placeholder);color:var(--nvb-color-neutral-400);pointer-events:none}.nvb-rich-text-editor__editable p,.nvb-rich-text-editor__editable h1,.nvb-rich-text-editor__editable h2,.nvb-rich-text-editor__editable h3,.nvb-rich-text-editor__editable h4,.nvb-rich-text-editor__editable h5,.nvb-rich-text-editor__editable h6,.nvb-rich-text-editor__editable ul,.nvb-rich-text-editor__editable ol,.nvb-rich-text-editor__editable blockquote,.nvb-rich-text-editor__editable li,.nvb-rich-text-editor__editable div,.nvb-rich-text-editor__editable pre{margin:0;padding:0}.nvb-rich-text-editor__editable>:last-child{margin-bottom:0}.nvb-rich-text-editor__editable ul,.nvb-rich-text-editor__editable ol{padding-left:22px}.nvb-rich-text-editor__editable ul{list-style:disc outside!important}.nvb-rich-text-editor__editable ol{list-style:decimal outside!important}.nvb-rich-text-editor__editable li{display:list-item!important}.nvb-rich-text-editor__editable .nvb-rt-font-system{font-family:Segoe UI,system-ui,Tahoma,Geneva,Verdana,sans-serif}.nvb-rich-text-editor__editable .nvb-rt-font-ibm-plex-sans{font-family:IBM Plex Sans,Segoe UI,sans-serif}.nvb-rich-text-editor__editable .nvb-rt-font-georgia{font-family:Georgia,Times New Roman,serif}.nvb-rich-text-editor__editable .nvb-rt-font-courier{font-family:Courier New,Courier,monospace}.nvb-rich-text-editor__editable .nvb-rt-size-8{font-size:8px}.nvb-rich-text-editor__editable .nvb-rt-size-9{font-size:9px}.nvb-rich-text-editor__editable .nvb-rt-size-10{font-size:10px}.nvb-rich-text-editor__editable .nvb-rt-size-11{font-size:11px}.nvb-rich-text-editor__editable .nvb-rt-size-12{font-size:12px}.nvb-rich-text-editor__editable .nvb-rt-size-14{font-size:14px}.nvb-rich-text-editor__editable .nvb-rt-size-16{font-size:16px}.nvb-rich-text-editor__editable .nvb-rt-size-18{font-size:18px}.nvb-rich-text-editor__editable .nvb-rt-size-20{font-size:20px}.nvb-rich-text-editor__editable .nvb-rt-size-24{font-size:24px}.nvb-rich-text-editor__editable .nvb-rt-size-28{font-size:28px}.nvb-rich-text-editor__editable .nvb-rt-size-32{font-size:32px}.nvb-rich-text-editor__editable .nvb-rt-size-36{font-size:36px}.nvb-rich-text-editor__editable .nvb-rt-size-48{font-size:48px}.nvb-rich-text-editor__editable .nvb-rt-size-72{font-size:72px}.nvb-rich-text-editor__editable .nvb-rt-size-small{font-size:12px}.nvb-rich-text-editor__editable .nvb-rt-size-normal{font-size:14px}.nvb-rich-text-editor__editable .nvb-rt-size-large{font-size:20px}.nvb-rich-text-editor__editable .nvb-rt-size-xlarge{font-size:28px}.nvb-rich-text-editor__editable .nvb-rt-align-left{text-align:left}.nvb-rich-text-editor__editable .nvb-rt-align-center{text-align:center}.nvb-rich-text-editor__editable .nvb-rt-align-right{text-align:right}.nvb-rich-text-editor__editable .nvb-rt-align-justify{text-align:justify}.nvb-rich-text-editor__editable .nvb-rt-leading-1{line-height:1}.nvb-rich-text-editor__editable .nvb-rt-leading-1-15{line-height:1.15}.nvb-rich-text-editor__editable .nvb-rt-leading-1-25{line-height:1.25}.nvb-rich-text-editor__editable .nvb-rt-leading-1-5{line-height:1.5}.nvb-rich-text-editor__editable .nvb-rt-leading-1-6{line-height:1.6}.nvb-rich-text-editor__editable .nvb-rt-leading-1-75{line-height:1.75}.nvb-rich-text-editor__editable .nvb-rt-leading-2{line-height:2}.nvb-rich-text-editor__editable .nvb-rt-leading-2-5{line-height:2.5}.nvb-rich-text-editor__editable .nvb-rt-leading-3{line-height:3}.nvb-rich-text-editor__editable .nvb-rt-leading-tight{line-height:1.25}.nvb-rich-text-editor__editable .nvb-rt-leading-normal{line-height:1.6}.nvb-rich-text-editor__editable .nvb-rt-leading-relaxed{line-height:2}.nvb-rich-text-editor__editable blockquote{margin:0;padding-left:12px;border-left:3px solid color-mix(in oklch,var(--nvb-color-primary-500) 30%,var(--nvb-color-neutral-300));color:var(--nvb-color-neutral-600)}.nvb-rich-text-editor__editable hr{border:0;border-top:1px solid var(--nvb-color-neutral-200);margin:12px 0}.nvb-rich-text-editor__editable mark{padding:0 .12em;border-radius:.2em;background:color-mix(in oklch,var(--nvb-color-warning-400, #f59e0b) 24%,white)}.nvb-rich-text-editor__editable code{display:inline;padding:.1em .3em;border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-100);border:1px solid var(--nvb-color-neutral-200);font-family:Cascadia Code,Courier New,Courier,monospace;font-size:.88em}.nvb-rich-text-editor__editable pre{display:block;margin:.5em 0;padding:12px 14px;border-radius:var(--nvb-radius-lg);background:var(--nvb-color-neutral-100);border:1px solid var(--nvb-color-neutral-200);overflow-x:auto;white-space:pre}.nvb-rich-text-editor__editable pre code{display:block;padding:0;border:none;background:transparent;font-size:.86em;line-height:1.55;white-space:pre}.nvb-rich-text-editor__editable a,.nvb-rich-text-editor__editable a.nvb-rt-link{color:var(--nvb-color-primary-700);text-decoration:underline;cursor:pointer}.nvb-rich-text-editor__editable :where(strong,b){font-weight:600}.nvb-rich-text-editor__editable :where(em,i){font-style:italic}.nvb-rich-text-editor__editable :where(u){text-decoration:underline}.nvb-rich-text-editor__editable :where(s,strike){text-decoration:line-through}.nvb-rich-text-editor__editable .nvb-rt-image{max-width:min(240px,100%);height:auto;vertical-align:middle}.nvb-rich-text-editor__editable .nvb-rt-media-node{position:relative;display:inline-block;max-width:100%;margin:6px 0;clear:both;cursor:grab;line-height:0}.nvb-rich-text-editor__editable .nvb-rt-media-node img,.nvb-rich-text-editor__editable .nvb-rt-media-node video,.nvb-rich-text-editor__editable .nvb-rt-media-node iframe{display:block;max-width:100%;border-radius:var(--nvb-radius-sm);pointer-events:none}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-left{float:left;margin:6px 14px 0 0}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-right{float:right;margin:6px 0 0 14px}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-center{display:block;width:fit-content;float:none;margin:10px auto;max-width:100%}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify{display:block;float:none;width:100%;margin:10px 0}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>img,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>video,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>iframe{width:100%;max-width:100%}.nvb-rich-text-editor__editable .nvb-rt-media-node:focus-within,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-selected{outline:2px solid color-mix(in oklch,var(--nvb-color-primary-500) 50%,transparent);outline-offset:2px}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-dragging{opacity:.65;cursor:grabbing}.nvb-rich-text-editor__editable .nvb-rt-video{aspect-ratio:16/9}@media(max-width:768px){.nvb-rich-text-editor__toolbar{gap:4px;padding:6px}.nvb-rich-text-editor__toolbar-group,.nvb-rich-text-editor__toolbar-group--selects{width:100%}.nvb-rich-text-editor__toolbar-divider{display:none}.nvb-rich-text-editor__select{max-width:none}.nvb-rich-text-editor__link-popup{width:calc(100% - 16px);left:8px!important}}.nvb-rich-text-editor__editable table.nvb-rt-table{border-collapse:collapse;width:100%;margin:12px 0;table-layout:fixed;font-size:inherit}.nvb-rich-text-editor__editable table.nvb-rt-table td,.nvb-rich-text-editor__editable table.nvb-rt-table th{padding:6px 8px;vertical-align:top;min-width:24px;word-break:break-word}.nvb-rich-text-editor__editable table.nvb-rt-table th{background:var(--nvb-color-neutral-100, #f1f5f9);font-weight:600;text-align:left}.nvb-rich-text-editor__editable table.nvb-rt-table-border-all td,.nvb-rich-text-editor__editable table.nvb-rt-table-border-all th,.nvb-rich-text-editor__editable table.nvb-rt-table-border-outer{border:1px solid var(--nvb-color-neutral-300, #cbd5e1)}.nvb-rich-text-editor__editable table.nvb-rt-table-border-none td,.nvb-rich-text-editor__editable table.nvb-rt-table-border-none th{border:0}.nvb-rich-text-editor__editable[contenteditable=true] table.nvb-rt-table-border-none td,.nvb-rich-text-editor__editable[contenteditable=true] table.nvb-rt-table-border-none th{outline:1px dashed var(--nvb-color-neutral-200, #e2e8f0);outline-offset:-1px}.nvb-rich-text-editor__editable table.nvb-rt-table-active{box-shadow:0 0 0 1px var(--nvb-color-primary-400, #60a5fa)}.nvb-rich-text-editor__editable table.nvb-rt-table .nvb-rt-valign-middle{vertical-align:middle}.nvb-rich-text-editor__editable table.nvb-rt-table .nvb-rt-valign-bottom{vertical-align:bottom}.nvb-rich-text-editor__editable table.nvb-rt-table td>:last-child,.nvb-rich-text-editor__editable table.nvb-rt-table th>:last-child{margin-bottom:0}.nvb-rich-text-editor__editable ul.nvb-rt-task-list{list-style:none;padding-inline-start:4px}.nvb-rich-text-editor__editable li.nvb-rt-task-item{list-style:none;position:relative;padding-inline-start:26px;display:block}.nvb-rich-text-editor__editable li.nvb-rt-task-item:before{content:"";position:absolute;inset-inline-start:0;top:.22em;width:15px;height:15px;border:1.5px solid var(--nvb-color-neutral-400, #94a3b8);border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-000, #fff);box-sizing:border-box}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked:before{background:var(--nvb-color-primary-500, #3b82f6);border-color:var(--nvb-color-primary-500, #3b82f6)}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked:after{content:"";position:absolute;inset-inline-start:5px;top:.4em;width:4px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked{color:var(--nvb-color-neutral-500, #64748b);text-decoration:line-through}.nvb-rich-text-editor__editable[contenteditable=true] li.nvb-rt-task-item:before{cursor:pointer}.nvb-rich-text-editor__editable .nvb-rt-indent-1{margin-inline-start:32px}.nvb-rich-text-editor__editable .nvb-rt-indent-2{margin-inline-start:64px}.nvb-rich-text-editor__editable .nvb-rt-indent-3{margin-inline-start:96px}.nvb-rich-text-editor__editable .nvb-rt-indent-4{margin-inline-start:128px}.nvb-rich-text-editor__editable .nvb-rt-indent-5{margin-inline-start:160px}.nvb-rich-text-editor__editable .nvb-rt-indent-6{margin-inline-start:192px}.nvb-rich-text-editor__editable .nvb-rt-indent-7{margin-inline-start:224px}.nvb-rich-text-editor__editable .nvb-rt-indent-8{margin-inline-start:256px}.nvb-rich-text-editor__editable .nvb-rt-embed{display:block;width:100%;aspect-ratio:16/9;border:0;border-radius:var(--nvb-radius-lg)}.nvb-rich-text-editor__button--rotated .nvb-icon-svg{transform:rotate(90deg)}.nvb-rich-text-editor__button--danger:hover{color:var(--nvb-color-danger-600, #dc2626);background:var(--nvb-color-danger-50, #fef2f2)}.nvb-rich-text-editor__button-swatch{position:absolute;inset-inline:5px;bottom:3px;height:3px;border-radius:2px;pointer-events:none}.nvb-rich-text-editor__button{position:relative}.nvb-rich-text-editor__popup{position:fixed;z-index:60;display:flex;flex-direction:column;gap:6px;padding:8px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-lg);background:var(--nvb-color-neutral-000);box-shadow:0 8px 24px #0f172a2e;max-width:280px}.nvb-rich-text-editor__popup--characters{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;max-width:264px}.nvb-rich-text-editor__popup--media,.nvb-rich-text-editor__popup--find{width:260px}.nvb-rich-text-editor__popup-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.nvb-rich-text-editor__popup-hint{font-size:12px;color:var(--nvb-color-neutral-500);margin-inline-end:auto}.nvb-rich-text-editor__popup-color{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--nvb-color-neutral-600);cursor:pointer}.nvb-rich-text-editor__popup-color input[type=color]{width:24px;height:20px;padding:0;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-sm);background:none;cursor:pointer}.nvb-rich-text-editor__swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}.nvb-rich-text-editor__swatches--table{grid-template-columns:repeat(5,1fr);margin-top:6px;padding:6px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000)}.nvb-rich-text-editor__swatch{width:22px;height:22px;border:1px solid var(--nvb-color-neutral-300);border-radius:var(--nvb-radius-sm);cursor:pointer;padding:0}.nvb-rich-text-editor__swatch--clear{background:linear-gradient(45deg,transparent 45%,var(--nvb-color-danger-500, #ef4444) 45%,var(--nvb-color-danger-500, #ef4444) 55%,transparent 55%),var(--nvb-color-neutral-000)}.nvb-rich-text-editor__table-grid{display:flex;flex-direction:column;gap:2px}.nvb-rich-text-editor__table-grid-row{display:flex;gap:2px}.nvb-rich-text-editor__table-grid-cell{width:16px;height:16px;padding:0;border:1px solid var(--nvb-color-neutral-300);border-radius:2px;background:var(--nvb-color-neutral-000);cursor:pointer}.nvb-rich-text-editor__table-grid-cell--active{background:var(--nvb-color-primary-500, #3b82f6);border-color:var(--nvb-color-primary-500, #3b82f6)}.nvb-rich-text-editor__character{height:28px;border:1px solid transparent;border-radius:var(--nvb-radius-sm);background:transparent;cursor:pointer;font-size:15px;color:var(--nvb-color-neutral-800)}.nvb-rich-text-editor__character:hover{background:var(--nvb-color-neutral-100);border-color:var(--nvb-color-neutral-200)}.nvb-rich-text-editor__table-overlay{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start}.nvb-rich-text-editor__table-toolbar{display:inline-flex;align-items:center;gap:1px;padding:3px 4px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);box-shadow:0 6px 18px #0f172a29;flex-wrap:wrap;max-width:100%}.nvb-rich-text-editor__column-handle{position:absolute;width:5px;z-index:14;cursor:col-resize;background:transparent}.nvb-rich-text-editor__column-handle:hover{background:var(--nvb-color-primary-400, #60a5fa);opacity:.6}.nvb-rich-text-editor__editable--hidden{display:none}.nvb-rich-text-editor__source{flex:1 1 auto;min-height:0;width:100%;resize:none;border:0;outline:none;padding:12px 14px;font-family:Courier New,Courier,monospace;font-size:13px;line-height:1.6;color:var(--nvb-color-neutral-800);background:var(--nvb-color-neutral-050, #f8fafc)}.nvb-rich-text-editor__status{display:flex;gap:14px;padding:3px 10px;border-top:1px solid var(--nvb-color-neutral-200);font-size:11px;color:var(--nvb-color-neutral-500);background:var(--nvb-color-neutral-000);flex:0 0 auto}\n'],dependencies:[{kind:"component",type:xt,selector:"nvb-select",inputs:["value","disabled","required","filterable","filterThreshold","allowCustomValue","placeholder","testId"],outputs:["valueChange","change","focus","blur"]},{kind:"component",type:mt,selector:"nvb-icon",inputs:["name","svg","ariaLabel"]},{kind:"pipe",type:O,name:"uiT"}],changeDetection:h.ChangeDetectionStrategy.Eager,encapsulation:h.ViewEncapsulation.None})};h.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:dt,decorators:[{type:j,args:[{selector:"nvb-rich-text-editor-core",imports:[xt,mt,O],changeDetection:K.Eager,encapsulation:te.None,template:"<section\n #rootRef\n class=\"nvb-rich-text-editor\"\n [class.nvb-rich-text-editor--minimal-viewer]=\"minimalViewer() && readOnly()\"\n data-testid=\"rich-text-editor-root\"\n>\n @if (showToolbar() && hasAnyToolbarTool()) {\n <div\n #toolbarRef\n class=\"nvb-rich-text-editor__toolbar\"\n role=\"toolbar\"\n [attr.aria-label]=\"'richText.toolbar' | uiT: 'Formatting'\"\n >\n @if (hasAnyTool('undo', 'redo')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('undo')) {\n <button [attr.data-testid]=\"tid('undo')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly() || !canUndo()\"\n title=\"{{ 'richText.undo' | uiT: 'Undo' }}\"\n (mousedown)=\"undo($event)\"\n >\n <nvb-icon [svg]=\"undoIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('redo')) {\n <button [attr.data-testid]=\"tid('redo')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly() || !canRedo()\"\n title=\"{{ 'richText.redo' | uiT: 'Redo' }}\"\n (mousedown)=\"redo($event)\"\n >\n <nvb-icon [svg]=\"redoIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('heading', 'font', 'size')) {\n <div\n class=\"nvb-rich-text-editor__toolbar-group nvb-rich-text-editor__toolbar-group--selects\"\n >\n @if (isToolEnabled('heading')) {\n <nvb-select [testId]=\"tid('heading-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--heading nvb-select--fit-content\"\n [value]=\"heading\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onHeadingChange($event)\"\n >\n @for (option of headingOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.key | uiT: option.fallback }}</option>\n }\n </nvb-select>\n }\n\n @if (isToolEnabled('font')) {\n <nvb-select [testId]=\"tid('font-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--font nvb-select--fit-content\"\n [value]=\"font\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onFontChange($event)\"\n >\n @for (option of fontOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.key | uiT: option.fallback }}</option>\n }\n </nvb-select>\n }\n\n @if (isToolEnabled('size')) {\n <nvb-select [testId]=\"tid('size-select')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--size nvb-select--fit-content\"\n [value]=\"size\"\n [disabled]=\"readOnly()\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onSizeChange($event)\"\n >\n @for (option of sizeOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.label }}</option>\n }\n </nvb-select>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (isToolEnabled('lineHeight')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n <nvb-icon\n class=\"nvb-rich-text-editor__select-icon\"\n [svg]=\"lineSpacingIconSvg\"\n [attr.title]=\"'richText.lineHeight' | uiT: 'Line spacing'\"\n ></nvb-icon>\n <nvb-select [testId]=\"tid('line-height')\"\n class=\"nvb-rich-text-editor__select nvb-rich-text-editor__select--line-height nvb-select--fit-content\"\n [value]=\"lineHeight\"\n [disabled]=\"readOnly()\"\n [attr.aria-label]=\"'richText.lineHeight' | uiT: 'Line spacing'\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (change)=\"onLineHeightChange($event)\"\n >\n @for (option of lineHeightOptions; track option.value) {\n <option [value]=\"option.value\">{{ option.label }}</option>\n }\n </nvb-select>\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('inlineCode', 'subscript', 'superscript')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('inlineCode')) {\n <button [attr.data-testid]=\"tid('inline-code')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isInlineCode\"\n title=\"{{ 'richText.inlineCode' | uiT: 'Inline code' }}\"\n (mousedown)=\"toggleTag('code', $event)\"\n >\n <nvb-icon [svg]=\"inlineCodeIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('subscript')) {\n <button [attr.data-testid]=\"tid('subscript')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSubscript\"\n title=\"{{ 'richText.subscript' | uiT: 'Subscript' }}\"\n (mousedown)=\"toggleTag('sub', $event)\"\n >\n <nvb-icon [svg]=\"subscriptIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('superscript')) {\n <button [attr.data-testid]=\"tid('superscript')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSuperscript\"\n title=\"{{ 'richText.superscript' | uiT: 'Superscript' }}\"\n (mousedown)=\"toggleTag('sup', $event)\"\n >\n <nvb-icon [svg]=\"superscriptIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('bold', 'italic', 'underline', 'strikeThrough')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('bold')) {\n <button [attr.data-testid]=\"tid('bold')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isBold\"\n title=\"{{ 'richText.bold' | uiT: 'Bold' }}\"\n (mousedown)=\"toggleInline('bold', $event)\"\n >\n <nvb-icon [svg]=\"boldIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('italic')) {\n <button [attr.data-testid]=\"tid('italic')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isItalic\"\n title=\"{{ 'richText.italic' | uiT: 'Italic' }}\"\n (mousedown)=\"toggleInline('italic', $event)\"\n >\n <nvb-icon [svg]=\"italicIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('underline')) {\n <button [attr.data-testid]=\"tid('underline')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isUnderline\"\n title=\"{{ 'richText.underline' | uiT: 'Underline' }}\"\n (mousedown)=\"toggleInline('underline', $event)\"\n >\n <nvb-icon [svg]=\"underlineIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('strikeThrough')) {\n <button [attr.data-testid]=\"tid('strike-through')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isStrike\"\n title=\"{{ 'richText.strikeThrough' | uiT: 'Strikethrough' }}\"\n (mousedown)=\"toggleInline('strikeThrough', $event)\"\n >\n <nvb-icon [svg]=\"strikeIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('orderedList', 'unorderedList')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('orderedList')) {\n <button [attr.data-testid]=\"tid('ordered-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.orderedList' | uiT: 'Ordered list' }}\"\n (mousedown)=\"insertOrderedList($event)\"\n >\n <nvb-icon name=\"lists\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('unorderedList')) {\n <button [attr.data-testid]=\"tid('unordered-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.unorderedList' | uiT: 'Unordered list' }}\"\n (mousedown)=\"insertUnorderedList($event)\"\n >\n <nvb-icon name=\"format_list_bulleted\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('taskList')) {\n <button [attr.data-testid]=\"tid('task-list')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isTaskList\"\n title=\"{{ 'richText.taskList' | uiT: 'Task list' }}\"\n (mousedown)=\"toggleTaskList($event)\"\n >\n <nvb-icon [svg]=\"taskListIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n }\n\n @if (hasAnyTool('outdent', 'indent')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('outdent')) {\n <button [attr.data-testid]=\"tid('outdent')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.outdent' | uiT: 'Decrease indent' }}\"\n (mousedown)=\"outdent($event)\"\n >\n <nvb-icon [svg]=\"outdentIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('indent')) {\n <button [attr.data-testid]=\"tid('indent')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.indent' | uiT: 'Increase indent' }}\"\n (mousedown)=\"indent($event)\"\n >\n <nvb-icon [svg]=\"indentIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n }\n\n @if (hasAnyTool('blockquote', 'horizontalRule', 'textColor')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('blockquote')) {\n <button [attr.data-testid]=\"tid('blockquote')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isBlockquote\"\n title=\"{{ 'richText.blockquote' | uiT: 'Quote' }}\"\n (mousedown)=\"toggleBlockquote($event)\"\n >\n <nvb-icon [svg]=\"blockquoteIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('horizontalRule')) {\n <button [attr.data-testid]=\"tid('horizontal-rule')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.horizontalRule' | uiT: 'Horizontal rule' }}\"\n (mousedown)=\"insertHorizontalRule($event)\"\n >\n <nvb-icon [svg]=\"horizontalRuleIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('textColor')) {\n <label\n class=\"nvb-rich-text-editor__color\"\n title=\"{{ 'richText.textColor' | uiT: 'Text color' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n >\n <nvb-icon [svg]=\"textColorIconSvg\"></nvb-icon>\n <input [attr.data-testid]=\"tid('color-input')\"\n type=\"color\"\n [value]=\"textColor\"\n [disabled]=\"readOnly()\"\n (input)=\"onTextColorChange($event)\"\n />\n </label>\n }\n\n @if (isToolEnabled('highlight')) {\n <button [attr.data-testid]=\"tid('highlight')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isHighlighted\"\n title=\"{{ 'richText.highlight' | uiT: 'Highlight' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openHighlightPopup($event)\"\n >\n <nvb-icon [svg]=\"highlightIconSvg\"></nvb-icon>\n <span\n class=\"nvb-rich-text-editor__button-swatch\"\n [style.background]=\"highlightColor\"\n ></span>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('alignLeft', 'alignCenter', 'alignRight', 'alignJustify')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('alignLeft')) {\n <button [attr.data-testid]=\"tid('align-left')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'left'\"\n title=\"{{ 'richText.alignLeft' | uiT: 'Align left' }}\"\n (mousedown)=\"setAlignment('left', $event)\"\n >\n <nvb-icon [svg]=\"alignLeftIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignCenter')) {\n <button [attr.data-testid]=\"tid('align-center')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'center'\"\n title=\"{{ 'richText.alignCenter' | uiT: 'Align center' }}\"\n (mousedown)=\"setAlignment('center', $event)\"\n >\n <nvb-icon [svg]=\"alignCenterIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignRight')) {\n <button [attr.data-testid]=\"tid('align-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'right'\"\n title=\"{{ 'richText.alignRight' | uiT: 'Align right' }}\"\n (mousedown)=\"setAlignment('right', $event)\"\n >\n <nvb-icon [svg]=\"alignRightIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('alignJustify')) {\n <button [attr.data-testid]=\"tid('align-justify')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"align === 'justify'\"\n title=\"{{ 'richText.alignJustify' | uiT: 'Justify' }}\"\n (mousedown)=\"setAlignment('justify', $event)\"\n >\n <nvb-icon [svg]=\"alignJustifyIconSvg\"></nvb-icon>\n </button>\n }\n </div>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n }\n\n @if (hasAnyTool('link', 'image', 'unlink', 'clearFormatting')) {\n <div class=\"nvb-rich-text-editor__toolbar-group\">\n @if (isToolEnabled('link')) {\n <button [attr.data-testid]=\"tid('link')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.link' | uiT: 'Link' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openLinkPopup($event)\"\n >\n <nvb-icon [svg]=\"linkIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('image')) {\n <button [attr.data-testid]=\"tid('image')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.image' | uiT: 'Image' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('image', $event)\"\n >\n <nvb-icon [svg]=\"imageIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('video')) {\n <button [attr.data-testid]=\"tid('video')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.video' | uiT: 'Video' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('video', $event)\"\n >\n <nvb-icon [svg]=\"videoIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('embed')) {\n <button [attr.data-testid]=\"tid('embed')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.embed' | uiT: 'Embed' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openMediaPopup('embed', $event)\"\n >\n <nvb-icon [svg]=\"embedIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('table')) {\n <button\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"showTablePicker || !!activeTableCell\"\n title=\"{{ 'richText.table' | uiT: 'Table' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openTablePicker($event)\"\n data-testid=\"rich-text-table-button\"\n >\n <nvb-icon [svg]=\"tableIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('specialCharacter')) {\n <button [attr.data-testid]=\"tid('special-character')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.specialCharacter' | uiT: 'Special character' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openSpecialCharacterPopup($event)\"\n >\n <nvb-icon [svg]=\"specialCharacterIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('findReplace')) {\n <button [attr.data-testid]=\"tid('find-replace')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"showFindPopup\"\n title=\"{{ 'richText.findReplace' | uiT: 'Find and replace' }}\"\n (mousedown)=\"onToolbarControlMouseDown($event)\"\n (click)=\"openFindPopup($event)\"\n >\n <nvb-icon [svg]=\"findReplaceIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('sourceCode')) {\n <button\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n [class.nvb-rich-text-editor__button--active]=\"isSourceMode\"\n title=\"{{ 'richText.sourceCode' | uiT: 'Source code' }}\"\n (mousedown)=\"toggleSourceMode($event)\"\n data-testid=\"rich-text-source-button\"\n >\n <nvb-icon [svg]=\"sourceCodeIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('unlink')) {\n <button [attr.data-testid]=\"tid('unlink')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.unlink' | uiT: 'Remove link' }}\"\n (mousedown)=\"unlinkSelection($event)\"\n >\n <nvb-icon [svg]=\"unlinkIconSvg\"></nvb-icon>\n </button>\n }\n\n @if (isToolEnabled('clearFormatting')) {\n <button [attr.data-testid]=\"tid('clear-formatting')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"readOnly()\"\n title=\"{{ 'richText.clearFormatting' | uiT: 'Clear formatting' }}\"\n (mousedown)=\"clearFormatting($event)\"\n >\n <nvb-icon name=\"ink_eraser\"></nvb-icon>\n </button>\n }\n </div>\n }\n </div>\n }\n\n <div [attr.data-testid]=\"tid('edit')\"\n #editableRef\n class=\"nvb-rich-text-editor__editable\"\n [class.nvb-rich-text-editor__editable--hidden]=\"isSourceMode\"\n contenteditable=\"true\"\n dir=\"ltr\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.aria-label]=\"'richText.edit' | uiT: 'Edit'\"\n [attr.data-placeholder]=\"placeholder()\"\n (input)=\"onEditorInput()\"\n (click)=\"onEditorClick($event)\"\n (paste)=\"onEditorPaste($event)\"\n (blur)=\"onEditorBlur()\"\n (focus)=\"onEditorFocus()\"\n (keyup)=\"onEditorCursorChange()\"\n (mouseup)=\"onEditorCursorChange()\"\n (scroll)=\"onEditorScroll()\"\n (keydown)=\"onEditorKeyDown($event)\"\n (dragstart)=\"onEditorDragStart($event)\"\n (dragover)=\"onEditorDragOver($event)\"\n (drop)=\"onEditorDrop($event)\"\n (dragend)=\"onEditorDragEnd()\"\n ></div>\n\n @if (isSourceMode) {\n <textarea\n #sourceTextareaRef\n class=\"nvb-rich-text-editor__source\"\n spellcheck=\"false\"\n [value]=\"sourceDraft\"\n [attr.aria-label]=\"'richText.sourceCode' | uiT: 'Source code'\"\n (input)=\"onSourceInput($event)\"\n data-testid=\"rich-text-source-editor\"\n ></textarea>\n }\n\n @if (activeTableCell && !readOnly() && !isSourceMode) {\n <div\n class=\"nvb-rich-text-editor__table-overlay\"\n [style.top.px]=\"tableOverlayTop\"\n [style.left.px]=\"tableOverlayLeft\"\n (mousedown)=\"$event.preventDefault(); $event.stopPropagation()\"\n data-testid=\"rich-text-table-toolbar\"\n >\n <div class=\"nvb-rich-text-editor__table-toolbar\">\n <button [attr.data-testid]=\"tid('table-row-above')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableRowAbove' | uiT: 'Insert row above' }}\"\n (mousedown)=\"addTableRow('above', $event)\"\n >\n <nvb-icon [svg]=\"tableRowAboveIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-row-below')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableRowBelow' | uiT: 'Insert row below' }}\"\n (mousedown)=\"addTableRow('below', $event)\"\n >\n <nvb-icon [svg]=\"tableRowBelowIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete-row')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableDeleteRow' | uiT: 'Delete row' }}\"\n (mousedown)=\"removeTableRow($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteRowIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-column-left')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableColumnLeft' | uiT: 'Insert column left' }}\"\n (mousedown)=\"addTableColumn('left', $event)\"\n >\n <nvb-icon [svg]=\"tableColumnLeftIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-column-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableColumnRight' | uiT: 'Insert column right' }}\"\n (mousedown)=\"addTableColumn('right', $event)\"\n >\n <nvb-icon [svg]=\"tableColumnRightIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete-column')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.tableDeleteColumn' | uiT: 'Delete column' }}\"\n (mousedown)=\"removeTableColumn($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteColumnIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-merge-right')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"!canMergeRight\"\n title=\"{{ 'richText.tableMergeRight' | uiT: 'Merge cell right' }}\"\n (mousedown)=\"mergeCells('right', $event)\"\n >\n <nvb-icon [svg]=\"tableMergeCellsIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-merge-down')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--rotated\"\n [disabled]=\"!canMergeDown\"\n title=\"{{ 'richText.tableMergeDown' | uiT: 'Merge cell down' }}\"\n (mousedown)=\"mergeCells('down', $event)\"\n >\n <nvb-icon [svg]=\"tableMergeCellsIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-split-horizontally')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [disabled]=\"!canSplitHorizontally\"\n title=\"{{ 'richText.tableSplitHorizontally' | uiT: 'Split cell horizontally' }}\"\n (mousedown)=\"splitCell('horizontal', $event)\"\n >\n <nvb-icon [svg]=\"tableSplitCellIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-split-vertically')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--rotated\"\n [disabled]=\"!canSplitVertically\"\n title=\"{{ 'richText.tableSplitVertically' | uiT: 'Split cell vertically' }}\"\n (mousedown)=\"splitCell('vertical', $event)\"\n >\n <nvb-icon [svg]=\"tableSplitCellIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-header-row')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"hasTableHeaderRow\"\n title=\"{{ 'richText.tableHeaderRow' | uiT: 'Header row' }}\"\n (mousedown)=\"toggleHeaderRow($event)\"\n >\n <nvb-icon [svg]=\"tableHeaderRowIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-header-column')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"hasTableHeaderColumn\"\n title=\"{{ 'richText.tableHeaderColumn' | uiT: 'Header column' }}\"\n (mousedown)=\"toggleHeaderColumn($event)\"\n >\n <nvb-icon [svg]=\"tableHeaderColumnIconSvg\"></nvb-icon>\n </button>\n\n <span class=\"nvb-rich-text-editor__toolbar-divider\" aria-hidden=\"true\"></span>\n\n <button [attr.data-testid]=\"tid('table-cell-background')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"showTableCellColorPopup\"\n title=\"{{ 'richText.tableCellBackground' | uiT: 'Cell background' }}\"\n (mousedown)=\"openTableCellColorPopup($event)\"\n >\n <nvb-icon [svg]=\"tableCellBackgroundIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-border-all')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"tableBorder === 'all'\"\n title=\"{{ 'richText.tableBorderAll' | uiT: 'All borders' }}\"\n (mousedown)=\"setTableBorderStyle('all', $event)\"\n >\n <nvb-icon [svg]=\"tableIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-border-none')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n [class.nvb-rich-text-editor__button--active]=\"tableBorder === 'none'\"\n title=\"{{ 'richText.tableBorderNone' | uiT: 'No borders' }}\"\n (mousedown)=\"setTableBorderStyle('none', $event)\"\n >\n <nvb-icon name=\"check_box_outline_blank\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('table-delete')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button nvb-rich-text-editor__button--danger\"\n title=\"{{ 'richText.tableDelete' | uiT: 'Delete table' }}\"\n (mousedown)=\"removeTable($event)\"\n >\n <nvb-icon [svg]=\"tableDeleteIconSvg\"></nvb-icon>\n </button>\n </div>\n\n @if (showTableCellColorPopup) {\n <div class=\"nvb-rich-text-editor__swatches nvb-rich-text-editor__swatches--table\">\n @for (swatch of tableCellBackgroundSwatches; track swatch; let tidIndex1 = $index) {\n <button [attr.data-testid]=\"tid('swatch', tidIndex1)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__swatch\"\n [class.nvb-rich-text-editor__swatch--clear]=\"swatch === 'transparent'\"\n [style.background]=\"swatch\"\n [title]=\"swatch\"\n (mousedown)=\"applyTableCellColor(swatch, $event)\"\n ></button>\n }\n </div>\n }\n </div>\n\n @for (handle of tableColumnHandles; track handle.index) {\n <div\n class=\"nvb-rich-text-editor__column-handle\"\n [style.left.px]=\"handle.left\"\n [style.top.px]=\"handle.top\"\n [style.height.px]=\"handle.height\"\n (mousedown)=\"startTableColumnResize(handle.index, $event)\"\n ></div>\n }\n }\n\n @if (showHighlightPopup) {\n <div\n class=\"nvb-rich-text-editor__popup\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <div class=\"nvb-rich-text-editor__swatches\">\n @for (swatch of highlightSwatches; track swatch; let tidIndex2 = $index) {\n <button [attr.data-testid]=\"tid('swatch', tidIndex2)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__swatch\"\n [style.background]=\"swatch\"\n [title]=\"swatch\"\n (mousedown)=\"applyHighlight(swatch, $event)\"\n ></button>\n }\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <label class=\"nvb-rich-text-editor__popup-color\">\n <input [attr.data-testid]=\"tid('color-input-2')\" type=\"color\" [value]=\"highlightColor\" (input)=\"onHighlightColorInput($event)\" />\n <span>{{ 'richText.customColor' | uiT: 'Custom' }}</span>\n </label>\n <button [attr.data-testid]=\"tid('highlight-none')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"clearHighlight($event)\"\n >\n {{ 'richText.removeHighlight' | uiT: 'None' }}\n </button>\n </div>\n </div>\n }\n\n @if (showTablePicker) {\n <div\n class=\"nvb-rich-text-editor__popup\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-table-picker\"\n >\n <div class=\"nvb-rich-text-editor__table-grid\" (mouseleave)=\"onTablePickerLeave()\">\n @for (row of tablePickerRowRange; track row; let tidIndex3 = $index) {\n <div class=\"nvb-rich-text-editor__table-grid-row\">\n @for (column of tablePickerColumnRange; track column; let tidIndex4 = $index) {\n <button [attr.data-testid]=\"tid('table-grid-cell', tidIndex3, tidIndex4)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__table-grid-cell\"\n [class.nvb-rich-text-editor__table-grid-cell--active]=\"\n row < tablePickerRows && column < tablePickerColumns\n \"\n (mouseenter)=\"onTablePickerHover(row, column)\"\n (mousedown)=\"confirmTablePicker(row, column, $event)\"\n ></button>\n }\n </div>\n }\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <span class=\"nvb-rich-text-editor__popup-hint\">\n {{ tablePickerRows || 0 }} &times; {{ tablePickerColumns || 0 }}\n </span>\n <button [attr.data-testid]=\"tid('table-picker-header')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"tablePickerWithHeader\"\n (mousedown)=\"toggleTablePickerHeader($event)\"\n >\n {{ 'richText.tableHeaderRow' | uiT: 'Header row' }}\n </button>\n </div>\n </div>\n }\n\n @if (showSpecialCharacterPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--characters\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n @for (character of specialCharacters; track character; let tidIndex5 = $index) {\n <button [attr.data-testid]=\"tid('character', tidIndex5)\"\n type=\"button\"\n class=\"nvb-rich-text-editor__character\"\n (mousedown)=\"insertSpecialCharacter(character, $event)\"\n >\n {{ character }}\n </button>\n }\n </div>\n }\n\n @if (showMediaPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--media\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-media-popup\"\n >\n @if (mediaKind === 'image') {\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('upload')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"mediaSource === 'upload'\"\n (mousedown)=\"setMediaSource('upload', $event)\"\n >\n {{ 'richText.mediaUpload' | uiT: 'Upload' }}\n </button>\n <button [attr.data-testid]=\"tid('url')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"mediaSource === 'url'\"\n (mousedown)=\"setMediaSource('url', $event)\"\n >\n {{ 'richText.mediaUrl' | uiT: 'By URL' }}\n </button>\n </div>\n }\n\n <input [attr.data-testid]=\"tid('media-url')\"\n #mediaUrlInputRef\n type=\"url\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"mediaUrl\"\n [placeholder]=\"\n mediaKind === 'image'\n ? ('richText.imagePrompt' | uiT: 'Enter image URL or data:image base64')\n : mediaKind === 'video'\n ? ('richText.videoPrompt' | uiT: 'Enter video or YouTube URL')\n : ('richText.embedPrompt' | uiT: 'Enter page URL to embed')\n \"\n (input)=\"onMediaUrlInput($event)\"\n (keydown.enter)=\"applyMediaFromPopup($event)\"\n (keydown.escape)=\"closeMediaPopup()\"\n />\n\n @if (mediaKind === 'image') {\n <input [attr.data-testid]=\"tid('media-alt')\"\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"mediaAlt\"\n [placeholder]=\"'richText.imageAlt' | uiT: 'Alternative text'\"\n (input)=\"onMediaAltInput($event)\"\n />\n }\n\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('media-apply')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"applyMediaFromPopup($event)\"\n >\n {{ 'richText.apply' | uiT: 'Apply' }}\n </button>\n <button [attr.data-testid]=\"tid('media-cancel')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"closeMediaPopup($event)\"\n >\n {{ 'richText.cancel' | uiT: 'Cancel' }}\n </button>\n </div>\n </div>\n }\n\n @if (showFindPopup) {\n <div\n class=\"nvb-rich-text-editor__popup nvb-rich-text-editor__popup--find\"\n [style.top.px]=\"popupTop\"\n [style.left.px]=\"popupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n data-testid=\"rich-text-find-popup\"\n >\n <input [attr.data-testid]=\"tid('find-input')\"\n #findInputRef\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"findQuery\"\n [placeholder]=\"'richText.find' | uiT: 'Find'\"\n (input)=\"onFindQueryInput($event)\"\n (keydown.enter)=\"findNext($event)\"\n (keydown.escape)=\"closeFindPopup()\"\n />\n <input [attr.data-testid]=\"tid('replace-input')\"\n type=\"text\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"replaceValue\"\n [placeholder]=\"'richText.replaceWith' | uiT: 'Replace with'\"\n (input)=\"onReplaceValueInput($event)\"\n />\n <div class=\"nvb-rich-text-editor__popup-row\">\n <button [attr.data-testid]=\"tid('find-match-case')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n [class.nvb-rich-text-editor__link-button--primary]=\"findMatchCase\"\n (mousedown)=\"toggleFindMatchCase($event)\"\n >\n {{ 'richText.matchCase' | uiT: 'Aa' }}\n </button>\n <button [attr.data-testid]=\"tid('find-previous')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"findPrevious($event)\"\n >\n {{ 'richText.findPrevious' | uiT: 'Previous' }}\n </button>\n <button [attr.data-testid]=\"tid('find-next')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"findNext($event)\"\n >\n {{ 'richText.findNext' | uiT: 'Next' }}\n </button>\n </div>\n <div class=\"nvb-rich-text-editor__popup-row\">\n <span class=\"nvb-rich-text-editor__popup-hint\">{{ findStatus }}</span>\n <button [attr.data-testid]=\"tid('replace-current')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"replaceCurrent($event)\"\n >\n {{ 'richText.replace' | uiT: 'Replace' }}\n </button>\n <button [attr.data-testid]=\"tid('replace-all')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"replaceAll($event)\"\n >\n {{ 'richText.replaceAll' | uiT: 'Replace all' }}\n </button>\n </div>\n </div>\n }\n\n @if (selectedMediaNode && !readOnly()) {\n <div\n class=\"nvb-rich-text-editor__media-overlay\"\n [style.top.px]=\"mediaOverlayTop - 36\"\n [style.left.px]=\"mediaOverlayLeft\"\n [style.width.px]=\"mediaOverlayWidth\"\n >\n <div class=\"nvb-rich-text-editor__media-toolbar\">\n <button [attr.data-testid]=\"tid('align-left-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignLeft' | uiT: 'Align left' }}\"\n (mousedown)=\"setSelectedMediaAlignment('left', $event)\"\n >\n <nvb-icon [svg]=\"alignLeftIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-center-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignCenter' | uiT: 'Align center' }}\"\n (mousedown)=\"setSelectedMediaAlignment('center', $event)\"\n >\n <nvb-icon [svg]=\"alignCenterIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-right-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignRight' | uiT: 'Align right' }}\"\n (mousedown)=\"setSelectedMediaAlignment('right', $event)\"\n >\n <nvb-icon [svg]=\"alignRightIconSvg\"></nvb-icon>\n </button>\n <button [attr.data-testid]=\"tid('align-justify-2')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__button\"\n title=\"{{ 'richText.alignJustify' | uiT: 'Justify' }}\"\n (mousedown)=\"setSelectedMediaAlignment('justify', $event)\"\n >\n <nvb-icon [svg]=\"alignJustifyIconSvg\"></nvb-icon>\n </button>\n </div>\n </div>\n\n <button [attr.data-testid]=\"tid('media-resize-handle')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__media-resize-handle\"\n [style.left.px]=\"mediaResizeHandleLeft\"\n [style.top.px]=\"mediaResizeHandleTop\"\n (mousedown)=\"startMediaResizeDrag($event)\"\n aria-label=\"Resize media\"\n ></button>\n }\n\n @if (showMediaDropCaret && !readOnly()) {\n <div\n class=\"nvb-rich-text-editor__drop-caret\"\n [style.left.px]=\"mediaDropCaretLeft\"\n [style.top.px]=\"mediaDropCaretTop\"\n [style.height.px]=\"mediaDropCaretHeight\"\n ></div>\n }\n\n @if (showLinkPopup) {\n <div\n #linkPopupRef\n class=\"nvb-rich-text-editor__link-popup\"\n [style.top.px]=\"linkPopupTop\"\n [style.left.px]=\"linkPopupLeft\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <input [attr.data-testid]=\"tid('link-url')\"\n #linkUrlInputRef\n type=\"url\"\n class=\"nvb-rich-text-editor__link-input\"\n [value]=\"linkUrl\"\n [placeholder]=\"'richText.linkPlaceholder' | uiT: 'https://example.com'\"\n (input)=\"onLinkUrlInput($event)\"\n (keydown.enter)=\"applyLinkFromKeyboard($event)\"\n (keydown.escape)=\"closeLinkPopup()\"\n />\n <button [attr.data-testid]=\"tid('link-apply')\"\n #linkButtonRef\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button nvb-rich-text-editor__link-button--primary\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"applyLink($event)\"\n >\n {{ 'richText.apply' | uiT: 'Apply' }}\n </button>\n <button [attr.data-testid]=\"tid('link-cancel')\"\n type=\"button\"\n class=\"nvb-rich-text-editor__link-button\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"closeLinkPopup($event)\"\n >\n {{ 'richText.cancel' | uiT: 'Cancel' }}\n </button>\n </div>\n }\n\n @if (showWordCount() && !readOnly()) {\n <div class=\"nvb-rich-text-editor__status\" data-testid=\"rich-text-status\">\n <span>{{ 'richText.words' | uiT: 'Words' }}: {{ wordCount() }}</span>\n <span>{{ 'richText.characters' | uiT: 'Characters' }}: {{ characterCount() }}</span>\n </div>\n }\n\n <input [attr.data-testid]=\"tid('image-input')\"\n #imageInputRef\n class=\"nvb-rich-text-editor__image-input\"\n type=\"file\"\n accept=\"image/*\"\n hidden\n (change)=\"onImageFileSelected($event)\"\n />\n</section>\n",styles:['@charset "UTF-8";.nvb-rich-text-editor{position:relative;width:100%;height:100%;min-height:0;max-height:100%;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);overflow:hidden;display:flex;flex-direction:column}.nvb-rich-text-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;align-content:center;gap:2px;padding:4px 6px;border-bottom:1px solid var(--nvb-color-neutral-200);background:var(--nvb-color-neutral-000);position:relative;z-index:2}.nvb-rich-text-editor__toolbar-group{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:0;padding:0;border:0;border-radius:0;background:transparent;min-width:0}.nvb-rich-text-editor__toolbar-group--selects{flex:0 1 auto;gap:2px}.nvb-rich-text-editor__toolbar-divider{width:1px;height:16px;background:var(--nvb-color-neutral-200);flex:0 0 auto;margin:0 2px}.nvb-rich-text-editor__toolbar-divider:first-child,.nvb-rich-text-editor__toolbar-divider:last-child{display:none}.nvb-rich-text-editor__select{min-width:0;max-width:160px;font-size:12px;--nvb-input-height: 26px;--nvb-input-radius: var(--nvb-radius-sm);--nvb-select-fit-min-width: 44px;--nvb-select-fit-menu-max-width: 140px;--nvb-select-trigger-border-color: transparent;--nvb-select-trigger-bg: transparent;--nvb-select-trigger-hover-bg: var(--nvb-color-neutral-100);--nvb-select-trigger-focus-ring: none;--nvb-select-trigger-focus-border-color: var(--nvb-color-primary-500);--nvb-select-trigger-padding-inline-start: 6px;--nvb-select-trigger-padding-inline-end: 20px;--nvb-select-arrow-inset-inline-end: 6px}.nvb-rich-text-editor__select--size{min-width:56px;max-width:64px;--nvb-select-fit-menu-max-width: 90px;--nvb-select-fit-min-width: 56px}.nvb-rich-text-editor__select--line-height{min-width:56px;max-width:68px;--nvb-select-fit-menu-max-width: 90px;--nvb-select-fit-min-width: 56px}.nvb-rich-text-editor__select-icon{display:inline-flex;align-items:center;color:var(--nvb-color-neutral-600);margin-inline-end:2px}.nvb-rich-text-editor__select-icon .nvb-icon-svg{width:17px;height:17px}.nvb-rich-text-editor__select--heading{min-width:52px;max-width:52px;--nvb-select-fit-min-width: 52px;--nvb-select-fit-menu-max-width: 80px}.nvb-rich-text-editor__select--font{min-width:116px;max-width:136px;--nvb-select-fit-min-width: 116px;--nvb-select-fit-menu-max-width: 180px}.nvb-rich-text-editor__select.nvb-select--fit-content{width:fit-content}.nvb-rich-text-editor__button,.nvb-rich-text-editor__color{width:28px;min-width:28px;height:28px;border:1px solid transparent;border-radius:var(--nvb-radius-sm);display:inline-flex;align-items:center;justify-content:center;color:var(--nvb-color-neutral-700);background:transparent;cursor:pointer;padding:0;transition:background-color .1s ease,border-color .1s ease,color .1s ease}.nvb-rich-text-editor__button--text{width:auto;min-width:0;padding:0 8px;font-size:12px;font-weight:500}.nvb-rich-text-editor__button--line-height{width:auto;min-width:0;padding:0 6px;gap:3px}.nvb-rich-text-editor__button-value{min-width:10px;font-size:11px;font-weight:600;line-height:1}.nvb-rich-text-editor__button:hover,.nvb-rich-text-editor__color:hover{background:var(--nvb-color-neutral-100);color:var(--nvb-color-neutral-900)}.nvb-rich-text-editor__button:disabled,.nvb-rich-text-editor__color:has(input:disabled){opacity:.45;cursor:default;background:transparent}.nvb-rich-text-editor__button--active{background:color-mix(in oklch,var(--nvb-color-primary-500) 10%,var(--nvb-color-neutral-000));border-color:color-mix(in oklch,var(--nvb-color-primary-500) 40%,transparent);color:var(--nvb-color-primary-700)}.nvb-rich-text-editor__button .nvb-icon-svg,.nvb-rich-text-editor__color .nvb-icon-svg{font-size:16px}.nvb-rich-text-editor__color{position:relative;overflow:hidden}.nvb-rich-text-editor__color input[type=color]{position:absolute;inset:0;opacity:0;cursor:pointer}.nvb-rich-text-editor__link-popup{position:absolute;z-index:10;display:flex;flex-wrap:nowrap;align-items:center;gap:6px;padding:6px 8px;width:min(340px,100% - 16px);border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);box-shadow:0 2px 8px color-mix(in oklch,var(--nvb-color-neutral-900) 10%,transparent),0 8px 20px color-mix(in oklch,var(--nvb-color-neutral-900) 8%,transparent)}.nvb-rich-text-editor__link-input{flex:1 1 0;min-width:0;height:28px;border:1px solid var(--nvb-color-neutral-300);border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-000);color:var(--nvb-color-neutral-800);padding:0 8px;font-size:12px;outline:none}.nvb-rich-text-editor__link-input:focus{border-color:var(--nvb-color-primary-500);box-shadow:0 0 0 1px color-mix(in oklch,var(--nvb-color-primary-500) 30%,transparent)}.nvb-rich-text-editor__link-button{flex:0 0 auto;height:28px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-sm);padding:0 10px;font-size:12px;font-weight:500;color:var(--nvb-color-neutral-700);background:var(--nvb-color-neutral-050);cursor:pointer;white-space:nowrap;transition:background-color .1s ease,border-color .1s ease}.nvb-rich-text-editor__link-button:hover{background:var(--nvb-color-neutral-100);border-color:var(--nvb-color-neutral-300)}.nvb-rich-text-editor__link-button--primary{background:var(--nvb-color-primary-600);border-color:var(--nvb-color-primary-600);color:#fff}.nvb-rich-text-editor__link-button--primary:hover{background:var(--nvb-color-primary-700);border-color:var(--nvb-color-primary-700)}.nvb-rich-text-editor__editable{min-height:0;flex:1 1 auto;padding:12px 14px;font-family:var(--nvb-font-family, var(--nvb-font-family-base, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif));font-size:14px;font-weight:400;line-height:1.6;color:var(--nvb-color-neutral-800);outline:none;white-space:pre-wrap;word-break:break-word;direction:ltr;unicode-bidi:normal;text-align:left;overflow:auto}.nvb-rich-text-editor__media-overlay{position:absolute;z-index:4;display:flex;justify-content:center;pointer-events:none}.nvb-rich-text-editor__media-toolbar{display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:color-mix(in oklch,var(--nvb-color-neutral-000) 96%,transparent);box-shadow:0 2px 6px color-mix(in oklch,var(--nvb-color-neutral-900) 10%,transparent),0 4px 14px color-mix(in oklch,var(--nvb-color-neutral-900) 6%,transparent);pointer-events:auto}.nvb-rich-text-editor__media-resize-handle{position:absolute;z-index:5;width:18px;height:18px;border:2px solid var(--nvb-color-primary-600);border-radius:50%;background:var(--nvb-color-neutral-000);box-shadow:0 2px 8px color-mix(in oklch,var(--nvb-color-neutral-900) 18%,transparent);cursor:nwse-resize}.nvb-rich-text-editor__drop-caret{position:absolute;z-index:6;width:2px;min-height:18px;border-radius:var(--nvb-radius-full);background:var(--nvb-color-primary-600);box-shadow:0 0 0 1px color-mix(in oklch,var(--nvb-color-neutral-000) 88%,transparent);pointer-events:none}.nvb-rich-text-editor__editable[contenteditable=false]{background:var(--nvb-color-neutral-050);cursor:default}.nvb-rich-text-editor--minimal-viewer{border:0;border-radius:0;background:transparent;overflow:visible;height:auto;min-height:0;max-height:none}.nvb-rich-text-editor--minimal-viewer .nvb-rich-text-editor__editable{padding:0;min-height:0;overflow:visible;background:transparent;border:0}.nvb-rich-text-editor--minimal-viewer .nvb-rich-text-editor__editable[contenteditable=false]{background:transparent}.nvb-rich-text-editor__editable:empty:before{content:attr(data-placeholder);color:var(--nvb-color-neutral-400);pointer-events:none}.nvb-rich-text-editor__editable p,.nvb-rich-text-editor__editable h1,.nvb-rich-text-editor__editable h2,.nvb-rich-text-editor__editable h3,.nvb-rich-text-editor__editable h4,.nvb-rich-text-editor__editable h5,.nvb-rich-text-editor__editable h6,.nvb-rich-text-editor__editable ul,.nvb-rich-text-editor__editable ol,.nvb-rich-text-editor__editable blockquote,.nvb-rich-text-editor__editable li,.nvb-rich-text-editor__editable div,.nvb-rich-text-editor__editable pre{margin:0;padding:0}.nvb-rich-text-editor__editable>:last-child{margin-bottom:0}.nvb-rich-text-editor__editable ul,.nvb-rich-text-editor__editable ol{padding-left:22px}.nvb-rich-text-editor__editable ul{list-style:disc outside!important}.nvb-rich-text-editor__editable ol{list-style:decimal outside!important}.nvb-rich-text-editor__editable li{display:list-item!important}.nvb-rich-text-editor__editable .nvb-rt-font-system{font-family:Segoe UI,system-ui,Tahoma,Geneva,Verdana,sans-serif}.nvb-rich-text-editor__editable .nvb-rt-font-ibm-plex-sans{font-family:IBM Plex Sans,Segoe UI,sans-serif}.nvb-rich-text-editor__editable .nvb-rt-font-georgia{font-family:Georgia,Times New Roman,serif}.nvb-rich-text-editor__editable .nvb-rt-font-courier{font-family:Courier New,Courier,monospace}.nvb-rich-text-editor__editable .nvb-rt-size-8{font-size:8px}.nvb-rich-text-editor__editable .nvb-rt-size-9{font-size:9px}.nvb-rich-text-editor__editable .nvb-rt-size-10{font-size:10px}.nvb-rich-text-editor__editable .nvb-rt-size-11{font-size:11px}.nvb-rich-text-editor__editable .nvb-rt-size-12{font-size:12px}.nvb-rich-text-editor__editable .nvb-rt-size-14{font-size:14px}.nvb-rich-text-editor__editable .nvb-rt-size-16{font-size:16px}.nvb-rich-text-editor__editable .nvb-rt-size-18{font-size:18px}.nvb-rich-text-editor__editable .nvb-rt-size-20{font-size:20px}.nvb-rich-text-editor__editable .nvb-rt-size-24{font-size:24px}.nvb-rich-text-editor__editable .nvb-rt-size-28{font-size:28px}.nvb-rich-text-editor__editable .nvb-rt-size-32{font-size:32px}.nvb-rich-text-editor__editable .nvb-rt-size-36{font-size:36px}.nvb-rich-text-editor__editable .nvb-rt-size-48{font-size:48px}.nvb-rich-text-editor__editable .nvb-rt-size-72{font-size:72px}.nvb-rich-text-editor__editable .nvb-rt-size-small{font-size:12px}.nvb-rich-text-editor__editable .nvb-rt-size-normal{font-size:14px}.nvb-rich-text-editor__editable .nvb-rt-size-large{font-size:20px}.nvb-rich-text-editor__editable .nvb-rt-size-xlarge{font-size:28px}.nvb-rich-text-editor__editable .nvb-rt-align-left{text-align:left}.nvb-rich-text-editor__editable .nvb-rt-align-center{text-align:center}.nvb-rich-text-editor__editable .nvb-rt-align-right{text-align:right}.nvb-rich-text-editor__editable .nvb-rt-align-justify{text-align:justify}.nvb-rich-text-editor__editable .nvb-rt-leading-1{line-height:1}.nvb-rich-text-editor__editable .nvb-rt-leading-1-15{line-height:1.15}.nvb-rich-text-editor__editable .nvb-rt-leading-1-25{line-height:1.25}.nvb-rich-text-editor__editable .nvb-rt-leading-1-5{line-height:1.5}.nvb-rich-text-editor__editable .nvb-rt-leading-1-6{line-height:1.6}.nvb-rich-text-editor__editable .nvb-rt-leading-1-75{line-height:1.75}.nvb-rich-text-editor__editable .nvb-rt-leading-2{line-height:2}.nvb-rich-text-editor__editable .nvb-rt-leading-2-5{line-height:2.5}.nvb-rich-text-editor__editable .nvb-rt-leading-3{line-height:3}.nvb-rich-text-editor__editable .nvb-rt-leading-tight{line-height:1.25}.nvb-rich-text-editor__editable .nvb-rt-leading-normal{line-height:1.6}.nvb-rich-text-editor__editable .nvb-rt-leading-relaxed{line-height:2}.nvb-rich-text-editor__editable blockquote{margin:0;padding-left:12px;border-left:3px solid color-mix(in oklch,var(--nvb-color-primary-500) 30%,var(--nvb-color-neutral-300));color:var(--nvb-color-neutral-600)}.nvb-rich-text-editor__editable hr{border:0;border-top:1px solid var(--nvb-color-neutral-200);margin:12px 0}.nvb-rich-text-editor__editable mark{padding:0 .12em;border-radius:.2em;background:color-mix(in oklch,var(--nvb-color-warning-400, #f59e0b) 24%,white)}.nvb-rich-text-editor__editable code{display:inline;padding:.1em .3em;border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-100);border:1px solid var(--nvb-color-neutral-200);font-family:Cascadia Code,Courier New,Courier,monospace;font-size:.88em}.nvb-rich-text-editor__editable pre{display:block;margin:.5em 0;padding:12px 14px;border-radius:var(--nvb-radius-lg);background:var(--nvb-color-neutral-100);border:1px solid var(--nvb-color-neutral-200);overflow-x:auto;white-space:pre}.nvb-rich-text-editor__editable pre code{display:block;padding:0;border:none;background:transparent;font-size:.86em;line-height:1.55;white-space:pre}.nvb-rich-text-editor__editable a,.nvb-rich-text-editor__editable a.nvb-rt-link{color:var(--nvb-color-primary-700);text-decoration:underline;cursor:pointer}.nvb-rich-text-editor__editable :where(strong,b){font-weight:600}.nvb-rich-text-editor__editable :where(em,i){font-style:italic}.nvb-rich-text-editor__editable :where(u){text-decoration:underline}.nvb-rich-text-editor__editable :where(s,strike){text-decoration:line-through}.nvb-rich-text-editor__editable .nvb-rt-image{max-width:min(240px,100%);height:auto;vertical-align:middle}.nvb-rich-text-editor__editable .nvb-rt-media-node{position:relative;display:inline-block;max-width:100%;margin:6px 0;clear:both;cursor:grab;line-height:0}.nvb-rich-text-editor__editable .nvb-rt-media-node img,.nvb-rich-text-editor__editable .nvb-rt-media-node video,.nvb-rich-text-editor__editable .nvb-rt-media-node iframe{display:block;max-width:100%;border-radius:var(--nvb-radius-sm);pointer-events:none}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-left{float:left;margin:6px 14px 0 0}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-right{float:right;margin:6px 0 0 14px}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-center{display:block;width:fit-content;float:none;margin:10px auto;max-width:100%}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify{display:block;float:none;width:100%;margin:10px 0}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>img,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>video,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-justify>iframe{width:100%;max-width:100%}.nvb-rich-text-editor__editable .nvb-rt-media-node:focus-within,.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-selected{outline:2px solid color-mix(in oklch,var(--nvb-color-primary-500) 50%,transparent);outline-offset:2px}.nvb-rich-text-editor__editable .nvb-rt-media-node.nvb-rt-media-dragging{opacity:.65;cursor:grabbing}.nvb-rich-text-editor__editable .nvb-rt-video{aspect-ratio:16/9}@media(max-width:768px){.nvb-rich-text-editor__toolbar{gap:4px;padding:6px}.nvb-rich-text-editor__toolbar-group,.nvb-rich-text-editor__toolbar-group--selects{width:100%}.nvb-rich-text-editor__toolbar-divider{display:none}.nvb-rich-text-editor__select{max-width:none}.nvb-rich-text-editor__link-popup{width:calc(100% - 16px);left:8px!important}}.nvb-rich-text-editor__editable table.nvb-rt-table{border-collapse:collapse;width:100%;margin:12px 0;table-layout:fixed;font-size:inherit}.nvb-rich-text-editor__editable table.nvb-rt-table td,.nvb-rich-text-editor__editable table.nvb-rt-table th{padding:6px 8px;vertical-align:top;min-width:24px;word-break:break-word}.nvb-rich-text-editor__editable table.nvb-rt-table th{background:var(--nvb-color-neutral-100, #f1f5f9);font-weight:600;text-align:left}.nvb-rich-text-editor__editable table.nvb-rt-table-border-all td,.nvb-rich-text-editor__editable table.nvb-rt-table-border-all th,.nvb-rich-text-editor__editable table.nvb-rt-table-border-outer{border:1px solid var(--nvb-color-neutral-300, #cbd5e1)}.nvb-rich-text-editor__editable table.nvb-rt-table-border-none td,.nvb-rich-text-editor__editable table.nvb-rt-table-border-none th{border:0}.nvb-rich-text-editor__editable[contenteditable=true] table.nvb-rt-table-border-none td,.nvb-rich-text-editor__editable[contenteditable=true] table.nvb-rt-table-border-none th{outline:1px dashed var(--nvb-color-neutral-200, #e2e8f0);outline-offset:-1px}.nvb-rich-text-editor__editable table.nvb-rt-table-active{box-shadow:0 0 0 1px var(--nvb-color-primary-400, #60a5fa)}.nvb-rich-text-editor__editable table.nvb-rt-table .nvb-rt-valign-middle{vertical-align:middle}.nvb-rich-text-editor__editable table.nvb-rt-table .nvb-rt-valign-bottom{vertical-align:bottom}.nvb-rich-text-editor__editable table.nvb-rt-table td>:last-child,.nvb-rich-text-editor__editable table.nvb-rt-table th>:last-child{margin-bottom:0}.nvb-rich-text-editor__editable ul.nvb-rt-task-list{list-style:none;padding-inline-start:4px}.nvb-rich-text-editor__editable li.nvb-rt-task-item{list-style:none;position:relative;padding-inline-start:26px;display:block}.nvb-rich-text-editor__editable li.nvb-rt-task-item:before{content:"";position:absolute;inset-inline-start:0;top:.22em;width:15px;height:15px;border:1.5px solid var(--nvb-color-neutral-400, #94a3b8);border-radius:var(--nvb-radius-sm);background:var(--nvb-color-neutral-000, #fff);box-sizing:border-box}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked:before{background:var(--nvb-color-primary-500, #3b82f6);border-color:var(--nvb-color-primary-500, #3b82f6)}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked:after{content:"";position:absolute;inset-inline-start:5px;top:.4em;width:4px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.nvb-rich-text-editor__editable li.nvb-rt-task-item.nvb-rt-task-checked{color:var(--nvb-color-neutral-500, #64748b);text-decoration:line-through}.nvb-rich-text-editor__editable[contenteditable=true] li.nvb-rt-task-item:before{cursor:pointer}.nvb-rich-text-editor__editable .nvb-rt-indent-1{margin-inline-start:32px}.nvb-rich-text-editor__editable .nvb-rt-indent-2{margin-inline-start:64px}.nvb-rich-text-editor__editable .nvb-rt-indent-3{margin-inline-start:96px}.nvb-rich-text-editor__editable .nvb-rt-indent-4{margin-inline-start:128px}.nvb-rich-text-editor__editable .nvb-rt-indent-5{margin-inline-start:160px}.nvb-rich-text-editor__editable .nvb-rt-indent-6{margin-inline-start:192px}.nvb-rich-text-editor__editable .nvb-rt-indent-7{margin-inline-start:224px}.nvb-rich-text-editor__editable .nvb-rt-indent-8{margin-inline-start:256px}.nvb-rich-text-editor__editable .nvb-rt-embed{display:block;width:100%;aspect-ratio:16/9;border:0;border-radius:var(--nvb-radius-lg)}.nvb-rich-text-editor__button--rotated .nvb-icon-svg{transform:rotate(90deg)}.nvb-rich-text-editor__button--danger:hover{color:var(--nvb-color-danger-600, #dc2626);background:var(--nvb-color-danger-50, #fef2f2)}.nvb-rich-text-editor__button-swatch{position:absolute;inset-inline:5px;bottom:3px;height:3px;border-radius:2px;pointer-events:none}.nvb-rich-text-editor__button{position:relative}.nvb-rich-text-editor__popup{position:fixed;z-index:60;display:flex;flex-direction:column;gap:6px;padding:8px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-lg);background:var(--nvb-color-neutral-000);box-shadow:0 8px 24px #0f172a2e;max-width:280px}.nvb-rich-text-editor__popup--characters{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;max-width:264px}.nvb-rich-text-editor__popup--media,.nvb-rich-text-editor__popup--find{width:260px}.nvb-rich-text-editor__popup-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.nvb-rich-text-editor__popup-hint{font-size:12px;color:var(--nvb-color-neutral-500);margin-inline-end:auto}.nvb-rich-text-editor__popup-color{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--nvb-color-neutral-600);cursor:pointer}.nvb-rich-text-editor__popup-color input[type=color]{width:24px;height:20px;padding:0;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-sm);background:none;cursor:pointer}.nvb-rich-text-editor__swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}.nvb-rich-text-editor__swatches--table{grid-template-columns:repeat(5,1fr);margin-top:6px;padding:6px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000)}.nvb-rich-text-editor__swatch{width:22px;height:22px;border:1px solid var(--nvb-color-neutral-300);border-radius:var(--nvb-radius-sm);cursor:pointer;padding:0}.nvb-rich-text-editor__swatch--clear{background:linear-gradient(45deg,transparent 45%,var(--nvb-color-danger-500, #ef4444) 45%,var(--nvb-color-danger-500, #ef4444) 55%,transparent 55%),var(--nvb-color-neutral-000)}.nvb-rich-text-editor__table-grid{display:flex;flex-direction:column;gap:2px}.nvb-rich-text-editor__table-grid-row{display:flex;gap:2px}.nvb-rich-text-editor__table-grid-cell{width:16px;height:16px;padding:0;border:1px solid var(--nvb-color-neutral-300);border-radius:2px;background:var(--nvb-color-neutral-000);cursor:pointer}.nvb-rich-text-editor__table-grid-cell--active{background:var(--nvb-color-primary-500, #3b82f6);border-color:var(--nvb-color-primary-500, #3b82f6)}.nvb-rich-text-editor__character{height:28px;border:1px solid transparent;border-radius:var(--nvb-radius-sm);background:transparent;cursor:pointer;font-size:15px;color:var(--nvb-color-neutral-800)}.nvb-rich-text-editor__character:hover{background:var(--nvb-color-neutral-100);border-color:var(--nvb-color-neutral-200)}.nvb-rich-text-editor__table-overlay{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start}.nvb-rich-text-editor__table-toolbar{display:inline-flex;align-items:center;gap:1px;padding:3px 4px;border:1px solid var(--nvb-color-neutral-200);border-radius:var(--nvb-radius-md);background:var(--nvb-color-neutral-000);box-shadow:0 6px 18px #0f172a29;flex-wrap:wrap;max-width:100%}.nvb-rich-text-editor__column-handle{position:absolute;width:5px;z-index:14;cursor:col-resize;background:transparent}.nvb-rich-text-editor__column-handle:hover{background:var(--nvb-color-primary-400, #60a5fa);opacity:.6}.nvb-rich-text-editor__editable--hidden{display:none}.nvb-rich-text-editor__source{flex:1 1 auto;min-height:0;width:100%;resize:none;border:0;outline:none;padding:12px 14px;font-family:Courier New,Courier,monospace;font-size:13px;line-height:1.6;color:var(--nvb-color-neutral-800);background:var(--nvb-color-neutral-050, #f8fafc)}.nvb-rich-text-editor__status{display:flex;gap:14px;padding:3px 10px;border-top:1px solid var(--nvb-color-neutral-200);font-size:11px;color:var(--nvb-color-neutral-500);background:var(--nvb-color-neutral-000);flex:0 0 auto}\n']}]}],ctorParameters:()=>[],propDecorators:{html:[{type:h.Input,args:[{isSignal:true,alias:"html",required:false}]}],htmlCss:[{type:h.Input,args:[{isSignal:true,alias:"htmlCss",required:false}]}],readOnly:[{type:h.Input,args:[{isSignal:true,alias:"readOnly",required:false}]}],showToolbar:[{type:h.Input,args:[{isSignal:true,alias:"showToolbar",required:false}]}],emitOnInput:[{type:h.Input,args:[{isSignal:true,alias:"emitOnInput",required:false}]}],placeholder:[{type:h.Input,args:[{isSignal:true,alias:"placeholder",required:false}]}],minimalViewer:[{type:h.Input,args:[{isSignal:true,alias:"minimalViewer",required:false}]}],showWordCount:[{type:h.Input,args:[{isSignal:true,alias:"showWordCount",required:false}]}],enabledTools:[{type:h.Input,args:[{isSignal:true,alias:"enabledTools",required:false}]}],testId:[{type:h.Input,args:[{isSignal:true,alias:"testId",required:false}]}],htmlChange:[{type:C}],htmlCssChange:[{type:C}],editorFocus:[{type:C}],editorBlur:[{type:C}],rootRef:[{type:_,args:["rootRef",{static:true}]}],editableRef:[{type:_,args:["editableRef",{static:true}]}],toolbarRef:[{type:_,args:["toolbarRef"]}],imageInputRef:[{type:_,args:["imageInputRef"]}],linkPopupRef:[{type:_,args:["linkPopupRef"]}],linkButtonRef:[{type:_,args:["linkButtonRef"]}],linkUrlInputRef:[{type:_,args:["linkUrlInputRef"]}],mediaUrlInputRef:[{type:_,args:["mediaUrlInputRef"]}],findInputRef:[{type:_,args:["findInputRef"]}],sourceTextareaRef:[{type:_,args:["sourceTextareaRef"]}],onWindowResize:[{type:S,args:["window:resize"]}],onDocumentMouseMove:[{type:S,args:["document:mousemove",["$event"]]}],onDocumentMouseUp:[{type:S,args:["document:mouseup"]}],onDocumentDragOver:[{type:S,args:["document:dragover",["$event"]]}],onDocumentDrop:[{type:S,args:["document:drop",["$event"]]}],onDocumentSelectionChange:[{type:S,args:["document:selectionchange"]}],onDocumentMouseDown:[{type:S,args:["document:mousedown",["$event"]]}]}});var Z=class ut{html=v("",...ngDevMode?[{debugName:"html"}]:[]);viewerHtml=v(null,...ngDevMode?[{debugName:"viewerHtml"}]:[]);htmlCss=v("",...ngDevMode?[{debugName:"htmlCss"}]:[]);readOnly=v(false,...ngDevMode?[{debugName:"readOnly"}]:[]);showToolbar=v(true,...ngDevMode?[{debugName:"showToolbar"}]:[]);emitOnInput=v(true,...ngDevMode?[{debugName:"emitOnInput"}]:[]);placeholder=v("Write content...",...ngDevMode?[{debugName:"placeholder"}]:[]);minimalViewer=v(false,...ngDevMode?[{debugName:"minimalViewer"}]:[]);showWordCount=v(false,...ngDevMode?[{debugName:"showWordCount"}]:[]);enabledTools=v(null,...ngDevMode?[{debugName:"enabledTools"}]:[]);testId=v("",...ngDevMode?[{debugName:"testId"}]:[]);htmlChange=new y;htmlCssChange=new y;editorFocus=new y;editorBlur=new y;richTextScopeId=`nvb-rich-text-scope-${Math.random().toString(36).slice(2,11)}`;richTextScopeSelector=`[data-nvb-rich-text-scope="${this.richTextScopeId}"]`;markupSecurityService=w(gt);cssScopeService=w(Xt);editorSource=f(()=>this.splitStyleBlocks(String(this.html()??"")),...ngDevMode?[{debugName:"editorSource"}]:[]);viewerSource=f(()=>this.splitStyleBlocks(String(this.viewerHtml()??this.html()??"")),...ngDevMode?[{debugName:"viewerSource"}]:[]);activeSource=f(()=>this.readOnly()?this.viewerSource():this.editorSource(),...ngDevMode?[{debugName:"activeSource"}]:[]);sanitizedEditorHtml=f(()=>this.markupSecurityService.sanitizeRichTextHtml(this.editorSource().html),...ngDevMode?[{debugName:"sanitizedEditorHtml"}]:[]);sanitizedViewerHtml=f(()=>this.markupSecurityService.sanitizeRichTextHtml(this.viewerSource().html),...ngDevMode?[{debugName:"sanitizedViewerHtml"}]:[]);displayHtml=f(()=>this.readOnly()?this.sanitizedViewerHtml():this.sanitizedEditorHtml(),...ngDevMode?[{debugName:"displayHtml"}]:[]);effectiveCss=f(()=>[String(this.htmlCss()??"").trim(),this.activeSource().css].filter((t,e,n)=>t.length>0&&n.indexOf(t)===e).join("\n\n"),...ngDevMode?[{debugName:"effectiveCss"}]:[]);renderedCss=f(()=>this.cssScopeService.scopeCssText(this.effectiveCss(),this.richTextScopeSelector),...ngDevMode?[{debugName:"renderedCss"}]:[]);styleOutletKey=f(()=>`rich-text:${this.richTextScopeId}:css`,...ngDevMode?[{debugName:"styleOutletKey"}]:[]);onCoreHtmlChange(t){this.htmlChange.emit(this.markupSecurityService.sanitizeRichTextHtml(String(t??"")))}onCoreHtmlCssChange(t){this.htmlCssChange.emit(String(t??""))}onCoreBlur(t){this.editorBlur.emit(this.markupSecurityService.sanitizeRichTextHtml(String(t??"")))}splitStyleBlocks(t){const e=String(t??"");if(!e.trim()||!/<style\b/i.test(e))return{html:e,css:""};const n=[];return{html:e.replace(/<style\b[^>]*>([\s\S]*?)<\/style>/gi,(i,r)=>{const o=String(r??"").trim();if(o)n.push(o);return""}).trim(),css:this.markupSecurityService.sanitizeCssText(n.join("\n\n"))}}static ɵfac=h.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:ut,deps:[],target:h.ɵɵFactoryTarget.Component});static ɵcmp=h.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.2.1",type:ut,isStandalone:true,selector:"nvb-rich-text-editor",inputs:{html:{classPropertyName:"html",publicName:"html",isSignal:true,isRequired:false,transformFunction:null},viewerHtml:{classPropertyName:"viewerHtml",publicName:"viewerHtml",isSignal:true,isRequired:false,transformFunction:null},htmlCss:{classPropertyName:"htmlCss",publicName:"htmlCss",isSignal:true,isRequired:false,transformFunction:null},readOnly:{classPropertyName:"readOnly",publicName:"readOnly",isSignal:true,isRequired:false,transformFunction:null},showToolbar:{classPropertyName:"showToolbar",publicName:"showToolbar",isSignal:true,isRequired:false,transformFunction:null},emitOnInput:{classPropertyName:"emitOnInput",publicName:"emitOnInput",isSignal:true,isRequired:false,transformFunction:null},placeholder:{classPropertyName:"placeholder",publicName:"placeholder",isSignal:true,isRequired:false,transformFunction:null},minimalViewer:{classPropertyName:"minimalViewer",publicName:"minimalViewer",isSignal:true,isRequired:false,transformFunction:null},showWordCount:{classPropertyName:"showWordCount",publicName:"showWordCount",isSignal:true,isRequired:false,transformFunction:null},enabledTools:{classPropertyName:"enabledTools",publicName:"enabledTools",isSignal:true,isRequired:false,transformFunction:null},testId:{classPropertyName:"testId",publicName:"testId",isSignal:true,isRequired:false,transformFunction:null}},outputs:{htmlChange:"htmlChange",htmlCssChange:"htmlCssChange",editorFocus:"editorFocus",editorBlur:"editorBlur"},ngImport:h,template:'<section class="nvb-rich-text-host" dir="ltr" [attr.data-nvb-rich-text-scope]="richTextScopeId">\n @if (renderedCss()) {\n <nvb-style-outlet\n [cssText]="renderedCss()"\n [renderInPlace]="true"\n [styleKey]="styleOutletKey()"\n ></nvb-style-outlet>\n }\n\n <nvb-rich-text-editor-core\n [html]="displayHtml()"\n [htmlCss]="effectiveCss()"\n [readOnly]="readOnly()"\n [showToolbar]="showToolbar()"\n [emitOnInput]="emitOnInput()"\n [placeholder]="placeholder()"\n [minimalViewer]="minimalViewer()"\n [showWordCount]="showWordCount()"\n [enabledTools]="enabledTools()"\n [testId]="testId()"\n (htmlChange)="onCoreHtmlChange($event)"\n (htmlCssChange)="onCoreHtmlCssChange($event)"\n (editorFocus)="editorFocus.emit()"\n (editorBlur)="onCoreBlur($event)"\n ></nvb-rich-text-editor-core>\n</section>\n',styles:['.nvb-rich-text-host{display:block;width:100%;height:100%;min-height:0}.nvb-rich-text{width:100%;color:var(--nvb-color-neutral-800);direction:ltr;unicode-bidi:normal;font-family:var(--nvb-font-family, var(--nvb-font-family-base, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif));font-size:16px;font-weight:400;line-height:1.6;word-break:break-word}.nvb-rich-text :where(h1,h2,h3,h4,h5,h6){margin:0 0 12px;color:var(--nvb-color-neutral-900);line-height:1.25}.nvb-rich-text :where(p,ul,ol,blockquote,pre){margin:0 0 12px}.nvb-rich-text :where(ul,ol){padding-inline-start:22px}.nvb-rich-text :where(blockquote){border-inline-start:3px solid var(--nvb-color-neutral-300);padding-inline-start:12px}.nvb-rich-text :where(pre){border-radius:var(--nvb-radius-lg);border:1px solid var(--nvb-color-neutral-300);background:var(--nvb-color-neutral-050);padding:10px 12px;overflow:auto}.nvb-rich-text :where(strong,b){font-weight:700}.nvb-rich-text :where(em,i){font-style:italic}.nvb-rich-text :where(u){text-decoration:underline}.nvb-rich-text :where(s,strike){text-decoration:line-through}\n'],dependencies:[{kind:"component",type:dt,selector:"nvb-rich-text-editor-core",inputs:["html","htmlCss","readOnly","showToolbar","emitOnInput","placeholder","minimalViewer","showWordCount","enabledTools","testId"],outputs:["htmlChange","htmlCssChange","editorFocus","editorBlur"]},{kind:"component",type:_t,selector:"nvb-style-outlet",inputs:["cssText","renderInPlace","styleKey"]}],changeDetection:h.ChangeDetectionStrategy.Eager})};h.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:Z,decorators:[{type:j,args:[{selector:"nvb-rich-text-editor",imports:[dt,_t],changeDetection:K.Eager,template:'<section class="nvb-rich-text-host" dir="ltr" [attr.data-nvb-rich-text-scope]="richTextScopeId">\n @if (renderedCss()) {\n <nvb-style-outlet\n [cssText]="renderedCss()"\n [renderInPlace]="true"\n [styleKey]="styleOutletKey()"\n ></nvb-style-outlet>\n }\n\n <nvb-rich-text-editor-core\n [html]="displayHtml()"\n [htmlCss]="effectiveCss()"\n [readOnly]="readOnly()"\n [showToolbar]="showToolbar()"\n [emitOnInput]="emitOnInput()"\n [placeholder]="placeholder()"\n [minimalViewer]="minimalViewer()"\n [showWordCount]="showWordCount()"\n [enabledTools]="enabledTools()"\n [testId]="testId()"\n (htmlChange)="onCoreHtmlChange($event)"\n (htmlCssChange)="onCoreHtmlCssChange($event)"\n (editorFocus)="editorFocus.emit()"\n (editorBlur)="onCoreBlur($event)"\n ></nvb-rich-text-editor-core>\n</section>\n',styles:['.nvb-rich-text-host{display:block;width:100%;height:100%;min-height:0}.nvb-rich-text{width:100%;color:var(--nvb-color-neutral-800);direction:ltr;unicode-bidi:normal;font-family:var(--nvb-font-family, var(--nvb-font-family-base, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif));font-size:16px;font-weight:400;line-height:1.6;word-break:break-word}.nvb-rich-text :where(h1,h2,h3,h4,h5,h6){margin:0 0 12px;color:var(--nvb-color-neutral-900);line-height:1.25}.nvb-rich-text :where(p,ul,ol,blockquote,pre){margin:0 0 12px}.nvb-rich-text :where(ul,ol){padding-inline-start:22px}.nvb-rich-text :where(blockquote){border-inline-start:3px solid var(--nvb-color-neutral-300);padding-inline-start:12px}.nvb-rich-text :where(pre){border-radius:var(--nvb-radius-lg);border:1px solid var(--nvb-color-neutral-300);background:var(--nvb-color-neutral-050);padding:10px 12px;overflow:auto}.nvb-rich-text :where(strong,b){font-weight:700}.nvb-rich-text :where(em,i){font-style:italic}.nvb-rich-text :where(u){text-decoration:underline}.nvb-rich-text :where(s,strike){text-decoration:line-through}\n']}]}],propDecorators:{html:[{type:h.Input,args:[{isSignal:true,alias:"html",required:false}]}],viewerHtml:[{type:h.Input,args:[{isSignal:true,alias:"viewerHtml",required:false}]}],htmlCss:[{type:h.Input,args:[{isSignal:true,alias:"htmlCss",required:false}]}],readOnly:[{type:h.Input,args:[{isSignal:true,alias:"readOnly",required:false}]}],showToolbar:[{type:h.Input,args:[{isSignal:true,alias:"showToolbar",required:false}]}],emitOnInput:[{type:h.Input,args:[{isSignal:true,alias:"emitOnInput",required:false}]}],placeholder:[{type:h.Input,args:[{isSignal:true,alias:"placeholder",required:false}]}],minimalViewer:[{type:h.Input,args:[{isSignal:true,alias:"minimalViewer",required:false}]}],showWordCount:[{type:h.Input,args:[{isSignal:true,alias:"showWordCount",required:false}]}],enabledTools:[{type:h.Input,args:[{isSignal:true,alias:"enabledTools",required:false}]}],testId:[{type:h.Input,args:[{isSignal:true,alias:"testId",required:false}]}],htmlChange:[{type:C}],htmlCssChange:[{type:C}],editorFocus:[{type:C}],editorBlur:[{type:C}]}});var Pe=Wt({RichTextElement:()=>ct});var ct=class bt{model=v(null,...ngDevMode?[{debugName:"model"}]:[]);tid=Jt(this.model,"nvb-rich-text","rich-text");elementActionService=w(Qt);dataService=w(qt);eventService=w(Zt);cdr=w(Yt);expressionService=w(Ut);structureService=w(jt);draftCss=X(null,...ngDevMode?[{debugName:"draftCss"}]:[]);onPropertyChangedHandler=t=>{const e=String(t?.payload?.elementName??"").trim();const n=String(this.model()?.name??"").trim();if(e&&n&&e===n){this.cdr.markForCheck();return}const i=String(this.model()?.dataPath??"").trim();if(!i)return;if(String(t?.payload?.elementNameOrPath??"").trim()!==i)return;this.cdr.markForCheck()};ngOnInit(){this.eventService.afterPropertyChanged.add(this.onPropertyChangedHandler)}ngOnDestroy(){this.eventService.afterPropertyChanged.remove(this.onPropertyChangedHandler)}isViewerType=f(()=>String(this.model()?.type??"").trim()===q.RICH_TEXT_VIEWER,...ngDevMode?[{debugName:"isViewerType"}]:[]);isInteractionLocked=f(()=>{const t=this.model();if(!t)return false;return Boolean(t.disabled)||Boolean(t.readOnly)||Boolean(t["__pfInteractionLocked"])},...ngDevMode?[{debugName:"isInteractionLocked"}]:[]);isInteractiveEditor=f(()=>!this.isViewerType()&&!this.isInteractionLocked(),...ngDevMode?[{debugName:"isInteractiveEditor"}]:[]);isRuntimeManaged=f(()=>{const t=this.model();if(!t)return false;return"__pfBaseReadOnly"in t||"__pfBaseDisabled"in t||"__pfInteractionReadonly"in t},...ngDevMode?[{debugName:"isRuntimeManaged"}]:[]);editorHtml=f(()=>{return String(this.model()?.value??this.model()?.htmlContent??"")},...ngDevMode?[{debugName:"editorHtml"}]:[]);enabledToolbarTools(){const t=this.model()?.toolbarTools;return Array.isArray(t)?t.map(e=>String(e)):[...Pt]}resolvedViewerPayload=f(()=>{const t=this.model();if(!t)return{html:"",css:""};const e=String(t.htmlSourcePath??"").trim();if(!this.isViewerType()||!e)return{html:String(t.value??t.htmlContent??""),css:String(t.htmlCss??"")};const n=e.replace(/^\{+|\}+$/g,"").trim();const i=this.expressionService.applyContextToExpression(n,t);const r=this.dataService.getValue(i);const o=this.resolveSourceRichTextModel(i,n,e);const a=r!==void 0?r:this.expressionService.evaluateInlineExpression(n,t);const l=String(o?.value??o?.htmlContent??"");const d=String(o?.htmlCss??"");if(a&&typeof a==="object"&&!Array.isArray(a)){const c=a;return{html:String(c["html"]??c["htmlContent"]??c["value"]??l),css:String(c["css"]??c["htmlCss"]??d)}}return{html:String(l||(a??t.value??t.htmlContent??"")),css:String(d||(t.htmlCss??""))}},...ngDevMode?[{debugName:"resolvedViewerPayload"}]:[]);editorCss=f(()=>this.draftCss()??(this.isViewerType()?this.resolvedViewerPayload().css:String(this.model()?.htmlCss??"")),...ngDevMode?[{debugName:"editorCss"}]:[]);onHtmlChange(t){const e=this.model();if(!e||!this.isInteractiveEditor())return;const n=String(t??"");if(!this.isRuntimeManaged())e.setHtmlValue(n,"input",this.editorCss());this.runActions("input",n)}onHtmlCssChange(t){const e=this.model();if(!e||!this.isInteractiveEditor())return;const n=String(t??"");e.htmlCss=n;if(this.isRuntimeManaged()){this.draftCss.set(n);return}}resolveSourceRichTextModel(...t){const e=t.map(r=>String(r??"").trim()).filter(Boolean);if(e.length===0)return;for(const r of e){const o=this.structureService.flatModelMap[r];if(this.isRichTextLikeModel(o))return o}const n=Object.values(this.structureService.flatModelMap??{});const i=e.flatMap(r=>{return[r,r.split(".").filter(Boolean).pop()??r]});return n.find(r=>{if(!this.isRichTextLikeModel(r))return false;const o=String(r.dataPath??"").trim();const a=String(r.schemaPath??"").trim();const l=String(r.name??"").trim();return i.some(d=>d===o||d===a||d===l)})}isRichTextLikeModel(t){if(!t||typeof t!=="object")return false;const e=t;return String(e["type"]??"").trim()===q.RICH_TEXT||String(e["type"]??"").trim()===q.RICH_TEXT_VIEWER}onEditorFocus(){if(!this.isInteractiveEditor())return;this.runActions("focus",this.editorHtml())}onEditorBlur(t){const e=this.model();if(!e||!this.isInteractiveEditor())return;const n=String(t??"");e.setHtmlValue(n,"blur",this.editorCss());e.htmlCss=this.editorCss();this.draftCss.set(null);this.runActions("blur",n);this.runActions("change",n)}runActions(t,e){const n=this.model();if(!n)return;const i=String(n.name??"").trim();const r={value:e,item:null,row:null};if(i)r[i]=e;this.elementActionService.runActions(n,n.events??[],t,r)}static ɵfac=h.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:bt,deps:[],target:h.ɵɵFactoryTarget.Component});static ɵcmp=h.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.2.1",type:bt,isStandalone:true,selector:"rich-text-element",inputs:{model:{classPropertyName:"model",publicName:"model",isSignal:true,isRequired:false,transformFunction:null}},ngImport:h,template:"<element-wrapper [model]=\"model()\">\n @if (model()) {\n <!-- viewerHtml runs through dynamicText as well: markup copied over from a\n customHtml element carries `{el2}`, `{row.column3}` and `{variable1}`\n tokens, and leaving them alone printed the braces verbatim. -->\n <nvb-rich-text-editor\n [html]=\"editorHtml()\"\n [viewerHtml]=\"\n !isInteractiveEditor()\n ? ((isViewerType() ? resolvedViewerPayload().html : editorHtml())\n | dynamicText: model())\n : null\n \"\n [htmlCss]=\"editorCss()\"\n [readOnly]=\"!isInteractiveEditor()\"\n [showToolbar]=\"!isViewerType()\"\n [enabledTools]=\"enabledToolbarTools()\"\n [emitOnInput]=\"!isRuntimeManaged()\"\n [minimalViewer]=\"isViewerType()\"\n [showWordCount]=\"!isViewerType() && !!model()?.showWordCount\"\n [attr.aria-label]=\"model()?.label || model()?.name\"\n [attr.data-testid]=\"tid('editor')\"\n [testId]=\"tid('editor')\"\n [placeholder]=\"\n isViewerType()\n ? ('richText.emptyViewer' | uiT: 'Content is empty')\n : ('richText.placeholder' | uiT: 'Write content...')\n \"\n (htmlChange)=\"onHtmlChange($event)\"\n (htmlCssChange)=\"onHtmlCssChange($event)\"\n (editorFocus)=\"onEditorFocus()\"\n (editorBlur)=\"onEditorBlur($event)\"\n ></nvb-rich-text-editor>\n }\n</element-wrapper>\n",styles:[":host{display:block;width:100%}\n"],dependencies:[{kind:"component",type:ft,selector:"element-wrapper",inputs:["model","controlIdInput","labelForInput","groupRole","showTextWrapperInput"],exportAs:["elementWrapper"]},{kind:"component",type:Z,selector:"nvb-rich-text-editor",inputs:["html","viewerHtml","htmlCss","readOnly","showToolbar","emitOnInput","placeholder","minimalViewer","showWordCount","enabledTools","testId"],outputs:["htmlChange","htmlCssChange","editorFocus","editorBlur"]},{kind:"pipe",type:vt,name:"dynamicText"},{kind:"pipe",type:O,name:"uiT"}],changeDetection:h.ChangeDetectionStrategy.OnPush})};h.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.2.1",ngImport:h,type:ct,decorators:[{type:j,args:[{selector:"rich-text-element",changeDetection:K.OnPush,imports:[ft,Z,vt,O],template:"<element-wrapper [model]=\"model()\">\n @if (model()) {\n <!-- viewerHtml runs through dynamicText as well: markup copied over from a\n customHtml element carries `{el2}`, `{row.column3}` and `{variable1}`\n tokens, and leaving them alone printed the braces verbatim. -->\n <nvb-rich-text-editor\n [html]=\"editorHtml()\"\n [viewerHtml]=\"\n !isInteractiveEditor()\n ? ((isViewerType() ? resolvedViewerPayload().html : editorHtml())\n | dynamicText: model())\n : null\n \"\n [htmlCss]=\"editorCss()\"\n [readOnly]=\"!isInteractiveEditor()\"\n [showToolbar]=\"!isViewerType()\"\n [enabledTools]=\"enabledToolbarTools()\"\n [emitOnInput]=\"!isRuntimeManaged()\"\n [minimalViewer]=\"isViewerType()\"\n [showWordCount]=\"!isViewerType() && !!model()?.showWordCount\"\n [attr.aria-label]=\"model()?.label || model()?.name\"\n [attr.data-testid]=\"tid('editor')\"\n [testId]=\"tid('editor')\"\n [placeholder]=\"\n isViewerType()\n ? ('richText.emptyViewer' | uiT: 'Content is empty')\n : ('richText.placeholder' | uiT: 'Write content...')\n \"\n (htmlChange)=\"onHtmlChange($event)\"\n (htmlCssChange)=\"onHtmlCssChange($event)\"\n (editorFocus)=\"onEditorFocus()\"\n (editorBlur)=\"onEditorBlur($event)\"\n ></nvb-rich-text-editor>\n }\n</element-wrapper>\n",styles:[":host{display:block;width:100%}\n"]}]}],propDecorators:{model:[{type:h.Input,args:[{isSignal:true,alias:"model",required:false}]}]}});export{ae as A,E as B,Mt as C,z as D,V as E,et as F,he as G,F as H,rt as I,tt as J,ce as K,B as L,Pt as M,u as N,ot as O,At as P,it as R,D as S,It as T,Tt as U,Rt as V,$ as W,Y as X,oe as Y,nt as _,yt as a,kt as b,L as c,ie as d,ne as f,J as g,se as h,P as i,re as j,Ht as k,wt as l,de as m,Pe as n,T as o,ee as p,St as q,Z as r,H as s,ct as t,Ct as u,Q as v,Lt as w,le as x,A as y,Et as z};