@globalpayments/vega 2.34.0 → 2.34.1

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 (122) hide show
  1. package/dist/cjs/{app-globals-4e819773.js → app-globals-48582633.js} +2 -2
  2. package/dist/cjs/{content-state-3a2724f6.js → content-state-6a5b9736.js} +64 -294
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/{text-color-toolbar-button-slimmer-b1c9f40e.js → text-color-toolbar-button-slimmer-21a166e4.js} +1 -1
  6. package/dist/cjs/{text-node-0d12da5a.js → text-node-494856f3.js} +0 -122
  7. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  8. package/dist/cjs/vega-pagination.cjs.entry.js +5 -2
  9. package/dist/cjs/vega-rich-text-content.cjs.entry.js +2 -2
  10. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +629 -416
  11. package/dist/cjs/vega-table_8.cjs.entry.js +1 -1
  12. package/dist/cjs/vega.cjs.js +3 -3
  13. package/dist/collection/components/vega-pagination/vega-pagination.js +5 -2
  14. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +0 -10
  15. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +0 -9
  16. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +0 -44
  17. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +0 -10
  18. package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +0 -42
  19. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +0 -9
  20. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +0 -14
  21. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +0 -11
  22. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +0 -26
  23. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +0 -44
  24. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +0 -11
  25. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +0 -18
  26. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +0 -13
  27. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +0 -19
  28. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +0 -27
  29. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +2 -14
  30. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +0 -10
  31. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +0 -32
  32. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +258 -0
  33. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +71 -0
  34. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +70 -0
  35. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +37 -0
  36. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +55 -0
  37. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +85 -0
  38. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +49 -0
  39. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +50 -0
  40. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +60 -0
  41. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +50 -0
  42. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +56 -0
  43. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +7 -3
  44. package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +3 -0
  45. package/dist/esm/{app-globals-9971ccfd.js → app-globals-48531a04.js} +2 -2
  46. package/dist/esm/{content-state-acf55eb0.js → content-state-4b036bf1.js} +65 -295
  47. package/dist/esm/index.js +2 -2
  48. package/dist/esm/loader.js +3 -3
  49. package/dist/esm/{text-color-toolbar-button-slimmer-d0255b98.js → text-color-toolbar-button-slimmer-b2270b64.js} +1 -1
  50. package/dist/esm/{text-node-6f7d736c.js → text-node-a652ca87.js} +0 -122
  51. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  52. package/dist/esm/vega-pagination.entry.js +5 -2
  53. package/dist/esm/vega-rich-text-content.entry.js +2 -2
  54. package/dist/esm/vega-rich-text-editor_4.entry.js +630 -417
  55. package/dist/esm/vega-table_8.entry.js +1 -1
  56. package/dist/esm/vega.js +3 -3
  57. package/dist/types/components/vega-pagination/vega-pagination.d.ts +1 -0
  58. package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +0 -7
  59. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +0 -7
  60. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +0 -14
  61. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +0 -8
  62. package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +0 -14
  63. package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +0 -7
  64. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +0 -7
  65. package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +0 -7
  66. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +0 -7
  67. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +0 -14
  68. package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +0 -7
  69. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +0 -8
  70. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +0 -1
  71. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -1
  72. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +0 -1
  73. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +0 -1
  74. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +0 -1
  75. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -2
  76. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +111 -0
  77. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +32 -0
  78. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +19 -0
  79. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +32 -0
  80. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +31 -0
  81. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +38 -0
  82. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +35 -0
  83. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +36 -0
  84. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +31 -0
  85. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +36 -0
  86. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +31 -0
  87. package/dist/vega/index.esm.js +1 -1
  88. package/dist/vega/{p-d302f052.entry.js → p-0190095c.entry.js} +1 -1
  89. package/dist/vega/p-10393104.js +1 -0
  90. package/dist/vega/p-584dcd9b.js +1 -0
  91. package/dist/vega/p-5f377954.js +1 -1
  92. package/dist/vega/{p-c1d97d12.entry.js → p-734ea281.entry.js} +1 -1
  93. package/dist/vega/{p-49f4a666.js → p-8836c1b9.js} +1 -1
  94. package/dist/vega/p-8f004647.entry.js +1 -0
  95. package/dist/vega/p-9e732a26.entry.js +1 -0
  96. package/dist/vega/{p-2fc3af2f.js → p-9f39dd10.js} +1 -1
  97. package/dist/vega/vega.esm.js +1 -1
  98. package/package.json +1 -1
  99. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +0 -135
  100. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +0 -74
  101. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +0 -47
  102. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +0 -39
  103. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +0 -50
  104. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +0 -41
  105. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +0 -57
  106. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +0 -56
  107. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +0 -77
  108. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +0 -44
  109. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +0 -67
  110. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +0 -29
  111. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +0 -37
  112. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +0 -35
  113. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +0 -37
  114. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +0 -36
  115. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +0 -39
  116. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +0 -39
  117. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +0 -46
  118. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +0 -37
  119. package/dist/vega/p-315667f1.js +0 -1
  120. package/dist/vega/p-728b029a.entry.js +0 -1
  121. package/dist/vega/p-b6af0fc1.entry.js +0 -1
  122. package/dist/vega/p-e43c2a27.js +0 -1
