@heartlandone/vega 2.73.0 → 2.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-cc162173.js → app-globals-e9f2edcf.js} +5 -5
- package/dist/cjs/{code-block-823cd481.js → code-block-c8ae7e0a.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-e2e0c6f3.js → component-value-history-controller-slimmer.abstract-13968181.js} +2 -2
- package/dist/cjs/{design-token-11656685.js → design-token-4e23c50a.js} +1 -1
- package/dist/cjs/{dto-renderer-manager-bd2bd447.js → dto-renderer-manager-ca753971.js} +19 -3
- package/dist/cjs/{element-appender-slimmer-12f40b8b.js → element-appender-slimmer-dc769946.js} +2 -2
- package/dist/cjs/{function-extension-78ec27e0.js → function-extension-5972c73c.js} +2 -2
- package/dist/cjs/{image-annotation-action-7408a4b3.js → image-annotation-action-92df8979.js} +2 -2
- package/dist/cjs/index.cjs.js +8 -8
- package/dist/cjs/{language-extension-716015a5.js → language-extension-d78389f9.js} +2 -2
- package/dist/cjs/loader.cjs.js +6 -6
- package/dist/cjs/{public-rules-2950f1fc.js → public-rules-23a86d33.js} +3 -3
- package/dist/cjs/{range-c3c48132.js → range-80f19554.js} +1 -1
- package/dist/cjs/{responsive-format-facade-96c5f598.js → responsive-format-facade-8d195366.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-4aab05a3.js → rich-text-editor-required-rule-80304585.js} +1 -1
- package/dist/cjs/{style-formatter-9c42d41b.js → style-formatter-dbda894b.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +5 -5
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +4 -4
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +4 -4
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-dialog_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +18 -8
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +175 -47
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +5 -5
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +19 -9
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -4
- package/dist/cjs/vega-signature-capture.cjs.entry.js +5 -5
- package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +5 -5
- package/dist/cjs/vega.cjs.js +6 -6
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.js +6 -3
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +31 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-item-controller.js +89 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.js +4 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.js +4 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +33 -13
- package/dist/collection/components/vega-input-select/vega-input-select.js +27 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +18 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/extension-controller.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +6 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +5 -0
- package/dist/esm/{app-globals-949d2e18.js → app-globals-9203a3e5.js} +5 -5
- package/dist/esm/{code-block-666674d7.js → code-block-4e0d321d.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-171dda08.js → component-value-history-controller-slimmer.abstract-0ab0d9f0.js} +2 -2
- package/dist/esm/{design-token-9b510e59.js → design-token-175c4c0c.js} +1 -1
- package/dist/esm/{dto-renderer-manager-49ae5d56.js → dto-renderer-manager-402e89d0.js} +19 -3
- package/dist/esm/{element-appender-slimmer-b9890dcb.js → element-appender-slimmer-7e7aa230.js} +2 -2
- package/dist/esm/{function-extension-8b06c6f8.js → function-extension-45e413ff.js} +2 -2
- package/dist/esm/{image-annotation-action-b3eea6a2.js → image-annotation-action-2cdbbd57.js} +2 -2
- package/dist/esm/index.js +8 -8
- package/dist/esm/{language-extension-b3f836d4.js → language-extension-4bed2436.js} +2 -2
- package/dist/esm/loader.js +6 -6
- package/dist/esm/{public-rules-b164e40e.js → public-rules-05e83e40.js} +3 -3
- package/dist/esm/{range-9cc1422b.js → range-5086f250.js} +1 -1
- package/dist/esm/{responsive-format-facade-94897ae8.js → responsive-format-facade-f995d6de.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-2131f21c.js → rich-text-editor-required-rule-0d1147a8.js} +1 -1
- package/dist/esm/{style-formatter-bb5aec96.js → style-formatter-f4067407.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +5 -5
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +4 -4
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +4 -4
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +5 -5
- package/dist/esm/vega-dialog_2.entry.js +5 -5
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +18 -8
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +4 -4
- package/dist/esm/vega-input-phone-number.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +175 -47
- package/dist/esm/vega-left-nav_5.entry.js +5 -5
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -4
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +6 -6
- package/dist/esm/vega-progress-tracker_2.entry.js +4 -4
- package/dist/esm/vega-rich-text-content.entry.js +3 -3
- package/dist/esm/vega-rich-text-editor_4.entry.js +19 -9
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +4 -4
- package/dist/esm/vega-signature-capture.entry.js +5 -5
- package/dist/esm/vega-table_11.entry.js +4 -4
- package/dist/esm/vega-time-picker_2.entry.js +5 -5
- package/dist/esm/vega-tooltip_2.entry.js +5 -5
- package/dist/esm/vega.js +6 -6
- package/dist/sri/vega-sri-manifest.json +179 -179
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.d.ts +1 -0
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +7 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-item-controller.d.ts +29 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +1 -1
- package/dist/types/components/vega-input-select/types.d.ts +5 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +12 -4
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +8 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components.d.ts +17 -5
- package/dist/types/types/components.type.d.ts +1 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-38ed3d59.entry.js → p-05feab84.entry.js} +1 -1
- package/dist/vega/{p-adc615a4.entry.js → p-071f9d00.entry.js} +1 -1
- package/dist/vega/{p-f3831dc9.entry.js → p-0f601e59.entry.js} +1 -1
- package/dist/vega/{p-40561fa0.entry.js → p-1a7e97d2.entry.js} +1 -1
- package/dist/vega/{p-76e6c13a.js → p-29618be2.js} +1 -1
- package/dist/vega/{p-c0036e71.js → p-301096ee.js} +1 -1
- package/dist/vega/{p-d01fe83d.entry.js → p-310a6294.entry.js} +1 -1
- package/dist/vega/{p-8fba7f9a.js → p-3226c208.js} +1 -1
- package/dist/vega/{p-03e16a05.entry.js → p-3398f553.entry.js} +1 -1
- package/dist/vega/{p-42a283b5.entry.js → p-370ee9e3.entry.js} +1 -1
- package/dist/vega/{p-70b2906a.entry.js → p-38b8efe5.entry.js} +1 -1
- package/dist/vega/{p-2e0deef6.js → p-3a279b71.js} +1 -1
- package/dist/vega/{p-623c3911.entry.js → p-3b32e75d.entry.js} +1 -1
- package/dist/vega/{p-0ba0f83d.entry.js → p-3ebc8b5b.entry.js} +1 -1
- package/dist/vega/{p-21e7808a.entry.js → p-3f56d184.entry.js} +1 -1
- package/dist/vega/{p-1e019406.js → p-42b7b5df.js} +1 -1
- package/dist/vega/p-451ddd84.js +1 -0
- package/dist/vega/{p-c2ac6b47.entry.js → p-5a0c92db.entry.js} +1 -1
- package/dist/vega/{p-0ad59141.entry.js → p-5c492358.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-e88f2dc3.js → p-674fe99e.js} +1 -1
- package/dist/vega/{p-dd72ad9e.js → p-73383099.js} +1 -1
- package/dist/vega/{p-9dfe2bbc.js → p-748eb5a2.js} +1 -1
- package/dist/vega/p-779cd090.entry.js +1 -0
- package/dist/vega/{p-3938880f.entry.js → p-7c238c19.entry.js} +1 -1
- package/dist/vega/{p-a3c4fa30.entry.js → p-950bf9a9.entry.js} +1 -1
- package/dist/vega/{p-5f09868d.entry.js → p-95b11cdd.entry.js} +1 -1
- package/dist/vega/{p-7be3aefc.entry.js → p-99676172.entry.js} +1 -1
- package/dist/vega/{p-a125cfec.entry.js → p-9b7daab0.entry.js} +1 -1
- package/dist/vega/{p-74a77cad.js → p-9ea8eb49.js} +1 -1
- package/dist/vega/{p-2971b17a.js → p-a2d1c2f3.js} +1 -1
- package/dist/vega/p-a6dfef41.entry.js +1 -0
- package/dist/vega/{p-6e701542.entry.js → p-a7f151fe.entry.js} +1 -1
- package/dist/vega/p-b0ed81e2.js +1 -0
- package/dist/vega/{p-75d91ee9.entry.js → p-b18c12cb.entry.js} +1 -1
- package/dist/vega/{p-e39aa2ea.entry.js → p-b19d4e26.entry.js} +1 -1
- package/dist/vega/{p-524ffc12.entry.js → p-b4be03bb.entry.js} +1 -1
- package/dist/vega/{p-721b2981.entry.js → p-ba223773.entry.js} +1 -1
- package/dist/vega/{p-db62b038.entry.js → p-bb9db84a.entry.js} +1 -1
- package/dist/vega/{p-1faef917.entry.js → p-c34feecd.entry.js} +1 -1
- package/dist/vega/{p-7b337fd4.entry.js → p-c796307d.entry.js} +1 -1
- package/dist/vega/p-ca9b4af9.entry.js +1 -0
- package/dist/vega/{p-f427d88c.entry.js → p-cadd84ec.entry.js} +1 -1
- package/dist/vega/{p-bf61d136.js → p-e3fa091a.js} +1 -1
- package/dist/vega/{p-114c6df8.entry.js → p-edbecf19.entry.js} +1 -1
- package/dist/vega/{p-7f86b3c8.js → p-f0bde406.js} +1 -1
- package/dist/vega/{p-2b20a215.entry.js → p-f844f3f1.entry.js} +1 -1
- package/dist/vega/{p-2bc4f7d9.entry.js → p-f92752d2.entry.js} +1 -1
- package/dist/vega/{p-bd60c72e.entry.js → p-fbda4a20.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-21cba83b.entry.js +0 -1
- package/dist/vega/p-2f592078.entry.js +0 -1
- package/dist/vega/p-79a544d6.js +0 -1
- package/dist/vega/p-aab0deab.js +0 -1
- package/dist/vega/p-b406a846.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as t,H as e,F as i,r as o,c as s,g as n}from"./p-6b2342e0.js";import{c as r,M as c,V as l,I as a}from"./p-6e1ab235.js";import{V as h,I as d}from"./p-d849e0f5.js";import{s as u}from"./p-519a7d55.js";import{c as f}from"./p-86194314.js";import{C as p}from"./p-2d0d575f.js";import{d as v,D as m,V as b,g,X as x,a as w,T as C,U as y}from"./p-8bd496b4.js";import{V as R,b as j,G as k,H as S,I as O,y as H}from"./p-5b71c85e.js";import{R as T,f as z,c as L,V as E,M as B,I,S as M,i as A,d as D}from"./p-451ddd84.js";import{i as F}from"./p-161b9c5b.js";import{a as V}from"./p-8c9ea6f4.js";import{b as P,a1 as N,y as W,a2 as U,a3 as $,e as _,T as K,a4 as q,a5 as G,u as J,a6 as Z,a7 as X,a8 as Y,_ as Q,W as tt,a9 as et,M as it,c as ot,a0 as st,A as nt,H as rt,s as ct,h as lt,Z as at,U as ht,j as dt,J as ut,r as ft,G as pt,x as vt,I as mt,V as bt}from"./p-e3fa091a.js";import{V as gt,I as xt,T as wt,b as Ct,a as yt}from"./p-674fe99e.js";import{g as Rt}from"./p-a4670e23.js";import{a as jt}from"./p-ce2ffff7.js";import{F as kt}from"./p-30e7544c.js";import{c as St}from"./p-f2c8c363.js";import{c as Ot}from"./p-5be29f14.js";import{R as Ht,C as Tt,A as zt,a as Lt}from"./p-3a279b71.js";import{F as Et,D as Bt}from"./p-a528714c.js";import{O as It}from"./p-331a62d5.js";import{d as Mt}from"./p-1bc5b3bc.js";import{D as At}from"./p-a5713178.js";import{R as Dt}from"./p-9ea8eb49.js";import{C as Ft}from"./p-184d8443.js";import{T as Vt}from"./p-75f981ce.js";import{V as Pt}from"./p-ef9cbad1.js";import{i as Nt}from"./p-d27ae9ff.js";import{c as Wt}from"./p-613ddaab.js";import{t as Ut}from"./p-aacf6920.js";import{f as $t}from"./p-d9671d27.js";import{r as _t}from"./p-77e64f26.js";import"./p-02841589.js";import"./p-bf19682d.js";import"./p-ed45b3b6.js";import"./p-40f39194.js";import"./p-d884c644.js";import"./p-f69f84a7.js";import"./p-6a334573.js";import"./p-5d676a94.js";import"./p-10ac8b57.js";import"./p-b75ee3ba.js";import"./p-abd7aeaa.js";import"./p-78a57a17.js";import"./p-52b8f2d2.js";import"./p-59fa3f68.js";import"./p-697eb0e1.js";import"./p-3226c208.js";import"./p-1fb56e14.js";import"./p-a8dad05d.js";import"./p-207cfa6a.js";import"./p-5f377954.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";import"./p-112455b1.js";import"./p-4866e390.js";import"./p-262ec334.js";class Kt{constructor(){this.format=(t,e={})=>{const{tabWidth:i=4,useTabs:o=!0}=e,s=(o?"\t":" ").repeat(i),n=t.split(/(<\/?[^>]+>)/g).filter((t=>t.length>0));let r=0,c="";for(let t=0;t<n.length;t++){let e=n[t];e.startsWith("</")&&(r=Math.max(0,r-1));const i=s.repeat(r);if(e.startsWith("<")){e=e.replace(/style\s*=\s*"([^"]*)"/g,((t,e)=>`style="${this.formatStyle(e)}"`));const o=Kt.getTagName(e);if(Kt.INLINE_TAGS.has(o)&&t+2<n.length&&n[t+2]===`</${o}>`){let o=`${e}${n[t+1]}${n[t+2]}`;for(t+=2;t+2<n.length&&n[t+1].startsWith("<")&&Kt.INLINE_TAGS.has(Kt.getTagName(n[t+1]))&&n[t+3]===`</${Kt.getTagName(n[t+1])}>`;)o+=`${n[t+1]}${n[t+2]}${n[t+3]}`,t+=3;c+=`${i}${o}\n`}else c+=`${i}${e}\n`,e.startsWith("</")||e.endsWith("/>")||/^<br|^<img|^<meta|^<input|^<hr/i.test(e)||r++}else{const t=e;t.length>0&&(c+=`${s.repeat(r)}${t}\n`)}}return c.trim()}}static getTagName(t){var e;const i=t.match(/^<\/?([a-z0-9]+)/i);return null!==(e=null==i?void 0:i[1].toLowerCase())&&void 0!==e?e:""}formatStyle(t){return t.split(";").map((t=>t.trim())).filter(Boolean).join("; ")}}Kt.INLINE_TAGS=new Set(["span","strong","em","a","b","i","u","small","abbr","code","b","u","s","mark","time","del","ins"]);const qt=new Kt;var Gt=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Jt extends l{constructor(){super(...arguments),this.renderHintMessage=()=>t("vega-text",null,this.hint),this.renderTextContent=()=>t("div",{class:{"rich-text-editor-container":!0,disabled:this.disabled,"vega-hidden":this.sourceView},style:{minHeight:24*this.rows+"px"},onClick:this.richTextContentFocus,role:"textbox",tabIndex:this.disabled?0:-1,onKeyDown:f(),ref:t=>this.richTextContainerRef=t},t("vega-rich-text-content",{ref:t=>this.richTextContentRef=t,content:this.value,extensions:this.extensions}),this.renderCharacterCounter()),this.renderCharacterCounter=()=>t("div",{class:{"text-editor-counter":!0,"counter-exceed-max-length":!1},style:{display:"none"}},t("span",null,"0"),t("span",null,"/100")),this.renderErrorMessage=()=>t("div",{class:"vega-error vega-hidden"}),this.richTextContentFocus=()=>{this.richTextContentRef.vegaFocus()},this.renderSourceViewContent=()=>{if(!this.allowSourceEdit)return;const e=this.sourceView?qt.format(this.value.toHtml()):"";return t("div",{class:{"source-view-container":!0,"vega-hidden":!this.sourceView}},t("vega-code-block",{ref:t=>this.sourceCodeBlockRef=t,disabled:this.disabled,value:{language:"html",code:e}}))}}componentDidRender(){p.notify(v.getSubject(this.host,R),{})}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")}getSourceCode(){if(this.sourceCodeBlockRef)return this.sourceCodeBlockRef.value.code}render(){return t(e,null,this.renderRichTextEditor())}renderRichTextEditor(){return t("vega-flex",{direction:"col",gap:"0",ref:t=>this.richTextWrapperRef=t},this.renderLabel(),this.hint&&this.renderHintMessage(),this.toolbarRenderer.render(),this.renderContent(),this.renderErrorMessage())}renderLabel(){return this.label&&t("vega-field-label",{onClick:this.richTextContentFocus,isFieldRequired:this.required,disabled:this.disabled,label:this.label})}renderContent(){return t(i,null,this.renderTextContent(),this.renderSourceViewContent())}}Gt([r()],Jt.prototype,"host",void 0),Gt([r()],Jt.prototype,"toolbarRenderer",void 0),Gt([r()],Jt.prototype,"label",void 0),Gt([r()],Jt.prototype,"required",void 0),Gt([r()],Jt.prototype,"hint",void 0),Gt([r()],Jt.prototype,"disabled",void 0),Gt([r()],Jt.prototype,"rows",void 0),Gt([r()],Jt.prototype,"placeholder",void 0),Gt([r()],Jt.prototype,"value",void 0),Gt([r()],Jt.prototype,"sourceView",void 0),Gt([r()],Jt.prototype,"toolbarItems",void 0),Gt([r()],Jt.prototype,"sourceEditConfig",void 0),Gt([r()],Jt.prototype,"allowSourceEdit",void 0),Gt([r()],Jt.prototype,"extensions",void 0),Gt([c("componentDidRender")],Jt.prototype,"componentDidRender",null);var Zt=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Xt extends l{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;case"codeBlock":return this.codeBlockToolbarButtonSlimmer}}}render(){const[e,o]=this.renderToolbarItems();return t("vega-flex",{gap:"size-8",alignItems:"center",flexWrap:"wrap"},this.allowSourceEdit&&t(i,null,t("div",{class:"toolbar-btn-group"},this.sourceEditToolbarButtonSlimmer.render()),this.toolbarItems.length>0&&o>0&&this.renderVegaDivider()),e)}renderVegaDivider(){return t("vega-box",{height:"size-32"},t("vega-divider",{direction:"vertical"}))}renderToolbarItems(){let e=0;return[this.toolbarItems.map((i=>{let o=0;const s=i.map((i=>{const s=this.getToolbarBtnRenderer(i),n=T.getRTEToolbarButtonRenderer(i);if(s)return s.isHidden()||(e++,o++),s.render();if(n){const i={sourceEditMode:this.sourceView,host:this.host,rteRange:this.selectionController.getCurrentRange()};return n.isHidden(i)||(e++,o++),n.render(t,i)}return null})).filter(F);return t("div",{class:{"toolbar-btn-group":!0,"vega-hidden":o<1}},s)})),e]}}Zt([r()],Xt.prototype,"toolbarItems",void 0),Zt([r()],Xt.prototype,"allowSourceEdit",void 0),Zt([r()],Xt.prototype,"host",void 0),Zt([r()],Xt.prototype,"clearStyleToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"boldToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"textStylesToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"italicToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"underlineToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"textColorToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"strikethroughToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"imageToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"moreIndentToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"lessIndentToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"codeToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"linkToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"codeBlockToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"sourceEditToolbarButtonSlimmer",void 0),Zt([r()],Xt.prototype,"selectionController",void 0),Zt([r()],Xt.prototype,"sourceView",void 0);class Yt extends gt{constructor(){super({icon:"bold",tooltip:{text:"Bold"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((e=>e.apply(new N(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof P));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(W.BOLD))||void 0===e?void 0:e.bold}))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return(null===(e=t.getAnnotationByType(W.CODE))||void 0===e?void 0:e.code)||this.shouldDisabledToolbar(t,N.name)}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],Yt.prototype,"selectionController",void 0);class Qt extends gt{constructor(){super({icon:"italic",tooltip:{text:"Italic"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof P));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(W.ITALIC))||void 0===e?void 0:e.italic}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((e=>e.apply(new U(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return(null===(e=t.getAnnotationByType(W.CODE))||void 0===e?void 0:e.code)||this.shouldDisabledToolbar(t,U.name)}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],Qt.prototype,"selectionController",void 0);class te extends gt{constructor(){super({icon:"underline",tooltip:{text:"Underline"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof P));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(W.UNDERLINE))||void 0===e?void 0:e.underline}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((e=>e.apply(new $(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return(null===(e=t.getAnnotationByType(W.CODE))||void 0===e?void 0:e.code)||this.shouldDisabledToolbar(t,$.name)}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],te.prototype,"selectionController",void 0);var ee=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ie extends gt{constructor(){super({icon:"text-size",tooltip:{text:"Text Styles"}}),this.handleDropdownItemClick=t=>{const e=t.detail,i=ie.items.find((t=>t.key===e)).bold,o=this.selectionController.getSelectedBlocks().filter((t=>t instanceof _));o.length>0?o.forEach((t=>{t.apply(new K(e,i))})):this.focusController.focusOnLastTextNode({newLine:!0}).then((()=>{this.selectionController.getSelectedBlocks().filter((t=>t instanceof _)).forEach((t=>{t.apply(new K(e,i))}))}))}}renderBtnWrapper(e){return t("vega-dropdown",{selectType:"single",trigger:"click",alignment:"center",selectedSourceKey:this.getSelectedSourceKey(),ref:t=>{this.addDropdownObserver(t)}},e({showArrowIcon:!0}),t("div",Object.assign({slot:"items"},super.preventLostFocus()),this.renderDropdownContent()))}renderDropdownContent(){return t(i,null,ie.items.map((e=>{const i=new q(e.key),o=new G(e.bold);return t("vega-dropdown-item",{key:e.key,itemKey:e.key},t("vega-box",{padding:{right:"size-20"}},t("div",{style:Object.assign(Object.assign({},i.renderStyle({standalone:!0})),o.renderStyle({standalone:!0}))},this.translationSlimmer.t(e.label))))})))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks();return super.isDisabled()||t.some((t=>this.shouldDisabledToolbar(t,K.name)))}addDropdownObserver(t){m.addUniqueObserverToNode(t,b,this.handleDropdownItemClick)}getSelectedSourceKey(){var t;const e=this.selectionController.getSelectedBlocks().filter((t=>t instanceof _));if(e.length>0&&e.every((t=>t.type===e[0].type))){const i=e[0].getAnnotationByType(J.TEXT_STYLE);return null!==(t=null==i?void 0:i.textStyle)&&void 0!==t?t:""}return""}}V.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>'}}),ie.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"}],ee([r()],ie.prototype,"selectionController",void 0),ee([r()],ie.prototype,"focusController",void 0);class oe extends gt{constructor(){super({icon:"text-slash",tooltip:{text:"Clear Style"}})}isSelected(){return!1}onClick(){this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((t=>{t.apply(new Z)}))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>this.shouldDisabledToolbar(t,Z.name)))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],oe.prototype,"selectionController",void 0);class se extends gt{constructor(){super({icon:"code-simple",tooltip:{text:"Code"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((e=>e.apply(new X(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes();return t.length>0&&t.filter((t=>t instanceof P)).map((t=>t.getAnnotationByType(W.CODE))).every((t=>t&&t.code))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t.getAnnotationByType(W.LINK)||this.shouldDisabledToolbar(t,X.name)))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],se.prototype,"selectionController",void 0);class ne extends gt{constructor(){super({icon:"strikethrough",tooltip:{text:"Strikethrough"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof P));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(W.STRIKETHROUGH))||void 0===e?void 0:e.strikethrough}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof P)).forEach((e=>e.apply(new Y(!t))))}isDisabled(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>{var e;return(null===(e=t.getAnnotationByType(W.CODE))||void 0===e?void 0:e.code)||this.shouldDisabledToolbar(t,Y.name)}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ne.prototype,"selectionController",void 0);class re extends gt{constructor(){super({icon:"link",tooltip:{text:"Link"}}),this.handleLinkEditorChange=({detail:t})=>{switch(t.action){case"link":{const{url:e,text:i}=t.payload,o=i!==this.currentSelectedText,s=Rt();return void this.currentSelectedNodes.forEach((t=>{t.apply(new Q(this.currentRange)).apply(new tt({link:{href:e,groupKey:s},newText:o?i:void 0,needMergeNode:o&&this.currentSelectedNodes.length>1,type:"link"}))}))}}}}renderBtnWrapper(e){return t("div",{class:"toolbar-btn-link-wrapper",ref:t=>this.linkBtnWrapperRef=t},e(),t("vega-rich-text-link-editor",{resetStatusAfterHide:!1,status:"linkEdit",ref:t=>{t&&(this.linkEditorRef=t),m.addUniqueObserverToNode(t,g,this.handleLinkEditorChange)}}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getSelectedBlocks();return super.isDisabled()||e.length>1||t.some((t=>{var e;return this.shouldDisabledToolbar(t,tt.name)||t.getAnnotationByType(W.LINK)||(null===(e=t.getAnnotationByType(W.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,jt(this.linkEditorRef).then((()=>{this.linkEditorRef.show()})))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],re.prototype,"selectionController",void 0);class ce extends gt{constructor(){super({icon:"indent",tooltip:{text:"More Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks();return super.isDisabled()||t.some((t=>this.shouldDisabledToolbar(t,et.name)))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const o=null!==(i=null===(e=t.getAnnotationByType(J.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new et(o+1))}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],ce.prototype,"selectionController",void 0);class le extends gt{constructor(){super({icon:"outdent",tooltip:{text:"Less Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks();return super.isDisabled()||t.some((t=>this.shouldDisabledToolbar(t,et.name)))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const o=null!==(i=null===(e=t.getAnnotationByType(J.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new et(o>1?o-1:0))}))}}V.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,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);n>3&&r&&Object.defineProperty(e,i,r)}([r()],le.prototype,"selectionController",void 0);class ae extends it{constructor(t){super(),this.type=ot.UPDATE_IMAGE_NODE_URL,this.url=t}}var he=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class de extends gt{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.apply(new ae(t))}));const o={file:e.files[0],sendBackUploadedURLCallback:this.updateNodeURLMap.get(i)};this.imageInsertedEventEmitter.emit(o),e.value=""}}renderBtnWrapper(e){return t("vega-box",null,e({showArrowIcon:!1}),t("input",{type:"file",style:{display:"none"},ref:t=>this.inputElementRef=t,accept:"image/*",onChange:this.fileInputChange}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getSelectedBlocks()[0];return super.isDisabled()||t.some((t=>t.getAnnotationByType(W.LINK)))||this.shouldDisabledToolbar(e,ot.INSERT_IMAGE_TO_BLOCK)}}V.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>'}}),he([r()],de.prototype,"insertImageController",void 0),he([r()],de.prototype,"imageInsertedEventEmitter",void 0),he([r()],de.prototype,"selectionController",void 0);class ue extends it{constructor(t,e){super(),this.type=ot.TRANSFORM_LIST_BLOCK,this.isFlushable=!0,this.listType=t,this.selectedBlocks=e}}class fe extends it{constructor(t){super(),this.type=ot.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}var pe=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ve extends gt{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(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof z||t instanceof st))}isListType(t,e="bullet-list"){return t.length>0&&t.every((t=>t instanceof L&&t.parent.type===e))}deselectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new fe(t))}selectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new ue("bullet-list",t))}}pe([r()],ve.prototype,"selectionController",void 0),pe([r()],ve.prototype,"popoverRef",void 0);var me=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class be extends gt{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(){const t=this.selectionController.getSelectedNodes();return super.isDisabled()||t.some((t=>t instanceof z||t instanceof st))}isListType(t,e="number-list"){return t.length>0&&t.every((t=>t instanceof L&&t.parent.type===e))}deselectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new fe(t))}selectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new ue("number-list",t))}}me([r()],be.prototype,"selectionController",void 0),me([r()],be.prototype,"popoverRef",void 0);var ge=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class xe extends gt{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}}),this.bulletsToolbarButtonSlimmer=new ve,this.numbersToolbarButtonSlimmer=new be}componentWillRender(){this.numbersToolbarButtonSlimmer.isSelected()?super.setIcon("list-ol"):super.setIcon("list-ul")}renderBtnWrapper(e){return t("vega-popover",{showArrow:!1,trigger:"click",placement:"bottom",alignment:"center",ref:t=>this.popoverRef=t},t("div",{slot:"popover-content"},e({showArrowIcon:!0})),t("div",{slot:"popover"},this.renderContent()))}renderContent(){return t("vega-flex",{gap:"size-8","justify-content":"center"},t("div",null,this.bulletsToolbarButtonSlimmer.render()),t("div",null,this.numbersToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){return super.isDisabled()||this.shouldDisabledListToolbar()}shouldDisabledListToolbar(){return this.selectionController.getSelectedBlocks().some((t=>t&&(this.unableToConvertListOrParagraph(t)||this.unableToInsertBlock(t.parent))))}unableToInsertBlock(t){return!(nt.canHandle(ot.INSERT_CHILDREN_AFTER,t)||nt.canHandle(ot.INSERT_CHILDREN_BEFORE,t))}unableToConvertListOrParagraph(t){return!nt.canHandle(ot.TRANSFORM_LIST_BLOCK,t)&&!nt.canHandle(ot.TRANSFORM_PARAGRAPH_BLOCK,t.parent)}}V.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>'}}),ge([r()],xe.prototype,"selectionController",void 0),ge([a()],xe.prototype,"bulletsToolbarButtonSlimmer",void 0),ge([a()],xe.prototype,"numbersToolbarButtonSlimmer",void 0),ge([c("componentWillRender")],xe.prototype,"componentWillRender",null);var we=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ce extends gt{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(J.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new rt("left")))),this.popoverRef.hide()}}V.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>'}}),we([r()],Ce.prototype,"selectionController",void 0),we([r()],Ce.prototype,"popoverRef",void 0);var ye=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Re extends gt{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(J.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new rt("center")))),this.popoverRef.hide()}}V.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>'}}),ye([r()],Re.prototype,"selectionController",void 0),ye([r()],Re.prototype,"popoverRef",void 0);var je=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ke extends gt{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(J.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new rt("right")))),this.popoverRef.hide()}}V.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>'}}),je([r()],ke.prototype,"selectionController",void 0),je([r()],ke.prototype,"popoverRef",void 0);var Se=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Oe extends gt{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(J.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new rt("justify")))),this.popoverRef.hide()}}V.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>'}}),Se([r()],Oe.prototype,"selectionController",void 0),Se([r()],Oe.prototype,"popoverRef",void 0);var He=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Te extends gt{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}}),this.leftAlignToolbarButtonSlimmer=new Ce,this.centerAlignToolbarButtonSlimmer=new Re,this.rightAlignToolbarButtonSlimmer=new ke,this.justifiedToolbarButtonSlimmer=new Oe}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(e){return t("vega-popover",{trigger:"click",showArrow:!1,alignment:"center",placement:"bottom",ref:t=>this.popoverRef=t},t("div",{slot:"popover-content"},e({showArrowIcon:!0})),t("div",{slot:"popover"},this.renderContent()))}renderContent(){return t("vega-flex",{gap:"size-8","justify-content":"center"},t("div",null,this.leftAlignToolbarButtonSlimmer.render()),t("div",null,this.centerAlignToolbarButtonSlimmer.render()),t("div",null,this.rightAlignToolbarButtonSlimmer.render()),t("div",null,this.justifiedToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){return super.isDisabled()||this.selectionController.getSelectedBlocks().some((t=>this.shouldDisabledToolbar(t,rt.name)))}}He([r()],Te.prototype,"selectionController",void 0),He([a()],Te.prototype,"leftAlignToolbarButtonSlimmer",void 0),He([a()],Te.prototype,"centerAlignToolbarButtonSlimmer",void 0),He([a()],Te.prototype,"rightAlignToolbarButtonSlimmer",void 0),He([a()],Te.prototype,"justifiedToolbarButtonSlimmer",void 0),He([c("componentWillRender")],Te.prototype,"componentWillRender",null);class ze{constructor(t,e){this.content=t.clone(!0),this.selection=e.clone(),this.refreshSelectionNodes()}clone(){return new ze(this.content,this.selection)}refreshSelectionNodes(){const{startNode:t,endNode:e,startOffset:i,endOffset:o}=this.selection.range;if(t&&e){const s=this.content.findNodeById(t.id),n=this.content.findNodeById(e.id);s&&n&&this.selection.range.updateRTERange({startNode:s,endNode:n,startOffset:i,endOffset:o})}}}var Le=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ee extends l{connectedCallback(){const t=Mt((()=>{this.valueController.flushChanges(this.value)}),Ee.VALUE_CHANGE_DEBOUNCE_TIME,this);this.flushChangeObserver=new It(this.isAcceptableFlushChange.bind(this),t),p.register(v.getSubject(this.host,j),this.flushChangeObserver)}disconnectedCallback(){p.unregister(v.getSubject(this.host,j),this.flushChangeObserver)}componentWillLoad(){!this.value||this.value instanceof E||(this.value=E.fromJSON(this.value)),this.registerEditorRefAndContent()}watchValueUpdate(){const t=this.sourceEditConfig.autoMatchFormat;!this.value||this.value instanceof E?this.value&&0!==this.value.children.length?(this.changeEventEmitter.emit(this.value),p.notify(Et,{host:this.host,detail:this.value})):this.value=E.createEmptyContent({autoMatchFormat:t}):this.value=E.fromJSON(this.value,{autoMatchFormat:t}),this.registerEditorRefAndContent()}async flushChanges(t,e=!0){this.value=t.clone(),e&&this.historyController.registerHistory(new ze(this.value,new Ht(this.selectionController.getCurrentRange()))),await jt(this.host)}isAcceptableFlushChange(){return!0}registerEditorRefAndContent(){this.host&&this.host.value&&ct.register(this.host,this.host.value)}}Ee.VALUE_CHANGE_DEBOUNCE_TIME=50,Le([r()],Ee.prototype,"host",void 0),Le([r({writable:!0})],Ee.prototype,"value",void 0),Le([r()],Ee.prototype,"changeEventEmitter",void 0),Le([r()],Ee.prototype,"valueController",void 0),Le([r()],Ee.prototype,"historyController",void 0),Le([r()],Ee.prototype,"selectionController",void 0),Le([r()],Ee.prototype,"sourceEditConfig",void 0),Le([c("connectedCallback")],Ee.prototype,"connectedCallback",null),Le([c("disconnectedCallback")],Ee.prototype,"disconnectedCallback",null),Le([c("componentWillLoad")],Ee.prototype,"componentWillLoad",null),Le([c("watchValueUpdate")],Ee.prototype,"watchValueUpdate",null);class Be{constructor(t){this.editor=t}syncRichTextContentEditable(){this.editor.richTextContentEditable=!this.editor.disabled}}class Ie{execute(t,e,i,o){this.initCurrentStateAndSelection(t,e),this.setCurrentRichTextEditor(i),this.handleEvent(o)}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}removeSelectionRange(t=!1){p.notify(v.getSubject(this.richTextEditorRef,k),{host:this.richTextEditorRef,detail:t});const e=this.selectionController.getCurrentRange(),i=this.selectionController.getSelectedNodes();return e.startNode||i[0]}createEmptyParagraph(){const t=new _(Rt(),"paragraph"),e=new P(`${t.id}1`,"",t);return t.apply(new lt([e])),t}initCurrentStateAndSelection(t,e){this.currentState=t,this.selectionController=e}setCurrentRichTextEditor(t){this.richTextEditorRef=t}}class Me extends it{constructor(t,e){super(),this.type=ot.REPLACE_SELECTED_TEXT,this.textToBeInsert="",this.textToBeInsert=t,this.currentRange=e}}class Ae extends it{constructor(t,e,i){super(),this.type=ot.INSERT_TEXT_TO_DECORATOR_NODE,this.text="",this.offset=0,this.decoratorNode=t,this.text=e,this.offset=i}}class De extends Ie{handleEvent(t){const e=t.data,i=this.selectionController.getCurrentRange(),{startContainer:o,startOffset:s}=i,n=this.selectionController.getSelectedNodes();if(n.length<2){if(!n.length&&this.isRootContainer(o)){const t=this.insertTextToRoot(e);this.selectionController.enqueueSelectionRangeFutureState(t,e.length)}else if(n[0]instanceof P)if(n[0].isContentEditable()){let t=s+e.length,r=!1,c=n[0];"\n"===c.text?(c=this.insertTextToLineBreakNode(c,e),r=!0):(o.nodeValue===at&&s===at.length&&c.isEmpty()&&(o.nodeValue="",t-=at.length),c instanceof P&&(r=!0,c.apply(new Me(e,i)))),r&&this.selectionController.enqueueSelectionRangeFutureState(c,Math.min(t,c.text.length))}else n[0].parent.apply(new Ae(n[0],e,s))}else{const t=this.removeSelectionRange(!0);t instanceof P&&(t.apply(new Me(e,i)),this.selectionController.enqueueSelectionRangeFutureState(t,Math.min(s+e.length,t.text.length)))}}insertTextToRoot(t){if(this.currentState&&this.currentState.children[0]&&this.currentState.children[0]instanceof _){const e=this.currentState.children[0].children[0];return e.apply(new ht(t)),e}}insertTextToLineBreakNode(t,e){const{startOffset:i,endOffset:o}=this.selectionController.getCurrentRange(),s=t.parent;if(s instanceof _){const n=s.children.indexOf(t);if(0===i&&i===o&&s.children[n+1]){const i=t.cloneWithText(e);return s.apply(new dt(t,i)),i}return t.apply(new ht(e)),t}}}class Fe extends Ie{handleEvent(){const t=this.selectionController.getSelectedBlocks();t.length&&(t.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 o=i.parent,s=t[t.length-1];if(o.type!==s.type&&e.startContainer.nodeType===e.endContainer.nodeType){o.apply(new B(s));const t=new ut(i,i.text.length);return o.apply(t),void this.switchCaretPositionToNextElement(t.newBlock)}}this.selectionController.enqueueSelectionRangeFutureState(i,e.startOffset)}breakSingleBlock(){const t=this.removeSelectionRange(),e=t.parent,{startOffset:i}=this.selectionController.getCurrentRange();if(e){const o=new I(t,i);e.apply(o),this.switchCaretPositionToNextElement(o.newBlock)}}switchCaretPositionToNextElement(t){t&&t.children&&this.selectionController.enqueueSelectionRangeFutureState(t.children[0],0)}}class Ve extends it{constructor(t,e){super(),this.type=ot.LINE_BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class Pe extends it{constructor(t){super(),this.type=ot.LINE_BREAK_MULTIPLE_BLOCKS,this.selectedBlocks=t}}class Ne extends Ie{handleEvent(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedBlocks();this.isRootContainer(t.startContainer)&&this.breakNewBlock(),e.length&&(e.length<2?this.breakSingleBlock():this.breakMultipleBlocks())}breakNewBlock(){if(this.currentState&&this.currentState.children[0]&&this.currentState.children[0]instanceof _){const t=new Ve(this.currentState.children[0].children[0],0);this.currentState.children[0].apply(t),this.switchCaretPositionToSpecifiedNode(t.lineBreakNode)}}breakSingleBlock(){const t=this.selectionController.getCurrentRange(),e=this.removeSelectionRange(),i=e.parent;if(i){const o=new Ve(e,t.startOffset);i.apply(o),o.lineBreakNode&&this.switchCaretPositionToSpecifiedNode(o.lineBreakNode)}}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.removeSelectionRange(),i=new Pe(t);e.parent.apply(i),this.switchCaretPositionToSpecifiedNode(i.lineBreakNode)}switchCaretPositionToSpecifiedNode(t){this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(t),0)}getNextRTENode(t){const e=t.parent.children.indexOf(t);return t.parent.children[e+1]||t}}class We extends it{constructor(t,e){super(),this.type=ot.DELETE_BLOCK_CONTENT,this.startContainerNode=t,this.startOffset=e}}class Ue extends Ie{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.deleteContentWithSingleBlock():this.deleteContentWithMultipleNodes()}deleteContentWithSingleBlock(){const t=this.selectionController.getCurrentRange(),{startOffset:e,endOffset:i,startContainer:o,endContainer:s}=t,n=this.selectionController.getSelectedBlocks(),r=this.selectionController.getSelectedNodes();if(e!==i||o!==s)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):t.previousNode.getRangeEndOffset();this.selectionController.enqueueSelectionRangeFutureState(t.previousNode,i)}else t.nextNode?this.selectionController.enqueueSelectionRangeFutureState(t.nextNode,0):0===this.currentState.children.length&&this.insertDefaultParagraph()}}deleteContentWithMultipleNodes(){const t=this.selectionController.getSelectedNodes(),e=this.removeSelectionRange(!0),i=t[t.length-1];t.length>1&&i instanceof P&&i.isEmpty()&&i.parent.apply(new ft(i)),this.convertFirstBlockToParagraph(e.parent)}convertFirstBlockToParagraph(t){if(this.currentState.children[0]===t&&t instanceof _&&1===t.children.length&&t.children[0].isEmpty()&&"paragraph"!==t.type){const e=this.createEmptyParagraph();e.apply(new pt(t.children)),t.parent.apply(new dt(t,e)),t.parent.apply(new ft(t))}}insertDefaultParagraph(){const t=this.createEmptyParagraph();this.currentState.apply(new lt([t])),this.selectionController.enqueueSelectionRangeFutureState(t.children[0],1)}}class $e extends it{constructor(t,e,i,o){super(),this.type=ot.PASTE_CONTENT,this.blocksToBeInserted=t,this.startNode=e,this.startOffset=i,this.rteRange=o}}class _e extends Ie{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 lt(t))}insertBlocksToContent(t){const e=this.removeSelectionRange();if(e&&e.parent){const{startOffset:i}=this.selectionController.getCurrentRange(),o=new $e(t,e,i);e.parent.apply(o),o.futureFocusBlock&&this.switchCaretPositionToNextElement(o.futureFocusBlock)}}insertBlocksBeforeEmptyBlock(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parent;if(i){const e=new $e(t,i.children[0],0,this.selectionController.getCurrentRange());i.apply(e),e.futureFocusBlock&&this.switchCaretPositionToNextElement(e.futureFocusBlock)}}parsePastedElements(t){let e=t.dataTransfer.getData("text/html");if(!e){const i=t.dataTransfer.getData("text/plain");e=this.parsePlainText(i)}const i=M.preserve(e),o=i.getProcessedHtml(),s=(new DOMParser).parseFromString(o,"text/html"),n=Array.from(s.body.childNodes);return i.restore(n),A.process(n).filter(Boolean).map((t=>t.toDto())).filter(Boolean)}switchCaretPositionToNextElement(t){t&&t.children&&this.selectionController.enqueueSelectionRangeFutureState(t.children[0],0)}parsePlainText(t){return t.split("\n").map((t=>""===t?"<p>\n</p>":`<p>${t}</p>`)).join("")}}var Ke=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class qe extends l{constructor(){super(...arguments),this.insertTextHandler=new De,this.insertParagraphHandler=new Fe,this.insertLineBreakHandler=new Ne,this.deleteContentHandler=new Ue,this.insertPasteHandler=new _e,this.handleUserInputAction=t=>{const e=t.inputType;if(t.preventDefault(),this.initValueIfEmpty(),"insertCompositionText"===e||this.isFocusNodeNonEditable())return;this.insertCompositionTextController.removeObserver();let i=!1;switch(e){case"insertParagraph":i=!0,this.insertParagraphHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertText":i=!0,this.insertTextHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertLineBreak":i=!0,this.insertLineBreakHandler.execute(this.value,this.selectionController,this.host,t);break;case"deleteContentBackward":i=!0,this.deleteContentHandler.execute(this.value,this.selectionController,this.host,t);break;case"insertFromPaste":i=!0,this.insertPasteHandler.execute(this.value,this.selectionController,this.host,t)}i&&this.valueController.flushChanges(this.value)}}addActionListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("beforeinput",this.handleUserInputAction),t.addEventListener("drop",this.preventDropEvent))}removeActionListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("beforeinput",this.handleUserInputAction),t.removeEventListener("drop",this.preventDropEvent))}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}preventDropEvent(t){t.preventDefault()}initValueIfEmpty(){if(!this.value){const t=Rt();this.valueController.flushChanges(E.fromJSON([{id:t,type:"paragraph",nodes:[{id:`${t}1`,type:"text",text:""}]}]))}}isFocusNodeNonEditable(){const{startContainer:t,endContainer:e}=this.selectionController.getCurrentRange(),i=this.selectionController.getSelectedNodes();if(t&&t===e&&0===i.length){const e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return e&&e.classList.contains(vt.CODE_BLOCK_PLACEHOLDER_CLASS_NAME)}return!1}}Ke([r()],qe.prototype,"host",void 0),Ke([r()],qe.prototype,"value",void 0),Ke([r()],qe.prototype,"valueController",void 0),Ke([r()],qe.prototype,"vegaRichTextEditorRenderer",void 0),Ke([r()],qe.prototype,"selectionController",void 0),Ke([r()],qe.prototype,"insertCompositionTextController",void 0),Ke([c("componentDidLoad")],qe.prototype,"addActionListener",null),Ke([c("disconnectedCallback")],qe.prototype,"removeActionListener",null);class Ge extends it{constructor(t,e,i){super(),this.isFlushable=!0,this.type=ot.INSERT_IMAGE_TO_BLOCK,this.splitPointNode=t,this.startOffsetOfNode=e,this.imageBlockToBeInserted=i}}var Je=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ze extends l{insertImageToCaretPosition(t){const e=this.selectionController.getSelectedBlocks(),i=new D(Rt()),o=new z(Rt(),t,i);if(o.apply(new xt("md","")),i.apply(new lt([o])),e.length<1||this.value.children.length<1)this.value.apply(new lt([i])),this.valueController.flushChanges(this.value);else{const{startOffset:t}=this.selectionController.getCurrentRange(),o=this.selectionController.getSelectedNodes();e[0].apply(new Ge(o[0],t,i))}return this.updateCaretPosition(o),o}registerObserver(){this.registerImageSelectedObserver()}unRegisterObserver(){this.removeImageSelectedObserver()}updateCaretPosition(t){this.selectionController.enqueueSelectionRangeFutureState(t,1)}registerImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(m.addUniqueObserverToNode(t,S,(t=>{const e=this.selectionController.getCurrentRange();if(!e||e.startContainer!==t.host||0!==e.startOffset){const e=ct.getEntityByDOM(t.host.querySelector("img"));this.selectionController.enqueueSelectionRangeFutureState(e,0,e,0,!0)}})),m.addUniqueObserverToNode(t,O,(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&&(m.removeUniqueObserverFromNode(t,S),m.removeUniqueObserverFromNode(t,O))}}Je([r()],Ze.prototype,"selectionController",void 0),Je([r()],Ze.prototype,"value",void 0),Je([r()],Ze.prototype,"valueController",void 0),Je([r()],Ze.prototype,"vegaRichTextEditorRenderer",void 0),Je([c("componentDidLoad")],Ze.prototype,"registerObserver",null),Je([c("disconnectedCallback")],Ze.prototype,"unRegisterObserver",null);var Xe=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Ye extends l{constructor(){super(...arguments),this.doFocusOnLastTextNode=async t=>{const e=t.getLastNode(),i=ct.getDOMByEntity(e);i&&(e.isContentEditable()?this.setCaretRangeToNodeEnd(i.firstChild,i.firstChild.nodeValue.length):this.setCaretRangeToNodeEnd(i.parentElement,e.getRangeEndOffset()),await this.vegaRichTextEditorRenderer.getRichTextContentRef().vegaFocus())}}async focusOnLastTextNode(t){const e=this.value.children[this.value.children.length-1];if(e instanceof _&&!(null==t?void 0:t.newLine))await this.doFocusOnLastTextNode(e);else{const t=_.from({id:Rt(),type:"paragraph",nodes:[{id:Rt(),type:"text",text:""}]});e.parent.apply(new mt(e,t)),await this.valueController.flushChanges(this.value),await this.doFocusOnLastTextNode(t)}}setCaretRangeToNodeEnd(t,e){const i=new Range;i.setStart(t,e),this.selectionController.setSelectionRange(i)}}Xe([r()],Ye.prototype,"vegaRichTextEditorRenderer",void 0),Xe([r()],Ye.prototype,"selectionController",void 0),Xe([r()],Ye.prototype,"valueController",void 0),Xe([r()],Ye.prototype,"value",void 0);var Qe=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ti extends l{connectedCallback(){this.observer=new It(this.isAcceptObserver.bind(this),(t=>{wt.getTextNodeElements().forEach(((e,i)=>{i.style.color=t?e.textColor.dark:e.textColor.light}))})),p.register(Bt,this.observer)}disconnectResizeObserver(){p.unregister(Bt,this.observer)}isAcceptObserver(){return!0}}Qe([c("connectedCallback")],ti.prototype,"connectedCallback",null),Qe([c("disconnectedCallback")],ti.prototype,"disconnectResizeObserver",null);var ei=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ii extends l{constructor(){super(...arguments),this.insertCompositionTextEndFlag=!0,this.observerOptions={characterData:!0,characterDataOldValue:!0,subtree:!0,childList:!0},this.updateTextFromDom=t=>{let e=!1;!1!==this.insertCompositionTextEndFlag&&t.forEach((t=>{const{target:i,oldValue:o}=t;if(i.nodeType===Node.TEXT_NODE&&i.parentElement){const t=ct.getEntityByDOM(i.parentElement),s=i.textContent;t instanceof P&&t.isContentEditable()&&t.parent instanceof _?e=this.updateCurrentNodeText(t,s,o):s&&(i.parentElement.removeChild(i),e=!0)}})),e&&this.valueController.flushChanges(this.value)},this.handleObserver=t=>{t.every((t=>"characterData"===t.type))&&this.updateTextFromDom(t)},this.handleCompositionStart=()=>{this.insertCompositionTextEndFlag=!1,p.notify(v.getSubject(this.host,k),{host:this.host,detail:!0})},this.handleCompositionEnd=t=>{this.insertCompositionTextEndFlag=!0;const e=t.data;e&&this.dispatchInsertTextEvent(e)}}initMutationObserver(){if(this.mutationObserver){const t=this.getEditableElementRef();t&&(this.mutationObserver.disconnect(),this.mutationObserver.observe(t,this.observerOptions))}}removeObserver(){this.mutationObserver&&this.mutationObserver.disconnect()}isComposing(){return!this.insertCompositionTextEndFlag}addCompositionTextEventListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd)),this.mutationObserver=new MutationObserver(this.handleObserver),this.initMutationObserver()}removeCompositionTextEventListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("compositionstart",this.handleCompositionStart),t.removeEventListener("compositionend",this.handleCompositionEnd)),this.removeObserver()}reConnectObserver(){this.initMutationObserver()}appendLineBreakNode(t){const e=t.parent,i=e.children.indexOf(t);if(e.children[i+1]){const o=t.cloneWithText("\n");e.apply(new dt(e.children[i+1],o))}}updateCurrentNodeText(t,e,i){const o=this.removeZeroWidthSpace(e.replace(/(\n)$/,""));if(t.text!==o){const{startOffset:s}=this.selectionController.getCurrentRange(),n="\n"===t.text;t.apply(new ht(o)),n&&this.appendLineBreakNode(t);const r=Math.min(o.length,s-(i?i.length-e.length:0));return this.selectionController.enqueueSelectionRangeFutureState(t,Math.max(0,r)),!0}}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}removeZeroWidthSpace(t){return t.startsWith(at)?t.slice(at.length):t.endsWith(at)?t.slice(0,t.length-at.length):t}dispatchInsertTextEvent(t){const e=new CustomEvent("beforeinput");e.data=t,e.inputType="insertText",this.editableElementRef.dispatchEvent(e)}}ei([r()],ii.prototype,"selectionController",void 0),ei([r()],ii.prototype,"host",void 0),ei([r()],ii.prototype,"value",void 0),ei([r()],ii.prototype,"valueController",void 0),ei([r()],ii.prototype,"userInputController",void 0),ei([r()],ii.prototype,"vegaRichTextEditorRenderer",void 0),ei([c("componentDidLoad")],ii.prototype,"addCompositionTextEventListener",null),ei([c("disconnectedCallback")],ii.prototype,"removeCompositionTextEventListener",null),ei([c("componentDidRender")],ii.prototype,"reConnectObserver",null);var oi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class si extends l{constructor(){super(...arguments),this.deleteActionProcess=t=>{const e=this.selectionController.getCurrentRange(),{startContainer:i,endContainer:o,startOffset:s,endOffset:n}=e;if(i!==o||s!==n){const s=this.removeSelectionRange();!(!t||!t.detail)&&t.detail&&this.mergeRangeStartAndEnd(i,o),this.selectionController.enqueueSelectionRangeFutureState(s,e.startOffset)}}}addDeleteObserver(){m.addUniqueObserverToNode(this.host,k,this.deleteActionProcess)}removeDeleteObserver(){m.removeUniqueObserverFromNode(this.host,k)}removeSelectionRange(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),{endOffset:i,startOffset:o}=t,s=e[0],n=e[e.length-1];if(e.length>1&&e.filter((t=>t.isContentEditable()?t!==s&&t!==n:t!==s&&(t!==n||this.isEndNodeFullyInTheRange(n,i,t)))).forEach((t=>{t.parent.apply(new ft(t))})),this.removeRangeStartAndEndSelectedText(),!s.isContentEditable()&&this.isStartNodeFullyInTheRange(s,n,o,i)){if(1===s.parent.children.length){const t=this.createEmptyParagraph();let e=s.parent;return!e.parent||e.parent instanceof E||1!==e.parent.children.length||(e=e.parent),e.parent.apply(new dt(e,t)),s.parent.apply(new ft(s)),t.children[0]}if(s===s.parent.children[0])return s.parent.apply(new ft(s)),s.parent.children[0]}return s}removeRangeStartAndEndSelectedText(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getCurrentRange();t[0]instanceof P&&t[0].isContentEditable()&&t[0].apply(new Me("",e));const i=t[t.length-1];t.length>1&&i instanceof P&&i.isContentEditable()&&t[t.length-1].apply(new Me("",e))}createEmptyParagraph(){const t=new _(Rt(),"paragraph"),e=new P(`${t.id}1`,"",t);return t.apply(new lt([e])),t}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.parent&&i&&i.parent){const t=i.parent;this.shouldMergeTextNode(e,i)&&(e.apply(new ht(e.text+i.text)),e.parent===i.parent?e.parent.apply(new ft(i)):i.parent.apply(new ft(i.parent.children[0]))),e instanceof P&&i instanceof P&&e.parent!==i.parent&&(e.parent.apply(new lt(t.children)),t.children=[]),t.children.length<1&&t.parent.apply(new ft(t))}}}shouldMergeTextNode(t,e){const{annotations:i}=t.toJSON(),{annotations:o}=e.toJSON();return t instanceof P&&e instanceof P&&JSON.stringify(i)===JSON.stringify(o)}isEndNodeFullyInTheRange(t,e,i){return i instanceof st||i===t&&0!==e}isStartNodeFullyInTheRange(t,e,i,o){return t instanceof st||0===i&&(e!==t||0!==o)}}oi([r()],si.prototype,"host",void 0),oi([r()],si.prototype,"selectionController",void 0),oi([r()],si.prototype,"value",void 0),oi([c("connectedCallback")],si.prototype,"addDeleteObserver",null),oi([c("disconnectedCallback")],si.prototype,"removeDeleteObserver",null);var ni=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ri extends Tt{constructor(){super(...arguments),this.getEffectiveTargets=()=>[this.vegaRichTextEditorRenderer.getRTEEditableElementRef()],this.getIneffectiveTargets=()=>{const t=this.vegaRichTextEditorRenderer.getRTEEditableElementRef();let e=[];return t&&(e=Array.from(t.querySelectorAll(".code-block-container"))),e}}registerInitState(){this.value&&this.registerHistory(new ze(this.value,new Ht(this.selectionController.getCurrentRange())),!0)}async undo(){if(this.undoStack.length>1){const t=this.undoStack.pop().clone();this.redoStack.push(t);const e=this.undoStack[this.undoStack.length-1];e&&await this.restoreState(e)}}async redo(){if(this.redoStack.length>0){const t=this.redoStack.pop().clone();this.undoStack.push(t),await this.restoreState(t)}}async restoreState(t){const{content:e,selection:i}=t.clone();this.selectionController.setSelectionState(i),await this.valueController.flushChanges(e,!1)}}ni([r()],ri.prototype,"host",void 0),ni([r()],ri.prototype,"vegaRichTextEditorRenderer",void 0),ni([r()],ri.prototype,"valueController",void 0),ni([r()],ri.prototype,"value",void 0),ni([r()],ri.prototype,"selectionController",void 0),ni([c("componentDidLoad")],ri.prototype,"registerInitState",null);class ci extends it{constructor(t){super(),this.type=ot.TRANSFORM_TO_CODE_BLOCK,this.selectedBlocks=t}}var li=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ai extends gt{constructor(){super({icon:"rectangle-code",tooltip:{text:"Code Block"}})}onClick(){if(!this.isSelected()){const t=this.selectionController.getSelectedBlocks(),e=t[0].parent,i=new ci(t);e.apply(i),this.valueController.flushChanges(this.value),this.selectionController.enqueueSelectionRangeFutureState(i.newCodeBlock.children[0],0)}}isSelected(){const t=this.selectionController.getSelectedBlocks();return!(!t.length||!t.every((t=>"code-block"===t.type)))}isDisabled(){const t=this.selectionController.getSelectedBlocks();return super.isDisabled()||t.some((t=>!(t instanceof vt)&&this.shouldDisabledCodeBlockToolbar(t)))}shouldDisabledCodeBlockToolbar(t){return t&&!(t instanceof _&&nt.canHandle(ot.TRANSFORM_TO_CODE_BLOCK,t.parent))}}V.register({"rectangle-code":{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="M320.1 175L384.1 239C394.3 248.4 394.3 263.6 384.1 272.1L320.1 336.1C311.6 346.3 296.4 346.3 287 336.1C277.7 327.6 277.7 312.4 287 303L334.1 256L287 208.1C277.7 199.6 277.7 184.4 287 175C296.4 165.7 311.6 165.7 320.1 175V175zM177.9 256L224.1 303C234.3 312.4 234.3 327.6 224.1 336.1C215.6 346.3 200.4 346.3 191 336.1L127 272.1C117.7 263.6 117.7 248.4 127 239L191 175C200.4 165.7 215.6 165.7 224.1 175C234.3 184.4 234.3 199.6 224.1 208.1L177.9 256zM448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM448 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H448C456.8 432 464 424.8 464 416V96C464 87.16 456.8 80 448 80z"/></svg>'}}),li([r()],ai.prototype,"selectionController",void 0),li([r()],ai.prototype,"valueController",void 0),li([r()],ai.prototype,"value",void 0);class hi extends zt{constructor(){super(1),this.focusNodeOffset=0,this.doTask=async()=>{await this.focusTheCodeBlock(this.shouldFocusNode)}}enqueueSelectionRangeFutureState(t,e,i){this.shouldFocusNode=t,this.focusNodeOffset=e,super.enqueueTheTaskIntoQueue(i)}isCodeBlockSelected(t,e){const i=ct.getDOMByEntity(t.children[0]);return t.isSelected()||i&&e.intersectsNode(i.nextSibling)&&e.intersectsNode(i.previousSibling)}async focusTheCodeBlock(t){await Promise.resolve();const e=ct.getDOMByEntity(t);e&&e.doFocus()}}var di=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class ui extends Ct{constructor(){super({icon:"display-code",tooltip:{text:"Edit Source"},autoFocusOnClick:!1})}async onClick(){const t=this.sourceView;t?await this.saveSourceCode():this.selectionController.setSelectionRange(new Range),this.sourceView=!t}isSelected(){return this.sourceView}isDisabled(){return super.isDisabled()}async saveSourceCode(){const t=this.vegaRichTextEditorRenderer.getSourceCode();!t&&this.value.isEmpty()||"string"==typeof t&&await this.valueController.flushChanges(E.fromHtml(t,{autoMatchFormat:this.sourceEditConfig.autoMatchFormat}))}}V.register({"display-code":{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="M512 48c8.8 0 16 7.2 16 16V352c0 8.8-7.2 16-16 16H336.5c-.3 0-.6 0-.8 0H240.4c-.3 0-.6 0-.8 0H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H512zM64 416H211.7l-8 48H152c-13.3 0-24 10.7-24 24s10.7 24 24 24h72H352h72c13.3 0 24-10.7 24-24s-10.7-24-24-24H372.3l-8-48H512c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64C28.7 0 0 28.7 0 64V352c0 35.3 28.7 64 64 64zm188.3 48l8-48h55.3l8 48H252.3zM249 177c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-48 48c-9.4 9.4-9.4 24.6 0 33.9l48 48c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-31-31 31-31zM361 143c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l31 31-31 31c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l48-48c9.4-9.4 9.4-24.6 0-33.9l-48-48z"/></svg>'}}),di([r({writable:!0})],ui.prototype,"sourceView",void 0),di([r()],ui.prototype,"selectionController",void 0),di([r()],ui.prototype,"valueController",void 0),di([r()],ui.prototype,"vegaRichTextEditorRenderer",void 0),di([r()],ui.prototype,"sourceEditConfig",void 0),di([r()],ui.prototype,"value",void 0);var fi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class pi extends l{constructor(){super(...arguments),this.flushValue=(t,e=!1)=>{if(this.host&&t&&(this.valueController.flushChanges(t,!0),e)){const t=this.host.value.getLastNode();t&&this.selectionController.enqueueSelectionRangeFutureState(t,t.getRangeEndOffset())}},this.isSourceEditMode=()=>this.sourceView,this.getSelectedNodes=()=>this.selectionController.getSelectedNodes()}initialExtensionContext(){if(this.extensions&&this.host)for(const t of this.extensions)t.initialExtension({host:this.host,flushValue:this.flushValue,isSourceEditMode:this.isSourceEditMode,getSelectedNodes:this.getSelectedNodes})}handleExtensionsChange(t,e){Nt(t,e,!1,((t,e)=>t===e?0:1))||this.initialExtensionContext()}}fi([r()],pi.prototype,"extensions",void 0),fi([r()],pi.prototype,"host",void 0),fi([r()],pi.prototype,"sourceView",void 0),fi([r()],pi.prototype,"valueController",void 0),fi([r()],pi.prototype,"selectionController",void 0),fi([c("componentDidLoad")],pi.prototype,"initialExtensionContext",null),fi([c("watchExtensions")],pi.prototype,"handleExtensionsChange",null);var vi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const mi=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.vegaImageInserted=s(this,"vegaImageInserted",7),this.imageInserted=s(this,"imageInserted",7),this.globalSlimmers={},this.translationSlimmer=new Vt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.formFieldController=new kt({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new Dt:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:t=>this[t],inputContainerGetter:()=>this.vegaRichTextEditorRenderer.getRichTextContainerRef(),touchableAreaGetter:()=>[this.vegaRichTextEditorRenderer.getRichTextContentRef()]}),this.changeEventEmitter=St(mi,g),this.vegaRichTextEditorRenderer=new Jt,this.valueController=new Ee,this.selectionController=new Lt,this.focusController=new Ye,this.darkModeStateControllerSlimmer=new At,this.toolbarRenderer=new Xt,this.clearStyleToolbarButtonSlimmer=new oe,this.boldToolbarButtonSlimmer=new Yt,this.italicToolbarButtonSlimmer=new Qt,this.underlineToolbarButtonSlimmer=new te,this.textColorToolbarButtonSlimmer=new yt,this.textStylesToolbarButtonSlimmer=new ie,this.codeToolbarButtonSlimmer=new se,this.strikethroughToolbarButtonSlimmer=new ne,this.imageToolbarButtonSlimmer=new de,this.linkToolbarButtonSlimmer=new re,this.moreIndentToolbarButtonSlimmer=new ce,this.lessIndentToolbarButtonSlimmer=new le,this.bulletsNumbersToolbarButtonSlimmer=new xe,this.horizontalAlignmentToolbarButtonSlimmer=new Te,this.codeBlockToolbarButtonSlimmer=new ai,this.sourceEditToolbarButtonSlimmer=new ui,this.placeholderNotifySlimmer=Ot(mi,"placeholder","watchPlaceholder"),this.disabledNotifySlimmer=Ot(mi,"richTextContentEditable","watchRichTextContentEditable"),this.richTextContentController=new Be(this),this.userInputController=new qe,this.insertImageController=new Ze,this.insertCompositionTextController=new ii,this.imageInsertedEventEmitter=St(mi,x),this.changeEventPreventSlimmer=new Ft([g],(()=>this.vegaRichTextEditorRenderer.getRichTextWrapperRef())),this.textNodeColorController=new ti,this.deleteSelectedNodesController=new si,this.historyController=new ri,this.internalCodeBlockSelectionController=new hi,this.rteExtensionController=new pi,this.richTextContentEditable=!0,this.selectionMap=new Map,this.isInDarkMode=Pt.isDarkMode(),this.sourceView=!1,this.label="",this.required=!1,this.placeholder="",this.disabled=!1,this.hint="",this.rows=4,this.value=E.createEmptyContent(),this.toolbarItems=bt,this.allowSourceEdit=!1,this.sourceEditConfig={autoMatchFormat:!0},this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.extensions=[]}watchRichTextContentEditable(){}watchPlaceholder(){}watchDisabled(){this.richTextContentController.syncRichTextContentEditable()}watchValueUpdate(){}watchValidationRules(){}watchExtensions(){}componentWillLoad(){this.richTextContentController.syncRichTextContentEditable()}render(){return u(this.vegaRichTextEditorRenderer.render(),this.host)}get host(){return n(this)}static get watchers(){return{richTextContentEditable:["watchRichTextContentEditable"],placeholder:["watchPlaceholder"],disabled:["watchDisabled"],value:["watchValueUpdate"],validationRules:["watchValidationRules"],extensions:["watchExtensions"]}}};vi([d()],mi.prototype,"globalSlimmers",void 0),vi([a()],mi.prototype,"translationSlimmer",void 0),vi([a()],mi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),vi([a()],mi.prototype,"formFieldController",void 0),vi([a()],mi.prototype,"changeEventEmitter",void 0),vi([a()],mi.prototype,"vegaRichTextEditorRenderer",void 0),vi([a()],mi.prototype,"valueController",void 0),vi([a()],mi.prototype,"selectionController",void 0),vi([a()],mi.prototype,"focusController",void 0),vi([a()],mi.prototype,"darkModeStateControllerSlimmer",void 0),vi([a()],mi.prototype,"toolbarRenderer",void 0),vi([a()],mi.prototype,"clearStyleToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"boldToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"italicToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"underlineToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"textColorToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"textStylesToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"codeToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"strikethroughToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"imageToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"linkToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"moreIndentToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"lessIndentToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"codeBlockToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"sourceEditToolbarButtonSlimmer",void 0),vi([a()],mi.prototype,"placeholderNotifySlimmer",void 0),vi([a()],mi.prototype,"disabledNotifySlimmer",void 0),vi([a()],mi.prototype,"richTextContentController",void 0),vi([a()],mi.prototype,"userInputController",void 0),vi([a()],mi.prototype,"insertImageController",void 0),vi([a()],mi.prototype,"insertCompositionTextController",void 0),vi([a()],mi.prototype,"imageInsertedEventEmitter",void 0),vi([a()],mi.prototype,"changeEventPreventSlimmer",void 0),vi([a()],mi.prototype,"textNodeColorController",void 0),vi([a()],mi.prototype,"deleteSelectedNodesController",void 0),vi([a()],mi.prototype,"historyController",void 0),vi([a()],mi.prototype,"internalCodeBlockSelectionController",void 0),vi([a()],mi.prototype,"rteExtensionController",void 0),mi.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;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}: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:3px;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));cursor:not-allowed}: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.disabled vega-rich-text-content{pointer-events:none;opacity:0.35}: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:3px;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;justify-content:center;align-items:center;margin-left:6px}.toolbar-btn-group .toolbar-btn-color-preview-box.disabled{opacity:0.35}.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 !important}.source-view-container{margin-top:12px}.source-view-container vega-code-block::part(editor-toolbar){display:none}';var bi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class gi extends l{constructor(){super(...arguments),this.handleClick=t=>{this.disabled?t.preventDefault():this.clickEventEmitter.emit(void 0,t)}}render(){return t("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-hidden":this.hidden,"rich-text-editor-toolbar-button-selected":this.selected},onClick:this.handleClick,disabled:this.disabled,hidden:this.hidden},t("vega-flex",{gap:"size-8",justifyContent:"center",alignItems:"center"},this.icon&&t("vega-icon",{size:"size-16",color:this.iconColor,icon:V.getIconKey(this.icon)}),this.showArrowIcon&&t("vega-icon",{size:"size-8",color:"text-secondary",icon:V.getIconKey("chevron-down")})),t("slot",null))}}V.register({"chevron-down":Wt}),bi([r()],gi.prototype,"disabled",void 0),bi([r()],gi.prototype,"hidden",void 0),bi([r()],gi.prototype,"selected",void 0),bi([r()],gi.prototype,"showArrowIcon",void 0),bi([r()],gi.prototype,"icon",void 0),bi([r()],gi.prototype,"iconColor",void 0),bi([r()],gi.prototype,"clickEventEmitter",void 0);var xi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const wi=class{constructor(t){o(this,t),this.vegaClick=s(this,"vegaClick",7),this.click=s(this,"click",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.clickEventEmitter=St(wi,w),this.eventPrevent=new Ft([w],(()=>this.host),{useCapture:!0,customPreventHandle:t=>{this.disabled&&t.stopImmediatePropagation()}}),this.renderer=new gi,this.disabled=!1,this.hidden=!1,this.selected=!1,this.showArrowIcon=!1,this.icon="",this.iconColor="text-primary"}render(){return u(t(e,null,this.renderer.render()),this.host)}get host(){return n(this)}};xi([d()],wi.prototype,"globalSlimmers",void 0),xi([a()],wi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),xi([a()],wi.prototype,"clickEventEmitter",void 0),xi([a()],wi.prototype,"eventPrevent",void 0),xi([a()],wi.prototype,"renderer",void 0),wi.style=":host{display:inline-block}:host ::slotted(vega-font.v-font-field-label-sm){line-height:16px}.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));cursor:not-allowed}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-hidden{display:none}";var Ci=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class yi extends l{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 t("vega-popover",{style:{width:"100%"},trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,m.addUniqueObserverToNode(t,C,(()=>{this.selected=!0,this.notifyImageSelected(),this.formRef.setValue({alt:this.alt})})),m.addUniqueObserverToNode(t,y,(()=>{this.currentPage=1,this.selected=!1,this.formRef.reset()}))}},t("div",{slot:"popover-content"},t("slot",null)),t("div",{slot:"popover"},this.renderImageEditor(),this.renderAltTextEditor()))}findParentContainerRef(){this.parentContainerRef=$t(this.host,"vega-rich-text-content")}renderImageEditor(){return t("vega-box",{display:1===this.currentPage?"block":"none"},t("vega-flex",{gap:"size-12",alignItems:"center"},t("vega-font",{variant:"font-field-label-sm",color:"text-primary"},this.translationSlimmer.t("Size"),":"),t("vega-segment-control",{size:"small",segments:[{key:"sm",text:this.translationSlimmer.t("Sm")},{key:"md",text:this.translationSlimmer.t("Md")},{key:"lg",text:this.translationSlimmer.t("Lg")}],selected:this.size,ref:t=>{m.addUniqueObserverToNode(t,g,(t=>{if(!this.selected)return;const e=t.detail;this.size=e,this.changeEventEmitter.emit({action:"edit",payload:{size:e,alt:this.alt}})}))}}),t("vega-button-group",{variant:"tertiary",size:"small",ref:t=>{m.addUniqueObserverToNode(t,w,(t=>{"Alt Text"===t.detail?this.currentPage=2:(this.notifyImageDeleteButtonClicked(),this.changeEventEmitter.emit({action:"delete"}),this.popoverRef.hide())}))}},t("vega-button-group-item",{label:this.translationSlimmer.t("Alt Text"),itemKey:"Alt Text"}),t("vega-button-group-item",{label:this.translationSlimmer.t("Delete Image"),icon:V.getIconKey("trash-can"),iconOnly:!0,itemKey:"trash-can"}))))}renderAltTextEditor(){return t("vega-box",{display:2===this.currentPage?"block":"none"},t("vega-form",{ref:t=>this.formRef=t},t("vega-input",{"data-vega-form":"alt",style:{width:"315px"},label:this.translationSlimmer.t("Alt Text"),ref:t=>{t.doFocus()},onKeyDown:this.handleKeyDown})))}notifyImageSelected(){this.parentContainerRef&&p.notify(v.getSubject(this.parentContainerRef,S),{host:this.host})}notifyImageDeleteButtonClicked(){this.parentContainerRef&&p.notify(v.getSubject(this.parentContainerRef,O),{host:this.host})}}V.register({"trash-can":Ut}),Ci([r({writable:!0})],yi.prototype,"currentPage",void 0),Ci([r({writable:!0})],yi.prototype,"selected",void 0),Ci([r()],yi.prototype,"host",void 0),Ci([r()],yi.prototype,"alt",void 0),Ci([r({writable:!0})],yi.prototype,"size",void 0),Ci([r()],yi.prototype,"changeEventEmitter",void 0),Ci([r()],yi.prototype,"translationSlimmer",void 0),Ci([c("componentDidLoad")],yi.prototype,"findParentContainerRef",null);var Ri=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const ji=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.globalSlimmers={},this.translationSlimmer=new Vt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.renderer=new yi,this.changeEventEmitter=St(ji,g),this.currentPage=1,this.selected=!1,this.alt="",this.size="md"}render(){return u(t(e,{class:{"rte-image-selected":this.selected}},this.renderer.render()),this.host)}get host(){return n(this)}};Ri([d()],ji.prototype,"globalSlimmers",void 0),Ri([a()],ji.prototype,"translationSlimmer",void 0),Ri([a()],ji.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Ri([a()],ji.prototype,"renderer",void 0),Ri([a()],ji.prototype,"changeEventEmitter",void 0),ji.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 ki=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Si extends l{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(){p.notify(v.getSubject(this.host,R),{})}watchStatusChange(){"linkEdit"===this.status&&setTimeout((()=>{this.urlInputRef.doFocus()}))}watchTargetChange(){this.updatePopoverTarget()}getPopoverRef(){return this.popoverRef}render(){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,m.addUniqueObserverToNode(t,C,(()=>{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})})),m.addUniqueObserverToNode(t,y,(()=>{this.formRef.reset(),this.resetStatusAfterHide&&(this.status="editOrUnlinkSelection")}))}},t("span",{slot:"popover-content"},t("slot",null)),t("div",{slot:"popover"},this.renderLinkUnlinkContent(),this.renderLinkEditContent()))}renderLinkUnlinkContent(){return t("vega-box",{display:"editOrUnlinkSelection"===this.status?"block":"none"},t("vega-button-group",{size:"small",variant:"tertiary",ref:t=>{m.addUniqueObserverToNode(t,w,(({detail:t})=>{switch(t){case"edit":return void(this.status="linkEdit");case"unlink":this.changeEventEmitter.emit({action:"unlink"}),this.popoverRef.hide()}}))}},t("vega-button-group-item",{label:this.translationSlimmer.t("Edit"),itemKey:"edit"}),t("vega-button-group-item",{label:this.translationSlimmer.t("Unlink"),itemKey:"unlink"})))}renderLinkEditContent(){return t("vega-box",{display:"linkEdit"===this.status?"block":"none"},t("vega-form",{ref:t=>this.formRef=t},t("vega-flex",{style:{width:"419px"},direction:"col",gap:"size-16"},t("vega-input",{"data-vega-form":"url",ref:t=>{this.urlInputRef=t},size:"small",label:this.translationSlimmer.t("URL"),onKeyDown:this.handleKeyDown}),t("vega-input",{size:"small",label:this.translationSlimmer.t("Text"),"data-vega-form":"text",onKeyDown:this.handleKeyDown}))))}updatePopoverTarget(){_t.call(v.getSubject(this.popoverRef,H),this.target)}}ki([r()],Si.prototype,"host",void 0),ki([r({writable:!0})],Si.prototype,"status",void 0),ki([r({writable:!0})],Si.prototype,"record",void 0),ki([r()],Si.prototype,"changeEventEmitter",void 0),ki([r()],Si.prototype,"resetStatusAfterHide",void 0),ki([r()],Si.prototype,"translationSlimmer",void 0),ki([r()],Si.prototype,"target",void 0),ki([c("componentDidLoad")],Si.prototype,"componentDidLoad",null),ki([c("componentDidRender")],Si.prototype,"componentDidRender",null),ki([c("watchStatusChange")],Si.prototype,"watchStatusChange",null),ki([c("watchTargetChange")],Si.prototype,"watchTargetChange",null);var Oi=function(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};const Hi=class{constructor(t){o(this,t),this.vegaChange=s(this,"vegaChange",7),this.change=s(this,"change",7),this.globalSlimmers={},this.translationSlimmer=new Vt,this.vegaComponentUsageRuntimeMetricsSlimmer=new h,this.renderer=new Si,this.changeEventEmitter=St(Hi,g),this.status="editOrUnlinkSelection",this.resetStatusAfterHide=!0}watchStatusChange(){}watchTargetChange(){}async show(){await this.renderer.getPopoverRef().show()}render(){return u(t(e,null,this.renderer.render()),this.host)}get host(){return n(this)}static get watchers(){return{status:["watchStatusChange"],target:["watchTargetChange"]}}};Oi([d()],Hi.prototype,"globalSlimmers",void 0),Oi([a()],Hi.prototype,"translationSlimmer",void 0),Oi([a()],Hi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Oi([a()],Hi.prototype,"renderer",void 0),Oi([a()],Hi.prototype,"changeEventEmitter",void 0),Hi.style=":host{display:contents}:host vega-popover{display:inline}";export{mi as vega_rich_text_editor,wi as vega_rich_text_editor_toolbar_button,ji as vega_rich_text_image_editor,Hi as vega_rich_text_link_editor}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as e,H as i,g as r}from"./p-6b2342e0.js";import{g as o,I as s}from"./p-16493e5b.js";import{h as a}from"./p-161b9c5b.js";import{s as v}from"./p-519a7d55.js";import{i as n}from"./p-2971b17a.js";import{a as h}from"./p-d9671d27.js";import{V as c}from"./p-8c9ea6f4.js";import{L as p,I as l}from"./p-6e1ab235.js";import{V as x,I as d}from"./p-d849e0f5.js";import{t as m}from"./p-b75ee3ba.js";import"./p-ed45b3b6.js";import"./p-40f39194.js";import"./p-d884c644.js";import"./p-f69f84a7.js";import"./p-2d0d575f.js";import"./p-a528714c.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-c0036e71.js";import"./p-10ac8b57.js";import"./p-262ec334.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-5f377954.js";import"./p-dd72ad9e.js";import"./p-ef9cbad1.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-4866e390.js";import"./p-697eb0e1.js";import"./p-8bd496b4.js";import"./p-79a544d6.js";import"./p-bf61d136.js";import"./p-5b71c85e.js";import"./p-02841589.js";import"./p-bf19682d.js";import"./p-a7b5f497.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";import"./p-5d676a94.js";var g=function(t,e,i,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var v=t.length-1;v>=0;v--)(o=t[v])&&(a=(s<3?o(a):s>3?o(e,i,a):o(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const b=class{constructor(e){t(this,e),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new x,this.size="size-16",this.cloneFAIconStyles=()=>{if(this.isThirdPartyIcon(this.icon)){const t=this.getIconStyleHTML();t&&this.appendStyles(t);let e=0;const i=window.setInterval((()=>{if(!(e<10))return p.warn("[Vega] Loading Font Awesome timeout.",this.icon),void clearInterval(i);{e++;const t=this.getIconStyleHTML();if(t)return this.appendStyles(t),void clearInterval(i)}}),300)}}}watchIcon(){this.cloneFAIconStyles()}componentWillLoad(){this.cloneFAIconStyles()}render(){const t=s.findIndex((t=>t===this.icon));if(c.hasIcon(this.icon)){const{icon:t,autoSize:e}=c.getIcon(this.icon);return this.renderForVegaIconToken(t,e?null:this.size,e)}return t>-1?this.renderForVegaIconToken(o(this.icon),this.size):this.renderForThirdPartyIcon()}isThirdPartyIcon(t){return!c.hasIcon(t)&&!s.find((e=>e===t))}renderForVegaIconToken(t,r,o=!1){const s=r?this.formatAndValidSize(this.size):null;return v(e(i,{class:h([s,this.color&&n(this.color),o&&"vega-auto-size"]),innerHTML:t},e("slot",null)),this.host)}renderForThirdPartyIcon(){return v(e(i,{class:h([this.color&&n(this.color)]),style:this.formatThirdPartyIconSize(this.size)},e("i",{part:"icon",class:this.icon})),this.host)}formatAndValidSize(t){return`v-w-${t} v-h-${t}`}formatThirdPartyIconSize(t){return{"font-size":`${a[t]}px`}}appendStyles(t){var e;if(t&&m()){const i=null!==(e=this.host.shadowRoot.querySelector("#fa-icon-styles"))&&void 0!==e?e:m().createElement("style");i.id="fa-icon-styles",i.innerHTML=t,this.host.shadowRoot.appendChild(i)}}getIconStyleHTML(){var t;if(b.iconStyleCache.has(this.icon))return b.iconStyleCache.get(this.icon);if(m()){const e=m().createElement("i");e.className=this.icon,e.style.display="none",m().body.appendChild(e);const i=getComputedStyle(e);if(null===(t=i.fontFamily)||void 0===t?void 0:t.includes("Font Awesome")){const t=getComputedStyle(e,"::before"),r=getComputedStyle(e,"::after"),o=`\n\t\t\t\ti {\n\t\t\t\t\tfont-weight: ${i.fontWeight};\n\t\t\t\t\tfont-family: ${i.fontFamily};\n\t\t\t\t\tfont-style: ${i.fontStyle};\n\t\t\t\t\tposition: ${i.position};\n\t\t\t\t\tletter-spacing: ${i.letterSpacing};\n\t\t\t\t}\n\t\t\t\ti::before {\n\t\t\t\t\tcontent: ${t.content};\n\t\t\t\t\tposition: ${t.position};\n\t\t\t\t\topacity: ${t.opacity};\n\t\t\t\t}\n\t\t\t\ti::after {\n\t\t\t\t\tcontent: ${r.content};\n\t\t\t\t\tposition: ${r.position};\n\t\t\t\t\topacity: ${r.opacity};\n\t\t\t\t}\n\t\t\t`.replace(/[\n\t]/gi,"");return b.iconStyleCache.set(this.icon,o),m().body.removeChild(e),o}return m().body.removeChild(e),null}}get host(){return r(this)}static get watchers(){return{icon:["watchIcon"]}}};b.iconStyleCache=new Map,g([d()],b.prototype,"globalSlimmers",void 0),g([l()],b.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),b.style=":host(.v-text-primary),.v-text-primary{color:rgba(var(--v-text-primary, 32, 54, 69, 1))}:host(.v-text-secondary),.v-text-secondary{color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}:host(.v-text-inverted-primary),.v-text-inverted-primary{color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}:host(.v-text-inverted-secondary),.v-text-inverted-secondary{color:rgba(var(--v-text-inverted-secondary, 188, 186, 213, 1))}:host(.v-text-black),.v-text-black{color:rgba(var(--v-text-black, 32, 54, 69, 1))}:host(.v-text-white),.v-text-white{color:rgba(var(--v-text-white, 252, 252, 252, 1))}:host(.v-text-brand),.v-text-brand{color:rgba(var(--v-text-brand, 51, 57, 61, 1))}:host(.v-text-danger-link),.v-text-danger-link{color:rgba(var(--v-text-danger-link, 230, 50, 87, 1))}:host(.v-text-danger-link-hover),.v-text-danger-link-hover{color:rgba(var(--v-text-danger-link-hover, 233, 71, 104, 1))}:host(.v-text-danger-link-active),.v-text-danger-link-active{color:rgba(var(--v-text-danger-link-active, 189, 41, 71, 1))}:host(.v-text-danger-link-focus),.v-text-danger-link-focus{color:rgba(var(--v-text-danger-link-focus, 240, 52, 91, 1))}:host(.v-text-danger-link-visited),.v-text-danger-link-visited{color:rgba(var(--v-text-danger-link-visited, 230, 50, 87, 1))}:host(.v-text-disabled),.v-text-disabled{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host(.v-text-error),.v-text-error{color:rgba(var(--v-text-error, 189, 41, 71, 1))}:host(.v-text-input-disabled),.v-text-input-disabled{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}:host(.v-text-input-placeholder),.v-text-input-placeholder{color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}:host(.v-text-link),.v-text-link{color:rgba(var(--v-text-link, 19, 98, 226, 1))}:host(.v-text-link-hover),.v-text-link-hover{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host(.v-text-link-active),.v-text-link-active{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host(.v-text-link-focus),.v-text-link-focus{color:rgba(var(--v-text-link-focus, 4, 112, 236, 1))}:host(.v-text-link-visited),.v-text-link-visited{color:rgba(var(--v-text-link-visited, 95, 56, 206, 1))}:host(.v-text-on-action),.v-text-on-action{color:rgba(var(--v-text-on-action, 252, 252, 252, 1))}:host(.v-text-on-danger),.v-text-on-danger{color:rgba(var(--v-text-on-danger, 252, 252, 252, 1))}:host(.v-text-on-disabled),.v-text-on-disabled{color:rgba(var(--v-text-on-disabled, 252, 252, 252, 1))}:host(.v-text-sidebar-link),.v-text-sidebar-link{color:rgba(var(--v-text-sidebar-link, 188, 186, 213, 1))}:host(.v-text-sidebar-link-hover),.v-text-sidebar-link-hover{color:rgba(var(--v-text-sidebar-link-hover, 18, 18, 39, 1))}:host(.v-text-sidebar-link-selected),.v-text-sidebar-link-selected{color:rgba(var(--v-text-sidebar-link-selected, 252, 252, 252, 1))}:host(.v-text-site-footer-link),.v-text-site-footer-link{color:rgba(var(--v-text-site-footer-link, 171, 198, 216, 1))}:host(.v-text-site-footer-link-hover),.v-text-site-footer-link-hover{color:rgba(var(--v-text-site-footer-link-hover, 199, 217, 229, 1))}:host(.v-text-site-footer-link-active),.v-text-site-footer-link-active{color:rgba(var(--v-text-site-footer-link-active, 143, 179, 203, 1))}:host(.v-text-success),.v-text-success{color:rgba(var(--v-text-success, 1, 128, 31, 1))}:host(.v-text-inverted-success),.v-text-inverted-success{color:rgba(var(--v-text-inverted-success, 89, 217, 119, 1))}:host(.v-text-accent1-primary),.v-text-accent1-primary{color:rgba(var(--v-text-accent1-primary, 115, 230, 220, 1))}:host(.v-text-accent2-primary),.v-text-accent2-primary{color:rgba(var(--v-text-accent2-primary, 128, 107, 255, 1))}:host(.v-text-accent3-primary),.v-text-accent3-primary{color:rgba(var(--v-text-accent3-primary, 255, 220, 131, 1))}:host(.v-text-accent4-primary),.v-text-accent4-primary{color:rgba(var(--v-text-accent4-primary, 255, 149, 113, 1))}:host(.v-text-accent5-primary),.v-text-accent5-primary{color:rgba(var(--v-text-accent5-primary, 0, 187, 255, 1))}:host(.v-text-accent6-primary),.v-text-accent6-primary{color:rgba(var(--v-text-accent6-primary, 240, 52, 91, 1))}:host(.v-text-accent7-primary),.v-text-accent7-primary{color:rgba(var(--v-text-accent7-primary, 37, 159, 159, 1))}:host(.v-text-accent8-primary),.v-text-accent8-primary{color:rgba(var(--v-text-accent8-primary, 86, 61, 130, 1))}:host(.v-text-accent9-primary),.v-text-accent9-primary{color:rgba(var(--v-text-accent9-primary, 255, 191, 63, 1))}:host(.v-text-accent10-primary),.v-text-accent10-primary{color:rgba(var(--v-text-accent10-primary, 237, 122, 35, 1))}:host(.v-w-0),.v-w-0{width:0px}:host(.v-w-size-0),.v-w-size-0{width:0px}:host(.v-w-size-4),.v-w-size-4{width:4px}:host(.v-w-size-8),.v-w-size-8{width:8px}:host(.v-w-size-12),.v-w-size-12{width:12px}:host(.v-w-size-16),.v-w-size-16{width:16px}:host(.v-w-size-20),.v-w-size-20{width:20px}:host(.v-w-size-24),.v-w-size-24{width:24px}:host(.v-w-size-32),.v-w-size-32{width:32px}:host(.v-w-size-40),.v-w-size-40{width:40px}:host(.v-w-size-48),.v-w-size-48{width:48px}:host(.v-w-size-64),.v-w-size-64{width:64px}:host(.v-w-size-72),.v-w-size-72{width:72px}:host(.v-w-size-80),.v-w-size-80{width:80px}:host(.v-w-size-112),.v-w-size-112{width:112px}:host(.v-w-size-2),.v-w-size-2{width:2px}:host(.v-h-0),.v-h-0{height:0px}:host(.v-h-size-0),.v-h-size-0{height:0px}:host(.v-h-size-4),.v-h-size-4{height:4px}:host(.v-h-size-8),.v-h-size-8{height:8px}:host(.v-h-size-12),.v-h-size-12{height:12px}:host(.v-h-size-16),.v-h-size-16{height:16px}:host(.v-h-size-20),.v-h-size-20{height:20px}:host(.v-h-size-24),.v-h-size-24{height:24px}:host(.v-h-size-32),.v-h-size-32{height:32px}:host(.v-h-size-40),.v-h-size-40{height:40px}:host(.v-h-size-48),.v-h-size-48{height:48px}:host(.v-h-size-64),.v-h-size-64{height:64px}:host(.v-h-size-72),.v-h-size-72{height:72px}:host(.v-h-size-80),.v-h-size-80{height:80px}:host(.v-h-size-112),.v-h-size-112{height:112px}:host(.v-h-size-2),.v-h-size-2{height:2px}:host{display:inline-flex;user-select:none}i{line-height:1}:host(:not(.vega-auto-size)) ::slotted(svg){width:100%;height:100%}";export{b as vega_icon}
|
|
1
|
+
import{r as t,h as e,H as i,g as r}from"./p-6b2342e0.js";import{g as o,I as s}from"./p-16493e5b.js";import{h as a}from"./p-161b9c5b.js";import{s as v}from"./p-519a7d55.js";import{i as n}from"./p-a2d1c2f3.js";import{a as h}from"./p-d9671d27.js";import{V as c}from"./p-8c9ea6f4.js";import{L as p,I as l}from"./p-6e1ab235.js";import{V as x,I as d}from"./p-d849e0f5.js";import{t as m}from"./p-b75ee3ba.js";import"./p-ed45b3b6.js";import"./p-40f39194.js";import"./p-d884c644.js";import"./p-f69f84a7.js";import"./p-2d0d575f.js";import"./p-a528714c.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-301096ee.js";import"./p-10ac8b57.js";import"./p-262ec334.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-5f377954.js";import"./p-73383099.js";import"./p-ef9cbad1.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-4866e390.js";import"./p-697eb0e1.js";import"./p-8bd496b4.js";import"./p-451ddd84.js";import"./p-e3fa091a.js";import"./p-5b71c85e.js";import"./p-02841589.js";import"./p-bf19682d.js";import"./p-a7b5f497.js";import"./p-e77a83e4.js";import"./p-db8cdba6.js";import"./p-5d676a94.js";var g=function(t,e,i,r){var o,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var v=t.length-1;v>=0;v--)(o=t[v])&&(a=(s<3?o(a):s>3?o(e,i,a):o(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const b=class{constructor(e){t(this,e),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new x,this.size="size-16",this.cloneFAIconStyles=()=>{if(this.isThirdPartyIcon(this.icon)){const t=this.getIconStyleHTML();t&&this.appendStyles(t);let e=0;const i=window.setInterval((()=>{if(!(e<10))return p.warn("[Vega] Loading Font Awesome timeout.",this.icon),void clearInterval(i);{e++;const t=this.getIconStyleHTML();if(t)return this.appendStyles(t),void clearInterval(i)}}),300)}}}watchIcon(){this.cloneFAIconStyles()}componentWillLoad(){this.cloneFAIconStyles()}render(){const t=s.findIndex((t=>t===this.icon));if(c.hasIcon(this.icon)){const{icon:t,autoSize:e}=c.getIcon(this.icon);return this.renderForVegaIconToken(t,e?null:this.size,e)}return t>-1?this.renderForVegaIconToken(o(this.icon),this.size):this.renderForThirdPartyIcon()}isThirdPartyIcon(t){return!c.hasIcon(t)&&!s.find((e=>e===t))}renderForVegaIconToken(t,r,o=!1){const s=r?this.formatAndValidSize(this.size):null;return v(e(i,{class:h([s,this.color&&n(this.color),o&&"vega-auto-size"]),innerHTML:t},e("slot",null)),this.host)}renderForThirdPartyIcon(){return v(e(i,{class:h([this.color&&n(this.color)]),style:this.formatThirdPartyIconSize(this.size)},e("i",{part:"icon",class:this.icon})),this.host)}formatAndValidSize(t){return`v-w-${t} v-h-${t}`}formatThirdPartyIconSize(t){return{"font-size":`${a[t]}px`}}appendStyles(t){var e;if(t&&m()){const i=null!==(e=this.host.shadowRoot.querySelector("#fa-icon-styles"))&&void 0!==e?e:m().createElement("style");i.id="fa-icon-styles",i.innerHTML=t,this.host.shadowRoot.appendChild(i)}}getIconStyleHTML(){var t;if(b.iconStyleCache.has(this.icon))return b.iconStyleCache.get(this.icon);if(m()){const e=m().createElement("i");e.className=this.icon,e.style.display="none",m().body.appendChild(e);const i=getComputedStyle(e);if(null===(t=i.fontFamily)||void 0===t?void 0:t.includes("Font Awesome")){const t=getComputedStyle(e,"::before"),r=getComputedStyle(e,"::after"),o=`\n\t\t\t\ti {\n\t\t\t\t\tfont-weight: ${i.fontWeight};\n\t\t\t\t\tfont-family: ${i.fontFamily};\n\t\t\t\t\tfont-style: ${i.fontStyle};\n\t\t\t\t\tposition: ${i.position};\n\t\t\t\t\tletter-spacing: ${i.letterSpacing};\n\t\t\t\t}\n\t\t\t\ti::before {\n\t\t\t\t\tcontent: ${t.content};\n\t\t\t\t\tposition: ${t.position};\n\t\t\t\t\topacity: ${t.opacity};\n\t\t\t\t}\n\t\t\t\ti::after {\n\t\t\t\t\tcontent: ${r.content};\n\t\t\t\t\tposition: ${r.position};\n\t\t\t\t\topacity: ${r.opacity};\n\t\t\t\t}\n\t\t\t`.replace(/[\n\t]/gi,"");return b.iconStyleCache.set(this.icon,o),m().body.removeChild(e),o}return m().body.removeChild(e),null}}get host(){return r(this)}static get watchers(){return{icon:["watchIcon"]}}};b.iconStyleCache=new Map,g([d()],b.prototype,"globalSlimmers",void 0),g([l()],b.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),b.style=":host(.v-text-primary),.v-text-primary{color:rgba(var(--v-text-primary, 32, 54, 69, 1))}:host(.v-text-secondary),.v-text-secondary{color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}:host(.v-text-inverted-primary),.v-text-inverted-primary{color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}:host(.v-text-inverted-secondary),.v-text-inverted-secondary{color:rgba(var(--v-text-inverted-secondary, 188, 186, 213, 1))}:host(.v-text-black),.v-text-black{color:rgba(var(--v-text-black, 32, 54, 69, 1))}:host(.v-text-white),.v-text-white{color:rgba(var(--v-text-white, 252, 252, 252, 1))}:host(.v-text-brand),.v-text-brand{color:rgba(var(--v-text-brand, 51, 57, 61, 1))}:host(.v-text-danger-link),.v-text-danger-link{color:rgba(var(--v-text-danger-link, 230, 50, 87, 1))}:host(.v-text-danger-link-hover),.v-text-danger-link-hover{color:rgba(var(--v-text-danger-link-hover, 233, 71, 104, 1))}:host(.v-text-danger-link-active),.v-text-danger-link-active{color:rgba(var(--v-text-danger-link-active, 189, 41, 71, 1))}:host(.v-text-danger-link-focus),.v-text-danger-link-focus{color:rgba(var(--v-text-danger-link-focus, 240, 52, 91, 1))}:host(.v-text-danger-link-visited),.v-text-danger-link-visited{color:rgba(var(--v-text-danger-link-visited, 230, 50, 87, 1))}:host(.v-text-disabled),.v-text-disabled{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host(.v-text-error),.v-text-error{color:rgba(var(--v-text-error, 189, 41, 71, 1))}:host(.v-text-input-disabled),.v-text-input-disabled{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}:host(.v-text-input-placeholder),.v-text-input-placeholder{color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}:host(.v-text-link),.v-text-link{color:rgba(var(--v-text-link, 19, 98, 226, 1))}:host(.v-text-link-hover),.v-text-link-hover{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host(.v-text-link-active),.v-text-link-active{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host(.v-text-link-focus),.v-text-link-focus{color:rgba(var(--v-text-link-focus, 4, 112, 236, 1))}:host(.v-text-link-visited),.v-text-link-visited{color:rgba(var(--v-text-link-visited, 95, 56, 206, 1))}:host(.v-text-on-action),.v-text-on-action{color:rgba(var(--v-text-on-action, 252, 252, 252, 1))}:host(.v-text-on-danger),.v-text-on-danger{color:rgba(var(--v-text-on-danger, 252, 252, 252, 1))}:host(.v-text-on-disabled),.v-text-on-disabled{color:rgba(var(--v-text-on-disabled, 252, 252, 252, 1))}:host(.v-text-sidebar-link),.v-text-sidebar-link{color:rgba(var(--v-text-sidebar-link, 188, 186, 213, 1))}:host(.v-text-sidebar-link-hover),.v-text-sidebar-link-hover{color:rgba(var(--v-text-sidebar-link-hover, 18, 18, 39, 1))}:host(.v-text-sidebar-link-selected),.v-text-sidebar-link-selected{color:rgba(var(--v-text-sidebar-link-selected, 252, 252, 252, 1))}:host(.v-text-site-footer-link),.v-text-site-footer-link{color:rgba(var(--v-text-site-footer-link, 171, 198, 216, 1))}:host(.v-text-site-footer-link-hover),.v-text-site-footer-link-hover{color:rgba(var(--v-text-site-footer-link-hover, 199, 217, 229, 1))}:host(.v-text-site-footer-link-active),.v-text-site-footer-link-active{color:rgba(var(--v-text-site-footer-link-active, 143, 179, 203, 1))}:host(.v-text-success),.v-text-success{color:rgba(var(--v-text-success, 1, 128, 31, 1))}:host(.v-text-inverted-success),.v-text-inverted-success{color:rgba(var(--v-text-inverted-success, 89, 217, 119, 1))}:host(.v-text-accent1-primary),.v-text-accent1-primary{color:rgba(var(--v-text-accent1-primary, 115, 230, 220, 1))}:host(.v-text-accent2-primary),.v-text-accent2-primary{color:rgba(var(--v-text-accent2-primary, 128, 107, 255, 1))}:host(.v-text-accent3-primary),.v-text-accent3-primary{color:rgba(var(--v-text-accent3-primary, 255, 220, 131, 1))}:host(.v-text-accent4-primary),.v-text-accent4-primary{color:rgba(var(--v-text-accent4-primary, 255, 149, 113, 1))}:host(.v-text-accent5-primary),.v-text-accent5-primary{color:rgba(var(--v-text-accent5-primary, 0, 187, 255, 1))}:host(.v-text-accent6-primary),.v-text-accent6-primary{color:rgba(var(--v-text-accent6-primary, 240, 52, 91, 1))}:host(.v-text-accent7-primary),.v-text-accent7-primary{color:rgba(var(--v-text-accent7-primary, 37, 159, 159, 1))}:host(.v-text-accent8-primary),.v-text-accent8-primary{color:rgba(var(--v-text-accent8-primary, 86, 61, 130, 1))}:host(.v-text-accent9-primary),.v-text-accent9-primary{color:rgba(var(--v-text-accent9-primary, 255, 191, 63, 1))}:host(.v-text-accent10-primary),.v-text-accent10-primary{color:rgba(var(--v-text-accent10-primary, 237, 122, 35, 1))}:host(.v-w-0),.v-w-0{width:0px}:host(.v-w-size-0),.v-w-size-0{width:0px}:host(.v-w-size-4),.v-w-size-4{width:4px}:host(.v-w-size-8),.v-w-size-8{width:8px}:host(.v-w-size-12),.v-w-size-12{width:12px}:host(.v-w-size-16),.v-w-size-16{width:16px}:host(.v-w-size-20),.v-w-size-20{width:20px}:host(.v-w-size-24),.v-w-size-24{width:24px}:host(.v-w-size-32),.v-w-size-32{width:32px}:host(.v-w-size-40),.v-w-size-40{width:40px}:host(.v-w-size-48),.v-w-size-48{width:48px}:host(.v-w-size-64),.v-w-size-64{width:64px}:host(.v-w-size-72),.v-w-size-72{width:72px}:host(.v-w-size-80),.v-w-size-80{width:80px}:host(.v-w-size-112),.v-w-size-112{width:112px}:host(.v-w-size-2),.v-w-size-2{width:2px}:host(.v-h-0),.v-h-0{height:0px}:host(.v-h-size-0),.v-h-size-0{height:0px}:host(.v-h-size-4),.v-h-size-4{height:4px}:host(.v-h-size-8),.v-h-size-8{height:8px}:host(.v-h-size-12),.v-h-size-12{height:12px}:host(.v-h-size-16),.v-h-size-16{height:16px}:host(.v-h-size-20),.v-h-size-20{height:20px}:host(.v-h-size-24),.v-h-size-24{height:24px}:host(.v-h-size-32),.v-h-size-32{height:32px}:host(.v-h-size-40),.v-h-size-40{height:40px}:host(.v-h-size-48),.v-h-size-48{height:48px}:host(.v-h-size-64),.v-h-size-64{height:64px}:host(.v-h-size-72),.v-h-size-72{height:72px}:host(.v-h-size-80),.v-h-size-80{height:80px}:host(.v-h-size-112),.v-h-size-112{height:112px}:host(.v-h-size-2),.v-h-size-2{height:2px}:host{display:inline-flex;user-select:none}i{line-height:1}:host(:not(.vega-auto-size)) ::slotted(svg){width:100%;height:100%}";export{b as vega_icon}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-8bd496b4.js";import{b as s,c as n}from"./p-5b71c85e.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-161b9c5b.js";import{g as c}from"./p-a4670e23.js";import{V as a}from"./p-ef9cbad1.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-d9671d27.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const T=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const s=this.rootDomToContentEntity.get(t);s&&s!==e&&this.contentEntityToRootDom.delete(s),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var x,E,g,w;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE",t.INSERT_NODE_TO_NEAREST_ROOT="INSERT_NODE_TO_NEAREST_ROOT",t.PASTE_CONTENT="PASTE_CONTENT"}(x||(x={}));class m{constructor(){this.isFlushable=!1}}class A extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new A("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){const s=this.toJsx(t,e);return Object.entries(s).map((([t,e])=>{const s="string"==typeof e?e:this.formatStyleToString(e);return`${r(t)}="${s}"`})).join(" ")}toJsx(t,e){const s=this.getStyle(t,e),n=this.getClass(t,e),r=this.getAttribute(t);return n.length>0&&(r.class=n.join(" ")),s&&Object.keys(s).length>0&&(r.style=s),r}getClass(t,e){const s=[];return t.link.customClass&&s.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&s.push("v-rte--link"),s}getStyle(t,e){const s={};return t.link.customStyle&&Object.assign(s,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&(s.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),s}getAttribute(t){const{href:e,customAttribute:s={}}=t.link,n=t.useInternalStyle,r=s.target||(n?"_blank":"");return Object.assign(Object.assign(Object.assign({},s),e||n?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${r(t)}: ${e};`)).join(" ")}}class O extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new O(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new O(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class N extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new N(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new N(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class R{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).has(t)||this.registry.get(e).set(t,new Set),this.registry.get(e).get(t).add(s)}static unregister(t,e,s){const n=this.registry.get(e);if(n){const e=n.get(t);e&&e.delete(s)}}static get(t,e){const s=t instanceof m?t.type:t.constructor.name,n=this.registry.get(e.constructor.name);if(n){const r=n.get(s);if(r&&r.size>0)return Array.from(r).find((s=>s.canIntercept(t,e)))}}}R.registry=new Map;class y{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static unregister(t,e){const s=this.registry.get(e);s&&s.delete(t)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=R.get(t,e),n=()=>{const s=t instanceof m?t.type:t.constructor.name,n=y.get(s,e.constructor.name);if(n)return t.executedFlag=!0,n.execute(t,e);i.warn(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)};return s?s.intercept(n,t,e):n()}static canHandle(t,e){return!!y.get(t,e.constructor.name)}}y.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(E||(E={}));class S extends p{}class C extends S{constructor(t){super(),this.type=E.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[E.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(o)}render(t={}){var e;const s=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete s[t])),Object.keys(s).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===s[t]&&(s[t]="true")})),s}}class b extends S{constructor(t){super(),this.type=E.CUSTOM_CLASS,this.customClass=t}static from(t){return[E.CUSTOM_CLASS,new b(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new b(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class k extends S{constructor(t){super(),this.type=E.CUSTOM_STYLE,this.customStyle=t}static from(t){return[E.CUSTOM_STYLE,new k(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new k(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class B extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new B(t)]}clone(){return new B(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}!function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(g||(g={}));class v extends p{}class _{constructor(t){this.dtoType=t instanceof RTEBlock?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,s){return s=s||this.toJSON(t,e),Object.entries(Object.assign({},s)).map((([t,e])=>`${r(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const s=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof k)).map((e=>e.renderStyle(t))).filter(o);return e&&e.length>0?this.mergeAnnotationStyles(s,e):s.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof f:t instanceof v}mergeAnnotationStyles(t,e){const s={};for(const n of t)for(const t in n){const r=n[t],i=s[t];s[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return s}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(w||(w={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,s){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${s}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return C.from(e);case"customClass":return b.from(e);case"customStyle":return k.from(e)}}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}getStyles(t={standalone:!1}){return new _(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof v||t instanceof b)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(E.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return T.getDOMByEntity(this)}generateAttributeString(...t){var e;const s=new _(this).toCssText({standalone:!0},["textDecoration"]),n=this.annotationMap.get(E.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==n?void 0:n.toString(),s?`style="${s}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}const L=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,s){return t.map((t=>{const n=L.getRTEBlockClass(t.type);if(n){const r=n.from(t,e);return r.parent=s,r}})).filter(o)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return O.from(e);case"indent":return N.from(e);case"customAttribute":return C.from(e);case"customClass":return b.from(e);case"customStyle":return k.from(e);case"internalWrapper":return B.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,s])=>{const n=this.createAnnotationEntity(e,s);o(n)&&t.set(...n)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof A||t instanceof B))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof S)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(n){if(this.doApply(n),n.isFlushable){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new _(this).toJSON(t);return Object.assign(Object.assign({},e),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof b)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(E.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const s=new _(this).toCssText({standalone:!0}),n=this.annotationMap.get(E.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==n?void 0:n.toString(),s?`style="${s}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?y.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof A||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class j{}class D extends j{constructor(){super(...arguments),this.doSplit=!0}}class I extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new I(this.range)}}class $ extends v{constructor(t){super(),this.type=g.STRIKETHROUGH,this.strikethrough=t}static from(t){return[g.STRIKETHROUGH,new $(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new $(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class M extends v{constructor(t){super(),this.type=g.UNDERLINE,this.underline=t}static from(t){return[g.UNDERLINE,new M(t)]}toJSON(){return{underline:this.underline}}clone(){return new M(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class H extends v{constructor(t){super(),this.type=g.ITALIC,this.italic=t}static from(t){return[g.ITALIC,new H(t)]}toJSON(){return{italic:this.italic}}clone(){return new H(this.italic)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class P extends v{constructor(t){super(),this.type=g.BOLD,this.bold=t}static from(t){return[g.BOLD,new P(t)]}toJSON(){return{bold:this.bold}}clone(){return new P(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class J extends v{constructor(t,e=!0){super(),this.type=g.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[g.CODE,new J(t,e)]}toJSON(){return{code:this.code}}clone(){return new J(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const K={key:"black",light:"#111128",dark:"#E3E3E8"},F=[K,{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],U="",W=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]];class G extends v{constructor(t){super(),this.type=g.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[g.TEXT_COLOR,new G(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new G(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:a.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return F.find((e=>e.key===t))||F[0]}}class z extends v{constructor(t,e=!0){super(),this.type=g.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[g.LINK,new z(t,e)]}toJSON(){return{link:this.link}}clone(){return new z(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class V extends j{constructor(t,e,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=s}toAnnotation(){return new A(this.groupKey)}}class X extends j{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class q{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const s=t.annotationMap.get(E.CUSTOM_STYLE);s&&this.isCustomStyle(s,e)&&t.annotationMap.set(s.type,new k(s.removeStyles(e)))}createNewParagraph(t){const e=L.getRTEBlockClass("paragraph");if(e)return e.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,s){return e===t.children[0]&&0===s}isCaretPositionAtBlockEnd(t,e,s){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,s):this.isCaretPositionAtDecoratorBlockEnd(t,e,s)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.children[t.children.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,s){return e===t.children[t.children.length-1]&&0!==s}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class Y extends m{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Q extends q{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof D&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:r,endOffset:i}=s.range,o=t===n&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(s.range)&&e.isContentEditable()){const n=this.splitTextNode(s.range,e);return t.annotationMap.has("LINK")&&t.apply(new Y(n)),n}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");this.setApplyTargetNode(s);const n=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===n?[s,e]:t===e.text.length||!e.isContentEditable()&&t===n+1?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:r}=t;return e!==s||n>0||r<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:r}=t,i=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const r=t.substring(0,s),i=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&T.getEntityByDOM(i),l=o&&T.getEntityByDOM(o);if(a&&a.id===e.id){const i=s===n?t.endOffset:e.text.length,[o,a,l]=c(e.text,r,i);return this.setApplyTargetNode(a),[o,a,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[s,n,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Z extends D{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new P(this.bold)}}class tt extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[g.BOLD,g.ITALIC,g.UNDERLINE,g.STRIKETHROUGH,g.TEXT_COLOR,g.CODE,E.CUSTOM_STYLE]}}class et extends D{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new tt}}class st extends D{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new J(this.code)}}class nt extends j{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class rt extends D{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new H(this.italic)}}class it extends D{constructor({link:t,newText:e,needMergeNode:s,doSplit:n,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=s,this.newText=e,this.type=r,o(n)&&(this.doSplit=n)}toAnnotation(){return new z(this.link)}}class ot extends D{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new $(this.strikethrough)}}class ct extends D{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new M(this.underline)}}class at extends q{handleAction(t,e){const s=t.toAnnotation();if(t instanceof nt)e.annotationMap.delete(t.annotationType);else{if(!(s instanceof tt))return s instanceof v||s instanceof I?(t instanceof it&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new V(t.link.groupKey,[e],t.type))),t instanceof st&&this.handleAction(new et,e),t instanceof Z&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof rt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ct||t instanceof ot)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(s.type,s)):void 0;s.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class lt extends m{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class ht extends q{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new lt)}}class ut extends m{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class dt extends q{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:r,startOffset:i,endOffset:o}=e;let c=s.text;if(n===r&&i===o&&t)c=s.text.slice(0,i)+t+s.text.slice(i);else{const e=n.parentElement,a=r.parentElement,l=e&&T.getEntityByDOM(e),h=a&&T.getEntityByDOM(a);let u=0,d=s.text.length;l&&l===s?(u=i,d=n===r?o:d):h&&h===s&&(d=o),c=s.text.slice(0,u)+t+s.text.slice(d)}s.apply(new ut(c))}}}class pt extends p{constructor(t){super(),this.type=g.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:s,customStyle:n,customClass:r,customAttribute:i}=t,o=new pt(e);return o.child=s?pt.from(s)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?b.from(r)[1]:void 0,o.customStyle=n?k.from(n)[1]:void 0,[g.INLINE_HTML,o]}clone(){var t,e,s,n;const r=new pt(this.htmlTag);return r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(s=this.customClass)||void 0===s?void 0:s.clone(),r.customStyle=null===(n=this.customStyle)||void 0===n?void 0:n.clone(),r}toJSON(){var t,e,s,n;return{inlineHtml:l({htmlTag:this.htmlTag,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(s=this.customClass)||void 0===s?void 0:s.toJSON().customClass,customStyle:null===(n=this.customStyle)||void 0===n?void 0:n.toJSON().customStyle})}}}class ft extends q{handleAction(t,e){const s=e.parent.getAnnotationByType(u.LINK_GROUP);if(s){const n=e.annotationMap.get("LINK").link.groupKey,r=s.linkGroups.get(n);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),s.linkGroups.set(n,r))}}}}class Tt extends q{handleAction(t,e){const s=e.parent.getAnnotationByType(u.LINK_GROUP);if(s){const t=e.annotationMap.get(g.LINK).link.groupKey,n=s.linkGroups.get(t);if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&s.linkGroups.delete(t),0===s.linkGroups.size&&e.parent.annotationMap.delete(u.LINK_GROUP)}}e.annotationMap.delete(g.LINK)}}class xt extends v{constructor(t){super(),this.type=g.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[g.PLAIN_TEXT,new xt(t)]}clone(){return new xt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return{plainText:this.plainText}}}class Et extends D{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new G(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,s,n){super(t,n),this.type=w.TEXT,this.parent=s,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,s={autoMatchFormat:!0}){const n=new RTETextNode(t.id,t.text,e),{annotations:r}=t;return r&&(n.annotationMap=this.generateTextAnnotationMap(r,s,e,n)),n}static generateTextAnnotationMap(t,e,s,n){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&s&&n&&s.apply(new V(t.link.groupKey,[n],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(o))}static createAnnotationEntity(t,e,s){const n=!(!s||!s.autoMatchFormat);switch(t){case"bold":return P.from(e);case"italic":return H.from(e);case"underline":return M.from(e);case"strikethrough":return $.from(e);case"code":return J.from(e,n);case"textColor":return G.from(e);case"link":return z.from(e,n);case"inlineHtml":return pt.from(e);case"plainText":return xt.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof v||t instanceof S||t instanceof pt)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}toHtml(){const t=this.getAnnotationByType(g.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new RTETextNode(c(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=this.getElementRef();if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(y.register(x.UPDATE_TEXT,t,new ht),y.register(x.REPLACE_SELECTED_TEXT,t,new dt),y.register(x.LINK_GROUP_NODE_SPLIT,t,new ft),y.register(it.name,t,new at)),y.register(D.name,t,new Q),y.register(x.DELETE_LINK_GROUP,t,new Tt),y.register(Z.name,t,new at),y.register(et.name,t,new at),y.register(rt.name,t,new at),y.register(ct.name,t,new at),y.register(Et.name,t,new at),y.register(ot.name,t,new at),y.register(st.name,t,new at),y.register(j.name,t,new at),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof D&&t.doSplit&&e){const e=y.get(D.name,this.constructor.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){y.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof X)return void this.syncUpSelectedNodes(t);s instanceof I||this.syncUpSelectedNodes(t);const n=y.get(e.constructor.name,t.constructor.name);if(n)return void n.execute(e,t);const r=y.get(j.name,RTETextNode.name);r&&r.execute(e,t)}syncUpSelectedNodes(s){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,n);i&&t.notify(i,{node:s})}}renderWithWrapperStr(t){const{htmlTag:e,customAttribute:s,customClass:n,customStyle:r,child:i}=t,c=[...(null==s?void 0:s.toString())||[],null==n?void 0:n.toString(),null==r?void 0:r.toString()].filter(o),a=c.length>0?` ${c.join(" ")}`:"";return i?`<${e}${a}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${a}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(g.CODE))||void 0===t?void 0:t.code)?"code":"span",s=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${s}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(g.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof v&&!(t instanceof z)&&!(t instanceof xt)||t instanceof S)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class gt extends m{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},s=Object.assign(Object.assign({},e),{marginTop:"0px",marginBottom:"0px"});switch(this.textStyle){case"paragraph":return s;case"title":return Object.assign(Object.assign({},e),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"});case"subtitle":return Object.assign(Object.assign({},e),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"});case"heading-1":return Object.assign(Object.assign({},e),{fontSize:"22px",lineHeight:"24px",minHeight:"24px",marginTop:"0px",marginBottom:"0px"});case"heading-2":return Object.assign(Object.assign({},e),{fontSize:"20px",lineHeight:"24px",minHeight:"24px",marginTop:"0px",marginBottom:"0px"});case"heading-3":return Object.assign(Object.assign({},e),{fontSize:"18px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-4":return Object.assign(Object.assign({},e),{fontSize:"16px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-5":return Object.assign(Object.assign({},e),{fontSize:"14px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-6":return Object.assign(Object.assign({},e),{fontSize:"12px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"})}}}class mt extends j{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class At extends q{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Z(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new nt(g.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Ot extends m{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Nt extends m{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Rt extends q{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),r=t.text.slice(e),i=s.children.indexOf(t);if(i>-1){const e=s.children.slice(0,i),o=s.children.slice(i+1);n&&e.push(t.cloneWithText(n)),r&&o.unshift(t.cloneWithText(r)),s.apply(new Nt(e));const c=s.cloneWithNodes(o);return s.parent.apply(new Ot(s,c)),c}}}}class yt extends q{handleAction(t,e){e.children=[],e.apply(new gt(t.newChildNodes))}}class St extends m{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ct extends q{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.children;"image"!==s.type&&(t=s.children.filter((t=>t.text))),e.apply(new gt(t)),s.parent.apply(new St(s))}}}class bt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new RTETextNode(c(),"\n",s),r=t.text.slice(0,e),i=t.text.slice(e),o=s.children.indexOf(t);if(o>-1){const e=s.children.slice(0,o),c=s.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,n,c,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(c(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Nt([...t,e,...s]))}}class kt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.children,n=new RTETextNode(c(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,r,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new St(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(c(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Nt([...t,e,...s]))}}class Bt extends m{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class vt extends m{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class _t extends j{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new O(this.textAlign)}}class Lt extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class jt extends j{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new N(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,s){super(t),this.children=[],this.type=e;const{autoMatchFormat:n}=s||{autoMatchFormat:!0};n&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var s,n;const r=new RTETextBlock(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(n=null===(s=t.annotations)||void 0===s?void 0:s.textStyle)&&void 0!==n?n:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const s=L.getRTENodeClass(t.type);if(s)return s.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.children=this.children.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof it&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(g.LINK),r=s.getAnnotationByType(g.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(){const t=this.getBlockTag(),e=super.generateAttributeString(),s=this.getChildrenHtml();return super.shouldRenderAsInternalWrapper()?s:[`<${t}${e}>`,s,`</${t}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(c(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new gt(t)),e}clone(t){const e=new RTETextBlock(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}getChildrenHtml(){const t=this.getAnnotationByType(u.LINK_GROUP);let e=this.children.map((t=>t.toHtml())).join("");return t&&this.children.length>0&&(e=this.generateLinkHtml(t,e)),e}doAnnotationActionApply(t){const e=y.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}generateLinkHtml(t,e){e="";let s=[];for(let n=0;n<this.children.length;n++){const r=this.children[n].getAnnotationByType(g.LINK),i=this.children[n+1]?this.children[n+1].getAnnotationByType(g.LINK):null;if(r){if(s.push(this.children[n]),!i||r.link.groupKey!==i.link.groupKey){const n=t.toString(r,{standalone:!0});e+=[`<a${n?` ${n}`:""}>`,s.map((t=>t.toHtml())).join(""),"</a>"].join(""),s=[]}}else e+=this.children[n].toHtml()}return e}}y.register(mt.name,RTETextBlock.name,new At),y.register(_t.name,RTETextBlock.name,new Lt),y.register(jt.name,RTETextBlock.name,new class extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),y.register(V.name,RTETextBlock.name,new class extends q{handleAction(t,e){let s=e.getAnnotationByType(u.LINK_GROUP);if("update_link"===t.type){if(s){const e=s.linkGroups.get(t.groupKey);e&&s.linkGroups.set(t.groupKey,[e[0]])}}else{if(s){const e=s.linkGroups.get(t.groupKey)||[];s.linkGroups.set(t.groupKey,[...e,...t.nodes])}else s=t.toAnnotation(),s.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(u.LINK_GROUP,s)}}}),y.register(x.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends q{handleAction(t,e){const s=e.getAnnotationByType(u.LINK_GROUP);s&&(s.linkGroups.size>1?s.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),y.register(x.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new Rt),y.register(x.REPLACE_CHILD_NODES,RTETextBlock.name,new yt),y.register(x.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ct),y.register(x.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new bt),y.register(x.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new kt),y.register(x.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,s,n))e.parent.apply(new Ot(e,r));else if(this.isCaretPositionAtBlockStart(e,s,n))e.parent.apply(new Bt(e,r));else{const t=new vt(s,n);e.apply(t),e.parent.apply(new Ot(e,r))}}}),y.register(x.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>s.toListItem(t)));n.apply(new gt(i)),s.apply(new Ot(t.selectedBlocks[0],n)),r.forEach((t=>{t.parent.apply(new St(t))}))}});class Dt extends q{getPreviousNode(t){const e=t.parent,s=e.children.indexOf(t);if(s>0)return e.children[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,s=e.children.indexOf(t);if(e.children[s+1])return e.children[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,s=e.children.indexOf(t),n=e.parent;if(e.isListItemBlock()){const t=n.parent;return 0===s&&Array.isArray(n.children)&&n.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===n}return 0===s&&Array.isArray(n.children)&&n.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(this.isRTEBlock(t.parent)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}isRTEBlock(t){return t&&"VegaRTEContent"!==t.constructor.name}}class It extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class $t extends j{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new I(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return h(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,s,n){super(t),this.type=w.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=n,this.language=s}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){y.executeTheStrategy(t,this)}doModifyActionApply(t){y.executeTheStrategy(t,this)}}y.register(x.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends q{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),y.register($t.name,RTECodeBlockNode.name,new class extends q{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var Mt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Mt||(Mt={}));class Ht extends q{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new St(e)))}}class RTECodeBlock extends RTEBlock{constructor(t,e,s){super(t),this.type="code-block",this.children=[new RTECodeBlockNode(`${t}-1`,e,s,this)]}static from(t){return new RTECodeBlock(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(){const{language:t=Mt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(n){if(n instanceof m&&y.executeTheStrategy(n,this),n.isFlushable){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(u.SELECTION_RANGE)}}y.register(x.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Dt{handleAction(t,e){const s=e.children[0],n=e.parent;if(n){let t=this.getPreviousNode(s),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),r=0),n.apply(new St(e));const i=t?T.getDOMByEntity(t):null;if(0===n.children.length){const s=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:""}]});e.parent.apply(new gt([s])),t=s.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(s,r,i,o){const c=T.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,n);o&&t.notify(o,{node:s,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),y.register(x.DELETE_CHILDREN,RTECodeBlock.name,new Ht),y.register(x.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends q{handleAction(s,r){const{content:i,language:o}=s,a=i.split("\n"),l=new It(a.slice(0,a.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),text:"",type:"text"}]});r.parent.apply(new Ot(r,h));const u=T.getDOMByEntity(r);if(u){const s=e.getSubjectFromParentNodeByEventId(u,n);s&&t.notify(s,{node:h.children[0]})}}}),y.register(x.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends q{handleAction(t,e){e.parent.apply(new Ot(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{Et as $,y as A,At as B,C,w as D,S as E,j as F,Nt as G,_t as H,Ot as I,vt as J,Dt as K,Ht as L,m as M,v as N,F as O,K as P,Mt as Q,L as R,X as S,mt as T,ut as U,W as V,it as W,E as X,It as Y,U as Z,$t as _,R as a,RTECodeBlockNode as a0,Z as a1,rt as a2,ct as a3,wt as a4,P as a5,et as a6,st as a7,ot as a8,jt as a9,RTETextNode as b,x as c,q as d,RTETextBlock as e,RTEBlock as f,_ as g,gt as h,RTENode as i,Bt as j,u as k,Lt as l,bt as m,kt as n,Rt as o,yt as p,Ct as q,St as r,T as s,f as t,d as u,k as v,b as w,RTECodeBlock as x,g as y,RTEDecoratorNode as z}
|
|
1
|
+
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-8bd496b4.js";import{b as s,c as n}from"./p-5b71c85e.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-161b9c5b.js";import{g as c}from"./p-a4670e23.js";import{V as a}from"./p-ef9cbad1.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-d9671d27.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const T=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const s=this.rootDomToContentEntity.get(t);s&&s!==e&&this.contentEntityToRootDom.delete(s),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var x,E,g,w;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE",t.INSERT_NODE_TO_NEAREST_ROOT="INSERT_NODE_TO_NEAREST_ROOT",t.PASTE_CONTENT="PASTE_CONTENT"}(x||(x={}));class m{constructor(){this.isFlushable=!1}}class A extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new A("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){const s=this.toJsx(t,e);return Object.entries(s).map((([t,e])=>{const s="string"==typeof e?e:this.formatStyleToString(e);return`${r(t)}="${s}"`})).join(" ")}toJsx(t,e){const s=this.getStyle(t,e),n=this.getClass(t,e),r=this.getAttribute(t);return n.length>0&&(r.class=n.join(" ")),s&&Object.keys(s).length>0&&(r.style=s),r}getClass(t,e){const s=[];return t.link.customClass&&s.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&s.push("v-rte--link"),s}getStyle(t,e){const s={};return t.link.customStyle&&Object.assign(s,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&(s.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),s}getAttribute(t){const{href:e,customAttribute:s={}}=t.link,n=t.useInternalStyle,r=s.target||(n?"_blank":"");return Object.assign(Object.assign(Object.assign({},s),e||n?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${r(t)}: ${e};`)).join(" ")}}class O extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new O(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new O(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class N extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new N(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new N(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class R{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).has(t)||this.registry.get(e).set(t,new Set),this.registry.get(e).get(t).add(s)}static unregister(t,e,s){const n=this.registry.get(e);if(n){const e=n.get(t);e&&e.delete(s)}}static get(t,e){const s=t instanceof m?t.type:t.constructor.name,n=this.registry.get(e.constructor.name);if(n){const r=n.get(s);if(r&&r.size>0)return Array.from(r).find((s=>s.canIntercept(t,e)))}}}R.registry=new Map;class y{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static unregister(t,e){const s=this.registry.get(e);s&&s.delete(t)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=R.get(t,e),n=()=>{const s=t instanceof m?t.type:t.constructor.name,n=y.get(s,e.constructor.name);if(n)return t.executedFlag=!0,n.execute(t,e);i.warn(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)};return s?s.intercept(n,t,e):n()}static canHandle(t,e){return!!y.get(t,e.constructor.name)}}y.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(E||(E={}));class S extends p{}class C extends S{constructor(t){super(),this.type=E.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[E.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(o)}render(t={}){var e;const s=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete s[t])),Object.keys(s).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===s[t]&&(s[t]="true")})),s}}class b extends S{constructor(t){super(),this.type=E.CUSTOM_CLASS,this.customClass=t}static from(t){return[E.CUSTOM_CLASS,new b(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new b(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class k extends S{constructor(t){super(),this.type=E.CUSTOM_STYLE,this.customStyle=t}static from(t){return[E.CUSTOM_STYLE,new k(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new k(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class B extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new B(t)]}clone(){return new B(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}!function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(g||(g={}));class v extends p{}class _{constructor(t){this.dtoType=t instanceof RTEBlock?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,s){return s=s||this.toJSON(t,e),Object.entries(Object.assign({},s)).map((([t,e])=>`${r(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const s=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof k)).map((e=>e.renderStyle(t))).filter(o);return e&&e.length>0?this.mergeAnnotationStyles(s,e):s.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof f:t instanceof v}mergeAnnotationStyles(t,e){const s={};for(const n of t)for(const t in n){const r=n[t],i=s[t];s[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return s}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(w||(w={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,s){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${s}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return C.from(e);case"customClass":return b.from(e);case"customStyle":return k.from(e)}}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}getStyles(t={standalone:!1}){return new _(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof v||t instanceof b)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(E.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return T.getDOMByEntity(this)}generateAttributeString(...t){var e;const s=new _(this).toCssText({standalone:!0},["textDecoration"]),n=this.annotationMap.get(E.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==n?void 0:n.toString(),s?`style="${s}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}const L=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,s){return t.map((t=>{const n=L.getRTEBlockClass(t.type);if(n){const r=n.from(t,e);return r.parent=s,r}})).filter(o)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return O.from(e);case"indent":return N.from(e);case"customAttribute":return C.from(e);case"customClass":return b.from(e);case"customStyle":return k.from(e);case"internalWrapper":return B.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,s])=>{const n=this.createAnnotationEntity(e,s);o(n)&&t.set(...n)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof A||t instanceof B))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof S)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(n){if(this.doApply(n),n.isFlushable){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new _(this).toJSON(t);return Object.assign(Object.assign({},e),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof b)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(E.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const s=new _(this).toCssText({standalone:!0}),n=this.annotationMap.get(E.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==n?void 0:n.toString(),s?`style="${s}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?y.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof A||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class j{}class D extends j{constructor(){super(...arguments),this.doSplit=!0}}class I extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new I(this.range)}}class $ extends v{constructor(t){super(),this.type=g.STRIKETHROUGH,this.strikethrough=t}static from(t){return[g.STRIKETHROUGH,new $(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new $(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class M extends v{constructor(t){super(),this.type=g.UNDERLINE,this.underline=t}static from(t){return[g.UNDERLINE,new M(t)]}toJSON(){return{underline:this.underline}}clone(){return new M(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class H extends v{constructor(t){super(),this.type=g.ITALIC,this.italic=t}static from(t){return[g.ITALIC,new H(t)]}toJSON(){return{italic:this.italic}}clone(){return new H(this.italic)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class P extends v{constructor(t){super(),this.type=g.BOLD,this.bold=t}static from(t){return[g.BOLD,new P(t)]}toJSON(){return{bold:this.bold}}clone(){return new P(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class J extends v{constructor(t,e=!0){super(),this.type=g.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[g.CODE,new J(t,e)]}toJSON(){return{code:this.code}}clone(){return new J(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const K={key:"black",light:"#111128",dark:"#E3E3E8"},F=[K,{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],U="",W=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]];class G extends v{constructor(t){super(),this.type=g.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[g.TEXT_COLOR,new G(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new G(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:a.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return F.find((e=>e.key===t))||F[0]}}class z extends v{constructor(t,e=!0){super(),this.type=g.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[g.LINK,new z(t,e)]}toJSON(){return{link:this.link}}clone(){return new z(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class V extends j{constructor(t,e,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=s}toAnnotation(){return new A(this.groupKey)}}class X extends j{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class q{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const s=t.annotationMap.get(E.CUSTOM_STYLE);s&&this.isCustomStyle(s,e)&&t.annotationMap.set(s.type,new k(s.removeStyles(e)))}createNewParagraph(t){const e=L.getRTEBlockClass("paragraph");if(e)return e.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,s){return e===t.children[0]&&0===s}isCaretPositionAtBlockEnd(t,e,s){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,s):this.isCaretPositionAtDecoratorBlockEnd(t,e,s)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.children[t.children.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,s){return e===t.children[t.children.length-1]&&0!==s}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class Y extends m{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Q extends q{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof D&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:r,endOffset:i}=s.range,o=t===n&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(s.range)&&e.isContentEditable()){const n=this.splitTextNode(s.range,e);return t.annotationMap.has("LINK")&&t.apply(new Y(n)),n}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");this.setApplyTargetNode(s);const n=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===n?[s,e]:t===e.text.length||!e.isContentEditable()&&t===n+1?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:r}=t;return e!==s||n>0||r<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:r}=t,i=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const r=t.substring(0,s),i=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&T.getEntityByDOM(i),l=o&&T.getEntityByDOM(o);if(a&&a.id===e.id){const i=s===n?t.endOffset:e.text.length,[o,a,l]=c(e.text,r,i);return this.setApplyTargetNode(a),[o,a,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[s,n,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Z extends D{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new P(this.bold)}}class tt extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[g.BOLD,g.ITALIC,g.UNDERLINE,g.STRIKETHROUGH,g.TEXT_COLOR,g.CODE,E.CUSTOM_STYLE]}}class et extends D{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new tt}}class st extends D{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new J(this.code)}}class nt extends j{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class rt extends D{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new H(this.italic)}}class it extends D{constructor({link:t,newText:e,needMergeNode:s,doSplit:n,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=s,this.newText=e,this.type=r,o(n)&&(this.doSplit=n)}toAnnotation(){return new z(this.link)}}class ot extends D{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new $(this.strikethrough)}}class ct extends D{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new M(this.underline)}}class at extends q{handleAction(t,e){const s=t.toAnnotation();if(t instanceof nt)e.annotationMap.delete(t.annotationType);else{if(!(s instanceof tt))return s instanceof v||s instanceof I?(t instanceof it&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new V(t.link.groupKey,[e],t.type))),t instanceof st&&this.handleAction(new et,e),t instanceof Z&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof rt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ct||t instanceof ot)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(s.type,s)):void 0;s.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class lt extends m{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class ht extends q{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new lt)}}class ut extends m{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class dt extends q{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:r,startOffset:i,endOffset:o}=e;let c=s.text;if(n===r&&i===o&&t)c=s.text.slice(0,i)+t+s.text.slice(i);else{const e=n.parentElement,a=r.parentElement,l=e&&T.getEntityByDOM(e),h=a&&T.getEntityByDOM(a);let u=0,d=s.text.length;l&&l===s?(u=i,d=n===r?o:d):h&&h===s&&(d=o),c=s.text.slice(0,u)+t+s.text.slice(d)}s.apply(new ut(c))}}}class pt extends p{constructor(t){super(),this.type=g.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:s,customStyle:n,customClass:r,customAttribute:i}=t,o=new pt(e);return o.child=s?pt.from(s)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?b.from(r)[1]:void 0,o.customStyle=n?k.from(n)[1]:void 0,[g.INLINE_HTML,o]}clone(){var t,e,s,n;const r=new pt(this.htmlTag);return r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(s=this.customClass)||void 0===s?void 0:s.clone(),r.customStyle=null===(n=this.customStyle)||void 0===n?void 0:n.clone(),r}toJSON(){var t,e,s,n;return{inlineHtml:l({htmlTag:this.htmlTag,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(s=this.customClass)||void 0===s?void 0:s.toJSON().customClass,customStyle:null===(n=this.customStyle)||void 0===n?void 0:n.toJSON().customStyle})}}}class ft extends q{handleAction(t,e){const s=e.parent.getAnnotationByType(u.LINK_GROUP);if(s){const n=e.annotationMap.get("LINK").link.groupKey,r=s.linkGroups.get(n);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),s.linkGroups.set(n,r))}}}}class Tt extends q{handleAction(t,e){const s=e.parent.getAnnotationByType(u.LINK_GROUP);if(s){const t=e.annotationMap.get(g.LINK).link.groupKey,n=s.linkGroups.get(t);if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&s.linkGroups.delete(t),0===s.linkGroups.size&&e.parent.annotationMap.delete(u.LINK_GROUP)}}e.annotationMap.delete(g.LINK)}}class xt extends v{constructor(t){super(),this.type=g.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[g.PLAIN_TEXT,new xt(t)]}clone(){return new xt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class Et extends D{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new G(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,s,n){super(t,n),this.type=w.TEXT,this.parent=s,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,s={autoMatchFormat:!0}){const n=new RTETextNode(t.id,t.text,e),{annotations:r}=t;return r&&(n.annotationMap=this.generateTextAnnotationMap(r,s,e,n)),n}static generateTextAnnotationMap(t,e,s,n){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&s&&n&&s.apply(new V(t.link.groupKey,[n],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(o))}static createAnnotationEntity(t,e,s){const n=!(!s||!s.autoMatchFormat);switch(t){case"bold":return P.from(e);case"italic":return H.from(e);case"underline":return M.from(e);case"strikethrough":return $.from(e);case"code":return J.from(e,n);case"textColor":return G.from(e);case"link":return z.from(e,n);case"inlineHtml":return pt.from(e);case"plainText":return xt.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof v||t instanceof S||t instanceof pt)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}toHtml(){const t=this.getAnnotationByType(g.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new RTETextNode(c(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!this.text||""===this.text||"\n"===this.text}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=this.getElementRef();if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(y.register(x.UPDATE_TEXT,t,new ht),y.register(x.REPLACE_SELECTED_TEXT,t,new dt),y.register(x.LINK_GROUP_NODE_SPLIT,t,new ft),y.register(it.name,t,new at)),y.register(D.name,t,new Q),y.register(x.DELETE_LINK_GROUP,t,new Tt),y.register(Z.name,t,new at),y.register(et.name,t,new at),y.register(rt.name,t,new at),y.register(ct.name,t,new at),y.register(Et.name,t,new at),y.register(ot.name,t,new at),y.register(st.name,t,new at),y.register(j.name,t,new at),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof D&&t.doSplit&&e){const e=y.get(D.name,this.constructor.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){y.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof X)return void this.syncUpSelectedNodes(t);s instanceof I||this.syncUpSelectedNodes(t);const n=y.get(e.constructor.name,t.constructor.name);if(n)return void n.execute(e,t);const r=y.get(j.name,RTETextNode.name);r&&r.execute(e,t)}syncUpSelectedNodes(s){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,n);i&&t.notify(i,{node:s})}}renderWithWrapperStr(t){const{htmlTag:e,customAttribute:s,customClass:n,customStyle:r,child:i}=t,c=[...(null==s?void 0:s.toString())||[],null==n?void 0:n.toString(),null==r?void 0:r.toString()].filter(o),a=c.length>0?` ${c.join(" ")}`:"";return i?`<${e}${a}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${a}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(g.CODE))||void 0===t?void 0:t.code)?"code":"span",s=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${s}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(g.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof v&&!(t instanceof z)&&!(t instanceof xt)||t instanceof S)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class gt extends m{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},s=Object.assign(Object.assign({},e),{marginTop:"0px",marginBottom:"0px"});switch(this.textStyle){case"paragraph":return s;case"title":return Object.assign(Object.assign({},e),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"});case"subtitle":return Object.assign(Object.assign({},e),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"});case"heading-1":return Object.assign(Object.assign({},e),{fontSize:"22px",lineHeight:"24px",minHeight:"24px",marginTop:"0px",marginBottom:"0px"});case"heading-2":return Object.assign(Object.assign({},e),{fontSize:"20px",lineHeight:"24px",minHeight:"24px",marginTop:"0px",marginBottom:"0px"});case"heading-3":return Object.assign(Object.assign({},e),{fontSize:"18px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-4":return Object.assign(Object.assign({},e),{fontSize:"16px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-5":return Object.assign(Object.assign({},e),{fontSize:"14px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"});case"heading-6":return Object.assign(Object.assign({},e),{fontSize:"12px",lineHeight:"22px",minHeight:"22px",marginTop:"0px",marginBottom:"0px"})}}}class mt extends j{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class At extends q{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Z(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new nt(g.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Ot extends m{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Nt extends m{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Rt extends q{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),r=t.text.slice(e),i=s.children.indexOf(t);if(i>-1){const e=s.children.slice(0,i),o=s.children.slice(i+1);n&&e.push(t.cloneWithText(n)),r&&o.unshift(t.cloneWithText(r)),s.apply(new Nt(e));const c=s.cloneWithNodes(o);return s.parent.apply(new Ot(s,c)),c}}}}class yt extends q{handleAction(t,e){e.children=[],e.apply(new gt(t.newChildNodes))}}class St extends m{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ct extends q{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.children;"image"!==s.type&&(t=s.children.filter((t=>t.text))),e.apply(new gt(t)),s.parent.apply(new St(s))}}}class bt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new RTETextNode(c(),"\n",s),r=t.text.slice(0,e),i=t.text.slice(e),o=s.children.indexOf(t);if(o>-1){const e=s.children.slice(0,o),c=s.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,n,c,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(c(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Nt([...t,e,...s]))}}class kt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.children,n=new RTETextNode(c(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,r,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new St(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(c(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Nt([...t,e,...s]))}}class Bt extends m{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class vt extends m{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class _t extends j{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new O(this.textAlign)}}class Lt extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class jt extends j{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new N(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,s){super(t),this.children=[],this.type=e;const{autoMatchFormat:n}=s||{autoMatchFormat:!0};n&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var s,n;const r=new RTETextBlock(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(n=null===(s=t.annotations)||void 0===s?void 0:s.textStyle)&&void 0!==n?n:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const s=L.getRTENodeClass(t.type);if(s)return s.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.children=this.children.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof it&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(g.LINK),r=s.getAnnotationByType(g.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(){const t=this.getBlockTag(),e=super.generateAttributeString(),s=this.getChildrenHtml();return super.shouldRenderAsInternalWrapper()?s:[`<${t}${e}>`,s,`</${t}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(c(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new gt(t)),e}clone(t){const e=new RTETextBlock(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}getChildrenHtml(){const t=this.getAnnotationByType(u.LINK_GROUP);let e=this.children.map((t=>t.toHtml())).join("");return t&&this.children.length>0&&(e=this.generateLinkHtml(t,e)),e}doAnnotationActionApply(t){const e=y.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}generateLinkHtml(t,e){e="";let s=[];for(let n=0;n<this.children.length;n++){const r=this.children[n].getAnnotationByType(g.LINK),i=this.children[n+1]?this.children[n+1].getAnnotationByType(g.LINK):null;if(r){if(s.push(this.children[n]),!i||r.link.groupKey!==i.link.groupKey){const n=t.toString(r,{standalone:!0});e+=[`<a${n?` ${n}`:""}>`,s.map((t=>t.toHtml())).join(""),"</a>"].join(""),s=[]}}else e+=this.children[n].toHtml()}return e}}y.register(mt.name,RTETextBlock.name,new At),y.register(_t.name,RTETextBlock.name,new Lt),y.register(jt.name,RTETextBlock.name,new class extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),y.register(V.name,RTETextBlock.name,new class extends q{handleAction(t,e){let s=e.getAnnotationByType(u.LINK_GROUP);if("update_link"===t.type){if(s){const e=s.linkGroups.get(t.groupKey);e&&s.linkGroups.set(t.groupKey,[e[0]])}}else{if(s){const e=s.linkGroups.get(t.groupKey)||[];s.linkGroups.set(t.groupKey,[...e,...t.nodes])}else s=t.toAnnotation(),s.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(u.LINK_GROUP,s)}}}),y.register(x.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends q{handleAction(t,e){const s=e.getAnnotationByType(u.LINK_GROUP);s&&(s.linkGroups.size>1?s.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),y.register(x.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new Rt),y.register(x.REPLACE_CHILD_NODES,RTETextBlock.name,new yt),y.register(x.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ct),y.register(x.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new bt),y.register(x.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new kt),y.register(x.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,s,n))e.parent.apply(new Ot(e,r));else if(this.isCaretPositionAtBlockStart(e,s,n))e.parent.apply(new Bt(e,r));else{const t=new vt(s,n);e.apply(t),e.parent.apply(new Ot(e,r))}}}),y.register(x.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>s.toListItem(t)));n.apply(new gt(i)),s.apply(new Ot(t.selectedBlocks[0],n)),r.forEach((t=>{t.parent.apply(new St(t))}))}});class Dt extends q{getPreviousNode(t){const e=t.parent,s=e.children.indexOf(t);if(s>0)return e.children[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,s=e.children.indexOf(t);if(e.children[s+1])return e.children[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,s=e.children.indexOf(t),n=e.parent;if(e.isListItemBlock()){const t=n.parent;return 0===s&&Array.isArray(n.children)&&n.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===n}return 0===s&&Array.isArray(n.children)&&n.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(this.isRTEBlock(t.parent)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}isRTEBlock(t){return t&&"VegaRTEContent"!==t.constructor.name}}class It extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class $t extends j{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new I(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return h(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,s,n){super(t),this.type=w.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=n,this.language=s}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){y.executeTheStrategy(t,this)}doModifyActionApply(t){y.executeTheStrategy(t,this)}}y.register(x.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends q{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),y.register($t.name,RTECodeBlockNode.name,new class extends q{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var Mt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Mt||(Mt={}));class Ht extends q{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new St(e)))}}class RTECodeBlock extends RTEBlock{constructor(t,e,s){super(t),this.type="code-block",this.children=[new RTECodeBlockNode(`${t}-1`,e,s,this)]}static from(t){return new RTECodeBlock(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(){const{language:t=Mt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(n){if(n instanceof m&&y.executeTheStrategy(n,this),n.isFlushable){const n=T.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(u.SELECTION_RANGE)}}y.register(x.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Dt{handleAction(t,e){const s=e.children[0],n=e.parent;if(n){let t=this.getPreviousNode(s),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),r=0),n.apply(new St(e));const i=t?T.getDOMByEntity(t):null;if(0===n.children.length){const s=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:""}]});e.parent.apply(new gt([s])),t=s.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(s,r,i,o){const c=T.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,n);o&&t.notify(o,{node:s,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),y.register(x.DELETE_CHILDREN,RTECodeBlock.name,new Ht),y.register(x.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends q{handleAction(s,r){const{content:i,language:o}=s,a=i.split("\n"),l=new It(a.slice(0,a.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),text:"",type:"text"}]});r.parent.apply(new Ot(r,h));const u=T.getDOMByEntity(r);if(u){const s=e.getSubjectFromParentNodeByEventId(u,n);s&&t.notify(s,{node:h.children[0]})}}}),y.register(x.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends q{handleAction(t,e){e.parent.apply(new Ot(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{Et as $,y as A,At as B,C,w as D,S as E,j as F,Nt as G,_t as H,Ot as I,vt as J,Dt as K,Ht as L,m as M,v as N,F as O,K as P,Mt as Q,L as R,X as S,mt as T,ut as U,W as V,it as W,E as X,It as Y,U as Z,$t as _,R as a,RTECodeBlockNode as a0,Z as a1,rt as a2,ct as a3,wt as a4,P as a5,et as a6,st as a7,ot as a8,jt as a9,RTETextNode as b,x as c,q as d,RTETextBlock as e,RTEBlock as f,_ as g,gt as h,RTENode as i,Bt as j,u as k,Lt as l,bt as m,kt as n,Rt as o,yt as p,Ct as q,St as r,T as s,f as t,d as u,k as v,b as w,RTECodeBlock as x,g as y,RTEDecoratorNode as z}
|