@@ -1 +0,0 @@
1
- import{d as t,M as e,V as i,h as s,H as o,F as n,I as r,L as c,r as l,e as a,g as h}from"./p-9c1eeff2.js";import{V as d,I as u}from"./p-8f93242a.js";import{g as f,s as p}from"./p-296cc56b.js";import{c as v}from"./p-86194314.js";import{C as m}from"./p-443ad3b3.js";import{d as g,D as b,c as x,V as w,O as y,Q as C,b as R,M as j,N as k}from"./p-a5ffe912.js";import{a as S,b as O,V as H,o as T,p as E,k as z}from"./p-f357cf46.js";import{a as L,T as B}from"./p-49f4a666.js";import{V as I}from"./p-a6a7d0c9.js";import{B as A,R as M,T as N,a as D,I as F,b as P,c as V,H as U,V as W,d as _,A as K,e as G,M as q,S as $,f as J,g as X,h as Y,i as Q,j as Z}from"./p-e43c2a27.js";import{a as tt,M as et,b as it,R as st,s as ot,I as nt,V as rt}from"./p-8c26227e.js";import{R as ct,T as lt,I as at,e as ht,B as dt,C as ut,f as ft,g as pt,A as vt,h as mt,L as gt,b as bt,Z as xt,U as wt,i as yt}from"./p-315667f1.js";import{e as Ct}from"./p-452e284a.js";import{g as Rt}from"./p-3ce31dc3.js";import{F as jt}from"./p-4c41dd64.js";import{c as kt}from"./p-11cb477b.js";import{c as St}from"./p-a6104aa7.js";import{d as Ot}from"./p-1bc5b3bc.js";import{S as Ht}from"./p-1fb56e14.js";import{f as Tt}from"./p-1995e98e.js";import{b as Et,D as zt}from"./p-d057999f.js";import"./p-5f377954.js";import"./p-acf7f903.js";import"./p-11a19ca0.js";import"./p-65b79fd7.js";import"./p-e1e1fcf0.js";import{C as Lt}from"./p-39836361.js";import{c as Bt}from"./p-613ddaab.js";import{t as It}from"./p-aacf6920.js";import{r as At}from"./p-3b4bde3e.js";import"./p-b1f65b13.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-112455b1.js";import"./p-eac38d87.js";import"./p-262ec334.js";import"./p-59bdf9b8.js";import"./p-70151c27.js";import"./p-4bcd6612.js";import"./p-f763e2eb.js";import"./p-0bb29d98.js";import"./p-843a0c1c.js";import"./p-a9354a5c.js";import"./p-b0502d01.js";import"./p-7a40e033.js";var Mt=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Nt extends i{constructor(){super(...arguments),this.renderHintMessage=()=>s("vega-text",null,this.hint),this.renderTextContent=()=>s("div",{class:{"rich-text-editor-container":!0,disabled:this.disabled},style:{minHeight:24*this.rows+"px"},onClick:this.richTextContentFocus,role:"textbox",tabIndex:this.disabled?0:-1,onKeyDown:v(),ref:t=>this.richTextContainerRef=t},s("vega-rich-text-content",{ref:t=>this.richTextContentRef=t,content:this.value}),this.renderCharacterCounter()),this.renderCharacterCounter=()=>s("div",{class:{"text-editor-counter":!0,"counter-exceed-max-length":!1},style:{display:"none"}},s("span",null,"0"),s("span",null,"/100")),this.renderErrorMessage=()=>s("div",{class:"vega-error vega-hidden"}),this.richTextContentFocus=()=>{this.richTextContentRef.vegaFocus()}}componentDidRender(){m.notify(g.getSubject(this.host,S),{})}getRichTextContainerRef(){return this.richTextContainerRef}getRichTextContentRef(){return this.richTextContentRef}getRichTextWrapperRef(){return this.richTextWrapperRef}getRTEEditableElementRef(){if(this.richTextContentRef&&this.richTextContentRef.shadowRoot)return this.richTextContentRef.shadowRoot.querySelector(".rich-text-content")}render(){return s(o,null,this.renderRichTextEditor())}renderRichTextEditor(){return s("vega-flex",{direction:"col",gap:"0",ref:t=>this.richTextWrapperRef=t},this.renderLabel(),this.hint&&this.renderHintMessage(),this.toolbarRenderer.render(),this.renderTextContent(),this.renderErrorMessage())}renderLabel(){return this.label&&s("vega-field-label",{onClick:this.richTextContentFocus,isFieldRequired:this.required,disabled:this.disabled,label:this.label})}}Mt([t()],Nt.prototype,"host",void 0),Mt([t()],Nt.prototype,"toolbarRenderer",void 0),Mt([t()],Nt.prototype,"label",void 0),Mt([t()],Nt.prototype,"required",void 0),Mt([t()],Nt.prototype,"hint",void 0),Mt([t()],Nt.prototype,"disabled",void 0),Mt([t()],Nt.prototype,"rows",void 0),Mt([t()],Nt.prototype,"placeholder",void 0),Mt([t()],Nt.prototype,"value",void 0),Mt([e("componentDidRender")],Nt.prototype,"componentDidRender",null);var Dt=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ft extends i{constructor(){super(...arguments),this.getToolbarBtnRenderer=t=>{switch(t){case"clearStyle":return this.clearStyleToolbarButtonSlimmer;case"bold":return this.boldToolbarButtonSlimmer;case"textStyles":return this.textStylesToolbarButtonSlimmer;case"italic":return this.italicToolbarButtonSlimmer;case"underline":return this.underlineToolbarButtonSlimmer;case"textColor":return this.textColorToolbarButtonSlimmer;case"moreIndent":return this.moreIndentToolbarButtonSlimmer;case"lessIndent":return this.lessIndentToolbarButtonSlimmer;case"code":return this.codeToolbarButtonSlimmer;case"strikethrough":return this.strikethroughToolbarButtonSlimmer;case"link":return this.linkToolbarButtonSlimmer;case"image":return this.imageToolbarButtonSlimmer;case"bulletsNumbers":return this.bulletsNumbersToolbarButtonSlimmer;case"horizontalAlignment":return this.horizontalAlignmentToolbarButtonSlimmer}}}render(){return s("vega-flex",{gap:"size-8",alignItems:"center",flexWrap:"wrap"},this.toolbarItems.map((t=>s("div",{class:"toolbar-btn-group"},t.map((t=>this.getToolbarBtnRenderer(t).render()))))))}}Dt([t()],Ft.prototype,"toolbarItems",void 0),Dt([t()],Ft.prototype,"clearStyleToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"boldToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"textStylesToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"italicToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"underlineToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"textColorToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"strikethroughToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"imageToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"moreIndentToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"lessIndentToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"codeToolbarButtonSlimmer",void 0),Dt([t()],Ft.prototype,"linkToolbarButtonSlimmer",void 0);class Pt extends L{constructor(){super({icon:"bold",tooltip:{text:"Bold"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new A(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.BOLD))||void 0===e?void 0:e.bold}))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}I.register({bold:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H80 96 224c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128H96 80 32c-17.7 0-32-14.3-32-32s14.3-32 32-32H48V256 96H32C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64H112V224H224zM112 288V416H256c35.3 0 64-28.7 64-64s-28.7-64-64-64H224 112z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],Pt.prototype,"selectionController",void 0);class Vt extends lt{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new at(this.italic)}}class Ut extends L{constructor(){super({icon:"italic",tooltip:{text:"Italic"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.ITALIC))||void 0===e?void 0:e.italic}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new Vt(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}I.register({italic:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M128 64c0-17.7 14.3-32 32-32H352c17.7 0 32 14.3 32 32s-14.3 32-32 32H293.3L160 416h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H90.7L224 96H160c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],Ut.prototype,"selectionController",void 0);class Wt extends lt{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new ht(this.underline)}}class _t extends L{constructor(){super({icon:"underline",tooltip:{text:"Underline"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.UNDERLINE))||void 0===e?void 0:e.underline}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new Wt(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}I.register({underline:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M16 64c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H128V224c0 53 43 96 96 96s96-43 96-96V96H304c-17.7 0-32-14.3-32-32s14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H384V224c0 88.4-71.6 160-160 160s-160-71.6-160-160V96H48C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],_t.prototype,"selectionController",void 0);var Kt=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Gt extends L{constructor(){super({icon:"text-size",tooltip:{text:"Text Styles"}}),this.handleDropdownItemClick=t=>{const e=t.detail,i=Gt.items.find((t=>t.key===e)).bold,s=this.selectionController.getSelectedBlocks().filter((t=>t instanceof M));s.length>0?s.forEach((t=>{t.apply(new N(e,i))})):this.focusController.focusOnLastTextNode({newLine:!0}).then((()=>{this.selectionController.getSelectedBlocks().filter((t=>t instanceof M)).forEach((t=>{t.apply(new N(e,i))}))}))}}renderBtnWrapper(t){return s("vega-dropdown",{selectType:"single",trigger:"click",alignment:"center",selectedSourceKey:this.getSelectedSourceKey(),ref:t=>{this.addDropdownObserver(t)}},t({showArrowIcon:!0}),s("div",Object.assign({slot:"items"},super.preventLostFocus()),this.renderDropdownContent()))}renderDropdownContent(){return s(n,null,Gt.items.map((t=>{const e=new D(t.key),i=new dt(t.bold);return s("vega-dropdown-item",{key:t.key,itemKey:t.key},s("vega-box",{padding:{right:"size-20"}},s("div",{style:Object.assign(Object.assign({},e.render()),i.render())},t.label)))})))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.IMAGE)))}addDropdownObserver(t){b.addUniqueObserverToNode(t,x,this.handleDropdownItemClick)}getSelectedSourceKey(){const t=this.selectionController.getSelectedBlocks().filter((t=>t instanceof M));return t.length>0&&t.every((e=>e.type===t[0].type))?t[0].getAnnotationByType(Ct.TEXT_STYLE).textStyle:""}}I.register({"text-size":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 128V96h96l0 320H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H256c17.7 0 32-14.3 32-32s-14.3-32-32-32H224l0-320h96v32c0 17.7 14.3 32 32 32s32-14.3 32-32V80c0-26.5-21.5-48-48-48H192 48C21.5 32 0 53.5 0 80v48c0 17.7 14.3 32 32 32s32-14.3 32-32zM384 304V288h64l0 128H432c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H512l0-128h64v16c0 17.7 14.3 32 32 32s32-14.3 32-32V272c0-26.5-21.5-48-48-48H368c-26.5 0-48 21.5-48 48v32c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>'}}),Gt.items=[{key:"title",label:"Title",bold:!0},{key:"subtitle",label:"Subtitle"},{key:"heading-1",label:"Heading 1",bold:!0},{key:"heading-2",label:"Heading 2",bold:!0},{key:"heading-3",label:"Heading 3",bold:!0},{key:"paragraph",label:"Paragraph"}],Kt([t()],Gt.prototype,"selectionController",void 0),Kt([t()],Gt.prototype,"focusController",void 0);class qt extends L{constructor(){super({icon:"text-slash",tooltip:{text:"Clear Style"}})}isSelected(){return!1}onClick(){this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((t=>{t.apply(new ut)}))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.IMAGE)))}}I.register({"text-slash":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96H503L497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32H376.1h-.3H204.5c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96H333.7L301.3 210.8l-94.5-74.1zM243.3 416H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H309.8l17.6-62.1L272.9 311 243.3 416z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],qt.prototype,"selectionController",void 0);class $t extends L{constructor(){super({icon:"code-simple",tooltip:{text:"Code"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new ft(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes();return t.length>0&&t.filter((t=>t instanceof ct)).map((t=>t.getAnnotationByType(tt.CODE))).every((t=>t&&t.code))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.LINK)||t.getAnnotationByType(tt.IMAGE)))}}I.register({"code-simple":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6zm146.7 0L498.7 256 361.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],$t.prototype,"selectionController",void 0);class Jt extends lt{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new pt(this.strikethrough)}}class Xt extends L{constructor(){super({icon:"strikethrough",tooltip:{text:"Strikethrough"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.STRIKETHROUGH))||void 0===e?void 0:e.strikethrough}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new Jt(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}I.register({strikethrough:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path fill="currentColor" d="M332.2 319.9c17.22 12.17 22.33 26.51 18.61 48.21c-3.031 17.59-10.88 29.34-24.72 36.99c-35.44 19.75-108.5 11.96-186-19.68c-16.34-6.686-35.03 1.156-41.72 17.53s1.188 35.05 17.53 41.71c31.75 12.93 95.69 35.37 157.6 35.37c29.62 0 58.81-5.156 83.72-18.96c30.81-17.09 50.44-45.46 56.72-82.11c3.998-23.27 2.168-42.58-3.488-59.05H332.2zM488 239.9l-176.5-.0309c-15.85-5.613-31.83-10.34-46.7-14.62c-85.47-24.62-110.9-39.05-103.7-81.33c2.5-14.53 10.16-25.96 22.72-34.03c20.47-13.15 64.06-23.84 155.4 .3438c17.09 4.531 34.59-5.654 39.13-22.74c4.531-17.09-5.656-34.59-22.75-39.12c-91.31-24.18-160.7-21.62-206.3 7.654C121.8 73.72 103.6 101.1 98.09 133.1C89.26 184.5 107.9 217.3 137.2 239.9L24 239.9c-13.25 0-24 10.75-24 23.1c0 13.25 10.75 23.1 24 23.1h464c13.25 0 24-10.75 24-23.1C512 250.7 501.3 239.9 488 239.9z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],Xt.prototype,"selectionController",void 0);class Yt extends vt{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new mt(this.range)}}class Qt extends L{constructor(){super({icon:"link",tooltip:{text:"Link"}}),this.handleLinkEditorChange=({detail:t})=>{switch(t.action){case"link":{const{url:e,text:i}=t.payload,s=i!==this.currentSelectedText,o=Rt();return void this.currentSelectedNodes.forEach((t=>{t.apply(new Yt(this.currentRange)).apply(new gt({link:{href:e,groupKey:o},newText:s?i:void 0,needMergeNode:s&&this.currentSelectedNodes.length>1}))}))}}}}renderBtnWrapper(t){return s("div",{class:"toolbar-btn-link-wrapper",ref:t=>this.linkBtnWrapperRef=t},t(),s("vega-rich-text-link-editor",{resetStatusAfterHide:!1,status:"linkEdit",ref:t=>{t&&(this.linkEditorRef=t),b.addUniqueObserverToNode(t,w,this.handleLinkEditorChange)}}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes();return this.selectionController.getSelectedBlocks().length>1||t.some((t=>{var e;return!(t instanceof ct)||t.getAnnotationByType(tt.LINK)||(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)}))}onClick(){this.currentRange=this.selectionController.getCurrentRange().toNativeRange(),this.currentSelectedNodes=this.selectionController.getSelectedNodes(),this.currentRange&&(this.currentSelectedText=this.currentRange.toString(),this.currentSelectedNodes.length>0&&(this.linkEditorRef.record={text:this.currentSelectedText,url:""})),this.linkEditorRef.target||(this.linkEditorRef.target=this.linkBtnWrapperRef,bt(this.linkEditorRef).then((()=>{this.linkEditorRef.show()})))}}I.register({link:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M562.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L405.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C189.5 251.2 196 330 246 380c56.5 56.5 148 56.5 204.5 0L562.8 267.7zM43.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C57 372 57 321 88.5 289.5L200.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C416.5 260.8 410 182 360 132c-56.5-56.5-148-56.5-204.5 0L43.2 244.3z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],Qt.prototype,"selectionController",void 0);class Zt extends vt{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new F(this.indent)}}class te extends L{constructor(){super({icon:"indent",tooltip:{text:"More Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return t.some((t=>"list-item"===t.type))||e.some((t=>t instanceof P))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const s=null!==(i=null===(e=t.getAnnotationByType(Ct.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new Zt(s+1))}))}}I.register({indent:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32zm32 96H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3V176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],te.prototype,"selectionController",void 0);class ee extends L{constructor(){super({icon:"outdent",tooltip:{text:"Less Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return t.some((t=>"list-item"===t.type))||e.some((t=>t instanceof P))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const s=null!==(i=null===(e=t.getAnnotationByType(Ct.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new Zt(s>1?s-1:0))}))}}I.register({outdent:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M6 64C6 46.3 20.3 32 38 32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38C20.3 96 6 81.7 6 64zM198 192c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32zm32 96H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32s14.3-32 32-32zM6 448c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38c-17.7 0-32-14.3-32-32zm.2-179.4c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6V335.3c0 13.3-15.3 20.8-25.8 12.6L6.2 268.6z"/></svg>'}}),function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([t()],ee.prototype,"selectionController",void 0);var ie=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class se extends L{constructor(){super({icon:"image",tooltip:{text:"Image"}}),this.onClick=()=>{this.inputElementRef.click()},this.fileInputChange=t=>{t.stopPropagation();const e=t.target;if(!e.files.length)return;const i=this.insertImageController.insertImageToCaretPosition(URL.createObjectURL(e.files[0]));this.updateNodeURLMap||(this.updateNodeURLMap=new Map),this.updateNodeURLMap.set(i,(t=>{i.url=t}));const s={file:e.files[0],sendBackUploadedURLCallback:this.updateNodeURLMap.get(i)};this.imageInsertedEventEmitter.emit(s),e.value=""}}renderBtnWrapper(t){return s("vega-box",null,t({showArrowIcon:!1}),s("input",{type:"file",style:{display:"none"},ref:t=>this.inputElementRef=t,accept:"image/*",onChange:this.fileInputChange}))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.LINK)))}}I.register({image:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>'}}),ie([t()],se.prototype,"insertImageController",void 0),ie([t()],se.prototype,"imageInsertedEventEmitter",void 0),ie([t()],se.prototype,"selectionController",void 0);class oe extends et{constructor(t,e){super(),this.type=it.TRANSFORM_LIST_BLOCK,this.isFlushable=!0,this.listType=t,this.selectedBlocks=e}}class ne extends et{constructor(t){super(),this.type=it.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}var re=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ce extends L{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectBulletList():this.selectBulletList(),this.popoverRef.hide()}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof P))}isListType(t,e="bullet-list"){return t.length>0&&t.every((t=>t instanceof V&&t.parent.type===e))}deselectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new ne(t))}selectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new oe("bullet-list",t))}}re([t()],ce.prototype,"selectionController",void 0),re([t()],ce.prototype,"popoverRef",void 0);var le=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ae extends L{constructor(){super({icon:"list-ol",tooltip:{text:"Numbers"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectNumberList():this.selectNumberList(),this.popoverRef.hide()}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof P))}isListType(t,e="number-list"){return t.length>0&&t.every((t=>t instanceof V&&t.parent.type===e))}deselectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new ne(t))}selectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new oe("number-list",t))}}le([t()],ae.prototype,"selectionController",void 0),le([t()],ae.prototype,"popoverRef",void 0);var he=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class de extends L{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}}),this.bulletsToolbarButtonSlimmer=new ce,this.numbersToolbarButtonSlimmer=new ae}componentWillRender(){this.numbersToolbarButtonSlimmer.isSelected()?super.setIcon("list-ol"):super.setIcon("list-ul")}renderBtnWrapper(t){return s("vega-popover",{showArrow:!1,trigger:"click",placement:"bottom",alignment:"center",ref:t=>this.popoverRef=t},s("div",{slot:"popover-content"},t({showArrowIcon:!0})),s("div",{slot:"popover"},this.renderContent()))}renderContent(){return s("vega-flex",{gap:"size-8","justify-content":"center"},s("div",null,this.bulletsToolbarButtonSlimmer.render()),s("div",null,this.numbersToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof P))}}I.register({"list-ul":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"/></svg>'},"list-ol":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M24 56c0-13.3 10.7-24 24-24H80c13.3 0 24 10.7 24 24V176h16c13.3 0 24 10.7 24 24s-10.7 24-24 24H40c-13.3 0-24-10.7-24-24s10.7-24 24-24H56V80H48C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432H120c13.3 0 24 10.7 24 24s-10.7 24-24 24H32c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>'}}),he([t()],de.prototype,"selectionController",void 0),he([r()],de.prototype,"bulletsToolbarButtonSlimmer",void 0),he([r()],de.prototype,"numbersToolbarButtonSlimmer",void 0),he([e("componentWillRender")],de.prototype,"componentWillRender",null);class ue extends vt{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new U(this.textAlign)}}var fe=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class pe extends L{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"left"===(null===(e=t.getAnnotationByType(Ct.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new ue("left")))),this.popoverRef.hide()}}I.register({"align-left":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M288 64c0 17.7-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32H256c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H256c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),fe([t()],pe.prototype,"selectionController",void 0),fe([t()],pe.prototype,"popoverRef",void 0);var ve=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class me extends L{constructor(){super({icon:"align-center",tooltip:{text:"Center Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"center"===(null===(e=t.getAnnotationByType(Ct.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new ue("center")))),this.popoverRef.hide()}}I.register({"align-center":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M352 64c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32z"/></svg>'}}),ve([t()],me.prototype,"selectionController",void 0),ve([t()],me.prototype,"popoverRef",void 0);var ge=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class be extends L{constructor(){super({icon:"align-right",tooltip:{text:"Right Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"right"===(null===(e=t.getAnnotationByType(Ct.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new ue("right")))),this.popoverRef.hide()}}I.register({"align-right":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M448 64c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),ge([t()],be.prototype,"selectionController",void 0),ge([t()],be.prototype,"popoverRef",void 0);var xe=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class we extends L{constructor(){super({icon:"align-justify",tooltip:{text:"Justified"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"justify"===(null===(e=t.getAnnotationByType(Ct.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new ue("justify")))),this.popoverRef.hide()}}I.register({"align-justify":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M448 64c0-17.7-14.3-32-32-32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 192c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM448 448c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32z"/></svg>'}}),xe([t()],we.prototype,"selectionController",void 0),xe([t()],we.prototype,"popoverRef",void 0);var ye=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ce extends L{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}}),this.leftAlignToolbarButtonSlimmer=new pe,this.centerAlignToolbarButtonSlimmer=new me,this.rightAlignToolbarButtonSlimmer=new be,this.justifiedToolbarButtonSlimmer=new we}componentWillRender(){this.leftAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-left"):this.centerAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-center"):this.rightAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-right"):this.justifiedToolbarButtonSlimmer.isSelected()?super.setIcon("align-justify"):super.setIcon("align-left")}renderBtnWrapper(t){return s("vega-popover",{trigger:"click",showArrow:!1,alignment:"center",placement:"bottom",ref:t=>this.popoverRef=t},s("div",{slot:"popover-content"},t({showArrowIcon:!0})),s("div",{slot:"popover"},this.renderContent()))}renderContent(){return s("vega-flex",{gap:"size-8","justify-content":"center"},s("div",null,this.leftAlignToolbarButtonSlimmer.render()),s("div",null,this.centerAlignToolbarButtonSlimmer.render()),s("div",null,this.rightAlignToolbarButtonSlimmer.render()),s("div",null,this.justifiedToolbarButtonSlimmer.render()))}isSelected(){return!1}}ye([t()],Ce.prototype,"selectionController",void 0),ye([r()],Ce.prototype,"leftAlignToolbarButtonSlimmer",void 0),ye([r()],Ce.prototype,"centerAlignToolbarButtonSlimmer",void 0),ye([r()],Ce.prototype,"rightAlignToolbarButtonSlimmer",void 0),ye([r()],Ce.prototype,"justifiedToolbarButtonSlimmer",void 0),ye([e("componentWillRender")],Ce.prototype,"componentWillRender",null);let Re=!1;class je{constructor(){this.rangeCount=0,this.ranges=[]}getRangeAt(t){return this.ranges[t]}addRange(t){if(this.ranges.push(t),this.rangeCount=this.ranges.length,!Re){const e=window.getSelection();e.removeAllRanges(),e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}}removeAllRanges(){this.ranges=[],this.rangeCount=0}}const ke=new class{constructor(){this.supportShadowSelection="function"==typeof window.ShadowRoot.prototype.getSelection,this.supportBeforeInput="function"==typeof window.InputEvent.prototype.getTargetRanges,this.isFirefox=window.navigator.userAgent.toLowerCase().indexOf("firefox")>0,this.listen()}getSelection(t){return this.supportShadowSelection?t.getSelection():this.isFirefox?this.getFirefoxSelection():this.polyfilledShadowSelection}getFirefoxSelection(){const t=document.getSelection(),e=t.getRangeAt(0),i=e.startContainer,s=e.endContainer;if(i!==s&&i.textContent.length===e.startOffset){const t=i.nodeType===Node.TEXT_NODE?i.parentNode.nextSibling:i.nextSibling;e.setStart(t.firstChild,0)}if(s!==i&&0===e.endOffset){const t=s.nodeType===Node.TEXT_NODE?s.parentNode.previousSibling:s.previousSibling;e.setEnd(t.lastChild,t.lastChild.textContent.length)}return t}listen(){this.isFirefox||this.supportShadowSelection||!this.supportBeforeInput||(this.polyfilledShadowSelection=new je,window.addEventListener("selectionchange",(()=>{if(!Re){Re=!0;const t=f();t&&t.hasAttribute("contenteditable")?document.execCommand("indent"):this.polyfilledShadowSelection.removeAllRanges(),Re=!1}}),!0),window.addEventListener("beforeinput",(t=>{if(Re){const e=t.getTargetRanges()[0],i=new Range;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset),this.polyfilledShadowSelection.removeAllRanges(),this.polyfilledShadowSelection.addRange(i),t.preventDefault(),t.stopImmediatePropagation()}}),!0))}};class Se{constructor(t,e,i=0,s=0,o,n,r){this._startOffset=0,this._endOffset=0,this._startContainer=t,this._endContainer=e,this._startOffset=i,this._endOffset=s,this._startNode=o,this._endNode=n,r&&(this._oldNativeRange=r)}get startContainer(){return this._startContainer}get endContainer(){return this._endContainer}get startNode(){return this._startNode}get endNode(){return this._endNode}get startOffset(){return this._startOffset}get endOffset(){return this._endOffset}updateRTERange(t,e){const{startOffset:i,endOffset:s}=t;this._startOffset=i,this._endOffset=s;const o=t.startNode,n=t.endNode;if(o instanceof st){this._startNode=o,this._endNode=n;const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode);t&&(this._startContainer=t,this._endContainer=e)}else this._startContainer=o,this._endContainer=n,this._startNode=this.getRTENodeByElement(this._startContainer),this._endNode=this._startContainer===this._endContainer?this._startNode:this.getRTENodeByElement(this._endContainer),e&&(this._oldNativeRange=e);return new Se(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}toNativeRange(){const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode),i=new Range;return t&&e?(i.setStart(t,this._startOffset),i.setEnd(e,this._endOffset),this._startContainer=t,this._endContainer=e,this._oldNativeRange=i,i):this._oldNativeRange?this._oldNativeRange:void 0}getElementByRTENode(t){if(t){const e=ot.getDOMByEntity(t);if(e)return t instanceof P?Tt(e,"vega-rich-text-image-editor"):e.firstChild}}getRTENodeByElement(t){if(t){const e=t.nodeType===Node.TEXT_NODE?t.parentElement:"VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t;return ot.getEntityByDOM(e)}}}var Oe=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class He extends i{constructor(){super(...arguments),this.currentRange=new Se,this.updateCaretPositionTaskQueue=new Ht(1),this.handleSelectionWithDebounce=Ot(this.handleSelectionChange,He.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.selectedNodes=[],this.createUpdateSelectionRangeTask=async()=>{await Promise.resolve();const t=this.currentRange.toNativeRange();t&&this.setSelectionRange(t)}}connectedCallback(){this.registerSelectionRangeChangeObserver()}disconnectedCallback(){m.unregister(g.getSubject(this.host,O),this.selectionRangeChangeObserver)}componentDidLoad(){document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}watchValueUpdate(){this.restoreSelection()}async updateCaretPosition(){this.updateCaretPositionTaskQueue.queue.length&&await this.updateCaretPositionTaskQueue.runTask()}getCurrentRange(){return this.currentRange}getSelectedNodes(){return Array.from(this.selectionMap.values()).flat()}getSelectedBlocks(){return Array.from(this.selectionMap.keys())}enqueueSelectionRangeFutureState(t,e,i,s,o=!1){this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:i=i||t,startOffset:e,endOffset:s=s||0===s?s:e}),this.updateCaretPositionTaskQueue.enqueue({run:async()=>{try{await this.createUpdateSelectionRangeTask()}catch(t){c.error("Set range error.",t)}}},o)}setSelectionRange(t){const e=this.getSelection();e.removeAllRanges(),e.addRange(t),this.saveSelection()}saveSelection(){const t=this.getSelection();if(t&&t.rangeCount>0&&0===this.updateCaretPositionTaskQueue.queue.length){const e=t.getRangeAt(0),{startContainer:i,endContainer:s,startOffset:o,endOffset:n}=e;this.currentRange=this.currentRange.updateRTERange({startNode:i,endNode:s,startOffset:o,endOffset:n},e)}}restoreSelection(){if(this.selectedNodes.length>0){const t=this.selectedNodes[0],e=this.selectedNodes.length>1?this.selectedNodes[this.selectedNodes.length-1]:t;if(t===e&&0===t.text.length)this.enqueueSelectionRangeFutureState(t,xt.length);else{const{startContainer:i,endContainer:s,startOffset:o,endOffset:n}=this.currentRange;ot.getDOMByEntity(t)===i.parentElement&&ot.getDOMByEntity(e)===s.parentElement?this.enqueueSelectionRangeFutureState(t,o,e,n):this.enqueueSelectionRangeFutureState(t,0,e,e.text.length)}this.selectedNodes=[]}}getSelection(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();return ke.getSelection(t.shadowRoot)}handleSelectionChange(){const t=this.getSelection();if(!t||0===t.rangeCount)return;this.clearSelectionMap(),this.saveSelection();const e=t.getRangeAt(0),i=[],s=t=>{if(e.intersectsNode(t)){if(t.nodeType===Node.TEXT_NODE){const e=ot.getEntityByDOM(t.parentElement);if(e instanceof st)return void i.push(e)}if(t.nodeType===Node.ELEMENT_NODE){const e="VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t,s=ot.getEntityByDOM(e);if(s instanceof st)return void i.push(s)}t.childNodes.forEach(s)}};s(e.commonAncestorContainer),i.forEach((t=>{this.selectionMap.has(t.parentBlock)?this.selectionMap.get(t.parentBlock).push(t):this.selectionMap.set(t.parentBlock,[t])})),this.getSelectedNodes().forEach((t=>t.apply(new Yt(e))))}clearSelectionMap(){this.getSelectedNodes().forEach((t=>{t.annotationMap.delete(nt.SELECTION_RANGE)})),this.selectionMap=new Map}isAcceptableSelectionRangeChange(){return!0}registerSelectionRangeChangeObserver(){this.selectionRangeChangeObserver=new y(this.isAcceptableSelectionRangeChange.bind(this),(t=>{this.selectedNodes.push(t.node)})),m.register(g.getSubject(this.host,O),this.selectionRangeChangeObserver)}}He.SELECTION_CHANGE_DEBOUNCE_TIME=50,Oe([t()],He.prototype,"vegaRichTextEditorRenderer",void 0),Oe([t({writable:!0})],He.prototype,"selectionMap",void 0),Oe([t()],He.prototype,"host",void 0),Oe([t()],He.prototype,"value",void 0),Oe([t()],He.prototype,"valueController",void 0),Oe([e("connectedCallback")],He.prototype,"connectedCallback",null),Oe([e("disconnectedCallback")],He.prototype,"disconnectedCallback",null),Oe([e("componentDidLoad")],He.prototype,"componentDidLoad",null),Oe([e("watchValueUpdate")],He.prototype,"watchValueUpdate",null),Oe([e("componentDidUpdate")],He.prototype,"updateCaretPosition",null);var Te=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ee extends i{connectedCallback(){const t=Ot((()=>{this.valueController.flushChanges(this.value)}),Ee.VALUE_CHANGE_DEBOUNCE_TIME,this);this.flushChangeObserver=new y(this.isAcceptableFlushChange.bind(this),t),m.register(g.getSubject(this.host,H),this.flushChangeObserver)}disconnectedCallback(){m.unregister(g.getSubject(this.host,H),this.flushChangeObserver)}watchValueUpdate(){this.value&&0!==this.value.blocks.length?(this.changeEventEmitter.emit(this.value),m.notify(Et,{host:this.host,detail:this.value})):this.value=W.createEmptyContent()}async flushChanges(t){this.value=t.clone(),await bt(this.host)}isAcceptableFlushChange(){return!0}}Ee.VALUE_CHANGE_DEBOUNCE_TIME=50,Te([t()],Ee.prototype,"host",void 0),Te([t({writable:!0})],Ee.prototype,"value",void 0),Te([t()],Ee.prototype,"changeEventEmitter",void 0),Te([t()],Ee.prototype,"valueController",void 0),Te([e("connectedCallback")],Ee.prototype,"connectedCallback",null),Te([e("disconnectedCallback")],Ee.prototype,"disconnectedCallback",null),Te([e("watchValueUpdate")],Ee.prototype,"watchValueUpdate",null);var ze=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Le extends i{connectedCallback(){this.observer=new y(this.isAcceptObserver.bind(this),(t=>{this.isInDarkMode=t})),m.register(zt,this.observer)}disconnectResizeObserver(){m.unregister(zt,this.observer)}isAcceptObserver(){return!0}}ze([t({writable:!0})],Le.prototype,"isInDarkMode",void 0),ze([e("connectedCallback")],Le.prototype,"connectedCallback",null),ze([e("disconnectedCallback")],Le.prototype,"disconnectResizeObserver",null);class Be{constructor(t){this.editor=t}syncRichTextContentEditable(){this.editor.richTextContentEditable=!this.editor.disabled}}class Ie extends et{constructor(t,e){super(),this.type=it.REPLACE_SELECTED_TEXT,this.textToBeInsert="",this.textToBeInsert=t,this.currentRange=e}}class Ae{execute(t,e,i){this.initCurrentStateAndSelection(t,e),this.handleEvent(i)}replaceSelectedNodesWithText(t){const e=this.selectionController.getSelectedNodes(),i=this.selectionController.getCurrentRange(),{startContainer:s,endContainer:o}=i,n=this.removeSelectionRange(),r=e[0];return r instanceof ct&&t&&r.apply(new wt(r.text+t)),this.mergeRangeStartAndEnd(s,o),n}isRootContainer(t){return t&&t.nodeType===Node.ELEMENT_NODE&&t.classList.contains("rich-text-content")}isEmptyParagraph(t){return t&&t.childNodes&&0===t.childNodes.length}removeRangeStartAndEndSelectedText(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getCurrentRange();t[0]instanceof ct&&t[0].apply(new Ie("",e)),t.length>1&&t[t.length-1]instanceof ct&&t[t.length-1].apply(new Ie("",e))}mergeRangeStartAndEnd(t,e){if(t!==e&&t.nodeType===Node.TEXT_NODE&&e.nodeType===Node.TEXT_NODE){const t=this.selectionController.getSelectedNodes(),e=t[0],i=t[t.length-1];if(e&&e.parentBlock&&i&&i.parentBlock){const t=i.parentBlock;this.shouldMergeTextNode(e,i)&&(e.apply(new wt(e.text+i.text)),e.parentBlock===i.parentBlock?e.parentBlock.apply(new _(i)):i.parentBlock.apply(new _(i.parentBlock.nodes[0]))),e.parentBlock!==i.parentBlock&&(e.parentBlock.apply(new K(t.nodes)),t.nodes=[]),t.nodes.length<1&&t.parent.apply(new _(t))}}}removeSelectionRange(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),{endOffset:i,startOffset:s}=t,o=e[0],n=e[e.length-1];if(e.length>1&&e.filter((t=>"IMAGE"!==t.type?t!==o&&t!==n:t!==o&&(t!==n||t===n&&0!==i))).forEach((t=>{t.parentBlock.apply(new _(t))})),this.removeRangeStartAndEndSelectedText(),o instanceof P&&1!==s&&(n!==o||0!==i)){if(1===o.parentBlock.nodes.length){const t=this.createEmptyParagraph();return o.parentBlock.parent.apply(new G(o.parentBlock,t)),o.parentBlock.apply(new _(o)),t.nodes[0]}if(o===o.parentBlock.nodes[0])return o.parentBlock.apply(new _(o)),o.parentBlock.nodes[0]}return o}createEmptyParagraph(){const t=new M(Rt(),"paragraph"),e=new ct(`${t.id}1`,"",t);return t.apply(new K([e])),t}shouldMergeTextNode(t,e){const{annotations:i}=t.toJSON(),{annotations:s}=e.toJSON();return JSON.stringify(i)===JSON.stringify(s)}initCurrentStateAndSelection(t,e){this.currentState=t,this.selectionController=e}}class Me extends et{constructor(t,...e){super(),this.type=it.INSERT_NODES_BEFORE,this.referNode=t,this.nodesToBeInserted=e}}class Ne extends Ae{handleEvent(t){const e=t.data,i=this.selectionController.getCurrentRange(),{startContainer:s,startOffset:o}=i,n=this.selectionController.getSelectedNodes();if(n.length<2){if(!n.length&&this.isRootContainer(s)){const t=this.insertTextToRoot(e);this.selectionController.enqueueSelectionRangeFutureState(t,e.length)}else if(n[0]instanceof ct){let t=o+e.length,r=!1,c=n[0];"\n"===c.text?(c=this.insertTextToLineBreakNode(c,e),r=!0):(s.nodeValue===xt&&o===xt.length&&c.isEmpty()&&(s.nodeValue="",t-=xt.length),c instanceof ct&&(r=!0,c.apply(new Ie(e,i)))),r&&this.selectionController.enqueueSelectionRangeFutureState(c,Math.min(t,c.text.length))}}else{const t=this.replaceSelectedNodesWithText(e);this.selectionController.enqueueSelectionRangeFutureState(t,t instanceof ct?Math.min(o+e.length,t.text.length):o)}}insertTextToRoot(t){if(this.currentState&&this.currentState.blocks[0]&&this.currentState.blocks[0]instanceof M){const e=this.currentState.blocks[0].nodes[0];return e.apply(new wt(t)),e}}insertTextToLineBreakNode(t,e){const{startOffset:i,endOffset:s}=this.selectionController.getCurrentRange(),o=t.parentBlock,n=o.nodes.indexOf(t);if(0===i&&i===s&&o.nodes[n+1]){const i=t.cloneWithText(e);return o.apply(new Me(t,i)),i}return t.apply(new wt(e)),t}}class De extends et{constructor(t,e){super(),this.type=it.BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class Fe extends Ae{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.breakSingleBlock():this.breakMultipleBlocks()}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getCurrentRange(),i=this.removeSelectionRange();if(t.length&&"list-item"===t[0].type||"list-item"===t[t.length-1].type){const s=i.parentBlock,o=t[t.length-1];if(s.type!==o.type&&e.startContainer.nodeType===e.endContainer.nodeType){s.apply(new q(o));const t=new $(i,i.text.length);return s.apply(t),void this.switchCaretPositionToNextElement(t.newBlock)}}this.selectionController.enqueueSelectionRangeFutureState(i,e.startOffset)}breakSingleBlock(){const t=this.removeSelectionRange(),e=t.parentBlock,{startOffset:i}=this.selectionController.getCurrentRange();if(e){const s=new De(t,i);e.apply(s),this.switchCaretPositionToNextElement(s.newBlock)}}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}}class Pe extends et{constructor(t,e){super(),this.type=it.LINE_BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class Ve extends et{constructor(t){super(),this.type=it.LINE_BREAK_MULTIPLE_BLOCKS,this.selectedBlocks=t}}class Ue extends Ae{handleEvent(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedBlocks();this.isRootContainer(t.startContainer)&&this.breakNewBlock(),e.length<2?this.breakSingleBlock():this.breakMultipleBlocks()}breakNewBlock(){const t=new M(Rt(),"paragraph"),e=this.createLineBreakNode(t);t.apply(new K([this.createLineBreakNode(t),e])),this.currentState.apply(new K([t])),this.switchCaretPositionToSpecifiedNode(e)}breakSingleBlock(){const t=this.selectionController.getCurrentRange(),e=this.removeSelectionRange(),i=e.parentBlock;if(i){const s=new Pe(e,t.startOffset);i.apply(s),this.switchCaretPositionToSpecifiedNode(s.lineBreakNode)}}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.removeSelectionRange(),i=new Ve(t);e.parentBlock.apply(i),this.switchCaretPositionToSpecifiedNode(i.lineBreakNode)}switchCaretPositionToSpecifiedNode(t){this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(t),0)}getNextRTENode(t){const e=t.parentBlock.nodes.indexOf(t);return t.parentBlock.nodes[e+1]||t}createLineBreakNode(t){return new ct(Rt(),"\n",t)}}class We extends et{constructor(t,e){super(),this.type=it.DELETE_BLOCK_CONTENT,this.startContainerNode=t,this.startOffset=e}}class _e extends Ae{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.deleteContentWithSingleBlock():this.deleteContentWithMultipleNodes()}deleteContentWithSingleBlock(){const t=this.selectionController.getCurrentRange(),{startOffset:e,endOffset:i,startContainer:s,endContainer:o}=t,n=this.selectionController.getSelectedBlocks(),r=this.selectionController.getSelectedNodes();if(e!==i||s!==o)this.deleteContentWithMultipleNodes();else if(n[0]){const t=new We(r[0],e);if(n[0].apply(t),t.previousNode){const i=t.previousNode===r[0]?Math.max(0,e-1):this.getNodeEndOffset(t.previousNode);this.selectionController.enqueueSelectionRangeFutureState(t.previousNode,i)}else t.nextNode?this.selectionController.enqueueSelectionRangeFutureState(t.nextNode,0):0===this.currentState.blocks.length&&this.insertDefaultParagraph()}}insertDefaultParagraph(){const t=this.createEmptyParagraph();this.currentState.apply(new K([t])),this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],1)}deleteContentWithMultipleNodes(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),i=this.replaceSelectedNodesWithText(""),s=e[e.length-1];e.length>1&&s instanceof ct&&s.isEmpty()&&s.parentBlock.apply(new _(s)),this.convertFirstBlockToParagraph(i.parentBlock),this.selectionController.enqueueSelectionRangeFutureState(i,t.startOffset)}convertFirstBlockToParagraph(t){if(this.currentState.blocks[0]===t&&t instanceof M&&1===t.nodes.length&&t.nodes[0].isEmpty()&&"paragraph"!==t.type){const e=this.createEmptyParagraph();e.apply(new J(t.nodes)),t.parent.apply(new G(t,e)),t.parent.apply(new _(t))}}getNodeEndOffset(t){return"IMAGE"===t.type?1:"TEXT"===t.type?"\n"===t.text?0:t.text.length:void 0}}class Ke{constructor(t){this.setEntityElementStyle(t),this.setElement(t)}static canHandle(t){throw new Error(`Method not implemented! ${t}`)}static currentTextBlockElementToDTO(){const t=this.getCurrentTextBlockElement(),e=t.firstChild;if(e&&"SPAN"===e.nodeName&&"\n"===e.textContent&&e.remove(),t.childNodes.length>0){const e=M.fromHTML(t,"paragraph");return t.innerHTML="",e}return null}static getCurrentTextBlockElement(){return Ke.currentTextBlockElement}handleEmptyBlock(t){return 0===this.currentVirtualElement.childNodes.length&&((t||Ke.getCurrentTextBlockElement()).append(this.createNewLineSpan()),!0)}setEntityElementStyle(t){if(t.nodeType===Node.TEXT_NODE)return;let e=t.getAttribute("style")||"";const i=t.classList,s=t.parentElement,o=s.getAttribute("style")||"",n=s.classList;switch(t.nodeName){case"CODE":i.add("v-rte--code");break;case"STRONG":e+="font-weight: bold; ";break;case"I":case"EM":e+="font-style: italic; ";break;case"S":i.add("v-rte--strikethrough");break;case"U":i.add("v-rte--underline")}t.setAttribute("style",o+e),t.classList.add(...Array.from(n))}setElement(t){if(this.currentEntityElement=t,t.nodeType===Node.TEXT_NODE){const e=document.createElement("span");e.setAttribute("style",t.parentElement.getAttribute("style")),e.setAttribute("class",t.parentElement.getAttribute("class")),e.append(t),this.currentVirtualElement=e}else{const e=t.cloneNode(!0);e.innerHTML="",this.currentVirtualElement=e}}createNewLineSpan(){const t=document.createElement("span");return t.append("\n"),t}}Ke.currentTextBlockElement=document.createElement("div");class Ge extends Ke{static canHandle(t){return t.nodeType===Node.ELEMENT_NODE&&("IMG"===t.nodeName||null!==t.querySelector("vega-rich-text-image-editor"))}childElements(){return[]}handle(){return[Ke.currentTextBlockElementToDTO(),X.fromHTML(this.currentEntityElement)]}getNextBlockElement(){return this.currentVirtualElement}}class qe extends Ke{static canHandle(){return!0}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(){return[]}getNextBlockElement(t){return t}}class $e extends Ke{constructor(t){super(t)}static canHandle(t){return["A"].includes(t.nodeName)}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(t){const e=Rt();return Array.from(this.currentVirtualElement.children).forEach((i=>{i.setAttribute("data-href",this.currentVirtualElement.href),i.setAttribute("data-group-key",e),(t||Ke.getCurrentTextBlockElement()).append(i)})),[]}getNextBlockElement(){return this.currentVirtualElement}}class Je extends Ke{static canHandle(t){return["LI"].includes(t.nodeName)}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(t){return t.append(this.currentVirtualElement),[]}getNextBlockElement(){return this.currentVirtualElement}}class Xe extends Ke{static canHandle(t){return["UL","OL"].includes(t.nodeName)}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(t){return this.handleEmptyBlock(t)?[]:t&&Je.canHandle(t)?(t.append(this.currentVirtualElement),[]):[Ke.currentTextBlockElementToDTO(),Y.fromHTML(this.currentVirtualElement)]}getNextBlockElement(){return this.currentVirtualElement}}class Ye extends Ke{static canHandle(t){return["DIV","P"].includes(t.nodeName)}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(t){return this.handleEmptyBlock(t)?[]:t&&!Ye.canHandle(t)?(t.append(...Array.from(this.currentVirtualElement.childNodes)),[]):[Ke.currentTextBlockElementToDTO(),M.fromHTML(this.currentVirtualElement,"paragraph")]}getNextBlockElement(){return this.currentVirtualElement}}class Qe extends Ke{static canHandle(t){return["heading-1","heading-2","heading-3","title","subtitle"].includes(this.getElementType(t))}static getElementType(t){if(t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type"))return t.getAttribute("data-type");switch(t.nodeName){case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";default:return""}}childElements(){return Array.from(this.currentEntityElement.childNodes)}handle(t){return this.handleEmptyBlock(t)?[]:t?(t.append(...Array.from(this.currentVirtualElement.childNodes)),[]):[Ke.currentTextBlockElementToDTO(),M.fromHTML(this.currentVirtualElement,Qe.getElementType(this.currentVirtualElement))]}getNextBlockElement(){return this.currentVirtualElement}}class Ze extends Ke{static canHandle(t){return t.nodeType===Node.TEXT_NODE}childElements(){return[]}handle(t){return(t||Ke.getCurrentTextBlockElement()).append(this.currentVirtualElement),[]}getNextBlockElement(t){return t}}class ti{constructor(){this.elementHandlers=[Ze,Ge,Xe,Je,Qe,Ye,$e,qe]}process(t){const e=this.transformDomToDto(Array.from(t.childNodes),null);return e.push(Ke.currentTextBlockElementToDTO()),e.filter(Boolean)}transformDomToDto(t,e){const i=[];return t.forEach((t=>{if(this.isInvalidElement(t))return;const s=new(this.elementHandlers.find((e=>e.canHandle(t))))(t);t.nodeType!==Node.TEXT_NODE&&i.push(...this.transformDomToDto(s.childElements(),s.getNextBlockElement(e))),i.push(...s.handle(e))})),i}isInvalidElement(t){return t.nodeType===Node.COMMENT_NODE||(!(t.nodeType!==Node.TEXT_NODE||!t.nodeValue.includes("\t")||0!==t.nodeValue.replace(/\n|\t/gm,"").length)||["META","BUTTON","STYLE"].includes(t.nodeName))}}class ei extends Ae{constructor(){super(...arguments),this.elementToDTOProcessor=new ti}handleEvent(t){const e=this.parsePastedElements(t),{startContainer:i}=this.selectionController.getCurrentRange();this.isRootContainer(i)?this.insertBlocksToRoot(e):this.isEmptyParagraph(i)?this.insertBlocksBeforeEmptyBlock(e):this.insertBlocksToContent(e)}insertBlocksToRoot(t){this.currentState.apply(new K(t))}insertBlocksToContent(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parentBlock;if(i){const{startOffset:s}=this.selectionController.getCurrentRange(),o=new $(e,s);i.apply(o),i.parent.apply(new Q(i,...t)),this.switchCaretPositionToNextElement(o.newBlock)}}insertBlocksBeforeEmptyBlock(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parentBlock;i.parent.apply(new G(i,...t)),this.switchCaretPositionToNextElement(i)}parsePastedElements(t){const e=t.dataTransfer.getData("text/html"),i=document.createElement("div");return i.innerHTML=e,this.elementToDTOProcessor.process(i)}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}}var ii=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class si extends i{constructor(){super(...arguments),this.insertTextHandler=new Ne,this.insertParagraphHandler=new Fe,this.insertLineBreakHandler=new Ue,this.deleteContentHandler=new _e,this.insertPasteHandler=new ei,this.observerOptions={characterData:!0,characterDataOldValue:!0,subtree:!0,childList:!0},this.handleUserInputAction=t=>{this.removeObserver(),t.preventDefault(),this.initValueIfEmpty();let e=!1;switch(t.inputType){case"insertParagraph":e=!0,this.insertParagraphHandler.execute(this.value,this.selectionController,t);break;case"insertText":e=!0,this.insertTextHandler.execute(this.value,this.selectionController,t);break;case"insertLineBreak":e=!0,this.insertLineBreakHandler.execute(this.value,this.selectionController,t);break;case"deleteContentBackward":e=!0,this.deleteContentHandler.execute(this.value,this.selectionController,t);break;case"insertFromPaste":e=!0,this.insertPasteHandler.execute(this.value,this.selectionController,t)}e&&this.notifyComponentFlushValue()},this.handleObserver=t=>{let e=!1;t.every((t=>"characterData"===t.type))&&(t.forEach((t=>{const{target:i}=t;if(i.nodeType===Node.TEXT_NODE&&i.parentElement){const t=ot.getEntityByDOM(i.parentElement);t&&t.text!==i.textContent&&(e=!0,t.text=i.textContent)}})),e&&this.notifyComponentFlushValue())}}initMutationObserver(){if(this.mutationObserver){const t=this.getEditableElementRef();t&&(this.mutationObserver.disconnect(),this.mutationObserver.observe(t,this.observerOptions))}}removeObserver(){this.mutationObserver&&this.mutationObserver.disconnect()}addActionListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("beforeinput",this.handleUserInputAction),t.addEventListener("drop",this.preventDropEvent)),this.mutationObserver=new MutationObserver(this.handleObserver),this.initMutationObserver()}removeActionListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("beforeinput",this.handleUserInputAction),t.removeEventListener("drop",this.preventDropEvent)),this.removeObserver()}reConnectObserver(){this.initMutationObserver()}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}notifyComponentFlushValue(){this.valueController.flushChanges(this.value)}preventDropEvent(t){t.preventDefault()}initValueIfEmpty(){if(!this.value){const t=Rt();this.valueController.flushChanges(W.fromJSON([{id:t,type:"paragraph",nodes:[{id:`${t}1`,type:"text",text:""}]}]))}}}ii([t()],si.prototype,"host",void 0),ii([t()],si.prototype,"value",void 0),ii([t()],si.prototype,"valueController",void 0),ii([t()],si.prototype,"vegaRichTextEditorRenderer",void 0),ii([t()],si.prototype,"selectionController",void 0),ii([e("componentDidLoad")],si.prototype,"addActionListener",null),ii([e("disconnectedCallback")],si.prototype,"removeActionListener",null),ii([e("componentDidRender")],si.prototype,"reConnectObserver",null);class oi{evaluate(t){var e;if(!this.isAcceptedInputType(t))throw new Error(`Invalid value ${t} for rich text editor`);const i=(null===(e=null==t?void 0:t.blocks)||void 0===e?void 0:e.length)>0&&t.blocks.some((t=>t.isNotEmpty()));return{isValid:i,message:i?"":"This field is required"}}canEvaluate(t,e){return e?this.isAcceptedInputType(t)&&!e.disabled&&e.visible:this.isAcceptedInputType(t)}shouldShowError(t){return!t.disabled&&t.visible&&(t.touched||t.modified)}isAcceptedInputType(t){return null==t||t instanceof W}}class ni extends et{constructor(t,e,i){super(),this.isFlushable=!0,this.type=it.INSERT_IMAGE_TO_BLOCK,this.splitPointNode=t,this.startOffsetOfNode=e,this.imageBlockToBeInserted=i}}var ri=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ci extends i{insertImageToCaretPosition(t){const e=this.selectionController.getSelectedBlocks(),i=new X(Rt()),s=new P(Rt(),t,i);if(s.apply(new Z("md","")),i.apply(new K([s])),e.length<1||this.value.blocks.length<1)this.value.apply(new K([i])),this.valueController.flushChanges(this.value);else{const{startOffset:t}=this.selectionController.getCurrentRange(),s=this.selectionController.getSelectedNodes();e[0].apply(new ni(s[0],t,i))}return this.updateCaretPosition(s),s}registerObserver(){this.registerImageSelectedObserver()}unRegisterObserver(){this.removeImageSelectedObserver()}updateCaretPosition(t){this.selectionController.enqueueSelectionRangeFutureState(t,1)}registerImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(b.addUniqueObserverToNode(t,T,(t=>{const e=this.selectionController.getCurrentRange();if(!e||e.startContainer!==t.host||0!==e.startOffset){const e=ot.getEntityByDOM(t.host.querySelector("img"));this.selectionController.enqueueSelectionRangeFutureState(e,0,e,0,!0)}})),b.addUniqueObserverToNode(t,E,(t=>{const e=this.selectionController.getCurrentRange();e&&e.startContainer===t.host&&1===e.startOffset||this.selectionController.enqueueSelectionRangeFutureState(t.host,1,t.host,1,!0)})))}removeImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(b.removeUniqueObserverFromNode(t,T),b.removeUniqueObserverFromNode(t,E))}}ri([t()],ci.prototype,"selectionController",void 0),ri([t()],ci.prototype,"value",void 0),ri([t()],ci.prototype,"valueController",void 0),ri([t()],ci.prototype,"vegaRichTextEditorRenderer",void 0),ri([e("componentDidLoad")],ci.prototype,"registerObserver",null),ri([e("disconnectedCallback")],ci.prototype,"unRegisterObserver",null);var li=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ai extends i{constructor(){super(...arguments),this.doFocusOnLastTextNode=async t=>{this.setCaretRangeToNodeEnd(ot.getDOMByEntity(t.getLastNode()).firstChild),await this.vegaRichTextEditorRenderer.getRichTextContentRef().vegaFocus()}}async focusOnLastTextNode(t){const e=this.value.blocks[this.value.blocks.length-1];if(e instanceof M&&!(null==t?void 0:t.newLine))await this.doFocusOnLastTextNode(e);else{const t=M.from({id:Rt(),type:"paragraph",nodes:[{id:Rt(),type:"text",text:""}]});e.parent.apply(new Q(e,t)),await this.valueController.flushChanges(this.value),await this.doFocusOnLastTextNode(t)}}setCaretRangeToNodeEnd(t){const e=new Range;e.setStart(t,t.nodeValue.length),this.selectionController.setSelectionRange(e)}}li([t()],ai.prototype,"vegaRichTextEditorRenderer",void 0),li([t()],ai.prototype,"selectionController",void 0),li([t()],ai.prototype,"valueController",void 0),li([t()],ai.prototype,"value",void 0);var hi=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class di extends i{connectedCallback(){this.observer=new y(this.isAcceptObserver.bind(this),(t=>{yt.getTextNodeElements().forEach(((e,i)=>{i.style.color=t?e.textColor.dark:e.textColor.light}))})),m.register(zt,this.observer)}disconnectResizeObserver(){m.unregister(zt,this.observer)}isAcceptObserver(){return!0}}hi([e("connectedCallback")],di.prototype,"connectedCallback",null),hi([e("disconnectedCallback")],di.prototype,"disconnectResizeObserver",null);var ui=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const fi=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.vegaImageInserted=a(this,"vegaImageInserted",7),this.imageInserted=a(this,"imageInserted",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.formFieldController=new jt({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new oi:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:t=>this[t],inputContainerGetter:()=>this.vegaRichTextEditorRenderer.getRichTextContainerRef(),touchableAreaGetter:()=>[this.vegaRichTextEditorRenderer.getRichTextContentRef()]}),this.changeEventEmitter=kt(fi,w),this.vegaRichTextEditorRenderer=new Nt,this.valueController=new Ee,this.selectionController=new He,this.focusController=new ai,this.darkModeStateControllerSlimmer=new Le,this.toolbarRenderer=new Ft,this.clearStyleToolbarButtonSlimmer=new qt,this.boldToolbarButtonSlimmer=new Pt,this.italicToolbarButtonSlimmer=new Ut,this.underlineToolbarButtonSlimmer=new _t,this.textColorToolbarButtonSlimmer=new B,this.textStylesToolbarButtonSlimmer=new Gt,this.codeToolbarButtonSlimmer=new $t,this.strikethroughToolbarButtonSlimmer=new Xt,this.imageToolbarButtonSlimmer=new se,this.linkToolbarButtonSlimmer=new Qt,this.moreIndentToolbarButtonSlimmer=new te,this.lessIndentToolbarButtonSlimmer=new ee,this.bulletsNumbersToolbarButtonSlimmer=new de,this.horizontalAlignmentToolbarButtonSlimmer=new Ce,this.placeholderNotifySlimmer=St(fi,"placeholder","watchPlaceholder"),this.disabledNotifySlimmer=St(fi,"richTextContentEditable","watchRichTextContentEditable"),this.richTextContentController=new Be(this),this.userInputController=new si,this.insertImageController=new ci,this.imageInsertedEventEmitter=kt(fi,C),this.changeEventPreventSlimmer=new Lt([w],(()=>this.vegaRichTextEditorRenderer.getRichTextWrapperRef())),this.textNodeColorController=new di,this.richTextContentEditable=!0,this.selectionMap=new Map,this.isInDarkMode=rt.isDarkMode(),this.label="",this.required=!1,this.placeholder="",this.disabled=!1,this.hint="",this.rows=4,this.value=W.createEmptyContent(),this.toolbarItems=[["clearStyle"],["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"]],this.isValid=null,this.autoValidation=!0,this.validationRules=[]}watchRichTextContentEditable(){}watchPlaceholder(){}watchDisabled(){this.richTextContentController.syncRichTextContentEditable()}watchValueUpdate(){}watchValidationRules(){}componentWillLoad(){this.richTextContentController.syncRichTextContentEditable()}render(){return p(this.vegaRichTextEditorRenderer.render(),this.host)}get host(){return h(this)}static get watchers(){return{richTextContentEditable:["watchRichTextContentEditable"],placeholder:["watchPlaceholder"],disabled:["watchDisabled"],value:["watchValueUpdate"],validationRules:["watchValidationRules"]}}};ui([u()],fi.prototype,"globalSlimmers",void 0),ui([r()],fi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),ui([r()],fi.prototype,"formFieldController",void 0),ui([r()],fi.prototype,"changeEventEmitter",void 0),ui([r()],fi.prototype,"vegaRichTextEditorRenderer",void 0),ui([r()],fi.prototype,"valueController",void 0),ui([r()],fi.prototype,"selectionController",void 0),ui([r()],fi.prototype,"focusController",void 0),ui([r()],fi.prototype,"darkModeStateControllerSlimmer",void 0),ui([r()],fi.prototype,"toolbarRenderer",void 0),ui([r()],fi.prototype,"clearStyleToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"boldToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"italicToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"underlineToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"textColorToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"textStylesToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"codeToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"strikethroughToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"imageToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"linkToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"moreIndentToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"lessIndentToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),ui([r()],fi.prototype,"placeholderNotifySlimmer",void 0),ui([r()],fi.prototype,"disabledNotifySlimmer",void 0),ui([r()],fi.prototype,"richTextContentController",void 0),ui([r()],fi.prototype,"userInputController",void 0),ui([r()],fi.prototype,"insertImageController",void 0),ui([r()],fi.prototype,"imageInsertedEventEmitter",void 0),ui([r()],fi.prototype,"changeEventPreventSlimmer",void 0),ui([r()],fi.prototype,"textNodeColorController",void 0),fi.style=':host{display:block}:host vega-field-label{margin-bottom:8px}:host vega-text{margin-bottom:16px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container{display:flex;box-sizing:content-box;position:relative;box-sizing:content-box;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));margin-top:12px;overflow:auto;resize:vertical;padding-top:12px;padding-right:16px;padding-bottom:32px;padding-left:16px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .rich-text-editor-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host .rich-text-editor-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1))}:host .rich-text-editor-container.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:hover,:host .rich-text-editor-container.disabled:focus-within{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:focus-within{outline:none}:host .rich-text-editor-container.error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host .rich-text-editor-container.error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host .rich-text-editor-container.error:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host .rich-text-editor-container .text-editor-counter{position:absolute;bottom:8px;right:8px;display:flex;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;border-radius:4px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1));background-color:rgba(var(--v-bg-textarea-count, 4, 4, 28, 0.6))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container .text-editor-counter.counter-exceed-max-length{background-color:rgba(var(--v-bg-textarea-counter-exceed-max-length, 214, 46, 81))}.toolbar-btn-group{display:flex;justify-content:center;align-items:center}.toolbar-btn-group>*:not(:first-child):not(:last-child) ::part(rich-text-editor-toolbar-button){border-radius:0px}.toolbar-btn-group>*:first-child:not(:last-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0px;border-bottom-right-radius:0px}.toolbar-btn-group>*:last-child:not(:first-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:0px;border-bottom-left-radius:0px;border-top-right-radius:4px;border-bottom-right-radius:4px}.toolbar-btn-group>*:not(:first-child) ::part(rich-text-editor-toolbar-button){margin-left:-1px}.toolbar-btn-group .toolbar-btn-color-preview-box{display:flex;border:1px solid rgba(var(--v-border-chip, 205, 209, 211, 1));box-sizing:border-box;border-radius:4px;width:16px;height:16px;cursor:pointer;justify-content:center;align-items:center;margin-left:6px}.toolbar-btn-group .toolbar-btn-link-wrapper{position:relative}.toolbar-btn-group .toolbar-btn-link-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;margin-top:12px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}';var pi=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class vi extends i{constructor(){super(...arguments),this.handleClick=t=>{this.disabled?t.preventDefault():this.clickEventEmitter.emit(void 0,t)}}render(){return s("button",{part:"rich-text-editor-toolbar-button",class:{"rich-text-editor-toolbar-btn":!0,"rich-text-editor-toolbar-button-disabled":this.disabled,"rich-text-editor-toolbar-button-selected":this.selected},onClick:this.handleClick,disabled:this.disabled},s("vega-flex",{gap:"size-8",justifyContent:"center",alignItems:"center"},s("vega-icon",{size:"size-16",color:this.iconColor,icon:I.getIconKey(this.icon)}),this.showArrowIcon&&s("vega-icon",{size:"size-8",color:"text-secondary",icon:I.getIconKey("chevron-down")})),s("slot",null))}}I.register({"chevron-down":Bt}),pi([t()],vi.prototype,"disabled",void 0),pi([t()],vi.prototype,"selected",void 0),pi([t()],vi.prototype,"showArrowIcon",void 0),pi([t()],vi.prototype,"icon",void 0),pi([t()],vi.prototype,"iconColor",void 0),pi([t()],vi.prototype,"clickEventEmitter",void 0);var mi=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const gi=class{constructor(t){l(this,t),this.vegaClick=a(this,"vegaClick",7),this.click=a(this,"click",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.clickEventEmitter=kt(gi,R),this.eventPrevent=new Lt([R],(()=>this.host),{useCapture:!0,customPreventHandle:t=>{this.disabled&&t.stopImmediatePropagation()}}),this.renderer=new vi,this.disabled=!1,this.selected=!1,this.showArrowIcon=!1,this.icon="",this.iconColor="text-primary"}render(){return p(s(o,null,this.renderer.render()),this.host)}get host(){return h(this)}};mi([u()],gi.prototype,"globalSlimmers",void 0),mi([r()],gi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),mi([r()],gi.prototype,"clickEventEmitter",void 0),mi([r()],gi.prototype,"eventPrevent",void 0),mi([r()],gi.prototype,"renderer",void 0),gi.style=":host{display:inline-block}.rich-text-editor-toolbar-btn{display:flex;justify-content:center;align-items:center;border-radius:4px;border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));padding-top:8px;padding-bottom:8px;padding-left:12px;padding-right:12px;cursor:pointer;position:relative;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1))}.rich-text-editor-toolbar-btn:hover{background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1));z-index:1}.rich-text-editor-toolbar-btn:active{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:-1px;z-index:2}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-selected{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}";var bi=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class xi extends i{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&(this.formRef.getValue().then((({alt:t})=>{this.changeEventEmitter.emit({action:"edit",payload:{size:this.size,alt:t}})})),this.popoverRef.hide())}}render(){return s("vega-popover",{style:{width:"100%"},trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,b.addUniqueObserverToNode(t,j,(()=>{this.selected=!0,this.notifyImageSelected(),this.formRef.setValue({alt:this.alt})})),b.addUniqueObserverToNode(t,k,(()=>{this.currentPage=1,this.selected=!1,this.formRef.reset()}))}},s("div",{slot:"popover-content"},s("slot",null)),s("div",{slot:"popover"},this.renderImageEditor(),this.renderAltTextEditor()))}findParentContainerRef(){this.parentContainerRef=Tt(this.host,"vega-rich-text-content")}renderImageEditor(){return s("vega-box",{display:1===this.currentPage?"block":"none"},s("vega-flex",{gap:"size-12",alignItems:"center"},s("vega-font",{variant:"font-field-label-sm",color:"text-primary"},"Size:"),s("vega-segment-control",{size:"small",segments:[{key:"sm",text:"Sm"},{key:"md",text:"Md"},{key:"lg",text:"Lg"}],selected:this.size,ref:t=>{b.addUniqueObserverToNode(t,w,(t=>{const e=t.detail;this.size=e,this.changeEventEmitter.emit({action:"edit",payload:{size:e,alt:this.alt}})}))}}),s("vega-button-group",{variant:"tertiary",size:"small",ref:t=>{b.addUniqueObserverToNode(t,R,(t=>{"Alt Text"===t.detail?this.currentPage=2:(this.notifyImageDeleteButtonClicked(),this.changeEventEmitter.emit({action:"delete"}),this.popoverRef.hide())}))}},s("vega-button-group-item",{label:"Alt Text",itemKey:"Alt Text"}),s("vega-button-group-item",{label:"Delete Image",icon:I.getIconKey("trash-can"),iconOnly:!0,itemKey:"trash-can"}))))}renderAltTextEditor(){return s("vega-box",{display:2===this.currentPage?"block":"none"},s("vega-form",{ref:t=>this.formRef=t},s("vega-input",{"data-vega-form":"alt",style:{width:"315px"},label:"Alt Text",ref:t=>{t.doFocus()},onKeyDown:this.handleKeyDown})))}notifyImageSelected(){this.parentContainerRef&&m.notify(g.getSubject(this.parentContainerRef,T),{host:this.host})}notifyImageDeleteButtonClicked(){this.parentContainerRef&&m.notify(g.getSubject(this.parentContainerRef,E),{host:this.host})}}I.register({"trash-can":It}),bi([t({writable:!0})],xi.prototype,"currentPage",void 0),bi([t({writable:!0})],xi.prototype,"selected",void 0),bi([t()],xi.prototype,"host",void 0),bi([t()],xi.prototype,"alt",void 0),bi([t({writable:!0})],xi.prototype,"size",void 0),bi([t()],xi.prototype,"changeEventEmitter",void 0),bi([e("componentDidLoad")],xi.prototype,"findParentContainerRef",null);var wi=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const yi=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.renderer=new xi,this.changeEventEmitter=kt(yi,w),this.currentPage=1,this.selected=!1,this.alt="",this.size="md"}render(){return p(s(o,{class:{"rte-image-selected":this.selected}},this.renderer.render()),this.host)}get host(){return h(this)}};wi([u()],yi.prototype,"globalSlimmers",void 0),wi([r()],yi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),wi([r()],yi.prototype,"renderer",void 0),wi([r()],yi.prototype,"changeEventEmitter",void 0),yi.style=":host{display:inline-block}:host(.rte-image-selected){outline:2px solid rgba(var(--v-border-color-tile-selected, 19, 98, 226, 1));outline-offset:-2px}";var Ci=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ri extends i{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&this.formRef.getValue().then((({text:t,url:e})=>{e.length>0&&(this.changeEventEmitter.emit({action:"link",payload:{text:t||e,url:e}}),this.popoverRef.hide())}))}}componentDidLoad(){this.updatePopoverTarget()}componentDidRender(){m.notify(g.getSubject(this.host,S),{})}watchStatusChange(){"linkEdit"===this.status&&setTimeout((()=>{this.urlInputRef.doFocus()}))}watchTargetChange(){this.updatePopoverTarget()}getPopoverRef(){return this.popoverRef}render(){return s("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,b.addUniqueObserverToNode(t,j,(()=>{var t,e;"linkEdit"===this.status&&this.urlInputRef.doFocus(),this.formRef.setValue({text:null===(t=this.record)||void 0===t?void 0:t.text,url:null===(e=this.record)||void 0===e?void 0:e.url})})),b.addUniqueObserverToNode(t,k,(()=>{this.formRef.reset(),this.resetStatusAfterHide&&(this.status="editOrUnlinkSelection")}))}},s("span",{slot:"popover-content"},s("slot",null)),s("div",{slot:"popover"},this.renderLinkUnlinkContent(),this.renderLinkEditContent()))}renderLinkUnlinkContent(){return s("vega-box",{display:"editOrUnlinkSelection"===this.status?"block":"none"},s("vega-button-group",{size:"small",variant:"tertiary",ref:t=>{b.addUniqueObserverToNode(t,R,(({detail:t})=>{switch(t){case"edit":return void(this.status="linkEdit");case"unlink":this.changeEventEmitter.emit({action:"unlink"}),this.popoverRef.hide()}}))}},s("vega-button-group-item",{label:"Edit",itemKey:"edit"}),s("vega-button-group-item",{label:"Unlink",itemKey:"unlink"})))}renderLinkEditContent(){return s("vega-box",{display:"linkEdit"===this.status?"block":"none"},s("vega-form",{ref:t=>this.formRef=t},s("vega-flex",{style:{width:"419px"},direction:"col",gap:"size-16"},s("vega-input",{"data-vega-form":"url",ref:t=>{this.urlInputRef=t},size:"small",label:"URL",onKeyDown:this.handleKeyDown}),s("vega-input",{size:"small",label:"Text","data-vega-form":"text",onKeyDown:this.handleKeyDown}))))}updatePopoverTarget(){At.call(g.getSubject(this.popoverRef,z),this.target)}}Ci([t()],Ri.prototype,"host",void 0),Ci([t({writable:!0})],Ri.prototype,"status",void 0),Ci([t({writable:!0})],Ri.prototype,"record",void 0),Ci([t()],Ri.prototype,"changeEventEmitter",void 0),Ci([t()],Ri.prototype,"resetStatusAfterHide",void 0),Ci([t()],Ri.prototype,"target",void 0),Ci([e("componentDidLoad")],Ri.prototype,"componentDidLoad",null),Ci([e("componentDidRender")],Ri.prototype,"componentDidRender",null),Ci([e("watchStatusChange")],Ri.prototype,"watchStatusChange",null),Ci([e("watchTargetChange")],Ri.prototype,"watchTargetChange",null);var ji=function(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const ki=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.renderer=new Ri,this.changeEventEmitter=kt(ki,w),this.status="editOrUnlinkSelection",this.resetStatusAfterHide=!0}watchStatusChange(){}watchTargetChange(){}async show(){await this.renderer.getPopoverRef().show()}render(){return p(s(o,null,this.renderer.render()),this.host)}get host(){return h(this)}static get watchers(){return{status:["watchStatusChange"],target:["watchTargetChange"]}}};ji([u()],ki.prototype,"globalSlimmers",void 0),ji([r()],ki.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),ji([r()],ki.prototype,"renderer",void 0),ji([r()],ki.prototype,"changeEventEmitter",void 0),ki.style=":host{display:contents}:host vega-popover{display:inline}";export{fi as vega_rich_text_editor,gi as vega_rich_text_editor_toolbar_button,yi as vega_rich_text_image_editor,ki as vega_rich_text_link_editor}
@@ -1 +0,0 @@
1
- import{h as t,r as e,e as i,H as n,g as a,I as s}from"./p-9c1eeff2.js";import{s as o}from"./p-296cc56b.js";import{n as r,c as g}from"./p-262ec334.js";import{D as h,v as p,A as l,V as m,b as c,L as f}from"./p-a5ffe912.js";import{a as v}from"./p-1995e98e.js";import{C as d}from"./p-39836361.js";import{c as u}from"./p-11cb477b.js";import{V as x,I as w}from"./p-8f93242a.js";import{T as b}from"./p-7209d03b.js";import"./p-443ad3b3.js";import"./p-f763e2eb.js";import"./p-5f377954.js";import"./p-acf7f903.js";import"./p-7a40e033.js";import"./p-112455b1.js";import"./p-59bdf9b8.js";import"./p-e1e1fcf0.js";import"./p-d057999f.js";import"./p-3ce31dc3.js";const y=({pageSize:e,current:i,total:n,translationSlimmer:a})=>{const s=n>0?e*(i-1)+1:0,o=Math.min(i*e,n);return t("vega-field-label",{label:a.t("Viewing {0}-{1} of {2}",s,o,n)})},z=({onChange:e,pageCount:i,translationSlimmer:n})=>{let a;const s=()=>{if(a.value){const t=r(g(a.value,1),1,i);e(t),a.value=""}},o=t=>{t.stopPropagation()};return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},t("vega-field-label",{label:n.t("Go To")}),t("vega-form",{ref:t=>{h.addUniqueObserverToNode(t,p,s)}},t("vega-input",{"data-vega-form":"paginationGoTo",type:"number",size:"small",showClearIcon:!1,style:{width:"60px"},maskConfig:{type:"number",options:{allowNegative:!1,precision:0}},onVegaChange:o,onChange:o,ref:t=>{a=t,h.addUniqueObserverToNode(t,l,s)}})))},S=({pageSize:e,pageSizeSelectorOptions:i,onChange:n,translationSlimmer:a})=>{const s=i.sort(((t,e)=>t-e)),o=t=>{const e=Number(t.detail);n(e)};return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},t("vega-field-label",{label:a.t("Show")}),t("div",null,t("vega-input-select",{size:"small",source:s.map((t=>({id:t.toString(),displayName:t.toString()}))),value:e.toString(),placeholder:"Page Size",vegaDropdownProps:{matchTargetWidth:!1,searchable:!1},ref:t=>{h.addUniqueObserverToNode(t,m,o)}})))},C=({total:e,current:i,onChange:n,pageCount:a})=>{const s=e=>{const a=i!==e;return t("li",{key:e,class:v(["vega-pagination-item",i===e?"active":""])},t("button",{onClick:()=>a&&n(e)},e))},o=(e,i,n)=>t("li",{class:v(["vega-pagination-button",i&&"disabled"])},t("vega-button-circle",{variant:"icon-only",icon:e,iconColor:"text-link",size:"small",disabled:i,ref:t=>{h.addUniqueObserverToNode(t,c,n)}}));return t("ul",{class:"vega-pagination"},o("chevron-left",0===e||1===i,(()=>{n(i-1)})),0===e?[s(1)]:((t,e,i=7)=>{if(i<7)throw new Error("Must allow at least 7 pager items");if(i%2==0)throw new Error("Must allow odd number of pager items");if(e<i)return Array(e).fill(0).map(((t,e)=>e+1));const n=Math.max(1,Math.min(e-i+1,t-Math.floor(i/2))),a=new Array(i);for(let t=0;t<i;t+=1)a[t]=t+n;return Number(a[0])>1&&(a[0]=1,a[1]="..."),Number(a[a.length-1])<=e-1&&(a[a.length-1]=e,a[a.length-2]="..."),a})(i,a).map((e=>"string"==typeof e?t("li",{class:"vega-pagination-item pager-ellipsis"},"..."):s(e))),o("chevron-right",0===e||i===a,(()=>{n(i+1)})))};var j=function(t,e,i,n){var a,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(o=(s<3?a(o):s>3?a(e,i,o):a(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};const I=class{constructor(n){e(this,n),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.vegaPageSizeChange=i(this,"vegaPageSizeChange",7),this.pageSizeChange=i(this,"pageSizeChange",7),this.globalSlimmers={},this.translationSlimmer=new b,this.childEventPrevent=new d([p],(()=>this.host)),this.childValueChangePrevent=new d([m],(()=>this.host),!0),this.vegaChangeEventEmitter=u(I,m),this.vegaPageSizeChangeEventEmitter=u(I,f),this.vegaComponentUsageRuntimeMetricsSlimmer=new x,this.vegaPaginationItemTypes=["currentPageLabel","pageSizeSelector","pageSelector","goTo"],this.pageCount=0,this.current=1,this.total=0,this.pageSize=10,this.extensions=[["pageSelector"]],this.pageSizeSelectorOptions=[10,20,50,100],this.renderPaginationItemsWrapper=e=>t("vega-flex",{gap:"size-24",alignItems:"center",key:this.generateWrapperKey(e)},e.map((e=>t("div",{key:e},this.renderPaginationItem(e))))),this.renderPaginationItem=e=>{switch(e){case"currentPageLabel":return t(y,{total:this.total,current:this.current,pageSize:this.pageSize,translationSlimmer:this.translationSlimmer});case"pageSizeSelector":{const e=this.pageSizeSelectorOptions.includes(this.pageSize)?this.pageSizeSelectorOptions:[...this.pageSizeSelectorOptions,this.pageSize];return t(S,{pageSize:this.pageSize,pageSizeSelectorOptions:e,onChange:this.onPageSizeSelectorChange,translationSlimmer:this.translationSlimmer})}case"pageSelector":return t(C,{current:this.current,total:this.total,onChange:this.onPageSelectorChange,pageCount:this.pageCount});case"goTo":return t(z,{onChange:this.handlePaginationGoToChange,pageCount:this.pageCount,translationSlimmer:this.translationSlimmer})}},this.handlePaginationGoToChange=t=>{this.current=t},this.onPageSizeSelectorChange=t=>{this.pageSize=t,this.vegaPageSizeChangeEventEmitter.emit(this.pageSize)},this.calculatePages=()=>this.total?Math.floor((this.total-1)/this.pageSize)+1:0,this.onPageSelectorChange=t=>{this.current=t},this.removeDuplicateItems=t=>{const e=[...this.vegaPaginationItemTypes];return[...t].map((t=>t.filter(((i,n)=>{const a=e.indexOf(i);return a>=0?(e.splice(a,1),!0):(t.splice(n,1),!1)})))).filter((t=>t.length>0))},this.generateWrapperKey=t=>t.map(String).reduce(((t,e)=>`${t}-${e}`)),this.currentValueGuard=()=>{0===this.pageCount?this.current=1:this.current>this.pageCount&&(this.current=this.pageCount)}}watchPageCount(){this.currentValueGuard()}watchCurrent(){this.currentValueGuard(),this.vegaChangeEventEmitter.emit(this.current)}watchPageSize(){this.pageCount=this.calculatePages()}componentWillLoad(){this.pageCount=this.calculatePages(),this.currentValueGuard(),this.pageSizeSelectorOptions.includes(this.pageSize)||(this.pageSizeSelectorOptions=[...this.pageSizeSelectorOptions,this.pageSize])}render(){return o(t(n,null,this.removeDuplicateItems(this.extensions).map(this.renderPaginationItemsWrapper)),this.host)}get host(){return a(this)}static get watchers(){return{pageCount:["watchPageCount"],current:["watchCurrent"],total:["watchPageSize"],pageSize:["watchPageSize"]}}};j([w()],I.prototype,"globalSlimmers",void 0),j([s()],I.prototype,"translationSlimmer",void 0),j([s()],I.prototype,"childEventPrevent",void 0),j([s()],I.prototype,"childValueChangePrevent",void 0),j([s()],I.prototype,"vegaChangeEventEmitter",void 0),j([s()],I.prototype,"vegaPageSizeChangeEventEmitter",void 0),j([s()],I.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),I.style=':host{display:flex;align-items:center;justify-content:space-between;gap:20px;line-height:normal}.vega-pagination{display:flex;padding:0px;margin:0px}.vega-pagination .vega-pagination-item{list-style-type:none;display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.vega-pagination .vega-pagination-item button{background-color:rgba(var(--v-bg-transparent, 0, 0, 0, 0));border-width:0px;outline:2px solid transparent;outline-offset:2px;width:100%;height:100%;cursor:pointer;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-link, 19, 98, 226, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.vega-pagination .vega-pagination-item.pager-ellipsis{cursor:default}.vega-pagination .vega-pagination-item:not(.pager-ellipsis):not(:active):hover{text-decoration:underline;text-underline-offset:2px}.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.vega-pagination .vega-pagination-item button:focus-visible{box-shadow:0 0 0 4px rgba(var(--v-ring-action-focus, 19, 98, 226, 0.25));border-radius:9999px}.vega-pagination .vega-pagination-button{list-style-type:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}';export{I as vega_pagination}
@@ -1 +0,0 @@
1
- import{h as t}from"./p-9c1eeff2.js";import{B as s,e}from"./p-452e284a.js";import{C as i}from"./p-443ad3b3.js";import{d as n,D as r,V as h}from"./p-a5ffe912.js";import{M as a,b as o,s as c,N as u,a as l,R as d,c as p,I as f}from"./p-8c26227e.js";import{V as w}from"./p-f357cf46.js";import{i as b}from"./p-b1f65b13.js";import{Z as g,A as m,T as k,B as y,R as x,L as N,D as A,a as j,U as O,S as v}from"./p-315667f1.js";import{g as L}from"./p-3ce31dc3.js";class B extends s{constructor(t){super(),this.type=e.ALIGNMENT,this.textAlign=t}static from(t){return[e.ALIGNMENT,new B(t)]}static fromHTML(t){const s=this.getTextAlign(t);return s?this.from(s):null}static getTextAlign(t){const s=t.classList;if(s.contains("v-rte--horizontal-alignment-left"))return"left";if(s.contains("v-rte--horizontal-alignment-center"))return"center";if(s.contains("v-rte--horizontal-alignment-right"))return"right";if(s.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}render(){return null}}class S extends s{constructor(t){super(),this.type=e.INDENT,this.indent=Math.max(0,t)}static from(t){return[e.INDENT,new S(t)]}static fromHTML(t){const s=this.getMarginLeft(t);return s&&s>=0?this.from(Math.floor(s/16)):null}static getMarginLeft(t){const s=t.style;let e;if(s.marginLeft)e=s.marginLeft;else{if(!s.margin)return null;{const t=s.margin.split(" ");switch(t.length){case 4:e=t[3];break;case 2:case 3:e=t[1];break;default:e=t[0]}}}return Number(e.replace("px",""))}toJSON(){return this.indent>0?{indent:this.indent}:null}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class T{replaceBlockWithBlocks(t,s){this.blocks&&(s.forEach((t=>{t.parent=this})),this.blocks=this.blocks.flatMap((e=>e===t?s:e)))}appendChildBlocks(t){this.blocks&&(t.forEach((t=>{t.parent=this})),this.blocks=this.blocks.concat(t))}removeChildBlock(t){this.blocks&&(this.blocks=this.blocks.filter((s=>s!==t)))}}class M extends a{constructor(t){super(),this.type=o.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class I extends a{constructor(t){super(),this.type=o.DELETE_CHILD,this.entityToBeRemoved=t}}class C extends s{constructor(t){super(),this.type=e.TEXT_STYLE,this.textStyle=t}static from(t){return[e.TEXT_STYLE,new C(t)]}static fromHTML(t){return this.from(this.getTextStyle(t))}static getTextStyle(t){if(t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type"))return t.getAttribute("data-type");switch(t.style.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3"}switch(t.nodeName){case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";default:return"paragraph"}}toJSON(){return{textStyle:this.textStyle}}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"}}}}class H extends T{constructor(t){super(),this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,s){switch(t){case"textAlign":return B.from(s);case"indent":return S.from(s)}}static createAnnotationEntityFromHTML(t,s){switch(t){case"ALIGNMENT":return B.fromHTML(s);case"TEXT_STYLE":return C.fromHTML(s);case"INDENT":return S.fromHTML(s)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof s)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=c.getDOMByEntity(this);if(t){const s=n.getSubjectFromParentNodeByEventId(t,w);s&&i.notify(s,{})}}}doApply(t){t instanceof a?this.doModifyActionApply(t):this.applyAnnotationAction(t)}applyAnnotationAction(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}getStyles(){return Array.from(this.annotationMap.values()).filter((t=>t instanceof s)).map((t=>t.render())).filter(b).reduce(((t,s)=>Object.assign(Object.assign({},t),s)),{})}getClasses(){return Array.from(this.annotationMap.values()).map((t=>{var s;return null===(s=t.renderClass)||void 0===s?void 0:s.call(t)})).filter(b).reduce(((t,s)=>[t,s].join(" ")),"")}appendChildNodes(t){t.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.concat(t)}mergeTwoBlocksNodes(t){if(this.type===t.type||"image"!==this.type&&"image"!==t.type){let s=t.nodes;"image"!==this.type&&(s=t.nodes.filter((t=>t.text&&t.text!==g))),this.apply(new M(s)),t.parent.apply(new I(t))}}concatBlocksNodes(t){const s=[];return t.map((t=>{"image"!==t.type&&(s.push(...t.nodes),t.parent.apply(new I(t)))})),s}getPreviousNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(e>0)return s.nodes[e-1];if(s.parent){const t=this.getPreviousBlock(s);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(s.nodes[e+1])return s.nodes[e+1];if(s.parent){const t=this.getNextBlock(s);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t),i=s.parent;if("list-item"===s.type){const t=i.parent;return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===i}return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockLastNode(t.blocks[t.blocks.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(s>0)return t.parent.blocks[s-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===s)return this.getPreviousBlock(t.parent)}}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(t.parent.blocks[s+1])return t.parent.blocks[s+1];if("list-item"===t.type&&t.parent.blocks.length===s+1)return this.getNextBlock(t.parent)}}replaceNodeWithNodes(t,s){this.nodes&&(s.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.flatMap((e=>e===t?s:e)))}}class E extends u{constructor(t="md",s){super(),this.type=l.IMAGE,this.size=t,this.alt=s}static from(t,s){return[l.IMAGE,new E(t,s)]}static fromHTML(t,s){return this.from(t||"md",s)}toJSON(){return b(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class z extends m{constructor(t,s){super(),this.isFlushable=!0,this.size=t,this.alt=s}toAnnotation(){return new E(this.size,this.alt)}}class J extends d{constructor(t,s,e,i){super(t,i),this.type=p.IMAGE,this.url=s,this.parentBlock=e}static from(t,s){const e=new J(t.id,t.url,s);let i;return i=t.annotations&&0!==Object.keys(t.annotations).length?t.annotations:{size:"md"},e.annotationMap=new Map(Object.keys(i).map((()=>E.from(i.size,i.alt))).filter(b)),e}static fromHTML(t,s){const e="IMG"===t.nodeName?t.src:t.querySelector("img").src,i=t.size,n=new J(L(),e,s);return n.annotationMap=new Map([E.fromHTML(i,t.alt)]),n}toJSON(){const t=this.annotationMap.get(l.IMAGE),s={};return(null==t?void 0:t.size)&&(s.size=t.size),(null==t?void 0:t.alt)&&(s.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{}),{type:"image",url:this.url})}render({editable:s}={}){const e=this.annotationMap.get(l.IMAGE),i=null==e?void 0:e.size,n=null==e?void 0:e.alt,a=({detail:t})=>{switch(t.action){case"edit":this.apply(new z(t.payload.size,t.payload.alt));break;case"delete":{const t=new InputEvent("beforeinput",{inputType:"deleteContentBackward",bubbles:!0});setTimeout((()=>{c.getDOMByEntity(this).dispatchEvent(t)}),50);break}}};return s?t("vega-rich-text-image-editor",{style:this.getStyles(),size:i,alt:n,ref:t=>{r.addUniqueObserverToNode(t,h,a)}},this.renderImage(s,n)):this.renderImage(s,n)}doAnnotationActionApply(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s)}doModifyActionApply(t){}registerRef(t){t&&c.register(t,this)}renderImage(s,e){return t("img",{style:s?{width:"100%"}:this.getStyles(),alt:e,src:this.url,ref:this.registerRef.bind(this)})}}class W extends a{constructor(t){super(),this.type=o.REPLACE_CHILD_NODES,this.newChildNodes=t}}class P extends a{constructor(t,...s){super(),this.type=o.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=s}}class F extends a{constructor(t,s){super(),this.type=o.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=s}}class R extends m{constructor(t,s){super(),this.isFlushable=!0,this.textStyle=t,this.bold=s}toAnnotation(){return new C(this.textStyle)}}class U extends k{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new y(this.bold)}}class V extends a{constructor(t){super(),this.type=o.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class D extends a{constructor(t,...s){super(),this.type=o.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=s}}class G extends H{constructor(t,s){super(t),this.nodes=[],this.type=s,super.annotationMap=G.isAcceptableTextStyle(s)?new Map([C.from(s)]):new Map([C.from("paragraph")])}static from(t){const s=new G(t.id,t.type),{annotations:e}=t;return s.nodes=t.nodes.map((t=>x.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static fromHTML(t,s){const i=new G(L(),s);return i.nodes=Array.from(t.childNodes).map((t=>x.fromHTML(t,i))),Object.keys(e).forEach((s=>{const e=this.createAnnotationEntityFromHTML(s,t);b(e)&&i.annotationMap.set(...e)})),i}static createAnnotationEntity(t,s){return"textStyle"===t?C.from(s):super.createAnnotationEntity(t,s)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((s,e)=>{const i=s.at(-1);if(t instanceof N&&t.needMergeNode){const t=null==i?void 0:i.getAnnotationByType(l.LINK),n=e.getAnnotationByType(l.LINK);if(t&&n&&t.toEqual(n))return s}return[...s,e]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new G(L(),this.type);return s.nodes=[],s.apply(new M(t)),s}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}render(s,e){const i=this.getBlockTagByType(this.type);return t(i,{ref:this.registerRef.bind(this),style:this.getStyles(),class:super.getClasses()},this.renderNodes(s),e)}registerRef(t){t&&c.register(t,this)}renderNodes(t={}){const s=this.getAnnotationByType(f.LINK_GROUP);return s?s.renderNodes(this.nodes,t):this.nodes.map((t=>t.render()))}doAnnotationActionApply(t){if(t instanceof R)return"list-item"!==this.type&&(this.type=t.textStyle),void this.nodes.forEach(t.bold?t=>{const s=new U(!0);s.doSplit=!1,t.apply(s)}:t=>{t.apply(new A(l.BOLD))});if(t instanceof j){const s=this.getAnnotationByType(f.LINK_GROUP);if(s){const e=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...e,...t.nodes]),this.annotationMap.set(f.LINK_GROUP,s)}}}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildNode(t);break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.TRANSFORM_LIST_BLOCK:this.convertParagraphToList(t);break;case o.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}splitTextNodeBlock(t,s){if(t){const e=t.text.slice(0,s),i=t.text.slice(s),n=this.nodes.indexOf(t);if(n>-1){const s=this.nodes.slice(0,n),r=this.nodes.slice(n+1);e&&s.push(t.cloneWithText(e)),i&&r.unshift(t.cloneWithText(i)),this.apply(new W(s));const h=this.cloneWithNodes(r);return this.parent.apply(new P(this,h)),h}}}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){const e=this.nodes[this.nodes.length-1];return t===e&&(t.isEmpty()||s===e.text.length)}lineBreakSingleBlock(t,s){if(t){const e=new x(L(),"\n",this),i=t.text.slice(0,s),n=t.text.slice(s),r=this.nodes.indexOf(t);if(r>-1){const s=this.nodes.slice(0,r),h=this.nodes.slice(r+1);i&&s.push(t.cloneWithText(i)),n&&h.unshift(t.cloneWithText(n)),this.mergeLineBreakNodes(s,e,h)}return e}}lineBreakMultipleBlocks(t){const s=this.nodes,e=new x(L(),"\n",this),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,e,i),e}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;if(0!==e&&!s.isEmpty()){const i=s.text.slice(0,e-1)+s.text.slice(e);if(s.apply(new O(i)),i)return void(t.previousNode=s);{const e=this.getPreviousNode(s);return e&&e.parentBlock===this&&"\n"===e.text||1===this.nodes.length?void(t.previousNode=s):(this.apply(new I(s)),void(t.previousNode=e))}}{let e=this.getPreviousNode(s),i=null;if(this.nodes.length&&e&&e.parentBlock!==this)s.isEmpty()&&this.apply(new I(s)),e.parentBlock.apply(new V(this));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&this.apply(new I(s)),e instanceof x&&e.isEmpty()){const t=e;e=this.getPreviousNode(e),t.parentBlock.apply(new I(t)),e||(i=s)}0===this.nodes.length&&this.parent.apply(new I(this)),e?t.previousNode=e:i&&(t.nextNode=i)}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new I(this))}mergeLineBreakNodes(t,s,e){(0===e.length||e[0]&&""===e[0].text)&&e.push(new x(L(),"\n",this,t[t.length-1]&&t[t.length-1].annotationMap)),this.apply(new W([...t,s,...e]))}getBlockTagByType(t){switch(t){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"paragraph":return"p";case"list-item":return"li"}}breakSingleTextBlock(t,s){const e=this.copyInlineStyleToNewParagraph(t);if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new P(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}this.parent.apply(new D(this,e))}return e}convertParagraphToList(t){const s=this.parent.createList(t.listType),e=t.selectedBlocks.map((t=>this.parent.toListItem(t)));s.apply(new M(e)),this.parent.apply(new P(t.selectedBlocks[0],s)),t.selectedBlocks.forEach((t=>{t.parent.apply(new I(t))}))}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtEnd(s,e))this.parent.apply(new P(this,i));else if(this.isCaretPositionAtStart(s,e))this.parent.apply(new D(this,i));else{const t=new F(s,e);this.apply(t),this.parent.apply(new P(this,i))}}copyInlineStyleToNewParagraph(t){const s=t.cloneWithText("");s.annotationMap.delete(l.LINK);const e=new G(L(),"paragraph");return e.apply(new M([s])),e}}class $ extends H{constructor(t){super(t),this.type="image",this.nodes=[]}static from(t){const s=new $(t.id),{annotations:e}=t;return s.nodes=t.nodes.map((t=>J.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static fromHTML(t){const s="IMG"===t.nodeName?[t]:Array.from(t.children),i=new $(L());return i.nodes=s.map((t=>J.fromHTML(t,i))),Object.keys(e).forEach((s=>{const e=this.createAnnotationEntityFromHTML(s,t);b(e)&&i.annotationMap.set(...e)})),i}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.nodes.map((t=>t.toJSON()))})}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>t.url.length>0))}getLastNode(){return this.nodes[this.nodes.length-1]}render(s){return t("div",{style:Object.assign({},this.getStyles()),ref:this.registerRef.bind(this),class:super.getClasses()},this.nodes.map((t=>t.render(s))))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildNode(t);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case o.INSERT_NODES_AFTER:this.replaceNodeWithNodes(t.referNode,[t.referNode,...t.nodesToBeInserted]);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}registerRef(t){t&&c.register(t,this)}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new I(this))}splitImageNodes(t,s){const e=this.nodes.indexOf(t);if(e>-1){const t=this.nodes.slice(0,e+s),i=this.nodes.slice(e+s);this.apply(new W(t));const n=this.cloneWithNodes(i);return this.parent.apply(new P(this,n)),n}}cloneWithNodes(t){const s=new $(L());return s.nodes=[],s.apply(new M(t)),s}breakSingleBlock(t,s){const e=G.from({id:L(),type:"paragraph",nodes:[{id:L(),type:"text",text:""}]});if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new P(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}this.parent.apply(new D(this,e))}return e}lineBreakSingleBlock(t,s){const e=this.breakSingleBlock(t,s);if(e)return e.nodes[0]}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){return t===this.nodes[this.nodes.length-1]&&1===s}lineBreakMultipleBlocks(t){const s=G.from({id:L(),type:"paragraph",nodes:[{id:L(),type:"text",text:"\n"}]});this.parent.apply(new P(this,s));const e=this.concatBlocksNodes(t.slice(1));return(0===e.length||e[0]&&""===e[0].text)&&e.push(new x(L(),"\n",s)),s.apply(new M(e)),s.nodes[0]}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;let i=this.getPreviousNode(s),n=null;if(1===e){const t=s.parentBlock;this.isContentFirstNode(s)&&(n=this.getNextNode(s)),1===t.nodes.length?t.parent.apply(new I(t)):s.parentBlock.apply(new I(s))}else{const e=i;e&&e instanceof J&&(i=this.getPreviousNode(e),e.parentBlock.apply(new I(e)),i||(t.nextNode=s))}i?t.previousNode=i:n&&(t.nextNode=n)}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;this.nodes.length<1?this.apply(new M(t.imageBlockToBeInserted.nodes)):this.isCaretPositionAtEnd(s,e)?this.parent.apply(new P(this,i)):this.isCaretPositionAtStart(s,e)?this.parent.apply(new D(this,i)):(this.apply(new F(s,e)),this.parent.apply(new P(this,i)))}}class X extends G{constructor(t,s){super(t,"list-item"),this.children=[],this.children=s}static from(t){const s=new X(t.id);s.nodes=t.nodes.map((t=>x.from(t,s))),t.children&&(s.children=t.children.map((t=>{const e=Z.from(t);return e.parent=s,e})));const{annotations:e}=t;return e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static fromHTML(t){const s=new X(L());return s.nodes=Array.from(t.childNodes).map((t=>{if(!["UL","OL"].includes(t.nodeName))return x.fromHTML(t,s)})).filter(Boolean),s.children=Array.from(t.childNodes).map((t=>{if(["UL","OL"].includes(t.nodeName)){const e=Z.fromHTML(t);return e&&(e.parent=s),e}})).filter(Boolean),Object.keys(e).forEach((e=>{const i=this.createAnnotationEntityFromHTML(e,t);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.children)||void 0===t?void 0:t.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new X(L());return s.nodes=[],s.apply(new M(t)),s}isNotEmpty(){return this.children?super.isNotEmpty()||this.children.some((t=>t.isNotEmpty())):super.isNotEmpty()}getLastNode(){return this.children&&this.children.length>0?this.children[this.children.length-1].getLastNode():super.getLastNode()}render(t){return super.render(t,this.renderChildren(t))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeListChildNode(t);break;case o.DELETE_NEST_LIST:this.removeNestList(t);break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.SPLIT_BLOCK_WITH_NODE:this.splitListItemBlock(t);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.REPLACE_NEST_LIST:this.replaceNestList(t.newList);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.DELETE_BLOCK_CONTENT:this.deleteListNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.parent.apply(t);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}renderChildren(t){var s;return null===(s=this.children)||void 0===s?void 0:s.map((s=>s.render(t)))}removeListChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0!==this.nodes.length||this.children&&this.children.length||this.parent.apply(new I(this))}removeNestList(t){this.children&&(this.children=this.children.length>1?this.children.filter((s=>s!==t.nestListBlockToBeRemoved)):void 0)}replaceNestList(t){t.forEach((t=>{t.parent=this})),this.children=t}splitListItemBlock(t){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode)}breakSingleListItemBlock(t,s){const e=new X(L()),i=this.copyInlineStyleToNewNode(t);if(e.apply(new M([i])),this.isCaretPositionAtEnd(t,s))return this.breakListItemAtEnd(e);if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}return this.parent.apply(new D(this,e)),e}breakListItemAtEnd(t){const s=this.parent.blocks[this.parent.blocks.length-1],e=1===this.nodes.length&&this.nodes[0].isEmpty();if(this===s&&e){const s=this.parent.parent;if("list-item"!==s.type){const e=G.from({id:L(),type:"paragraph",nodes:[]});return e.apply(new M(t.nodes)),s.apply(new P(this.parent,e)),this.parent.apply(new I(this)),e}s.parent.apply(new P(s,t)),this.parent.apply(new I(this))}else this.parent.apply(new P(this,t));return t}deleteListNodeContent(t){const s=t.startContainerNode.parentBlock.parent;this.deleteNodeContent(t),0===s.blocks.length&&s.parent.apply(new I(s))}copyInlineStyleToNewNode(t){const s=t.cloneWithText("");return s.annotationMap.delete(l.LINK),s}}class Y extends a{constructor(t){super(),this.type=o.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class Z extends H{constructor(t,s){super(t),this.type="bullet-list",this.blocks=[],this.type=s}static from(t){const s=new Z(t.id,t.type);return s.blocks=t.blocks.map((t=>{const e=X.from(t);return e.parent=s,e})),s}static fromHTML(t){const s=new Z(L(),"UL"===t.nodeName?"bullet-list":"number-list");return s.blocks=Array.from(t.children).map((t=>{const e=X.fromHTML(t);return e&&(e.parent=s),e})).filter(Boolean),Object.keys(e).forEach((e=>{const i=this.createAnnotationEntityFromHTML(e,t);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.blocks.map((t=>t.toJSON()))})}isNotEmpty(){return this.blocks.length>0&&this.blocks.some((t=>t.isNotEmpty()))}getLastNode(){return this.blocks[this.blocks.length-1].getLastNode()}render(s){return t("number-list"===this.type?"ol":"ul",{ref:this.registerRef.bind(this)},this.blocks.map((t=>t.render(s))))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeListItemBlock(t.entityToBeRemoved);break;case o.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case o.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock]);break;case o.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case o.TRANSFORM_LIST_BLOCK:this.convertToList(t);break;case o.TRANSFORM_PARAGRAPH_BLOCK:this.convertToParagraph(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t)}}toParagraph(t){const s=new G(L(),"paragraph");return s.apply(new M(t.nodes)),s.annotationMap=t.annotationMap,s}registerRef(t){t&&c.register(t,this)}convertToList(t){const s=t.selectedBlocks,e=this.parent.createList(t.listType);if(s.every((t=>t.parent===this)))e.apply(new M(this.blocks)),this.parent.apply(new P(this,e)),this.parent.apply(new I(this)),s.forEach((t=>t.nodes.map((t=>t.apply(new v)))));else{const s=t.selectedBlocks.map((t=>this.parent.toListItem(t)));e.apply(new M(s)),this.parent.apply(new P(this,e)),t.selectedBlocks.forEach((t=>{t.parent.apply(new I(t))})),0===this.blocks.length&&this.parent.apply(new I(this))}}convertToParagraph(t){let s=!1,e=!1;const i=t.selectedBlocks,n=i.map((t=>(t.nodes.map((t=>t.apply(new v))),t===this.blocks[0]&&(s=!0),t===this.blocks[this.blocks.length-1]&&(e=!0),this.toParagraph(t))));if(s)this.parent.apply(new D(this,...n));else if(e)this.parent.apply(new P(this,...n));else{const t=this.blocks.indexOf(i[0]),s=this.blocks.indexOf(i[i.length-1]),e=this.parent.createList(this.type);e.apply(new M(this.blocks.slice(0,t)));const r=this.parent.createList(this.type);r.apply(new M(this.blocks.slice(s+1))),this.parent.apply(new D(this,e,...n,r)),this.parent.apply(new I(this))}i.map((t=>{this.apply(new I(t))})),0===this.blocks.length&&this.parent.apply(new I(this))}insertImage(t){this.parent.apply("list-item"!==this.parent.type?new P(this,t.imageBlockToBeInserted):t)}removeListItemBlock(t){super.removeChildBlock(t),0===this.blocks.length&&this.parent&&this.parent.apply(this.parent instanceof X?new Y(this):new I(this))}}class _ extends T{constructor(t){super(),t.forEach((t=>{t.parent=this})),this.blocks=t}static fromJSON(t){const s=t.map((t=>{switch(t.type){case"paragraph":case"title":case"subtitle":case"heading-1":case"heading-2":case"heading-3":return G.from(t);case"image":return $.from(t);case"bullet-list":case"number-list":return Z.from(t);default:throw new Error(`[Vega] Unknown block type: ${t.type}`)}}));return new _(s)}static createEmptyContent(){return _.fromJSON([{id:L(),type:"paragraph",nodes:[{id:L(),type:"text",text:""}]}])}clone(){return new _([...this.blocks])}toJSON(){return this.blocks.map((t=>t.toJSON()))}apply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildBlock(t.entityToBeRemoved);break;case o.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case o.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case o.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock])}}toListItem(t){t.nodes.map((t=>t.apply(new v)));const s=new X(L());return s.apply(new M(t.nodes)),s.annotationMap=t.annotationMap,s}createList(t){return new Z(L(),t)}}export{M as A,U as B,B as H,S as I,V as M,G as R,F as S,R as T,_ as V,C as a,J as b,X as c,I as d,D as e,W as f,$ as g,Z as h,P as i,z as j}