@blinkk/root-cms 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/app.js +5 -5
  2. package/dist/{chunk-KGAUXTJ6.js → chunk-7Z5IRD2G.js} +176 -83
  3. package/dist/{chunk-2BSW7SIH.js → chunk-N4K6ICFR.js} +4 -4
  4. package/dist/{chunk-BGTUWIV6.js → chunk-PNLLZXVY.js} +4 -4
  5. package/dist/{chunk-C245C557.js → chunk-RXWDB3K4.js} +3 -3
  6. package/dist/{chunk-XLX37FRL.js → chunk-TEKMLYXS.js} +3 -4
  7. package/dist/cli/cli.d.ts +12 -0
  8. package/dist/cli/docs.d.ts +49 -0
  9. package/dist/cli/export.d.ts +11 -0
  10. package/dist/cli/generate-types.d.ts +6 -0
  11. package/dist/cli/import.d.ts +13 -0
  12. package/dist/cli/init-firebase.d.ts +7 -0
  13. package/dist/cli/utils.d.ts +27 -0
  14. package/dist/cli.js +10 -10
  15. package/dist/client.js +1 -1
  16. package/dist/core/ai-tools.d.ts +156 -0
  17. package/dist/core/ai.d.ts +330 -0
  18. package/dist/core/api.d.ts +21 -0
  19. package/dist/core/app.d.ts +16 -0
  20. package/dist/core/checks-translations.d.ts +13 -0
  21. package/dist/core/checks.d.ts +48 -0
  22. package/dist/core/client.d.ts +715 -0
  23. package/dist/core/core.d.ts +5 -0
  24. package/dist/core/cron.d.ts +19 -0
  25. package/dist/core/csv.d.ts +5 -0
  26. package/dist/core/functions.d.ts +9 -0
  27. package/dist/core/plugin.d.ts +357 -0
  28. package/dist/{project.d.ts → core/project.d.ts} +8 -12
  29. package/dist/core/richtext.d.ts +101 -0
  30. package/dist/{core.d.ts → core/route.d.ts} +13 -66
  31. package/dist/core/runtime.d.ts +46 -0
  32. package/dist/{schema-Db_xODoi.d.ts → core/schema.d.ts} +47 -100
  33. package/dist/core/search-extract.d.ts +70 -0
  34. package/dist/core/search-index.d.ts +182 -0
  35. package/dist/core/search-query.d.ts +68 -0
  36. package/dist/core/security.d.ts +6 -0
  37. package/dist/core/server-version.d.ts +5 -0
  38. package/dist/core/services-notifications.d.ts +57 -0
  39. package/dist/core/services.d.ts +44 -0
  40. package/dist/core/sse.d.ts +10 -0
  41. package/dist/core/translations-manager.d.ts +187 -0
  42. package/dist/core/translations.d.ts +83 -0
  43. package/dist/core/url-safety.d.ts +19 -0
  44. package/dist/core/validation.d.ts +30 -0
  45. package/dist/core/values.d.ts +9 -0
  46. package/dist/core/versions.d.ts +48 -0
  47. package/dist/core.js +1 -1
  48. package/dist/edit-M4PN4SGX.js +7 -0
  49. package/dist/functions.js +4 -4
  50. package/dist/{generate-types-SPV7I3A5.js → generate-types-JWIG4QVI.js} +1 -1
  51. package/dist/plugin.js +124 -129
  52. package/dist/shared/marshal.d.ts +68 -0
  53. package/dist/shared/objects.d.ts +9 -0
  54. package/dist/shared/richtext.d.ts +74 -0
  55. package/dist/shared/safe-json.d.ts +11 -0
  56. package/dist/shared/sanitize.d.ts +12 -0
  57. package/dist/shared/slug.d.ts +19 -0
  58. package/dist/shared/sse.d.ts +16 -0
  59. package/dist/shared/strings.d.ts +23 -0
  60. package/dist/ui/AIPage-2LUC2PWC.js +1 -0
  61. package/dist/ui/AssetsPage-PODV4QAB.js +1 -0
  62. package/dist/ui/CollectionPage-4DMKW5YB.js +1 -0
  63. package/dist/ui/ComparePage-JMJE5A5Y.js +1 -0
  64. package/dist/ui/DataPage-MVLZT2BU.js +1 -0
  65. package/dist/ui/DataSourcePage-4RPBXRI2.js +1 -0
  66. package/dist/ui/DocTranslationsPage-XJSPKGVX.js +1 -0
  67. package/dist/ui/DocumentPage-R2PVNG24.js +1 -0
  68. package/dist/ui/EditDataSourcePage-3SHAARNL.js +1 -0
  69. package/dist/ui/EditReleasePage-G5VW2OGW.js +1 -0
  70. package/dist/ui/ImageEditorDialog-4H665KK2.js +81 -0
  71. package/dist/ui/ImageEditorDialog-4H665KK2.js.LEGAL.txt +17 -0
  72. package/dist/ui/LogsPage-K6KYEG2P.js +1 -0
  73. package/dist/ui/NewDataSourcePage-O2VQEOJG.js +1 -0
  74. package/dist/ui/NewReleasePage-RSVS32RZ.js +1 -0
  75. package/dist/ui/NotFoundPage-ZYD5ILG6.js +1 -0
  76. package/dist/ui/ProjectPage-X3YQBWL4.js +1 -0
  77. package/dist/ui/ReleasePage-FJHHXNNB.js +1 -0
  78. package/dist/ui/ReleasesPage-VGWIBNEZ.js +1 -0
  79. package/dist/ui/SettingsPage-C4RXOQ6T.js +1 -0
  80. package/dist/ui/SidebarToolsPage-ZBOKPEMP.js +1 -0
  81. package/dist/ui/TaskPage-BQ4OX5WN.js +1 -0
  82. package/dist/ui/TasksPage-3IGQYVYS.js +1 -0
  83. package/dist/ui/TranslationsArbPage-GGHCWPQL.js +2 -0
  84. package/dist/ui/TranslationsEditPage-E2BCMKYV.js +1 -0
  85. package/dist/ui/TranslationsPage-MC4O4ZNI.js +162 -0
  86. package/dist/ui/ai-tools-5E5ELLZX.js +1 -0
  87. package/dist/ui/chunk-3IYZCUPI.js +1 -0
  88. package/dist/ui/chunk-4KE2SZKH.js +1 -0
  89. package/dist/ui/chunk-4W73RW5I.js +1 -0
  90. package/dist/ui/chunk-54DVDYU6.js +1 -0
  91. package/dist/ui/chunk-5MV6XVGA.js +1 -0
  92. package/dist/ui/chunk-62UWGWON.js +1 -0
  93. package/dist/ui/chunk-6IFGKSIE.js +1 -0
  94. package/dist/ui/chunk-767BAQ53.js +1 -0
  95. package/dist/ui/chunk-AFWBSIPL.js +1 -0
  96. package/dist/ui/chunk-AL3TN2KI.js +1 -0
  97. package/dist/ui/chunk-B6BLDN24.js +141 -0
  98. package/dist/ui/chunk-B6BLDN24.js.LEGAL.txt +106 -0
  99. package/dist/ui/chunk-BZIRGB4W.js +1 -0
  100. package/dist/ui/chunk-C5NH23G4.js +3 -0
  101. package/dist/ui/chunk-CGCKJFL4.js +1 -0
  102. package/dist/ui/chunk-DEGMKEHP.js +1 -0
  103. package/dist/ui/chunk-DTMZLUNY.js +15 -0
  104. package/dist/ui/chunk-DTMZLUNY.js.LEGAL.txt +237 -0
  105. package/dist/ui/chunk-DUJYIOLE.js +5 -0
  106. package/dist/ui/chunk-E2RCCK2T.js +1 -0
  107. package/dist/ui/chunk-EGEB6N4J.js +22 -0
  108. package/dist/ui/chunk-EGEB6N4J.js.LEGAL.txt +1059 -0
  109. package/dist/ui/chunk-GXSAEPU3.js +1 -0
  110. package/dist/ui/chunk-HHMG665Z.js +1 -0
  111. package/dist/ui/chunk-HKINZLMW.js +84 -0
  112. package/dist/ui/chunk-HLMBCVRX.js +1 -0
  113. package/dist/ui/chunk-HRGYNHZ3.js +1 -0
  114. package/dist/ui/chunk-I6ICVKEC.js +1 -0
  115. package/dist/ui/chunk-IU36W2TB.js +1 -0
  116. package/dist/ui/chunk-JDW4UORS.js +1 -0
  117. package/dist/ui/chunk-JHBAMPGB.js +1 -0
  118. package/dist/ui/chunk-JYFLU7DM.js +19 -0
  119. package/dist/ui/chunk-JZFTZ4X4.js +87 -0
  120. package/dist/ui/chunk-JZFTZ4X4.js.LEGAL.txt +9 -0
  121. package/dist/ui/chunk-KFAZBEPV.js +1 -0
  122. package/dist/ui/chunk-KKEWCXVV.js +1 -0
  123. package/dist/ui/chunk-KUCVLANF.js +1 -0
  124. package/dist/ui/chunk-KYDOSLTO.js +1 -0
  125. package/dist/ui/chunk-L4RHGQUG.js +1 -0
  126. package/dist/ui/chunk-MDUBCXU2.js +1 -0
  127. package/dist/ui/chunk-NXQVLOTK.js +1 -0
  128. package/dist/ui/chunk-NZHF733K.js +7 -0
  129. package/dist/ui/chunk-NZHF733K.js.LEGAL.txt +146 -0
  130. package/dist/ui/chunk-ONTGW2VA.js +1 -0
  131. package/dist/ui/chunk-ORXEMIQC.js +1 -0
  132. package/dist/ui/chunk-PHBMVORG.js +1 -0
  133. package/dist/ui/chunk-PJA7YP4A.js +1 -0
  134. package/dist/ui/chunk-PVAE643M.js +1 -0
  135. package/dist/ui/chunk-PWKJDYE2.js +1 -0
  136. package/dist/ui/chunk-RSVO46S3.js +1 -0
  137. package/dist/ui/chunk-SKEP5WYH.js +10 -0
  138. package/dist/ui/chunk-SKEP5WYH.js.LEGAL.txt +176 -0
  139. package/dist/ui/chunk-SQRKKWRG.js +3 -0
  140. package/dist/ui/chunk-UEON4JAT.js +1 -0
  141. package/dist/ui/chunk-V7S4IAGB.js +1 -0
  142. package/dist/ui/chunk-VMT7JFAM.js +1 -0
  143. package/dist/ui/chunk-W3BJ2EZX.js +1 -0
  144. package/dist/ui/chunk-W3HIZQ4Z.js +1 -0
  145. package/dist/ui/chunk-X2WHBGTP.js +1 -0
  146. package/dist/ui/chunk-XOQ3KDSR.js +3 -0
  147. package/dist/ui/chunk-YDO2EDVY.js +1 -0
  148. package/dist/ui/chunk-YFA6U2CV.js +1 -0
  149. package/dist/ui/gcs-L33FIRZU.js +1 -0
  150. package/dist/ui/prerender-Q4YSDCPB.js +1 -0
  151. package/dist/ui/signin.js +1 -1
  152. package/dist/ui/ui.css +1 -1
  153. package/dist/ui/ui.js +1 -630
  154. package/dist/ui/ui.js.LEGAL.txt +19 -732
  155. package/package.json +20 -20
  156. package/dist/client-1puwLgNx.d.ts +0 -1552
  157. package/dist/client.d.ts +0 -5
  158. package/dist/edit-MT4B37QK.js +0 -7
  159. package/dist/functions.d.ts +0 -13
  160. package/dist/plugin.d.ts +0 -5
  161. package/dist/richtext.d.ts +0 -104
@@ -0,0 +1,141 @@
1
+ import{c as pE,e as kE}from"./chunk-HHMG665Z.js";import{a as yE,b as xE}from"./chunk-YFA6U2CV.js";import{a as gE}from"./chunk-4W73RW5I.js";import{a as fE,b as hE,c as hh}from"./chunk-IU36W2TB.js";import{a as Ad}from"./chunk-V7S4IAGB.js";import{a as SE}from"./chunk-KFAZBEPV.js";import{a as sE,d as lE}from"./chunk-PHBMVORG.js";import{a as oE,d as fh}from"./chunk-JZFTZ4X4.js";import{b as rE,d as iE}from"./chunk-HKINZLMW.js";import{a as vE,b as pr,c as Js,d as CE,e as Fd,f as to,g as EE,i as Fo,j as en,l as Bd}from"./chunk-6IFGKSIE.js";import{a as Ld}from"./chunk-CGCKJFL4.js";import{a as ur}from"./chunk-VMT7JFAM.js";import{f as qs,j as aE}from"./chunk-SKEP5WYH.js";import{a as gC,d as mE,e as _E,h as TE}from"./chunk-GXSAEPU3.js";import{g as dE,h as Xs,i as uE}from"./chunk-NXQVLOTK.js";import{c as fC,d as hC,f as _d}from"./chunk-3IYZCUPI.js";import{a as cE}from"./chunk-X2WHBGTP.js";import{a as Pd,b as bE,c as wE}from"./chunk-ONTGW2VA.js";import{a as Rd}from"./chunk-L4RHGQUG.js";import{a as Qt,c as yt}from"./chunk-HRGYNHZ3.js";import{a as Ks,b as Us,c as ud,d as nC}from"./chunk-W3HIZQ4Z.js";import{c as Zv}from"./chunk-JDW4UORS.js";import{A as uC,D as gd,E as md,a as pd,b as vl,e as rC,g as iC,p as sC,q as aC,t as js,v as lC,x as cC,y as hd,z as dC}from"./chunk-AFWBSIPL.js";import{b as fd,e as ih,f as dr,h as oC}from"./chunk-XOQ3KDSR.js";import{a as oh,b as cr}from"./chunk-62UWGWON.js";import{a as ke,b as bt,c as Vv}from"./chunk-I6ICVKEC.js";import{a as El}from"./chunk-HLMBCVRX.js";import{a as rh,d as Qv,e as eC,f as tC}from"./chunk-ORXEMIQC.js";import{a as Vs,b as Ro,e as Ze,g as pC}from"./chunk-5MV6XVGA.js";import{a as dd,c as Wv,e as Gv,p as Yv,q as qv,r as Xv,u as nh}from"./chunk-EGEB6N4J.js";import{d as Jv,f as we}from"./chunk-AL3TN2KI.js";import{$ as Hs,$a as Hn,$b as wd,Aa as Lo,Ab as DC,Ac as kd,Bc as QC,Ca as qr,Cb as OC,Cc as eE,Ec as Ys,Fa as cd,Fb as IC,Ga as De,Gb as vd,Gc as tE,Ha as g,Hb as MC,Hc as Nd,Ib as AC,Ic as Dd,Ja as sh,Jb as LC,Jc as Od,Ka as mC,Kb as RC,Kc as Id,Lb as PC,Na as Xr,Ob as lh,Oc as Cl,Pb as Cd,Pc as Po,Qb as FC,Qc as Md,Ra as Ws,Rb as BC,Sb as Hi,Tb as $C,U as th,Ua as bd,Ub as zC,Uc as ph,V as Zt,Va as _C,W as Be,Wa as bC,Xb as Ed,Y as sr,Ya as yC,Yb as HC,Yc as nE,Zb as KC,_a as zi,_b as UC,a as R,b as Lv,ba as zv,bb as xC,bc as jC,c as P,cb as vC,d as un,db as CC,dc as VC,e as Y,ea as Q,eb as yd,fa as Mo,fb as EC,g as X,ga as ar,h as Ee,hb as wC,i as It,ic as WC,j as Se,jc as ch,k as Rv,kb as xd,kc as Td,l as Pv,m as $i,ma as sd,mb as TC,nc as GC,o as Fv,oa as Ao,oc as YC,pa as ad,q as Yr,qa as Hv,qc as qC,r as Bv,ra as ne,rb as SC,rc as XC,s as $v,sa as ld,sc as JC,ta as Kv,u as xl,ub as ah,v as et,va as lr,vc as Ki,w as zs,wa as Uv,wc as dh,x as Qf,xb as Gs,xc as Sd,y as ut,yb as kC,yc as uh,z as eh,za as jv,zb as NC,zc as ZC}from"./chunk-NZHF733K.js";import{b as Bi,d as Me,e as Av,j as Ot,k as $s}from"./chunk-KUCVLANF.js";import{b as Jf,c as Re,d as Zf,e as WL}from"./chunk-PVAE643M.js";var QE=Jf(ZE=>{"use strict";var wl=(ut(),WL(Qf));function TR(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var SR=typeof Object.is=="function"?Object.is:TR,kR=wl.useSyncExternalStore,NR=wl.useRef,DR=wl.useEffect,OR=wl.useMemo,IR=wl.useDebugValue;ZE.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=NR(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=OR(function(){function l(f){if(!c){if(c=!0,d=f,f=o(f),r!==void 0&&s.hasValue){var h=s.value;if(r(h,f))return u=h}return u=f}if(h=u,SR(d,f))return h;var m=o(f);return r!==void 0&&r(h,m)?(d=f,h):(d=f,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=kR(t,i[0],i[1]);return DR(function(){s.hasValue=!0,s.value=a},[a]),IR(a),a}});var t0=Jf((S9,e0)=>{"use strict";e0.exports=QE()});var uv=Jf((use,$f)=>{"use strict";var tV=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var oe=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,x;switch(r.util.type(_)){case"Object":if(x=r.util.objId(_),b[x])return b[x];y={},b[x]=y;for(var v in _)_.hasOwnProperty(v)&&(y[v]=m(_[v],b));return y;case"Array":return x=r.util.objId(_),b[x]?b[x]:(y=[],b[x]=y,_.forEach(function(E,C){y[C]=m(E,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var x=m.classList;if(x.contains(_))return!0;if(x.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var x=y[m],v={};for(var E in x)if(x.hasOwnProperty(E)){if(E==_)for(var C in b)b.hasOwnProperty(C)&&(v[C]=b[C]);b.hasOwnProperty(E)||(v[E]=x[E])}var k=y[m];return y[m]=v,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=v)}),v},DFS:function m(_,b,y,x){x=x||{};var v=r.util.objId;for(var E in _)if(_.hasOwnProperty(E)){b.call(_,E,_[E],y||E);var C=_[E],k=r.util.type(C);k==="Object"&&!x[v(C)]?(x[v(C)]=!0,m(C,b,null,x)):k==="Array"&&!x[v(C)]&&(x[v(C)]=!0,m(C,b,E,x))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var x=0,v;v=y.elements[x++];)r.highlightElement(v,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),x=r.languages[y];r.util.setLanguage(m,y);var v=m.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(v,y);var E=m.textContent,C={element:m,language:y,grammar:x,code:E};function k(w){C.highlightedCode=w,r.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,r.hooks.run("after-highlight",C),r.hooks.run("complete",C),b&&b.call(C.element)}if(r.hooks.run("before-sanity-check",C),v=C.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!C.code){r.hooks.run("complete",C),b&&b.call(C.element);return}if(r.hooks.run("before-highlight",C),!C.grammar){k(r.util.encode(C.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else k(r.highlight(C.code,C.grammar,C.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var x=new l;return c(x,x.head,m),a(m,x,_,x.head,0),u(x)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,x;x=b[y++];)x(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var x={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},v=_.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),r.hooks.run("wrap",x);var E="";for(var C in x.attributes)E+=" "+C+'="'+(x.attributes[C]||"").replace(/"/g,"&quot;")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+E+">"+x.content+"</"+x.tag+">"};function s(m,_,b,y){m.lastIndex=_;var x=m.exec(b);if(x&&y&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function a(m,_,b,y,x,v){for(var E in b)if(!(!b.hasOwnProperty(E)||!b[E])){var C=b[E];C=Array.isArray(C)?C:[C];for(var k=0;k<C.length;++k){if(v&&v.cause==E+","+k)return;var T=C[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var M=T.pattern||T,I=y.next,L=x;I!==_.tail&&!(v&&L>=v.reach);L+=I.value.length,I=I.next){var K=I.value;if(_.length>m.length)return;if(!(K instanceof i)){var W=1,q;if(N){if(q=s(M,L,m,S),!q||q.index>=m.length)break;var mt=q.index,B=q.index+q[0].length,se=L;for(se+=I.value.length;mt>=se;)I=I.next,se+=I.value.length;if(se-=I.value.length,L=se,I.value instanceof i)continue;for(var me=I;me!==_.tail&&(se<B||typeof me.value=="string");me=me.next)W++,se+=me.value.length;W--,K=m.slice(L,se),q.index-=L}else if(q=s(M,0,K,S),!q)continue;var mt=q.index,Jt=q[0],dt=K.slice(0,mt),_t=K.slice(mt+Jt.length),sn=L+K.length;v&&sn>v.reach&&(v.reach=sn);var ye=I.prev;dt&&(ye=c(_,ye,dt),L+=dt.length),d(_,ye,W);var Je=new i(E,w?r.tokenize(Jt,w):Jt,D,Jt);if(I=c(_,ye,Je),_t&&c(_,I,_t),W>1){var st={cause:E+","+k,reach:sn};a(m,_,b,I.prev,L,st),v&&st.reach>v.reach&&(v.reach=st.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,x={value:b,prev:_,next:y};return _.next=x,y.prev=x,m.length++,x}function d(m,_,b){for(var y=_.next,x=0;x<b&&y!==m.tail;x++)y=y.next;_.next=y,y.prev=_,m.length-=x}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,x=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),x&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var h=document.readyState;h==="loading"||h==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(tV);typeof $f<"u"&&$f.exports&&($f.exports=oe);typeof global<"u"&&(global.Prism=oe);oe.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};oe.languages.markup.tag.inside["attr-value"].inside.entity=oe.languages.markup.entity;oe.languages.markup.doctype.inside["internal-subset"].inside=oe.languages.markup;oe.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(oe.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:oe.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:oe.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},oe.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(oe.languages.markup.tag,"addAttribute",{value:function(t,e){oe.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:oe.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});oe.languages.html=oe.languages.markup;oe.languages.mathml=oe.languages.markup;oe.languages.svg=oe.languages.markup;oe.languages.xml=oe.languages.extend("markup",{});oe.languages.ssml=oe.languages.xml;oe.languages.atom=oe.languages.xml;oe.languages.rss=oe.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(oe);oe.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};oe.languages.javascript=oe.languages.extend("clike",{"class-name":[oe.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});oe.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;oe.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:oe.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:oe.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});oe.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:oe.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});oe.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});oe.languages.markup&&(oe.languages.markup.tag.addInlined("script","javascript"),oe.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));oe.languages.js=oe.languages.javascript;(function(){if(typeof oe>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,f){return"\u2716 Error "+p+" while fetching file: "+f},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,f,h){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?h(e(m.status,m.statusText)):h(n))},m.send(null)}function d(p){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(f){var h=Number(f[1]),m=f[2],_=f[3];return m?_?[h,Number(_)]:[h,void 0]:[h,h]}}oe.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),oe.hooks.add("before-sanity-check",function(p){var f=p.element;if(f.matches(l)){p.code="",f.setAttribute(r,i);var h=f.appendChild(document.createElement("CODE"));h.textContent=t;var m=f.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}oe.util.setLanguage(h,_),oe.util.setLanguage(f,_);var y=oe.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(x){f.setAttribute(r,s);var v=d(f.getAttribute("data-range"));if(v){var E=x.split(/\r\n?|\n/g),C=v[0],k=v[1]==null?E.length:v[1];C<0&&(C+=E.length),C=Math.max(0,Math.min(C-1,E.length)),k<0&&(k+=E.length),k=Math.max(0,Math.min(k,E.length)),x=E.slice(C,k).join(`
2
+ `),f.hasAttribute("data-start")||f.setAttribute("data-start",String(C+1))}h.textContent=x,oe.highlightElement(h)},function(x){f.setAttribute(r,a),h.textContent=x})}}),oe.plugins.fileHighlight={highlight:function(f){for(var h=(f||document).querySelectorAll(l),m=0,_;_=h[m++];)oe.highlightElement(_)}};var u=!1;oe.fileHighlight=function(){u||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),u=!0),oe.plugins.fileHighlight.highlight.apply(this,arguments)}})()});Se();Se();Se();function $d(t){return g(Ki,{className:t.className,size:t.size})}function IE(t){let[e,n]=R(null),[o,r]=R("");if(P(()=>{let a=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let c=await l.json();a&&n(c)}).catch(l=>{a&&r(String(l))}),()=>{a=!1}},[]),!e&&!o)return g("div",{className:"AiEditModal__ChatPanel__loading",children:g(Zt,{size:"sm",color:"gray"})});if(!(!!e?.enabled&&(e.models?.length||0)>0))return g("div",{className:"AiEditModal__ChatPanel__notConfigured",children:[g("div",{className:"AiEditModal__ChatPanel__notConfigured__icon",children:g(Ki,{size:32})}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__title",children:"Root AI is not configured for this project."}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__body",children:["Add an ",g("code",{children:"ai.models"})," entry to ",g("code",{children:"cmsPlugin()"})," in"," ",g("code",{children:"root.config.ts"}),"."]}),o&&g("pre",{className:"AiEditModal__ChatPanel__notConfigured__error",children:o})]});let s=e.models.find(a=>a.id===e.defaultModel)||e.models[0];return g(GL,{model:s,editModeData:t.editModeData,onEditModeResponse:t.onEditModeResponse,welcome:t.children})}function GL(t){let e=Y(t.editModeData);e.current=t.editModeData;let n=X(()=>new rE({api:"/cms/api/ai.edit_object",credentials:"include",prepareSendMessagesRequest:({messages:p})=>({body:{messages:p,modelId:t.model.id,editData:e.current}})}),[t.model.id]),o=Y(t.onEditModeResponse);o.current=t.onEditModeResponse;let r=Y(new Map),{messages:i,sendMessage:s,status:a,error:l,stop:c,addToolOutput:d}=sE({transport:n,sendAutomaticallyWhen:iE,onToolCall:async({toolCall:p})=>{let f=await lE(p.toolName,p.input);d({tool:p.toolName,toolCallId:p.toolCallId,output:f})}}),u=a==="streaming"||a==="submitted";return P(()=>{let p=o.current;if(p)for(let f=i.length-1;f>=0;f--){let h=i[f];if(h.role!=="assistant")continue;let m=sR(h),_=aR(m);if(!_||r.current.get(h.id)===_)return;try{let y=JSON.parse(_);y&&typeof y=="object"&&(r.current.set(h.id,_),p({message:"",data:y}))}catch{}return}},[i]),g(Me,{children:[g(YL,{messages:i,isStreaming:u,welcome:t.welcome}),l&&g("div",{className:"AiEditModal__ChatPanel__error",children:[g("strong",{children:"Error:"})," ",l.message]}),g(eR,{canAttach:t.model.capabilities.attachments,isStreaming:u,onStop:c,onSend:(p,f)=>{if(!p&&f.length===0)return;let h=tR(f),m=[p,h.text].filter(Boolean).join(`
3
+
4
+ `);s({text:m,files:h.files.map(_=>({type:"file",mediaType:_.mediaType,url:_.url,filename:_.filename}))})}})]})}function YL(t){let e=Y(null);return P(()=>{let n=e.current;n&&(n.scrollTop=n.scrollHeight)},[t.messages]),t.messages.length===0?g("div",{className:"AiEditModal__ChatPanel__transcript AiEditModal__ChatPanel__transcript--empty",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__welcome",children:[g("div",{className:"AiEditModal__ChatPanel__welcome__icon",children:g($d,{})}),g("div",{className:"AiEditModal__ChatPanel__welcome__title",children:"Edit with Root AI"}),t.welcome&&g("div",{className:"AiEditModal__ChatPanel__welcome__body",children:t.welcome})]})}):g("div",{className:"AiEditModal__ChatPanel__transcript",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__transcript__inner",children:[t.messages.map(n=>g(qL,{message:n},n.id)),t.isStreaming&&g("div",{className:"AiEditModal__ChatPanel__streamingIndicator",children:[g(Zt,{size:"xs",color:"gray"}),g("span",{children:"Thinking\u2026"})]})]})})}function qL(t){let e=t.message,n=e.role==="user",o=n?"You":"Root AI",r=n?window.firebase.user?.photoURL:null;return g("div",{className:we("AiEditModal__ChatPanel__message",`AiEditModal__ChatPanel__message--${e.role}`),children:[g("div",{className:"AiEditModal__ChatPanel__message__avatar",children:r?g("img",{src:r,alt:o}):g(Ki,{size:18})}),g("div",{className:"AiEditModal__ChatPanel__message__body",children:[g("div",{className:"AiEditModal__ChatPanel__message__username",children:o}),g("div",{className:"AiEditModal__ChatPanel__message__parts",children:(e.parts||[]).map((i,s)=>g(XL,{part:i},s))})]})]})}function XL(t){let e=t.part;if(e.type==="text"){if(!e.text)return null;let n=lR(e.text);return n?g("div",{className:"AiEditModal__ChatPanel__textPart",children:g(fh,{code:n})}):null}return e.type==="reasoning"?g(JL,{text:e.text}):e.type==="file"?g(ZL,{part:e}):typeof e.type=="string"&&e.type.startsWith("tool-")?g(NE,{part:e}):e.type==="dynamic-tool"?g(NE,{part:e}):(e.type==="step-start",null)}function JL(t){let[e,n]=R(!1);return t.text?g("div",{className:we("AiEditModal__ChatPanel__reasoning",e&&"AiEditModal__ChatPanel__reasoning--open"),children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__reasoning__toggle",onClick:()=>n(!e),children:[g(Hn,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),g("span",{children:"Thinking"})]}),e&&g("div",{className:"AiEditModal__ChatPanel__reasoning__body",children:g(fh,{code:t.text})})]}):null}function ZL(t){let e=t.part;return e.mediaType?.startsWith("image/")?g("div",{className:"AiEditModal__ChatPanel__filePart",children:g("img",{src:e.url,alt:e.filename||"attachment"})}):g("a",{className:"AiEditModal__ChatPanel__filePart AiEditModal__ChatPanel__filePart--link",href:e.url,target:"_blank",children:[g(ch,{size:14}),g("span",{children:e.filename||e.url})]})}function NE(t){let e=t.part,n=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",o=e.state||"",[r,i]=R(!1);return g("div",{className:"AiEditModal__ChatPanel__tool",children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__tool__header",onClick:()=>i(!r),children:[g(Cl,{size:14}),g("code",{children:n}),g("span",{className:"AiEditModal__ChatPanel__tool__state",children:QL(o)}),g(Hn,{size:14,style:{marginLeft:"auto",transform:r?"rotate(0deg)":"rotate(-90deg)"}})]}),r&&g("div",{className:"AiEditModal__ChatPanel__tool__body",children:[e.input&&g("details",{open:!0,children:[g("summary",{children:"Input"}),g("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&g("details",{open:!0,children:[g("summary",{children:"Output"}),g("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&g("div",{className:"AiEditModal__ChatPanel__tool__error",children:e.errorText})]})]})}function QL(t){switch(t){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return t}}function eR(t){let[e,n]=R(""),[o,r]=R([]),[i,s]=R(!1),a=Y(null),l=Y(null);P(()=>{window.requestAnimationFrame(()=>{let h=l.current;h&&(h.style.height="auto",h.style.height=`${Math.min(h.scrollHeight,200)}px`)})},[e,o]);let d=Ee(()=>{t.isStreaming||!e&&o.length===0||(t.onSend(e,o),n(""),r([]),a.current&&(a.current.value=""))},[e,o,t.isStreaming]),u=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),d())},p=async h=>{s(!0);try{let m=h.type||iR(h.name),_=await oR(h,m),b=await qs(h,{disableGci:!0});r(y=>[...y,{url:b.src,filename:b.filename||h.name,mediaType:m,textContent:_?.text,textTruncated:_?.truncated,width:b.width,height:b.height}])}catch(m){console.error("upload failed",m)}finally{s(!1),a.current&&(a.current.value="")}},f=h=>{let m=h.target;Array.from(m.files||[]).forEach(p)};return g("div",{className:"AiEditModal__ChatPanel__composer",children:[g("div",{className:we("AiEditModal__ChatPanel__composer__prompt",(i||o.length>0)&&"AiEditModal__ChatPanel__composer__prompt--hasImage"),children:[t.canAttach&&g("label",{className:"AiEditModal__ChatPanel__composer__imageUpload",children:[g("input",{ref:a,type:"file",className:"AiEditModal__ChatPanel__composer__imageUpload__input",onChange:f}),g(De,{label:"Upload file",children:g(Be,{component:"div",className:"AiEditModal__ChatPanel__composer__imageUpload__icon",radius:"xl",children:g(ch,{size:18})})})]}),g("textarea",{ref:l,className:"AiEditModal__ChatPanel__composer__textInput",placeholder:"Tell me what you want to change...",value:e,rows:1,autofocus:!0,onKeyDown:u,onChange:h=>n(h.target.value),onPaste:h=>{let m=h.clipboardData?.items||[];for(let _ of m)if(_.kind==="file"){let b=_.getAsFile();b&&t.canAttach&&p(b)}}}),(i||o.length>0)&&g("div",{className:"AiEditModal__ChatPanel__composer__attachments",children:[i&&g(Zt,{size:"sm"}),o.map((h,m)=>g(De,{label:h.filename,transition:"pop",position:"top",withArrow:!0,children:g("button",{className:"AiEditModal__ChatPanel__composer__attachment",onClick:()=>r(_=>_.filter((b,y)=>y!==m)),children:[h.mediaType.startsWith("image/")?g("img",{src:h.url,alt:h.filename}):g("span",{className:"AiEditModal__ChatPanel__composer__attachment__name",children:h.filename}),g("div",{className:"AiEditModal__ChatPanel__composer__attachment__close",children:g(ph,{size:20,color:"white"})})]})},m))]}),t.isStreaming?g(Be,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",onClick:t.onStop,title:"Stop",children:g(ph,{size:18})}):g(Be,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",disabled:i||!e&&o.length===0,onClick:d,title:"Send",children:g(QC,{size:18})})]}),g("div",{className:"AiEditModal__ChatPanel__composer__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var DE=1e5;function tR(t){let e=t.filter(OE),n=t.filter(o=>!OE(o)).map(nR);return{files:e,text:n.length?`Attached files:
5
+
6
+ ${n.join(`
7
+
8
+ `)}`:""}}function OE(t){return t.mediaType.startsWith("image/")}function nR(t){let e=`File: ${t.filename} (${t.mediaType})`;if(t.textContent!==void 0){let n=t.textTruncated?`
9
+
10
+ [Content truncated before sending to the model.]`:"";return`${e}
11
+ URL: ${t.url}
12
+
13
+ ~~~
14
+ ${t.textContent}${n}
15
+ ~~~`}return`${e}
16
+ URL: ${t.url}
17
+
18
+ [The file was uploaded, but its binary content was not inlined into this chat message.]`}async function oR(t,e){if(!rR(t.name,e))return null;let n=await t.text();return n.length<=DE?{text:n,truncated:!1}:{text:n.slice(0,DE),truncated:!0}}function rR(t,e){return e.startsWith("text/")?!0:[".css",".js",".jsx",".json",".md",".mdx",".mjs",".scss",".ts",".tsx",".txt",".yaml",".yml"].some(n=>t.toLowerCase().endsWith(n))}function iR(t){let e=t.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".webp")?"image/webp":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".pdf")?"application/pdf":e.endsWith(".json")?"application/json":e.endsWith(".csv")?"text/csv":e.endsWith(".md")?"text/markdown":e.endsWith(".txt")?"text/plain":"application/octet-stream"}function sR(t){return(t.parts||[]).filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}function aR(t){if(!t)return null;let e=/```(?:json)?\s*\n([\s\S]*?)```/gi,n,o=null;for(;(n=e.exec(t))!==null;)o=n[1].trim();return o}function lR(t){if(!t)return t;let e=/```(?:json)?\s*\n[\s\S]*?```/gi,n=Array.from(t.matchAll(e)),o=t;if(n.length>0){let i=n[n.length-1],s=i.index??-1,a=s+i[0].length;s!==-1&&/^\s*$/.test(o.slice(a))&&(o=o.slice(0,s))}if((o.match(/```/g)||[]).length%2===1){let i=o.lastIndexOf("```");i!==-1&&(o=o.slice(0,i))}return o.trim()}var gh="AiEditModal";function ME(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal(gh,{...e,title:n.title||"Edit with AI (Experimental)",innerProps:n,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(gh)}}}function cR(t){let{innerProps:e,context:n,id:o}=t,r=Y(null),i=X(()=>JSON.stringify(e.data||{},null,2),[e.data]),[s,a]=R(i),l=X(()=>{if(!s)return null;try{return JSON.parse(s)}catch{return null}},[s]),c=X(()=>s!==i,[s,i]),d=Ee(()=>{if(!l)return;let p=md(l);e.onSave&&e.onSave(p)},[l]),u=Ee(p=>{if(p?.data){let f=JSON.stringify(p.data,null,2);a(f),r.current?.click()}},[]);return g("div",{className:"AiEditModal",children:[g("div",{className:"AiEditModal__SplitPanel",children:[g("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:g(IE,{editModeData:l,onEditModeResponse:u,children:[g("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),g("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),g("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:g(cd,{className:"AiEditModal__Tabs",grow:!0,children:[g(cd.Tab,{label:"JSON",icon:g(FC,{size:20}),children:g("div",{className:"AiEditModal__JsonEditor",children:g(ad,{value:s,onChange:p=>a(p),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),g(cd.Tab,{ref:r,label:"Diff",icon:g(kC,{size:20}),children:g("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&s&&g(oE,{oldCode:i,newCode:s})})})]})})]}),g("div",{className:"AiEditModal__buttons",children:[g(Q,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(Q,{variant:"default",size:"xs",type:"button",leftIcon:g(Xr,{size:16}),disabled:!c,onClick:()=>a(i),children:"Reset"}),g(Q,{leftIcon:g(zi,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:d,children:"Accept changes"})]})]})}cR.id=gh;Se();var mh="ComponentPickerModal",dR="root::ComponentPickerModal:layout",uR=3;function AE(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal(mh,{...e,innerProps:n,size:"720px",overflow:"inside",title:"Select a component"})},close:()=>{t.closeModal(mh)}}}function _h(t){let{innerProps:e}=t,[n,o]=R(""),[r,i]=cE(dR,"list"),[s,a]=R(0),l=Y(null),c=X(()=>{let f=n.trim().toLowerCase();return f?e.options.filter(h=>[h.schema.name,h.schema.label,h.schema.description,h.preset?.id,h.preset?.label,h.preset?.description].filter(Boolean).join(" ").toLowerCase().includes(f)):e.options},[e.options,n]);P(()=>{a(c.length>0?0:-1)},[c]),P(()=>{if(s<0||!l.current)return;l.current.querySelectorAll(".ComponentPickerModal__Card")[s]?.scrollIntoView({block:"nearest"})},[s]);function d(f){if(c.length===0)return;let h=r==="grid"?uR:1,m=c.length-1;if(f.key==="ArrowDown")f.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+h));else if(f.key==="ArrowUp")f.preventDefault(),a(_=>Math.max(0,_-h));else if(f.key==="ArrowRight"&&r==="grid")f.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+1));else if(f.key==="ArrowLeft"&&r==="grid")f.preventDefault(),a(_=>Math.max(0,_-1));else if(f.key==="Enter"&&s>=0){let _=c[s];_&&(f.preventDefault(),e.onSelect(_))}}let u=!!e.onRemove&&!n.trim();return g("div",{className:`ComponentPickerModal ${r==="grid"?"ComponentPickerModal--grid":"ComponentPickerModal--list"}`,onKeyDown:d,children:[g("div",{className:"ComponentPickerModal__controls",children:[g(lr,{"data-autofocus":!0,placeholder:e.searchPlaceholder||"Search components...",value:n,onChange:f=>o(f.target.value),icon:g(kd,{size:16}),size:"xs",className:"ComponentPickerModal__controls__search"}),g(jv,{className:"ComponentPickerModal__controls__layout",size:"xs",value:r,onChange:f=>i(f),data:[{value:"list",label:g("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"List layout",title:"List layout",children:g(zC,{size:14})})},{value:"grid",label:g("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"Grid layout",title:"Grid layout",children:g($C,{size:14})})}]})]}),c.length===0?g("div",{className:"ComponentPickerModal__empty",children:e.options.length===0?"No component types available.":"No components match your search."}):g("div",{className:"ComponentPickerModal__cards",ref:l,children:c.map((f,h)=>g(_h.Card,{option:f,layout:r,focused:h===s,onMouseEnter:()=>a(h),onSelect:()=>e.onSelect(f)},f.key))}),u&&g("div",{className:"ComponentPickerModal__footer",children:g(Q,{variant:"subtle",color:"red",size:"xs",leftIcon:g(Po,{size:14}),onClick:()=>e.onRemove?.(),children:"Clear selection"})})]})}_h.Card=t=>{let{schema:e,preset:n}=t.option,o=n?.label||n?.id||e.label||e.name,r=n?.description??e.description??"",i=n?.image||e.image,s=n?e.label||e.name:"",l=t.layout==="grid"?180:120,c=t.layout==="grid"?120:90,d=["ComponentPickerModal__Card",t.focused?"ComponentPickerModal__Card--focused":""].filter(Boolean).join(" ");return g("button",{type:"button",className:d,onClick:t.onSelect,onMouseEnter:t.onMouseEnter,children:[g("div",{className:"ComponentPickerModal__Card__image",children:g(sd,{src:i,width:l,height:c,withPlaceholder:!i,alt:o})}),g("div",{className:"ComponentPickerModal__Card__content",children:[s&&g("div",{className:"ComponentPickerModal__Card__content__subtitle",children:s}),g("div",{className:"ComponentPickerModal__Card__content__title",children:o}),r&&g("div",{className:"ComponentPickerModal__Card__content__description",children:r})]})]})};_h.id=mh;Se();var bh="EditJsonModal";function LE(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal(bh,{...e,title:n.title||"Edit JSON",innerProps:n,size:"680px",centered:!0})},close:()=>{t.closeModal(bh)}}}function pR(t){let{innerProps:e,context:n,id:o}=t,r=JSON.stringify(e.data||{},null,2),[i,s]=R(r),[a,l]=R(!0),[c,d]=R(!1),[u,p]=R(!1);function f(_){s(_),d(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}p(_!==r)}function h(){navigator.clipboard.writeText(i).then(()=>d(!0))}function m(){let _=JSON.parse(i),b=md(_);e.onSave&&e.onSave(b)}return g("div",{className:"EditJsonModal",children:[g(ad,{value:i,onChange:f,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),g("div",{className:"EditJsonModal__buttons",children:[g(Q,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(Q,{leftIcon:g(wC,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!a,type:"button",onClick:h,children:c?"Copied!":"Copy"}),g(Q,{variant:"default",size:"xs",type:"button",leftIcon:g(Xr,{size:16}),disabled:!u,onClick:()=>{s(r),l(!0),p(!1)},children:"Reset"}),g(Q,{leftIcon:g(SC,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!a||!u,onClick:m,children:"Save"})]})]})}pR.id=bh;Se();Se();function PE(t){let{docId:e,deepKey:n,translatable:o}=t,[r,i]=R(!0),[s,a]=R([]),l=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return P(()=>{async function c(){i(!0);let[d,u]=await Promise.all([lC(e),cC(e,"draft")]),p=d.versions,f=[];if(u){let m=Ro(u,n);f.push({value:RE(m),modifiedBy:u.sys?.modifiedBy||"Unknown",modifiedAt:u.sys?.modifiedAt?.toDate?.()||new Date,versionId:"draft"})}for(let m of p){let _=Ro(m,n);f.push({value:RE(_),modifiedBy:m.sys?.modifiedBy||"Unknown",modifiedAt:m.sys?.modifiedAt?.toDate?.()||new Date,versionId:m._versionId})}let h=[];for(let m of f){let _=h[h.length-1];(!_||_.value!==m.value)&&h.push(m)}a(h),i(!1)}c()},[e,n]),r?g("div",{className:"FieldHistory__loading",children:g(Zt,{size:"sm"})}):s.length===0?g("div",{className:"FieldHistory__empty",children:"No history available."}):g("div",{className:"FieldHistory",children:s.map((c,d)=>g("div",{className:"FieldHistory__entry",children:[g("div",{className:"FieldHistory__entry__header",children:[g("span",{className:"FieldHistory__entry__author",children:c.modifiedBy}),g("span",{className:"FieldHistory__entry__date",children:l.format(c.modifiedAt)}),d===0&&g("span",{className:"FieldHistory__entry__badge",children:"Current"}),o&&c.value&&g("span",{className:"FieldHistory__entry__translationsLink",children:g(fR,{value:c.value})})]}),g("div",{className:"FieldHistory__entry__value",children:c.value||g("span",{className:"FieldHistory__entry__empty",children:"(empty)"})})]},c.versionId))})}function fR(t){let[e,n]=R("");return P(()=>{dr(t.value).then(o=>{n(`/cms/translations/${o}`)})},[t.value]),e?g(De,{label:"Open in Translations Editor",withArrow:!0,position:"right",children:g(Be,{component:"a",href:e,target:"_blank",variant:"transparent",size:"sm",children:g(Hi,{size:16})})}):null}function RE(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}var yh="EditTranslationsModal";function BE(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal(yh,{...e,innerProps:n,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(yh)}}}function xh(t){let{innerProps:e,context:n,id:o}=t,r=e.strings||[],s=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],[a,l]=R({}),[c,d]=R([]),[u,p]=R(!1),[f,h]=R(!1),[m,_]=R(!0),[b,y]=R(!1),[x,v]=R(""),[E,C]=R(!1),[k,T]=R("translations"),w=e.draft||null;P(()=>{if(e.field?.deepKey&&w?.controller){let M=FE(e.field.deepKey),I=w.controller.getValue(M)||{};y(I.disableTranslations||!1),v(I.description||"")}},[e.field?.deepKey,w?.controller]),P(()=>{fd({tags:[e.docId]}).then(M=>{let I={};Object.values(M).forEach(L=>{I[L.source]=L}),l(I),_(!1)})},[e.docId]);async function S(){h(!0),await cr(async()=>{let M=`edit-translations-${e.docId}`;if(ke({id:M,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0}),e.field?.deepKey&&w?.controller){let I=FE(e.field.deepKey),L=w.controller.getValue(I)||{};b?L.disableTranslations=!0:delete L.disableTranslations,x?L.description=x:delete L.description,Object.keys(L).length>0?await w.controller.updateKey(I,L):await w.controller.removeKey(I),await w.controller.flush()}if(!b&&c.length>0){let I=[];c.forEach(L=>{let K=a[L];I.push(K)}),await js(e.docId,I)}bt({id:M,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),h(!1)}function N(M){l(I=>{let L={...I};return L[M.source]=M,L}),d(I=>{let L=new Set(I);return L.add(M.source),Array.from(L)}),p(!0)}async function D(){if(r.length!==0){C(!0);try{await cr(async()=>{for(let M of r){let I=a[M]||{source:M},L={};s.forEach(B=>{I[B]&&(L[B]=I[B])});let K=s.filter(B=>!I[B]);if(K.length===0)continue;let W=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:M,targetLocales:K,description:x||void 0,existingTranslations:L})});if(W.status!==200){let B=await W.text();throw new Error(`Translation failed: ${B}`)}let q=await W.json();if(q.success&&q.translations){let B={...I};Object.entries(q.translations).forEach(([se,me])=>{B[se]=me}),N(B)}}ke({message:"Finished generating AI translations",color:"green"})})}finally{C(!1)}}}function O(){if(!!!(window.__ROOT_CTX?.experiments||{}).ai)return!1;for(let L of r){let K=a[L]||{};for(let W of s)if(!K[W])return!0}return!1}return g("div",{className:"EditTranslationsModal",children:[m?g(Zt,{}):g(Me,{children:[e.field?.deepKey&&g("div",{className:"EditTranslationsModal__tabs",children:[g("button",{type:"button",className:we("EditTranslationsModal__tabs__tab",k==="translations"&&"active"),onClick:()=>T("translations"),children:"Translations"}),g("button",{type:"button",className:we("EditTranslationsModal__tabs__tab",k==="history"&&"active"),onClick:()=>T("history"),children:"History"})]}),k==="history"&&e.field?.deepKey?g(PE,{docId:e.docId,deepKey:e.field.deepKey,translatable:!0}):g(Me,{children:[g("div",{className:"EditTranslationsModal__controls",children:[g("div",{className:"EditTranslationsModal__controls__doNotTranslate",children:[g(Mo,{label:"Do not translate",checked:b,onChange:M=>{y(M.currentTarget.checked),p(!0)},size:"sm"}),g(De,{label:"Prevent the string from being included for translation",withArrow:!0,position:"right",children:g(lh,{size:14,style:{marginLeft:"6px"}})})]}),g("div",{className:"EditTranslationsModal__controls__description",children:[g("div",{className:"EditTranslationsModal__controls__description__label",children:[g("span",{children:"Description"}),g(De,{label:"Translator notes may be included when the string is extracted and sent for translation",withArrow:!0,position:"right",children:g(lh,{size:14,style:{marginLeft:"6px"}})})]}),g(Ao,{size:"sm",autosize:!0,minRows:1,maxRows:6,value:x,placeholder:"Add context or notes for translators...",onChange:M=>{v(M.currentTarget.value),p(!0)}})]})]}),g("table",{className:"EditTranslationsModal__table",children:[g("thead",{style:{display:b?"none":"table-header-group"},children:g("tr",{children:[g("th",{children:g(ur,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),g("th",{children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g(ur,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"}),O()&&g(De,{label:"Generate quick translations using AI",withArrow:!0,position:"left",children:g(Be,{variant:"outline",onClick:D,loading:E,disabled:E,sx:{height:30,width:30,borderColor:"#ced4da"},children:E?g(wd,{size:16}):g(Ys,{size:16,fill:"currentColor",stroke:1.5})})})]})})]})}),g("tbody",{children:r.map(M=>g("tr",{style:{display:b?"none":"table-row"},children:[g("td",{children:g("div",{className:"EditTranslationsModal__table__source",children:M})}),g("td",{children:g(xh.StringsEditor,{source:M,locales:s,translations:a[M]||{},onChange:N})})]}))})]})]})]}),g("div",{className:"EditTranslationsModal__footer",children:[g("div",{className:"EditTranslationsModal__footer__left",children:[g(Q,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:g(Gs,{size:14}),children:"Open Translations Editor"}),e.l10nSheet&&g("div",{className:"EditTranslationsModal__footer__gsheet",children:[g("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",g("a",{href:Us(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]})]}),g("div",{className:"EditTranslationsModal__footer__buttons",children:[g(Q,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(Q,{variant:"filled",size:"xs",color:"dark",onClick:()=>S(),disabled:!u,loading:f,children:"Save"})]})]})]})}xh.StringsEditor=t=>{let e=t.locales,[n,o]=R(t.translations||{}),[r,i]=R(!1);P(()=>{o(t.translations||{})},[t.translations]);function s(a,l){i(!0),o(c=>{let d={...c,source:t.source};return d[a]=l,d})}return P(()=>{r&&t.onChange(n)},[r,n]),g("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(a=>g("div",{className:"EditTranslationsModal__StringsEditor__row",children:[g("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:a}),g("div",{className:we("EditTranslationsModal__StringsEditor__row__translation",n[a]?"hasValue":"empty"),children:g(Ao,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:n[a],onChange:l=>{s(a,l.currentTarget.value)}})})]}))})};xh.id=yh;function FE(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}zs();Se();var $E="ExportSheetModal";function zE(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal($E,{...e,title:"Export to Google Sheet",innerProps:n,size:"650px"})}}}function vh(t){let{innerProps:e,context:n,id:o}=t,[r,i]=R(!1),[s,a]=R("new-sheet"),[l,c]=R(""),[d,u]=R(!1),p=Ld(),f=pE(),h=Y(),m=nC(f.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],b=!1;(s==="add-tab"||s==="link-sheet")&&(b=!0,l&&ud(l)?.spreadsheetId&&(b=!1));async function y(k,T){let w=T?.isNew||!1,{headers:S,rows:N}=e.csvData;w?(await k.replaceSheet(S,N),await k.applyL10nTheme()):await k.updateValuesMap(N,{keyedBy:"source",preserveColumns:e.locales})}async function x(){p.isLoggedIn()||await p.login();let k=window.__ROOT_CTX.rootConfig,T=k.projectName||k.projectId||"Root CMS",w,S,N="create-google-sheet";try{if(ke({id:N,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),w=await Ks.create({title:`${T} Localization`,parent:m,share:h.current?.checked}),S=await w.getSheet(0),!S)throw new Error("could not find sheet gid=0");S.setTitle(e.docId)}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),bt({id:N,title:"Failed to create Google Sheet",message:String(O),color:"red",autoClose:!1});return}try{bt({id:N,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let D={spreadsheetId:w.spreadsheetId,gid:0};await hd(e.docId,D)}catch(D){console.error(D),bt({id:N,title:"Failed to link Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{bt({id:N,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(S,{isNew:!0})}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),bt({id:N,title:"Failed to export strings to Google Sheet",message:O,color:"red",autoClose:!1});return}c(S.getUrl()),u(!0),bt({id:N,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function v(){p.isLoggedIn()||await p.login();let k=ud(l);if(!k?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let T=new Ks(k.spreadsheetId),w,S="add-tab-google-sheet";try{ke({id:S,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),w=await T.createSheet({title:e.docId})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),bt({id:S,title:"Failed to create Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{bt({id:S,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let N={spreadsheetId:T.spreadsheetId,gid:w.gid};await hd(e.docId,N)}catch(N){console.error(N),bt({id:S,title:"Failed to link Google Sheet",message:String(N),color:"red",autoClose:!1});return}try{bt({id:S,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(w,{isNew:!0})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),bt({id:S,title:"Failed to export strings to Google Sheet",message:D,color:"red",autoClose:!1});return}u(!0),bt({id:S,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function E(){let k="link-google-sheet",T=ud(l);if(!T?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{ke({id:k,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await hd(e.docId,T)}catch(w){console.error(w),bt({id:k,title:"Failed to link Google Sheet",message:String(w),color:"red",autoClose:!1});return}u(!0),bt({id:k,title:`Done! Linked ${e.docId} to Google Sheet.`,message:Us(T),autoClose:!1})}async function C(){console.log(s),i(!0),s==="new-sheet"?await cr(x):s==="add-tab"?await cr(v):s==="link-sheet"&&await cr(E),i(!1)}return g("div",{className:"ExportSheetModal",children:g("div",{className:"ExportSheetModal__content",children:[g("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),g("form",{className:"ExportSheetModal__form",children:[g("div",{className:"ExportSheetModal__form__section",children:[g("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),g(Lo,{disabled:d||r,itemComponent:vh.SelectItem,data:_,onChange:k=>{a(k),k==="new-sheet"&&c("")},value:s})]}),g("div",{className:"ExportSheetModal__form__section",children:[g("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),s==="new-sheet"?g(lr,{disabled:!0,placeholder:f.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):g(lr,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:d||r,onChange:k=>c(k.currentTarget.value)})]}),s==="new-sheet"&&g("div",{className:"ExportSheetModal__form__section",children:g(De,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:g(Mo,{disabled:d||r,ref:h,name:"share",value:"true",label:"Share Google Sheet with collaborators",defaultChecked:!m})})}),g("div",{className:"ExportSheetModal__form__buttons",children:d?g(Me,{children:[g(Q,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:g(Gs,{size:16}),children:"Open Google Sheet"}),g(Q,{variant:"filled",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):g(Me,{children:[g(Q,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(Q,{variant:"filled",size:"xs",color:"primary",loading:r,disabled:b,onClick:()=>C(),children:s==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}vh.SelectItem=$i(t=>{let{label:e,help:n,...o}=t;return g("div",{className:"ExportSheetModal__SelectItem",...o,children:[g(El,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),g(El,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:n})]})});vh.id=$E;Se();Se();function HE(t){let{labels:e}=t,[n,o]=R(0);return P(()=>{let r=setTimeout(()=>{o(i=>(i+1)%e.length)},2e3);return()=>clearTimeout(r)},[n,e.length]),g("div",{className:"ProgressiveLoader",children:[g(Zt,{color:"gray",size:"md"}),g("div",{className:"ProgressiveLoader__labels",children:g(sr,{size:"sm",color:"dimmed",className:"ProgressiveLoader__label--entering",children:e[n]},n)})]})}var KE="LocalizationModal";function UE(){let t=Qt(),e=yt();return{open:n=>{let o=new URLSearchParams(window.location.search);o.set("modal","localization"),window.history.replaceState(null,"",`${window.location.pathname}?${o}`),t.openContextModal(KE,{...e,innerProps:n,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{n.draft?.flush({quiet:!0});let r=new URLSearchParams(window.location.search);r.delete("modal");let i=r.toString()?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",i)}})}}}function Bo(t){let e=t.innerProps;return g("div",{className:"LocalizationModal",children:g("div",{className:"LocalizationModal__layout",children:[g(Bo.ConfigLocales,{...e}),g(Bo.Translations,{...e})]})})}Bo.id=KE;Bo.ConfigLocales=t=>{let[e,n]=R(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},r=o.locales||["en"],i=o.groups||{default:{label:"",locales:r}};function s(c){return e.filter(d=>(i[c].locales||[]).includes(d))}function a(c,d){let u=new Set(e),p=i[c].locales||[];for(let h of p)d.includes(h)?u.add(h):u.delete(h);let f=Array.from(u.values()).sort();l(f)}function l(c){n(c),t.draft.setLocales(c)}return g("div",{className:"LocalizationModal__locales",children:g(qr,{spacing:30,children:[g(ar,{children:[g(ur,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[g(VC,{strokeWidth:1.5}),g("span",{children:"Locales"})]}),g(Bo.AllNoneButtons,{onAllClicked:()=>l(r),onNoneClicked:()=>l([])})]}),g(qr,{spacing:40,children:Object.keys(i).map(c=>{let d=i[c],u=s(c);return g(Bo.LocaleGroup,{group:d,groupEnabledLocales:u,allEnabledLocales:e,onChange:p=>a(c,p)})})})]})})};Bo.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],n=t.group.locales||[],o=t.allEnabledLocales||[];function r(s){t.onChange&&t.onChange(s)}function i(s){let a=e.indexOf(s);a===-1?e.push(s):e.splice(a,1),r(e)}return g(qr,{spacing:16,children:[t.group.label&&g(ar,{position:"apart",children:[g(ur,{size:"h4",weight:"semi-bold",children:t.group.label}),g(Bo.AllNoneButtons,{onAllClicked:()=>r(n),onNoneClicked:()=>r([])})]}),g(ar,{children:n.map(s=>{let a=e.includes(s),l=o.length<=1&&a;return g(Mo,{value:s,checked:a,disabled:l,label:jE(s),onChange:()=>i(s),size:"xs"})})})]})};Bo.AllNoneButtons=t=>g(ar,{spacing:"8px",children:[g(Q,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,children:"All"}),"/",g(Q,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,children:"None"})]});Bo.Translations=t=>{let[e,n]=R(!0),[o,r]=R([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=t.locale||i.find(H=>H!=="en")||"en",[a,l]=R(s),[c,d]=R(!1),[u,p]=R({}),f=X(()=>{if(!a)return{};let H={};return Object.values(u).forEach(te=>{H[te.source]=te[a]||""}),H},[a,u]),h=Ld(),[m,_]=R(null),b=zE(),y=gE(),[x,v]=R(new Set),E=x.size,[C,k]=R({}),[T,w]=R(!1),[S,N]=R(!1),[D,O]=R(null),M=Y(!1),I=Y(null),L=Object.keys(C).length;function K(H,te,pe){k(ie=>{let _e={...ie};_e[H]||(_e[H]={}),_e[H]={..._e[H],[te]:pe};let He=f[H]||"";return pe===He&&(delete _e[H][te],Object.keys(_e[H]).length===0&&delete _e[H]),_e})}async function W(){w(!0);try{let H=Object.entries(C).map(([ie,_e])=>({source:ie,locales:_e}));await oC(H,{tags:[t.docId]});let te=await Promise.all(H.map(async ie=>({hash:await dr(ie.source),source:ie.source,locales:ie.locales}))),pe=[t.docId];p(ie=>{let _e={...ie};for(let{hash:He,source:wt,locales:Dt}of te){let an=_e[He],Vr=an?.tags||[],Tn=Array.from(new Set([...Vr,...pe]));an?_e[He]={...an,...Dt,tags:Tn}:_e[He]={source:wt,...Dt,tags:Tn}}return _e}),k({}),ke({title:"Saved!",message:`Updated ${H.length} translation(s).`,autoClose:2500})}catch(H){console.error(H),ke({title:"Error saving translations",message:String(H),color:"red",autoClose:!1})}w(!1)}function q(){return!!!(window.__ROOT_CTX?.experiments||{}).ai||!a?!1:o.some(pe=>{let ie=C[pe]?.[a];return ie!==void 0?!ie:!f[pe]})}function B(){M.current=!0,I.current?.abort()}async function se(){if(!(!a||o.length===0)){M.current=!1,N(!0);try{for(let H of o){if(M.current)break;if(C[H]?.[a]||f[H])continue;O(H);let pe=new AbortController;I.current=pe;let ie={},_e=mt[H];_e&&i.forEach(Dt=>{_e[Dt]&&(ie[Dt]=_e[Dt])});let He=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:H,targetLocales:[a],existingTranslations:ie}),signal:pe.signal});if(He.status!==200){let Dt=await He.text();throw new Error(`Translation failed: ${Dt}`)}let wt=await He.json();wt.success&&wt.translations?.[a]&&K(H,a,wt.translations[a])}M.current?ke({message:"AI translation stopped",color:"yellow"}):ke({message:"Finished generating AI translations",color:"green"})}catch(H){H instanceof DOMException&&H.name==="AbortError"||(console.error(H),ke({title:"Error generating translations",message:String(H),color:"red"}))}finally{N(!1),O(null),M.current=!1,I.current=null}}}let me=Y(!1);P(()=>{if(e)return;if(!me.current){me.current=!0;return}let H=!1;async function te(){let pe=[t.docId],ie=await Promise.all(o.map(async He=>({source:He,hash:await dr(He)})));if(H)return;let _e=new Set;for(let{source:He,hash:wt}of ie)if(u[wt]){let Dt=u[wt].tags||[];pe.every(Vr=>Dt.includes(Vr))||_e.add(He)}H||v(_e)}return te(),()=>{H=!0}},[t.docId,o,u,e]);let mt=X(()=>{let H={};return Object.values(u).forEach(te=>{H[te.source]=te}),H},[u]),Jt=i.map(H=>({value:H,label:jE(H)})),dt=X(()=>!a||o.length===0?0:o.filter(H=>{let te=C[H]?.[a];return te!==void 0?!te:!f[H]}).length,[o,f,a,C]);P(()=>{n(!0),Promise.all([fE(t.docId),fd(),uC(t.docId)]).then(async([H,te,pe])=>{let ie=[t.docId],_e=await Promise.all(H.map(async wt=>({source:wt,hash:await dr(wt)}))),He=new Set;for(let{source:wt,hash:Dt}of _e)if(te[Dt]){let an=te[Dt].tags||[];ie.every(Tn=>an.includes(Tn))||He.add(wt)}r(H),p(te),_(pe),v(He),n(!1)}).catch(H=>{console.error("Failed to load translations:",H),n(!1),ke({title:"Error",message:String(H?.message||H),color:"red",autoClose:!1})})},[t.docId]);function _t(H,te){let pe=mt[H];return pe&&pe[te]||""}function sn(){let H=i.filter(ie=>ie!=="en"),te=["source","en",...H],pe=[];return o.forEach(ie=>{let _e={source:ie,en:_t(ie,"en")||ie};H.forEach(He=>{_e[He]=_t(ie,He)}),pe.push(_e)}),{headers:te,rows:pe}}async function ye(){let{headers:H,rows:te}=sn(),pe=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:H,rows:te})});if(pe.status!==200){console.error("csv.download failed:");let He=await pe.text();console.error(He)}let ie=await pe.blob(),_e=window.URL.createObjectURL(ie);window.location.assign(_e),window.URL.revokeObjectURL(_e)}async function Je(){let H=document.createElement("input");H.type="file",H.accept=".csv",H.addEventListener("change",async()=>{let te=H.files?.[0];if(te){let pe=new FormData;pe.append("file",te);try{let ie=await fetch("/cms/api/csv.import",{method:"POST",body:pe});if(ie.status!==200){let wt=await ie.text();throw new Error(`RPCError: ${wt}`)}let _e=(await ie.json()).data,He=await js(t.docId,_e);p(wt=>Ch(wt,He)),ke({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(ie){console.error(ie),ke({title:"Failed to import CSV",message:String(ie),color:"red",autoClose:!1})}}}),H.click()}async function st(){if(h.isLoggedIn()||await h.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let te=await new Ks(m.spreadsheetId).getSheet(m.gid??0);if(!te)throw new Error(`sheet not found: ${JSON.stringify(m)}`);await ml(te),ke({title:"Exported strings to Google Sheet",message:te.getUrl(),autoClose:!1})}async function ml(H,te){let pe=te?.isNew||!1,{headers:ie,rows:_e}=sn();pe?(await H.replaceSheet(ie,_e),await H.applyL10nTheme()):await H.updateValuesMap(_e,{keyedBy:"source",preserveColumns:i}),tC("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:H.spreadsheet.spreadsheetId,gid:H.gid}}})}async function Bt(){if(h.isLoggedIn()||await h.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let te=await new Ks(m.spreadsheetId).getSheet(m.gid??0);if(!te)throw new Error(`sheet not found: ${JSON.stringify(m)}`);console.log("importing google sheet");let pe=await te.getValuesMap(),ie=await js(t.docId,pe);p(_e=>Ch(_e,ie)),ke({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function wn(){await dC(t.docId),_(null),ke({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function _l(){n(!0);let H=[],te=[t.docId];for(let pe of o){let ie=await dr(pe);if(u[ie]){let _e=u[ie].tags||[],He=Array.from(new Set([..._e,...te]));H.push({hash:ie,tags:He})}}H.length>0?(await ih(H,{mode:"union"}),p(pe=>{let ie={...pe};return H.forEach(({hash:_e,tags:He})=>{ie[_e]&&(ie[_e]={...ie[_e],tags:He})}),ie}),ke({title:"Tags Applied",message:`Applied tag "${t.docId}" to ${H.length} string(s).`,color:"green"})):ke({title:"No strings updated",message:"No existing translations found to tag.",color:"blue"}),n(!1)}async function ir(H){try{await H()}catch(te){console.error(te);let pe;typeof te=="object"&&te.body?pe=String(te.body):pe=String(te),ke({title:"Error",message:pe,color:"red",autoClose:!1})}}function eo(H){switch(H){case"EXPORT_DOWNLOAD_CSV":{ir(ye);return}case"EXPORT_GOOGLE_SHEET_LINKED":{ir(st);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{b.open({docId:t.docId,csvData:sn(),locales:i});return}case"IMPORT_CSV":{ir(Je);return}case"IMPORT_GOOGLE_SHEET_LINKED":{ir(Bt);return}case"UNLINK_GOOGLE_SHEET":{ir(wn);return}default:console.log("unhandled action: "+H)}}async function id(H,te){let ie=(window.__ROOT_CTX.translations||[]).find(_e=>_e.id===H)?.label||H;await ir(async()=>{let _e=te==="export"?await hE(t.docId):null,He=o.map(an=>{let Vr={};i.forEach($t=>{Vr[$t]=_t(an,$t)??""});let Tn=_e?.get(an)?.description;return{source:an,translations:Vr,...Tn?{description:Tn}:{}}}),wt=te==="import"||te==="export"?te:(()=>{throw new Error("Invalid translations action")})(),Dt=`translations-${wt}-${H}`;ke({id:Dt,message:te==="import"?`Importing from ${ie}...`:`Exporting to ${ie}...`,loading:!0,autoClose:!1,disallowClose:!0});try{let an=await window.fetch(`/cms/api/translations.${wt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:H,docId:t.docId,data:He})});if(!(an.headers.get("content-type")||"").includes("application/json"))throw new Error(`Unexpected response (${an.status}). Please reload the page and try again.`);let Tn=await an.json();if(!Tn.success)throw new Error(Tn.error||"Unknown error");if(te==="import")if(Array.isArray(Tn.data)){let $t=Tn.data.map(Wr=>{let Io={source:String(Wr?.source??"")},Gr=Wr?.translations;return Gr&&typeof Gr=="object"&&i.forEach(Bs=>{let yl=Gr[Bs];yl!=null&&(Io[Bs]=String(yl))}),Io}),bl=await js(t.docId,$t,{actionMetadata:{service:H,numStrings:$t.length,locales:i},actionLinks:[{label:"Open translations",url:`/cms/content/${t.docId}?modal=localization`}]});p(Wr=>Ch(Wr,bl));let Fi=[t.docId],Sn=[];for(let Wr of $t){let Io=await dr(Wr.source),Bs=u[Io]?.tags||[],yl=Array.from(new Set([...Bs,...Fi]));Sn.push({hash:Io,tags:yl})}Sn.length>0&&(await ih(Sn,{mode:"union"}),p(Wr=>{let Io={...Wr};return Sn.forEach(({hash:Gr,tags:Bs})=>{Io[Gr]&&(Io[Gr]={...Io[Gr],tags:Bs})}),Io})),bt({id:Dt,title:"Imported!",message:`Imported translations from ${ie}.`,loading:!1,autoClose:5e3})}else{let $t=Tn.data||{},bl=$t.title||"Import complete",Fi=$t.message||`Imported translations from ${ie}.`,Sn=$t.link;bt({id:Dt,title:bl,color:$t.status==="success"?"green":$t.status==="error"?"red":void 0,message:Sn?.url?g("div",{children:[g("div",{children:Fi}),g(Q,{component:"a",href:Sn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:g(Ws,{size:14}),style:{marginTop:"8px"},children:Sn.label||"Open"})]}):Fi,loading:!1,autoClose:Sn?.url?1e4:5e3})}else{let $t=Tn.data||{},bl=$t.title||"Exported!",Fi=$t.message||`Exported translations to ${ie}.`,Sn=$t.link;bt({id:Dt,title:bl,color:$t.status==="success"?"green":$t.status==="error"?"red":void 0,message:Sn?.url?g("div",{children:[g("div",{children:Fi}),g(Q,{component:"a",href:Sn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:g(Ws,{size:14}),style:{marginTop:"8px"},children:Sn.label||"Open"})]}):Fi,loading:!1,autoClose:Sn?.url?1e4:5e3})}}catch(an){throw Vv(Dt),an}})}return g("div",{className:"LocalizationModal__translations",children:[g("div",{className:"LocalizationModal__translations__topWrapper",children:[g("div",{className:"LocalizationModal__translations__header",children:[g("div",{className:"LocalizationModal__translations__titleWrap",children:g(ur,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[g(Hi,{strokeWidth:1.5})," ",g("span",{children:"Translations"})]})}),g("div",{className:"LocalizationModal__translations__header__buttons",children:[h.enabled&&m?.spreadsheetId&&g(De,{label:"Open Google Sheet",children:g(Be,{component:"a",href:Us(m),target:"_blank",variant:"filled",color:"green",size:"sm",children:g(Id,{size:16,strokeWidth:2.25})})}),g(Q,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:g(Ws,{size:14,strokeWidth:1.75}),children:"Open Editor"}),g(gR,{onAction:eo,onServiceAction:id,gapiClient:h,linkedSheet:m}),g(mR,{onAction:eo,onServiceAction:id,gapiClient:h,linkedSheet:m}),g(ne,{className:"LocalizationModal__translations__menu",control:g(De,{label:"Tools",children:g(Be,{className:"LocalizationModal__translations__menu__dots",variant:"default",children:g(Cl,{size:16})})}),size:220,children:g(ne.Item,{className:"LocalizationModal__translations__menu__item",icon:g(ZC,{size:16}),onClick:()=>y.open({docId:t.docId,sourceStrings:o,onPruned:H=>{p(te=>{let pe={...te};return H.forEach(ie=>delete pe[ie]),pe})}}),children:"Prune unused strings"})})]})]}),e&&g(HE,{labels:["Transmogrifying...","Deciphering the vibes...","Consulting the Rosetta Stone...","Untangling the syntax...","Babel-ing..."]}),!e&&E>0&&g("div",{className:"LocalizationModal__missingTags",children:[g("div",{className:"LocalizationModal__missingTags__message",children:[g(sh,{}),E>1?g(sr,{size:"sm",children:[g("b",{children:[E," strings"]}),' are missing the "',t.docId,'" tag.']}):g(sr,{size:"sm",children:[g("b",{children:[E," string"]}),' is missing the "',t.docId,'" tag.']})]}),g(Q,{variant:"filled",size:"xs",onClick:()=>ir(_l),loading:e,leftIcon:g(Cl,{size:16}),children:"Fix missing tags"})]}),!e&&g("table",{className:"LocalizationModal__translations__table",children:[g("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[g("th",{className:"LocalizationModal__translations__table__header",children:g(ur,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),g("th",{className:"LocalizationModal__translations__table__header",children:g("div",{className:"LocalizationModal__translations__localeHeader",children:[g(ur,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[g("span",{children:"LOCALE: "})," ",g(Lo,{data:Jt,size:"xs",placeholder:"select locale",allowDeselect:!0,value:a,onChange:H=>l(H)})]}),g("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a&&dt>0&&g(De,{label:c?"Show all translations":"Show only missing translations",position:"top",withArrow:!0,children:g("button",{className:`LocalizationModal__translations__missingToggle${c?" LocalizationModal__translations__missingToggle--active":""}`,onClick:()=>d(H=>!H),children:[g(OC,{size:14}),g("span",{children:[dt," missing"]})]})},c?"active":"inactive"),a&&o.length>0&&dt===0&&L===0&&g("div",{className:"LocalizationModal__translations__fullyTranslated",children:[g(zi,{size:14}),g("span",{children:"Translated"})]}),q()&&!S&&g(De,{label:"Generate translations using AI",withArrow:!0,position:"top",children:g(Be,{variant:"default",size:"sm",onClick:se,children:g(Ys,{size:14,fill:"black"})})}),S&&g(De,{label:"Stop generating",withArrow:!0,position:"top",children:g(Be,{variant:"default",size:"sm",onClick:B,children:g(qC,{size:14,fill:"black"})})}),S&&g(wd,{size:18,className:"LocalizationModal__spinner"})]})]})})]}),o.filter(H=>!c||!a?!0:!f[H]).map((H,te)=>g("tr",{className:"LocalizationModal__translations__table__row",children:[g("td",{className:"LocalizationModal__translations__table__col",children:g("div",{className:"LocalizationModal__sourceCell",children:[g("span",{className:"LocalizationModal__sourceCell__text",children:H}),(mt[H]||x.has(H))&&g("div",{className:"LocalizationModal__sourceCell__icons",children:[mt[H]&&g(Be,{className:"LocalizationModal__sourceCell__link",size:"sm",variant:"subtle",onClick:async()=>{let pe=await dr(H);window.open(`/cms/translations/${pe}`,"_blank")},children:g(Gs,{size:16})}),x.has(H)&&g(De,{label:`Missing "${t.docId}" tag`,position:"top",withArrow:!0,children:g(Be,{className:"LocalizationModal__sourceCell__missingTag",size:"sm",variant:"subtle",children:g(sh,{size:14})})})]})]})}),g("td",{className:"LocalizationModal__translations__table__col",children:g(hR,{source:H,locale:a,savedValue:f[H]||"",pendingValue:C[H]?.[a],isAiGenerating:D===H,readOnly:S,onEdit:pe=>K(H,a,pe)})})]},te))]})]}),g("div",{className:"LocalizationModal__translations__saveBar",children:[g("span",{className:"LocalizationModal__translations__saveBar__status",children:L>0?`${L} unsaved change${L!==1?"s":""}`:""}),L>0&&g(Q,{variant:"default",size:"xs",leftIcon:g(Xr,{size:14}),onClick:()=>k({}),children:"Discard changes"}),g(Q,{variant:"filled",size:"xs",color:"dark",leftIcon:g(zi,{size:14}),onClick:W,loading:T,disabled:L===0,children:"Save"})]})]})};function hR(t){let e=t.pendingValue!==void 0?t.pendingValue:t.savedValue,o=[t.pendingValue!==void 0?"LocalizationModal__translations__cell--edited":"",t.isAiGenerating?"LocalizationModal__translations__cell--ai-generating":"",e?"":"LocalizationModal__translations__cell--empty"].filter(Boolean).join(" ")||void 0;return g(Ao,{size:"xs",autosize:!0,minRows:1,value:e,placeholder:"",readOnly:t.readOnly,onChange:r=>t.onEdit(r.currentTarget.value),className:o,styles:{root:{height:"100%"},wrapper:{height:"100%"},input:{fontSize:"12px",minHeight:"100%"}}})}function gR(t){function e(r){t.onAction&&t.onAction(r)}let n=t.linkedSheet,o=(window.__ROOT_CTX.translations||[]).filter(r=>r.hasImport);return g(ne,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:g(Q,{variant:"default",color:"dark",size:"xs",leftIcon:g(DC,{size:16,strokeWidth:1.75}),rightIcon:g(Hn,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&g(Me,{children:[g(ne.Label,{children:"Google Sheets"}),g(ne.Item,{className:"LocalizationModal__translations__menu__item",disabled:!n?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),g(Hs,{})]}),g(ne.Label,{children:"File"}),g(ne.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"}),o.length>0&&g(Me,{children:[g(Hs,{}),g(ne.Label,{children:"Services"}),o.map(r=>g(ne.Item,{className:"LocalizationModal__translations__menu__item",icon:r.icon?g("img",{src:r.icon,alt:r.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(r.id,"import"),children:["Import from ",r.label]},r.id))]})]})}function mR(t){async function e(i){t.onAction&&t.onAction(i)}let o=!!t.linkedSheet?.spreadsheetId,r=(window.__ROOT_CTX.translations||[]).filter(i=>i.hasExport);return g(ne,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:g(Q,{variant:"default",color:"dark",size:"xs",leftIcon:g(NC,{size:16,strokeWidth:1.75}),rightIcon:g(Hn,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&g(Me,{children:[g(ne.Label,{children:"Google Sheets"}),o?g(Me,{children:g(ne.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):g(Me,{children:g(ne.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),g(Hs,{})]}),g(ne.Label,{children:"File"}),g(ne.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),r.length>0&&g(Me,{children:[g(Hs,{}),g(ne.Label,{children:"Services"}),r.map(i=>g(ne.Item,{className:"LocalizationModal__translations__menu__item",icon:i.icon?g("img",{src:i.icon,alt:i.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(i.id,"export"),children:["Export to ",i.label]},i.id))]}),o&&g(Me,{children:[g(Hs,{}),g(ne.Label,{children:"Danger zone"}),g(ne.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function Ch(t,e){let n={...t};for(let[o,r]of Object.entries(e)){let i=n[o];n[o]=i?{...i,...r}:r}return n}function jE(t){let e=t.split("_"),n=e[0];if(n==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(n)||t} (${t})`}Se();function VE(t){let e=new Set;return Eh(t,e),Array.from(e)}function Eh(t,e){if(!(!t||typeof t!="object")){if(Array.isArray(t)){for(let n of t)Eh(n,e);return}if(_R(t)){e.add(t.id);return}for(let n of Object.keys(t))Eh(t[n],e)}}function _R(t){return typeof t.id=="string"&&typeof t.collection=="string"&&typeof t.slug=="string"&&t.id.includes("/")}var WE="PublishDocModal";function GE(t){let e=Qt(),n=yt();return{open:()=>{e.openContextModal(WE,{...n,title:`Publish ${t.docId}`,innerProps:t,size:"850px"})}}}function bR(t){let{innerProps:e,context:n,id:o}=t,[r,i]=R(""),[s,a]=R(""),[l,c]=R(!1),[d,u]=R(""),[p,f]=R(!1),h=Y(null),m=Qt(),_=yt(),b=window.__ROOT_CTX.experiments||{},{roles:y,loading:x}=Rd(),v=window.firebase.user.email||"",E=Pd(y,v),C=r==="scheduled"?"Schedule":"Publish";async function k(){try{c(!0),await rC(e.docId,{publishMessage:d.trim()||void 0}),c(!1),ke({title:"Published!",message:`Succesfully published ${e.docId}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=oh(D);ke({title:"Publish failed",message:`Failed to publish ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function T(){try{c(!0);let D=Math.floor(new Date(s).getTime());await iC(e.docId,D,{publishMessage:d.trim()||void 0}),c(!1),ke({title:"Scheduled!",message:`${e.docId} will go live ${s}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=oh(D);ke({title:"Schedule failed",message:`Failed to schedule ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function w(){try{f(!0);let O=await(await window.fetch("/cms/api/ai.publish_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({docId:e.docId})})).json();O.success&&O.message?u(O.message):ke({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}catch(D){console.error(D),ke({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}finally{f(!1)}}function S(){m.openConfirmModal({..._,title:`${C} ${e.docId}`,children:g(Me,{children:[g(El,{size:"body-sm",weight:"semi-bold",className:"PublishDocModal__confirmText",children:["Are you sure you want to publish the following doc? The doc will go live ",r==="now"?"now":`at ${s}`,"."]}),g(mE,{docId:e.docId})]}),labels:{confirm:C,cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{r==="now"?k():r==="scheduled"&&T()}})}let N=!0;return(r==="now"||r==="scheduled"&&s)&&(N=!1),(x||!E)&&(N=!0),g("div",{className:"PublishDocModal",children:g("div",{className:"PublishDocModal__content",children:[g("form",{className:"PublishDocModal__form",onSubmit:D=>{D.preventDefault(),S()},children:[g("div",{className:"PublishDocModal__form__publishOptions",children:g("div",{className:"PublishDocModal__form__publishOptions__options",children:[g("label",{className:we("PublishDocModal__form__publishOptions__option",r==="now"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="now"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[g("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[g("input",{type:"radio",name:"publish-option",value:"now",checked:r==="now",onChange:()=>i("now")})," ","Now"]}),g("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live immediately."})]}),g("label",{className:we("PublishDocModal__form__publishOptions__option",r==="scheduled"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="scheduled"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[g("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[g("input",{type:"radio",name:"publish-option",value:"scheduled",checked:r==="scheduled",onChange:()=>i("scheduled")}),g("div",{children:"Scheduled"})]}),g("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live at the date and time specified below."}),g("div",{className:"PublishDocModal__form__publishOptions__option__input2",children:[g("input",{ref:h,type:"datetime-local",disabled:r!=="scheduled",value:s,min:eC(),onChange:D=>{let O=D.target;a(O.value)}}),g("div",{className:"PublishDocModal__form__publishOptions__option__input2__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})]})]})}),g("div",{className:"PublishDocModal__form__publishMessage",children:g("div",{className:"PublishDocModal__form__publishMessage__wrapper",children:[g("textarea",{className:"PublishDocModal__form__publishMessage__textarea",placeholder:"Optional: Add a message to describe the changes",value:d,rows:3,onInput:D=>{let O=D.target;u(O.value)}}),b.ai&&g("button",{type:"button",className:"PublishDocModal__form__publishMessage__sparkle",onClick:w,disabled:p,children:g(De,{label:"Generate message",withArrow:!0,position:"left",allowPointerEvents:!0,wrapLines:!0,children:p?g(Zt,{size:16}):g(Ys,{size:16,stroke:1.5})})})]})}),g("div",{className:"PublishDocModal__form__buttons",children:[g(Q,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(Q,{variant:"filled",size:"xs",color:"dark",disabled:N,loading:l,type:"submit",children:C})]})]}),g("div",{className:"PublishDocModal__DiffWrapper",children:[g(vR,{docId:e.docId}),b.ai&&g(yE,{docId:e.docId,beforeVersion:"published",afterVersion:"draft"}),g(yR,{docId:e.docId})]})]})})}function yR(t){let e=t.docId,[n,o]=R(!1);function r(){o(!0)}return g("div",{className:"PublishDocModal__ShowChanges",children:g(th,{iconPosition:"right",onChange:()=>r(),disableIconRotation:!0,children:g(th.Item,{label:"Compare JSON data",icon:g(IC,{stroke:1.5}),iconPosition:"left",children:n&&g(xE,{left:{docId:e,versionId:"published"},right:{docId:e,versionId:"draft"},showExpandButton:!0,showAiSummary:!1})})})})}function xR(t){let e=t?.sys;return e?!!(!e.publishedAt||e.modifiedAt&&e.modifiedAt>e.publishedAt):!1}function vR(t){let[e,n]=R(!0),[o,r]=R([]);P(()=>{async function a(){n(!0);try{let l=await vl(t.docId);if(!l?.fields){n(!1);return}let c=VE(l.fields).filter(u=>u!==t.docId);if(c.length===0){n(!1);return}let d=[];await Promise.all(c.map(async u=>{try{let p=await vl(u);p&&xR(p)&&d.push(u)}catch(p){console.warn(`Failed to fetch reference doc: ${u}`,p)}})),r(d.sort())}catch(l){console.error("Failed to load reference docs",l)}n(!1)}a()},[t.docId]);let i=[t.docId,...o],s=gC({docIds:i});return e?g("div",{className:"PublishDocModal__ReferenceDocs",children:g(Zt,{color:"gray",size:"sm"})}):o.length===0?null:g("div",{className:"PublishDocModal__ReferenceDocs",children:[g("div",{className:"PublishDocModal__ReferenceDocs__header",children:[g("div",{className:"PublishDocModal__ReferenceDocs__header__label",children:["Referenced docs with unpublished changes (",o.length,")"]}),g(Q,{variant:"outline",size:"xs",color:"dark",leftIcon:g(WC,{size:16}),onClick:()=>s.open(),children:"Bundle all docs into a release"})]}),g("div",{className:"PublishDocModal__ReferenceDocs__list",children:o.map(a=>g(_d,{docId:a,variant:"compact",statusBadges:!0,clickable:!0},a))})]})}bR.id=WE;ut();ut();function pn(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var CR=typeof Symbol=="function"&&Symbol.observable||"@@observable",YE=CR,wh=()=>Math.random().toString(36).substring(7).split("").join("."),ER={INIT:`@@redux/INIT${wh()}`,REPLACE:`@@redux/REPLACE${wh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${wh()}`},qE=ER;function wR(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Th(t,e,n){if(typeof t!="function")throw new Error(pn(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(pn(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(pn(1));return n(Th)(t,e)}let o=t,r=e,i=new Map,s=i,a=0,l=!1;function c(){s===i&&(s=new Map,i.forEach((_,b)=>{s.set(b,_)}))}function d(){if(l)throw new Error(pn(3));return r}function u(_){if(typeof _!="function")throw new Error(pn(4));if(l)throw new Error(pn(5));let b=!0;c();let y=a++;return s.set(y,_),function(){if(b){if(l)throw new Error(pn(6));b=!1,c(),s.delete(y),i=null}}}function p(_){if(!wR(_))throw new Error(pn(7));if(typeof _.type>"u")throw new Error(pn(8));if(typeof _.type!="string")throw new Error(pn(17));if(l)throw new Error(pn(9));try{l=!0,r=o(r,_)}finally{l=!1}return(i=s).forEach(y=>{y()}),_}function f(_){if(typeof _!="function")throw new Error(pn(10));o=_,p({type:qE.REPLACE})}function h(){let _=u;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(pn(11));function y(){let v=b;v.next&&v.next(d())}return y(),{unsubscribe:_(y)}},[YE](){return this}}}return p({type:qE.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:f,[YE]:h}}function XE(t,e){return function(...n){return e(t.apply(this,n))}}function Sh(t,e){if(typeof t=="function")return XE(t,e);if(typeof t!="object"||t===null)throw new Error(pn(16));let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=XE(r,e))}return n}function kh(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...o)=>e(n(...o)))}function JE(...t){return e=>(n,o)=>{let r=e(n,o),i=()=>{throw new Error(pn(15))},s={getState:r.getState,dispatch:(l,...c)=>i(l,...c)},a=t.map(l=>l(s));return i=kh(...a)(r.dispatch),{...r,dispatch:i}}}ut();var SP=Zf(t0(),1),MR=Bv.startsWith("19"),AR=Symbol.for(MR?"react.transitional.element":"react.element"),LR=Symbol.for("react.portal"),RR=Symbol.for("react.fragment"),PR=Symbol.for("react.strict_mode"),FR=Symbol.for("react.profiler"),BR=Symbol.for("react.consumer"),$R=Symbol.for("react.context"),l0=Symbol.for("react.forward_ref"),zR=Symbol.for("react.suspense"),HR=Symbol.for("react.suspense_list"),Ih=Symbol.for("react.memo"),KR=Symbol.for("react.lazy");var UR=l0,jR=Ih;function VR(t){if(typeof t=="object"&&t!==null){let{$$typeof:e}=t;switch(e){case AR:switch(t=t.type,t){case RR:case FR:case PR:case zR:case HR:return t;default:switch(t=t&&t.$$typeof,t){case $R:case l0:case KR:case Ih:return t;case BR:return t;default:return e}}case LR:return e}}}function WR(t){return VR(t)===Ih}function GR(t,e,n,o,{areStatesEqual:r,areOwnPropsEqual:i,areStatePropsEqual:s}){let a=!1,l,c,d,u,p;function f(y,x){return l=y,c=x,d=t(l,c),u=e(o,c),p=n(d,u,c),a=!0,p}function h(){return d=t(l,c),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function m(){return t.dependsOnOwnProps&&(d=t(l,c)),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function _(){let y=t(l,c),x=!s(y,d);return d=y,x&&(p=n(d,u,c)),p}function b(y,x){let v=!i(x,c),E=!r(y,l,x,c);return l=y,c=x,v&&E?h():v?m():E?_():p}return function(x,v){return a?b(x,v):f(x,v)}}function YR(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:o,...r}){let i=e(t,r),s=n(t,r),a=o(t,r);return GR(i,s,a,t,r)}function qR(t,e){let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=(...i)=>e(r(...i)))}return n}function Dh(t){return function(n){let o=t(n);function r(){return o}return r.dependsOnOwnProps=!1,r}}function n0(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function c0(t,e){return function(o,{displayName:r}){let i=function(a,l){return i.dependsOnOwnProps?i.mapToProps(a,l):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,l){i.mapToProps=t,i.dependsOnOwnProps=n0(t);let c=i(a,l);return typeof c=="function"&&(i.mapToProps=c,i.dependsOnOwnProps=n0(c),c=i(a,l)),c},i}}function Mh(t,e){return(n,o)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${o.wrappedComponentName}.`)}}function XR(t){return t&&typeof t=="object"?Dh(e=>qR(t,e)):t?typeof t=="function"?c0(t,"mapDispatchToProps"):Mh(t,"mapDispatchToProps"):Dh(e=>({dispatch:e}))}function JR(t){return t?typeof t=="function"?c0(t,"mapStateToProps"):Mh(t,"mapStateToProps"):Dh(()=>({}))}function ZR(t,e,n){return{...n,...t,...e}}function QR(t){return function(n,{displayName:o,areMergedPropsEqual:r}){let i=!1,s;return function(l,c,d){let u=t(l,c,d);return i?r(u,s)||(s=u):(i=!0,s=u),s}}}function eP(t){return t?typeof t=="function"?QR(t):Mh(t,"mergeProps"):()=>ZR}function tP(t){t()}function nP(){let t=null,e=null;return{clear(){t=null,e=null},notify(){tP(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],o=t;for(;o;)n.push(o),o=o.next;return n},subscribe(n){let o=!0,r=e={callback:n,next:null,prev:e};return r.prev?r.prev.next=r:t=r,function(){!o||t===null||(o=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}var o0={notify(){},get:()=>[]};function d0(t,e){let n,o=o0,r=0,i=!1;function s(m){d();let _=o.subscribe(m),b=!1;return()=>{b||(b=!0,_(),u())}}function a(){o.notify()}function l(){h.onStateChange&&h.onStateChange()}function c(){return i}function d(){r++,n||(n=e?e.addNestedSub(l):t.subscribe(l),o=nP())}function u(){r--,n&&r===0&&(n(),n=void 0,o.clear(),o=o0)}function p(){i||(i=!0,d())}function f(){i&&(i=!1,u())}let h={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:f,getListeners:()=>o};return h}var oP=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rP=oP(),iP=()=>typeof navigator<"u"&&navigator.product==="ReactNative",sP=iP(),aP=()=>rP||sP?un:P,zd=aP();function r0(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function Nh(t,e){if(r0(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!r0(t[n[r]],e[n[r]]))return!1;return!0}var lP={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},cP={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},dP={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u0={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},uP={[UR]:dP,[jR]:u0};function i0(t){return WR(t)?u0:uP[t.$$typeof]||lP}var pP=Object.defineProperty,fP=Object.getOwnPropertyNames,s0=Object.getOwnPropertySymbols,hP=Object.getOwnPropertyDescriptor,gP=Object.getPrototypeOf,a0=Object.prototype;function Oh(t,e){if(typeof e!="string"){if(a0){let i=gP(e);i&&i!==a0&&Oh(t,i)}let n=fP(e);s0&&(n=n.concat(s0(e)));let o=i0(t),r=i0(e);for(let i=0;i<n.length;++i){let s=n[i];if(!cP[s]&&!(r&&r[s])&&!(o&&o[s])){let a=hP(e,s);try{pP(t,s,a)}catch{}}}}return t}var mP=Symbol.for("react-redux-context"),_P=typeof globalThis<"u"?globalThis:{};function bP(){if(!Ot)return{};let t=_P[mP]??=new Map,e=t.get(Ot);return e||(e=Ot(null),t.set(Ot,e)),e}var p0=bP(),yP=[null,null];function xP(t,e,n){zd(()=>t(...e),n)}function vP(t,e,n,o,r,i){t.current=o,n.current=!1,r.current&&(r.current=null,i())}function CP(t,e,n,o,r,i,s,a,l,c,d){if(!t)return()=>{};let u=!1,p=null,f=()=>{if(u||!a.current)return;let m=e.getState(),_,b;try{_=o(m,r.current)}catch(y){b=y,p=y}b||(p=null),_===i.current?s.current||c():(i.current=_,l.current=_,s.current=!0,d())};return n.onStateChange=f,n.trySubscribe(),f(),()=>{if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}function EP(t,e){return t===e}function wP(t,e,n,{pure:o,areStatesEqual:r=EP,areOwnPropsEqual:i=Nh,areStatePropsEqual:s=Nh,areMergedPropsEqual:a=Nh,forwardRef:l=!1,context:c=p0}={}){let d=c,u=JR(t),p=XR(e),f=eP(n),h=!!t;return _=>{let b=_.displayName||_.name||"Component",y=`Connect(${b})`,x={shouldHandleStateChanges:h,displayName:y,wrappedComponentName:b,WrappedComponent:_,initMapStateToProps:u,initMapDispatchToProps:p,initMergeProps:f,areStatesEqual:r,areStatePropsEqual:s,areOwnPropsEqual:i,areMergedPropsEqual:a};function v(k){let[T,w,S]=X(()=>{let{reactReduxForwardedRef:Bt,...wn}=k;return[k.context,Bt,wn]},[k]),N=X(()=>{let Bt=d;return T?.Consumer,Bt},[T,d]),D=It(N),O=!!k.store&&!!k.store.getState&&!!k.store.dispatch,M=!!D&&!!D.store,I=O?k.store:D.store,L=M?D.getServerState:I.getState,K=X(()=>YR(I.dispatch,x),[I]),[W,q]=X(()=>{if(!h)return yP;let Bt=d0(I,O?void 0:D.subscription),wn=Bt.notifyNestedSubs.bind(Bt);return[Bt,wn]},[I,O,D]),B=X(()=>O?D:{...D,subscription:W},[O,D,W]),se=Y(void 0),me=Y(S),mt=Y(void 0),Jt=Y(!1),dt=Y(!1),_t=Y(void 0);zd(()=>(dt.current=!0,()=>{dt.current=!1}),[]);let sn=X(()=>()=>mt.current&&S===me.current?mt.current:K(I.getState(),S),[I,S]),ye=X(()=>wn=>W?CP(h,I,W,K,me,se,Jt,dt,mt,q,wn):()=>{},[W]);xP(vP,[me,se,Jt,S,mt,q]);let Je;try{Je=Rv(ye,sn,L?()=>K(L(),S):sn)}catch(Bt){throw _t.current&&(Bt.message+=`
19
+ The error may be correlated with this previous error:
20
+ ${_t.current.stack}
21
+
22
+ `),Bt}zd(()=>{_t.current=void 0,mt.current=void 0,se.current=Je});let st=X(()=>Bi(_,{...Je,ref:w}),[w,_,Je]);return X(()=>h?Bi(N.Provider,{value:B},st):st,[N,st,B])}let C=Pv(v);if(C.WrappedComponent=_,C.displayName=v.displayName=y,l){let T=$i(function(S,N){return Bi(C,{...S,reactReduxForwardedRef:N})});return T.displayName=y,T.WrappedComponent=_,Oh(T,_)}return Oh(C,_)}}var Ah=wP;function TP(t){let{children:e,context:n,serverState:o,store:r}=t,i=X(()=>{let l=d0(r);return{store:r,subscription:l,getServerState:o?()=>o:void 0}},[r,o]),s=X(()=>r.getState(),[r]);return zd(()=>{let{subscription:l}=i;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),s!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[i,s]),Bi((n||p0).Provider,{value:i},e)}var f0=TP;var kP=!0,Lh="Invariant failed";function h0(t,e){if(!t){if(kP)throw new Error(Lh);var n=typeof e=="function"?e():e,o=n?"".concat(Lh,": ").concat(n):Lh;throw new Error(o)}}var oo=function(e){var n=e.top,o=e.right,r=e.bottom,i=e.left,s=o-i,a=r-n,l={top:n,right:o,bottom:r,left:i,width:s,height:a,x:i,y:n,center:{x:(o+i)/2,y:(r+n)/2}};return l},Hd=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},g0=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},NP=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},Rh={top:0,right:0,bottom:0,left:0},Kd=function(e){var n=e.borderBox,o=e.margin,r=o===void 0?Rh:o,i=e.border,s=i===void 0?Rh:i,a=e.padding,l=a===void 0?Rh:a,c=oo(Hd(n,r)),d=oo(g0(n,s)),u=oo(g0(d,l));return{marginBox:c,borderBox:oo(n),paddingBox:d,contentBox:u,margin:r,border:s,padding:l}},no=function(e){var n=e.slice(0,-2),o=e.slice(-2);if(o!=="px")return 0;var r=Number(n);return isNaN(r)&&h0(!1),r},DP=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Tl=function(e,n){var o=e.borderBox,r=e.border,i=e.margin,s=e.padding,a=NP(o,n);return Kd({borderBox:a,border:r,margin:i,padding:s})},Sl=function(e,n){return n===void 0&&(n=DP()),Tl(e,n)},Ph=function(e,n){var o={top:no(n.marginTop),right:no(n.marginRight),bottom:no(n.marginBottom),left:no(n.marginLeft)},r={top:no(n.paddingTop),right:no(n.paddingRight),bottom:no(n.paddingBottom),left:no(n.paddingLeft)},i={top:no(n.borderTopWidth),right:no(n.borderRightWidth),bottom:no(n.borderBottomWidth),left:no(n.borderLeftWidth)};return Kd({borderBox:e,margin:o,padding:r,border:i})},Fh=function(e){var n=e.getBoundingClientRect(),o=window.getComputedStyle(e);return Ph(n,o)};var OP=function(e){var n=[],o=null,r=function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];n=a,!o&&(o=requestAnimationFrame(function(){o=null,e.apply(void 0,n)}))};return r.cancel=function(){o&&(cancelAnimationFrame(o),o=null)},r},Zs=OP;var IP=!0,MP=/[ \t]{2,}/g,AP=/^[ \t]*/gm,m0=t=>t.replace(MP," ").replace(AP,"").trim(),LP=t=>m0(`
23
+ %c@hello-pangea/dnd
24
+
25
+ %c${m0(t)}
26
+
27
+ %c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
28
+ `),RP=t=>[LP(t),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"],PP="__@hello-pangea/dnd-disable-dev-warnings";function j0(t,e){IP||typeof window<"u"&&window[PP]||console[t](...RP(e))}var z9=j0.bind(null,"warn"),FP=j0.bind(null,"error");function Jr(){}function BP(t,e){return{...t,...e}}function ro(t,e,n){let o=e.map(r=>{let i=BP(n,r.options);return t.addEventListener(r.eventName,r.fn,i),function(){t.removeEventListener(r.eventName,r.fn,i)}});return function(){o.forEach(i=>{i()})}}var $P=!0,_0="Invariant failed",Vi=class extends Error{};Vi.prototype.toString=function(){return this.message};function j(t,e){throw $P?new Vi(_0):new Vi(`${_0}: ${e||""}`)}var Yh=class extends et.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=Jr,this.onWindowError=n=>{let o=this.getCallbacks();o.isDragging()&&o.tryAbort(),n.error instanceof Vi&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=ro(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof Vi){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}},zP=`
29
+ Press space bar to start a drag.
30
+ When dragging you can use the arrow keys to move the item around and escape to cancel.
31
+ Some screen readers may require you to be in focus mode or to use your pass through key
32
+ `,Gd=t=>t+1,HP=t=>`
33
+ You have lifted an item in position ${Gd(t.source.index)}
34
+ `,V0=(t,e)=>{let n=t.droppableId===e.droppableId,o=Gd(t.index),r=Gd(e.index);return n?`
35
+ You have moved the item from position ${o}
36
+ to position ${r}
37
+ `:`
38
+ You have moved the item from position ${o}
39
+ in list ${t.droppableId}
40
+ to list ${e.droppableId}
41
+ in position ${r}
42
+ `},W0=(t,e,n)=>e.droppableId===n.droppableId?`
43
+ The item ${t}
44
+ has been combined with ${n.draggableId}`:`
45
+ The item ${t}
46
+ in list ${e.droppableId}
47
+ has been combined with ${n.draggableId}
48
+ in list ${n.droppableId}
49
+ `,KP=t=>{let e=t.destination;if(e)return V0(t.source,e);let n=t.combine;return n?W0(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},b0=t=>`
50
+ The item has returned to its starting position
51
+ of ${Gd(t.index)}
52
+ `,UP=t=>{if(t.reason==="CANCEL")return`
53
+ Movement cancelled.
54
+ ${b0(t.source)}
55
+ `;let e=t.destination,n=t.combine;return e?`
56
+ You have dropped the item.
57
+ ${V0(t.source,e)}
58
+ `:n?`
59
+ You have dropped the item.
60
+ ${W0(t.draggableId,t.source,n)}
61
+ `:`
62
+ The item has been dropped while not over a drop area.
63
+ ${b0(t.source)}
64
+ `},Wd={dragHandleUsageInstructions:zP,onDragStart:HP,onDragUpdate:KP,onDragEnd:UP};function jP(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function G0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!jP(t[n],e[n]))return!1;return!0}function Le(t,e){let n=R(()=>({inputs:e,result:t()}))[0],o=Y(!0),r=Y(n),s=o.current||!!(e&&r.current.inputs&&G0(e,r.current.inputs))?r.current:{inputs:e,result:t()};return P(()=>{o.current=!1,r.current=s},[s]),s.result}function ae(t,e){return Le(()=>t,e)}var Ht={x:0,y:0},tn=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),Kn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),Zr=(t,e)=>t.x===e.x&&t.y===e.y,na=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),Wi=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},Ml=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),y0=(t,e)=>Math.min(...e.map(n=>Ml(t,n))),Y0=t=>e=>({x:t(e.x),y:t(e.y)}),VP=(t,e)=>{let n=oo({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n},$l=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),x0=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],WP={top:0,right:0,bottom:0,left:0},GP=(t,e)=>e?$l(t,e.scroll.diff.displacement):t,YP=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,qP=(t,e)=>e&&e.shouldClipSubject?VP(e.pageMarginBox,t):oo(t),Qs=({page:t,withPlaceholder:e,axis:n,frame:o})=>{let r=GP(t.marginBox,o),i=YP(r,n,e),s=qP(i,o);return{page:t,withPlaceholder:e,active:s}},ng=(t,e)=>{t.frame||j();let n=t.frame,o=Kn(e,n.scroll.initial),r=na(o),i={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:o,displacement:r},max:n.scroll.max}},s=Qs({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:i});return{...t,frame:i,subject:s}};function zt(t,e=G0){let n=null;function o(...r){if(n&&n.lastThis===this&&e(r,n.lastArgs))return n.lastResult;let i=t.apply(this,r);return n={lastResult:i,lastArgs:r,lastThis:this},i}return o.clear=function(){n=null},o}var q0=zt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),X0=zt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Xd=zt(t=>Object.values(t)),XP=zt(t=>Object.values(t)),oa=zt((t,e)=>XP(e).filter(o=>t===o.descriptor.droppableId).sort((o,r)=>o.descriptor.index-r.descriptor.index));function og(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function Jd(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var Zd=zt((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),JP=({isMovingForward:t,draggable:e,destination:n,insideDestination:o,previousImpact:r})=>{if(!n.isCombineEnabled||!og(r))return null;function s(f){let h={type:"COMBINE",combine:{draggableId:f,droppableId:n.descriptor.id}};return{...r,at:h}}let a=r.displaced.all,l=a.length?a[0]:null;if(t)return l?s(l):null;let c=Zd(e,o);if(!l){if(!c.length)return null;let f=c[c.length-1];return s(f.descriptor.id)}let d=c.findIndex(f=>f.descriptor.id===l);d===-1&&j();let u=d-1;if(u<0)return null;let p=c[u];return s(p.descriptor.id)},ra=(t,e)=>t.descriptor.droppableId===e.descriptor.id,J0={point:Ht,value:0},Al={invisible:{},visible:{},all:[]},ZP={displaced:Al,displacedBy:J0,at:null},io=(t,e)=>n=>t<=n&&n<=e,Z0=t=>{let e=io(t.top,t.bottom),n=io(t.left,t.right);return o=>{if(e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right))return!0;let i=e(o.top)||e(o.bottom),s=n(o.left)||n(o.right);if(i&&s)return!0;let l=o.top<t.top&&o.bottom>t.bottom,c=o.left<t.left&&o.right>t.right;return l&&c?!0:l&&s||c&&i}},QP=t=>{let e=io(t.top,t.bottom),n=io(t.left,t.right);return o=>e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right)},rg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Q0={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},eF=t=>e=>{let n=io(e.top,e.bottom),o=io(e.left,e.right);return r=>t===rg?n(r.top)&&n(r.bottom):o(r.left)&&o(r.right)},tF=(t,e)=>{let n=e.frame?e.frame.scroll.diff.displacement:Ht;return $l(t,n)},nF=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,oF=(t,e,n)=>n(e)(t),ig=({target:t,destination:e,viewport:n,withDroppableDisplacement:o,isVisibleThroughFrameFn:r})=>{let i=o?tF(t,e):t;return nF(i,e,r)&&oF(i,n,r)},rF=t=>ig({...t,isVisibleThroughFrameFn:Z0}),ew=t=>ig({...t,isVisibleThroughFrameFn:QP}),iF=t=>ig({...t,isVisibleThroughFrameFn:eF(t.destination.axis)}),sF=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;let{invisible:o,visible:r}=e;if(o[t])return!1;let i=r[t];return i?i.shouldAnimate:!0};function aF(t,e){let n=t.page.marginBox,o={top:e.point.y,right:0,bottom:0,left:e.point.x};return oo(Hd(n,o))}function Ll({afterDragging:t,destination:e,displacedBy:n,viewport:o,forceShouldAnimate:r,last:i}){return t.reduce(function(a,l){let c=aF(l,n),d=l.descriptor.id;if(a.all.push(d),!rF({target:c,destination:e,viewport:o,withDroppableDisplacement:!0}))return a.invisible[l.descriptor.id]=!0,a;let p=sF(d,i,r),f={draggableId:d,shouldAnimate:p};return a.visible[d]=f,a},{all:[],visible:{},invisible:{}})}function lF(t,e){if(!t.length)return 0;let n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function v0({insideDestination:t,inHomeList:e,displacedBy:n,destination:o}){let r=lF(t,{inHomeList:e});return{displaced:Al,displacedBy:n,at:{type:"REORDER",destination:{droppableId:o.descriptor.id,index:r}}}}function Yd({draggable:t,insideDestination:e,destination:n,viewport:o,displacedBy:r,last:i,index:s,forceShouldAnimate:a}){let l=ra(t,n);if(s==null)return v0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let c=e.find(h=>h.descriptor.index===s);if(!c)return v0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let d=Zd(t,e),u=e.indexOf(c),p=d.slice(u);return{displaced:Ll({afterDragging:p,destination:n,displacedBy:r,last:i,viewport:o.frame,forceShouldAnimate:a}),displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:s}}}}function Qr(t,e){return!!e.effected[t]}var cF=({isMovingForward:t,destination:e,draggables:n,combine:o,afterCritical:r})=>{if(!e.isCombineEnabled)return null;let i=o.draggableId,a=n[i].descriptor.index;return Qr(i,r)?t?a:a-1:t?a+1:a},dF=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:o})=>{if(!n.length)return null;let r=o.index,i=t?r+1:r-1,s=n[0].descriptor.index,a=n[n.length-1].descriptor.index,l=e?a:a+1;return i<s||i>l?null:i},uF=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:o,destination:r,insideDestination:i,previousImpact:s,viewport:a,afterCritical:l})=>{let c=s.at;if(c||j(),c.type==="REORDER"){let u=dF({isMovingForward:t,isInHomeList:e,location:c.destination,insideDestination:i});return u==null?null:Yd({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:u})}let d=cF({isMovingForward:t,destination:r,displaced:s.displaced,draggables:o,combine:c.combine,afterCritical:l});return d==null?null:Yd({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:d})},pF=({displaced:t,afterCritical:e,combineWith:n,displacedBy:o})=>{let r=!!(t.visible[n]||t.invisible[n]);return Qr(n,e)?r?Ht:na(o.point):r?o.point:Ht},fF=({afterCritical:t,impact:e,draggables:n})=>{let o=Jd(e);o||j();let r=o.draggableId,i=n[r].page.borderBox.center,s=pF({displaced:e.displaced,afterCritical:t,combineWith:r,displacedBy:e.displacedBy});return tn(i,s)},tw=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,hF=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,sg=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,C0=({axis:t,moveRelativeTo:e,isMoving:n})=>Wi(t.line,e.marginBox[t.end]+tw(t,n),sg(t,e.marginBox,n)),E0=({axis:t,moveRelativeTo:e,isMoving:n})=>Wi(t.line,e.marginBox[t.start]-hF(t,n),sg(t,e.marginBox,n)),gF=({axis:t,moveInto:e,isMoving:n})=>Wi(t.line,e.contentBox[t.start]+tw(t,n),sg(t,e.contentBox,n)),mF=({impact:t,draggable:e,draggables:n,droppable:o,afterCritical:r})=>{let i=oa(o.descriptor.id,n),s=e.page,a=o.axis;if(!i.length)return gF({axis:a,moveInto:o.page,isMoving:s});let{displaced:l,displacedBy:c}=t,d=l.all[0];if(d){let p=n[d];if(Qr(d,r))return E0({axis:a,moveRelativeTo:p.page,isMoving:s});let f=Tl(p.page,c.point);return E0({axis:a,moveRelativeTo:f,isMoving:s})}let u=i[i.length-1];if(u.descriptor.id===e.descriptor.id)return s.borderBox.center;if(Qr(u.descriptor.id,r)){let p=Tl(u.page,na(r.displacedBy.point));return C0({axis:a,moveRelativeTo:p,isMoving:s})}return C0({axis:a,moveRelativeTo:u.page,isMoving:s})},qh=(t,e)=>{let n=t.frame;return n?tn(e,n.scroll.diff.displacement):e},_F=({impact:t,draggable:e,droppable:n,draggables:o,afterCritical:r})=>{let i=e.page.borderBox.center,s=t.at;return!n||!s?i:s.type==="REORDER"?mF({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:r}):fF({impact:t,draggables:o,afterCritical:r})},Qd=t=>{let e=_F(t),n=t.droppable;return n?qh(n,e):e},nw=(t,e)=>{let n=Kn(e,t.scroll.initial),o=na(n);return{frame:oo({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:o}}}};function w0(t,e){return t.map(n=>e[n])}function bF(t,e){for(let n=0;n<e.length;n++){let o=e[n].visible[t];if(o)return o}return null}var yF=({impact:t,viewport:e,destination:n,draggables:o,maxScrollChange:r})=>{let i=nw(e,tn(e.scroll.current,r)),s=n.frame?ng(n,tn(n.frame.scroll.current,r)):n,a=t.displaced,l=Ll({afterDragging:w0(a.all,o),destination:n,displacedBy:t.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),c=Ll({afterDragging:w0(a.all,o),destination:s,displacedBy:t.displacedBy,viewport:e.frame,last:a,forceShouldAnimate:!1}),d={},u={},p=[a,l,c];return a.all.forEach(h=>{let m=bF(h,p);if(m){u[h]=m;return}d[h]=!0}),{...t,displaced:{all:a.all,invisible:d,visible:u}}},xF=(t,e)=>tn(t.scroll.diff.displacement,e),ag=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{let o=xF(n,t),r=Kn(o,e.page.borderBox.center);return tn(e.client.borderBox.center,r)},ow=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:o,withDroppableDisplacement:r,onlyOnMainAxis:i=!1})=>{let s=Kn(n,t.page.borderBox.center),l={target:$l(t.page.borderBox,s),destination:e,withDroppableDisplacement:r,viewport:o};return i?iF(l):ew(l)},vF=({isMovingForward:t,draggable:e,destination:n,draggables:o,previousImpact:r,viewport:i,previousPageBorderBoxCenter:s,previousClientSelection:a,afterCritical:l})=>{if(!n.isEnabled)return null;let c=oa(n.descriptor.id,o),d=ra(e,n),u=JP({isMovingForward:t,draggable:e,destination:n,insideDestination:c,previousImpact:r})||uF({isMovingForward:t,isInHomeList:d,draggable:e,draggables:o,destination:n,insideDestination:c,previousImpact:r,viewport:i,afterCritical:l});if(!u)return null;let p=Qd({impact:u,draggable:e,droppable:n,draggables:o,afterCritical:l});if(ow({draggable:e,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:ag({pageBorderBoxCenter:p,draggable:e,viewport:i}),impact:u,scrollJumpRequest:null};let h=Kn(p,s),m=yF({impact:u,viewport:i,destination:n,draggables:o,maxScrollChange:h});return{clientSelection:a,impact:m,scrollJumpRequest:h}},fn=t=>{let e=t.subject.active;return e||j(),e},CF=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:o,viewport:r})=>{let i=n.subject.active;if(!i)return null;let s=n.axis,a=io(i[s.start],i[s.end]),l=Xd(o).filter(d=>d!==n).filter(d=>d.isEnabled).filter(d=>!!d.subject.active).filter(d=>Z0(r.frame)(fn(d))).filter(d=>{let u=fn(d);return t?i[s.crossAxisEnd]<u[s.crossAxisEnd]:u[s.crossAxisStart]<i[s.crossAxisStart]}).filter(d=>{let u=fn(d),p=io(u[s.start],u[s.end]);return a(u[s.start])||a(u[s.end])||p(i[s.start])||p(i[s.end])}).sort((d,u)=>{let p=fn(d)[s.crossAxisStart],f=fn(u)[s.crossAxisStart];return t?p-f:f-p}).filter((d,u,p)=>fn(d)[s.crossAxisStart]===fn(p[0])[s.crossAxisStart]);if(!l.length)return null;if(l.length===1)return l[0];let c=l.filter(d=>io(fn(d)[s.start],fn(d)[s.end])(e[s.line]));return c.length===1?c[0]:c.length>1?c.sort((d,u)=>fn(d)[s.start]-fn(u)[s.start])[0]:l.sort((d,u)=>{let p=y0(e,x0(fn(d))),f=y0(e,x0(fn(u)));return p!==f?p-f:fn(d)[s.start]-fn(u)[s.start]})[0]},T0=(t,e)=>{let n=t.page.borderBox.center;return Qr(t.descriptor.id,e)?Kn(n,e.displacedBy.point):n},EF=(t,e)=>{let n=t.page.borderBox;return Qr(t.descriptor.id,e)?$l(n,na(e.displacedBy.point)):n},wF=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:o,afterCritical:r})=>o.filter(s=>ew({target:EF(s,r),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((s,a)=>{let l=Ml(t,qh(n,T0(s,r))),c=Ml(t,qh(n,T0(a,r)));return l<c?-1:c<l?1:s.descriptor.index-a.descriptor.index})[0]||null,zl=zt(function(e,n){let o=n[e.line];return{value:o,point:Wi(e.line,o)}}),TF=(t,e,n)=>{let o=t.axis;if(t.descriptor.mode==="virtual")return Wi(o.line,e[o.line]);let r=t.subject.page.contentBox[o.size],l=oa(t.descriptor.id,n).reduce((c,d)=>c+d.client.marginBox[o.size],0)+e[o.line]-r;return l<=0?null:Wi(o.line,l)},rw=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),iw=(t,e,n)=>{let o=t.frame;ra(e,t)&&j(),t.subject.withPlaceholder&&j();let r=zl(t.axis,e.displaceBy).point,i=TF(t,r,n),s={placeholderSize:r,increasedBy:i,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!o){let d=Qs({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:t.frame});return{...t,subject:d}}let a=i?tn(o.scroll.max,i):o.scroll.max,l=rw(o,a),c=Qs({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:l});return{...t,subject:c,frame:l}},SF=t=>{let e=t.subject.withPlaceholder;e||j();let n=t.frame;if(!n){let s=Qs({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:s}}let o=e.oldFrameMaxScroll;o||j();let r=rw(n,o),i=Qs({page:t.subject.page,axis:t.axis,frame:r,withPlaceholder:null});return{...t,subject:i,frame:r}},kF=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:o,draggables:r,destination:i,viewport:s,afterCritical:a})=>{if(!e){if(n.length)return null;let u={displaced:Al,displacedBy:J0,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=Qd({impact:u,draggable:o,droppable:i,draggables:r,afterCritical:a}),f=ra(o,i)?i:iw(i,o,r);return ow({draggable:o,destination:f,newPageBorderBoxCenter:p,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?u:null}let l=t[i.axis.line]<=e.page.borderBox.center[i.axis.line],c=(()=>{let u=e.descriptor.index;return e.descriptor.id===o.descriptor.id||l?u:u+1})(),d=zl(i.axis,o.displaceBy);return Yd({draggable:o,insideDestination:n,destination:i,viewport:s,displacedBy:d,last:Al,index:c})},NF=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:o,draggables:r,droppables:i,viewport:s,afterCritical:a})=>{let l=CF({isMovingForward:t,pageBorderBoxCenter:e,source:o,droppables:i,viewport:s});if(!l)return null;let c=oa(l.descriptor.id,r),d=wF({pageBorderBoxCenter:e,viewport:s,destination:l,insideDestination:c,afterCritical:a}),u=kF({previousPageBorderBoxCenter:e,destination:l,draggable:n,draggables:r,moveRelativeTo:d,insideDestination:c,viewport:s,afterCritical:a});if(!u)return null;let p=Qd({impact:u,draggable:n,droppable:l,draggables:r,afterCritical:a});return{clientSelection:ag({pageBorderBoxCenter:p,draggable:n,viewport:s}),impact:u,scrollJumpRequest:null}},Un=t=>{let e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null},DF=(t,e)=>{let n=Un(t);return n?e[n]:null},OF=({state:t,type:e})=>{let n=DF(t.impact,t.dimensions.droppables),o=!!n,r=t.dimensions.droppables[t.critical.droppable.id],i=n||r,s=i.axis.direction,a=s==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||s==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(a&&!o)return null;let l=e==="MOVE_DOWN"||e==="MOVE_RIGHT",c=t.dimensions.draggables[t.critical.draggable.id],d=t.current.page.borderBoxCenter,{draggables:u,droppables:p}=t.dimensions;return a?vF({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):NF({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function ji(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function sw(t){let e=io(t.top,t.bottom),n=io(t.left,t.right);return function(r){return e(r.y)&&n(r.x)}}function IF(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function MF({pageBorderBox:t,draggable:e,candidates:n}){let o=e.page.borderBox.center,r=n.map(i=>{let s=i.axis,a=Wi(i.axis.line,t.center[s.line],i.page.borderBox.center[s.crossAxisLine]);return{id:i.descriptor.id,distance:Ml(o,a)}}).sort((i,s)=>s.distance-i.distance);return r[0]?r[0].id:null}function AF({pageBorderBox:t,draggable:e,droppables:n}){let o=Xd(n).filter(r=>{if(!r.isEnabled)return!1;let i=r.subject.active;if(!i||!IF(t,i))return!1;if(sw(i)(t.center))return!0;let s=r.axis,a=i.center[s.crossAxisLine],l=t[s.crossAxisStart],c=t[s.crossAxisEnd],d=io(i[s.crossAxisStart],i[s.crossAxisEnd]),u=d(l),p=d(c);return!u&&!p?!0:u?l<a:c>a});return o.length?o.length===1?o[0].descriptor.id:MF({pageBorderBox:t,draggable:e,candidates:o}):null}var aw=(t,e)=>oo($l(t,e)),LF=(t,e)=>{let n=t.frame;return n?aw(e,n.scroll.diff.value):e};function lw({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function RF({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var PF=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:o,last:r,viewport:i,afterCritical:s})=>{let a=n.axis,l=zl(n.axis,e.displaceBy),c=l.value,d=t[a.start],u=t[a.end],f=Zd(e,o).find(m=>{let _=m.descriptor.id,b=m.page.borderBox.center[a.line],y=Qr(_,s),x=lw({displaced:r,id:_});return y?x?u<=b:d<b-c:x?u<=b+c:d<b})||null,h=RF({draggable:e,closest:f,inHomeList:ra(e,n)});return Yd({draggable:e,insideDestination:o,destination:n,viewport:i,last:r,displacedBy:l,index:h})},FF=4,BF=({draggable:t,pageBorderBoxWithDroppableScroll:e,previousImpact:n,destination:o,insideDestination:r,afterCritical:i})=>{if(!o.isCombineEnabled)return null;let s=o.axis,a=zl(o.axis,t.displaceBy),l=a.value,c=e[s.start],d=e[s.end],p=Zd(t,r).find(h=>{let m=h.descriptor.id,_=h.page.borderBox,y=_[s.size]/FF,x=Qr(m,i),v=lw({displaced:n.displaced,id:m});return x?v?d>_[s.start]+y&&d<_[s.end]-y:c>_[s.start]-l+y&&c<_[s.end]-l-y:v?d>_[s.start]+l+y&&d<_[s.end]+l-y:c>_[s.start]+y&&c<_[s.end]-y});return p?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}}}:null},cw=({pageOffset:t,draggable:e,draggables:n,droppables:o,previousImpact:r,viewport:i,afterCritical:s})=>{let a=aw(e.page.borderBox,t),l=AF({pageBorderBox:a,draggable:e,droppables:o});if(!l)return ZP;let c=o[l],d=oa(c.descriptor.id,n),u=LF(c,a);return BF({pageBorderBoxWithDroppableScroll:u,draggable:e,previousImpact:r,destination:c,insideDestination:d,afterCritical:s})||PF({pageBorderBoxWithDroppableScroll:u,draggable:e,destination:c,insideDestination:d,last:r.displaced,viewport:i,afterCritical:s})},lg=(t,e)=>({...t,[e.descriptor.id]:e}),$F=({previousImpact:t,impact:e,droppables:n})=>{let o=Un(t),r=Un(e);if(!o||o===r)return n;let i=n[o];if(!i.subject.withPlaceholder)return n;let s=SF(i);return lg(n,s)},zF=({draggable:t,draggables:e,droppables:n,previousImpact:o,impact:r})=>{let i=$F({previousImpact:o,impact:r,droppables:n}),s=Un(r);if(!s)return i;let a=n[s];if(ra(t,a)||a.subject.withPlaceholder)return i;let l=iw(a,t,e);return lg(i,l)},Ol=({state:t,clientSelection:e,dimensions:n,viewport:o,impact:r,scrollJumpRequest:i})=>{let s=o||t.viewport,a=n||t.dimensions,l=e||t.current.client.selection,c=Kn(l,t.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:tn(t.initial.client.borderBoxCenter,c)},u={selection:tn(d.selection,s.scroll.current),borderBoxCenter:tn(d.borderBoxCenter,s.scroll.current),offset:tn(d.offset,s.scroll.diff.value)},p={client:d,page:u};if(t.phase==="COLLECTING")return{...t,dimensions:a,viewport:s,current:p};let f=a.draggables[t.critical.draggable.id],h=r||cw({pageOffset:u.offset,draggable:f,draggables:a.draggables,droppables:a.droppables,previousImpact:t.impact,viewport:s,afterCritical:t.afterCritical}),m=zF({draggable:f,impact:h,previousImpact:t.impact,draggables:a.draggables,droppables:a.droppables});return{...t,current:p,dimensions:{draggables:a.draggables,droppables:m},impact:h,viewport:s,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function HF(t,e){return t.map(n=>e[n])}var dw=({impact:t,viewport:e,draggables:n,destination:o,forceShouldAnimate:r})=>{let i=t.displaced,s=HF(i.all,n),a=Ll({afterDragging:s,destination:o,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:r,last:i});return{...t,displaced:a}},uw=({impact:t,draggable:e,droppable:n,draggables:o,viewport:r,afterCritical:i})=>{let s=Qd({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:i});return ag({pageBorderBoxCenter:s,draggable:e,viewport:r})},pw=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&j();let o=t.impact,r=n||t.viewport,i=e||t.dimensions,{draggables:s,droppables:a}=i,l=s[t.critical.draggable.id],c=Un(o);c||j();let d=a[c],u=dw({impact:o,viewport:r,destination:d,draggables:s}),p=uw({impact:u,draggable:l,droppable:d,draggables:s,viewport:r,afterCritical:t.afterCritical});return Ol({impact:u,clientSelection:p,state:t,dimensions:i,viewport:r})},KF=t=>({index:t.index,droppableId:t.droppableId}),fw=({draggable:t,home:e,draggables:n,viewport:o})=>{let r=zl(e.axis,t.displaceBy),i=oa(e.descriptor.id,n),s=i.indexOf(t);s===-1&&j();let a=i.slice(s+1),l=a.reduce((p,f)=>(p[f.descriptor.id]=!0,p),{}),c={inVirtualList:e.descriptor.mode==="virtual",displacedBy:r,effected:l};return{impact:{displaced:Ll({afterDragging:a,destination:e,displacedBy:r,last:null,viewport:o.frame,forceShouldAnimate:!1}),displacedBy:r,at:{type:"REORDER",destination:KF(t.descriptor)}},afterCritical:c}},UF=(t,e)=>({draggables:t.draggables,droppables:lg(t.droppables,e)}),Hl=t=>{},Kl=t=>{},jF=({draggable:t,offset:e,initialWindowScroll:n})=>{let o=Tl(t.client,e),r=Sl(o,n);return{...t,placeholder:{...t.placeholder,client:o},client:o,page:r}},VF=t=>{let e=t.frame;return e||j(),e},WF=({additions:t,updatedDroppables:e,viewport:n})=>{let o=n.scroll.diff.value;return t.map(r=>{let i=r.descriptor.droppableId,s=e[i],l=VF(s).scroll.diff.value,c=tn(o,l);return jF({draggable:r,offset:c,initialWindowScroll:n.scroll.initial})})},GF=({state:t,published:e})=>{Hl();let n=e.modified.map(b=>{let y=t.dimensions.droppables[b.droppableId];return ng(y,b.scroll)}),o={...t.dimensions.droppables,...q0(n)},r=X0(WF({additions:e.additions,updatedDroppables:o,viewport:t.viewport})),i={...t.dimensions.draggables,...r};e.removals.forEach(b=>{delete i[b]});let s={droppables:o,draggables:i},a=Un(t.impact),l=a?s.droppables[a]:null,c=s.draggables[t.critical.draggable.id],d=s.droppables[t.critical.droppable.id],{impact:u,afterCritical:p}=fw({draggable:c,home:d,draggables:i,viewport:t.viewport}),f=l&&l.isCombineEnabled?t.impact:u,h=cw({pageOffset:t.current.page.offset,draggable:s.draggables[t.critical.draggable.id],draggables:s.draggables,droppables:s.droppables,previousImpact:f,viewport:t.viewport,afterCritical:p});Kl();let m={...t,phase:"DRAGGING",impact:h,onLiftImpact:u,dimensions:s,afterCritical:p,forceShouldAnimate:!1};return t.phase==="COLLECTING"?m:{...m,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}},Xh=t=>t.movementMode==="SNAP",Bh=(t,e,n)=>{let o=UF(t.dimensions,e);return!Xh(t)||n?Ol({state:t,dimensions:o}):pw({state:t,dimensions:o})};function $h(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}var S0={phase:"IDLE",completed:null,shouldFlush:!1},YF=(t=S0,e)=>{if(e.type==="FLUSH")return{...S0,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&j();let{critical:n,clientSelection:o,viewport:r,dimensions:i,movementMode:s}=e.payload,a=i.draggables[n.draggable.id],l=i.droppables[n.droppable.id],c={selection:o,borderBoxCenter:a.client.borderBox.center,offset:Ht},d={client:c,page:{selection:tn(c.selection,r.scroll.initial),borderBoxCenter:tn(c.selection,r.scroll.initial),offset:tn(c.selection,r.scroll.diff.value)}},u=Xd(i.droppables).every(m=>!m.isFixedOnPage),{impact:p,afterCritical:f}=fw({draggable:a,home:l,draggables:i.draggables,viewport:r});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:s,dimensions:i,initial:d,current:d,isWindowScrollAllowed:u,impact:p,afterCritical:f,onLiftImpact:p,viewport:r,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&j(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||j(),GF({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;ji(t)||j();let{client:n}=e.payload;return Zr(n,t.current.client.selection)?t:Ol({state:t,clientSelection:n,impact:Xh(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return $h(t);ji(t)||j();let{id:n,newScroll:o}=e.payload,r=t.dimensions.droppables[n];if(!r)return t;let i=ng(r,o);return Bh(t,i,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;ji(t)||j();let{id:n,isEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isEnabled===o&&j();let i={...r,isEnabled:o};return Bh(t,i,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;ji(t)||j();let{id:n,isCombineEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isCombineEnabled===o&&j();let i={...r,isCombineEnabled:o};return Bh(t,i,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;ji(t)||j(),t.isWindowScrollAllowed||j();let n=e.payload.newScroll;if(Zr(t.viewport.scroll.current,n))return $h(t);let o=nw(t.viewport,n);return Xh(t)?pw({state:t,viewport:o}):Ol({state:t,viewport:o})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!ji(t))return t;let n=e.payload.maxScroll;if(Zr(n,t.viewport.scroll.max))return t;let o={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:o}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&j();let n=OF({state:t,type:e.type});return n?Ol({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){let n=e.payload.reason;return t.phase!=="COLLECTING"&&j(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){let{completed:n,dropDuration:o,newHomeClientOffset:r}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||j(),{phase:"DROP_ANIMATING",completed:n,dropDuration:o,newHomeClientOffset:r,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){let{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function Ke(t,e){return t instanceof Object&&"type"in t&&t.type===e}var qF=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),XF=t=>({type:"LIFT",payload:t}),JF=t=>({type:"INITIAL_PUBLISH",payload:t}),ZF=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),QF=()=>({type:"COLLECTION_STARTING",payload:null}),eB=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),tB=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),nB=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),hw=t=>({type:"MOVE",payload:t}),oB=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),rB=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),iB=()=>({type:"MOVE_UP",payload:null}),sB=()=>({type:"MOVE_DOWN",payload:null}),aB=()=>({type:"MOVE_RIGHT",payload:null}),lB=()=>({type:"MOVE_LEFT",payload:null}),cg=()=>({type:"FLUSH",payload:null}),cB=t=>({type:"DROP_ANIMATE",payload:t}),dg=t=>({type:"DROP_COMPLETE",payload:t}),gw=t=>({type:"DROP",payload:t}),dB=t=>({type:"DROP_PENDING",payload:t}),mw=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var uB=t=>({getState:e,dispatch:n})=>o=>r=>{if(!Ke(r,"LIFT")){o(r);return}let{id:i,clientSelection:s,movementMode:a}=r.payload,l=e();l.phase==="DROP_ANIMATING"&&n(dg({completed:l.completed})),e().phase!=="IDLE"&&j(),n(cg()),n(qF({draggableId:i,movementMode:a}));let d={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:u,dimensions:p,viewport:f}=t.startPublishing(d);n(JF({critical:u,dimensions:p,clientSelection:s,movementMode:a,viewport:f}))},pB=t=>()=>e=>n=>{Ke(n,"INITIAL_PUBLISH")&&t.dragging(),Ke(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(Ke(n,"FLUSH")||Ke(n,"DROP_COMPLETE"))&&t.resting(),e(n)},ug={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Rl={opacity:{drop:0,combining:.7},scale:{drop:.75}},_w={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Ui=`${_w.outOfTheWay}s ${ug.outOfTheWay}`,Il={fluid:`opacity ${Ui}`,snap:`transform ${Ui}, opacity ${Ui}`,drop:t=>{let e=`${t}s ${ug.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${Ui}`,placeholder:`height ${Ui}, width ${Ui}, margin ${Ui}`},k0=t=>Zr(t,Ht)?void 0:`translate(${t.x}px, ${t.y}px)`,Jh={moveTo:k0,drop:(t,e)=>{let n=k0(t);if(n)return e?`${n} scale(${Rl.scale.drop})`:n}},{minDropTime:Zh,maxDropTime:bw}=_w,fB=bw-Zh,N0=1500,hB=.6,gB=({current:t,destination:e,reason:n})=>{let o=Ml(t,e);if(o<=0)return Zh;if(o>=N0)return bw;let r=o/N0,i=Zh+fB*r,s=n==="CANCEL"?i*hB:i;return Number(s.toFixed(2))},mB=({impact:t,draggable:e,dimensions:n,viewport:o,afterCritical:r})=>{let{draggables:i,droppables:s}=n,a=Un(t),l=a?s[a]:null,c=s[e.descriptor.droppableId],d=uw({impact:t,draggable:e,draggables:i,afterCritical:r,droppable:l||c,viewport:o});return Kn(d,e.client.borderBox.center)},_B=({draggables:t,reason:e,lastImpact:n,home:o,viewport:r,onLiftImpact:i})=>!n.at||e!=="DROP"?{impact:dw({draggables:t,impact:i,destination:o,viewport:r,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Al},didDropInsideDroppable:!0},bB=({getState:t,dispatch:e})=>n=>o=>{if(!Ke(o,"DROP")){n(o);return}let r=t(),i=o.payload.reason;if(r.phase==="COLLECTING"){e(dB({reason:i}));return}if(r.phase==="IDLE")return;r.phase==="DROP_PENDING"&&r.isWaiting&&j(),r.phase==="DRAGGING"||r.phase==="DROP_PENDING"||j();let a=r.critical,l=r.dimensions,c=l.draggables[r.critical.draggable.id],{impact:d,didDropInsideDroppable:u}=_B({reason:i,lastImpact:r.impact,afterCritical:r.afterCritical,onLiftImpact:r.onLiftImpact,home:r.dimensions.droppables[r.critical.droppable.id],viewport:r.viewport,draggables:r.dimensions.draggables}),p=u?og(d):null,f=u?Jd(d):null,h={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:c.descriptor.id,type:c.descriptor.type,source:h,reason:i,mode:r.movementMode,destination:p,combine:f},_=mB({impact:d,draggable:c,dimensions:l,viewport:r.viewport,afterCritical:r.afterCritical}),b={critical:r.critical,afterCritical:r.afterCritical,result:m,impact:d};if(!(!Zr(r.current.client.offset,_)||!!m.combine)){e(dg({completed:b}));return}let x=gB({current:r.current.client.offset,destination:_,reason:i});e(cB({newHomeClientOffset:_,dropDuration:x,completed:b}))},yw=()=>({x:window.pageXOffset,y:window.pageYOffset});function yB(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function xB({onWindowScroll:t}){function e(){t(yw())}let n=Zs(e),o=yB(n),r=Jr;function i(){return r!==Jr}function s(){i()&&j(),r=ro(window,[o])}function a(){i()||j(),n.cancel(),r(),r=Jr}return{start:s,stop:a,isActive:i}}var vB=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH"),CB=t=>{let e=xB({onWindowScroll:n=>{t.dispatch(oB({newScroll:n}))}});return n=>o=>{!e.isActive()&&Ke(o,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&vB(o)&&e.stop(),n(o)}},EB=t=>{let e=!1,n=!1,o=setTimeout(()=>{n=!0}),r=i=>{e||n||(e=!0,t(i),clearTimeout(o))};return r.wasCalled=()=>e,r},wB=()=>{let t=[],e=r=>{let i=t.findIndex(a=>a.timerId===r);i===-1&&j();let[s]=t.splice(i,1);s.callback()};return{add:r=>{let i=setTimeout(()=>e(i)),s={timerId:i,callback:r};t.push(s)},flush:()=>{if(!t.length)return;let r=[...t];t.length=0,r.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}},TB=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,SB=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,kB=(t,e)=>{if(t===e)return!0;let n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,o=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&o},kl=(t,e)=>{Hl(),e(),Kl()},Ud=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function zh(t,e,n,o){if(!t){n(o(e));return}let r=EB(n);t(e,{announce:r}),r.wasCalled()||n(o(e))}var NB=(t,e)=>{let n=wB(),o=null,r=(u,p)=>{o&&j(),kl("onBeforeCapture",()=>{let f=t().onBeforeCapture;f&&f({draggableId:u,mode:p})})},i=(u,p)=>{o&&j(),kl("onBeforeDragStart",()=>{let f=t().onBeforeDragStart;f&&f(Ud(u,p))})},s=(u,p)=>{o&&j();let f=Ud(u,p);o={mode:p,lastCritical:u,lastLocation:f.source,lastCombine:null},n.add(()=>{kl("onDragStart",()=>zh(t().onDragStart,f,e,Wd.onDragStart))})},a=(u,p)=>{let f=og(p),h=Jd(p);o||j();let m=!kB(u,o.lastCritical);m&&(o.lastCritical=u);let _=!TB(o.lastLocation,f);_&&(o.lastLocation=f);let b=!SB(o.lastCombine,h);if(b&&(o.lastCombine=h),!m&&!_&&!b)return;let y={...Ud(u,o.mode),combine:h,destination:f};n.add(()=>{kl("onDragUpdate",()=>zh(t().onDragUpdate,y,e,Wd.onDragUpdate))})},l=()=>{o||j(),n.flush()},c=u=>{o||j(),o=null,kl("onDragEnd",()=>zh(t().onDragEnd,u,e,Wd.onDragEnd))};return{beforeCapture:r,beforeStart:i,start:s,update:a,flush:l,drop:c,abort:()=>{if(!o)return;let u={...Ud(o.lastCritical,o.mode),combine:null,destination:null,reason:"CANCEL"};c(u)}}},DB=(t,e)=>{let n=NB(t,e);return o=>r=>i=>{if(Ke(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Ke(i,"INITIAL_PUBLISH")){let a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),r(i),n.start(a,i.payload.movementMode);return}if(Ke(i,"DROP_COMPLETE")){let a=i.payload.completed.result;n.flush(),r(i),n.drop(a);return}if(r(i),Ke(i,"FLUSH")){n.abort();return}let s=o.getState();s.phase==="DRAGGING"&&n.update(s.critical,s.impact)}},OB=t=>e=>n=>{if(!Ke(n,"DROP_ANIMATION_FINISHED")){e(n);return}let o=t.getState();o.phase!=="DROP_ANIMATING"&&j(),t.dispatch(dg({completed:o.completed}))},IB=t=>{let e=null,n=null;function o(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return r=>i=>{if((Ke(i,"FLUSH")||Ke(i,"DROP_COMPLETE")||Ke(i,"DROP_ANIMATION_FINISHED"))&&o(),r(i),!Ke(i,"DROP_ANIMATE"))return;let s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(mw())}};n=requestAnimationFrame(()=>{n=null,e=ro(window,[s])})}},MB=t=>()=>e=>n=>{(Ke(n,"DROP_COMPLETE")||Ke(n,"FLUSH")||Ke(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},AB=t=>{let e=!1;return()=>n=>o=>{if(Ke(o,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(o.payload.critical.draggable.id),n(o),t.tryRestoreFocusRecorded();return}if(n(o),!!e){if(Ke(o,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(Ke(o,"DROP_COMPLETE")){e=!1;let r=o.payload.completed.result;r.combine&&t.tryShiftRecord(r.draggableId,r.combine.draggableId),t.tryRestoreFocusRecorded()}}}},LB=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH"),RB=t=>e=>n=>o=>{if(LB(o)){t.stop(),n(o);return}if(Ke(o,"INITIAL_PUBLISH")){n(o);let r=e.getState();r.phase!=="DRAGGING"&&j(),t.start(r);return}n(o),t.scroll(e.getState())},PB=t=>e=>n=>{if(e(n),!Ke(n,"PUBLISH_WHILE_DRAGGING"))return;let o=t.getState();o.phase==="DROP_PENDING"&&(o.isWaiting||t.dispatch(gw({reason:o.reason})))},FB=kh,BB=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:o,announce:r,autoScroller:i})=>Th(YF,FB(JE(pB(n),MB(t),uB(t),bB,OB,IB,PB,RB(i),CB,AB(e),DB(o,r)))),Hh=()=>({additions:{},removals:{},modified:{}});function $B({registry:t,callbacks:e}){let n=Hh(),o=null,r=()=>{o||(e.collectionStarting(),o=requestAnimationFrame(()=>{o=null,Hl();let{additions:l,removals:c,modified:d}=n,u=Object.keys(l).map(h=>t.draggable.getById(h).getDimension(Ht)).sort((h,m)=>h.descriptor.index-m.descriptor.index),p=Object.keys(d).map(h=>{let _=t.droppable.getById(h).callbacks.getScrollWhileDragging();return{droppableId:h,scroll:_}}),f={additions:u,removals:Object.keys(c),modified:p};n=Hh(),Kl(),e.publish(f)}))};return{add:l=>{let c=l.descriptor.id;n.additions[c]=l,n.modified[l.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],r()},remove:l=>{let c=l.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],r()},stop:()=>{o&&(cancelAnimationFrame(o),o=null,n=Hh())}}}var xw=({scrollHeight:t,scrollWidth:e,height:n,width:o})=>{let r=Kn({x:e,y:t},{x:o,y:n});return{x:Math.max(0,r.x),y:Math.max(0,r.y)}},vw=()=>{let t=document.documentElement;return t||j(),t},Cw=()=>{let t=vw();return xw({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},zB=()=>{let t=yw(),e=Cw(),n=t.y,o=t.x,r=vw(),i=r.clientWidth,s=r.clientHeight,a=o+i,l=n+s;return{frame:oo({top:n,left:o,right:a,bottom:l}),scroll:{initial:t,current:t,max:e,diff:{value:Ht,displacement:Ht}}}},HB=({critical:t,scrollOptions:e,registry:n})=>{Hl();let o=zB(),r=o.scroll.current,i=t.droppable,s=n.droppable.getAllByType(i.type).map(d=>d.callbacks.getDimensionAndWatchScroll(r,e)),a=n.draggable.getAllByType(t.draggable.type).map(d=>d.getDimension(r)),l={draggables:X0(a),droppables:q0(s)};return Kl(),{dimensions:l,critical:t,viewport:o}};function D0(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var KB=(t,e)=>{let n=null,o=$B({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),r=(p,f)=>{t.droppable.exists(p)||j(),n&&e.updateDroppableIsEnabled({id:p,isEnabled:f})},i=(p,f)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:f}))},s=(p,f)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableScroll({id:p,newScroll:f}))},a=(p,f)=>{n&&t.droppable.getById(p).callbacks.scroll(f)},l=()=>{if(!n)return;o.stop();let p=n.critical.droppable;t.droppable.getAllByType(p.type).forEach(f=>f.callbacks.dragStopped()),n.unsubscribe(),n=null},c=p=>{n||j();let f=n.critical.draggable;p.type==="ADDITION"&&D0(t,f,p.value)&&o.add(p.value),p.type==="REMOVAL"&&D0(t,f,p.value)&&o.remove(p.value)};return{updateDroppableIsEnabled:r,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:s,startPublishing:p=>{n&&j();let f=t.draggable.getById(p.draggableId),h=t.droppable.getById(f.descriptor.droppableId),m={draggable:f.descriptor,droppable:h.descriptor},_=t.subscribe(c);return n={critical:m,unsubscribe:_},HB({critical:m,registry:t,scrollOptions:p.scrollOptions})},stopPublishing:l}},Ew=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",UB=t=>{window.scrollBy(t.x,t.y)},jB=zt(t=>Xd(t).filter(e=>!(!e.isEnabled||!e.frame))),VB=(t,e)=>jB(e).find(o=>(o.frame||j(),sw(o.frame.pageMarginBox)(t)))||null,WB=({center:t,destination:e,droppables:n})=>{if(e){let r=n[e];return r.frame?r:null}return VB(t,n)},Pl={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1},GB=(t,e,n=()=>Pl)=>{let o=n(),r=t[e.size]*o.startFromPercentage,i=t[e.size]*o.maxScrollAtPercentage;return{startScrollingFrom:r,maxScrollValueAt:i}},ww=({startOfRange:t,endOfRange:e,current:n})=>{let o=e-t;return o===0?0:(n-t)/o},pg=1,YB=(t,e,n=()=>Pl)=>{let o=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return o.maxPixelScroll;if(t===e.startScrollingFrom)return pg;let i=1-ww({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),s=o.maxPixelScroll*o.ease(i);return Math.ceil(s)},qB=(t,e,n)=>{let o=n(),r=o.durationDampening.accelerateAt,i=o.durationDampening.stopDampeningAt,s=e,a=i,c=Date.now()-s;if(c>=i)return t;if(c<r)return pg;let d=ww({startOfRange:r,endOfRange:a,current:c}),u=t*o.ease(d);return Math.ceil(u)},O0=({distanceToEdge:t,thresholds:e,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:r})=>{let i=YB(t,e,r);return i===0?0:o?Math.max(qB(i,n,r),pg):i},I0=({container:t,distanceToEdges:e,dragStartTime:n,axis:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=GB(t,o,i);return e[o.end]<e[o.start]?O0({distanceToEdge:e[o.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i}):-1*O0({distanceToEdge:e[o.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i})},XB=({container:t,subject:e,proposedScroll:n})=>{let o=e.height>t.height,r=e.width>t.width;return!r&&!o?n:r&&o?null:{x:r?0:n.x,y:o?0:n.y}},JB=Y0(t=>t===0?0:t),Tw=({dragStartTime:t,container:e,subject:n,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s={top:o.y-e.top,right:e.right-o.x,bottom:e.bottom-o.y,left:o.x-e.left},a=I0({container:e,distanceToEdges:s,dragStartTime:t,axis:rg,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),l=I0({container:e,distanceToEdges:s,dragStartTime:t,axis:Q0,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),c=JB({x:l,y:a});if(Zr(c,Ht))return null;let d=XB({container:e,subject:n,proposedScroll:c});return d?Zr(d,Ht)?null:d:null},ZB=Y0(t=>t===0?0:t>0?1:-1),fg=(()=>{let t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:o})=>{let r=tn(e,o),i={x:t(r.x,n.x),y:t(r.y,n.y)};return Zr(i,Ht)?null:i}})(),Sw=({max:t,current:e,change:n})=>{let o={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},r=ZB(n),i=fg({max:o,current:e,change:r});return!i||r.x!==0&&i.x===0||r.y!==0&&i.y===0},hg=(t,e)=>Sw({current:t.scroll.current,max:t.scroll.max,change:e}),QB=(t,e)=>{if(!hg(t,e))return null;let n=t.scroll.max,o=t.scroll.current;return fg({current:o,max:n,change:e})},gg=(t,e)=>{let n=t.frame;return n?Sw({current:n.scroll.current,max:n.scroll.max,change:e}):!1},e$=(t,e)=>{let n=t.frame;return!n||!gg(t,e)?null:fg({current:n.scroll.current,max:n.scroll.max,change:e})},t$=({viewport:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=Tw({dragStartTime:o,container:t.frame,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return s&&hg(t,s)?s:null},n$=({droppable:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=t.frame;if(!s)return null;let a=Tw({dragStartTime:o,container:s.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return a&&gg(t,a)?a:null},M0=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:o,scrollDroppable:r,getAutoScrollerOptions:i})=>{let s=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){let u=t.viewport,p=t$({dragStartTime:e,viewport:u,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(p){o(p);return}}let c=WB({center:s,destination:Un(t.impact),droppables:t.dimensions.droppables});if(!c)return;let d=n$({dragStartTime:e,droppable:c,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});d&&r(c.descriptor.id,d)},o$=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>Pl})=>{let o=Zs(t),r=Zs(e),i=null,s=c=>{i||j();let{shouldUseTimeDampening:d,dragStartTime:u}=i;M0({state:c,scrollWindow:o,scrollDroppable:r,dragStartTime:u,shouldUseTimeDampening:d,getAutoScrollerOptions:n})};return{start:c=>{Hl(),i&&j();let d=Date.now(),u=!1,p=()=>{u=!0};M0({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p,getAutoScrollerOptions:n}),i={dragStartTime:d,shouldUseTimeDampening:u},Kl(),u&&s(c)},stop:()=>{i&&(o.cancel(),r.cancel(),i=null)},scroll:s}},r$=({move:t,scrollDroppable:e,scrollWindow:n})=>{let o=(a,l)=>{let c=tn(a.current.client.selection,l);t({client:c})},r=(a,l)=>{if(!gg(a,l))return l;let c=e$(a,l);if(!c)return e(a.descriptor.id,l),null;let d=Kn(l,c);return e(a.descriptor.id,d),Kn(l,d)},i=(a,l,c)=>{if(!a||!hg(l,c))return c;let d=QB(l,c);if(!d)return n(c),null;let u=Kn(c,d);return n(u),Kn(c,u)};return a=>{let l=a.scrollJumpRequest;if(!l)return;let c=Un(a.impact);c||j();let d=r(a.dimensions.droppables[c],l);if(!d)return;let u=a.viewport,p=i(a.isWindowScrollAllowed,u,d);p&&o(a,p)}},i$=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:o})=>{let r=o$({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:o}),i=r$({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:l=>{if(!(o().disabled||l.phase!=="DRAGGING")){if(l.movementMode==="FLUID"){r.scroll(l);return}l.scrollJumpRequest&&i(l)}},start:r.start,stop:r.stop}},ea="data-rfd",ta=(()=>{let t=`${ea}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),Qh=(()=>{let t=`${ea}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),s$=(()=>{let t=`${ea}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),A0={contextId:`${ea}-scroll-container-context-id`},a$=t=>e=>`[${e}="${t}"]`,Nl=(t,e)=>t.map(n=>{let o=n.styles[e];return o?`${n.selector} { ${o} }`:""}).join(" "),l$="pointer-events: none;",c$=t=>{let e=a$(t),n=(()=>{let a=`
65
+ cursor: -webkit-grab;
66
+ cursor: grab;
67
+ `;return{selector:e(ta.contextId),styles:{always:`
68
+ -webkit-touch-callout: none;
69
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
70
+ touch-action: manipulation;
71
+ `,resting:a,dragging:l$,dropAnimating:a}}})(),o=(()=>{let a=`
72
+ transition: ${Il.outOfTheWay};
73
+ `;return{selector:e(Qh.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),r={selector:e(s$.contextId),styles:{always:"overflow-anchor: none;"}},s=[o,n,r,{selector:"body",styles:{dragging:`
74
+ cursor: grabbing;
75
+ cursor: -webkit-grabbing;
76
+ user-select: none;
77
+ -webkit-user-select: none;
78
+ -moz-user-select: none;
79
+ -ms-user-select: none;
80
+ overflow-anchor: none;
81
+ `}}];return{always:Nl(s,"always"),resting:Nl(s,"resting"),dragging:Nl(s,"dragging"),dropAnimating:Nl(s,"dropAnimating"),userCancel:Nl(s,"userCancel")}},jn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?un:P,Kh=()=>{let t=document.querySelector("head");return t||j(),t},L0=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function d$(t,e){let n=Le(()=>c$(t),[t]),o=Y(null),r=Y(null),i=ae(zt(u=>{let p=r.current;p||j(),p.textContent=u}),[]),s=ae(u=>{let p=o.current;p||j(),p.textContent=u},[]);jn(()=>{!o.current&&!r.current||j();let u=L0(e),p=L0(e);return o.current=u,r.current=p,u.setAttribute(`${ea}-always`,t),p.setAttribute(`${ea}-dynamic`,t),Kh().appendChild(u),Kh().appendChild(p),s(n.always),i(n.resting),()=>{let f=h=>{let m=h.current;m||j(),Kh().removeChild(m),h.current=null};f(o),f(r)}},[e,s,i,n.always,n.resting,t]);let a=ae(()=>i(n.dragging),[i,n.dragging]),l=ae(u=>{if(u==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=ae(()=>{r.current&&i(n.resting)},[i,n.resting]);return Le(()=>({dragging:a,dropping:l,resting:c}),[a,l,c])}function kw(t,e){return Array.from(t.querySelectorAll(e))}var Nw=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function Ul(t){return t instanceof Nw(t).HTMLElement}function Dw(t,e){let n=`[${ta.contextId}="${t}"]`,o=kw(document,n);if(!o.length)return null;let r=o.find(i=>i.getAttribute(ta.draggableId)===e);return!r||!Ul(r)?null:r}function u$(t){let e=Y({}),n=Y(null),o=Y(null),r=Y(!1),i=ae(function(p,f){let h={id:p,focus:f};return e.current[p]=h,function(){let _=e.current;_[p]!==h&&delete _[p]}},[]),s=ae(function(p){let f=Dw(t,p);f&&f!==document.activeElement&&f.focus()},[t]),a=ae(function(p,f){n.current===p&&(n.current=f)},[]),l=ae(function(){o.current||r.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let p=n.current;p&&s(p)}))},[s]),c=ae(function(p){n.current=null;let f=document.activeElement;f&&f.getAttribute(ta.draggableId)===p&&(n.current=p)},[]);return jn(()=>(r.current=!0,function(){r.current=!1;let p=o.current;p&&cancelAnimationFrame(p)}),[]),Le(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:a}),[i,c,l,a])}function p$(){let t={draggables:{},droppables:{}},e=[];function n(u){return e.push(u),function(){let f=e.indexOf(u);f!==-1&&e.splice(f,1)}}function o(u){e.length&&e.forEach(p=>p(u))}function r(u){return t.draggables[u]||null}function i(u){let p=r(u);return p||j(),p}let s={register:u=>{t.draggables[u.descriptor.id]=u,o({type:"ADDITION",value:u})},update:(u,p)=>{let f=t.draggables[p.descriptor.id];f&&f.uniqueId===u.uniqueId&&(delete t.draggables[p.descriptor.id],t.draggables[u.descriptor.id]=u)},unregister:u=>{let p=u.descriptor.id,f=r(p);f&&u.uniqueId===f.uniqueId&&(delete t.draggables[p],t.droppables[u.descriptor.droppableId]&&o({type:"REMOVAL",value:u}))},getById:i,findById:r,exists:u=>!!r(u),getAllByType:u=>Object.values(t.draggables).filter(p=>p.descriptor.type===u)};function a(u){return t.droppables[u]||null}function l(u){let p=a(u);return p||j(),p}let c={register:u=>{t.droppables[u.descriptor.id]=u},unregister:u=>{let p=a(u.descriptor.id);p&&u.uniqueId===p.uniqueId&&delete t.droppables[u.descriptor.id]},getById:l,findById:a,exists:u=>!!a(u),getAllByType:u=>Object.values(t.droppables).filter(p=>p.descriptor.type===u)};function d(){t.draggables={},t.droppables={},e.length=0}return{draggable:s,droppable:c,subscribe:n,clean:d}}function f$(){let t=Le(p$,[]);return P(()=>function(){t.clean()},[t]),t}var mg=et.createContext(null),Fl=()=>{let t=document.body;return t||j(),t},h$={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},g$=t=>`rfd-announcement-${t}`;function m$(t){let e=Le(()=>g$(t),[t]),n=Y(null);return P(function(){let i=document.createElement("div");return n.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),eh(i.style,h$),Fl().appendChild(i),function(){setTimeout(function(){let l=Fl();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[e]),ae(r=>{let i=n.current;if(i){i.textContent=r;return}},[])}var _$={separator:"::"};function _g(t,e=_$){let n=et.useId();return Le(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function b$({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function y$({contextId:t,text:e}){let n=_g("hidden-text",{separator:"-"}),o=Le(()=>b$({contextId:t,uniqueId:n}),[n,t]);return P(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",Fl().appendChild(i),function(){let a=Fl();a.contains(i)&&a.removeChild(i)}},[o,e]),o}var eu=et.createContext(null),x$={react:"^18.0.0 || ^19.0.0"},v$=/(\d+)\.(\d+)\.(\d+)/,R0=t=>{let e=v$.exec(t);e==null&&j();let n=Number(e[1]),o=Number(e[2]),r=Number(e[3]);return{major:n,minor:o,patch:r,raw:t}},C$=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,E$=(t,e)=>{let n=R0(t),o=R0(e);C$(n,o)};var w$=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function jl(t,e){}function T$(){jl(()=>{E$(x$.react,et.version),w$(document)},[])}function bg(t){let e=Y(t);return P(()=>{e.current=t}),e}function S$(){let t=null;function e(){return!!t}function n(s){return s===t}function o(s){t&&j();let a={abandon:s};return t=a,a}function r(){t||j(),t=null}function i(){t&&(t.abandon(),r())}return{isClaimed:e,isActive:n,claim:o,release:r,tryAbandon:i}}function Bl(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var k$=9,N$=13,yg=27,Ow=32,D$=33,O$=34,I$=35,M$=36,A$=37,L$=38,R$=39,P$=40,F$={[N$]:!0,[k$]:!0},Iw=t=>{F$[t.keyCode]&&t.preventDefault()},tu=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),Mw=0,P0=5;function B$(t,e){return Math.abs(e.x-t.x)>=P0||Math.abs(e.y-t.y)>=P0}var F0={type:"IDLE"};function $$({cancel:t,completed:e,getPhase:n,setPhase:o}){return[{eventName:"mousemove",fn:r=>{let{button:i,clientX:s,clientY:a}=r;if(i!==Mw)return;let l={x:s,y:a},c=n();if(c.type==="DRAGGING"){r.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&j();let d=c.point;if(!B$(d,l))return;r.preventDefault();let u=c.actions.fluidLift(l);o({type:"DRAGGING",actions:u})}},{eventName:"mouseup",fn:r=>{let i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:r=>{n().type==="DRAGGING"&&r.preventDefault(),t()}},{eventName:"keydown",fn:r=>{if(n().type==="PENDING"){t();return}if(r.keyCode===yg){r.preventDefault(),t();return}Iw(r)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:r=>{let i=n();if(i.type==="IDLE"&&j(),i.actions.shouldRespectForcePress()){t();return}r.preventDefault()}},{eventName:tu,fn:t}]}function z$(t){let e=Y(F0),n=Y(Jr),o=Le(()=>({eventName:"mousedown",fn:function(u){if(u.defaultPrevented||u.button!==Mw||u.ctrlKey||u.metaKey||u.shiftKey||u.altKey)return;let p=t.findClosestDraggableId(u);if(!p)return;let f=t.tryGetLock(p,s,{sourceEvent:u});if(!f)return;u.preventDefault();let h={x:u.clientX,y:u.clientY};n.current(),c(f,h)}}),[t]),r=Le(()=>({eventName:"webkitmouseforcewillbegin",fn:d=>{if(d.defaultPrevented)return;let u=t.findClosestDraggableId(d);if(!u)return;let p=t.findOptionsForDraggable(u);p&&(p.shouldRespectForcePress||t.canGetLock(u)&&d.preventDefault())}}),[t]),i=ae(function(){let u={passive:!1,capture:!0};n.current=ro(window,[r,o],u)},[r,o]),s=ae(()=>{e.current.type!=="IDLE"&&(e.current=F0,n.current(),i())},[i]),a=ae(()=>{let d=e.current;s(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[s]),l=ae(function(){let u={capture:!0,passive:!1},p=$$({cancel:a,completed:s,getPhase:()=>e.current,setPhase:f=>{e.current=f}});n.current=ro(window,p,u)},[a,s]),c=ae(function(u,p){e.current.type!=="IDLE"&&j(),e.current={type:"PENDING",point:p,actions:u},l()},[l]);jn(function(){return i(),function(){n.current()}},[i])}function H$(){}var K$={[O$]:!0,[D$]:!0,[M$]:!0,[I$]:!0};function U$(t,e){function n(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:r=>{if(r.keyCode===yg){r.preventDefault(),n();return}if(r.keyCode===Ow){r.preventDefault(),o();return}if(r.keyCode===P$){r.preventDefault(),t.moveDown();return}if(r.keyCode===L$){r.preventDefault(),t.moveUp();return}if(r.keyCode===R$){r.preventDefault(),t.moveRight();return}if(r.keyCode===A$){r.preventDefault(),t.moveLeft();return}if(K$[r.keyCode]){r.preventDefault();return}Iw(r)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:tu,fn:n}]}function j$(t){let e=Y(H$),n=Le(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==Ow)return;let s=t.findClosestDraggableId(i);if(!s)return;let a=t.tryGetLock(s,d,{sourceEvent:i});if(!a)return;i.preventDefault();let l=!0,c=a.snapLift();e.current();function d(){l||j(),l=!1,e.current(),o()}e.current=ro(window,U$(c,d),{capture:!0,passive:!1})}}),[t]),o=ae(function(){let i={passive:!1,capture:!0};e.current=ro(window,[n],i)},[n]);jn(function(){return o(),function(){e.current()}},[o])}var Uh={type:"IDLE"},V$=120,W$=.15;function G$({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===yg&&n.preventDefault(),t()}},{eventName:tu,fn:t}]}function Y$({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}r.hasMoved=!0;let{clientX:i,clientY:s}=o.touches[0],a={x:i,y:s};o.preventDefault(),r.actions.move(a)}},{eventName:"touchend",fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}o.preventDefault(),r.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(n().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let r=n();r.type==="IDLE"&&j();let i=o.touches[0];if(!i||!(i.force>=W$))return;let a=r.actions.shouldRespectForcePress();if(r.type==="PENDING"){a&&t();return}if(a){if(r.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:tu,fn:t}]}function q$(t){let e=Y(Uh),n=Y(Jr),o=ae(function(){return e.current},[]),r=ae(function(f){e.current=f},[]),i=Le(()=>({eventName:"touchstart",fn:function(f){if(f.defaultPrevented)return;let h=t.findClosestDraggableId(f);if(!h)return;let m=t.tryGetLock(h,a,{sourceEvent:f});if(!m)return;let _=f.touches[0],{clientX:b,clientY:y}=_,x={x:b,y};n.current(),u(m,x)}}),[t]),s=ae(function(){let f={capture:!0,passive:!1};n.current=ro(window,[i],f)},[i]),a=ae(()=>{let p=e.current;p.type!=="IDLE"&&(p.type==="PENDING"&&clearTimeout(p.longPressTimerId),r(Uh),n.current(),s())},[s,r]),l=ae(()=>{let p=e.current;a(),p.type==="DRAGGING"&&p.actions.cancel({shouldBlockNextClick:!0}),p.type==="PENDING"&&p.actions.abort()},[a]),c=ae(function(){let f={capture:!0,passive:!1},h={cancel:l,completed:a,getPhase:o},m=ro(window,Y$(h),f),_=ro(window,G$(h),f);n.current=function(){m(),_()}},[l,o,a]),d=ae(function(){let f=o();f.type!=="PENDING"&&j();let h=f.actions.fluidLift(f.point);r({type:"DRAGGING",actions:h,hasMoved:!1})},[o,r]),u=ae(function(f,h){o().type!=="IDLE"&&j();let m=setTimeout(d,V$);r({type:"PENDING",point:h,actions:f,longPressTimerId:m}),c()},[c,o,r,d]);jn(function(){return s(),function(){n.current();let h=o();h.type==="PENDING"&&(clearTimeout(h.longPressTimerId),r(Uh))}},[o,s,r]),jn(function(){return ro(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function X$(t){}var J$=["input","button","textarea","select","option","optgroup","video","audio"];function Aw(t,e){if(e==null)return!1;if(J$.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:Aw(t,e.parentElement)}function Z$(t,e){let n=e.target;return Ul(n)?Aw(t,n):!1}var Q$=t=>oo(t.getBoundingClientRect()).center;function e2(t){return t instanceof Nw(t).Element}var t2=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function Lw(t,e){return t==null?null:t[t2](e)?t:Lw(t.parentElement,e)}function n2(t,e){return t.closest?t.closest(e):Lw(t,e)}function o2(t){return`[${ta.contextId}="${t}"]`}function r2(t,e){let n=e.target;if(!e2(n))return null;let o=o2(t),r=n2(n,o);return!r||!Ul(r)?null:r}function i2(t,e){let n=r2(t,e);return n?n.getAttribute(ta.draggableId):null}function s2(t,e){let n=`[${Qh.contextId}="${t}"]`,r=kw(document,n).find(i=>i.getAttribute(Qh.id)===e);return!r||!Ul(r)?null:r}function a2(t){t.preventDefault()}function jd({expected:t,phase:e,isLockActive:n,shouldWarn:o}){return!(!n()||t!==e)}function Rw({lockAPI:t,store:e,registry:n,draggableId:o}){if(t.isClaimed())return!1;let r=n.draggable.findById(o);return!(!r||!r.options.isEnabled||!Ew(e.getState(),o))}function l2({lockAPI:t,contextId:e,store:n,registry:o,draggableId:r,forceSensorStop:i,sourceEvent:s}){if(!Rw({lockAPI:t,store:n,registry:o,draggableId:r}))return null;let l=o.draggable.getById(r),c=s2(e,l.descriptor.id);if(!c||s&&!l.options.canDragInteractiveElements&&Z$(c,s))return null;let d=t.claim(i||Jr),u="PRE_DRAG";function p(){return l.options.shouldRespectForcePress}function f(){return t.isActive(d)}function h(E,C){jd({expected:E,phase:u,isLockActive:f,shouldWarn:!0})&&n.dispatch(C())}let m=h.bind(null,"DRAGGING");function _(E){function C(){t.release(),u="COMPLETED"}u!=="PRE_DRAG"&&(C(),j()),n.dispatch(XF(E.liftActionArgs)),u="DRAGGING";function k(T,w={shouldBlockNextClick:!1}){if(E.cleanup(),w.shouldBlockNextClick){let S=ro(window,[{eventName:"click",fn:a2,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(S)}C(),n.dispatch(gw({reason:T}))}return{isActive:()=>jd({expected:"DRAGGING",phase:u,isLockActive:f,shouldWarn:!1}),shouldRespectForcePress:p,drop:T=>k("DROP",T),cancel:T=>k("CANCEL",T),...E.actions}}function b(E){let C=Zs(T=>{m(()=>hw({client:T}))});return{..._({liftActionArgs:{id:r,clientSelection:E,movementMode:"FLUID"},cleanup:()=>C.cancel(),actions:{move:C}}),move:C}}function y(){let E={moveUp:()=>m(iB),moveRight:()=>m(aB),moveDown:()=>m(sB),moveLeft:()=>m(lB)};return _({liftActionArgs:{id:r,clientSelection:Q$(c),movementMode:"SNAP"},cleanup:Jr,actions:E})}function x(){jd({expected:"PRE_DRAG",phase:u,isLockActive:f,shouldWarn:!0})&&t.release()}return{isActive:()=>jd({expected:"PRE_DRAG",phase:u,isLockActive:f,shouldWarn:!1}),shouldRespectForcePress:p,fluidLift:b,snapLift:y,abort:x}}var c2=[z$,j$,q$];function d2({contextId:t,store:e,registry:n,customSensors:o,enableDefaultSensors:r}){let i=[...r?c2:[],...o||[]],s=R(()=>S$())[0],a=ae(function(_,b){Bl(_)&&!Bl(b)&&s.tryAbandon()},[s]);jn(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();a(_,y),_=y})},[s,e,a]),jn(()=>s.tryAbandon,[s.tryAbandon]);let l=ae(m=>Rw({lockAPI:s,registry:n,store:e,draggableId:m}),[s,n,e]),c=ae((m,_,b)=>l2({lockAPI:s,registry:n,contextId:t,store:e,draggableId:m,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,s,n,e]),d=ae(m=>i2(t,m),[t]),u=ae(m=>{let _=n.draggable.findById(m);return _?_.options:null},[n.draggable]),p=ae(function(){s.isClaimed()&&(s.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(cg()))},[s,e]),f=ae(()=>s.isClaimed(),[s]),h=Le(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:d,findOptionsForDraggable:u,tryReleaseLock:p,isLockClaimed:f}),[l,c,d,u,p,f]);X$(i);for(let m=0;m<i.length;m++)i[m](h)}var u2=t=>({onBeforeCapture:e=>{xl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),p2=t=>({...Pl,...t.autoScrollerOptions,durationDampening:{...Pl.durationDampening,...t.autoScrollerOptions}});function Dl(t){return t.current||j(),t.current}function f2(t){let{contextId:e,setCallbacks:n,sensors:o,nonce:r,dragHandleUsageInstructions:i}=t,s=Y(null);T$();let a=bg(t),l=ae(()=>u2(a.current),[a]),c=ae(()=>p2(a.current),[a]),d=m$(e),u=y$({contextId:e,text:i}),p=d$(e,r),f=ae(S=>{Dl(s).dispatch(S)},[]),h=Le(()=>Sh({publishWhileDragging:ZF,updateDroppableScroll:eB,updateDroppableIsEnabled:tB,updateDroppableIsCombineEnabled:nB,collectionStarting:QF},f),[f]),m=f$(),_=Le(()=>KB(m,h),[m,h]),b=Le(()=>i$({scrollWindow:UB,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...Sh({move:hw},f)}),[_.scrollDroppable,f,c]),y=u$(e),x=Le(()=>BB({announce:d,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:p}),[d,b,_,y,l,p]);s.current=x;let v=ae(()=>{let S=Dl(s);S.getState().phase!=="IDLE"&&S.dispatch(cg())},[]),E=ae(()=>{let S=Dl(s).getState();return S.phase==="DROP_ANIMATING"?!0:S.phase==="IDLE"?!1:S.isDragging},[]),C=Le(()=>({isDragging:E,tryAbort:v}),[E,v]);n(C);let k=ae(S=>Ew(Dl(s).getState(),S),[]),T=ae(()=>ji(Dl(s).getState()),[]),w=Le(()=>({marshal:_,focus:y,contextId:e,canLift:k,isMovementAllowed:T,dragHandleUsageInstructionsId:u,registry:m}),[e,_,u,y,k,T,m]);return d2({contextId:e,store:x,registry:m,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),P(()=>v,[v]),et.createElement(eu.Provider,{value:w},et.createElement(f0,{context:mg,store:x},t.children))}function h2(){return et.useId()}function nu(t){let e=h2(),n=t.dragHandleUsageInstructions||Wd.dragHandleUsageInstructions;return et.createElement(Yh,null,o=>et.createElement(f2,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var B0={dragging:5e3,dropAnimating:4500},g2=(t,e)=>e?Il.drop(e.duration):t?Il.snap:Il.fluid,m2=(t,e)=>{if(t)return e?Rl.opacity.drop:Rl.opacity.combining},_2=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function b2(t){let n=t.dimension.client,{offset:o,combineWith:r,dropping:i}=t,s=!!r,a=_2(t),l=!!i,c=l?Jh.drop(o,s):Jh.moveTo(o);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:g2(a,i),transform:c,opacity:m2(s,l),zIndex:l?B0.dropAnimating:B0.dragging,pointerEvents:"none"}}function y2(t){return{transform:Jh.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function x2(t){return t.type==="DRAGGING"?b2(t):y2(t)}function v2(t,e,n=Ht){let o=window.getComputedStyle(e),r=e.getBoundingClientRect(),i=Ph(r,o),s=Sl(i,n),a={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:a,displaceBy:l,client:i,page:s}}function C2(t){let e=_g("draggable"),{descriptor:n,registry:o,getDraggableRef:r,canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}=t,l=Le(()=>({canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}),[i,a,s]),c=ae(f=>{let h=r();return h||j(),v2(n,h,f)},[n,r]),d=Le(()=>({uniqueId:e,descriptor:n,options:l,getDimension:c}),[n,c,l,e]),u=Y(d),p=Y(!0);jn(()=>(o.draggable.register(u.current),()=>o.draggable.unregister(u.current)),[o.draggable]),jn(()=>{if(p.current){p.current=!1;return}let f=u.current;u.current=d,o.draggable.update(d,f)},[d,o.draggable])}var xg=et.createContext(null);function Pw(t){t&&Ul(t)||j()}function E2(t,e,n){jl(()=>{function o(i){return`Draggable[id: ${i}]: `}let r=t.draggableId;r||j(!1),typeof r!="string"&&j(!1),Number.isInteger(t.index)||j(!1),t.mapped.type!=="DRAGGING"&&(Pw(n()),t.isEnabled&&(Dw(e,r)||j(!1)))})}function w2(t){}function qd(t){let e=It(t);return e||j(),e}function T2(t){t.preventDefault()}var S2=t=>{let e=Y(null),n=ae((C=null)=>{e.current=C},[]),o=ae(()=>e.current,[]),{contextId:r,dragHandleUsageInstructionsId:i,registry:s}=qd(eu),{type:a,droppableId:l}=qd(xg),c=Le(()=>({id:t.draggableId,index:t.index,type:a,droppableId:l}),[t.draggableId,t.index,a,l]),{children:d,draggableId:u,isEnabled:p,shouldRespectForcePress:f,canDragInteractiveElements:h,isClone:m,mapped:_,dropAnimationFinished:b}=t;if(E2(t,r,o),w2(m),!m){let C=Le(()=>({descriptor:c,registry:s,getDraggableRef:o,canDragInteractiveElements:h,shouldRespectForcePress:f,isEnabled:p}),[c,s,o,h,f,p]);C2(C)}let y=Le(()=>p?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":u,"data-rfd-drag-handle-context-id":r,draggable:!1,onDragStart:T2}:null,[r,i,u,p]),x=ae(C=>{_.type==="DRAGGING"&&_.dropping&&C.propertyName==="transform"&&xl(b)},[b,_]),v=Le(()=>{let C=x2(_),k=_.type==="DRAGGING"&&_.dropping?x:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":r,"data-rfd-draggable-id":u,style:C,onTransitionEnd:k},dragHandleProps:y}},[r,y,u,_,x,n]),E=Le(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return et.createElement(et.Fragment,null,d(v,_.snapshot,E))},Fw=(t,e)=>t===e,Bw=t=>{let{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null},k2=t=>t.combine?t.combine.draggableId:null,N2=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function D2(){let t=zt((r,i)=>({x:r,y:i})),e=zt((r,i,s=null,a=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:r,draggingOver:s,combineWith:a,combineTargetFor:null})),n=zt((r,i,s,a,l=null,c=null,d=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:r,dimension:s,forceShouldAnimate:d,snapshot:e(i,a,l,c,null)}}));return(r,i)=>{if(Bl(r)){if(r.critical.draggable.id!==i.draggableId)return null;let s=r.current.client.offset,a=r.dimensions.draggables[i.draggableId],l=Un(r.impact),c=N2(r.impact),d=r.forceShouldAnimate;return n(t(s.x,s.y),r.movementMode,a,i.isClone,l,c,d)}if(r.phase==="DROP_ANIMATING"){let s=r.completed;if(s.result.draggableId!==i.draggableId)return null;let a=i.isClone,l=r.dimensions.draggables[i.draggableId],c=s.result,d=c.mode,u=Bw(c),p=k2(c),h={duration:r.dropDuration,curve:ug.drop,moveTo:r.newHomeClientOffset,opacity:p?Rl.opacity.drop:null,scale:p?Rl.scale.drop:null};return{mapped:{type:"DRAGGING",offset:r.newHomeClientOffset,dimension:l,dropping:h,draggingOver:u,combineWith:p,mode:d,forceShouldAnimate:null,snapshot:e(d,a,u,p,h)}}}return null}}function $w(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var O2={mapped:{type:"SECONDARY",offset:Ht,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:$w(null)}};function I2(){let t=zt((s,a)=>({x:s,y:a})),e=zt($w),n=zt((s,a=null,l)=>({mapped:{type:"SECONDARY",offset:s,combineTargetFor:a,shouldAnimateDisplacement:l,snapshot:e(a)}})),o=s=>s?n(Ht,s,!0):null,r=(s,a,l,c)=>{let d=l.displaced.visible[s],u=!!(c.inVirtualList&&c.effected[s]),p=Jd(l),f=p&&p.draggableId===s?a:null;if(!d){if(!u)return o(f);if(l.displaced.invisible[s])return null;let _=na(c.displacedBy.point),b=t(_.x,_.y);return n(b,f,!0)}if(u)return o(f);let h=l.displacedBy.point,m=t(h.x,h.y);return n(m,f,d.shouldAnimate)};return(s,a)=>{if(Bl(s))return s.critical.draggable.id===a.draggableId?null:r(a.draggableId,s.critical.draggable.id,s.impact,s.afterCritical);if(s.phase==="DROP_ANIMATING"){let l=s.completed;return l.result.draggableId===a.draggableId?null:r(a.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var M2=()=>{let t=D2(),e=I2();return(o,r)=>t(o,r)||e(o,r)||O2},A2={dropAnimationFinished:mw},L2=Ah(M2,A2,null,{context:mg,areStatePropsEqual:Fw})(S2);function zw(t){return qd(xg).isUsingCloneFor===t.draggableId&&!t.isClone?null:et.createElement(L2,t)}function ou(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return et.createElement(zw,eh({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:o}))}var vg=t=>e=>t===e,R2=vg("scroll"),P2=vg("auto"),F2=vg("visible"),$0=(t,e)=>e(t.overflowX)||e(t.overflowY),B2=(t,e)=>e(t.overflowX)&&e(t.overflowY),Hw=t=>{let e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return $0(n,R2)||$0(n,P2)},$2=()=>!1,Kw=t=>t==null?null:t===document.body?$2()?t:null:t===document.documentElement?null:Hw(t)?t:Kw(t.parentElement);var eg=t=>({x:t.scrollLeft,y:t.scrollTop}),Uw=t=>t?window.getComputedStyle(t).position==="fixed"?!0:Uw(t.parentElement):!1,z2=t=>{let e=Kw(t),n=Uw(t);return{closestScrollable:e,isFixedOnPage:n}},H2=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:o,direction:r,client:i,page:s,closest:a})=>{let l=(()=>{if(!a)return null;let{scrollSize:p,client:f}=a,h=xw({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:f.paddingBox.height,width:f.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:f,scrollSize:p,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:h,diff:{value:Ht,displacement:Ht}}}})(),c=r==="vertical"?rg:Q0,d=Qs({page:s,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:s,frame:l,subject:d}},K2=(t,e)=>{let n=Fh(t);if(!e||t!==e)return n;let o=n.paddingBox.top-e.scrollTop,r=n.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,s=r+e.scrollWidth,l=Hd({top:o,right:s,bottom:i,left:r},n.border);return Kd({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})},U2=({ref:t,descriptor:e,env:n,windowScroll:o,direction:r,isDropDisabled:i,isCombineEnabled:s,shouldClipSubject:a})=>{let l=n.closestScrollable,c=K2(t,l),d=Sl(c,o),u=(()=>{if(!l)return null;let f=Fh(l),h={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:f,page:Sl(f,o),scroll:eg(l),scrollSize:h,shouldClipSubject:a}})();return H2({descriptor:e,isEnabled:!i,isCombineEnabled:s,isFixedOnPage:n.isFixedOnPage,direction:r,client:c,page:d,closest:u})},j2={passive:!1},V2={passive:!0},z0=t=>t.shouldPublishImmediately?j2:V2,Vd=t=>t&&t.env.closestScrollable||null;function W2(t){let e=Y(null),n=qd(eu),o=_g("droppable"),{registry:r,marshal:i}=n,s=bg(t),a=Le(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=Y(a),c=Le(()=>zt((v,E)=>{e.current||j();let C={x:v,y:E};i.updateDroppableScroll(a.id,C)}),[a.id,i]),d=ae(()=>{let v=e.current;return!v||!v.env.closestScrollable?Ht:eg(v.env.closestScrollable)},[]),u=ae(()=>{let v=d();c(v.x,v.y)},[d,c]),p=Le(()=>Zs(u),[u]),f=ae(()=>{let v=e.current,E=Vd(v);if(v&&E||j(),v.scrollOptions.shouldPublishImmediately){u();return}p()},[p,u]),h=ae((v,E)=>{e.current&&j();let C=s.current,k=C.getDroppableRef();k||j();let T=z2(k),w={ref:k,descriptor:a,env:T,scrollOptions:E};e.current=w;let S=U2({ref:k,descriptor:a,env:T,windowScroll:v,direction:C.direction,isDropDisabled:C.isDropDisabled,isCombineEnabled:C.isCombineEnabled,shouldClipSubject:!C.ignoreContainerClipping}),N=T.closestScrollable;return N&&(N.setAttribute(A0.contextId,n.contextId),N.addEventListener("scroll",f,z0(w.scrollOptions))),S},[n.contextId,a,f,s]),m=ae(()=>{let v=e.current,E=Vd(v);return v&&E||j(),eg(E)},[]),_=ae(()=>{let v=e.current;v||j();let E=Vd(v);e.current=null,E&&(p.cancel(),E.removeAttribute(A0.contextId),E.removeEventListener("scroll",f,z0(v.scrollOptions)))},[f,p]),b=ae(v=>{let E=e.current;E||j();let C=Vd(E);C||j(),C.scrollTop+=v.y,C.scrollLeft+=v.x},[]),y=Le(()=>({getDimensionAndWatchScroll:h,getScrollWhileDragging:m,dragStopped:_,scroll:b}),[_,h,m,b]),x=Le(()=>({uniqueId:o,descriptor:a,callbacks:y}),[y,a,o]);jn(()=>(l.current=x.descriptor,r.droppable.register(x),()=>{e.current&&_(),r.droppable.unregister(x)}),[y,a,_,x,i,r.droppable]),jn(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),jn(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function jh(){}var H0={width:0,height:0,margin:WP},G2=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?H0:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},Y2=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{let o=G2({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Il.placeholder:null}},q2=t=>{let e=Y(null),n=ae(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:r,onClose:i,contextId:s}=t,[a,l]=R(t.animate==="open");P(()=>a?o!=="open"?(n(),l(!1),jh):e.current?jh:(e.current=setTimeout(()=>{e.current=null,l(!1)}),n):jh,[o,a,n]);let c=ae(u=>{u.propertyName==="height"&&(r(),o==="close"&&i())},[o,i,r]),d=Y2({isAnimatingOpenOnMount:a,animate:t.animate,placeholder:t.placeholder});return et.createElement(t.placeholder.tagName,{style:d,"data-rfd-placeholder-context-id":s,onTransitionEnd:c,ref:t.innerRef})},X2=et.memo(q2);function Vh(t){return typeof t=="boolean"}function Wh(t,e){e.forEach(n=>n(t))}var J2=[function({props:e}){e.droppableId||j(),typeof e.droppableId!="string"&&j()},function({props:e}){Vh(e.isDropDisabled)||j(),Vh(e.isCombineEnabled)||j(),Vh(e.ignoreContainerClipping)||j()},function({getDroppableRef:e}){Pw(e())}],Z2=[function({props:e,getPlaceholderRef:n}){!e.placeholder||n()}],Q2=[function({props:e}){e.renderClone||j()},function({getPlaceholderRef:e}){e()&&j()}];function ez(t){jl(()=>{Wh(t,J2),t.props.mode==="standard"&&Wh(t,Z2),t.props.mode==="virtual"&&Wh(t,Q2)})}var tg=class extends et.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},tz=t=>{let e=It(eu);e||j();let{contextId:n,isMovementAllowed:o}=e,r=Y(null),i=Y(null),{children:s,droppableId:a,type:l,mode:c,direction:d,ignoreContainerClipping:u,isDropDisabled:p,isCombineEnabled:f,snapshot:h,useClone:m,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=ae(()=>r.current,[]),x=ae((D=null)=>{r.current=D},[]),v=ae(()=>i.current,[]),E=ae((D=null)=>{i.current=D},[]);ez({props:t,getDroppableRef:y,getPlaceholderRef:v});let C=ae(()=>{o()&&_({maxScroll:Cw()})},[o,_]);W2({droppableId:a,type:l,mode:c,direction:d,isDropDisabled:p,isCombineEnabled:f,ignoreContainerClipping:u,getDroppableRef:y});let k=Le(()=>et.createElement(tg,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:D,data:O,animate:M})=>et.createElement(X2,{placeholder:O,onClose:D,innerRef:E,animate:M,contextId:n,onTransitionEnd:C})),[n,C,t.placeholder,t.shouldAnimatePlaceholder,E]),T=Le(()=>({innerRef:x,placeholder:k,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,k,x]),w=m?m.dragging.draggableId:null,S=Le(()=>({droppableId:a,type:l,isUsingCloneFor:w}),[a,w,l]);function N(){if(!m)return null;let{dragging:D,render:O}=m,M=et.createElement(zw,{draggableId:D.draggableId,index:D.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(I,L)=>O(I,L,D));return et.createPortal(M,b())}return et.createElement(xg.Provider,{value:S},s(T,h),N())};function nz(){return document.body||j(),document.body}var K0={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:nz},jw=t=>{let e={...t},n;for(n in K0)t[n]===void 0&&(e={...e,[n]:K0[n]});return e},Gh=(t,e)=>t===e.droppable.type,U0=(t,e)=>e.draggables[t.draggable.id],oz=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=zt(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=zt((i,s,a,l,c,d)=>{let u=c.descriptor.id;if(c.descriptor.droppableId===i){let h=d?{render:d,dragging:n(c.descriptor)}:null,m={isDraggingOver:a,draggingOverWith:a?u:null,draggingFromThisWith:u,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:h}}if(!s)return e;if(!l)return t;let f={isDraggingOver:a,draggingOverWith:u,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:f,useClone:null}});return(i,s)=>{let a=jw(s),l=a.droppableId,c=a.type,d=!a.isDropDisabled,u=a.renderClone;if(Bl(i)){let p=i.critical;if(!Gh(c,p))return e;let f=U0(p,i.dimensions),h=Un(i.impact)===l;return o(l,d,h,h,f,u)}if(i.phase==="DROP_ANIMATING"){let p=i.completed;if(!Gh(c,p.critical))return e;let f=U0(p.critical,i.dimensions);return o(l,d,Bw(p.result)===l,Un(p.impact)===l,f,u)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let p=i.completed;if(!Gh(c,p.critical))return e;let f=Un(p.impact)===l,h=!!(p.impact.at&&p.impact.at.type==="COMBINE"),m=p.critical.droppable.id===l;return f?h?t:e:m?t:e}return e}},rz={updateViewportMaxScroll:rB},ru=Ah(oz,rz,(t,e,n)=>({...jw(n),...t,...e}),{context:mg,areStatePropsEqual:Fw})(tz);$s();Se();$s();Se();function iz(){return new URLSearchParams(window.location.search).get("deeplink")||""}var Vw=Ot(null);function Ww(t){let e=iz(),[n,o]=R(e),r={value:n,setValue:o};return P(()=>{o(e)},[e]),P(()=>{let i=s=>{let a=s.data;if(a.scrollToDeeplink){let l=a.scrollToDeeplink.deepKey,c=document.getElementById(l);if(c){o(l),Cg(c,{behavior:"smooth",force:!0});let d=new URL(window.location.href);d.searchParams.set("deeplink",l),window.history.replaceState({},"",d.toString())}}};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}},[]),g(Vw.Provider,{value:r,children:t.children})}function Vl(){let t=It(Vw);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function sz(t){let e=t;for(;e&&e!==document.body;){let n=e.closest("details");if(n&&n.parentElement)n.open=!0,e=n.parentElement;else break}}function az(t){let e=[],n=t;for(;n&&n!==document.body;){let o=n.closest(".DocEditor__ArrayField__item");if(!o)break;let r=o.querySelector(".DocEditor__ArrayField__item__header");if(r&&!e.includes(r))e.push(r),n=o.parentElement;else break}return e}function Cg(t,e={behavior:"auto"}){setTimeout(()=>{let n=document.querySelector(".DocumentPage__side");if(!n||n.scrollTop>0&&!e.force)return;sz(t);let r=az(t).reduce((s,a)=>s+a.offsetHeight,0),i=t.offsetTop-r;n.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function Gw(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}var lz={get:async()=>{try{let t=await cz();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function Yw(){return lz}async function cz(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function Vn(t,e){if(!uz())return;let n=dz();n&&n.contentWindow?.postMessage({highlightNode:{deepKey:t,options:e}},"*")}function dz(){return document.querySelector('iframe[title="iframe preview"]')}function uz(){let t=window.__ROOT_CTX.preview||{};return[!0,"to-preview"].includes(t.channel)}function qw(t,e){return t.replace(/\{(.+?)\}/g,(n,o)=>{let r=e(o);return r??n})}var iu=class extends Error{};function Xw(t,e,n){let o=t.preview?.title;if(o)return ia(o,e,n)}function Jw(t,e,n){let o=t.preview?.image;if(o)return ia(o,e,n)}function ia(t,e,n){if(!t)return;let o=Array.isArray(t)?t:[t],r=n?.index,i=s=>{if(r!==void 0){if(s==="_index"||s==="_index0")return String(r);if(s==="_index1")return String(r+1);if(s==="_index:02")return String(r).padStart(2,"0");if(s==="_index:03")return String(r).padStart(3,"0")}let a=Ro(e,s);if(!a)throw new iu(s);if(pd(a)){let l=pz(a);if(l)return l}return String(a)};for(let s of o)try{return qw(s,i)}catch(a){if(a instanceof iu)continue;throw a}}function pz(t){let e=t?.blocks||[];for(let n of e)if(n.type==="paragraph"){let o=n.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
82
+ `),o=o.replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ");let r=o.split(/\r?\n/)[0].trim();if(r)return r}}function Gi(t,e,n={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!pd(e);case"object":if(!Vs(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!Gi(o,e[o.id],n))return!1;return!0;case"array":if(Array.isArray(e)){if(e.length===0)return!0;for(let o of e)if(!Gi(t.of,o,n))return!1;return!0}if(!Vs(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!Gi(t.of,e[o],n))return!1;return!0;case"oneof":{if(!Vs(e)||!e._type)return!0;let o,r=t.types||[];if(typeof r[0]=="string"?r.includes(e._type)&&(o=n[e._type]):o=r.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!Gi(i,e[i.id],n))return!1;return!0}default:return!1}}Se();function Zw(t,e){let n=!1;return(...o)=>{n||(t(...o),n=!0,setTimeout(()=>{n=!1},e))}}var Wl=class extends Js{constructor(n){super();this.interval=0;this.timeout=0;this.interval=n}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var fz=60*rh.second,Qw=5*rh.minute,Eg=class extends Js{constructor(n){super();this.started=!1;this.timer=new Wl(fz);this.idleTimer=new Wl(Qw);this.onUserInteraction=Zw(()=>{this.idleTimer.reset()},5e3);this.id=n;let o=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db;this.docRef=Wv(r,"Projects",o,"Viewers",n),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=Xv(this.docRef,n=>{let o=n.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(n){let o=window.firebase.user,r=dd.now(),i=Object.values(n).filter(s=>!(s.email===o.email||r.toMillis()-s.lastViewedAt.toMillis()>Qw));this.dispatch("change",i)}async onTick(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}await Yv(this.docRef,{[n.email]:{email:n.email,photoURL:n.photoURL,lastViewedAt:nh()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}let o=new Gv(n.email,"disconnectedAt");await qv(this.docRef,o,nh())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function eT(t){let e=Zv(t.id),[n,o]=R([]);if(P(()=>{let l=new Eg(e);l.on("change",d=>o(d)),l.start();let c=()=>{document.hidden||document.visibilityState!=="visible"?l.stop():l.started||l.start()};return document.addEventListener("visibilitychange",c),()=>{l.dispose(),document.removeEventListener("visibilitychange",c)}},[e]),n.length===0)return null;function r(l){return l.disconnectedAt?l.disconnectedAt>l.lastViewedAt:!1}let i=t.max||3,s=n.slice(0,i),a=n.length-i;return g("div",{className:"Viewers",children:[s.map(l=>g(SE,{email:l.email,size:30,inactive:r(l),className:"Viewers__avatar"},l.email)),a>0&&g(zv,{className:"Viewers__avatar",size:30,radius:"xl",children:["+",a]})]})}function tT(t){let n=t.field.checkboxLabel||"Enabled",[o,r]=en(t.deepKey,!1);return g("div",{className:"DocEditor__BooleanField",children:g(Mo,{label:n,onChange:i=>{let s=i.currentTarget;r(s.checked)},checked:o,size:"xs"})})}Se();function nT(t){let[e,n]=en(t.deepKey),[o,r]=R(null),i=(s,a)=>{if(a&&!a.valid){r("Invalid date");return}if(s){let l=new Date(s);if(isNaN(l.getTime())){r("Invalid date");return}r(null),n(s)}else r(null),n(null)};return g("div",{className:"DocEditor__DateField",children:[g("input",{type:"date",value:e||"",onChange:s=>{let a=s.currentTarget;i(a.value,a.validity)}}),o&&g("div",{style:{color:"red",fontSize:"12px",marginTop:"4px"},children:o})]})}var hz={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},oT=(t,e,n)=>{let o,r=hz[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function su(t){return(e={})=>{let n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var gz={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_z={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},rT={date:su({formats:gz,defaultWidth:"full"}),time:su({formats:mz,defaultWidth:"full"}),dateTime:su({formats:_z,defaultWidth:"full"})};var bz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iT=(t,e,n,o)=>bz[t];function sa(t){return(e,n)=>{let o=n?.context?String(n.context):"standalone",r;if(o==="formatting"&&t.formattingValues){let s=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):s;r=t.formattingValues[a]||t.formattingValues[s]}else{let s=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[s]}let i=t.argumentCallback?t.argumentCallback(e):e;return r[i]}}var yz={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},xz={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},vz={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Cz={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ez={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Tz=(t,e)=>{let n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},sT={ordinalNumber:Tz,era:sa({values:yz,defaultWidth:"wide"}),quarter:sa({values:xz,defaultWidth:"wide",argumentCallback:t=>t-1}),month:sa({values:vz,defaultWidth:"wide"}),day:sa({values:Cz,defaultWidth:"wide"}),dayPeriod:sa({values:Ez,defaultWidth:"wide",formattingValues:wz,defaultFormattingWidth:"wide"})};function aa(t){return(e,n={})=>{let o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],i=e.match(r);if(!i)return null;let s=i[0],a=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?kz(a,u=>u.test(s)):Sz(a,u=>u.test(s)),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;let d=e.slice(s.length);return{value:c,rest:d}}}function Sz(t,e){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function kz(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function aT(t){return(e,n={})=>{let o=e.match(t.matchPattern);if(!o)return null;let r=o[0],i=e.match(t.parsePattern);if(!i)return null;let s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;let a=e.slice(r.length);return{value:s,rest:a}}}var Nz=/^(\d+)(th|st|nd|rd)?/i,Dz=/\d+/i,Oz={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Iz={any:[/^b/i,/^(a|c)/i]},Mz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Az={any:[/1/i,/2/i,/3/i,/4/i]},Lz={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Rz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Pz={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Fz={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Bz={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},$z={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},lT={ordinalNumber:aT({matchPattern:Nz,parsePattern:Dz,valueCallback:t=>parseInt(t,10)}),era:aa({matchPatterns:Oz,defaultMatchWidth:"wide",parsePatterns:Iz,defaultParseWidth:"any"}),quarter:aa({matchPatterns:Mz,defaultMatchWidth:"wide",parsePatterns:Az,defaultParseWidth:"any",valueCallback:t=>t+1}),month:aa({matchPatterns:Lz,defaultMatchWidth:"wide",parsePatterns:Rz,defaultParseWidth:"any"}),day:aa({matchPatterns:Pz,defaultMatchWidth:"wide",parsePatterns:Fz,defaultParseWidth:"any"}),dayPeriod:aa({matchPatterns:Bz,defaultMatchWidth:"any",parsePatterns:$z,defaultParseWidth:"any"})};var wg={code:"en-US",formatDistance:oT,formatLong:rT,formatRelative:iT,localize:sT,match:lT,options:{weekStartsOn:0,firstWeekContainsDate:1}};var zz={};function $o(){return zz}var Hz=Math.pow(10,8)*24*60*60*1e3,ZY=-Hz,au=6048e5,cT=864e5;var Kz=3600;var dT=Kz*24,QY=dT*7,Uz=dT*365.2425,jz=Uz/12,eq=jz*3,Tg=Symbol.for("constructDateFrom");function kn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Tg in t?t[Tg](e):t instanceof Date?new t.constructor(e):new Date(e)}function pt(t,e){return kn(e||t,t)}function Sg(t){let e=pt(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function uT(t,...e){let n=kn.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function kg(t,e){let n=pt(t,e?.in);return n.setHours(0,0,0,0),n}function pT(t,e,n){let[o,r]=uT(n?.in,t,e),i=kg(o),s=kg(r),a=+i-Sg(i),l=+s-Sg(s);return Math.round((a-l)/cT)}function fT(t,e){let n=pt(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function hT(t,e){let n=pt(t,e?.in);return pT(n,fT(n))+1}function fr(t,e){let n=$o(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=pt(t,e?.in),i=r.getDay(),s=(i<o?7:0)+i-o;return r.setDate(r.getDate()-s),r.setHours(0,0,0,0),r}function Yi(t,e){return fr(t,{...e,weekStartsOn:1})}function lu(t,e){let n=pt(t,e?.in),o=n.getFullYear(),r=kn(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);let i=Yi(r),s=kn(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);let a=Yi(s);return n.getTime()>=i.getTime()?o+1:n.getTime()>=a.getTime()?o:o-1}function gT(t,e){let n=lu(t,e),o=kn(e?.in||t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),Yi(o)}function mT(t,e){let n=pt(t,e?.in),o=+Yi(n)-+gT(n);return Math.round(o/au)+1}function cu(t,e){let n=pt(t,e?.in),o=n.getFullYear(),r=$o(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=kn(e?.in||t,0);s.setFullYear(o+1,0,i),s.setHours(0,0,0,0);let a=fr(s,e),l=kn(e?.in||t,0);l.setFullYear(o,0,i),l.setHours(0,0,0,0);let c=fr(l,e);return+n>=+a?o+1:+n>=+c?o:o-1}function _T(t,e){let n=$o(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=cu(t,e),i=kn(e?.in||t,0);return i.setFullYear(r,0,o),i.setHours(0,0,0,0),fr(i,e)}function bT(t,e){let n=pt(t,e?.in),o=+fr(n,e)-+_T(n,e);return Math.round(o/au)+1}function $e(t,e){let n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}var hr={y(t,e){let n=t.getFullYear(),o=n>0?n:1-n;return $e(e==="yy"?o%100:o,e.length)},M(t,e){let n=t.getMonth();return e==="M"?String(n+1):$e(n+1,2)},d(t,e){return $e(t.getDate(),e.length)},a(t,e){let n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return $e(t.getHours()%12||12,e.length)},H(t,e){return $e(t.getHours(),e.length)},m(t,e){return $e(t.getMinutes(),e.length)},s(t,e){return $e(t.getSeconds(),e.length)},S(t,e){let n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return $e(r,e.length)}};var la={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ng={G:function(t,e,n){let o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){let o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return hr.y(t,e)},Y:function(t,e,n,o){let r=cu(t,o),i=r>0?r:1-r;if(e==="YY"){let s=i%100;return $e(s,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):$e(i,e.length)},R:function(t,e){let n=lu(t);return $e(n,e.length)},u:function(t,e){let n=t.getFullYear();return $e(n,e.length)},Q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return $e(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return $e(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){let o=t.getMonth();switch(e){case"M":case"MM":return hr.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){let o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return $e(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){let r=bT(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):$e(r,e.length)},I:function(t,e,n){let o=mT(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):$e(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):hr.d(t,e)},D:function(t,e,n){let o=hT(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):$e(o,e.length)},E:function(t,e,n){let o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return $e(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return $e(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){let o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return $e(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){let o=t.getHours(),r;switch(o===12?r=la.noon:o===0?r=la.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){let o=t.getHours(),r;switch(o>=17?r=la.evening:o>=12?r=la.afternoon:o>=4?r=la.morning:r=la.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return hr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):hr.H(t,e)},K:function(t,e,n){let o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):$e(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):$e(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):hr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):hr.s(t,e)},S:function(t,e){return hr.S(t,e)},X:function(t,e,n){let o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return xT(o);case"XXXX":case"XX":return qi(o);default:return qi(o,":")}},x:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"x":return xT(o);case"xxxx":case"xx":return qi(o);default:return qi(o,":")}},O:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+yT(o,":");default:return"GMT"+qi(o,":")}},z:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+yT(o,":");default:return"GMT"+qi(o,":")}},t:function(t,e,n){let o=Math.trunc(+t/1e3);return $e(o,e.length)},T:function(t,e,n){return $e(+t,e.length)}};function yT(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+$e(i,2)}function xT(t,e){return t%60===0?(t>0?"-":"+")+$e(Math.abs(t)/60,2):qi(t,e)}function qi(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=$e(Math.trunc(o/60),2),i=$e(o%60,2);return n+r+e+i}var vT=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},CT=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Vz=(t,e)=>{let n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return vT(t,e);let i;switch(o){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",vT(o,e)).replace("{{time}}",CT(r,e))},ET={p:CT,P:Vz};var Wz=/^D+$/,Gz=/^Y+$/,Yz=["D","DD","YY","YYYY"];function wT(t){return Wz.test(t)}function TT(t){return Gz.test(t)}function ST(t,e,n){let o=qz(t,e,n);if(console.warn(o),Yz.includes(t))throw new RangeError(o)}function qz(t,e,n){let o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function kT(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function NT(t){return!(!kT(t)&&typeof t!="number"||isNaN(+pt(t)))}var Xz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Jz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zz=/^'([^]*?)'?$/,Qz=/''/g,eH=/[a-zA-Z]/;function DT(t,e,n){let o=$o(),r=n?.locale??o.locale??wg,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,a=pt(t,n?.in);if(!NT(a))throw new RangeError("Invalid time value");let l=e.match(Jz).map(d=>{let u=d[0];if(u==="p"||u==="P"){let p=ET[u];return p(d,r.formatLong)}return d}).join("").match(Xz).map(d=>{if(d==="''")return{isToken:!1,value:"'"};let u=d[0];if(u==="'")return{isToken:!1,value:tH(d)};if(Ng[u])return{isToken:!0,value:d};if(u.match(eH))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));let c={firstWeekContainsDate:i,weekStartsOn:s,locale:r};return l.map(d=>{if(!d.isToken)return d.value;let u=d.value;(!n?.useAdditionalWeekYearTokens&&TT(u)||!n?.useAdditionalDayOfYearTokens&&wT(u))&&ST(u,e,String(t));let p=Ng[u[0]];return p(a,u,r.localize,c)}).join("")}function tH(t){let e=t.match(Zz);return e?e[1].replace(Qz,"'"):t}function OT(){return Object.assign({},$o())}function Dg(t,e,n){let o=OT(),r=rH(t,n.timeZone,n.locale??o.locale);return"formatToParts"in r?nH(r,e):oH(r,e)}function nH(t,e){let n=t.formatToParts(e);for(let o=n.length-1;o>=0;--o)if(n[o].type==="timeZoneName")return n[o].value}function oH(t,e){let n=t.format(e).replace(/\u200E/g,""),o=/ [\w-+ ]+$/.exec(n);return o?o[0].substr(1):""}function rH(t,e,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:e,timeZoneName:t})}function MT(t,e){let n=cH(e);return"formatToParts"in n?sH(n,t):aH(n,t)}var iH={year:0,month:1,day:2,hour:3,minute:4,second:5};function sH(t,e){try{let n=t.formatToParts(e),o=[];for(let r=0;r<n.length;r++){let i=iH[n[r].type];i!==void 0&&(o[i]=parseInt(n[r].value,10))}return o}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function aH(t,e){let n=t.format(e),o=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(o[3],10),parseInt(o[1],10),parseInt(o[2],10),parseInt(o[4],10),parseInt(o[5],10),parseInt(o[6],10)]}var Og={},IT=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),lH=IT==="06/25/2014, 00:00:00"||IT==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";function cH(t){return Og[t]||(Og[t]=lH?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Og[t]}function Gl(t,e,n,o,r,i,s){let a=new Date(0);return a.setUTCFullYear(t,e,n),a.setUTCHours(o,r,i,s),a}var AT=36e5,dH=6e4,Ig={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function gr(t,e,n){if(!t)return 0;let o=Ig.timezoneZ.exec(t);if(o)return 0;let r,i;if(o=Ig.timezoneHH.exec(t),o)return r=parseInt(o[1],10),LT(r)?-(r*AT):NaN;if(o=Ig.timezoneHHMM.exec(t),o){r=parseInt(o[2],10);let s=parseInt(o[3],10);return LT(r,s)?(i=Math.abs(r)*AT+s*dH,o[1]==="+"?-i:i):NaN}if(fH(t)){e=new Date(e||Date.now());let s=n?e:uH(e),a=Mg(s,t);return-(n?a:pH(e,a,t))}return NaN}function uH(t){return Gl(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function Mg(t,e){let n=MT(t,e),o=Gl(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=t.getTime(),i=r%1e3;return r-=i>=0?i:1e3+i,o-r}function pH(t,e,n){let r=t.getTime()-e,i=Mg(new Date(r),n);if(e===i)return e;r-=i-e;let s=Mg(new Date(r),n);return i===s?i:Math.max(i,s)}function LT(t,e){return-23<=t&&t<=23&&(e==null||0<=e&&e<=59)}var RT={};function fH(t){if(RT[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),RT[t]=!0,!0}catch{return!1}}var hH=60*1e3,FT={X:function(t,e,n){let o=Ag(n.timeZone,t);if(o===0)return"Z";switch(e){case"X":return PT(o);case"XXXX":case"XX":return ca(o);default:return ca(o,":")}},x:function(t,e,n){let o=Ag(n.timeZone,t);switch(e){case"x":return PT(o);case"xxxx":case"xx":return ca(o);default:return ca(o,":")}},O:function(t,e,n){let o=Ag(n.timeZone,t);switch(e){case"O":case"OO":case"OOO":return"GMT"+gH(o,":");default:return"GMT"+ca(o,":")}},z:function(t,e,n){switch(e){case"z":case"zz":case"zzz":return Dg("short",t,n);default:return Dg("long",t,n)}}};function Ag(t,e){let n=t?gr(t,e,!0)/hH:e?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+t);return n}function du(t,e){let n=t<0?"-":"",o=Math.abs(t).toString();for(;o.length<e;)o="0"+o;return n+o}function ca(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=du(Math.floor(o/60),2),i=du(Math.floor(o%60),2);return n+r+e+i}function PT(t,e){return t%60===0?(t>0?"-":"+")+du(Math.abs(t)/60,2):ca(t,e)}function gH(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.floor(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+du(i,2)}function Lg(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+t-+e}var uu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;var Rg=36e5,BT=6e4,mH=2,hn={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:uu};function ei(t,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(t===null)return new Date(NaN);let n=e.additionalDigits==null?mH:Number(e.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]")return new Date(t.getTime());if(typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]")return new Date(t);if(Object.prototype.toString.call(t)!=="[object String]")return new Date(NaN);let o=_H(t),{year:r,restDateString:i}=bH(o.date,n),s=yH(i,r);if(s===null||isNaN(s.getTime()))return new Date(NaN);if(s){let a=s.getTime(),l=0,c;if(o.time&&(l=xH(o.time),l===null||isNaN(l)))return new Date(NaN);if(o.timeZone||e.timeZone){if(c=gr(o.timeZone||e.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=Lg(new Date(a+l)),c=Lg(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function _H(t){let e={},n=hn.dateTimePattern.exec(t),o;if(n?(e.date=n[1],o=n[3]):(n=hn.datePattern.exec(t),n?(e.date=n[1],o=n[2]):(e.date=null,o=t)),o){let r=hn.timeZone.exec(o);r?(e.time=o.replace(r[1],""),e.timeZone=r[1].trim()):e.time=o}return e}function bH(t,e){if(t){let n=hn.YYY[e],o=hn.YYYYY[e],r=hn.YYYY.exec(t)||o.exec(t);if(r){let i=r[1];return{year:parseInt(i,10),restDateString:t.slice(i.length)}}if(r=hn.YY.exec(t)||n.exec(t),r){let i=r[1];return{year:parseInt(i,10)*100,restDateString:t.slice(i.length)}}}return{year:null}}function yH(t,e){if(e===null)return null;let n,o,r;if(!t||!t.length)return n=new Date(0),n.setUTCFullYear(e),n;let i=hn.MM.exec(t);if(i)return n=new Date(0),o=parseInt(i[1],10)-1,zT(e,o)?(n.setUTCFullYear(e,o),n):new Date(NaN);if(i=hn.DDD.exec(t),i){n=new Date(0);let s=parseInt(i[1],10);return EH(e,s)?(n.setUTCFullYear(e,0,s),n):new Date(NaN)}if(i=hn.MMDD.exec(t),i){n=new Date(0),o=parseInt(i[1],10)-1;let s=parseInt(i[2],10);return zT(e,o,s)?(n.setUTCFullYear(e,o,s),n):new Date(NaN)}if(i=hn.Www.exec(t),i)return r=parseInt(i[1],10)-1,HT(r)?$T(e,r):new Date(NaN);if(i=hn.WwwD.exec(t),i){r=parseInt(i[1],10)-1;let s=parseInt(i[2],10)-1;return HT(r,s)?$T(e,r,s):new Date(NaN)}return null}function xH(t){let e,n,o=hn.HH.exec(t);if(o)return e=parseFloat(o[1].replace(",",".")),Pg(e)?e%24*Rg:NaN;if(o=hn.HHMM.exec(t),o)return e=parseInt(o[1],10),n=parseFloat(o[2].replace(",",".")),Pg(e,n)?e%24*Rg+n*BT:NaN;if(o=hn.HHMMSS.exec(t),o){e=parseInt(o[1],10),n=parseInt(o[2],10);let r=parseFloat(o[3].replace(",","."));return Pg(e,n,r)?e%24*Rg+n*BT+r*1e3:NaN}return null}function $T(t,e,n){e=e||0,n=n||0;let o=new Date(0);o.setUTCFullYear(t,0,4);let r=o.getUTCDay()||7,i=e*7+n+1-r;return o.setUTCDate(o.getUTCDate()+i),o}var vH=[31,28,31,30,31,30,31,31,30,31,30,31],CH=[31,29,31,30,31,30,31,31,30,31,30,31];function KT(t){return t%400===0||t%4===0&&t%100!==0}function zT(t,e,n){if(e<0||e>11)return!1;if(n!=null){if(n<1)return!1;let o=KT(t);if(o&&n>CH[e]||!o&&n>vH[e])return!1}return!0}function EH(t,e){if(e<1)return!1;let n=KT(t);return!(n&&e>366||!n&&e>365)}function HT(t,e){return!(t<0||t>52||e!=null&&(e<0||e>6))}function Pg(t,e,n){return!(t<0||t>=25||e!=null&&(e<0||e>=60)||n!=null&&(n<0||n>=60))}var wH=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Fg(t,e,n={}){e=String(e);let o=e.match(wH);if(o){let r=ei(n.originalDate||t,n);e=o.reduce(function(i,s){if(s[0]==="'")return i;let a=i.indexOf(s),l=i[a-1]==="'",c=i.replace(s,"'"+FT[s[0]](r,s,n)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},e)}return DT(t,e,n)}function Bg(t,e,n){t=ei(t,n);let o=gr(e,t,!0),r=new Date(t.getTime()-o),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}function $g(t,e,n,o){return o={...o,timeZone:e,originalDate:t},Fg(Bg(t,e,{timeZone:o.timeZone}),n,o)}function zg(t,e,n){if(typeof t=="string"&&!t.match(uu))return ei(t,{...n,timeZone:e});t=ei(t,n);let o=Gl(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).getTime(),r=gr(e,new Date(o));return new Date(o+r)}Se();function UT(t){let e=t.field,[n,o]=en(t.deepKey),r=`${TH(t.deepKey)}.timezone`,[i,s]=en(r),a=e.timezone||i||Intl.DateTimeFormat().resolvedOptions().timeZone,l=X(()=>{if(!n)return"";try{return $g(n.toDate(),a,"yyyy-MM-dd'T'HH:mm")}catch(f){return console.error("Error formatting date:",f),""}},[n,a]),[c,d]=R(null),u=(f,h)=>{if(h&&!h.valid){console.warn("Invalid date input"),d("Invalid datetime");return}if(f)try{let m=zg(f,a);if(isNaN(m.getTime())){console.warn("Invalid date:",f),d("Invalid datetime");return}d(null),o(dd.fromDate(m))}catch(m){console.error("Error parsing date:",m),d("Invalid datetime")}else d(null),o(null)},p=f=>{s(f)};return g("div",{className:"DocEditor__DateTimeField",children:[g("div",{className:"DocEditor__DateTimeField__row",children:[g("input",{type:"datetime-local",value:l,onChange:f=>{let h=f.target;u(h.value,h.validity)},className:"DocEditor__DateTimeField__input"}),e.timezone?g("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",e.timezone]}):g(Lo,{className:"DocEditor__DateTimeField__timezoneSelect",value:a,onChange:f=>{f&&p(f)},data:Intl.supportedValuesOf("timeZone"),searchable:!0,size:"xs"})]}),c&&g("div",{className:"DocEditor__DateTimeField__error",children:c})]})}function TH(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}function jT(t){return g(Bd,{...t,variant:"image"})}Se();function VT(t){let e=t.field,[n,o]=en(t.deepKey,[]),r=X(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return g("div",{className:"DocEditor__MultiSelectField",children:g(Kv,{data:r,size:"xs",radius:0,placeholder:e.placeholder,value:n,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function WT(t){let[e,n]=en(t.deepKey,0);return g(Uv,{size:"xs",radius:0,value:e,onChange:o=>n(o),hideControls:!0})}Se();var GT="ReferenceFieldEditorModal";function pu(){let t=Qt(),e=yt();return{open:n=>{t.openContextModal(GT,{...e,className:"ReferenceFieldEditorModalWrap",innerProps:n,title:`Edit ${n.docId}`,size:"xl",overflow:"inside",closeOnClickOutside:!1,closeOnEscape:!1})}}}function Hg(t){let{id:e,context:n,innerProps:o}=t,r=o.docId;return g("div",{className:"ReferenceFieldEditorModal",children:g(CE,{docId:r,autoSave:!1,flushOnStop:!1,children:[g(Ne,{className:"ReferenceFieldEditorModal__DocEditor",docId:o.docId,hideStatusBar:!0}),g(Hg.Footer,{docId:r,onCancel:()=>n.closeModal(e)})]})})}Hg.Footer=t=>{let e=to();return g("div",{className:"ReferenceFieldEditorModal__footer",children:[g("div",{className:"ReferenceFieldEditorModal__footer__start",children:g(Q,{component:"a",variant:"default",size:"xs",rightIcon:g(Ws,{size:16}),href:`/cms/content/${t.docId}`,target:"_blank",children:["Open ",t.docId]})}),g(Q,{variant:"default",size:"xs",onClick:t.onCancel,children:"Cancel"}),g(Q,{color:"dark",size:"xs",onClick:async()=>{await e.controller.flush(),t.onCancel()},children:"Save"})]})};Hg.id=GT;function da(t){let e=t.field,[n,o]=en(t.deepKey),r=n?.id||"";function i(c){o(c?gd(c):null)}let s=Ad(),a=pu();function l(){let c=r?gd(r).collection:e.initialCollection;s.open({collections:e.collections,initialCollection:c,onChange:d=>{i(d),s.close()}})}return g("div",{className:"ReferenceField",children:[r?g("div",{className:"ReferenceField__ref",children:[g(da.Preview,{id:r}),g("div",{className:"ReferenceField__remove",children:[g(De,{label:"Quick edit",children:g(Be,{className:"ReferenceField__remove__icon",onClick:()=>a.open({docId:r}),children:g(Td,{size:16})})}),g(De,{label:"Remove",children:g(Be,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:g(Po,{size:16})})})]})]}):g("div",{className:"ReferenceField__none",children:"None selected"}),g(Q,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}da.Preview=t=>{let[e,n]=R(!0),[o,r]=R(null);async function i(){n(!0),await cr(async()=>{let s=await vl(t.id);r(s)}),n(!1)}return P(()=>{i()},[t.id]),g("div",{className:"ReferenceField__Preview",children:e?g("div",{className:"ReferenceField__Preview__loading",children:g(Zt,{color:"gray",size:"sm"})}):o?g(da.DocCard,{doc:o}):g("div",{className:"ReferenceField__Preview__notfound",children:["Doc not found: ",g("b",{children:t.id})," (was it deleted?). Select a new doc or remove using the trash icon to the right."]})})};da.DocCard=t=>{let e=t.doc,n=e.id||e.sys?.id||"";if(!n)return g("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=gd(n).collection,r=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let s=Ro(r,i.preview?.title||"meta.title"),a=Ro(r,i.preview?.image||"meta.image")||i.preview?.defaultImage;return g("a",{className:"ReferenceField__DocCard",href:`/cms/content/${n}`,target:"_blank",children:[g("div",{className:"ReferenceField__DocCard__image",children:g(sd,{src:a?.src,width:80,height:60,withPlaceholder:!a?.src})}),g("div",{className:"ReferenceField__DocCard__content",children:[g("div",{className:"ReferenceField__DocCard__content__header",children:g("div",{className:"ReferenceField__DocCard__content__header__docId",children:n})}),g("div",{className:"ReferenceField__DocCard__content__title",children:s||"[UNTITLED]"})]})]})};Se();function YT(t){let e=t.field,[n,o]=R([]),r=to().controller;function i(d){if(d.length){let u=d.map(p=>{let[f,h]=p.split("/");return{id:p,collection:f,slug:h}});r.updateKey(t.deepKey,u)}else r.removeKey(t.deepKey);o(d)}Fo(t.deepKey,d=>{Array.isArray(d)?o(d.map(u=>u.id)):o([])});let s=Ad(),a=pu();function l(){s.open({collections:e.collections,initialCollection:e.initialCollection,multiSelect:!0,selectedDocIds:n,onChangeMulti:(d,u)=>{o(p=>{let f=[...p];if(u)f.includes(d)||f.push(d);else{let h=f.indexOf(d);h>-1&&f.splice(h,1)}return i(f),f})}})}function c(d){let u=n.filter(p=>p!==d);i(u)}return g("div",{className:"ReferencesField",children:[n.length>0?g(nu,{onDragEnd:d=>{let{destination:u,source:p}=d;if(!u||u.index===p.index)return;let f=[...n],[h]=f.splice(p.index,1);f.splice(u.index,0,h),i(f)},children:g(ru,{droppableId:"ReferencesField__droppable",direction:"vertical",children:d=>g("div",{ref:d.innerRef,...d.droppableProps,className:"ReferencesField__refs",children:[n.map((u,p)=>g(ou,{draggableId:u,index:p,children:(f,h)=>g("div",{ref:f.innerRef,...f.draggableProps,className:we("ReferencesField__card",h.isDragging&&"ReferencesField__card--dragging"),children:[g("div",{className:"ReferencesField__card__handle",...f.dragHandleProps,children:g(vd,{size:16,stroke:"1.5"})}),g(_d,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0,statusBadges:!0}),g("div",{className:"ReferencesField__card__controls",children:[g(De,{label:"Quick edit",children:g(Be,{onClick:()=>a.open({docId:u}),children:g(Td,{size:16})})}),g(De,{label:"Remove",children:g(Be,{className:"ReferencesField__card__controls__remove",onClick:()=>c(u),children:g(Po,{size:16})})})]})]})},u)),d.placeholder]})})}):g("div",{className:"ReferencesField__none",children:"None selected"}),g(Q,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}Se();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function SH(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}function Kg(){}Object.assign(Kg,{default:Kg,register:Kg,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;for(;--n>=0&&e.item(n)!==this;);return n>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(n=>{let o=n instanceof Node;e.appendChild(o?n:document.createTextNode(n))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,n=window.getComputedStyle(e,null),o=parseInt(n.getPropertyValue("border-top-width")),r=parseInt(n.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,s=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,a=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-r>e.scrollLeft+e.clientWidth,c=i&&!s;(i||s)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(a||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-r+this.clientWidth/2),(i||s||a||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var kH=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),""),lS=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(lS||{}),ve={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},NH={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function lc(t,e,n="log",o,r="color: inherit"){if(!("console"in window)||!window.console[n])return;let i=["info","log","warn","error"].includes(n),s=[];switch(lc.logLevel){case"ERROR":if(n!=="error")return;break;case"WARN":if(!["error","warn"].includes(n))return;break;case"INFO":if(!i||t)return;break}o&&s.push(o);let a="Editor.js 2.31.0-rc.7";t&&(i?(s.unshift(`line-height: 1em;
83
+ color: #006FEA;
84
+ display: inline-block;
85
+ font-size: 11px;
86
+ line-height: 1em;
87
+ background-color: #fff;
88
+ padding: 4px 9px;
89
+ border-radius: 30px;
90
+ border: 1px solid rgba(56, 138, 229, 0.16);
91
+ margin: 4px 5px 4px 0;`,r),e=`%c${a}%c ${e}`):e=`( ${a} )${e}`);try{i?o?console[n](`${e} %o`,...s):console[n](e,...s):console[n](e)}catch{}}lc.logLevel="VERBOSE";function DH(t){lc.logLevel=t}var Ue=lc.bind(window,!1),ao=lc.bind(window,!0);function Ji(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function at(t){return Ji(t)==="function"||Ji(t)==="asyncfunction"}function nn(t){return Ji(t)==="object"}function yr(t){return Ji(t)==="string"}function OH(t){return Ji(t)==="boolean"}function qT(t){return Ji(t)==="number"}function XT(t){return Ji(t)==="undefined"}function lo(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0}function cS(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}async function IH(t,e=()=>{},n=()=>{}){async function o(r,i,s){try{await r.function(r.data),await i(XT(r.data)?{}:r.data)}catch{s(XT(r.data)?{}:r.data)}}return t.reduce(async(r,i)=>(await r,o(i,e,n)),Promise.resolve())}function dS(t){return Array.prototype.slice.call(t)}function xu(t,e){return function(){let n=this,o=arguments;window.setTimeout(()=>t.apply(n,o),e)}}function MH(t){return t.name.split(".").pop()}function AH(t){return/^[-\w]+\/([-+\w]+|\*)$/.test(t)}function JT(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=null,n||t.apply(i,r)},a=n&&!o;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function qg(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s||(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s||(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}function LH(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e&&(t[e]=!0),t}function vu(t){return t[0].toUpperCase()+t.slice(1)}function Xg(t,...e){if(!e.length)return t;let n=e.shift();if(nn(t)&&nn(n))for(let o in n)nn(n[o])?(t[o]||Object.assign(t,{[o]:{}}),Xg(t[o],n[o])):Object.assign(t,{[o]:n[o]});return Xg(t,...e)}function Ym(t){let e=LH();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi," + "),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function RH(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function PH(){return kH(10)}function FH(t){window.open(t,"_blank")}function BH(t=""){return`${t}${Math.floor(Math.random()*1e8).toString(16)}`}function Jg(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&ao(o,"warn")}function ma(t,e,n){let o=n.value?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,...s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}var uS=650;function _a(){return window.matchMedia(`(max-width: ${uS}px)`).matches}var Zg=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function $H(t,e){let n=Array.isArray(t)||nn(t),o=Array.isArray(e)||nn(e);return n||o?JSON.stringify(t)===JSON.stringify(e):t===e}var z=class t{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,n=null,o={}){let r=document.createElement(e);if(Array.isArray(n)){let i=n.filter(s=>s!==void 0);r.classList.add(...i)}else n&&r.classList.add(n);for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i]);return r}static text(e){return document.createTextNode(e)}static append(e,n){Array.isArray(n)?n.forEach(o=>e.appendChild(o)):e.appendChild(n)}static prepend(e,n){Array.isArray(n)?(n=n.reverse(),n.forEach(o=>e.prepend(o))):e.prepend(n)}static swap(e,n){let o=document.createElement("div"),r=e.parentNode;r.insertBefore(o,e),r.insertBefore(e,n),r.insertBefore(n,o),r.removeChild(o)}static find(e=document,n){return e.querySelector(n)}static get(e){return document.getElementById(e)}static findAll(e=document,n){return e.querySelectorAll(n)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return dS(e.querySelectorAll(t.allInputsSelector)).reduce((n,o)=>t.isNativeInput(o)||t.containsOnlyInlineElements(o)?[...n,o]:[...n,...t.getDeepestBlockElements(o)],[])}static getDeepestNode(e,n=!1){let o=n?"lastChild":"firstChild",r=n?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(t.isSingleTag(i)&&!t.isNativeInput(i)&&!t.isLineBreakTag(i))if(i[r])i=i[r];else if(i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return this.getDeepestNode(i,n)}return e}static isElement(e){return qT(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return qT(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){let n=["INPUT","TEXTAREA"];return e&&e.tagName?n.includes(e.tagName):!1}static canSetCaret(e){let n=!0;if(t.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":n=!1;break}else n=t.isContentEditable(e);return n}static isNodeEmpty(e,n){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("\u200B",""),n&&(o=o.replace(new RegExp(n,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,n){let o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,n))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){let n=t.make("div");return n.innerHTML=e,n.childElementCount>0}static getContentLength(e){return t.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let n;yr(e)?(n=document.createElement("div"),n.innerHTML=e):n=e;let o=r=>!t.blockElements.includes(r.tagName.toLowerCase())&&Array.from(r.children).every(o);return Array.from(n.children).every(o)}static getDeepestBlockElements(e){return t.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((n,o)=>[...n,...t.getDeepestBlockElements(o)],[])}static getHolder(e){return yr(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){let n=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=n.top+r,s=n.left+o;return{top:i,left:s,bottom:i+n.height,right:s+n.width}}};function zH(t){return!/[^\t\n\r ]/.test(t)}function HH(t){let e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2;return s+i+r+l+a}function pS(t){t.dataset.empty=z.isEmpty(t)?"true":"false"}var KH={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},UH={Text:"",Link:"",Bold:"",Italic:""},jH={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},VH={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},fS={ui:KH,toolNames:UH,tools:jH,blockTunes:VH},hS=class ua{static ui(e,n){return ua._t(e,n)}static t(e,n){return ua._t(e,n)}static setDictionary(e){ua.currentDictionary=e}static _t(e,n){let o=ua.getNamespace(e);return!o||!o[n]?n:o[n]}static getNamespace(e){return e.split(".").reduce((n,o)=>!n||!Object.keys(n).length?{}:n[o],ua.currentDictionary)}};hS.currentDictionary=fS;var mn=hS,Cu=class extends Error{},Zi=class{constructor(){this.subscribers={}}on(e,n){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(n)}once(e,n){e in this.subscribers||(this.subscribers[e]=[]);let o=r=>{let i=n(r),s=this.subscribers[e].indexOf(o);return s!==-1&&this.subscribers[e].splice(s,1),i};this.subscribers[e].push(o)}emit(e,n){lo(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,r)=>{let i=r(o);return i!==void 0?i:o},n)}off(e,n){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===n){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function mr(t){Object.setPrototypeOf(this,{get id(){return t.id},get name(){return t.name},get config(){return t.config},get holder(){return t.holder},get isEmpty(){return t.isEmpty},get selected(){return t.selected},set stretched(e){t.stretched=e},get stretched(){return t.stretched},get focusable(){return t.focusable},call(e,n){return t.call(e,n)},save(){return t.save()},validate(e){return t.validate(e)},dispatchChange(){t.dispatchChange()},getActiveToolboxEntry(){return t.getActiveToolboxEntry()}})}var Qi=class{constructor(){this.allListeners=[]}on(e,n,o,r=!1){let i=BH("l"),s={id:i,element:e,eventType:n,handler:o,options:r};if(!this.findOne(e,n,o))return this.allListeners.push(s),e.addEventListener(n,o,r),i}off(e,n,o,r){let i=this.findAll(e,n,o);i.forEach((s,a)=>{let l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),s.element.removeEventListener(s.eventType,s.handler,s.options))})}offById(e){let n=this.findById(e);n&&n.element.removeEventListener(n.eventType,n.handler,n.options)}findOne(e,n,o){let r=this.findAll(e,n,o);return r.length>0?r[0]:null}findAll(e,n,o){let r,i=e?this.findByEventTarget(e):[];return e&&n&&o?r=i.filter(s=>s.eventType===n&&s.handler===o):e&&n?r=i.filter(s=>s.eventType===n):r=i,r}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(n=>{if(n.element===e)return n})}findByType(e){return this.allListeners.filter(n=>{if(n.eventType===e)return n})}findByHandler(e){return this.allListeners.filter(n=>{if(n.handler===e)return n})}findById(e){return this.allListeners.find(n=>n.id===e)}},Ie=class t{constructor({config:e,eventsDispatcher:n}){if(this.nodes={},this.listeners=new Qi,this.readOnlyMutableListeners={on:(o,r,i,s=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,r,i,s))},clearAll:()=>{for(let o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===t)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=n}set state(e){this.Editor=e}removeAllNodes(){for(let e in this.nodes){let n=this.nodes[e];n instanceof HTMLElement&&n.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},ge=class t{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){let e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return n?z.isElement(n)?n:n.parentElement:null}static get anchorOffset(){let e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){let e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(t.get())}static isSelectionAtEditor(e){if(!e)return!1;let n=e.anchorNode||e.focusNode;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let n=e.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!t.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,n,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,n=e.createRange(),o.x=n.boundingLeft,o.y=n.boundingTop,o.width=n.boundingWidth,o.height=n.boundingHeight,o;if(!window.getSelection)return Ue("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return Ue("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(n=e.getRangeAt(0).cloneRange(),n.getBoundingClientRect&&(o=n.getBoundingClientRect()),o.x===0&&o.y===0){let r=document.createElement("span");if(r.getBoundingClientRect){r.appendChild(document.createTextNode("\u200B")),n.insertNode(r),o=r.getBoundingClientRect();let i=r.parentNode;i.removeChild(r),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,n=0){let o=document.createRange(),r=window.getSelection();return z.isNativeInput(e)?z.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=n,e.getBoundingClientRect()):void 0:(o.setStart(e,n),o.setEnd(e,n),r.removeAllRanges(),r.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){let n=t.range;return n===null?!1:e.contains(n.startContainer)}static addFakeCursor(){let e=t.range;if(e===null)return;let n=z.make("span","codex-editor__fake-cursor");n.dataset.mutationFree="true",e.collapse(),e.insertNode(n)}static isFakeCursorInsideContainer(e){return z.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){let n=z.find(e,".codex-editor__fake-cursor");n&&n.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=t.range}restore(){if(!this.savedSelectionRange)return;let e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(e.focusNode),n.collapse(!1),e.removeAllRanges(),e.addRange(n)}findParentTag(e,n,o=10){let r=window.getSelection(),i=null;return!r||!r.anchorNode||!r.focusNode?null:([r.anchorNode,r.focusNode].forEach(s=>{let a=o;for(;a>0&&s.parentNode&&!(s.tagName===e&&(i=s,n&&s.classList&&!s.classList.contains(n)&&(i=null),i));)s=s.parentNode,a--}),i)}expandToTag(e){let n=window.getSelection();n.removeAllRanges();let o=document.createRange();o.selectNodeContents(e),n.addRange(o)}};function WH(t,e){let{type:n,target:o,addedNodes:r,removedNodes:i}=t;return t.type==="attributes"&&t.attributeName==="data-empty"?!1:!!(e.contains(o)||n==="childList"&&(Array.from(r).some(s=>s===e)||Array.from(i).some(s=>s===e)))}var Qg="redactor dom changed",gS="block changed",mS="fake cursor is about to be toggled",_S="fake cursor have been set",tc="editor mobile layout toggled";function em(t,e){if(!t.conversionConfig)return!1;let n=t.conversionConfig[e];return at(n)||yr(n)}function Eu(t,e){return em(t.tool,e)}function bS(t,e){return Object.entries(t).some(([n,o])=>e[n]&&$H(e[n],o))}async function yS(t,e){let n=(await t.save()).data,o=e.find(r=>r.name===t.name);return o!==void 0&&!em(o,"export")?[]:e.reduce((r,i)=>{if(!em(i,"import")||i.toolbox===void 0)return r;let s=i.toolbox.filter(a=>{if(lo(a)||a.icon===void 0)return!1;if(a.data!==void 0){if(bS(a.data,n))return!1}else if(i.name===t.name)return!1;return!0});return r.push({...i,toolbox:s}),r},[])}function ZT(t,e){return t.mergeable?t.name===e.name?!0:Eu(e,"export")&&Eu(t,"import"):!1}function GH(t,e){let n=e?.export;return at(n)?n(t):yr(n)?t[n]:(n!==void 0&&Ue("Conversion \xABexport\xBB property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function QT(t,e,n){let o=e?.import;return at(o)?o(t,n):yr(o)?{[o]:t}:(o!==void 0&&Ue("Conversion \xABimport\xBB property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var tt=(t=>(t.Default="default",t.Separator="separator",t.Html="html",t))(tt||{}),_r=(t=>(t.APPEND_CALLBACK="appendCallback",t.RENDERED="rendered",t.MOVED="moved",t.UPDATED="updated",t.REMOVED="removed",t.ON_PASTE="onPaste",t))(_r||{}),ho=class t extends Zi{constructor({id:e=PH(),data:n,tool:o,readOnly:r,tunesData:i},s){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(a=void 0)=>{let l=a===void 0,c=a instanceof InputEvent;!l&&!c&&this.detectToolRootChange(a);let d;l||c?d=!0:d=!(a.length>0&&a.every(u=>{let{addedNodes:p,removedNodes:f,target:h}=u;return[...Array.from(p),...Array.from(f),h].some(m=>(z.isElement(m)||(m=m.parentElement),m&&m.closest('[data-mutation-free="true"]')!==null))})),d&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=s||null,this.blockAPI=new mr(this),this.tool=o,this.toolInstance=o.create(n,this.blockAPI,r),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;let e=z.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){let n=this.inputs.findIndex(o=>o===e||o.contains(e));n!==-1&&(this.inputIndex=n)}get firstInput(){return this.inputs[0]}get lastInput(){let e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!lo(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return at(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){let e=z.isEmpty(this.pluginsContent,"/"),n=!this.hasMedia;return e&&n}get hasMedia(){let e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,o;this.holder.classList.toggle(t.CSS.selected,e);let r=e===!0&&ge.isRangeInsideContainer(this.holder),i=e===!1&&ge.isFakeCursorInsideContainer(this.holder);(r||i)&&((n=this.editorEventBus)==null||n.emit(mS,{state:e}),r?ge.addFakeCursor():ge.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(_S,{state:e}))}get selected(){return this.holder.classList.contains(t.CSS.selected)}set stretched(e){this.holder.classList.toggle(t.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(t.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(t.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,n){if(at(this.toolInstance[e])){e==="appendCallback"&&Ue("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,n)}catch(o){Ue(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){let e=await this.toolInstance.save(this.pluginsContent),n=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,s])=>{if(at(s.save))try{n[i]=s.save()}catch(a){Ue(`Tune ${s.constructor.name} save method throws an Error %o`,"warn",a)}});let o=window.performance.now(),r;return Promise.resolve(e).then(i=>(r=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:n,time:r-o})).catch(i=>{Ue(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let n=!0;return this.toolInstance.validate instanceof Function&&(n=await this.toolInstance.validate(e)),n}getTunes(){let e=[],n=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return z.isElement(o)?e.push({type:tt.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(r=>r.render()).forEach(r=>{z.isElement(r)?n.push({type:tt.Html,element:r}):Array.isArray(r)?n.push(...r):n.push(r)}),{toolTunes:e,commonTunes:n}}updateCurrentInput(){this.currentInput=z.isNativeInput(document.activeElement)||!ge.anchorNode?document.activeElement:ge.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),at(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){let e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);let n=await this.data,o=e;return o?.find(r=>bS(r.data,n))}async exportDataAsString(){let e=await this.data;return GH(e,this.tool.conversionConfig)}compose(){let e=z.make("div",t.CSS.wrapper),n=z.make("div",t.CSS.content),o=this.toolInstance.render();e.setAttribute("data-cy","block-wrapper"),e.dataset.id=this.id,this.toolRenderedElement=o,n.appendChild(this.toolRenderedElement);let r=n;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(at(i.wrap))try{r=i.wrap(r)}catch(s){Ue(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",s)}}),e.appendChild(r),e}composeTunes(e){Array.from(this.tunes.values()).forEach(n=>{(n.isInternal?this.defaultTunesInstances:this.tunesInstances).set(n.name,n.create(e[n.name],this.blockAPI))}),Object.entries(e).forEach(([n,o])=>{this.tunesInstances.has(n)||(this.unavailableTunesData[n]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),z.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),z.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=n=>{let{mutations:o}=n;o.some(r=>WH(r,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(Qg,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(Qg,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(n=>{if(Array.from(n.removedNodes).includes(this.toolRenderedElement)){let o=n.addedNodes[n.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(pS)}},tm=class extends Ie{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,n={},o={},r,i,s,a)=>{let l=this.Editor.BlockManager.insert({id:a,tool:e,data:n,index:r,needToFocus:i,replace:s});return new mr(l)},this.composeBlockData=async e=>{let n=this.Editor.Tools.blockTools.get(e);return new ho({tool:n,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,n,o)=>{let{BlockManager:r}=this.Editor,i=r.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);let s=await r.update(i,n,o);return new mr(s)},this.convert=async(e,n,o)=>{var r,i;let{BlockManager:s,Tools:a}=this.Editor,l=s.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);let c=a.blockTools.get(l.name),d=a.blockTools.get(n);if(!d)throw new Error(`Block Tool with type "${n}" not found`);let u=((r=c?.conversionConfig)==null?void 0:r.export)!==void 0,p=((i=d.conversionConfig)==null?void 0:i.import)!==void 0;if(u&&p){let f=await s.convert(l,n,o);return new mr(f)}else{let f=[u?!1:vu(l.name),p?!1:vu(n)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${n}" is not possible. ${f} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,n=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(n);let o=e.map(({id:r,type:i,data:s})=>this.Editor.BlockManager.composeBlock({id:r,tool:i||this.config.defaultBlock,data:s}));return this.Editor.BlockManager.insertMany(o,n),o.map(r=>new mr(r))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,n)=>this.swap(e,n),move:(e,n)=>this.move(e,n),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,n=!0)=>this.stretchBlock(e,n),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){let n=this.Editor.BlockManager.getBlockById(e);if(!n){ao("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(n)}getBlockByIndex(e){let n=this.Editor.BlockManager.getBlockByIndex(e);if(n===void 0){ao("There is no block at index `"+e+"`","warn");return}return new mr(n)}getById(e){let n=this.Editor.BlockManager.getBlockById(e);return n===void 0?(ao("There is no block with id `"+e+"`","warn"),null):new mr(n)}getBlockByElement(e){let n=this.Editor.BlockManager.getBlock(e);if(n===void 0){ao("There is no block corresponding to element `"+e+"`","warn");return}return new mr(n)}swap(e,n){Ue("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,n)}move(e,n){this.Editor.BlockManager.move(e,n)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{let n=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(n)}catch(n){ao(n,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}renderFromHTML(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,n=!0){Jg(!0,"blocks.stretchBlock()","BlockAPI");let o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=n)}insertNewBlock(){Ue("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}};function YH(t,e){return typeof t=="number"?e.BlockManager.getBlockByIndex(t):typeof t=="string"?e.BlockManager.getBlockById(t):e.BlockManager.getBlockById(t.id)}var nm=class extends Ie{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,n),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,n),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,n),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,n),!0):!1,this.setToBlock=(e,n=this.Editor.Caret.positions.DEFAULT,o=0)=>{let r=YH(e,this.Editor);return r===void 0?!1:(this.Editor.Caret.setToBlock(r,n,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}},om=class extends Ie{get methods(){return{emit:(e,n)=>this.emit(e,n),off:(e,n)=>this.off(e,n),on:(e,n)=>this.on(e,n)}}on(e,n){this.eventsDispatcher.on(e,n)}emit(e,n){this.eventsDispatcher.emit(e,n)}off(e,n){this.eventsDispatcher.off(e,n)}},rm=class t extends Ie{static getNamespace(e,n){return n?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{ao("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,n){return Object.assign(this.methods,{t:o=>mn.t(t.getNamespace(e,n),o)})}},im=class extends Ie{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,n){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,n)})}},sm=class extends Ie{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}},am=class extends Ie{get methods(){return{on:(e,n,o,r)=>this.on(e,n,o,r),off:(e,n,o,r)=>this.off(e,n,o,r),offById:e=>this.offById(e)}}on(e,n,o,r){return this.listeners.on(e,n,o,r)}off(e,n,o,r){this.listeners.off(e,n,o,r)}offById(e){this.listeners.offById(e)}},xS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="/",r(r.s=0)})([function(n,o,r){r(1),n.exports=(function(){var i=r(6),s="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=i.getWrapper(),document.body.appendChild(a)})();var c=null,d=l.time||8e3;switch(l.type){case"confirm":c=i.confirm(l);break;case"prompt":c=i.prompt(l);break;default:c=i.alert(l),window.setTimeout(function(){c.remove()},d)}a.appendChild(c),c.classList.add(s)}}}})()},function(n,o,r){var i=r(2);typeof i=="string"&&(i=[[n.i,i,""]]);var s={hmr:!0,transform:void 0,insertInto:void 0};r(4)(i,s),i.locals&&(n.exports=i.locals)},function(n,o,r){(n.exports=r(3)(!1)).push([n.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(n,o){n.exports=function(r){var i=[];return i.toString=function(){return this.map(function(s){var a=(function(l,c){var d=l[1]||"",u=l[3];if(!u)return d;if(c&&typeof btoa=="function"){var p=(h=u,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(h))))+" */"),f=u.sources.map(function(m){return"/*# sourceURL="+u.sourceRoot+m+" */"});return[d].concat(f).concat([p]).join(`
92
+ `)}var h;return[d].join(`
93
+ `)})(s,r);return s[2]?"@media "+s[2]+"{"+a+"}":a}).join("")},i.i=function(s,a){typeof s=="string"&&(s=[[null,s,""]]);for(var l={},c=0;c<this.length;c++){var d=this[c][0];typeof d=="number"&&(l[d]=!0)}for(c=0;c<s.length;c++){var u=s[c];typeof u[0]=="number"&&l[u[0]]||(a&&!u[2]?u[2]=a:a&&(u[2]="("+u[2]+") and ("+a+")"),i.push(u))}},i}},function(n,o,r){var i,s,a={},l=(i=function(){return window&&document&&document.all&&!window.atob},function(){return s===void 0&&(s=i.apply(this,arguments)),s}),c=(function(T){var w={};return function(S){if(typeof S=="function")return S();if(w[S]===void 0){var N=(function(D){return document.querySelector(D)}).call(this,S);if(window.HTMLIFrameElement&&N instanceof window.HTMLIFrameElement)try{N=N.contentDocument.head}catch{N=null}w[S]=N}return w[S]}})(),d=null,u=0,p=[],f=r(5);function h(T,w){for(var S=0;S<T.length;S++){var N=T[S],D=a[N.id];if(D){D.refs++;for(var O=0;O<D.parts.length;O++)D.parts[O](N.parts[O]);for(;O<N.parts.length;O++)D.parts.push(v(N.parts[O],w))}else{var M=[];for(O=0;O<N.parts.length;O++)M.push(v(N.parts[O],w));a[N.id]={id:N.id,refs:1,parts:M}}}}function m(T,w){for(var S=[],N={},D=0;D<T.length;D++){var O=T[D],M=w.base?O[0]+w.base:O[0],I={css:O[1],media:O[2],sourceMap:O[3]};N[M]?N[M].parts.push(I):S.push(N[M]={id:M,parts:[I]})}return S}function _(T,w){var S=c(T.insertInto);if(!S)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var N=p[p.length-1];if(T.insertAt==="top")N?N.nextSibling?S.insertBefore(w,N.nextSibling):S.appendChild(w):S.insertBefore(w,S.firstChild),p.push(w);else if(T.insertAt==="bottom")S.appendChild(w);else{if(typeof T.insertAt!="object"||!T.insertAt.before)throw new Error(`[Style Loader]
94
+
95
+ Invalid value for parameter 'insertAt' ('options.insertAt') found.
96
+ Must be 'top', 'bottom', or Object.
97
+ (https://github.com/webpack-contrib/style-loader#insertat)
98
+ `);var D=c(T.insertInto+" "+T.insertAt.before);S.insertBefore(w,D)}}function b(T){if(T.parentNode===null)return!1;T.parentNode.removeChild(T);var w=p.indexOf(T);w>=0&&p.splice(w,1)}function y(T){var w=document.createElement("style");return T.attrs.type===void 0&&(T.attrs.type="text/css"),x(w,T.attrs),_(T,w),w}function x(T,w){Object.keys(w).forEach(function(S){T.setAttribute(S,w[S])})}function v(T,w){var S,N,D,O;if(w.transform&&T.css){if(!(O=w.transform(T.css)))return function(){};T.css=O}if(w.singleton){var M=u++;S=d||(d=y(w)),N=k.bind(null,S,M,!1),D=k.bind(null,S,M,!0)}else T.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(S=(function(I){var L=document.createElement("link");return I.attrs.type===void 0&&(I.attrs.type="text/css"),I.attrs.rel="stylesheet",x(L,I.attrs),_(I,L),L})(w),N=(function(I,L,K){var W=K.css,q=K.sourceMap,B=L.convertToAbsoluteUrls===void 0&&q;(L.convertToAbsoluteUrls||B)&&(W=f(W)),q&&(W+=`
99
+ /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(q))))+" */");var se=new Blob([W],{type:"text/css"}),me=I.href;I.href=URL.createObjectURL(se),me&&URL.revokeObjectURL(me)}).bind(null,S,w),D=function(){b(S),S.href&&URL.revokeObjectURL(S.href)}):(S=y(w),N=(function(I,L){var K=L.css,W=L.media;if(W&&I.setAttribute("media",W),I.styleSheet)I.styleSheet.cssText=K;else{for(;I.firstChild;)I.removeChild(I.firstChild);I.appendChild(document.createTextNode(K))}}).bind(null,S),D=function(){b(S)});return N(T),function(I){if(I){if(I.css===T.css&&I.media===T.media&&I.sourceMap===T.sourceMap)return;N(T=I)}else D()}}n.exports=function(T,w){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(w=w||{}).attrs=typeof w.attrs=="object"?w.attrs:{},w.singleton||typeof w.singleton=="boolean"||(w.singleton=l()),w.insertInto||(w.insertInto="head"),w.insertAt||(w.insertAt="bottom");var S=m(T,w);return h(S,w),function(N){for(var D=[],O=0;O<S.length;O++){var M=S[O];(I=a[M.id]).refs--,D.push(I)}for(N&&h(m(N,w),w),O=0;O<D.length;O++){var I;if((I=D[O]).refs===0){for(var L=0;L<I.parts.length;L++)I.parts[L]();delete a[I.id]}}}};var E,C=(E=[],function(T,w){return E[T]=w,E.filter(Boolean).join(`
100
+ `)});function k(T,w,S,N){var D=S?"":N.css;if(T.styleSheet)T.styleSheet.cssText=C(w,D);else{var O=document.createTextNode(D),M=T.childNodes;M[w]&&T.removeChild(M[w]),M.length?T.insertBefore(O,M[w]):T.appendChild(O)}}},function(n,o){n.exports=function(r){var i=typeof window<"u"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!r||typeof r!="string")return r;var s=i.protocol+"//"+i.host,a=s+i.pathname.replace(/\/[^\/]*$/,"/");return r.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var d,u=c.trim().replace(/^"(.*)"$/,function(p,f){return f}).replace(/^'(.*)'$/,function(p,f){return f});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(u)?l:(d=u.indexOf("//")===0?u:u.indexOf("/")===0?s+u:a+u.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(n,o,r){var i,s,a,l,c,d,u,p,f;n.exports=(i="cdx-notifies",s="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",d="cdx-notify__input",u="cdx-notify__button",p="cdx-notify__btns-wrapper",{alert:f=function(h){var m=document.createElement("DIV"),_=document.createElement("DIV"),b=h.message,y=h.style;return m.classList.add(s),y&&m.classList.add(s+"--"+y),m.innerHTML=b,_.classList.add(a),_.addEventListener("click",m.remove.bind(m)),m.appendChild(_),m},confirm:function(h){var m=f(h),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("button"),x=m.querySelector("."+a),v=h.cancelHandler,E=h.okHandler;return _.classList.add(p),b.innerHTML=h.okText||"Confirm",y.innerHTML=h.cancelText||"Cancel",b.classList.add(u),y.classList.add(u),b.classList.add(l),y.classList.add(c),v&&typeof v=="function"&&(y.addEventListener("click",v),x.addEventListener("click",v)),E&&typeof E=="function"&&b.addEventListener("click",E),b.addEventListener("click",m.remove.bind(m)),y.addEventListener("click",m.remove.bind(m)),_.appendChild(b),_.appendChild(y),m.appendChild(_),m},prompt:function(h){var m=f(h),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("input"),x=m.querySelector("."+a),v=h.cancelHandler,E=h.okHandler;return _.classList.add(p),b.innerHTML=h.okText||"Ok",b.classList.add(u),b.classList.add(l),y.classList.add(d),h.placeholder&&y.setAttribute("placeholder",h.placeholder),h.default&&(y.value=h.default),h.inputType&&(y.type=h.inputType),v&&typeof v=="function"&&x.addEventListener("click",v),E&&typeof E=="function"&&b.addEventListener("click",function(){E(y.value)}),b.addEventListener("click",m.remove.bind(m)),_.appendChild(y),_.appendChild(b),m.appendChild(_),m},getWrapper:function(){var h=document.createElement("DIV");return h.classList.add(i),h}})}])})})(xS);var qH=xS.exports,XH=Bu(qH),lm=class{show(e){XH.show(e)}},cm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.notifier=new lm}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}},dm=class extends Ie{get methods(){let e=()=>this.isEnabled;return{toggle:n=>this.toggle(n),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}},vS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(ec,function(){function n(u){var p=u.tags,f=Object.keys(p),h=f.map(function(m){return typeof p[m]}).every(function(m){return m==="object"||m==="boolean"||m==="function"});if(!h)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function r(u){return o.indexOf(u.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(u){return i.indexOf(u.nodeName)!==-1}n.prototype.clean=function(u){let p=document.implementation.createHTMLDocument(),f=p.createElement("div");return f.innerHTML=u,this._sanitize(p,f),f.innerHTML},n.prototype._sanitize=function(u,p){var f=a(u,p),h=f.firstChild();if(h)do{if(h.nodeType===Node.TEXT_NODE)if(h.data.trim()===""&&(h.previousElementSibling&&r(h.previousElementSibling)||h.nextElementSibling&&r(h.nextElementSibling))){p.removeChild(h),this._sanitize(u,p);break}else continue;if(h.nodeType===Node.COMMENT_NODE){p.removeChild(h),this._sanitize(u,p);break}var m=s(h),_;m&&(_=Array.prototype.some.call(h.childNodes,r));var b=!!p.parentNode,y=r(p)&&r(h)&&b,x=h.nodeName.toLowerCase(),v=l(this.config,x,h),E=m&&_;if(E||c(h,v)||!this.config.keepNestedBlockElements&&y){if(!(h.nodeName==="SCRIPT"||h.nodeName==="STYLE"))for(;h.childNodes.length>0;)p.insertBefore(h.childNodes[0],h);p.removeChild(h),this._sanitize(u,p);break}for(var C=0;C<h.attributes.length;C+=1){var k=h.attributes[C];d(k,v,h)&&(h.removeAttribute(k.name),C=C-1)}this._sanitize(u,h)}while(h=f.nextSibling())};function a(u,p){return u.createTreeWalker(p,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,p,f){return typeof u.tags[p]=="function"?u.tags[p](f):u.tags[p]}function c(u,p){return typeof p>"u"?!0:typeof p=="boolean"?!p:!1}function d(u,p,f){var h=u.name.toLowerCase();return p===!0?!1:typeof p[h]=="function"?!p[h](u.value,f):typeof p[h]>"u"||p[h]===!1?!0:typeof p[h]=="string"?p[h]!==u.value:!1}return n})})(vS);var JH=vS.exports,ZH=Bu(JH);function qm(t,e){return t.map(n=>{let o=at(e)?e(n.tool):e;return lo(o)||(n.data=Xm(n.data,o)),n})}function zo(t,e={}){let n={tags:e};return new ZH(n).clean(t)}function Xm(t,e){return Array.isArray(t)?QH(t,e):nn(t)?e4(t,e):yr(t)?t4(t,e):t}function QH(t,e){return t.map(n=>Xm(n,e))}function e4(t,e){let n={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let r=t[o],i=n4(e[o])?e[o]:e;n[o]=Xm(r,i)}return n}function t4(t,e){return nn(e)?zo(t,e):e===!1?zo(t,{}):t}function n4(t){return nn(t)||OH(t)||at(t)}var um=class extends Ie{get methods(){return{clean:(e,n)=>this.clean(e,n)}}clean(e,n){return zo(e,n)}},pm=class extends Ie{get methods(){return{save:()=>this.save()}}save(){let e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(ao(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}},fm=class extends Ie{constructor(){super(...arguments),this.selectionUtils=new ge}get methods(){return{findParentTag:(e,n)=>this.findParentTag(e,n),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,n){return this.selectionUtils.findParentTag(e,n)}expandToTag(e){this.selectionUtils.expandToTag(e)}},hm=class extends Ie{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}},gm=class extends Ie{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}},mm=class extends Ie{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){ao("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){ao("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}},CS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){n.exports=r(1)},function(n,o,r){r.r(o),r.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);let d=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(d.hidingDelay&&(this.hidingDelay=d.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of \xABcontent\xBB passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),d.placement){case"top":this.placeTop(a,d);break;case"left":this.placeLeft(a,d);break;case"right":this.placeRight(a,d);break;default:this.placeBottom(a,d)}d&&d.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},d.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){let a="codex-tooltips-style";if(document.getElementById(a))return;let l=r(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",d,u)}placeTop(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",d,u)}placeLeft(a,l){let c=a.getBoundingClientRect(),d=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",d,u)}placeRight(a,l){let c=a.getBoundingClientRect(),d=c.right+this.offsetRight+l.marginRight,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",d,u)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){let d=document.createElement(a);Array.isArray(l)?d.classList.add(...l):l&&d.classList.add(l);for(let u in c)c.hasOwnProperty(u)&&(d[u]=c[u]);return d}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(n,o){n.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(CS);var o4=CS.exports,r4=Bu(o4),go=null;function Jm(){go||(go=new r4)}function i4(t,e,n){Jm(),go?.show(t,e,n)}function wu(t=!1){Jm(),go?.hide(t)}function Tu(t,e,n){Jm(),go?.onHover(t,e,n)}function s4(){go?.destroy(),go=null}var _m=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n})}get methods(){return{show:(e,n,o)=>this.show(e,n,o),hide:()=>this.hide(),onHover:(e,n,o)=>this.onHover(e,n,o)}}show(e,n,o){i4(e,n,o)}hide(){wu()}onHover(e,n,o){Tu(e,n,o)}},bm=class extends Ie{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}};function ES(t,e){let n={};return Object.entries(t).forEach(([o,r])=>{if(nn(r)){let i=e?`${e}.${o}`:o;Object.values(r).every(s=>yr(s))?n[o]=i:n[o]=ES(r,i);return}n[o]=r}),n}var Gn=ES(fS);function a4(t,e){let n={};return Object.keys(t).forEach(o=>{let r=e[o];r!==void 0?n[r]=t[o]:n[o]=t[o]}),n}var wS=class Jl{constructor(e,n){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=n}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(Jl.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(Jl.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let n=this.cursor;return n===-1?n=e===Jl.directions.RIGHT?-1:0:this.items[n].classList.remove(this.focusedCssClass),e===Jl.directions.RIGHT?n=(n+1)%this.items.length:n=(this.items.length+n-1)%this.items.length,z.canSetCaret(this.items[n])&&xu(()=>ge.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),n}};wS.directions={RIGHT:"right",LEFT:"left"};var Yl=wS,ha=class t{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=n=>{if(this.isEventReadyForHandling(n))switch(t.usedKeys.includes(n.keyCode)&&n.preventDefault(),n.keyCode){case ve.TAB:this.handleTabPress(n);break;case ve.LEFT:case ve.UP:this.flipLeft();break;case ve.RIGHT:case ve.DOWN:this.flipRight();break;case ve.ENTER:this.handleEnterPress(n);break}},this.iterator=new Yl(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||t.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[ve.TAB,ve.LEFT,ve.RIGHT,ve.ENTER,ve.UP,ve.DOWN]}activate(e,n){this.activated=!0,e&&this.iterator.setItems(e),n!==void 0&&this.iterator.setCursor(n),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(n=>n!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?Yl.directions.LEFT:Yl.directions.RIGHT){case Yl.directions.RIGHT:this.flipRight();break;case Yl.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),at(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}},l4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',c4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',d4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',u4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',p4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',f4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',h4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',g4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',eS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',m4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',_4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',TS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',b4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',y4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',x4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',v4="__",C4="--";function ni(t){return(e,n)=>[[t,e].filter(o=>!!o).join(v4),n].filter(o=>!!o).join(C4)}var ql=ni("ce-hint"),Xl={root:ql(),alignedStart:ql(null,"align-left"),alignedCenter:ql(null,"align-center"),title:ql("title"),description:ql("description")},ym=class{constructor(e){this.nodes={root:z.make("div",[Xl.root,e.alignment==="center"?Xl.alignedCenter:Xl.alignedStart]),title:z.make("div",Xl.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=z.make("div",Xl.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}},nc=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){wu()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,n;this.params!==void 0&&"onActivate"in this.params&&((n=(e=this.params).onActivate)==null||n.call(e,this.params))}addHint(e,n){let o=new ym(n);Tu(e,o.getElement(),{placement:n.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}},Wn=ni("ce-popover-item"),ft={container:Wn(),active:Wn(null,"active"),disabled:Wn(null,"disabled"),focused:Wn(null,"focused"),hidden:Wn(null,"hidden"),confirmationState:Wn(null,"confirmation"),noHover:Wn(null,"no-hover"),noFocus:Wn(null,"no-focus"),title:Wn("title"),secondaryTitle:Wn("secondary-title"),icon:Wn("icon"),iconTool:Wn("icon","tool"),iconChevronRight:Wn("icon","chevron-right"),wobbleAnimation:ni("wobble")()},br=class extends nc{constructor(e,n){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(ft.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(ft.noHover)},this.onErrorAnimationEnd=()=>{var o,r;(o=this.nodes.icon)==null||o.classList.remove(ft.wobbleAnimation),(r=this.nodes.icon)==null||r.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,n)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(ft.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ft.active,e)}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ft.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,n){var o,r;let i=n?.wrapperTag||"div",s=z.make(i,ft.container,{type:i==="button"?"button":void 0});return e.name&&(s.dataset.itemName=e.name),this.nodes.icon=z.make("div",[ft.icon,ft.iconTool],{innerHTML:e.icon||h4}),s.appendChild(this.nodes.icon),e.title!==void 0&&s.appendChild(z.make("div",ft.title,{innerHTML:e.title||""})),e.secondaryLabel&&s.appendChild(z.make("div",ft.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&s.appendChild(z.make("div",[ft.icon,ft.iconChevronRight],{innerHTML:u4})),this.isActive&&s.classList.add(ft.active),e.isDisabled&&s.classList.add(ft.disabled),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(s,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"}),s}enableConfirmationMode(e){if(this.nodes.root===null)return;let n={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(n);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(ft.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;let e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(ft.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,n,o;(e=this.nodes.root)==null||e.classList.add(ft.noHover),(n=this.nodes.root)==null||n.classList.add(ft.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var n;if(!("confirmation"in e)||e.confirmation===void 0)try{(n=e.onActivate)==null||n.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,n,o;(e=this.nodes.icon)!=null&&e.classList.contains(ft.wobbleAnimation)||((n=this.nodes.icon)==null||n.classList.add(ft.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}},Ug=ni("ce-popover-item-separator"),jg={container:Ug(),line:Ug("line"),hidden:Ug(null,"hidden")},Su=class extends nc{constructor(){super(),this.nodes={root:z.make("div",jg.container),line:z.make("div",jg.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(jg.hidden,e)}},Ho=(t=>(t.Closed="closed",t.ClosedOnActivate="closed-on-activate",t))(Ho||{}),gn=ni("ce-popover"),xt={popover:gn(),popoverContainer:gn("container"),popoverOpenTop:gn(null,"open-top"),popoverOpenLeft:gn(null,"open-left"),popoverOpened:gn(null,"opened"),search:gn("search"),nothingFoundMessage:gn("nothing-found-message"),nothingFoundMessageDisplayed:gn("nothing-found-message","displayed"),items:gn("items"),overlay:gn("overlay"),overlayHidden:gn("overlay","hidden"),popoverNested:gn(null,"nested"),getPopoverNestedClass:t=>gn(null,`nested-level-${t.toString()}`),popoverInline:gn(null,"inline"),popoverHeader:gn("header")},fa=(t=>(t.NestingLevel="--nesting-level",t.PopoverHeight="--popover-height",t.InlinePopoverWidth="--inline-popover-width",t.TriggerItemLeft="--trigger-item-left",t.TriggerItemTop="--trigger-item-top",t))(fa||{}),tS=ni("ce-popover-item-html"),nS={root:tS(),hidden:tS(null,"hidden")},es=class extends nc{constructor(e,n){var o,r;super(e),this.nodes={root:z.make("div",nS.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(nS.hidden,e)}getControls(){let e=this.nodes.root.querySelectorAll(`button, ${z.allInputsSelector}`);return Array.from(e)}},ku=class extends Zi{constructor(e,n={}){super(),this.params=e,this.itemsRenderParams=n,this.listeners=new Qi,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=z.make("div",[xt.popoverContainer]),this.nodes.nothingFoundMessage=z.make("div",[xt.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=z.make("div",[xt.items]),this.items.forEach(o=>{let r=o.getElement();r!==null&&this.nodes.items.appendChild(r)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=z.make("div",[xt.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof br)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(xt.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(xt.popoverOpened),this.nodes.popover.classList.remove(xt.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Ho.Closed)}destroy(){var e;this.items.forEach(n=>n.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){let n=this.items.find(o=>o.name===e);this.handleItemClick(n)}buildItems(e){return e.map(n=>{switch(n.type){case tt.Separator:return new Su;case tt.Html:return new es(n,this.itemsRenderParams[tt.Html]);default:return new br(n,this.itemsRenderParams[tt.Default])}})}getTargetItem(e){return this.items.filter(n=>n instanceof br||n instanceof es).find(n=>{let o=n.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(n=>n!==e).forEach(n=>n.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Ho.ClosedOnActivate))}}handleClick(e){let n=this.getTargetItem(e);n!==void 0&&this.handleItemClick(n)}toggleItemActivenessIfNeeded(e){if(e instanceof br&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){let n=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(n.length===1){e.toggleActive();return}n.forEach(o=>{o.toggleActive(o===e)})}}},Nu=(t=>(t.Search="search",t))(Nu||{}),Vg=ni("cdx-search-field"),Wg={wrapper:Vg(),icon:Vg("icon"),input:Vg("input")},xm=class extends Zi{constructor({items:e,placeholder:n}){super(),this.listeners=new Qi,this.items=e,this.wrapper=z.make("div",Wg.wrapper);let o=z.make("div",Wg.icon,{innerHTML:b4});this.input=z.make("input",Wg.input,{placeholder:n,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(Nu.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(Nu.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,o;let r=((n=e.title)==null?void 0:n.toLowerCase())||"",i=(o=this.searchQuery)==null?void 0:o.toLowerCase();return i!==void 0?r.includes(i):!1}},E4=Object.defineProperty,w4=Object.getOwnPropertyDescriptor,T4=(t,e,n,o)=>{for(var r=o>1?void 0:o?w4(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&E4(e,n,r),r},SS=class kS extends ku{constructor(e,n){super(e,n),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{let o=this.itemsDefault.find(r=>r.isFocused);o?.onFocus()},this.onSearch=o=>{var r;let i=o.query==="",s=o.items.length===0;this.items.forEach(l=>{let c=!1;l instanceof br?c=!o.items.includes(l):(l instanceof Su||l instanceof es)&&(c=s||!i),l.toggleHidden(c)}),this.toggleNothingFoundMessage(s);let a=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(r=this.flipper)!=null&&r.isActivated&&(this.flipper.deactivate(),this.flipper.activate(a))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(xt.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new ha({items:this.flippableElements,focusedItemClass:ft.focused,allowedKeys:[ve.TAB,ve.UP,ve.DOWN,ve.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(fa.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(xt.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(xt.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){let n=this.getTargetItem(e);n!==void 0&&this.previouslyHoveredItem!==n&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=n,n.hasChildren&&this.showNestedPopoverForItem(n))}setTriggerItemPosition(e,n){let o=n.getElement(),r=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+r;e.style.setProperty(fa.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var e,n;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Ho.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose())}showNestedPopoverForItem(e){var n;this.nestedPopover=new kS({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Ho.ClosedOnActivate,this.hide);let o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(fa.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popoverContainer.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.height,r=e.top+o,i=e.top-o,s=Math.min(window.innerHeight,n.bottom);return i<n.top||r<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popover.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.width,r=e.right+o,i=e.left-o,s=Math.min(window.innerWidth,n.right);return i<n.left||r<=s}get size(){var e;let n={height:0,width:0};if(this.nodes.popover===null)return n;let o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(xt.popoverOpened),(e=o.querySelector("."+xt.popoverNested))==null||e.remove(),document.body.appendChild(o);let r=o.querySelector("."+xt.popoverContainer);return n.height=r.offsetHeight,n.width=r.offsetWidth,o.remove(),n}get flippableElements(){return this.items.map(e=>{if(e instanceof br)return e.getElement();if(e instanceof es)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new xm({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Nu.Search,this.onSearch);let e=this.search.getElement();e.classList.add(xt.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(xt.nothingFoundMessageDisplayed,e)}};T4([ma],SS.prototype,"size",1);var Zm=SS,vm=class extends Zm{constructor(e){let n=!_a();super({...e,class:xt.popoverInline},{[tt.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:n}},[tt.Html]:{hint:{position:"top",alignment:"center",enabled:n}}}),this.items.forEach(o=>{!(o instanceof br)&&!(o instanceof es)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(fa.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,n){let o=n.getElement(),r=o?o.offsetLeft:0,i=this.offsetLeft+r;e.style.setProperty(fa.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){let n=super.showNestedPopoverForItem(e);return n.getElement().classList.add(xt.getPopoverNestedClass(n.nestingLevel)),n}handleItemClick(e){var n;e!==this.nestedPopoverTriggerItem&&((n=this.nestedPopoverTriggerItem)==null||n.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}},NS=class Zl{constructor(){this.scrollPosition=null}lock(){Zg?this.lockHard():document.body.classList.add(Zl.CSS.scrollLocked)}unlock(){Zg?this.unlockHard():document.body.classList.remove(Zl.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(Zl.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(Zl.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};NS.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var S4=NS,Gg=ni("ce-popover-header"),Yg={root:Gg(),text:Gg("text"),backButton:Gg("back-button")},Cm=class{constructor({text:e,onBackButtonClick:n}){this.listeners=new Qi,this.text=e,this.onBackButtonClick=n,this.nodes={root:z.make("div",[Yg.root]),backButton:z.make("button",[Yg.backButton]),text:z.make("div",[Yg.text])},this.nodes.backButton.innerHTML=d4,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}},Em=class{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}},Du=class extends ku{constructor(e){super(e,{[tt.Default]:{hint:{enabled:!1}},[tt.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new S4,this.history=new Em,this.isHidden=!0,this.nodes.overlay=z.make("div",[xt.overlay,xt.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(xt.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(xt.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,n){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),n!==void 0){this.header=new Cm({text:n,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});let o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var r;return(r=o.getElement())==null?void 0:r.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var r;let i=o.getElement();i!==null&&((r=this.nodes.items)==null||r.appendChild(i))})}},wm=class extends Ie{constructor(){super(...arguments),this.opened=!1,this.selection=new ge,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,ge.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Ho.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=z.make("div",[this.CSS.settings]),this.nodes.wrapper.setAttribute("data-cy","block-tunes"),this.eventsDispatcher.on(tc,this.close)}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(tc,this.close)}async open(e=this.Editor.BlockManager.currentBlock){var n;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();let{toolTunes:o,commonTunes:r}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);let i=_a()?Du:Zm;this.popover=new i({searchable:!0,items:await this.getTunesItems(e,r,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:mn.ui(Gn.ui.popover,"Nothing found"),search:mn.ui(Gn.ui.popover,"Filter")}}),this.popover.on(Ho.Closed,this.onPopoverClose),(n=this.nodes.wrapper)==null||n.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,n,o){let r=[];o!==void 0&&o.length>0&&(r.push(...o),r.push({type:tt.Separator}));let i=Array.from(this.Editor.Tools.blockTools.values()),s=(await yS(e,i)).reduce((a,l)=>(l.toolbox.forEach(c=>{a.push({icon:c.icon,title:mn.t(Gn.toolNames,c.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{let{BlockManager:d,Caret:u,Toolbar:p}=this.Editor,f=await d.convert(e,l.name,c.data);p.close(),u.setToBlock(f,u.positions.END)}})}),a),[]);return s.length>0&&(r.push({icon:TS,name:"convert-to",title:mn.ui(Gn.ui.popover,"Convert to"),children:{searchable:!0,items:s}}),r.push({type:tt.Separator})),r.push(...n),r.map(a=>this.resolveTuneAliases(a))}resolveTuneAliases(e){if(e.type===tt.Separator||e.type===tt.Html)return e;let n=a4(e,{label:"title"});return e.confirmation&&(n.confirmation=this.resolveTuneAliases(e.confirmation)),n}},DS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){function i(l,c){for(var d=0;d<c.length;d++){var u=c[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(l,u.key,u)}}function s(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}r.r(o);var a=(function(){function l(c){var d=this;(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(u){d.execute(u)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return s(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),s(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var d=0;d<c.length;d++){c[d]=c[d].toUpperCase();var u=!1;for(var p in l.supportedCommands)if(l.supportedCommands[p].includes(c[d])){u=this.commands[p]=!0;break}u||(this.keys[c[d]]=!0)}for(var f in l.supportedCommands)this.commands[f]||(this.commands[f]=!1)}},{key:"execute",value:function(c){var d,u={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},p=!0;for(d in this.commands)this.commands[d]!==u[d]&&(p=!1);var f,h=!0;for(f in this.keys)h=h&&c.keyCode===l.keyCodes[f];p&&h&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();o.default=a}]).default})})(DS);var k4=DS.exports,N4=Bu(k4),Tm=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);let n=new N4({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,n])}remove(e,n){let o=this.findShortcut(e,n);if(!o)return;o.remove();let r=this.registeredShortcuts.get(e);this.registeredShortcuts.set(e,r.filter(i=>i!==o))}findShortcut(e,n){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===n)}},ga=new Tm,D4=Object.defineProperty,O4=Object.getOwnPropertyDescriptor,OS=(t,e,n,o)=>{for(var r=o>1?void 0:o?O4(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&D4(e,n,r),r},gu=(t=>(t.Opened="toolbox-opened",t.Closed="toolbox-closed",t.BlockAdded="toolbox-block-added",t))(gu||{}),Qm=class IS extends Zi{constructor({api:e,tools:n,i18nLabels:o}){super(),this.opened=!1,this.listeners=new Qi,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=n,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:z.make("div",IS.CSS.toolbox)},this.initPopover(),this.nodes.toolbox.setAttribute("data-cy","toolbox"),this.api.events.on(tc,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Ho.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(tc,this.handleMobileLayoutToggle)}toolButtonActivated(e,n){this.insertNewBlock(e,n)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;let n=_a()?Du:Zm;this.popover=new n({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Ho.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Ho.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){let e=[];return this.tools.forEach(n=>{n.toolbox&&e.push(n)}),e}get toolboxItemsToBeDisplayed(){let e=(n,o,r=!0)=>({icon:n.icon,title:mn.t(Gn.toolNames,n.title||vu(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,n.data)},secondaryLabel:o.shortcut&&r?Ym(o.shortcut):""});return this.toolsToBeDisplayed.reduce((n,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((r,i)=>{n.push(e(r,o,i===0))}):o.toolbox!==void 0&&n.push(e(o.toolbox,o)),n),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&this.enableShortcutForTool(e.name,n)})}enableShortcutForTool(e,n){ga.add({name:n,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();let r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r);if(i)try{let s=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(s,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&ga.remove(this.api.ui.nodes.redactor,n)})}async insertNewBlock(e,n){let o=this.api.blocks.getCurrentBlockIndex(),r=this.api.blocks.getBlockByIndex(o);if(!r)return;let i=r.isEmpty?o:o+1,s;if(n){let l=await this.api.blocks.composeBlockData(e);s=Object.assign(l,n)}let a=this.api.blocks.insert(e,s,void 0,i,void 0,r.isEmpty);a.call(_r.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:a}),this.api.toolbar.close()}};OS([ma],Qm.prototype,"toolsToBeDisplayed",1);OS([ma],Qm.prototype,"toolboxItemsToBeDisplayed",1);var I4=Qm,MS="block hovered";async function M4(t,e){let n=navigator.keyboard;if(!n)return e;try{return(await n.getLayoutMap()).get(t)||e}catch(o){return console.error(o),e}}var Sm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var n;(n=this.toolboxInstance)==null||n.close()},open:()=>{if(this.toolboxInstance===null){Ue("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){Ue("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var n;return(n=this.toolboxInstance)==null?void 0:n.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){Ue("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;let n=e.holder,{isMobile:o}=this.Editor.UI,r,i=20,s=e.firstInput,a=n.getBoundingClientRect(),l=s!==void 0?s.getBoundingClientRect():null,c=l!==null?l.top-a.top:null,d=c!==null?c>i:void 0;if(o)r=n.offsetTop+n.offsetHeight;else if(s===void 0||d){let u=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);r=n.offsetTop+u}else{let u=HH(s),p=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);r=n.offsetTop+u-p+8+c}this.nodes.wrapper.style.top=`${Math.floor(r)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,n;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=z.make("div",this.CSS.toolbar),["content","actions"].forEach(i=>{this.nodes[i]=z.make("div",this.CSS[i])}),z.append(this.nodes.wrapper,this.nodes.content),z.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=z.make("div",this.CSS.plusButton,{innerHTML:_4}),z.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{wu(!0),this.plusButtonClicked()},!1);let e=z.make("div");e.appendChild(document.createTextNode(mn.ui(Gn.ui.toolbar.toolbox,"Add"))),e.appendChild(z.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),Tu(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=z.make("span",this.CSS.settingsToggler,{innerHTML:m4}),z.append(this.nodes.actions,this.nodes.settingsToggler);let n=z.make("div"),o=z.text(mn.ui(Gn.ui.blockTunes.toggler,"Click to tune")),r=await M4("Slash","/");n.appendChild(o),n.appendChild(z.make("div",this.CSS.plusButtonShortcut,{textContent:Ym(`CMD + ${r}`)})),Tu(this.nodes.settingsToggler,n,{hidingDelay:400}),z.append(this.nodes.actions,this.makeToolbox()),z.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),z.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new I4({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:mn.ui(Gn.ui.popover,"Filter"),nothingFound:mn.ui(Gn.ui.popover,"Nothing found")}}),this.toolboxInstance.on(gu.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(gu.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(gu.BlockAdded,({block:e})=>{let{BlockManager:n,Caret:o}=this.Editor,r=n.getBlockById(e.id);r.inputs.length===0&&(r===n.lastBlock?(n.insertAtEnd(),o.setToBlock(n.lastBlock)):o.setToBlock(n.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var n;e.stopPropagation(),this.settingsTogglerClicked(),(n=this.toolboxInstance)!=null&&n.opened&&this.toolboxInstance.close(),wu(!0)},!0),_a()||this.eventsDispatcher.on(MS,e=>{var n;this.Editor.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}},Xi=(t=>(t[t.Block=0]="Block",t[t.Inline=1]="Inline",t[t.Tune=2]="Tune",t))(Xi||{}),mu=(t=>(t.Shortcut="shortcut",t.Toolbox="toolbox",t.EnabledInlineTools="inlineToolbar",t.EnabledBlockTunes="tunes",t.Config="config",t))(mu||{}),AS=(t=>(t.Shortcut="shortcut",t.SanitizeConfig="sanitize",t))(AS||{}),pa=(t=>(t.IsEnabledLineBreaks="enableLineBreaks",t.Toolbox="toolbox",t.ConversionConfig="conversionConfig",t.IsReadOnlySupported="isReadOnlySupported",t.PasteConfig="pasteConfig",t))(pa||{}),Ou=(t=>(t.IsInline="isInline",t.Title="title",t.IsReadOnlySupported="isReadOnlySupported",t))(Ou||{}),km=(t=>(t.IsTune="isTune",t))(km||{}),oc=class{constructor({name:e,constructable:n,config:o,api:r,isDefault:i,isInternal:s=!1,defaultPlaceholder:a}){this.api=r,this.name=e,this.constructable=n,this.config=o,this.isDefault=i,this.isInternal=s,this.defaultPlaceholder=a}get settings(){let e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(at(this.constructable.reset))return this.constructable.reset()}prepare(){if(at(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){let e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===Xi.Inline}isBlock(){return this.type===Xi.Block}isTune(){return this.type===Xi.Tune}},Nm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=_a()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,n;if(this.opened){for(let[o,r]of this.tools){let i=this.getToolShortcut(o.name);i!==void 0&&ga.remove(this.Editor.UI.nodes.redactor,i),at(r.clear)&&r.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(n=this.popover)==null||n.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=z.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.wrapper.setAttribute("data-cy","inline-toolbar"),z.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();let n=await this.getPopoverItems();this.popover=new vm({items:n,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:mn.ui(Gn.ui.popover,"Nothing found"),search:mn.ui(Gn.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){let n=ge.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),r={x:n.x-o.x,y:n.y+n.height-o.top+this.toolbarVerticalMargin};r.x+e+o.x>this.Editor.UI.contentRect.right&&(r.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(r.x)+"px",this.nodes.wrapper.style.top=Math.floor(r.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){let e=["IMG","INPUT"],n=ge.get(),o=ge.text;if(!n||!n.anchorNode||n.isCollapsed||o.length<1)return!1;let r=z.isElement(n.anchorNode)?n.anchorNode:n.anchorNode.parentElement;if(r===null||n!==null&&e.includes(r.tagName))return!1;let i=this.Editor.BlockManager.getBlock(n.anchorNode);return!i||this.getTools().some(s=>i.tool.inlineTools.has(s.name))===!1?!1:r.closest("[contenteditable]")!==null}getTools(){let e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Editor.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{let n=e.create();this.tools.set(e,n)})}async getPopoverItems(){let e=[],n=0;for(let[o,r]of this.tools){let i=await r.render(),s=this.getToolShortcut(o.name);if(s!==void 0)try{this.enableShortcuts(o.name,s)}catch{}let a=s!==void 0?Ym(s):void 0,l=mn.t(Gn.toolNames,o.title||vu(o.name));[i].flat().forEach(c=>{var d,u;let p={name:o.name,onActivate:()=>{this.toolClicked(r)},hint:{title:l,description:a}};if(z.isElement(c)){let f={...p,element:c,type:tt.Html};if(at(r.renderActions)){let h=r.renderActions();f.children={isOpen:(d=r.checkState)==null?void 0:d.call(r,ge.get()),isFlippable:!1,items:[{type:tt.Html,element:h}]}}else(u=r.checkState)==null||u.call(r,ge.get());e.push(f)}else if(c.type===tt.Html)e.push({...p,...c,type:tt.Html});else if(c.type===tt.Separator)e.push({type:tt.Separator});else{let f={...p,...c,type:tt.Default};"children"in f&&n!==0&&e.push({type:tt.Separator}),e.push(f),"children"in f&&n<this.tools.size-1&&e.push({type:tt.Separator})}}),n++}return e}getToolShortcut(e){let{Tools:n}=this.Editor,o=n.inlineTools.get(e),r=n.internal.inlineTools;return Array.from(r.keys()).includes(e)?this.inlineTools[e][AS.Shortcut]:o?.shortcut}enableShortcuts(e,n){ga.add({name:n,handler:o=>{var r;let{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),(r=this.popover)==null||r.activateItemByName(e))},on:document})}toolClicked(e){var n;let o=ge.range;(n=e.surround)==null||n.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(n=>{var o;(o=n.checkState)==null||o.call(n,ge.get())})}get inlineTools(){let e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([n,o])=>{e[n]=o.create()}),e}};function LS(){let t=window.getSelection();if(t===null)return[null,0];let e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],n=e.textContent.length)),[e,n])}function RS(t,e,n,o){let r=document.createRange();o==="left"?(r.setStart(t,0),r.setEnd(e,n)):(r.setStart(e,n),r.setEnd(t,t.childNodes.length));let i=r.cloneContents(),s=document.createElement("div");s.appendChild(i);let a=s.textContent||"";return zH(a)}function _u(t){let e=z.getDeepestNode(t);if(e===null||z.isEmpty(t))return!0;if(z.isNativeInput(e))return e.selectionEnd===0;if(z.isEmpty(t))return!0;let[n,o]=LS();return n===null?!1:RS(t,n,o,"left")}function bu(t){let e=z.getDeepestNode(t,!0);if(e===null)return!0;if(z.isNativeInput(e))return e.selectionEnd===e.value.length;let[n,o]=LS();return n===null?!1:RS(t,n,o,"right")}var PS={},e_={},$u={},ts={},t_={},n_={};Object.defineProperty(n_,"__esModule",{value:!0});n_.allInputsSelector=A4;function A4(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=n_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(t_);var ns={},o_={};Object.defineProperty(o_,"__esModule",{value:!0});o_.isNativeInput=L4;function L4(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=o_;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(ns);var FS={},r_={};Object.defineProperty(r_,"__esModule",{value:!0});r_.append=R4;function R4(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=r_;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(FS);var i_={},s_={};Object.defineProperty(s_,"__esModule",{value:!0});s_.blockElements=P4;function P4(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=s_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(i_);var BS={},a_={};Object.defineProperty(a_,"__esModule",{value:!0});a_.calculateBaseline=F4;function F4(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2,c=s+i+r+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=a_;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(BS);var $S={},l_={},c_={},d_={};Object.defineProperty(d_,"__esModule",{value:!0});d_.isContentEditable=B4;function B4(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=d_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(c_);Object.defineProperty(l_,"__esModule",{value:!0});l_.canSetCaret=H4;var $4=ns,z4=c_;function H4(t){var e=!0;if((0,$4.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,z4.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=l_;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})($S);var zu={},u_={};function K4(t,e,n){let o=n.value!==void 0?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}function zS(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function p_(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function U4(t){return!p_(t)}var j4=()=>typeof window<"u"&&window.navigator!==null&&p_(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function V4(t){let e=zS();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function W4(t){return t[0].toUpperCase()+t.slice(1)}function G4(t){let e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);let n=window.getSelection(),o=document.createRange();if(o.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function Y4(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=void 0,n!==!0&&t.apply(i,r)},a=n===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function ti(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function q4(t){return ti(t)==="boolean"}function HS(t){return ti(t)==="function"||ti(t)==="asyncfunction"}function X4(t){return HS(t)&&/^\s*class\s+/.test(t.toString())}function J4(t){return ti(t)==="number"}function yu(t){return ti(t)==="object"}function Z4(t){return Promise.resolve(t)===t}function Q4(t){return ti(t)==="string"}function e5(t){return ti(t)==="undefined"}function Dm(t,...e){if(!e.length)return t;let n=e.shift();if(yu(t)&&yu(n))for(let o in n)yu(n[o])?(t[o]===void 0&&Object.assign(t,{[o]:{}}),Dm(t[o],n[o])):Object.assign(t,{[o]:n[o]});return Dm(t,...e)}function t5(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&console.warn(o)}function n5(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function o5(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}var r5={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},i5={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4},s5=class{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,n)=>{this.completed=this.completed.then(t).then(e).catch(n)})}};function a5(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s===null&&(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s===null&&(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}var l5=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:s5,beautifyShortcut:V4,cacheable:K4,capitalize:W4,copyTextToClipboard:G4,debounce:Y4,deepMerge:Dm,deprecationAssert:t5,getUserOS:zS,getValidUrl:n5,isBoolean:q4,isClass:X4,isEmpty:U4,isFunction:HS,isIosDevice:j4,isNumber:J4,isObject:yu,isPrintableKey:o5,isPromise:Z4,isString:Q4,isUndefined:e5,keyCodes:r5,mouseButtons:i5,notEmpty:p_,throttle:a5,typeOf:ti},Symbol.toStringTag,{value:"Module"})),f_=SH(l5);Object.defineProperty(u_,"__esModule",{value:!0});u_.containsOnlyInlineElements=u5;var c5=f_,d5=i_;function u5(t){var e;(0,c5.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(o){return!(0,d5.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=u_;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(zu);var KS={},h_={},Hu={},g_={};Object.defineProperty(g_,"__esModule",{value:!0});g_.make=p5;function p5(t,e,n){var o;e===void 0&&(e=null),n===void 0&&(n={});var r=document.createElement(t);if(Array.isArray(e)){var i=e.filter(function(a){return a!==void 0});(o=r.classList).add.apply(o,i)}else e!==null&&r.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);return r}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=g_;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(Hu);Object.defineProperty(h_,"__esModule",{value:!0});h_.fragmentToString=h5;var f5=Hu;function h5(t){var e=(0,f5.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=h_;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(KS);var US={},m_={};Object.defineProperty(m_,"__esModule",{value:!0});m_.getContentLength=m5;var g5=ns;function m5(t){var e,n;return(0,g5.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=m_;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(US);var __={},b_={},oS=ec&&ec.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(b_,"__esModule",{value:!0});b_.getDeepestBlockElements=jS;var _5=zu;function jS(t){return(0,_5.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return oS(oS([],e,!0),jS(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=b_;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(__);var VS={},y_={},Ku={},x_={};Object.defineProperty(x_,"__esModule",{value:!0});x_.isLineBreakTag=b5;function b5(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=x_;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(Ku);var Uu={},v_={};Object.defineProperty(v_,"__esModule",{value:!0});v_.isSingleTag=y5;function y5(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=v_;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(Uu);Object.defineProperty(y_,"__esModule",{value:!0});y_.getDeepestNode=WS;var x5=ns,v5=Ku,C5=Uu;function WS(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var r=t[n];if((0,C5.isSingleTag)(r)&&!(0,x5.isNativeInput)(r)&&!(0,v5.isLineBreakTag)(r))if(r[o])r=r[o];else if(r.parentNode!==null&&r.parentNode[o])r=r.parentNode[o];else return r.parentNode;return WS(r,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=y_;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(VS);var GS={},C_={},fu=ec&&ec.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(C_,"__esModule",{value:!0});C_.findAllInputs=k5;var E5=zu,w5=__,T5=t_,S5=ns;function k5(t){return Array.from(t.querySelectorAll((0,T5.allInputsSelector)())).reduce(function(e,n){return(0,S5.isNativeInput)(n)||(0,E5.containsOnlyInlineElements)(n)?fu(fu([],e,!0),[n],!1):fu(fu([],e,!0),(0,w5.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=C_;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(GS);var YS={},E_={};Object.defineProperty(E_,"__esModule",{value:!0});E_.isCollapsedWhitespaces=N5;function N5(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=E_;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(YS);var w_={},T_={};Object.defineProperty(T_,"__esModule",{value:!0});T_.isElement=O5;var D5=f_;function O5(t){return(0,D5.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=T_;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(w_);var qS={},S_={},k_={},N_={};Object.defineProperty(N_,"__esModule",{value:!0});N_.isLeaf=I5;function I5(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=N_;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(k_);var D_={},O_={};Object.defineProperty(O_,"__esModule",{value:!0});O_.isNodeEmpty=P5;var M5=Ku,A5=w_,L5=ns,R5=Uu;function P5(t,e){var n="";return(0,R5.isSingleTag)(t)&&!(0,M5.isLineBreakTag)(t)?!1:((0,A5.isElement)(t)&&(0,L5.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("\u200B","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=O_;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(D_);Object.defineProperty(S_,"__esModule",{value:!0});S_.isEmpty=$5;var F5=k_,B5=D_;function $5(t,e){t.normalize();for(var n=[t];n.length>0;){var o=n.shift();if(o){if(t=o,(0,F5.isLeaf)(t)&&!(0,B5.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=S_;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(qS);var XS={},I_={};Object.defineProperty(I_,"__esModule",{value:!0});I_.isFragment=H5;var z5=f_;function H5(t){return(0,z5.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=I_;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(XS);var JS={},M_={};Object.defineProperty(M_,"__esModule",{value:!0});M_.isHTMLString=U5;var K5=Hu;function U5(t){var e=(0,K5.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=M_;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(JS);var ZS={},A_={};Object.defineProperty(A_,"__esModule",{value:!0});A_.offset=j5;function j5(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,r=e.top+o,i=e.left+n;return{top:r,left:i,bottom:r+e.height,right:i+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=A_;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(ZS);var QS={},L_={};Object.defineProperty(L_,"__esModule",{value:!0});L_.prepend=V5;function V5(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=L_;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(QS);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=t_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=ns;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var o=FS;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return o.append}});var r=i_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return r.blockElements}});var i=BS;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return i.calculateBaseline}});var s=$S;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=zu;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=KS;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=US;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var d=__;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return d.getDeepestBlockElements}});var u=VS;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return u.getDeepestNode}});var p=GS;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var f=YS;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return f.isCollapsedWhitespaces}});var h=c_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return h.isContentEditable}});var m=w_;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return m.isElement}});var _=qS;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var b=XS;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return b.isFragment}});var y=JS;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return y.isHTMLString}});var x=k_;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return x.isLeaf}});var v=D_;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return v.isNodeEmpty}});var E=Ku;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return E.isLineBreakTag}});var C=Uu;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return C.isSingleTag}});var k=Hu;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return k.make}});var T=ZS;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return T.offset}});var w=QS;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return w.prepend}})})(ts);var ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.getContenteditableSlice=G5;var W5=ts;function G5(t,e,n,o,r){var i;r===void 0&&(r=!1);var s=document.createRange();if(o==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),r===!0){var a=s.extractContents();return(0,W5.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var d=(i=c.textContent)!==null&&i!==void 0?i:"";return d}Object.defineProperty($u,"__esModule",{value:!0});$u.checkContenteditableSliceForEmptiness=X5;var Y5=ts,q5=ju;function X5(t,e,n,o){var r=(0,q5.getContenteditableSlice)(t,e,n,o);return(0,Y5.isCollapsedWhitespaces)(r)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=$u;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(e_);var ek={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=ju;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(ek);var tk={},R_={};Object.defineProperty(R_,"__esModule",{value:!0});R_.focus=Z5;var J5=ts;function Z5(t,e){var n,o;if(e===void 0&&(e=!0),(0,J5.isNativeInput)(t)){t.focus();var r=e?0:t.value.length;t.setSelectionRange(r,r)}else{var i=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p){var f=document.createTextNode("");p.appendChild(f),i.setStart(f,0),i.setEnd(f,0)},l=function(p){return p!=null},c=t.childNodes,d=e?c[0]:c[c.length-1];if(l(d)){for(;l(d)&&d.nodeType!==Node.TEXT_NODE;)d=e?d.firstChild:d.lastChild;if(l(d)&&d.nodeType===Node.TEXT_NODE){var u=(o=(n=d.textContent)===null||n===void 0?void 0:n.length)!==null&&o!==void 0?o:0,r=e?0:u;i.setStart(d,r),i.setEnd(d,r)}else a(t)}else a(t);s.removeAllRanges(),s.addRange(i)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=R_;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(tk);var P_={},Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.getCaretNodeAndOffset=Q5;function Q5(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=Vu;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(P_);var nk={},Wu={};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.getRange=e6;function e6(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=Wu;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(nk);var ok={},F_={};Object.defineProperty(F_,"__esModule",{value:!0});F_.isCaretAtEndOfInput=o6;var rS=ts,t6=P_,n6=e_;function o6(t){var e=(0,rS.getDeepestNode)(t,!0);if(e===null)return!0;if((0,rS.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,t6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,n6.checkContenteditableSliceForEmptiness)(t,o,r,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=F_;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(ok);var rk={},B_={};Object.defineProperty(B_,"__esModule",{value:!0});B_.isCaretAtStartOfInput=s6;var hu=ts,r6=Vu,i6=$u;function s6(t){var e=(0,hu.getDeepestNode)(t);if(e===null||(0,hu.isEmpty)(t))return!0;if((0,hu.isNativeInput)(e))return e.selectionEnd===0;if((0,hu.isEmpty)(t))return!0;var n=(0,r6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,i6.checkContenteditableSliceForEmptiness)(t,o,r,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=B_;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(rk);var ik={},$_={};Object.defineProperty($_,"__esModule",{value:!0});$_.save=c6;var a6=ts,l6=Wu;function c6(){var t=(0,l6.getRange)(),e=(0,a6.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=$_;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(ik);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=e_;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=ek;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var o=tk;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return o.focus}});var r=P_;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return r.getCaretNodeAndOffset}});var i=nk;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return i.getRange}});var s=ok;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=rk;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=ik;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(PS);var Om=class extends Ie{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case ve.BACKSPACE:this.backspace(e);break;case ve.DELETE:this.delete(e);break;case ve.ENTER:this.enter(e);break;case ve.DOWN:case ve.RIGHT:this.arrowRightAndDown(e);break;case ve.UP:case ve.LEFT:this.arrowLeftAndUp(e);break;case ve.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&cS(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!0}dragLeave(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!1}handleCommandC(e){let{BlockSelection:n}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e)}handleCommandX(e){let{BlockSelection:n,BlockManager:o,Caret:r}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e).then(()=>{let i=o.removeSelectedBlocks(),s=o.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),n.clearSelection(e)})}tabPressed(e){let{InlineToolbar:n,Caret:o}=this.Editor;n.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){this.Editor.BlockManager.currentBlock.isEmpty&&(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){let{BlockManager:n,UI:o}=this.Editor,r=n.currentBlock;if(r===void 0||r.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!Zg)return;let i=r;r.currentInput!==void 0&&_u(r.currentInput)&&!r.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):r.currentInput&&bu(r.currentInput)?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,previousBlock:i}=n;if(!(r===void 0||!ge.isCollapsed||!r.currentInput||!_u(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.firstInput){o.navigatePrevious();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r);let s=n.currentBlock;o.setToBlock(s,o.positions.END);return}ZT(i,r)?this.mergeBlocks(i,r):o.setToBlock(i,o.positions.END)}}}delete(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,nextBlock:i}=n;if(!(!ge.isCollapsed||!bu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.lastInput){o.navigateNext();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r),o.setToBlock(i,o.positions.START);return}ZT(r,i)?this.mergeBlocks(r,i):o.setToBlock(i,o.positions.START)}}}mergeBlocks(e,n){let{BlockManager:o,Toolbar:r}=this.Editor;e.lastInput!==void 0&&(PS.focus(e.lastInput,!1),o.mergeBlocks(e,n).then(()=>{r.close()}))}arrowRightAndDown(e){let n=ha.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===ve.TAB);if(this.Editor.UI.someToolbarOpened&&n)return;this.Editor.Toolbar.close();let{currentBlock:o}=this.Editor.BlockManager,r=(o?.currentInput!==void 0?bu(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===ve.DOWN&&r){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===ve.DOWN||e.keyCode===ve.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}xu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(ha.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===ve.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();let{currentBlock:n}=this.Editor.BlockManager,o=(n?.currentInput!==void 0?_u(n.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===ve.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===ve.UP||e.keyCode===ve.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}xu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){let n=e.keyCode===ve.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===ve.ENTER&&this.Editor.BlockSettings.opened,r=e.keyCode===ve.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===ve.TAB;return!(e.shiftKey||i||n||o||r)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}},Ql=class{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return dS(this.workingArea.children)}static set(e,n,o){return isNaN(Number(n))?(Reflect.set(e,n,o),!0):(e.insert(+n,o),!0)}static get(e,n){return isNaN(Number(n))?Reflect.get(e,n):e.get(+n)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,n){let o=this.blocks[n];z.swap(this.blocks[e].holder,o.holder),this.blocks[n]=this.blocks[e],this.blocks[e]=o}move(e,n){let o=this.blocks.splice(n,1)[0],r=e-1,i=Math.max(0,r),s=this.blocks[i];e>0?this.insertToDOM(o,"afterend",s):this.insertToDOM(o,"beforebegin",s),this.blocks.splice(e,0,o);let a=this.composeBlockEvent("move",{fromIndex:n,toIndex:e});o.call(_r.MOVED,a)}insert(e,n,o=!1){if(!this.length){this.push(n);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(_r.REMOVED));let r=o?1:0;if(this.blocks.splice(e,r,n),e>0){let i=this.blocks[e-1];this.insertToDOM(n,"afterend",i)}else{let i=this.blocks[e+1];i?this.insertToDOM(n,"beforebegin",i):this.insertToDOM(n)}}replace(e,n){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(n.holder),this.blocks[e]=n}insertMany(e,n){let o=new DocumentFragment;for(let r of e)o.appendChild(r.holder);if(this.length>0){if(n>0){let r=Math.min(n-1,this.length-1);this.blocks[r].holder.after(o)}else n===0&&this.workingArea.prepend(o);this.blocks.splice(n,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(r=>r.call(_r.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(_r.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(_r.REMOVED)),this.blocks.length=0}insertAfter(e,n){let o=this.blocks.indexOf(e);this.insert(o+1,n)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,n,o){n?o.holder.insertAdjacentElement(n,e.holder):this.workingArea.appendChild(e.holder),e.call(_r.RENDERED)}composeBlockEvent(e,n){return new CustomEvent(e,{detail:n})}},iS="block-removed",sS="block-added",d6="block-moved",aS="block-changed",Im=class{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,o)=>{this.completed=this.completed.then(e).then(n).catch(o)})}},Mm=class extends Ie{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){let e=new Ql(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:Ql.set,get:Ql.get}),this.listeners.on(document,"copy",n=>this.Editor.BlockEvents.handleCommandC(n))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:n={},id:o=void 0,tunes:r={}}){let i=this.Editor.ReadOnly.isEnabled,s=this.Editor.Tools.blockTools.get(e),a=new ho({id:o,data:n,tool:s,api:this.Editor.API,readOnly:i,tunesData:r},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:n=this.config.defaultBlock,data:o={},index:r,needToFocus:i=!0,replace:s=!1,tunes:a={}}={}){let l=r;l===void 0&&(l=this.currentBlockIndex+(s?0:1));let c=this.composeBlock({id:e,tool:n,data:o,tunes:a});return s&&this.blockDidMutated(iS,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,s),this.blockDidMutated(sS,c,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,n=0){this._blocks.insertMany(e,n)}async update(e,n,o){if(!n&&!o)return e;let r=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},r,n??{}),tunes:o??e.tunes}),s=this.getBlockIndex(e);return this._blocks.replace(s,i),this.blockDidMutated(aS,i,{index:s}),i}replace(e,n,o){let r=this.getBlockIndex(e);return this.insert({tool:n,data:o,index:r,replace:!0})}paste(e,n,o=!1){let r=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{r.call(_r.ON_PASTE,n)})}catch(i){Ue(`${e}: onPaste callback call is failed`,"error",i)}return r}insertDefaultBlockAtIndex(e,n=!1){let o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(sS,o,{index:e}),n?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,n){let o;if(e.name===n.name&&e.mergeable){let r=await n.data;if(lo(r)){console.error("Could not merge Block. Failed to extract original Block data.");return}let[i]=qm([r],e.tool.sanitizeConfig);o=i}else if(e.mergeable&&Eu(n,"export")&&Eu(e,"import")){let r=await n.exportDataAsString(),i=zo(r,e.tool.sanitizeConfig);o=QT(i,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(n),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,n=!0){return new Promise(o=>{let r=this._blocks.indexOf(e);if(!this.validateIndex(r))throw new Error("Can't find a Block to remove");e.destroy(),this._blocks.remove(r),this.blockDidMutated(iS,e,{index:r}),this.currentBlockIndex>=r&&this.currentBlockIndex--,this.blocks.length?r===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),n&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let n=this.blocks.length-1;n>=0;n--)this.blocks[n].selected&&(this.removeBlock(this.blocks[n]),e=n);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){let e=this.Editor.Caret.extractFragmentFromCaretPosition(),n=z.make("div");n.appendChild(e);let o={text:z.isEmpty(n)?"":n.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(n=>n.id===e)}getBlock(e){z.isElement(e)||(e=e.parentNode);let n=this._blocks.nodes,o=e.closest(`.${ho.CSS.wrapper}`),r=n.indexOf(o);if(r>=0)return this._blocks[r]}setCurrentBlockByChildNode(e){z.isElement(e)||(e=e.parentNode);let n=e.closest(`.${ho.CSS.wrapper}`);if(!n)return;let o=n.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(n),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;z.isElement(e)||(e=e.parentNode);let n=e.closest(`.${ho.CSS.wrapper}`);return this.blocks.find(o=>o.holder===n)}swap(e,n){this._blocks.swap(e,n),this.currentBlockIndex=n}move(e,n=this.currentBlockIndex){if(isNaN(e)||isNaN(n)){Ue("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(n)){Ue("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,n),this.currentBlockIndex=e,this.blockDidMutated(d6,this.currentBlock,{fromIndex:n,toIndex:e})}async convert(e,n,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");let r=this.Editor.Tools.blockTools.get(n);if(!r)throw new Error(`Could not convert Block. Tool \xAB${n}\xBB not found.`);let i=await e.exportDataAsString(),s=zo(i,r.sanitizeConfig),a=QT(s,r.conversionConfig,r.settings);return o&&(a=Object.assign(a,o)),this.replace(e,r.name,a)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){let n=new Im;this.blocks.forEach(o=>{n.add(async()=>{await this.removeBlock(o,!1)})}),await n.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){let{BlockEvents:n}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{n.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{n.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{n.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{n.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(aS,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,n,o){let r=new CustomEvent(e,{detail:{target:new mr(n),...o}});return this.eventsDispatcher.emit(gS,{event:r}),n}},Am=class extends Ie{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){let{BlockManager:e}=this.Editor;return e.blocks.every(n=>n.selected===!0)}set allBlocksSelected(e){let{BlockManager:n}=this.Editor;n.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){let{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(n=>n.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new ge,ga.add({name:"CMD+A",handler:e=>{let{BlockManager:n,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}n.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){ge.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){let{BlockManager:n}=this.Editor,o;isNaN(e)?o=n.currentBlock:o=n.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,n=!1){let{BlockManager:o,Caret:r,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;let s=e&&e instanceof KeyboardEvent,a=s&&cS(e.keyCode);if(this.anyBlockSelected&&s&&a&&!ge.isSelectionExists){let l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),r.setToBlock(o.currentBlock),xu(()=>{let c=e.key;r.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}n&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();let n=z.make("div");this.selectedBlocks.forEach(i=>{let s=zo(i.holder.innerHTML,this.sanitizerConfig),a=z.make("p");a.innerHTML=s,n.appendChild(a)});let o=Array.from(n.childNodes).map(i=>i.textContent).join(`
101
+
102
+ `),r=n.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",r),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){let{BlockManager:n}=this.Editor,o=n.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),ge.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){ga.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),z.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}let n=this.Editor.BlockManager.getBlock(e.target),o=n.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(n),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),ge.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}},Lm=class t extends Ie{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,n=this.positions.DEFAULT,o=0){var r;let{BlockManager:i,BlockSelection:s}=this.Editor;if(s.clearSelection(),!e.focusable){(r=window.getSelection())==null||r.removeAllRanges(),s.selectBlock(e),i.currentBlock=e;return}let a;switch(n){case this.positions.START:a=e.firstInput;break;case this.positions.END:a=e.lastInput;break;default:a=e.currentInput}if(!a)return;let l=z.getDeepestNode(a,n===this.positions.END),c=z.getContentLength(l);switch(!0){case n===this.positions.START:o=0;break;case n===this.positions.END:case o>c:o=c;break}this.set(l,o),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=a}setToInput(e,n=this.positions.DEFAULT,o=0){let{currentBlock:r}=this.Editor.BlockManager,i=z.getDeepestNode(e);switch(n){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,z.getContentLength(i));break;default:o&&this.set(i,o)}r.currentInput=e}set(e,n=0){let{top:o,bottom:r}=ge.setCursor(e,n),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):r>i&&window.scrollBy(0,r-i+30)}setToTheLastBlock(){let e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{let n=this.Editor.BlockManager.insertAtEnd();this.setToBlock(n)}}extractFragmentFromCaretPosition(){let e=ge.get();if(e.rangeCount){let n=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(n.deleteContents(),o)if(z.isNativeInput(o)){let r=o,i=document.createDocumentFragment(),s=r.value.substring(0,r.selectionStart),a=r.value.substring(r.selectionStart);return i.textContent=a,r.value=s,i}else{let r=n.cloneRange();return r.selectNodeContents(o),r.setStart(n.endContainer,n.endOffset),r.extractContents()}}}navigateNext(e=!1){let{BlockManager:n}=this.Editor,{currentBlock:o,nextBlock:r}=n;if(o===void 0)return!1;let{nextInput:i,currentInput:s}=o,a=s!==void 0?bu(s):void 0,l=r,c=e||a||!o.focusable;if(i&&c)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!c)return!1;l=n.insertAtEnd()}return c?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){let{currentBlock:n,previousBlock:o}=this.Editor.BlockManager;if(!n)return!1;let{previousInput:r,currentInput:i}=n,s=i!==void 0?_u(i):void 0,a=e||s||!n.focusable;return r&&a?(this.setToInput(r,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){let n=document.createElement("span");n.classList.add(t.CSS.shadowCaret),e.insertAdjacentElement("beforeend",n)}restoreCaret(e){let n=e.querySelector(`.${t.CSS.shadowCaret}`);if(!n)return;new ge().expandToTag(n);let o=document.createRange();o.selectNode(n),o.extractContents()}insertContentAtCaretPosition(e){let n=document.createDocumentFragment(),o=document.createElement("div"),r=ge.get(),i=ge.range;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>n.appendChild(c)),n.childNodes.length===0&&n.appendChild(new Text);let s=n.lastChild;i.deleteContents(),i.insertNode(n);let a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),r.removeAllRanges(),r.addRange(a)}},Rm=class extends Ie{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{let{BlockManager:n,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;let r=n.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=n.getBlockByChildNode(e.target);if(!(!r||!i)&&i!==r){if(r===this.firstSelectedBlock){ge.get().removeAllRanges(),r.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){r.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(r,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==NH.LEFT)return;let{BlockManager:n}=this.Editor;this.firstSelectedBlock=n.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){let{BlockManager:n,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),ge.get().removeAllRanges());let r=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=n.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor,i=n.blocks.indexOf(this.firstSelectedBlock),s=n.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&s>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case ve.DOWN:case ve.RIGHT:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END);break;case ve.UP:case ve.LEFT:r.setToBlock(n.blocks[Math.min(i,s)],r.positions.START);break;default:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){let{UI:n}=this.Editor;ge.isCollapsed||this.Editor.BlockSelection.clearSelection(e),n.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,n){let{BlockManager:o,BlockSelection:r}=this.Editor,i=o.blocks.indexOf(e),s=o.blocks.indexOf(n),a=e.selected!==n.selected;for(let l=Math.min(i,s);l<=Math.max(i,s);l++){let c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:n)&&(o.blocks[l].selected=!o.blocks[l].selected,r.clearCache())}}},Pm=class extends Ie{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){let{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async n=>{await this.processDrop(n)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",n=>{this.processDragOver(n)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){let{BlockManager:n,Paste:o,Caret:r}=this.Editor;e.preventDefault(),n.blocks.forEach(s=>{s.dropTarget=!1}),ge.isAtEditor&&!ge.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;let i=n.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,r.positions.END);else{let s=n.setCurrentBlockByChildNode(n.lastBlock.holder);this.Editor.Caret.setToBlock(s,r.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){ge.isAtEditor&&!ge.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}},u6=180,p6=400,Fm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=p6,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(gS,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(mS,()=>{this.disable()}),this.eventsDispatcher.on(_S,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!at(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let n;this.batchingOnChangeQueue.size===1?n=this.batchingOnChangeQueue.values().next().value:n=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,n),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(Qg,{mutations:e})}},sk=class ak extends Ie{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{let n=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!at(n.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(n){Ue(`Paste handling for \xAB${e.name}\xBB Tool hasn't been set up because of the error`,"warn",n)}},this.handlePasteEvent=async e=>{let{BlockManager:n,Toolbar:o}=this.Editor,r=n.setCurrentBlockByChildNode(e.target);!r||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||r&&this.exceptionList.includes(r.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,n=!1){let{Tools:o}=this.Editor,r=e.types;if((r.includes?r.includes("Files"):r.contains("Files"))&&!lo(this.toolsFiles)){await this.processFiles(e.files);return}let i=e.getData(this.MIME_TYPE),s=e.getData("text/plain"),a=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}n&&s.trim()&&a.trim()&&(a="<p>"+(a.trim()?a:s)+"</p>");let l=Object.keys(this.toolsTags).reduce((u,p)=>(u[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},u),{}),c=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),d=zo(a,c);!d.trim()||d.trim()===s||!z.isHTMLString(d)?await this.processText(s):await this.processText(d,!0)}async processText(e,n=!1){let{Caret:o,BlockManager:r}=this.Editor,i=n?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}let s=r.currentBlock&&r.currentBlock.tool.isDefault&&r.currentBlock.isEmpty;i.map(async(a,l)=>this.insertBlock(a,l===0&&s)),r.currentBlock&&o.setToBlock(r.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){let e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return yr(e)?[e]:nn(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;let n=e.pasteConfig.tags||[],o=[];n.forEach(r=>{let i=this.collectTagNames(r);o.push(...i),i.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){Ue(`Paste handler for \xAB${e.name}\xBB Tool on \xAB${s}\xBB tag is skipped because it is already used by \xAB${this.toolsTags[s].tool.name}\xBB Tool.`,"warn");return}let a=nn(r)?r[s]:null;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(r=>r.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;let{files:n={}}=e.pasteConfig,{extensions:o,mimeTypes:r}=n;!o&&!r||(o&&!Array.isArray(o)&&(Ue(`\xABextensions\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),o=[]),r&&!Array.isArray(r)&&(Ue(`\xABmimeTypes\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),r=[]),r&&(r=r.filter(i=>AH(i)?!0:(Ue(`MIME type value \xAB${i}\xBB for the \xAB${e.name}\xBB Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:r||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||lo(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([n,o])=>{o instanceof RegExp||Ue(`Pattern ${o} for \xAB${e.name}\xBB Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:n,pattern:o,tool:e})})}isNativeBehaviour(e){return z.isNativeInput(e)}async processFiles(e){let{BlockManager:n}=this.Editor,o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);let r=n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty;o.forEach((i,s)=>{n.paste(i.type,i.event,s===0&&r)})}async processFile(e){let n=MH(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:s,extensions:a}])=>{let[l,c]=e.type.split("/"),d=a.find(p=>p.toLowerCase()===n.toLowerCase()),u=s.find(p=>{let[f,h]=p.split("/");return f===l&&(h===c||h==="*")});return!!d||!!u});if(!o)return;let[r]=o;return{event:this.composePasteEvent("file",{file:e}),type:r}}processHTML(e){let{Tools:n}=this.Editor,o=z.make("DIV");return o.innerHTML=e,this.getNodes(o).map(r=>{let i,s=n.defaultTool,a=!1;switch(r.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=z.make("div"),i.appendChild(r);break;case Node.ELEMENT_NODE:i=r,a=!0,this.toolsTags[i.tagName]&&(s=this.toolsTags[i.tagName].tool);break}let{tags:l}=s.pasteConfig||{tags:[]},c=l.reduce((p,f)=>(this.collectTagNames(f).forEach(h=>{let m=nn(f)?f[h]:null;p[h.toLowerCase()]=m||{}}),p),{}),d=Object.assign({},c,s.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){let p=zo(i.outerHTML,d);i=z.make("div",void 0,{innerHTML:p}).firstChild}else i.innerHTML=zo(i.innerHTML,d);let u=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:a,tool:s.name,event:u}}).filter(r=>{let i=z.isEmpty(r.content),s=z.isSingleTag(r.content);return!i||s})}processPlain(e){let{defaultBlock:n}=this.config;if(!e)return[];let o=n;return e.split(/\r?\n/).filter(r=>r.trim()).map(r=>{let i=z.make("div");i.textContent=r;let s=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:s}})}async processSingleBlock(e){let{Caret:n,BlockManager:o}=this.Editor,{currentBlock:r}=o;if(!r||e.tool!==r.name||!z.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,r?.tool.isDefault&&r.isEmpty);return}n.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){let{BlockManager:n,Caret:o}=this.Editor,{content:r}=e;if(n.currentBlock&&n.currentBlock.tool.isDefault&&r.textContent.length<ak.PATTERN_PROCESSING_MAX_LENGTH){let i=await this.processPattern(r.textContent);if(i){let s=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty,a=n.paste(i.tool,i.event,s);o.setToBlock(a,o.positions.END);return}}if(n.currentBlock&&n.currentBlock.currentInput){let i=n.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,zo(r.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){let n=this.toolsPatterns.find(o=>{let r=o.pattern.exec(e);return r?e===r.shift():!1});return n?{event:this.composePasteEvent("pattern",{key:n.key,data:e}),tool:n.tool.name}:void 0}insertBlock(e,n=!1){let{BlockManager:o,Caret:r}=this.Editor,{currentBlock:i}=o,s;if(n&&i&&i.isEmpty){s=o.paste(e.tool,e.event,!0),r.setToBlock(s,r.positions.END);return}s=o.paste(e.tool,e.event),r.setToBlock(s,r.positions.END)}insertEditorJSData(e){let{BlockManager:n,Caret:o,Tools:r}=this.Editor;qm(e,i=>r.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:s},a)=>{let l=!1;a===0&&(l=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);let c=n.insert({tool:i,data:s,replace:l});o.setToBlock(c,o.positions.END)})}processElementNode(e,n,o){let r=Object.keys(this.toolsTags),i=e,{tool:s}=this.toolsTags[i.tagName]||{},a=this.tagsByTool[s?.name]||[],l=r.includes(i.tagName),c=z.blockElements.includes(i.tagName.toLowerCase()),d=Array.from(i.children).some(({tagName:p})=>r.includes(p)&&!a.includes(p)),u=Array.from(i.children).some(({tagName:p})=>z.blockElements.includes(p.toLowerCase()));if(!c&&!l&&!d)return o.appendChild(i),[...n,o];if(l&&!d||c&&!u&&!d)return[...n,o,i]}getNodes(e){let n=Array.from(e.childNodes),o,r=(i,s)=>{if(z.isEmpty(s)&&!z.isSingleTag(s))return i;let a=i[i.length-1],l=new DocumentFragment;switch(a&&z.isFragment(a)&&(l=i.pop()),s.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(s,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(s),[...i,l];default:return[...i,l]}return[...i,...Array.from(s.childNodes).reduce(r,[])]};return n.reduce(r,[])}composePasteEvent(e,n){return new CustomEvent(e,{detail:n})}};sk.PATTERN_PROCESSING_MAX_LENGTH=450;var f6=sk,Bm=class extends Ie{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){let{Tools:e}=this.Editor,{blockTools:n}=e,o=[];Array.from(n.entries()).forEach(([r,i])=>{i.isReadOnlySupported||o.push(r)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,n=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();let o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(let i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(n)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();let r=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(r.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new Cu(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}},$m=class t extends Ie{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,n){let o=document.elementFromPoint(e-window.pageXOffset,n-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);let r=[`.${ho.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),s=r.some(a=>!!o.closest(a));!i||s||(this.mousedown=!0,this.startX=e,this.startY=n)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){let{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1),this.listeners.on(document.body,"mousemove",qg(n=>{this.processMouseMove(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",qg(n=>{this.processScroll(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(z.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){let{UI:e}=this.Editor,n=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=z.make("div",t.CSS.overlay,{}),r=z.make("div",t.CSS.overlayContainer,{}),i=z.make("div",t.CSS.rect,{});return r.appendChild(i),o.appendChild(r),n.appendChild(o),this.overlayRectangle=i,{container:n,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;let n=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-n,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);let{rightPos:n,leftPos:o,index:r}=this.genInfoForMouseSelection(),i=this.startX>n&&this.mouseX>n,s=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||s),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),r!==void 0&&(this.trySelectNextBlock(r),this.inverseSelection(),ge.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){let e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(n);if(!this.rectCrossesBlocks&&e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(n)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){let e=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,n),r=this.Editor.BlockManager.getBlockByChildNode(o),i;r!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(d=>d.holder===r.holder));let s=this.Editor.BlockManager.lastBlock.holder.querySelector("."+ho.CSS.content),a=Number.parseInt(window.getComputedStyle(s).width,10)/2,l=e-a,c=e+a;return{index:i,leftPos:l,rightPos:c}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){let n=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,r=1,i=-1,s=0;if(n)return;let a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0,l=s;o>1&&(l=a?r:i);let c=e>this.stackOfSelected[o-1]&&l===r,d=e<this.stackOfSelected[o-1]&&l===i,u=!(c||d||l===s);if(!u&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let h=this.stackOfSelected[o-1]+1||e;for(h;h<=e;h++)this.addBlockInSelection(h);return}if(!u&&e<this.stackOfSelected[o-1]){for(let h=this.stackOfSelected[o-1]-1;h>=e;h--)this.addBlockInSelection(h);return}if(!u)return;let p=o-1,f;for(e>this.stackOfSelected[o-1]?f=()=>e>this.stackOfSelected[p]:f=()=>e<this.stackOfSelected[p];f();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[p]),this.stackOfSelected.pop(),p--}},zm=class extends Ie{async render(e){return new Promise(n=>{let{Tools:o,BlockManager:r}=this.Editor;if(e.length===0)r.insert();else{let i=e.map(({type:s,data:a,tunes:l,id:c})=>{o.available.has(s)===!1&&(ao(`Tool \xAB${s}\xBB is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(s,a,c),s=o.stubTool);let d;try{d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}catch(u){Ue(`Block \xAB${s}\xBB skipped because of plugins error`,"error",{data:a,error:u}),a=this.composeStubDataForTool(s,a,c),s=o.stubTool,d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}return d});r.insertMany(i)}window.requestIdleCallback(()=>{n()},{timeout:2e3})})}composeStubDataForTool(e,n,o){let{Tools:r}=this.Editor,i=e;if(r.unavailable.has(e)){let s=r.unavailable.get(e).toolbox;s!==void 0&&s[0].title!==void 0&&(i=s[0].title)}return{savedData:{id:o,type:e,data:n},title:i}}},Hm=class extends Ie{async save(){let{BlockManager:e,Tools:n}=this.Editor,o=e.blocks,r=[];try{o.forEach(a=>{r.push(this.getSavedData(a))});let i=await Promise.all(r),s=await qm(i,a=>n.blockTools.get(a).sanitizeConfig);return this.makeOutput(s)}catch(i){ao("Saving failed due to the Error %o","error",i)}}async getSavedData(e){let n=await e.save(),o=n&&await e.validate(n.data);return{...n,isValid:o}}makeOutput(e){let n=[];return e.forEach(({id:o,tool:r,data:i,tunes:s,isValid:a})=>{if(!a){Ue(`Block \xAB${r}\xBB skipped because saved data is invalid`);return}if(r===this.Editor.Tools.stubTool){n.push(i);return}let l={id:o,type:r,data:i,...!lo(s)&&{tunes:s}};n.push(l)}),{time:+new Date,blocks:n,version:"2.31.0-rc.7"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var h6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function g6(t){let e=document.createElement("div");e.innerHTML=t.trim();let n=document.createDocumentFragment();return n.append(...Array.from(e.childNodes)),n}var Km=class t{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=n.placeholder?n.placeholder:t.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=n.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;let{textContent:n}=this._element;n===""&&(this._element.innerHTML="")}drawView(){let e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;let n=g6(e.text);this._element.appendChild(n),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){let n={text:e.detail.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:h6,title:"Text"}}},rc=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:l4,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};rc.isInline=!0;rc.title="Bold";var ic=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=g4,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){let e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};ic.isInline=!0;ic.title="Italic";var sc=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new ge}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=eS,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());let n=this.selection.findParentTag("A");if(n){this.selection.expandToTag(n),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close();return}}this.toggleActions()}checkState(){let e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=y4,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();let n=e.getAttribute("href");this.nodes.input.value=n!=="null"?n:"",this.selection.save()}else this.nodes.button.innerHTML=eS,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){let n=new ge;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let n=this.nodes.input.value||"";if(!n.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(n)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Ue("Incorrect Link pasted","warn",n);return}n=this.prepareLink(n),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(n),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;let n=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",r=/^\/\/[^/\s]/.test(e);return!n&&!o&&!r&&(e="http://"+e),e}insertLink(e){let n=this.selection.findParentTag("A");n&&this.selection.expandToTag(n),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};sc.isInline=!0;sc.title="Link";var Iu=class{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){let e=ge.get(),n=this.blocksAPI.getBlockByElement(e.anchorNode);if(n===void 0)return[];let o=this.toolsAPI.getBlockTools(),r=await yS(n,o);if(r.length===0)return[];let i=r.reduce((c,d)=>{var u;return(u=d.toolbox)==null||u.forEach(p=>{c.push({icon:p.icon,title:mn.t(Gn.toolNames,p.title),name:d.name,closeOnActivate:!0,onActivate:async()=>{let f=await this.blocksAPI.convert(n.id,d.name,p.data);this.caretAPI.setToBlock(f,"end")}})}),c},[]),s=await n.getActiveToolboxEntry(),a=s!==void 0?s.icon:TS,l=!_a();return{icon:a,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};Iu.isInline=!0;var Mu=class{constructor({data:e,api:n}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=n,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){let e=z.make("div",this.CSS.wrapper),n=x4,o=z.make("div",this.CSS.info),r=z.make("div",this.CSS.title,{textContent:this.title}),i=z.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=n,o.appendChild(r),o.appendChild(i),e.appendChild(o),e}};Mu.isReadOnlySupported=!0;var Um=class extends oc{constructor(){super(...arguments),this.type=Xi.Inline}get title(){return this.constructable[Ou.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Ou.IsReadOnlySupported]??!1}},jm=class extends oc{constructor(){super(...arguments),this.type=Xi.Tune}create(e,n){return new this.constructable({api:this.api,config:this.settings,block:n,data:e})}},so=class t extends Map{get blockTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isBlock());return new t(e)}get inlineTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInline());return new t(e)}get blockTunes(){let e=Array.from(this.entries()).filter(([,n])=>n.isTune());return new t(e)}get internalTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInternal);return new t(e)}get externalTools(){let e=Array.from(this.entries()).filter(([,n])=>!n.isInternal);return new t(e)}},m6=Object.defineProperty,_6=Object.getOwnPropertyDescriptor,lk=(t,e,n,o)=>{for(var r=o>1?void 0:o?_6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&m6(e,n,r),r},ac=class extends oc{constructor(){super(...arguments),this.type=Xi.Block,this.inlineTools=new so,this.tunes=new so}create(e,n,o){return new this.constructable({data:e,block:n,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[pa.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[pa.IsEnabledLineBreaks]}get toolbox(){let e=this.constructable[pa.Toolbox],n=this.config[mu.Toolbox];if(!lo(e)&&n!==!1)return n?Array.isArray(e)?Array.isArray(n)?n.map((o,r)=>{let i=e[r];return i?{...i,...o}:o}):[n]:Array.isArray(n)?n:[{...e,...n}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[pa.ConversionConfig]}get enabledInlineTools(){return this.config[mu.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[mu.EnabledBlockTunes]}get pasteConfig(){return this.constructable[pa.PasteConfig]??{}}get sanitizeConfig(){let e=super.sanitizeConfig,n=this.baseSanitizeConfig;if(lo(e))return n;let o={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r];nn(i)?o[r]=Object.assign({},n,i):o[r]=i}return o}get baseSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),Array.from(this.tunes.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),e}};lk([ma],ac.prototype,"sanitizeConfig",1);lk([ma],ac.prototype,"baseSanitizeConfig",1);var Vm=class{constructor(e,n,o){this.api=o,this.config=e,this.editorConfig=n}get(e){let{class:n,isInternal:o=!1,...r}=this.config[e],i=this.getConstructor(n),s=n[km.IsTune];return new i({name:e,constructable:n,config:r,api:this.api.getMethodsForTool(e,s),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[Ou.IsInline]:return Um;case e[km.IsTune]:return jm;default:return ac}}},Au=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:c4,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e+1);if(!n)throw new Error("Unable to move Block down since it is already the last");let o=n.holder,r=o.getBoundingClientRect(),i=Math.abs(window.innerHeight-o.offsetHeight);r.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}};Au.isTune=!0;var Lu=class{constructor({api:e}){this.api=e}render(){return{icon:f4,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};Lu.isTune=!0;var Ru=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:p4,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!n||!o)throw new Error("Unable to move Block up since it is already the first");let r=n.holder,i=o.holder,s=r.getBoundingClientRect(),a=i.getBoundingClientRect(),l;a.top>0?l=Math.abs(s.top)-Math.abs(a.top):l=Math.abs(s.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}};Ru.isTune=!0;var b6=Object.defineProperty,y6=Object.getOwnPropertyDescriptor,x6=(t,e,n,o)=>{for(var r=o>1?void 0:o?y6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&b6(e,n,r),r},Pu=class extends Ie{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new so,this.toolsUnavailable=new so}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Xg({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");let e=this.prepareConfig();this.factory=new Vm(e,this.config,this.Editor.API);let n=this.getListOfPrepareFunctions(e);if(n.length===0)return Promise.resolve();await IH(n,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>{Object.assign(e,n.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{at(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:Iu,isInternal:!0},link:{class:sc,isInternal:!0},bold:{class:rc,isInternal:!0},italic:{class:ic,isInternal:!0},paragraph:{class:Km,inlineToolbar:!0,isInternal:!0},stub:{class:Mu,isInternal:!0},moveUp:{class:Ru,isInternal:!0},delete:{class:Lu,isInternal:!0},moveDown:{class:Au,isInternal:!0}}}toolPrepareMethodSuccess(e){let n=this.factory.get(e.toolName);if(n.isInline()){let o=["render"].filter(r=>!n.create()[r]);if(o.length){Ue(`Incorrect Inline Tool: ${n.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(n.name,n);return}}this.toolsAvailable.set(n.name,n)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){let n=[];return Object.entries(e).forEach(([o,r])=>{n.push({function:at(r.class.prepare)?r.class.prepare:()=>{},data:{toolName:o,config:r.config}})}),n}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new so(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(n=>[n,this.inlineTools.get(n)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new so(["convertTo",...e.enabledInlineTools].map(n=>[n,this.inlineTools.get(n)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){let n=new so(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new so([...n,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){let n=new so(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new so([...n,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(let e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;let n=this.config.tools[e];if(!at(n)&&!at(n.class))throw Error(`Tool \xAB${e}\xBB must be a constructor function or an object with function in the \xABclass\xBB property`)}}prepareConfig(){let e={};for(let n in this.config.tools)nn(this.config.tools[n])?e[n]=this.config.tools[n]:e[n]={class:this.config.tools[n]};return e}};x6([ma],Pu.prototype,"getAllInlineToolsSanitizeConfig",1);var v6=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
103
+ `,Wm=class extends Ie{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=JT(()=>{this.windowResize()},200),this.selectionChangeDebounced=JT(()=>{this.selectionChanged()},u6),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;let e=this.nodes.wrapper.querySelector(`.${ho.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){let{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;return!!(n.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof ha).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;n.close(),o.close(),e.toolbox.close()}setIsMobile(){let e=window.innerWidth<uS;e!==this.isMobile&&this.eventsDispatcher.emit(tc,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=z.getHolder(this.config.holder),this.nodes.wrapper=z.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=z.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){let e="editor-js-styles";if(z.get(e))return;let n=z.make("style",null,{id:e,textContent:v6.toString()});this.config.style&&!lo(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),z.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",qg(n=>{let o=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(MS,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case ve.ENTER:this.enterPressed(e);break;case ve.BACKSPACE:case ve.DELETE:this.backspacePressed(e);break;case ve.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){let{currentBlock:n}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||n&&r||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor;if(o.anyBlockSelected&&!ge.isSelectionExists){let i=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){let{BlockManager:n,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;let r=n.currentBlockIndex>=0;if(o.anyBlockSelected&&!ge.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&r&&e.target.tagName==="BODY"){let i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,o;if(!e.isTrusted)return;let r=e.target;this.nodes.holder.contains(r)||ge.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());let i=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(r),s=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(r),a=i||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();let l=this.Editor.BlockManager.getBlockByChildNode(r);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){let o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(o,r)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!ge.isCollapsed)return;let n=e.target,o=e.metaKey||e.ctrlKey;if(z.isAnchor(n)&&o){e.stopImmediatePropagation(),e.stopPropagation();let r=n.getAttribute("href"),i=RH(r);FH(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){let n=this.Editor.BlockManager.getBlockByIndex(-1),o=z.offset(n.holder).bottom,r=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<r){e.stopImmediatePropagation(),e.stopPropagation();let{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){let{CrossBlockSelection:e,BlockSelection:n}=this.Editor,o=ge.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&ge.get().removeAllRanges(),!o){ge.range||this.Editor.InlineToolbar.close();return}let r=o.closest(`.${ho.CSS.content}`);(r===null||r.closest(`.${ge.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){let o=n.target;pS(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}},C6={BlocksAPI:tm,CaretAPI:nm,EventsAPI:om,I18nAPI:rm,API:im,InlineToolbarAPI:sm,ListenersAPI:am,NotifierAPI:cm,ReadOnlyAPI:dm,SanitizerAPI:um,SaverAPI:pm,SelectionAPI:fm,ToolsAPI:hm,StylesAPI:gm,ToolbarAPI:mm,TooltipAPI:_m,UiAPI:bm,BlockSettings:wm,Toolbar:Sm,InlineToolbar:Nm,BlockEvents:Om,BlockManager:Mm,BlockSelection:Am,Caret:Lm,CrossBlockSelection:Rm,DragNDrop:Pm,ModificationsObserver:Fm,Paste:f6,ReadOnly:Bm,RectangleSelection:$m,Renderer:zm,Saver:Hm,Tools:Pu,UI:Wm},Gm=class{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Zi;let n,o;this.isReady=new Promise((r,i)=>{n=r,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();let{BlockManager:r,Caret:i,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(r.blocks[0],i.positions.START),n()}).catch(r=>{Ue(`Editor.js is not ready because of ${r}`,"error"),o(r)})}set configuration(e){var n,o;nn(e)?this.config={...e}:this.config={holder:e},Jg(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=lS.VERBOSE),DH(this.config.logLevel),Jg(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;let r={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(lo(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[r]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&mn.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){let{holderId:e,holder:n}=this.config;if(e&&n)throw Error("\xABholderId\xBB and \xABholder\xBB param can't assign at the same time.");if(yr(n)&&!z.get(n))throw Error(`element with ID \xAB${n}\xBB is missing. Pass correct holder's ID.`);if(n&&nn(n)&&!z.isElement(n))throw Error("\xABholder\xBB value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(o){if(o instanceof Cu)throw new Error(o.message);Ue(`Module ${n} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(C6).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){Ue("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(let e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){let n={};for(let o in this.moduleInstances)o!==e&&(n[o]=this.moduleInstances[o]);return n}};var Fu=class{static get version(){return"2.31.0-rc.7"}constructor(e){let n=()=>{};nn(e)&&at(e.onReady)&&(n=e.onReady);let o=new Gm(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),n()})}exportAPI(e){let n=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(r=>{at(r.destroy)&&r.destroy(),r.listeners.removeAll()}),s4(),e=null;for(let r in this)Object.prototype.hasOwnProperty.call(this,r)&&delete this[r];Object.setPrototypeOf(this,null)};n.forEach(r=>{this[r]=e[r]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([r,i])=>{Object.entries(i).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[r][s]})})}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var E6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',w6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',T6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',S6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',k6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',N6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',D6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';var Gu=class{constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){let n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){let n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){let e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){let e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(\u0E07'\u0300-'\u0301)\u0E07 Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){let e=[{number:1,tag:"H1",svg:E6},{number:2,tag:"H2",svg:w6},{number:3,tag:"H3",svg:T6},{number:4,tag:"H4",svg:S6},{number:5,tag:"H5",svg:k6},{number:6,tag:"H6",svg:N6}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){let n=e.detail;if("data"in n){let o=n.data,r=this.defaultLevel.number;switch(o.tagName){case"H1":r=1;break;case"H2":r=2;break;case"H3":r=3;break;case"H4":r=4;break;case"H5":r=5;break;case"H6":r=6;break}this._settings.levels&&(r=this._settings.levels.reduce((i,s)=>Math.abs(s-r)<Math.abs(i-r)?s:i)),this.data={level:r,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:D6,title:"Heading"}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:block}.image-tool__image-preloader{width:50px;height:50px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;animation:image-preloader-spin 2s infinite linear;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important;content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:flex;align-items:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading .image-tool__image{min-height:200px;display:flex;border:1px solid var(--border-color);background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@keyframes image-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var O6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',I6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',ck='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>',M6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',A6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function ba(t,e=null,n={}){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e!==null&&o.classList.add(e);for(let r in n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o}var Yu=(t=>(t.Empty="empty",t.Uploading="uploading",t.Filled="filled",t))(Yu||{}),H_=class{constructor({api:e,config:n,onSelectFile:o,readOnly:r}){this.api=e,this.config=n,this.onSelectFile=o,this.readOnly=r,this.nodes={wrapper:ba("div",[this.CSS.baseClass,this.CSS.wrapper]),imageContainer:ba("div",[this.CSS.imageContainer]),fileButton:this.createFileButton(),imageEl:void 0,imagePreloader:ba("div",this.CSS.imagePreloader),caption:ba("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly})},this.nodes.caption.dataset.placeholder=this.config.captionPlaceholder,this.nodes.imageContainer.appendChild(this.nodes.imagePreloader),this.nodes.wrapper.appendChild(this.nodes.imageContainer),this.nodes.wrapper.appendChild(this.nodes.caption),this.nodes.wrapper.appendChild(this.nodes.fileButton)}applyTune(e,n){this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${e}`,n)}render(){return this.toggleStatus("empty"),this.nodes.wrapper}showPreloader(e){this.nodes.imagePreloader.style.backgroundImage=`url(${e})`,this.toggleStatus("uploading")}hidePreloader(){this.nodes.imagePreloader.style.backgroundImage="",this.toggleStatus("empty")}fillImage(e){let n=/\.mp4$/.test(e)?"VIDEO":"IMG",o={src:e},r="load";n==="VIDEO"&&(o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsinline=!0,r="loadeddata"),this.nodes.imageEl=ba(n,this.CSS.imageEl,o),this.nodes.imageEl.addEventListener(r,()=>{this.toggleStatus("filled"),this.nodes.imagePreloader!==void 0&&(this.nodes.imagePreloader.style.backgroundImage="")}),this.nodes.imageContainer.appendChild(this.nodes.imageEl)}fillCaption(e){this.nodes.caption!==void 0&&(this.nodes.caption.innerHTML=e)}toggleStatus(e){for(let n in Yu)if(Object.prototype.hasOwnProperty.call(Yu,n)){let o=Yu[n];this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${o}`,o===e)}}get CSS(){return{baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,button:this.api.styles.button,wrapper:"image-tool",imageContainer:"image-tool__image",imagePreloader:"image-tool__image-preloader",imageEl:"image-tool__image-picture",caption:"image-tool__caption"}}createFileButton(){let e=ba("div",[this.CSS.button]);return e.innerHTML=this.config.buttonContent??`${ck} ${this.api.i18n.t("Select an Image")}`,e.addEventListener("click",()=>{this.onSelectFile()}),e}};function L6(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var dk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=3)})([function(n,o){var r;r=(function(){return this})();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},function(n,o,r){(function(i){var s=r(2),a=setTimeout;function l(){}function c(_){if(!(this instanceof c))throw new TypeError("Promises must be constructed via new");if(typeof _!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],m(_,this)}function d(_,b){for(;_._state===3;)_=_._value;_._state!==0?(_._handled=!0,c._immediateFn(function(){var y=_._state===1?b.onFulfilled:b.onRejected;if(y!==null){var x;try{x=y(_._value)}catch(v){return void p(b.promise,v)}u(b.promise,x)}else(_._state===1?u:p)(b.promise,_._value)})):_._deferreds.push(b)}function u(_,b){try{if(b===_)throw new TypeError("A promise cannot be resolved with itself.");if(b&&(typeof b=="object"||typeof b=="function")){var y=b.then;if(b instanceof c)return _._state=3,_._value=b,void f(_);if(typeof y=="function")return void m((x=y,v=b,function(){x.apply(v,arguments)}),_)}_._state=1,_._value=b,f(_)}catch(E){p(_,E)}var x,v}function p(_,b){_._state=2,_._value=b,f(_)}function f(_){_._state===2&&_._deferreds.length===0&&c._immediateFn(function(){_._handled||c._unhandledRejectionFn(_._value)});for(var b=0,y=_._deferreds.length;b<y;b++)d(_,_._deferreds[b]);_._deferreds=null}function h(_,b,y){this.onFulfilled=typeof _=="function"?_:null,this.onRejected=typeof b=="function"?b:null,this.promise=y}function m(_,b){var y=!1;try{_(function(x){y||(y=!0,u(b,x))},function(x){y||(y=!0,p(b,x))})}catch(x){if(y)return;y=!0,p(b,x)}}c.prototype.catch=function(_){return this.then(null,_)},c.prototype.then=function(_,b){var y=new this.constructor(l);return d(this,new h(_,b,y)),y},c.prototype.finally=s.a,c.all=function(_){return new c(function(b,y){if(!_||_.length===void 0)throw new TypeError("Promise.all accepts an array");var x=Array.prototype.slice.call(_);if(x.length===0)return b([]);var v=x.length;function E(k,T){try{if(T&&(typeof T=="object"||typeof T=="function")){var w=T.then;if(typeof w=="function")return void w.call(T,function(S){E(k,S)},y)}x[k]=T,--v==0&&b(x)}catch(S){y(S)}}for(var C=0;C<x.length;C++)E(C,x[C])})},c.resolve=function(_){return _&&typeof _=="object"&&_.constructor===c?_:new c(function(b){b(_)})},c.reject=function(_){return new c(function(b,y){y(_)})},c.race=function(_){return new c(function(b,y){for(var x=0,v=_.length;x<v;x++)_[x].then(b,y)})},c._immediateFn=typeof i=="function"&&function(_){i(_)}||function(_){a(_,0)},c._unhandledRejectionFn=function(_){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",_)},o.a=c}).call(this,r(5).setImmediate)},function(n,o,r){o.a=function(i){var s=this.constructor;return this.then(function(a){return s.resolve(i()).then(function(){return a})},function(a){return s.resolve(i()).then(function(){return s.reject(a)})})}},function(n,o,r){function i(m){return(i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _})(m)}r(4);var s,a,l,c,d,u,p,f=r(8),h=(a=function(m){return new Promise(function(_,b){m=c(m),(m=d(m)).beforeSend&&m.beforeSend();var y=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");y.open(m.method,m.url),y.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(m.headers).forEach(function(v){var E=m.headers[v];y.setRequestHeader(v,E)});var x=m.ratio;y.upload.addEventListener("progress",function(v){var E=Math.round(v.loaded/v.total*100),C=Math.ceil(E*x/100);m.progress(Math.min(C,100))},!1),y.addEventListener("progress",function(v){var E=Math.round(v.loaded/v.total*100),C=Math.ceil(E*(100-x)/100)+x;m.progress(Math.min(C,100))},!1),y.onreadystatechange=function(){if(y.readyState===4){var v=y.response;try{v=JSON.parse(v)}catch{}var E=f.parseHeaders(y.getAllResponseHeaders()),C={body:v,code:y.status,headers:E};p(y.status)?_(C):b(C)}},y.send(m.data)})},l=function(m){return m.method="POST",a(m)},c=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(m.url&&typeof m.url!="string")throw new Error("Url must be a string");if(m.url=m.url||"",m.method&&typeof m.method!="string")throw new Error("`method` must be a string or null");if(m.method=m.method?m.method.toUpperCase():"GET",m.headers&&i(m.headers)!=="object")throw new Error("`headers` must be an object or null");if(m.headers=m.headers||{},m.type&&(typeof m.type!="string"||!Object.values(s).includes(m.type)))throw new Error("`type` must be taken from module's \xABcontentType\xBB library");if(m.progress&&typeof m.progress!="function")throw new Error("`progress` must be a function or null");if(m.progress=m.progress||function(_){},m.beforeSend=m.beforeSend||function(_){},m.ratio&&typeof m.ratio!="number")throw new Error("`ratio` must be a number");if(m.ratio<0||m.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(m.ratio=m.ratio||90,m.accept&&typeof m.accept!="string")throw new Error("`accept` must be a string with a list of allowed mime-types");if(m.accept=m.accept||"*/*",m.multiple&&typeof m.multiple!="boolean")throw new Error("`multiple` must be a true or false");if(m.multiple=m.multiple||!1,m.fieldName&&typeof m.fieldName!="string")throw new Error("`fieldName` must be a string");return m.fieldName=m.fieldName||"files",m},d=function(m){switch(m.method){case"GET":var _=u(m.data,s.URLENCODED);delete m.data,m.url=/\?/.test(m.url)?m.url+"&"+_:m.url+"?"+_;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var b=(function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).type||s.JSON})(m);(f.isFormData(m.data)||f.isFormElement(m.data))&&(b=s.FORM),m.data=u(m.data,b),b!==h.contentType.FORM&&(m.headers["content-type"]=b)}return m},u=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case s.URLENCODED:return f.urlEncode(m);case s.JSON:return f.jsonEncode(m);case s.FORM:return f.formEncode(m);default:return m}},p=function(m){return m>=200&&m<300},{contentType:s={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:a,get:function(m){return m.method="GET",a(m)},post:l,transport:function(m){return m=c(m),f.selectFiles(m).then(function(_){for(var b=new FormData,y=0;y<_.length;y++)b.append(m.fieldName,_[y],_[y].name);f.isObject(m.data)&&Object.keys(m.data).forEach(function(v){var E=m.data[v];b.append(v,E)});var x=m.beforeSend;return m.beforeSend=function(){return x(_)},m.data=b,l(m)})},selectFiles:function(m){return delete(m=c(m)).beforeSend,f.selectFiles(m)}});n.exports=h},function(n,o,r){r.r(o);var i=r(1);window.Promise=window.Promise||i.a},function(n,o,r){(function(i){var s=i!==void 0&&i||typeof self<"u"&&self||window,a=Function.prototype.apply;function l(c,d){this._id=c,this._clearFn=d}o.setTimeout=function(){return new l(a.call(setTimeout,s,arguments),clearTimeout)},o.setInterval=function(){return new l(a.call(setInterval,s,arguments),clearInterval)},o.clearTimeout=o.clearInterval=function(c){c&&c.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(s,this._id)},o.enroll=function(c,d){clearTimeout(c._idleTimeoutId),c._idleTimeout=d},o.unenroll=function(c){clearTimeout(c._idleTimeoutId),c._idleTimeout=-1},o._unrefActive=o.active=function(c){clearTimeout(c._idleTimeoutId);var d=c._idleTimeout;d>=0&&(c._idleTimeoutId=setTimeout(function(){c._onTimeout&&c._onTimeout()},d))},r(6),o.setImmediate=typeof self<"u"&&self.setImmediate||i!==void 0&&i.setImmediate||this&&this.setImmediate,o.clearImmediate=typeof self<"u"&&self.clearImmediate||i!==void 0&&i.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(n,o,r){(function(i,s){(function(a,l){if(!a.setImmediate){var c,d,u,p,f,h=1,m={},_=!1,b=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,{}.toString.call(a.process)==="[object process]"?c=function(E){s.nextTick(function(){v(E)})}:(function(){if(a.postMessage&&!a.importScripts){var E=!0,C=a.onmessage;return a.onmessage=function(){E=!1},a.postMessage("","*"),a.onmessage=C,E}})()?(p="setImmediate$"+Math.random()+"$",f=function(E){E.source===a&&typeof E.data=="string"&&E.data.indexOf(p)===0&&v(+E.data.slice(p.length))},a.addEventListener?a.addEventListener("message",f,!1):a.attachEvent("onmessage",f),c=function(E){a.postMessage(p+E,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(E){v(E.data)},c=function(E){u.port2.postMessage(E)}):b&&"onreadystatechange"in b.createElement("script")?(d=b.documentElement,c=function(E){var C=b.createElement("script");C.onreadystatechange=function(){v(E),C.onreadystatechange=null,d.removeChild(C),C=null},d.appendChild(C)}):c=function(E){setTimeout(v,0,E)},y.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var C=new Array(arguments.length-1),k=0;k<C.length;k++)C[k]=arguments[k+1];var T={callback:E,args:C};return m[h]=T,c(h),h++},y.clearImmediate=x}function x(E){delete m[E]}function v(E){if(_)setTimeout(v,0,E);else{var C=m[E];if(C){_=!0;try{(function(k){var T=k.callback,w=k.args;switch(w.length){case 0:T();break;case 1:T(w[0]);break;case 2:T(w[0],w[1]);break;case 3:T(w[0],w[1],w[2]);break;default:T.apply(l,w)}})(C)}finally{x(E),_=!1}}}}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,r(0),r(7))},function(n,o){var r,i,s=n.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(y){if(r===setTimeout)return setTimeout(y,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:a}catch{r=a}try{i=typeof clearTimeout=="function"?clearTimeout:l}catch{i=l}})();var d,u=[],p=!1,f=-1;function h(){p&&d&&(p=!1,d.length?u=d.concat(u):f=-1,u.length&&m())}function m(){if(!p){var y=c(h);p=!0;for(var x=u.length;x;){for(d=u,u=[];++f<x;)d&&d[f].run();f=-1,x=u.length}d=null,p=!1,(function(v){if(i===clearTimeout)return clearTimeout(v);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(v);try{i(v)}catch{try{return i.call(null,v)}catch{return i.call(this,v)}}})(y)}}function _(y,x){this.fun=y,this.array=x}function b(){}s.nextTick=function(y){var x=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)x[v-1]=arguments[v];u.push(new _(y,x)),u.length!==1||p||c(m)},_.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=b,s.addListener=b,s.once=b,s.off=b,s.removeListener=b,s.removeAllListeners=b,s.emit=b,s.prependListener=b,s.prependOnceListener=b,s.listeners=function(y){return[]},s.binding=function(y){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(y){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(n,o,r){function i(a,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=r(9);n.exports=(function(){function a(){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,a)}var l,c,d;return l=a,d=[{key:"urlEncode",value:function(u){return s(u)}},{key:"jsonEncode",value:function(u){return JSON.stringify(u)}},{key:"formEncode",value:function(u){if(this.isFormData(u))return u;if(this.isFormElement(u))return new FormData(u);if(this.isObject(u)){var p=new FormData;return Object.keys(u).forEach(function(f){var h=u[f];p.append(f,h)}),p}throw new Error("`data` must be an instance of Object, FormData or <FORM> HTMLElement")}},{key:"isObject",value:function(u){return Object.prototype.toString.call(u)==="[object Object]"}},{key:"isFormData",value:function(u){return u instanceof FormData}},{key:"isFormElement",value:function(u){return u instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p,f){var h=document.createElement("INPUT");h.type="file",u.multiple&&h.setAttribute("multiple","multiple"),u.accept&&h.setAttribute("accept",u.accept),h.style.display="none",document.body.appendChild(h),h.addEventListener("change",function(m){var _=m.target.files;p(_),document.body.removeChild(h)},!1),h.click()})}},{key:"parseHeaders",value:function(u){var p=u.trim().split(/[\r\n]+/),f={};return p.forEach(function(h){var m=h.split(": "),_=m.shift(),b=m.join(": ");_&&(f[_]=b)}),f}}],(c=null)&&i(l.prototype,c),d&&i(l,d),a})()},function(n,o){var r=function(s){return encodeURIComponent(s).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},i=function(s,a,l,c){return a=a||null,l=l||"&",c=c||null,s?(function(d){for(var u=new Array,p=0;p<d.length;p++)d[p]&&u.push(d[p]);return u})(Object.keys(s).map(function(d){var u,p,f=d;if(c&&(f=c+"["+f+"]"),typeof s[d]=="object"&&s[d]!==null)u=i(s[d],null,l,f);else{a&&(p=f,f=!isNaN(parseFloat(p))&&isFinite(p)?a+Number(f):f);var h=s[d];h=(h=(h=(h=h===!0?"1":h)===!1?"0":h)===0?"0":h)||"",u=r(f)+"="+r(h)}return u})).join(l).replace(/[!'()*]/g,""):""};n.exports=i}])})})(dk);var R6=dk.exports,ya=L6(R6);function z_(t){return t!==void 0&&typeof t.then=="function"}var K_=class{constructor({config:e,onUpload:n,onError:o}){this.config=e,this.onUpload=n,this.onError=o}uploadSelectedFile({onPreview:e}){let n=function(r){let i=new FileReader;i.readAsDataURL(r),i.onload=s=>{e(s.target.result)}},o;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function"){let r=this.config.uploader.uploadByFile;o=ya.selectFiles({accept:this.config.types??"image/*"}).then(i=>{n(i[0]);let s=r(i[0]);return z_(s)||console.warn("Custom uploader method uploadByFile should return a Promise"),s})}else o=ya.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types??"image/*",headers:this.config.additionalRequestHeaders,beforeSend:r=>{n(r[0])},fieldName:this.config.field??"image"}).then(r=>r.body);o.then(r=>{this.onUpload(r)}).catch(r=>{this.onError(r)})}uploadByUrl(e){let n;this.config.uploader&&typeof this.config.uploader.uploadByUrl=="function"?(n=this.config.uploader.uploadByUrl(e),z_(n)||console.warn("Custom uploader method uploadByUrl should return a Promise")):n=ya.post({url:this.config.endpoints.byUrl,data:Object.assign({url:e},this.config.additionalRequestData),type:ya.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(o=>o.body),n.then(o=>{this.onUpload(o)}).catch(o=>{this.onError(o)})}uploadByFile(e,{onPreview:n}){let o=new FileReader;o.readAsDataURL(e),o.onload=i=>{n(i.target.result)};let r;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function")r=this.config.uploader.uploadByFile(e),z_(r)||console.warn("Custom uploader method uploadByFile should return a Promise");else{let i=new FormData;i.append(this.config.field??"image",e),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEach(([s,a])=>{i.append(s,a)}),r=ya.post({url:this.config.endpoints.byFile,data:i,type:ya.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(s=>s.body)}r.then(i=>{this.onUpload(i)}).catch(i=>{this.onError(i)})}};var qu=class t{constructor({data:e,config:n,api:o,readOnly:r,block:i}){this.isCaptionEnabled=null,this.api=o,this.block=i,this.config={endpoints:n.endpoints,additionalRequestData:n.additionalRequestData,additionalRequestHeaders:n.additionalRequestHeaders,field:n.field,types:n.types,captionPlaceholder:this.api.i18n.t(n.captionPlaceholder??"Caption"),buttonContent:n.buttonContent,uploader:n.uploader,actions:n.actions,features:n.features||{}},this.uploader=new K_({config:this.config,onUpload:s=>this.onUpload(s),onError:s=>this.uploadingFailed(s)}),this.ui=new H_({api:o,config:this.config,onSelectFile:()=>{this.uploader.uploadSelectedFile({onPreview:s=>{this.ui.showPreloader(s)}})},readOnly:r}),this._data={caption:"",withBorder:!1,withBackground:!1,stretched:!1,file:{url:""}},this.data=e}static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:ck,title:"Image"}}static get tunes(){return[{name:"withBorder",icon:I6,title:"With border",toggle:!0},{name:"stretched",icon:M6,title:"Stretch image",toggle:!0},{name:"withBackground",icon:O6,title:"With background",toggle:!0}]}render(){var e,n,o;return(((e=this.config.features)==null?void 0:e.caption)===!0||((n=this.config.features)==null?void 0:n.caption)===void 0||((o=this.config.features)==null?void 0:o.caption)==="optional"&&this.data.caption)&&(this.isCaptionEnabled=!0),this.ui.render()}validate(e){return!!e.file.url}save(){let e=this.ui.nodes.caption;return this._data.caption=e.innerHTML,this.data}renderSettings(){var e;let n=t.tunes.concat(this.config.actions||[]),o={border:"withBorder",background:"withBackground",stretch:"stretched",caption:"caption"};((e=this.config.features)==null?void 0:e.caption)==="optional"&&n.push({name:"caption",icon:A6,title:"With caption",toggle:!0});let r=n.filter(s=>{var a,l;let c=Object.keys(o).find(d=>o[d]===s.name);return c==="caption"?((a=this.config.features)==null?void 0:a.caption)!==!1:c==null||((l=this.config.features)==null?void 0:l[c])!==!1}),i=s=>{let a=this.data[s.name];return s.name==="caption"&&(a=this.isCaptionEnabled??a),a};return r.map(s=>({icon:s.icon,label:this.api.i18n.t(s.title),name:s.name,toggle:s.toggle,isActive:i(s),onActivate:()=>{if(typeof s.action=="function"){s.action(s.name);return}let a=!i(s);s.name==="caption"&&(this.isCaptionEnabled=!(this.isCaptionEnabled??!1),a=this.isCaptionEnabled),this.tuneToggled(s.name,a)}}))}appendCallback(){this.ui.nodes.fileButton.click()}static get pasteConfig(){return{tags:[{img:{src:!0}}],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i},files:{mimeTypes:["image/*"]}}}async onPaste(e){switch(e.type){case"tag":{let n=e.detail.data;if(/^blob:/.test(n.src)){let o=await(await fetch(n.src)).blob();this.uploadFile(o);break}this.uploadUrl(n.src);break}case"pattern":{let n=e.detail.data;this.uploadUrl(n);break}case"file":{let n=e.detail.file;this.uploadFile(n);break}}}set data(e){this.image=e.file,this._data.caption=e.caption||"",this.ui.fillCaption(this._data.caption),t.tunes.forEach(({name:n})=>{let o=typeof e[n]<"u"?e[n]===!0||e[n]==="true":!1;this.setTune(n,o)}),e.caption&&this.setTune("caption",!0)}get data(){return this._data}set image(e){this._data.file=e||{url:""},e&&e.url&&this.ui.fillImage(e.url)}onUpload(e){e.success&&e.file?this.image=e.file:this.uploadingFailed("incorrect response: "+JSON.stringify(e))}uploadingFailed(e){console.log("Image Tool: uploading failed because of",e),this.api.notifier.show({message:this.api.i18n.t("Couldn\u2019t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}tuneToggled(e,n){e==="caption"?(this.ui.applyTune(e,n),n==!1&&(this._data.caption="",this.ui.fillCaption(""))):this.setTune(e,n)}setTune(e,n){this._data[e]=n,this.ui.applyTune(e,n),e==="stretched"&&Promise.resolve().then(()=>{this.block.stretched=n}).catch(o=>{console.error(o)})}uploadFile(e){this.uploader.uploadByFile(e,{onPreview:n=>{this.ui.showPreloader(n)}})}uploadUrl(e){this.ui.showPreloader(e),this.uploader.uploadByUrl(e)}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"\u2022"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function xr(t){return t.nodeType===Node.ELEMENT_NODE}function xa(t,e=null,n){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(let r in n)o[r]=n[r];return o}function uk(t){let e=xa("div");return e.appendChild(t),e.innerHTML}function fk(t){let e;return t.nodeType!==Node.ELEMENT_NODE?e=t.textContent:(e=t.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}var oi=class t{constructor(){this.savedFakeCaret=void 0}save(){let e=t.range,n=xa("span");n.hidden=!0,e&&(e.insertNode(n),this.savedFakeCaret=n)}restore(){if(!this.savedFakeCaret)return;let e=window.getSelection();if(!e)return;let n=new Range;n.setStartAfter(this.savedFakeCaret),n.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(n),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){let e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){let e=window.getSelection();if(!e||!e.rangeCount)return;let n=e.getRangeAt(0),o=n.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!xr(o))return;let r=o.closest("[contenteditable]");if(!r)return;n.deleteContents();let i=n.cloneRange();return i.selectNodeContents(r),i.setStart(n.endContainer,n.endOffset),i.extractContents()}static focus(e,n=!0){let o=document.createRange(),r=window.getSelection();r&&(o.selectNodeContents(e),o.collapse(n),r.removeAllRanges(),r.addRange(o))}static isAtStart(){let e=window.getSelection();if(!e||e.focusOffset>0)return!1;let n=e.focusNode;return!n||!xr(n)?!1:t.getHigherLevelSiblings(n,"left").every(o=>fk(o))}static getHigherLevelSiblings(e,n="left"){let o=e,r=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;let i=n==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],r.push(o);return r}},P6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',pk='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',cc=class t{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:pk,title:"List"}}constructor({data:e,config:n,api:o,readOnly:r}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=r,this.config=n,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";let s={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:s,this.caret=new oi}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:P6},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:pk}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){let n=e.detail.data;this.data=this.pasteHandler(n);let o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){let{tagName:n}=e,o="unordered",r;switch(n){case"OL":o="ordered",r="ol";break;case"UL":case"LI":o="unordered",r="ul"}let i={style:o,items:[]},s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{var c;let d=l.querySelector(`:scope > ${r}`),u=d?s(d):[];return{content:((c=l?.firstChild)==null?void 0:c.textContent)||"",items:u}});return i.items=s(e),i}appendItems(e,n){e.forEach(o=>{let r=this.createItem(o.content,o.items);n.appendChild(r)})}createItem(e,n=[]){let o=xa("li",this.CSS.item),r=xa("div",this.CSS.itemBody),i=xa("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),o.appendChild(r),n&&n.length>0&&this.addChildrenList(o,n),o}save(){let e=n=>Array.from(n.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{let r=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),s=r?e(r):[];return{content:i,items:s}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,n){let o=e.querySelector(`.${this.CSS.itemBody}`),r=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(n,r),o&&o.appendChild(r)}makeListWrapper(e=this.listStyle,n=[]){let o=e==="ordered"?"ol":"ul",r=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return n.push(r),xa(o,[this.CSS.wrapper,...n])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;let n=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));n.push(this.nodes.wrapper),n.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(xr(n)||(n=n.parentNode),!n)||!xr(n)?null:n.closest(`.${this.CSS.item}`)}enterPressed(e){let n=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;let o=n?this.getItemContent(n).trim().length===0:!0,r=n?.parentNode===this.nodes.wrapper,i=n?.nextElementSibling===null;if(r&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}let s=oi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=uk(s),l=n?.querySelector(`.${this.CSS.itemChildren}`),c=this.createItem(a,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(c):n?.after(c),this.focusItem(c)}unshiftItem(){let e=this.currentItem;if(!e||!e.parentNode||!xr(e.parentNode))return;let n=e.parentNode.closest(`.${this.CSS.item}`);if(!n)return;this.caret.save(),n.after(e),this.caret.restore();let o=n.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){let n=e.querySelector(`.${this.CSS.itemContent}`);return!n||fk(n)?"":n.innerHTML}focusItem(e,n=!0){let o=e.querySelector(`.${this.CSS.itemContent}`);o&&oi.focus(o,n)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!oi.isAtStart())return;e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!n.parentNode||!xr(n.parentNode))return;let r=n.parentNode.closest(`.${this.CSS.item}`);if(!o&&!r||o&&!xr(o))return;e.stopPropagation();let i;if(o){let d=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(d).pop()||o}else i=r;let s=oi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=uk(s);if(!i)return;let l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;oi.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",a);let c=n.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);c=Array.from(c),c=c.filter(d=>!d.parentNode||!xr(d.parentNode)?!1:d.parentNode.closest(`.${this.CSS.item}`)===n),c.reverse().forEach(d=>{o?i.after(d):n.after(d)}),n.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!o||!xr(o)||!o)return;let r=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),r)r.appendChild(n);else{let i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),s=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(n),s?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${t.joinRecursive(n)}`).join("")}static get conversionConfig(){return{export:e=>t.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-rawtool__textarea{min-height:200px;resize:vertical;border-radius:8px;border:0;background-color:#1e2128;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:12px;line-height:1.6;letter-spacing:-.2px;color:#a1a7b6;overscroll-behavior:contain}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var F6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.6954 5C17.912 5 18.8468 6.07716 18.6755 7.28165L17.426 16.0659C17.3183 16.8229 16.7885 17.4522 16.061 17.6873L12.6151 18.8012C12.2152 18.9304 11.7848 18.9304 11.3849 18.8012L7.93898 17.6873C7.21148 17.4522 6.6817 16.8229 6.57403 16.0659L5.32454 7.28165C5.15322 6.07716 6.088 5 7.30461 5H16.6954Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8.4H9L9.42857 11.7939H14.5714L14.3571 13.2788L14.1429 14.7636L12 15.4L9.85714 14.7636L9.77143 14.3394"/></svg>';var Xu=class t{static get isReadOnlySupported(){return!0}static get displayInToolbox(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:F6,title:"Raw HTML"}}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this.placeholder=o.i18n.t(n.placeholder||t.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-rawtool",textarea:"ce-rawtool__textarea"},this.data={html:e.html||""},this.textarea=null,this.resizeDebounce=null}render(){let e=document.createElement("div"),n=100;return this.textarea=document.createElement("textarea"),e.classList.add(this.CSS.baseClass,this.CSS.wrapper),this.textarea.classList.add(this.CSS.textarea,this.CSS.input),this.textarea.textContent=this.data.html,this.textarea.placeholder=this.placeholder,this.readOnly?this.textarea.disabled=!0:this.textarea.addEventListener("input",()=>{this.onInput()}),e.appendChild(this.textarea),setTimeout(()=>{this.resize()},n),e}save(e){return{html:e.querySelector("textarea").value}}static get DEFAULT_PLACEHOLDER(){return"Enter HTML code"}static get sanitize(){return{html:!0}}onInput(){this.resizeDebounce&&clearTimeout(this.resizeDebounce),this.resizeDebounce=setTimeout(()=>{this.resize()},200)}resize(){this.textarea.style.height="auto",this.textarea.style.height=this.textarea.scrollHeight+"px"}};Se();var U_=class t{static get CSS(){return""}static get shortcut(){return"CMD+SHIFT+X"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("S",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("S");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("S",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"/></svg>'}static get sanitize(){return{s:{}}}},hk=U_;var j_=class t{static get CSS(){return""}static get shortcut(){return"CMD+."}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("SUP",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("SUP");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("SUP",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" style="stroke: none !important" /><path d="M5 7l8 10m-8 0l8 -10" /><path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" /></svg>'}static get sanitize(){return{sup:{}}}},gk=j_;var V_=class t{static get CSS(){return""}static get shortcut(){return"CMD+U"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("U",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("U");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("U",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}static get sanitize(){return{u:{}}}},mk=V_;function _k(t){let e=Y(null),[n,o]=R(null),[r,i]=R({blocks:[{type:"paragraph",data:{}}],time:0,version:""}),s=t.placeholder||"Start typing...";return P(()=>{if(!n)return;let a=t.value;if(r?.time!==a?.time){let l=r?.time||0;(a?.time||0)>l&&B6(a)&&((a?.blocks||[]).length>0?n.render(a):n.render({...a,blocks:[{type:"paragraph",data:{text:""}}]}),i(a))}},[n,t.value]),P(()=>{let a=e.current,l=Fu,c=new l({holder:a,placeholder:s,inlineToolbar:["bold","italic","underline","strikethrough","superscript","link"],tools:{heading:{class:Gu,config:{placeholder:"Enter a header",levels:[2,3,4,5],defaultLevel:2}},strikethrough:{class:hk},superscript:{class:gk},underline:{class:mk},image:{class:qu,config:{uploader:$6(),captionPlaceholder:"Alt text"}},unorderedList:{class:cc,inlineToolbar:!0,config:{defaultStyle:"unordered"},toolbox:{name:"unorderedList",title:"Bulleted List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>'}},orderedList:{class:cc,inlineToolbar:!0,config:{defaultStyle:"ordered"},toolbox:{name:"orderedList",title:"Numbered List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>'}},html:{class:Xu,toolbox:{name:"HTML"}}},onReady:()=>{o(c)},onChange:()=>{c.save().then(d=>{i(d),t.onChange&&t.onChange(d)}).catch(d=>{console.error("richtext error: ",d)})}});return()=>{c&&typeof c.destroy=="function"&&c.destroy()}},[]),g("div",{ref:e,className:we(t.className,"EditorJSEditor")})}function B6(t){return Vs(t)&&Array.isArray(t.blocks)&&t.blocks.length>0}function $6(){return{uploadByFile:async t=>{try{let e=await qs(t),n=e.src;return z6(n)&&(n=`${n}=s0-e365`),console.log(e),{success:1,file:{...e,url:n}}}catch(e){return console.error(e),{success:0,error:e}}},uploadByUrl:async t=>({success:0,error:"upload by url not currently supported"})}}function z6(t){return t.startsWith("https://lh3.googleusercontent.com/")}var by={};Re(by,{$addUpdateTag:()=>N1,$applyNodeReplacement:()=>Ac,$caretFromPoint:()=>fi,$caretRangeFromSelection:()=>Ib,$cloneWithProperties:()=>R1,$comparePointCaretNext:()=>gy,$copyNode:()=>cy,$create:()=>_U,$createLineBreakNode:()=>Da,$createNodeSelection:()=>Yb,$createParagraphNode:()=>Nr,$createPoint:()=>yo,$createRangeSelection:()=>i1,$createRangeSelectionFromDom:()=>HK,$createTabNode:()=>Np,$createTextNode:()=>Kt,$extendCaretToRange:()=>fy,$getAdjacentChildCaret:()=>Ba,$getAdjacentNode:()=>S1,$getAdjacentSiblingOrParentSiblingCaret:()=>TU,$getCaretInDirection:()=>hi,$getCaretRange:()=>pi,$getCaretRangeInDirection:()=>_y,$getCharacterOffsets:()=>Eb,$getChildCaret:()=>Ir,$getChildCaretAtIndex:()=>U1,$getChildCaretOrSelf:()=>B1,$getCollapsedCaretRange:()=>$1,$getCommonAncestor:()=>_c,$getCommonAncestorResultBranchOrder:()=>my,$getEditor:()=>dy,$getNearestNodeFromDOMNode:()=>Ap,$getNearestRootOrShadowRoot:()=>O1,$getNodeByKey:()=>At,$getNodeByKeyOrThrow:()=>I1,$getPreviousSelection:()=>hs,$getRoot:()=>On,$getSelection:()=>Pe,$getSiblingCaret:()=>Gt,$getState:()=>cp,$getStateChange:()=>gK,$getTextContent:()=>jK,$getTextNodeOffset:()=>fs,$getTextPointCaret:()=>ui,$getTextPointCaretSlice:()=>Db,$getWritableNodeState:()=>$b,$hasAncestor:()=>Ep,$hasUpdateTag:()=>uU,$insertNodes:()=>UK,$isBlockElementNode:()=>zK,$isChildCaret:()=>bo,$isDecoratorNode:()=>Ye,$isElementNode:()=>U,$isExtendableTextPointCaret:()=>K1,$isInlineElementOrDecoratorNode:()=>pU,$isLeafNode:()=>lU,$isLineBreakNode:()=>is,$isNodeCaret:()=>xU,$isNodeSelection:()=>Dp,$isParagraphNode:()=>QK,$isRangeSelection:()=>de,$isRootNode:()=>Nn,$isRootOrShadowRoot:()=>xo,$isSiblingCaret:()=>ps,$isTabNode:()=>Gb,$isTextNode:()=>ee,$isTextPointCaret:()=>Dr,$isTextPointCaretSlice:()=>wU,$isTokenOrSegmented:()=>wr,$isTokenOrTab:()=>si,$nodesOfType:()=>dU,$normalizeCaret:()=>mo,$normalizeSelection__EXPERIMENTAL:()=>dp,$onUpdate:()=>D1,$parseSerializedNode:()=>GK,$removeTextFromCaretRange:()=>H1,$rewindSiblingCaret:()=>Ka,$selectAll:()=>cU,$setCompositionKey:()=>jt,$setPointFromCaret:()=>$a,$setSelection:()=>In,$setSelectionFromCaretRange:()=>z1,$setState:()=>mK,$splitAtPointCaretNext:()=>NU,$splitNode:()=>fU,$updateRangeSelectionFromCaretRange:()=>bc,ArtificialNode__DO_NOT_USE:()=>xp,BLUR_COMMAND:()=>jN,CAN_REDO_COMMAND:()=>NK,CAN_UNDO_COMMAND:()=>DK,CLEAR_EDITOR_COMMAND:()=>SK,CLEAR_HISTORY_COMMAND:()=>kK,CLICK_COMMAND:()=>SN,COLLABORATION_TAG:()=>p1,COMMAND_PRIORITY_CRITICAL:()=>rU,COMMAND_PRIORITY_EDITOR:()=>eU,COMMAND_PRIORITY_HIGH:()=>oU,COMMAND_PRIORITY_LOW:()=>tU,COMMAND_PRIORITY_NORMAL:()=>nU,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ea,COPY_COMMAND:()=>jb,CUT_COMMAND:()=>Vb,DELETE_CHARACTER_COMMAND:()=>Tc,DELETE_LINE_COMMAND:()=>kc,DELETE_WORD_COMMAND:()=>Sc,DRAGEND_COMMAND:()=>KN,DRAGOVER_COMMAND:()=>HN,DRAGSTART_COMMAND:()=>zN,DROP_COMMAND:()=>$N,DecoratorNode:()=>Nc,ElementNode:()=>di,FOCUS_COMMAND:()=>UN,FORMAT_ELEMENT_COMMAND:()=>TK,FORMAT_TEXT_COMMAND:()=>ri,HISTORIC_TAG:()=>YK,HISTORY_MERGE_TAG:()=>ip,HISTORY_PUSH_TAG:()=>qK,INDENT_CONTENT_COMMAND:()=>EK,INSERT_LINE_BREAK_COMMAND:()=>fc,INSERT_PARAGRAPH_COMMAND:()=>hb,INSERT_TAB_COMMAND:()=>CK,INTERNAL_$isBlock:()=>kr,IS_ALL_FORMATTING:()=>uN,IS_BOLD:()=>X6,IS_CODE:()=>Z6,IS_HIGHLIGHT:()=>Tp,IS_ITALIC:()=>J6,IS_STRIKETHROUGH:()=>xc,IS_SUBSCRIPT:()=>Q6,IS_SUPERSCRIPT:()=>eK,IS_UNDERLINE:()=>vc,KEY_ARROW_DOWN_COMMAND:()=>AN,KEY_ARROW_LEFT_COMMAND:()=>ON,KEY_ARROW_RIGHT_COMMAND:()=>NN,KEY_ARROW_UP_COMMAND:()=>MN,KEY_BACKSPACE_COMMAND:()=>RN,KEY_DELETE_COMMAND:()=>FN,KEY_DOWN_COMMAND:()=>kN,KEY_ENTER_COMMAND:()=>hp,KEY_ESCAPE_COMMAND:()=>PN,KEY_MODIFIER_COMMAND:()=>VN,KEY_SPACE_COMMAND:()=>LN,KEY_TAB_COMMAND:()=>BN,LineBreakNode:()=>Na,MOVE_TO_END:()=>DN,MOVE_TO_START:()=>IN,NODE_STATE_KEY:()=>lK,OUTDENT_CONTENT_COMMAND:()=>wK,PASTE_COMMAND:()=>Hb,PASTE_TAG:()=>XK,ParagraphNode:()=>Ma,REDO_COMMAND:()=>Ub,REMOVE_TEXT_COMMAND:()=>gb,RootNode:()=>Ia,SELECTION_CHANGE_COMMAND:()=>zb,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>vK,SELECT_ALL_COMMAND:()=>mb,SKIP_COLLAB_TAG:()=>JK,SKIP_DOM_SELECTION_TAG:()=>h1,SKIP_SCROLL_INTO_VIEW_TAG:()=>f1,TEXT_TYPE_TO_FORMAT:()=>ln,TabNode:()=>Oa,TextNode:()=>cs,UNDO_COMMAND:()=>Kb,buildImportMap:()=>MK,createCommand:()=>xe,createEditor:()=>iU,createSharedNodeState:()=>bN,createState:()=>hK,flipDirection:()=>gi,getDOMOwnerDocument:()=>ay,getDOMSelection:()=>Vo,getDOMSelectionFromTarget:()=>M1,getDOMTextNode:()=>us,getEditorPropertyFromDOMNode:()=>Ic,getNearestEditorFromDOMNode:()=>ny,getRegisteredNode:()=>ey,getRegisteredNodeOrThrow:()=>Qb,isBlockDomNode:()=>kb,isCurrentlyReadOnlyMode:()=>za,isDOMDocumentNode:()=>_1,isDOMNode:()=>Ha,isDOMTextNode:()=>Wo,isDOMUnmanaged:()=>F1,isDocumentFragment:()=>A1,isExactShortcutMatch:()=>je,isHTMLAnchorElement:()=>hU,isHTMLElement:()=>yn,isInlineDomNode:()=>L1,isLexicalEditor:()=>Ip,isModifierMatch:()=>T1,isSelectionCapturedInDecoratorInput:()=>ty,isSelectionWithinEditor:()=>Oc,makeStepwiseIterator:()=>hy,removeFromParent:()=>ai,resetRandomKey:()=>sU,setDOMUnmanaged:()=>mU,setNodeIndentFromDOM:()=>P1});function V(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vo=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,H6=vo&&"documentMode"in document?document.documentMode:null,jo=vo&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ss=vo&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),sp=!(!vo||!("InputEvent"in window)||H6)&&"getTargetRanges"in new window.InputEvent("input"),yc=vo&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Sa=vo&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,K6=vo&&/Android/.test(navigator.userAgent),cN=vo&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bk=vo&&K6&&cN,ap=vo&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!cN;function lp(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var U6=1,j6=3,V6=9,W6=11,as=0,dN=1,ka=2,G6=0,Y6=1,q6=2,X6=1,J6=2,xc=4,vc=8,Z6=16,Q6=32,eK=64,Tp=128,uN=1792|(112|(3|xc|vc)|Tp),Mb=1,Ab=2,Lb=3,Rb=4,Pb=5,Fb=6,Sp=yc||Sa||ap?"\xA0":"\u200B",Or=`
104
+
105
+ `,tK=ss?"\xA0":Sp,pN="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",fN="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",nK=new RegExp("^[^"+fN+"]*["+pN+"]"),oK=new RegExp("^[^"+pN+"]*["+fN+"]"),ln={bold:1,capitalize:1024,code:16,highlight:Tp,italic:2,lowercase:256,strikethrough:xc,subscript:32,superscript:64,underline:vc,uppercase:512},rK={directionless:1,unmergeable:2},yk={center:Ab,end:Fb,justify:Rb,left:Mb,right:Lb,start:Pb},iK={[Ab]:"center",[Fb]:"end",[Rb]:"justify",[Mb]:"left",[Lb]:"right",[Pb]:"start"},sK={normal:0,segmented:2,token:1},aK={[G6]:"normal",[q6]:"segmented",[Y6]:"token"},lK="$",xk="$config";function hN(t,e,n,o,r,i){let s=t.getFirstChild();for(;s!==null;){let a=s.__key;s.__parent===e&&(U(s)&&hN(s,a,n,o,r,i),n.has(a)||i.delete(a),r.push(a)),s=s.getNextSibling()}}var cK=100,ib=!1,Bb=0;function dK(t){Bb=t.timeStamp}function W_(t,e,n){let o=t.nodeName==="BR",r=e.__lexicalLineBreak;return r&&(t===r||o&&t.previousSibling===r)||o&&Mp(t,n)!==void 0}function uK(t,e,n){let o=Vo(co(n)),r=null,i=null;o!==null&&o.anchorNode===t&&(r=o.anchorOffset,i=o.focusOffset);let s=t.nodeValue;s!==null&&iy(e,s,r,i,!1)}function pK(t,e,n){if(de(t)){let o=t.anchor.getNode();if(o.is(n)&&t.format!==o.getFormat())return!1}return Wo(e)&&n.isAttached()}function fK(t,e,n,o){for(let r=t;r&&!F1(r);r=Mc(r)){let i=Mp(r,e);if(i!==void 0){let s=At(i,n);if(s)return Ye(s)||!yn(r)?void 0:[r,s]}else if(r===o)return[o,v1(n)]}}function gN(t,e,n){ib=!0;let o=performance.now()-Bb>cK;try{Yn(t,(()=>{let r=Pe()||(function(p){return p.getEditorState().read((()=>{let f=Pe();return f!==null?f.clone():null}))})(t),i=new Map,s=t.getRootElement(),a=t._editorState,l=t._blockCursorElement,c=!1,d="";for(let p=0;p<e.length;p++){let f=e[p],h=f.type,m=f.target,_=fK(m,t,a,s);if(!_)continue;let[b,y]=_;if(h==="characterData")o&&ee(y)&&Wo(m)&&pK(r,m,y)&&uK(m,y,t);else if(h==="childList"){c=!0;let x=f.addedNodes;for(let C=0;C<x.length;C++){let k=x[C],T=y1(k),w=k.parentNode;if(w!=null&&k!==l&&T===null&&!W_(k,w,t)){if(ss){let S=(yn(k)?k.innerText:null)||k.nodeValue;S&&(d+=S)}w.removeChild(k)}}let v=f.removedNodes,E=v.length;if(E>0){let C=0;for(let k=0;k<E;k++){let T=v[k];(W_(T,m,t)||l===T)&&(m.appendChild(T),C++)}E!==C&&i.set(b,y)}}}if(i.size>0)for(let[p,f]of i)f.reconcileObservedMutation(p,t);let u=n.takeRecords();if(u.length>0){for(let p=0;p<u.length;p++){let f=u[p],h=f.addedNodes,m=f.target;for(let _=0;_<h.length;_++){let b=h[_],y=b.parentNode;y==null||b.nodeName!=="BR"||W_(b,m,t)||y.removeChild(b)}}n.takeRecords()}r!==null&&(c&&In(r),ss&&k1(t)&&r.insertRawText(d))}))}finally{ib=!1}}function mN(t){let e=t._observer;e!==null&&gN(t,e.takeRecords(),e)}function _N(t){(function(e){Bb===0&&co(e).addEventListener("textInput",dK,!0)})(t),t._observer=new MutationObserver(((e,n)=>{gN(t,e,n)}))}var sb=class{constructor(e,n){this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||_K).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function hK(t,e){return new sb(t,e)}function cp(t,e,n="latest"){let o=(n==="latest"?t.getLatest():t).__state;return o?o.getValue(e):e.defaultValue}function gK(t,e,n){let o=cp(t,n,"direct"),r=cp(e,n,"direct");return n.isEqual(o,r)?null:[o,r]}function mK(t,e,n){let o;if(Ut(),typeof n=="function"){let i=t.getLatest(),s=cp(i,e);if(o=n(s),e.isEqual(s,o))return i}else o=n;let r=t.getWritable();return $b(r).updateFromKnown(e,o),r}function bN(t){let e=new Map,n=new Set;for(let o=typeof t=="function"?t:t.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=uy(o);if(r&&r.stateConfigs)for(let i of r.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&n.add(s.key)):s=i,e.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:e}}var ab=class t{constructor(e,n,o=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,c,d){let u=d.size;if(c)for(let p in c){let f=l.get(p);f&&d.has(f)||u++}return u})(s,o,r);this.size=a}getValue(e){let n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let o=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let r=this.unknownState[e.key];r!==void 0&&(o=e.parse(r)),this.updateFromKnown(e,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete e[o.key]:e[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in e&&(n[o]=e[o],delete e[o]);return vk(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new t(e,n,(function(i,s,a){let l;if(a)for(let[c,d]of Object.entries(a)){let u=i.get(c);u?s.has(u)||s.set(u,u.parse(d)):(l=l||{},l[c]=d)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(e,n){let o=e.key;this.sharedNodeState.sharedConfigMap.set(o,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&o in i||(i&&(delete i[o],this.unknownState=vk(i)),this.size++),r.set(e,n)}updateFromUnknown(e,n){let o=this.sharedNodeState.sharedConfigMap.get(e);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(let[o,r]of Object.entries(e))this.updateFromUnknown(o,r)}};function $b(t){let e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new ab(e,yN(e));return e.__state=n,n}function yN(t){return t.__state?t.__state.sharedNodeState:Qb(dy(),t.getType()).sharedNodeState}function vk(t){if(t)for(let e in t)return t}function _K(t){return t}function Ck(t,e,n){for(let[o,r]of e.knownState){if(t.has(o.key))continue;t.add(o.key);let i=n?n.getValue(o):o.defaultValue;if(i!==r&&!o.isEqual(i,r))return!0}return!1}function Ek(t,e,n){let{unknownState:o}=e,r=n?n.unknownState:void 0;if(o){for(let[i,s]of Object.entries(o))if(!t.has(i)&&(t.add(i),s!==(r?r[i]:void 0)))return!0}return!1}function wk(t,e){let n=t.__state;return n&&n.node===t?n.getWritable(e):n}function Tk(t,e){let n=t.__mode,o=t.__format,r=t.__style,i=e.__mode,s=e.__format,a=e.__style,l=t.__state,c=e.__state;return(n===null||n===i)&&(o===null||o===s)&&(r===null||r===a)&&(t.__state===null||l===c||(function(d,u){if(d===u)return!0;if(d&&u&&d.size!==u.size)return!1;let p=new Set;return!(d&&Ck(p,d,u)||u&&Ck(p,u,d)||d&&Ek(p,d,u)||u&&Ek(p,u,d))})(l,c))}function Sk(t,e){let n=t.mergeWithSibling(e),o=nt()._normalizedNodes;return o.add(t.__key),o.add(e.__key),n}function kk(t){let e,n,o=t;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(e=o.getPreviousSibling())!==null&&ee(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Tk(e,o)){o=Sk(e,o);break}break}e.remove()}for(;(n=o.getNextSibling())!==null&&ee(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(Tk(o,n)){o=Sk(o,n);break}break}n.remove()}}else o.remove()}function dp(t){return Nk(t.anchor),Nk(t.focus),t}function Nk(t){for(;t.type==="element";){let e=t.getNode(),n=t.offset,o,r;if(n===e.getChildrenSize()?(o=e.getChildAtIndex(n-1),r=!0):(o=e.getChildAtIndex(n),r=!1),ee(o)){t.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!U(o))break;t.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var li,bn,Cc,kp,lb,cb,ls,_o,db,Ec,Mt="",_n="",Ko=null,Uo="",Tr="",xN=!1,wc=!1,np=null;function up(t,e){let n=ls.get(t);if(e!==null){let o=fb(t);o.parentNode===e&&e.removeChild(o)}if(_o.has(t)||bn._keyToDOMMap.delete(t),U(n)){let o=fp(n,ls);ub(o,0,o.length-1,null)}n!==void 0&&sy(Ec,Cc,kp,n,"destroyed")}function ub(t,e,n,o){let r=e;for(;r<=n;++r){let i=t[r];i!==void 0&&up(i,o)}}function os(t,e){t.setProperty("text-align",e)}var bK="40px";function vN(t,e){let n=li.theme.indent;if(typeof n=="string"){let r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}let o=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||bK;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function CN(t,e){let n=t.style;e===0?os(n,""):e===Mb?os(n,"left"):e===Ab?os(n,"center"):e===Lb?os(n,"right"):e===Rb?os(n,"justify"):e===Pb?os(n,"start"):e===Fb&&os(n,"end")}function pp(t,e){let n=_o.get(t);n===void 0&&V(60);let o=n.createDOM(li,bn);if((function(r,i,s){let a=s._keyToDOMMap;(function(l,c,d){let u=`__lexicalKey_${c._key}`;l[u]=d})(i,s,r),a.set(r,i)})(t,o,bn),ee(n)?o.setAttribute("data-lexical-text","true"):Ye(n)&&o.setAttribute("data-lexical-decorator","true"),U(n)){let r=n.__indent,i=n.__size;if(r!==0&&vN(o,r),i!==0){let a=i-1;(function(l,c,d,u){let p=_n;_n="",pb(l,d,0,c,d.getDOMSlot(u)),wN(d,u),_n=p})(fp(n,_o),a,n,o)}let s=n.__format;s!==0&&CN(o,s),n.isInline()||EN(null,n,o),Lp(n)&&(Mt+=Or,Tr+=Or)}else{let r=n.getTextContent();if(Ye(n)){let i=n.decorate(bn,li);i!==null&&TN(t,i),o.contentEditable="false"}else ee(n)&&(n.isDirectionless()||(_n+=r));Mt+=r,Tr+=r}return e!==null&&e.insertChild(o),sy(Ec,Cc,kp,n,"created"),o}function pb(t,e,n,o,r){let i=Mt;Mt="";let s=n;for(;s<=o;++s){pp(t[s],r);let a=_o.get(t[s]);a!==null&&ee(a)&&(Ko===null&&(Ko=a.getFormat()),Uo===""&&(Uo=a.getStyle()))}Lp(e)&&(Mt+=Or),r.element.__lexicalTextContent=Mt,Mt=i+Mt}function Dk(t,e){if(t){let n=t.__last;if(n){let o=e.get(n);if(o)return is(o)?"line-break":Ye(o)&&o.isInline()?"decorator":null}return"empty"}return null}function EN(t,e,n){let o=Dk(t,ls),r=Dk(e,_o);o!==r&&e.getDOMSlot(n).setManagedLineBreak(r)}function wN(t,e){let n=e.__lexicalDirTextContent||"",o=e.__lexicalDir||"";if(n!==_n||o!==np){let r=_n==="",i=r?np:(function(s){return nK.test(s)?"rtl":oK.test(s)?"ltr":null})(_n);if(i!==o){let s=e.classList,a=li.theme,l=o!==null?a[o]:void 0,c=i!==null?a[i]:void 0;if(l!==void 0){if(typeof l=="string"){let d=lp(l);l=a[o]=d}s.remove(...l)}if(i===null||r&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){let d=lp(c);c=a[i]=d}c!==void 0&&s.add(...c)}e.dir=i}wc||(t.getWritable().__dir=i)}np=i,e.__lexicalDirTextContent=_n,e.__lexicalDir=i}}function yK(t,e,n){let o=_n;var r;_n="",Ko=null,Uo="",(function(i,s,a){let l=Mt,c=i.__size,d=s.__size;Mt="";let u=a.element;if(c===1&&d===1){let p=i.__first,f=s.__first;if(p===f)pc(p,u);else{let m=fb(p),_=pp(f,null);try{u.replaceChild(_,m)}catch(b){if(typeof b=="object"&&b!=null){let y=`${b.toString()} Parent: ${u.tagName}, new child: {tag: ${_.tagName} key: ${f}}, old child: {tag: ${m.tagName}, key: ${p}}.`;throw new Error(y)}throw b}up(p,null)}let h=_o.get(f);ee(h)&&(Ko===null&&(Ko=h.getFormat()),Uo===""&&(Uo=h.getStyle()))}else{let p=fp(i,ls),f=fp(s,_o);if(p.length!==c&&V(227),f.length!==d&&V(228),c===0)d!==0&&pb(f,s,0,d-1,a);else if(d===0){if(c!==0){let h=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;ub(p,0,c-1,h?null:u),h&&(u.textContent="")}}else(function(h,m,_,b,y,x){let v=b-1,E=y-1,C,k,T=x.getFirstChild(),w=0,S=0;for(;w<=v&&S<=E;){let O=m[w],M=_[S];if(O===M)T=G_(pc(M,x.element)),w++,S++;else{C===void 0&&(C=new Set(m)),k===void 0&&(k=new Set(_));let L=k.has(O),K=C.has(M);if(L)if(K){let W=La(bn,M);W===T?T=G_(pc(M,x.element)):(x.withBefore(T).insertChild(W),pc(M,x.element)),w++,S++}else pp(M,x.withBefore(T)),S++;else T=G_(fb(O)),up(O,x.element),w++}let I=_o.get(M);I!==null&&ee(I)&&(Ko===null&&(Ko=I.getFormat()),Uo===""&&(Uo=I.getStyle()))}let N=w>v,D=S>E;if(N&&!D){let O=_[E+1],M=O===void 0?null:bn.getElementByKey(O);pb(_,h,S,E,x.withBefore(M))}else D&&!N&&ub(m,w,v,x.element)})(s,p,f,c,d,a)}Lp(s)&&(Mt+=Or),u.__lexicalTextContent=Mt,Mt=l+Mt})(t,e,e.getDOMSlot(n)),wN(e,n),r=e,Ko==null||Ko===r.__textFormat||wc||r.setTextFormat(Ko),(function(i){Uo===""||Uo===i.__textStyle||wc||i.setTextStyle(Uo)})(e),_n=o}function fp(t,e){let n=[],o=t.__first;for(;o!==null;){let r=e.get(o);r===void 0&&V(101),n.push(o),o=r.__next}return n}function pc(t,e){let n=ls.get(t),o=_o.get(t);n!==void 0&&o!==void 0||V(61);let r=xN||cb.has(t)||lb.has(t),i=La(bn,t);if(n===o&&!r){if(U(n)){let s=i.__lexicalTextContent;s!==void 0&&(Mt+=s,Tr+=s);let a=i.__lexicalDirTextContent;a!==void 0&&(_n+=a)}else{let s=n.getTextContent();ee(n)&&!n.isDirectionless()&&(_n+=s),Tr+=s,Mt+=s}return i}if(n!==o&&r&&sy(Ec,Cc,kp,o,"updated"),o.updateDOM(n,i,li)){let s=pp(t,null);return e===null&&V(62),e.replaceChild(s,i),up(t,null),s}if(U(n)&&U(o)){let s=o.__indent;s!==n.__indent&&vN(i,s);let a=o.__format;a!==n.__format&&CN(i,a),r&&(yK(n,o,i),Nn(o)||o.isInline()||EN(n,o,i)),Lp(o)&&(Mt+=Or,Tr+=Or)}else{let s=o.getTextContent();if(Ye(o)){let a=o.decorate(bn,li);a!==null&&TN(t,a)}else ee(o)&&!o.isDirectionless()&&(_n+=s);Mt+=s,Tr+=s}if(!wc&&Nn(o)&&o.__cachedText!==Tr){let s=o.getWritable();s.__cachedText=Tr,o=s}return i}function TN(t,e){let n=bn._pendingDecorators,o=bn._decorators;if(n===null){if(o[t]===e)return;n=x1(bn)}n[t]=e}function G_(t){let e=t.nextSibling;return e!==null&&e===bn._blockCursorElement&&(e=e.nextSibling),e}function xK(t,e,n,o,r,i){Mt="",Tr="",_n="",xN=o===ka,np=null,bn=n,li=n._config,Cc=n._nodes,kp=bn._listeners.mutation,lb=r,cb=i,ls=t._nodeMap,_o=e._nodeMap,wc=e._readOnly,db=new Map(n._keyToDOMMap);let s=new Map;return Ec=s,pc("root",null),bn=void 0,Cc=void 0,lb=void 0,cb=void 0,ls=void 0,_o=void 0,li=void 0,db=void 0,Ec=void 0,s}function fb(t){let e=db.get(t);return e===void 0&&V(75,t),e}function xe(t){return{type:t}}var zb=xe("SELECTION_CHANGE_COMMAND"),vK=xe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),SN=xe("CLICK_COMMAND"),Tc=xe("DELETE_CHARACTER_COMMAND"),fc=xe("INSERT_LINE_BREAK_COMMAND"),hb=xe("INSERT_PARAGRAPH_COMMAND"),Ea=xe("CONTROLLED_TEXT_INSERTION_COMMAND"),Hb=xe("PASTE_COMMAND"),gb=xe("REMOVE_TEXT_COMMAND"),Sc=xe("DELETE_WORD_COMMAND"),kc=xe("DELETE_LINE_COMMAND"),ri=xe("FORMAT_TEXT_COMMAND"),Kb=xe("UNDO_COMMAND"),Ub=xe("REDO_COMMAND"),kN=xe("KEYDOWN_COMMAND"),NN=xe("KEY_ARROW_RIGHT_COMMAND"),DN=xe("MOVE_TO_END"),ON=xe("KEY_ARROW_LEFT_COMMAND"),IN=xe("MOVE_TO_START"),MN=xe("KEY_ARROW_UP_COMMAND"),AN=xe("KEY_ARROW_DOWN_COMMAND"),hp=xe("KEY_ENTER_COMMAND"),LN=xe("KEY_SPACE_COMMAND"),RN=xe("KEY_BACKSPACE_COMMAND"),PN=xe("KEY_ESCAPE_COMMAND"),FN=xe("KEY_DELETE_COMMAND"),BN=xe("KEY_TAB_COMMAND"),CK=xe("INSERT_TAB_COMMAND"),EK=xe("INDENT_CONTENT_COMMAND"),wK=xe("OUTDENT_CONTENT_COMMAND"),$N=xe("DROP_COMMAND"),TK=xe("FORMAT_ELEMENT_COMMAND"),zN=xe("DRAGSTART_COMMAND"),HN=xe("DRAGOVER_COMMAND"),KN=xe("DRAGEND_COMMAND"),jb=xe("COPY_COMMAND"),Vb=xe("CUT_COMMAND"),mb=xe("SELECT_ALL_COMMAND"),SK=xe("CLEAR_EDITOR_COMMAND"),kK=xe("CLEAR_HISTORY_COMMAND"),NK=xe("CAN_REDO_COMMAND"),DK=xe("CAN_UNDO_COMMAND"),UN=xe("FOCUS_COMMAND"),jN=xe("BLUR_COMMAND"),VN=xe("KEY_MODIFIER_COMMAND"),vr=Object.freeze({}),_b=30,bb=[["keydown",function(t,e){if(hc=t.timeStamp,WN=t.key,!e.isComposing()&&!J(e,kN,t)&&t.key!=null){if(Y_&&oN(t))return Yn(e,(()=>{Ju(e,q_)})),Y_=!1,void(q_="");if((function(n){return je(n,"ArrowRight",{shiftKey:"any"})})(t))J(e,NN,t);else if((function(n){return je(n,"ArrowRight",Er)})(t))J(e,DN,t);else if((function(n){return je(n,"ArrowLeft",{shiftKey:"any"})})(t))J(e,ON,t);else if((function(n){return je(n,"ArrowLeft",Er)})(t))J(e,IN,t);else if((function(n){return je(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(t))J(e,MN,t);else if((function(n){return je(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(t))J(e,AN,t);else if((function(n){return je(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(t))gc=!0,J(e,hp,t);else if((function(n){return n.key===" "})(t))J(e,LN,t);else if((function(n){return jo&&je(n,"o",{ctrlKey:!0})})(t))t.preventDefault(),gc=!0,J(e,fc,!0);else if((function(n){return je(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(t))gc=!1,J(e,hp,t);else if((function(n){return je(n,"Backspace",{shiftKey:"any"})||jo&&je(n,"h",{ctrlKey:!0})})(t))oN(t)?J(e,RN,t):(t.preventDefault(),J(e,Tc,!0));else if((function(n){return n.key==="Escape"})(t))J(e,PN,t);else if((function(n){return je(n,"Delete",{})||jo&&je(n,"d",{ctrlKey:!0})})(t))(function(n){return n.key==="Delete"})(t)?J(e,FN,t):(t.preventDefault(),J(e,Tc,!1));else if((function(n){return je(n,"Backspace",nN)})(t))t.preventDefault(),J(e,Sc,!0);else if((function(n){return je(n,"Delete",nN)})(t))t.preventDefault(),J(e,Sc,!1);else if((function(n){return jo&&je(n,"Backspace",{metaKey:!0})})(t))t.preventDefault(),J(e,kc,!0);else if((function(n){return jo&&(je(n,"Delete",{metaKey:!0})||je(n,"k",{ctrlKey:!0}))})(t))t.preventDefault(),J(e,kc,!1);else if((function(n){return je(n,"b",Er)})(t))t.preventDefault(),J(e,ri,"bold");else if((function(n){return je(n,"u",Er)})(t))t.preventDefault(),J(e,ri,"underline");else if((function(n){return je(n,"i",Er)})(t))t.preventDefault(),J(e,ri,"italic");else if((function(n){return je(n,"Tab",{shiftKey:"any"})})(t))J(e,BN,t);else if((function(n){return je(n,"z",Er)})(t))t.preventDefault(),J(e,Kb,void 0);else if((function(n){return jo?je(n,"z",{metaKey:!0,shiftKey:!0}):je(n,"y",{ctrlKey:!0})||je(n,"z",{ctrlKey:!0,shiftKey:!0})})(t))t.preventDefault(),J(e,Ub,void 0);else{let n=e._editorState._selection;n===null||de(n)?rN(t)&&(t.preventDefault(),J(e,mb,t)):(function(o){return je(o,"c",Er)})(t)?(t.preventDefault(),J(e,jb,t)):(function(o){return je(o,"x",Er)})(t)?(t.preventDefault(),J(e,Vb,t)):rN(t)&&(t.preventDefault(),J(e,mb,t))}(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(t)&&J(e,VN,t)}}],["pointerdown",function(t,e){let n=t.target,o=t.pointerType;Ha(n)&&o!=="touch"&&o!=="pen"&&t.button===0&&Yn(e,(()=>{Qk(n)||(xb=!0)}))}],["compositionstart",function(t,e){Yn(e,(()=>{let n=Pe();if(de(n)&&!e.isComposing()){let o=n.anchor,r=n.anchor.getNode();jt(o.key),(t.timeStamp<hc+_b||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||ee(r)&&r.getStyle()!==n.style)&&J(e,Ea,tK)}}))}],["compositionend",function(t,e){ss?dc=!0:Sa||!yc&&!ap?Yn(e,(()=>{Ju(e,t.data)})):(Y_=!0,q_=t.data)}],["input",function(t,e){t.stopPropagation(),Yn(e,(()=>{if(yn(t.target)&&Qk(t.target))return;let n=Pe(),o=t.data,r=JN(t);if(o!=null&&de(n)&&qN(n,r,o,t.timeStamp,!1)){dc&&(Ju(e,o),dc=!1);let i=n.anchor.getNode(),s=Vo(co(e));if(s===null)return;let a=n.isBackward(),l=a?n.anchor.offset:n.focus.offset,c=a?n.focus.offset:n.anchor.offset;sp&&!n.isCollapsed()&&ee(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,l)+o+i.getTextContent().slice(l+c)===w1(s.anchorNode)||J(e,Ea,o);let d=o.length;ss&&d>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(n.anchor.offset-=d),yc||Sa||ap||!e.isComposing()||(hc=0,jt(null))}else ry(!1,e,o!==null?o:void 0),dc&&(Ju(e,o||void 0),dc=!1);(function(){Ut();let i=nt();mN(i)})()}),{event:t}),va=null}],["click",function(t,e){Yn(e,(()=>{let n=Pe(),o=Vo(co(e)),r=hs();if(o){if(de(n)){let i=n.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&n.isCollapsed()&&!Nn(s)&&On().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(t.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let a=(function(l,c){let d=l;for(;d!==On()&&d!=null;){if(c(d))return d;d=d.getParent()}return null})(s,(l=>U(l)&&!l.isInline()));U(a)&&a.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=o.anchorNode;(yn(i)||Wo(i))&&In(Op(r,o,e,t))}}J(e,SN,t)}))}],["cut",vr],["copy",vr],["dragstart",vr],["dragover",vr],["dragend",vr],["paste",vr],["focus",vr],["blur",vr],["drop",vr]];sp&&bb.push(["beforeinput",(t,e)=>(function(n,o){let r=n.inputType,i=JN(n);r==="deleteCompositionText"||ss&&k1(o)||r!=="insertCompositionText"&&Yn(o,(()=>{let s=Pe();if(r==="deleteContentBackward"){if(s===null){let f=hs();if(!de(f))return;In(f.clone())}if(de(s)){let f=s.anchor.key===s.focus.key;if(a=n.timeStamp,WN==="MediaLast"&&a<hc+_b&&o.isComposing()&&f){if(jt(null),hc=0,setTimeout((()=>{Yn(o,(()=>{jt(null)}))}),_b),de(s)){let h=s.anchor.getNode();h.markDirty(),ee(h)||V(142),XN(s,h)}}else{jt(null),n.preventDefault();let h=s.anchor.getNode(),m=h.getTextContent(),_=h.canInsertTextAfter(),b=s.anchor.offset===0&&s.focus.offset===m.length,y=bk&&f&&!b&&_;if(y&&s.isCollapsed()&&(y=!Ye(S1(s.anchor,!0))),!y){J(o,Tc,!0);let x=Pe();bk&&de(x)&&x.isCollapsed()&&(rs=x,setTimeout((()=>rs=null)))}}return}}var a;if(!de(s))return;let l=n.data;va!==null&&ry(!1,o,va),s.dirty&&va===null||!s.isCollapsed()||Nn(s.anchor.getNode())||i===null||s.applyDOMRange(i),va=null;let c=s.anchor,d=s.focus,u=c.getNode(),p=d.getNode();if(r!=="insertText"&&r!=="insertTranspose")switch(n.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":J(o,Ea,n);break;case"insertFromComposition":jt(null),J(o,Ea,n);break;case"insertLineBreak":jt(null),J(o,fc,!1);break;case"insertParagraph":jt(null),gc&&!Sa?(gc=!1,J(o,fc,!1)):J(o,hb,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":J(o,Hb,n);break;case"deleteByComposition":(function(f,h){return f!==h||U(f)||U(h)||!si(f)||!si(h)})(u,p)&&J(o,gb,n);break;case"deleteByDrag":case"deleteByCut":J(o,gb,n);break;case"deleteContent":J(o,Tc,!1);break;case"deleteWordBackward":J(o,Sc,!0);break;case"deleteWordForward":J(o,Sc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":J(o,kc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":J(o,kc,!1);break;case"formatStrikeThrough":J(o,ri,"strikethrough");break;case"formatBold":J(o,ri,"bold");break;case"formatItalic":J(o,ri,"italic");break;case"formatUnderline":J(o,ri,"underline");break;case"historyUndo":J(o,Kb,void 0);break;case"historyRedo":J(o,Ub,void 0)}else{if(l===`
106
+ `)n.preventDefault(),J(o,fc,!1);else if(l===Or)n.preventDefault(),J(o,hb,void 0);else if(l==null&&n.dataTransfer){let f=n.dataTransfer.getData("text/plain");n.preventDefault(),s.insertRawText(f)}else l!=null&&qN(s,i,l,n.timeStamp,!0)?(n.preventDefault(),J(o,Ea,l)):va=l;GN=n.timeStamp}}))})(t,e)]);var hc=0,WN=null,GN=0,va=null,gp=new WeakMap,yb=!1,xb=!1,gc=!1,dc=!1,Y_=!1,q_="",rs=null,YN=[0,"",0,"root",0];function qN(t,e,n,o,r){let i=t.anchor,s=t.focus,a=i.getNode(),l=nt(),c=Vo(co(l)),d=c!==null?c.anchorNode:null,u=i.key,p=l.getElementByKey(u),f=n.length;return u!==s.key||!ee(a)||(!r&&(!sp||GN<o+50)||a.isDirty()&&f<2||C1(n))&&i.offset!==s.offset&&!a.isComposing()||wr(a)||a.isDirty()&&f>1||(r||!sp)&&p!==null&&!a.isComposing()&&d!==us(p)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||a.getFormat()!==t.format||a.getStyle()!==t.style||(function(h,m){if(m.isSegmented())return!0;if(!h.isCollapsed())return!1;let _=h.anchor.offset,b=m.getParentOrThrow(),y=si(m);return _===0?!m.canInsertTextBefore()||!b.canInsertTextBefore()&&!m.isComposing()||y||(function(x){let v=x.getPreviousSibling();return(ee(v)||U(v)&&v.isInline())&&!v.canInsertTextAfter()})(m):_===m.getTextContentSize()&&(!m.canInsertTextAfter()||!b.canInsertTextAfter()&&!m.isComposing()||y)})(t,a)}function Ok(t,e){return Wo(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function Ik(t,e,n){let{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}=t;yb&&(yb=!1,Ok(o,r)&&Ok(i,s)&&!rs)||Yn(e,(()=>{if(!n)return void In(null);if(!Oc(e,o,i))return;let a=Pe();if(rs&&de(a)&&a.isCollapsed()){let l=a.anchor,c=rs.anchor;(l.key===c.key&&l.offset===c.offset+1||l.offset===1&&c.getNode().is(l.getNode().getPreviousSibling()))&&(a=rs.clone(),In(a))}if(rs=null,de(a)){let l=a.anchor,c=l.getNode();if(a.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(a.dirty=!0);let d=co(e).event,u=d?d.timeStamp:performance.now(),[p,f,h,m,_]=YN,b=On(),y=e.isComposing()===!1&&b.getTextContent()==="";if(u<_+200&&l.offset===h&&l.key===m)op(a,p,f);else if(l.type==="text")ee(c)||V(141),XN(a,c);else if(l.type==="element"&&!y){U(c)||V(259);let x=l.getNode();x.isEmpty()?(function(v,E){let C=E.getTextFormat(),k=E.getTextStyle();op(v,C,k)})(a,x):op(a,0,"")}}else{let d=l.key,u=a.focus.key,p=a.getNodes(),f=p.length,h=a.isBackward(),m=h?s:r,_=h?r:s,b=h?u:d,y=h?d:u,x=uN,v=!1;for(let E=0;E<f;E++){let C=p[E],k=C.getTextContentSize();if(ee(C)&&k!==0&&!(E===0&&C.__key===b&&m===k||E===f-1&&C.__key===y&&_===0)&&(v=!0,x&=C.getFormat(),x===0))break}a.format=v?x:0}}J(e,zb,void 0)}))}function op(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function XN(t,e){op(t,e.getFormat(),e.getStyle())}function JN(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function Ju(t,e){let n=t._compositionKey;if(jt(null),n!==null&&e!=null){if(e===""){let o=At(n),r=us(t.getElementByKey(n));return void(r!==null&&r.nodeValue!==null&&ee(o)&&iy(o,r.nodeValue,null,null,!0))}if(e[e.length-1]===`
107
+ `){let o=Pe();if(de(o)){let r=o.focus;return o.anchor.set(r.key,r.offset,r.type),void J(t,hp,null)}}}ry(!0,t,e)}function ZN(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var wa=new Map;function QN(t){let e=M1(t.target);if(e===null)return;let n=ny(e.anchorNode);if(n===null)return;xb&&(xb=!1,Yn(n,(()=>{let l=hs(),c=e.anchorNode;(yn(c)||Wo(c))&&In(Op(l,e,n,t))})));let o=oy(n),r=o[o.length-1],i=r._key,s=wa.get(i),a=s||r;a!==n&&Ik(e,a,!1),Ik(e,n,!0),n!==r?wa.set(i,n):s&&wa.delete(i)}function Mk(t){t._lexicalHandled=!0}function Ak(t){return t._lexicalHandled===!0}var OK=()=>{};function IK(t){let e=t.ownerDocument,n=gp.get(e);if(n===void 0)return void OK();let o=n-1;o>=0||V(164),gp.set(e,o),o===0&&e.removeEventListener("selectionchange",QN);let r=Ic(t);Ip(r)?((function(s){if(s._parentEditor!==null){let a=oy(s),l=a[a.length-1]._key;wa.get(l)===s&&wa.delete(l)}else wa.delete(s._key)})(r),t.__lexicalEditor=null):r&&V(198);let i=ZN(t);for(let s=0;s<i.length;s++)i[s]();t.__lexicalEventHandles=[]}function vb(t,e,n){Ut();let o=t.__key,r=t.getParent();if(r===null)return;let i=(function(a){let l=Pe();if(!de(l)||!U(a))return l;let{anchor:c,focus:d}=l,u=c.getNode(),p=d.getNode();return Ep(u,a)&&c.set(a.__key,0,"element"),Ep(p,a)&&d.set(a.__key,0,"element"),l})(t),s=!1;if(de(i)&&e){let a=i.anchor,l=i.focus;a.key===o&&(bp(a,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0),l.key===o&&(bp(l,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else Dp(i)&&e&&t.isSelected()&&t.selectPrevious();if(de(i)&&e&&!s){let a=t.getIndexWithinParent();ai(t),_p(i,r,a,-1)}else ai(t);n||xo(r)||r.canBeEmpty()||!r.isEmpty()||vb(r,e),e&&i&&Nn(r)&&r.isEmpty()&&r.selectEnd()}function MK(t){return t}var ci=class{static getType(){let{ownNodeType:e}=uy(this);return e===void 0&&V(64,this.name),e}static clone(e){V(65,this.name)}$config(){return{}}config(e,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:e}),{[e]:n}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),b1(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let n=At(e);if(n===null)break;e=n.__parent}return!1}isSelected(e){let n=e||Pe();if(n==null)return!1;let o=n.getNodes().some((r=>r.__key===this.__key));if(ee(this))return o;if(de(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Ye(this)&&this.isInline()&&r){let i=n.isBackward()?n.focus:n.anchor;if(r.is(i.getNode())&&i.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:At(e)}getParentOrThrow(){let e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let n=e.getParent();if(xo(n))return U(e)||e===this&&Ye(e)||V(194),e;e=n}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){let e=[],n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){let e=[],n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:At(e)}getPreviousSiblings(){let e=[],n=this.getParent();if(n===null)return e;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:At(e)}getNextSiblings(){let e=[],n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){let n=U(this)?this:this.getParent(),o=U(e)?e:e.getParent(),r=n&&o?_c(n,o):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let n=_c(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?my(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&V(279),!1)))}isParentOf(e){let n=_c(this,e);return n!==null&&n.type==="ancestor"}getNodesBetween(e){let n=this.isBefore(e),o=[],r=new Set,i=this;for(;i!==null;){let s=i.__key;if(r.has(s)||(r.add(s),o.push(i)),i===e)break;let a=U(i)?n?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}let l=n?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||o.push(c),c===e)break;let d=null,u=c;do{if(u===null&&V(68),d=n?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;d!==null||r.has(u.__key)||o.push(u)}while(d===null);i=d}return n||o.reverse(),o}isDirty(){let e=nt()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=At(this.__key);return e===null&&V(113),e}getWritable(){Ut();let e=Mr(),n=nt(),o=e._nodeMap,r=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,a=Pe();if(a!==null&&a.setCachedNodes(null),s.has(r))return Cp(i),i;let l=R1(i);return s.add(r),Cp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){V(70)}updateDOM(e,n,o){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){V(18,this.name)}updateFromJSON(e){return(function(n,o){let r=n.getWritable(),i=o.$,s=i;for(let a of yN(r).flatKeys)a in o&&(s!==void 0&&s!==i||(s={...i}),s[a]=o[a]);return(r.__state||s)&&$b(n).updateFromJSON(s),r})(this,e)}static transform(){return null}remove(e){vb(this,!0,e)}replace(e,n){Ut();let o=Pe();o!==null&&(o=o.clone()),tb(this,e);let r=this.getLatest(),i=this.__key,s=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;ai(a);let d=r.getPreviousSibling(),u=r.getNextSibling(),p=r.__prev,f=r.__next,h=r.__parent;if(vb(r,!1,!0),d===null?l.__first=s:d.getWritable().__next=s,a.__prev=p,u===null?l.__last=s:u.getWritable().__prev=s,a.__next=f,a.__parent=h,l.__size=c,n&&(U(this)&&U(a)||V(139),this.getChildren().forEach((m=>{a.append(m)}))),de(o)){In(o);let m=o.anchor,_=o.focus;m.key===i&&Fk(m,a),_.key===i&&Fk(_,a)}return ii()===i&&jt(s),a}insertAfter(e,n=!0){Ut(),tb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=Pe(),a=!1,l=!1;if(i!==null){let f=e.getIndexWithinParent();if(ai(r),de(s)){let h=i.__key,m=s.anchor,_=s.focus;a=m.type==="element"&&m.key===h&&m.offset===f+1,l=_.type==="element"&&_.key===h&&_.offset===f+1}}let c=this.getNextSibling(),d=this.getParentOrThrow().getWritable(),u=r.__key,p=o.__next;if(c===null?d.__last=u:c.getWritable().__prev=u,d.__size++,o.__next=u,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&de(s)){let f=this.getIndexWithinParent();_p(s,d,f+1);let h=d.__key;a&&s.anchor.set(h,f+2,"element"),l&&s.focus.set(h,f+2,"element")}return e}insertBefore(e,n=!0){Ut(),tb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.__key;ai(r);let s=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=o.__prev,c=this.getIndexWithinParent();s===null?a.__first=i:s.getWritable().__next=i,a.__size++,o.__prev=i,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let d=Pe();return n&&de(d)&&_p(d,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return Nr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){Ut();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(U(o))return o.select();if(!ee(o)){let i=o.getIndexWithinParent()+1;return r.select(i,i)}return o.select(e,n)}selectNext(e,n){Ut();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(U(o))return o.select(0,0);if(!ee(o)){let i=o.getIndexWithinParent();return r.select(i,i)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}},Na=class t extends ci{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
108
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(n){let o=n.parentElement;if(o!==null&&kb(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Zu(r)){let i=o.lastChild;if(i===n||i.previousSibling===n&&Zu(i))return!0}}return!1})(e)||(function(n){let o=n.parentElement;if(o!==null&&kb(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Zu(r))return!1;let i=o.lastChild;if(i===n||i.previousSibling===n&&Zu(i))return!0}return!1})(e)?null:{conversion:AK,priority:0}}}static importJSON(e){return Da().updateFromJSON(e)}};function AK(t){return{node:Da()}}function Da(){return Ac(new Na)}function is(t){return t instanceof Na}function Zu(t){return Wo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function X_(t,e){return 16&e?"code":e&Tp?"mark":32&e?"sub":64&e?"sup":null}function J_(t,e){return 1&e?"strong":2&e?"em":"span"}function e1(t,e,n,o,r){let i=o.classList,s=Ta(r,"base");s!==void 0&&i.add(...s),s=Ta(r,"underlineStrikethrough");let a=!1,l=e&vc&&e&xc;s!==void 0&&(n&vc&&n&xc?(a=!0,l||i.add(...s)):l&&i.remove(...s));for(let c in ln){let d=ln[c];if(s=Ta(r,c),s!==void 0)if(n&d){if(a&&(c==="underline"||c==="strikethrough")){e&d&&i.remove(...s);continue}e&d&&(!l||c!=="underline")&&c!=="strikethrough"||i.add(...s)}else e&d&&i.remove(...s)}}function t1(t,e,n){let o=e.firstChild,r=n.isComposing(),i=t+(r?Sp:"");if(o==null)e.textContent=i;else{let s=o.nodeValue;if(s!==i)if(r||ss){let[a,l,c]=(function(d,u){let p=d.length,f=u.length,h=0,m=0;for(;h<p&&h<f&&d[h]===u[h];)h++;for(;m+h<p&&m+h<f&&d[p-m-1]===u[f-m-1];)m++;return[h,p-h-m,u.slice(h,f-m)]})(s,i);l!==0&&o.deleteData(a,l),o.insertData(a,c)}else o.nodeValue=i}}function Lk(t,e,n,o,r,i){t1(r,t,e);let s=i.theme.text;s!==void 0&&e1(0,0,o,t,s)}function Qu(t,e){let n=document.createElement(e);return n.appendChild(t),n}var cs=class t extends ci{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",n){super(n),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return aK[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ii()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let n=ln[e];return!!(this.getFormat()&n)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,n){return vp(this.getLatest().__format,e,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,n){let o=this.__format,r=X_(0,o),i=J_(0,o),s=r===null?i:r,a=document.createElement(s),l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(i),a.appendChild(l)),Lk(l,this,0,o,this.__text,e);let c=this.__style;return c!==""&&(a.style.cssText=c),a}updateDOM(e,n,o){let r=this.__text,i=e.__format,s=this.__format,a=X_(0,i),l=X_(0,s),c=J_(0,i),d=J_(0,s);if((a===null?c:a)!==(l===null?d:l))return!0;if(a===l&&c!==d){let m=n.firstChild;m==null&&V(48);let _=document.createElement(d);return Lk(_,this,0,s,r,o),n.replaceChild(_,m),!1}let u=n;l!==null&&a!==null&&(u=n.firstChild,u==null&&V(49)),t1(r,u,this);let p=o.theme.text;p!==void 0&&i!==s&&e1(0,i,s,u,p);let f=e.__style,h=this.__style;return f!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:FK,priority:0}),b:()=>({conversion:RK,priority:0}),code:()=>({conversion:Cr,priority:0}),em:()=>({conversion:Cr,priority:0}),i:()=>({conversion:Cr,priority:0}),mark:()=>({conversion:Cr,priority:0}),s:()=>({conversion:Cr,priority:0}),span:()=>({conversion:LK,priority:0}),strong:()=>({conversion:Cr,priority:0}),sub:()=>({conversion:Cr,priority:0}),sup:()=>({conversion:Cr,priority:0}),u:()=>({conversion:Cr,priority:0})}}static importJSON(e){return Kt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return yn(n)||V(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Qu(n,"b")),this.hasFormat("italic")&&(n=Qu(n,"i")),this.hasFormat("strikethrough")&&(n=Qu(n,"s")),this.hasFormat("underline")&&(n=Qu(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,n){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?ln[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?rK[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){let n=vp(this.getFormat(),e,null);return this.setFormat(n)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let n=sK[e];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(e){if(this.__text===e)return this;let n=this.getWritable();return n.__text=e,n}select(e,n){Ut();let o=e,r=n,i=Pe(),s=this.getTextContent(),a=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!de(i))return r1(a,o,a,r,"text","text");{let l=ii();l!==i.anchor.key&&l!==i.focus.key||jt(a),i.setTextNodeRange(this,o,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,n,o,r){let i=this.getWritable(),s=i.__text,a=o.length,l=e;l<0&&(l=a+l,l<0&&(l=0));let c=Pe();if(r&&de(c)){let u=e+a;c.setTextNodeRange(i,u,i,u)}let d=s.slice(0,l)+o+s.slice(l+n);return i.__text=d,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Ut();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,i=ii(),s=o.length;e.sort(((T,w)=>T-w)),e.push(s);let a=[],l=e.length;for(let T=0,w=0;T<s&&w<=l;w++){let S=e[w];S>T&&(a.push(o.slice(T,S)),T=S)}let c=a.length;if(c===1)return[n];let d=a[0],u=n.getParent(),p,f=n.getFormat(),h=n.getStyle(),m=n.__detail,_=!1,b=null,y=null,x=Pe();if(de(x)){let[T,w]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];T.type==="text"&&T.key===r&&(b=T),w.type==="text"&&w.key===r&&(y=w)}n.isSegmented()?(p=Kt(d),p.__format=f,p.__style=h,p.__detail=m,p.__state=wk(n,p),_=!0):p=n.setTextContent(d);let v=[p];for(let T=1;T<c;T++){let w=Kt(a[T]);w.__format=f,w.__style=h,w.__detail=m,w.__state=wk(n,w);let S=w.__key;i===r&&jt(S),v.push(w)}let E=b?b.offset:null,C=y?y.offset:null,k=0;for(let T of v){if(!b&&!y)break;let w=k+T.getTextContentSize();if(b!==null&&E!==null&&E<=w&&E>=k&&(b.set(T.getKey(),E-k,"text"),E<w&&(b=null)),y!==null&&C!==null&&C<=w&&C>=k){y.set(T.getKey(),C-k,"text");break}k=w}if(u!==null){(function(S){let N=S.getPreviousSibling(),D=S.getNextSibling();N!==null&&Cp(N),D!==null&&Cp(D)})(this);let T=u.getWritable(),w=this.getIndexWithinParent();_?(T.splice(w,0,v),this.remove()):T.splice(w,1,v),de(x)&&_p(x,u,w,c-1)}return v}mergeWithSibling(e){let n=e===this.getPreviousSibling();n||e===this.getNextSibling()||V(50);let o=this.__key,r=e.__key,i=this.__text,s=i.length;ii()===r&&jt(o);let a=Pe();if(de(a)){let u=a.anchor,p=a.focus;u!==null&&u.key===r&&jk(u,n,o,e,s),p!==null&&p.key===r&&jk(p,n,o,e,s)}let l=e.__text,c=n?l+i:i+l;this.setTextContent(c);let d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function LK(t){return{forChild:Wb(t.style),node:null}}function RK(t){let e=t,n=e.style.fontWeight==="normal";return{forChild:Wb(e.style,n?void 0:"bold"),node:null}}var Rk=new WeakMap;function PK(t){if(!yn(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function FK(t){let e=t;t.parentElement===null&&V(129);let n=e.textContent||"";if((function(o){let r,i=o.parentNode,s=[o];for(;i!==null&&(r=Rk.get(i))===void 0&&!PK(i);)s.push(i),i=i.parentNode;let a=r===void 0?i:r;for(let l=0;l<s.length;l++)Rk.set(s[l],a);return a})(e)!==null){let o=n.split(/(\r?\n|\t)/),r=[],i=o.length;for(let s=0;s<i;s++){let a=o[s];a===`
109
+ `||a===`\r
110
+ `?r.push(Da()):a===" "?r.push(Np()):a!==""&&r.push(Kt(a))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=e,r=!0;for(;o!==null&&(o=Pk(o,!1))!==null;){let i=o.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=e,r=!0;for(;o!==null&&(o=Pk(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Kt(n)}}function Pk(t,e){let n=t;for(;;){let o;for(;(o=e?n.nextSibling:n.previousSibling)===null;){let i=n.parentElement;if(i===null)return null;n=i}if(n=o,yn(n)){let i=n.style.display;if(i===""&&!L1(n)||i!==""&&!i.startsWith("inline"))return null}let r=n;for(;(r=e?n.firstChild:n.lastChild)!==null;)n=r;if(Wo(n))return n;if(n.nodeName==="BR")return null}}var BK={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Cr(t){let e=BK[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Wb(t.style,e),node:null}}function Kt(t=""){return Ac(new cs(t))}function ee(t){return t instanceof cs}function Wb(t,e){let n=t.fontWeight,o=t.textDecoration.split(" "),r=n==="700"||n==="bold",i=o.includes("line-through"),s=t.fontStyle==="italic",a=o.includes("underline"),l=t.verticalAlign;return c=>(ee(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),a&&!c.hasFormat("underline")&&c.toggleFormat("underline"),l!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),l!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}var Oa=class t extends cs{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let n=super.createDOM(e),o=Ta(e.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(e){return Np().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&V(126),super.setTextContent(" ")}spliceText(e,n,o,r){return o===""&&n===0||o===" "&&n===1||V(286),this}setDetail(e){return e!==2&&V(127),this}setMode(e){return e!=="normal"&&V(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Np(){return Ac(new Oa)}function Gb(t){return t instanceof Oa}var Cb=class{constructor(e,n,o){this._selection=null,this.key=e,this.offset=n,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:gy(mo(fi(this,"next")),mo(fi(e,"next")))<0}getNode(){let e=At(this.key);return e===null&&V(20),e}set(e,n,o,r){let i=this._selection,s=this.key;r&&this.key===e&&this.offset===n&&this.type===o||(this.key=e,this.offset=n,this.type=o,za()||(ii()===s&&jt(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function yo(t,e,n){return new Cb(t,e,n)}function Z_(t,e){let n=e.__key,o=t.offset,r="element";if(ee(e)){r="text";let i=e.getTextContentSize();o>i&&(o=i)}else if(!U(e)){let i=e.getNextSibling();if(ee(i))n=i.__key,o=0,r="text";else{let s=e.getParent();s&&(n=s.__key,o=e.getIndexWithinParent()+1)}}t.set(n,o,r)}function Fk(t,e){if(U(e)){let n=e.getLastDescendant();U(n)||ee(n)?Z_(t,n):Z_(t,e)}else Z_(t,e)}var mp=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Dp(e))return!1;let n=this._nodes,o=e._nodes;return n.size===o.size&&Array.from(n).every((r=>o.has(r)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let n=this.getNodes(),o=n.length,r=n[o-1],i;if(ee(r))i=r.select();else{let s=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=this._nodes,o=[];for(let r of n){let i=At(r);i!==null&&o.push(i)}return za()||(this._cachedNodes=o),o}getTextContent(){let e=this.getNodes(),n="";for(let o=0;o<e.length;o++)n+=e[o].getTextContent();return n}deleteNodes(){let e=this.getNodes();if((Pe()||hs())===this&&e[0]){let n=Gt(e[0],"next");z1(pi(n,n))}for(let n of e)n.remove()}};function de(t){return t instanceof ds}var ds=class t{constructor(e,n,o,r){this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!de(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=(function(o){let r=[],[i,s]=o.getTextSlices();i&&r.push(i.caret.origin);let a=new Set,l=new Set;for(let c of o)if(bo(c)){let{origin:d}=c;r.length===0?a.add(d):(l.add(d),r.push(d))}else{let{origin:d}=c;U(d)&&l.has(d)||r.push(d)}if(s&&r.push(s.caret.origin),ps(o.focus)&&U(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let c=Ir(o.focus.origin,"previous");bo(c)&&a.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=Ba(c))a.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!U(c)||l.has(c)||c.isEmpty()||a.has(c))break;r.pop()}if(r.length===0&&o.isCollapsed()){let c=mo(o.anchor),d=mo(o.anchor.getFlipped()),u=f=>Dr(f)?f.origin:f.getNodeAtCaret(),p=u(c)||u(d)||(o.anchor.getNodeAtCaret()?c.origin:d.origin);r.push(p)}return r})(_y(Ib(this),"next"));return za()||(this._cachedNodes=n),n}setTextNodeRange(e,n,o,r){this.anchor.set(e.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let n=e[0],o=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[a,l]=Eb(this),c="",d=!0;for(let u=0;u<e.length;u++){let p=e[u];if(U(p)&&!p.isInline())d||(c+=`
111
+ `),d=!p.isEmpty();else if(d=!1,ee(p)){let f=p.getTextContent();p===n?p===o?r.type==="element"&&i.type==="element"&&i.offset!==r.offset||(f=a<l?f.slice(a,l):f.slice(l,a)):f=s?f.slice(a):f.slice(l):p===o&&(f=s?f.slice(0,l):f.slice(0,a)),c+=f}else!Ye(p)&&!is(p)||p===o&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(e){let n=nt(),o=n.getEditorState()._selection,r=o1(e.startContainer,e.startOffset,e.endContainer,e.endOffset,n,o);if(r===null)return;let[i,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),dp(this)}clone(){let e=this.anchor,n=this.focus;return new t(yo(e.key,e.offset,e.type),yo(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=vp(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let n=ln[e];return!!(this.format&n)}insertRawText(e){let n=e.split(/(\r?\n|\t)/),o=[],r=n.length;for(let i=0;i<r;i++){let s=n[i];s===`
112
+ `||s===`\r
113
+ `?o.push(Da()):s===" "?o.push(Np()):o.push(Kt(s))}this.insertNodes(o)}insertText(e){let n=this.anchor,o=this.focus,r=this.format,i=this.style,s=n,a=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,a=n),s.type==="element"&&(function(_,b,y,x){let v=_.getNode(),E=v.getChildAtIndex(_.offset),C=Kt(),k=Nn(v)?Nr().append(C):C;C.setFormat(y),C.setStyle(x),E===null?v.append(k):E.insertBefore(k),_.is(b)&&b.set(C.__key,0,"text"),_.set(C.__key,0,"text")})(s,a,r,i),a.type==="element"&&$a(a,mo(fi(a,"next")));let l=s.offset,c=a.offset,d=this.getNodes(),u=d.length,p=d[0];ee(p)||V(26);let f=p.getTextContent().length,h=p.getParentOrThrow(),m=d[u-1];if(u===1&&a.type==="element"&&(c=f,a.set(s.key,c,"text")),this.isCollapsed()&&l===f&&(wr(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let _=p.getNextSibling();if(ee(_)&&_.canInsertTextBefore()&&!wr(_)||(_=Kt(),_.setFormat(r),_.setStyle(i),h.canInsertTextAfter()?p.insertAfter(_):h.insertAfter(_)),_.select(0,0),p=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(wr(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let _=p.getPreviousSibling();if(ee(_)&&!wr(_)||(_=Kt(),_.setFormat(r),h.canInsertTextBefore()?p.insertBefore(_):h.insertBefore(_)),_.select(),p=_,e!=="")return void this.insertText(e)}else if(p.isSegmented()&&l!==f){let _=Kt(p.getTextContent());_.setFormat(r),p.replace(_),p=_}else if(!this.isCollapsed()&&e!==""){let _=m.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||U(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),n1(this.anchor,this.focus,null),void this.insertText(e)}if(u===1){if(si(p)){let x=Kt(e);return x.select(),void p.replace(x)}let _=p.getFormat(),b=p.getStyle();if(l!==c||_===r&&b===i){if(Gb(p)){let x=Kt(e);return x.setFormat(r),x.setStyle(i),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=Kt(e);if(x.setFormat(r),x.setStyle(i),x.select(),l===0)p.insertBefore(x,!1);else{let[v]=p.splitText(l);v.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}p.setFormat(r),p.setStyle(i)}let y=c-l;p=p.spliceText(l,y,e,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(p.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=b))}else{let _=new Set([...p.getParentKeys(),...m.getParentKeys()]),b=U(p)?p:p.getParentOrThrow(),y=U(m)?m:m.getParentOrThrow(),x=m;if(!b.is(y)&&y.isInline())do x=y,y=y.getParentOrThrow();while(y.isInline());if(a.type==="text"&&(c!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<c)if(ee(m)&&!si(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let T=Kt(m.getTextContent());m.replace(T),m=T}Nn(a.getNode())||a.type!=="text"||(m=m.spliceText(0,c,"")),_.add(m.__key)}else{let T=m.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?m.remove():T.remove()}else _.add(m.__key);let v=y.getChildren(),E=new Set(d),C=b.is(y),k=b.isInline()&&p.getNextSibling()===null?b:p;for(let T=v.length-1;T>=0;T--){let w=v[T];if(w.is(p)||U(w)&&w.isParentOf(p))break;w.isAttached()&&(!E.has(w)||w.is(x)?C||k.insertAfter(w,!1):w.remove())}if(!C){let T=y,w=null;for(;T!==null;){let S=T.getChildren(),N=S.length;(N===0||S[N-1].is(w))&&(_.delete(T.__key),w=T),T=T.getParent()}}if(si(p))if(l===f)p.select();else{let T=Kt(e);T.select(),p.replace(T)}else p=p.spliceText(l,f-l,e,!0),p.getTextContent()===""?p.remove():p.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let T=1;T<u;T++){let w=d[T],S=w.__key;_.has(S)||w.remove()}}}removeText(){let e=Pe()===this;bc(this,H1(Ib(this))),e&&Pe()!==this&&In(this)}formatText(e,n=null){if(this.isCollapsed())return this.toggleFormat(e),void jt(null);let o=this.getNodes(),r=[];for(let v of o)ee(v)&&r.push(v);let i=v=>{o.forEach((E=>{if(U(E)){let C=E.getFormatFlags(e,v);E.setTextFormat(C)}}))},s=r.length;if(s===0)return this.toggleFormat(e),jt(null),void i(n);let a=this.anchor,l=this.focus,c=this.isBackward(),d=c?l:a,u=c?a:l,p=0,f=r[0],h=d.type==="element"?0:d.offset;if(d.type==="text"&&h===f.getTextContentSize()&&(p=1,f=r[1],h=0),f==null)return;let m=f.getFormatFlags(e,n);i(m);let _=s-1,b=r[_],y=u.type==="text"?u.offset:b.getTextContentSize();if(f.is(b)){if(h===y)return;if(wr(f)||h===0&&y===f.getTextContentSize())f.setFormat(m);else{let v=f.splitText(h,y),E=h===0?v[0]:v[1];E.setFormat(m),d.type==="text"&&d.set(E.__key,0,"text"),u.type==="text"&&u.set(E.__key,y-h,"text")}return void(this.format=m)}h===0||wr(f)||([,f]=f.splitText(h),h=0),f.setFormat(m);let x=b.getFormatFlags(e,m);y>0&&(y===b.getTextContentSize()||wr(b)||([b]=b.splitText(y)),b.setFormat(x));for(let v=p+1;v<_;v++){let E=r[v],C=E.getFormatFlags(e,x);E.setFormat(C)}d.type==="text"&&d.set(f.__key,h,"text"),u.type==="text"&&u.set(b.__key,y,"text"),this.format=m|x}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=Pe();return de(h)||V(134),h.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=ob(n,kr),r=e[e.length-1];if(U(o)&&"__language"in o){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let h=Q_(this);o.splice(h,0,e),r.selectEnd()}return}if(!e.some((h=>(U(h)||Ye(h))&&!h.isInline()))){U(o)||V(211,n.constructor.name,n.getType());let h=Q_(this);return o.splice(h,0,e),void r.selectEnd()}let i=(function(h){let m=Nr(),_=null;for(let b=0;b<h.length;b++){let y=h[b],x=is(y);if(x||Ye(y)&&y.isInline()||U(y)&&y.isInline()||ee(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),x))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m})(e),s=i.getLastDescendant(),a=i.getChildren(),l=!U(o)||!o.isEmpty()?this.insertParagraph():null,c=a[a.length-1],d=a[0];var u;U(u=d)&&kr(u)&&!u.isEmpty()&&U(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(U(o)||V(211,n.constructor.name,n.getType()),o.append(...d.getChildren()),d=a[1]),d&&(o===null&&V(212,n.constructor.name,n.getType()),(function(h,m,_){let b=m.getParentOrThrow().getLastChild(),y=m,x=[m];for(;y!==b;)y.getNextSibling()||V(140),y=y.getNextSibling(),x.push(y);let v=h;for(let E of x)v=v.insertAfter(E)})(o,d));let p=ob(s,kr);l&&U(p)&&(l.canMergeWhenEmpty()||kr(c))&&(p.append(...l.getChildren()),l.remove()),U(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let f=U(o)?o.getLastChild():null;is(f)&&p!==o&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Nr();return On().splice(this.anchor.offset,0,[s]),s.select(),s}let e=Q_(this),n=ob(this.anchor.getNode(),kr);U(n)||V(213);let o=n.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let n=Da();if(this.insertNodes([n]),e){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let e=this.getNodes(),n=e.length,o=n-1,r=this.anchor,i=this.focus,s=e[0],a=e[o],[l,c]=Eb(this);if(n===0)return[];if(n===1){if(ee(s)&&!this.isCollapsed()){let u=l>c?c:l,p=l>c?l:c,f=s.splitText(u,p),h=u===0?f[0]:f[1];return h!=null?[h]:[]}return[s]}let d=r.isBefore(i);if(ee(s)){let u=d?l:c;u===s.getTextContentSize()?e.shift():u!==0&&([,s]=s.splitText(u),e[0]=s)}if(ee(a)){let u=a.getTextContent().length,p=d?c:l;p===0?e.pop():p!==u&&([a]=a.splitText(p),e[o]=a)}return e}modify(e,n,o){if(Vk(this,e,n,o))return;let r=e==="move",i=nt(),s=Vo(co(i));if(!s)return;let a=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(l===null||a===null||!U(c)||c.isInline()||c.canBeEmpty()||Sb(a,i,l),this.dirty){let d=La(i,this.anchor.key),u=La(i,this.focus.key);this.anchor.type==="text"&&(d=us(d)),this.focus.type==="text"&&(u=us(u)),d&&u&&s1(s,d,this.anchor.offset,u,this.focus.offset)}if((function(d,u,p,f){d.modify(u,p,f)})(s,e,n?"backward":"forward",o),s.rangeCount>0){let d=s.getRangeAt(0),u=this.anchor.getNode(),p=Nn(u)?u:O1(u);if(this.applyDOMRange(d),this.dirty=!0,!r){let f=this.getNodes(),h=[],m=!1;for(let _=0;_<f.length;_++){let b=f[_];Ep(b,p)?h.push(b):m=!0}if(m&&h.length>0)if(n){let _=h[0];U(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{let _=h[h.length-1];U(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}s.anchorNode===d.startContainer&&s.anchorOffset===d.startOffset||(function(_){let b=_.focus,y=_.anchor,x=y.key,v=y.offset,E=y.type;y.set(b.key,b.offset,b.type,!0),b.set(x,v,E,!0)})(this)}}o==="lineboundary"&&Vk(this,e,n,o,"decorators")}forwardDeletion(e,n,o){if(!o&&(e.type==="element"&&U(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){let r=n.getParent(),i=n.getNextSibling()||(r===null?null:r.getNextSibling());if(U(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,e))return;let i=fy(fi(o,e?"previous":"next"));if(i.getTextSlices().every((a=>a===null||a.distance===0))){let a={type:"initial"};for(let l of i.iterNodeCarets("shadowRoot"))if(bo(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(a.type==="merge-block")break;if(U(i.anchor.origin)&&i.anchor.origin.isEmpty()){let c=mo(l);bc(this,pi(c,c)),i.anchor.origin.remove()}return}a.type!=="merge-next-block"&&a.type!=="merge-block"||(a={block:a.block,caret:l,type:"merge-block"})}}else{if(a.type==="merge-block")break;if(ps(l)){if(U(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(i.anchor.origin))break}else a={block:l.origin,type:"merge-next-block"};continue}if(Ye(l.origin)){if(!l.origin.isIsolated())if(a.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&U(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let c=Yb();c.add(l.origin.getKey()),In(c)}else l.origin.remove();return}break}}if(a.type==="merge-block"){let{caret:l,block:c}=a;return bc(this,pi(!l.origin.isEmpty()&&c.isEmpty()?Ka(Gt(c,l.direction)):i.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&$k(this,o.getNode()))return}else{let a=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,a!==null&&a.isSegmented()){let l=s.offset,c=a.getTextContentSize();if(a.is(r)||e&&l!==c||!e&&l!==0)return void zk(a,e,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,c=r.getTextContentSize();if(r.is(a)||e&&l!==0||!e&&l!==c)return void zk(r,e,l)}(function(l,c){let d=l.anchor,u=l.focus,p=d.getNode(),f=u.getNode();if(p===f&&d.type==="text"&&u.type==="text"){let h=d.offset,m=u.offset,_=h<m,b=_?h:m,y=_?m:h,x=y-1;b!==x&&(function(v){return!(C1(v)||$K(v))})(p.getTextContent().slice(b,y))&&(c?u.set(u.key,x,u.type):d.set(d.key,x,d.type))}})(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Nn(o.getParent())&&o.getPreviousSibling()===null&&$k(this,o)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Dp(t){return t instanceof mp}function Bk(t){let e=t.offset;if(t.type==="text")return e;let n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function Eb(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[n,o]=e;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[Bk(n),Bk(o)]}function $k(t,e){for(let n=e;n;n=n.getParent()){if(U(n)){if(n.collapseAtStart(t))return!0;if(xo(n))break}if(n.getPreviousSibling())break}return!1}var $K=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function zk(t,e,n){let o=t,r=o.getTextContent().split(/(?=\s)/g),i=r.length,s=0,a=0;for(let c=0;c<i;c++){let d=c===i-1;if(a=s,s+=r[c].length,e&&s===n||s>n||d){r.splice(c,1),d&&(a=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(a,a))}function Hk(t,e,n,o){let r,i=e;if(yn(t)){let s=!1,a=t.childNodes,l=a.length,c=o._blockCursorElement;i===l&&(s=!0,i=l-1);let d=a[i],u=!1;if(d===c)d=a[i+1],u=!0;else if(c!==null){let p=c.parentNode;t===p&&e>Array.prototype.indexOf.call(p.children,c)&&i--}if(r=Ca(d),ee(r))i=tN(r,s);else{let p=Ca(t);if(p===null)return null;if(U(p)){let f=o.getElementByKey(p.getKey());f===null&&V(214),[p,i]=p.getDOMSlot(f).resolveChildIndex(p,f,t,e),U(p)||V(215),s&&i>=p.getChildrenSize()&&(i=Math.max(0,p.getChildrenSize()-1));let m=p.getChildAtIndex(i);if(U(m)&&(function(_,b,y){let x=_.getParent();return y===null||x===null||!x.canBeEmpty()||x!==y.getNode()})(m,0,n)){let _=s?m.getLastDescendant():m.getFirstDescendant();_===null?p=m:(m=_,p=U(m)?m:m.getParentOrThrow()),i=0}ee(m)?(r=m,p=null,i=tN(m,s)):m!==p&&s&&!u&&(U(p)||V(216),i=Math.min(p.getChildrenSize(),i+1))}else{let f=p.getIndexWithinParent();i=e===0&&Ye(p)&&Ca(t)===p?f:f+1,p=p.getParentOrThrow()}if(U(p))return yo(p.__key,i,"element")}}else r=Ca(t);return ee(r)?yo(r.__key,i,"text"):null}function Kk(t,e,n){let o=t.offset,r=t.getNode();if(o===0){let i=r.getPreviousSibling(),s=r.getParent();if(e){if((n||!e)&&i===null&&U(s)&&s.isInline()){let a=s.getPreviousSibling();ee(a)&&t.set(a.__key,a.getTextContent().length,"text")}}else U(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):ee(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(o===r.getTextContent().length){let i=r.getNextSibling(),s=r.getParent();if(e&&U(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&U(s)&&s.isInline()&&!s.canInsertTextAfter()){let a=s.getNextSibling();ee(a)&&t.set(a.__key,0,"text")}}}function n1(t,e,n){if(t.type==="text"&&e.type==="text"){let o=t.isBefore(e),r=t.is(e);Kk(t,o,r),Kk(e,!o,r),r&&e.set(t.key,t.offset,t.type);let i=nt();if(i.isComposing()&&i._compositionKey!==t.key&&de(n)){let s=n.anchor,a=n.focus;t.set(s.key,s.offset,s.type,!0),e.set(a.key,a.offset,a.type,!0)}}}function o1(t,e,n,o,r,i){if(t===null||n===null||!Oc(r,t,n))return null;let s=Hk(t,e,de(i)?i.anchor:null,r);if(s===null)return null;let a=Hk(n,o,de(i)?i.focus:null,r);if(a===null)return null;if(s.type==="element"&&a.type==="element"){let l=Ca(t),c=Ca(n);if(Ye(l)&&Ye(c))return null}return n1(s,a,i),[s,a]}function zK(t){return U(t)&&!t.isInline()}function r1(t,e,n,o,r,i){let s=Mr(),a=new ds(yo(t,e,r),yo(n,o,i),0,"");return a.dirty=!0,s._selection=a,a}function i1(){let t=yo("root",0,"element"),e=yo("root",0,"element");return new ds(t,e,0,"")}function Yb(){return new mp(new Set)}function HK(t,e){return Op(null,t,e,null)}function Op(t,e,n,o){let r=n._window;if(r===null)return null;let i=o||r.event,s=i?i.type:void 0,a=s==="selectionchange",l=!ib&&(a||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0),c,d,u,p;if(de(t)&&!l)return t.clone();if(e===null)return null;if(c=e.anchorNode,d=e.focusNode,u=e.anchorOffset,p=e.focusOffset,a&&de(t)&&!Oc(n,c,d))return t.clone();let f=o1(c,u,d,p,n,t);if(f===null)return null;let[h,m]=f;return new ds(h,m,de(t)?t.format:0,de(t)?t.style:"")}function Pe(){return Mr()._selection}function hs(){return nt()._editorState._selection}function _p(t,e,n,o=1){let r=t.anchor,i=t.focus,s=r.getNode(),a=i.getNode();if(!e.is(s)&&!e.is(a))return;let l=e.__key;if(t.isCollapsed()){let c=r.offset;if(n<=c&&o>0||n<c&&o<0){let d=Math.max(0,c+o);r.set(l,d,"element"),i.set(l,d,"element"),Uk(t)}}else{let c=t.isBackward(),d=c?i:r,u=d.getNode(),p=c?r:i,f=p.getNode();if(e.is(u)){let h=d.offset;(n<=h&&o>0||n<h&&o<0)&&d.set(l,Math.max(0,h+o),"element")}if(e.is(f)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}Uk(t)}function Uk(t){let e=t.anchor,n=e.offset,o=t.focus,r=o.offset,i=e.getNode(),s=o.getNode();if(t.isCollapsed()){if(!U(i))return;let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(ee(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text"),o.set(c.__key,d,"text")}}else{if(U(i)){let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(ee(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text")}}if(U(s)){let a=s.getChildrenSize(),l=r>=a,c=l?s.getChildAtIndex(a-1):s.getChildAtIndex(r);if(ee(c)){let d=0;l&&(d=c.getTextContentSize()),o.set(c.__key,d,"text")}}}}function bp(t,e,n,o,r){let i=null,s=0,a=null;o!==null?(i=o.__key,ee(o)?(s=o.getTextContentSize(),a="text"):U(o)&&(s=o.getChildrenSize(),a="element")):r!==null&&(i=r.__key,ee(r)?a="text":U(r)&&(a="element")),i!==null&&a!==null?t.set(i,s,a):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function jk(t,e,n,o,r){t.type==="text"?t.set(n,t.offset+(e?0:r),"text"):t.offset>o.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function s1(t,e,n,o,r){try{t.setBaseAndExtent(e,n,o,r)}catch{}}function KK(t,e,n,o,r,i,s){let a=o.anchorNode,l=o.focusNode,c=o.anchorOffset,d=o.focusOffset,u=document.activeElement;if(r.has(p1)&&u!==i||u!==null&&ty(u))return;if(!de(e))return void(t!==null&&Oc(n,a,l)&&o.removeAllRanges());let p=e.anchor,f=e.focus,h=p.key,m=f.key,_=La(n,h),b=La(n,m),y=p.offset,x=f.offset,v=e.format,E=e.style,C=e.isCollapsed(),k=_,T=b,w=!1;if(p.type==="text"){k=us(_);let I=p.getNode();w=I.getFormat()!==v||I.getStyle()!==E}else de(t)&&t.anchor.type==="text"&&(w=!0);var S,N,D,O,M;if(f.type==="text"&&(T=us(b)),k!==null&&T!==null&&(C&&(t===null||w||de(t)&&(t.format!==v||t.style!==E))&&(S=v,N=E,D=y,O=h,M=performance.now(),YN=[S,N,D,O,M]),c!==y||d!==x||a!==k||l!==T||o.type==="Range"&&C||(u!==null&&i.contains(u)||i.focus({preventScroll:!0}),p.type==="element"))){if(s1(o,k,y,T,x),!r.has(f1)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let I=de(e)&&e.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(I!==null){let L;if(I instanceof Text){let K=document.createRange();K.selectNode(I),L=K.getBoundingClientRect()}else L=I.getBoundingClientRect();(function(K,W,q){let B=ay(q),se=ly(B);if(B===null||se===null)return;let{top:me,bottom:mt}=W,Jt=0,dt=0,_t=q;for(;_t!==null;){let sn=_t===B.body;if(sn)Jt=0,dt=co(K).innerHeight;else{let Je=_t.getBoundingClientRect();Jt=Je.top,dt=Je.bottom}let ye=0;if(me<Jt?ye=-(Jt-me):mt>dt&&(ye=mt-dt),ye!==0)if(sn)se.scrollBy(0,ye);else{let Je=_t.scrollTop;_t.scrollTop+=ye;let st=_t.scrollTop-Je;me-=st,mt-=st}if(sn)break;_t=Mc(_t)}})(n,L,i)}}yb=!0}}function UK(t){let e=Pe()||hs();e===null&&(e=On().selectEnd()),e.insertNodes(t)}function jK(){let t=Pe();return t===null?"":t.getTextContent()}function Q_(t){let e=t;t.isCollapsed()||e.removeText();let n=Pe();de(n)&&(e=n),de(e)||V(161);let o=e.anchor,r=o.getNode(),i=o.offset;for(;!kr(r);){let s=r;if([r,i]=VK(r,i),s.is(r))break}return i}function VK(t,e){let n=t.getParent();if(!n){let r=Nr();return On().append(r),r.select(),[On(),0]}if(ee(t)){let r=t.splitText(e);if(r.length===0)return[n,t.getIndexWithinParent()];let i=e===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!U(t)||e===0)return[n,t.getIndexWithinParent()];let o=t.getChildAtIndex(e);if(o){let r=new ds(yo(t.__key,e,"element"),yo(t.__key,e,"element"),0,""),i=t.insertNewAfter(r);i&&i.append(o,...o.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Vk(t,e,n,o,r="decorators-and-blocks"){if(e==="move"&&o==="character"&&!t.isCollapsed()){let[d,u]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return u.set(d.key,d.offset,d.type),!0}let i=fi(t.focus,n?"previous":"next"),s=o==="lineboundary",a=e==="move",l=i,c=r==="decorators-and-blocks";if(!K1(l)){for(let d of l){c=!1;let{origin:u}=d;if(!Ye(u)||u.isIsolated()||(l=d,!s||!u.isInline()))break}if(c)for(let d of fy(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(bo(d))d.origin.isInline()||(l=d);else{if(U(d.origin))continue;Ye(d.origin)&&!d.origin.isInline()&&(l=d)}break}}if(l===i)return!1;if(a&&!s&&Ye(l.origin)&&l.origin.isKeyboardSelectable()){let d=Yb();return d.add(l.origin.getKey()),In(d),!0}return l=mo(l),a&&$a(t.anchor,l),$a(t.focus,l),c||!s}var Vt=null,Wt=null,Dn=!1,eb=!1,rp=0,Wk={characterData:!0,childList:!0,subtree:!0};function za(){return Dn||Vt!==null&&Vt._readOnly}function Ut(){Dn&&V(13)}function a1(){rp>99&&V(14)}function Mr(){return Vt===null&&V(195,l1()),Vt}function nt(){return Wt===null&&V(196,l1()),Wt}function l1(){let t=0,e=new Set,n=Aa.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let i=Ic(r);if(Ip(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let o=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function WK(){return Wt}function Gk(t,e,n){let o=e.__type,r=Qb(t,o),i=n.get(o);i===void 0&&(i=Array.from(r.transforms),n.set(o,i));let s=i.length;for(let a=0;a<s&&(i[a](e),e.isAttached());a++);}function Yk(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function c1(t,e){if(!e)return;let n=t._updateTags,o=e;Array.isArray(e)||(o=[e]);for(let r of o)n.add(r)}function GK(t){return qb(t,nt()._nodes)}function qb(t,e){let n=t.type,o=e.get(n);o===void 0&&V(17,n);let r=o.klass;t.type!==r.getType()&&V(18,r.name);let i=r.importJSON(t),s=t.children;if(U(i)&&Array.isArray(s))for(let a=0;a<s.length;a++){let l=qb(s[a],e);i.append(l)}return i}function qk(t,e,n){let o=Vt,r=Dn,i=Wt;Vt=e,Dn=!0,Wt=t;try{return n()}finally{Vt=o,Dn=r,Wt=i}}function Sr(t,e){let n=t._pendingEditorState,o=t._rootElement,r=t._headless||o===null;if(n===null)return;let i=t._editorState,s=i._selection,a=n._selection,l=t._dirtyType!==as,c=Vt,d=Dn,u=Wt,p=t._updating,f=t._observer,h=null;if(t._pendingEditorState=null,t._editorState=n,!r&&l&&f!==null){Wt=t,Vt=n,Dn=!1,t._updating=!0;try{let C=t._dirtyType,k=t._dirtyElements,T=t._dirtyLeaves;f.disconnect(),h=xK(i,n,t,C,k,T)}catch(C){if(C instanceof Error&&t._onError(C),eb)throw C;return g1(t,null,o,n),_N(t),t._dirtyType=ka,eb=!0,Sr(t,i),void(eb=!1)}finally{f.observe(o,Wk),t._updating=p,Vt=c,Dn=d,Wt=u}}n._readOnly||(n._readOnly=!0);let m=t._dirtyLeaves,_=t._dirtyElements,b=t._normalizedNodes,y=t._updateTags,x=t._deferred;l&&(t._dirtyType=as,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),(function(C,k){let T=C._decorators,w=C._pendingDecorators||T,S=k._nodeMap,N;for(N in w)S.has(N)||(w===T&&(w=x1(C)),delete w[N])})(t,n);let v=r?null:Vo(co(t));if(t._editable&&v!==null&&(l||a===null||a.dirty)&&o!==null&&!y.has(h1)){Wt=t,Vt=n;try{if(f!==null&&f.disconnect(),l||a===null||a.dirty){let C=t._blockCursorElement;C!==null&&Sb(C,t,o),KK(s,a,t,v,y,o)}(function(C,k,T){let w=C._blockCursorElement;if(de(T)&&T.isCollapsed()&&T.anchor.type==="element"&&k.contains(document.activeElement)){let S=T.anchor,N=S.getNode(),D=S.offset,O=!1,M=null;if(D===N.getChildrenSize())nb(N.getChildAtIndex(D-1))&&(O=!0);else{let I=N.getChildAtIndex(D);if(I!==null&&nb(I)){let L=I.getPreviousSibling();(L===null||nb(L))&&(O=!0,M=C.getElementByKey(I.__key))}}if(O){let I=C.getElementByKey(N.__key);return w===null&&(C._blockCursorElement=w=(function(L){let K=L.theme,W=document.createElement("div");W.contentEditable="false",W.setAttribute("data-lexical-cursor","true");let q=K.blockCursor;if(q!==void 0){if(typeof q=="string"){let B=lp(q);q=K.blockCursor=B}q!==void 0&&W.classList.add(...q)}return W})(C._config)),k.style.caretColor="transparent",void(M===null?I.appendChild(w):I.insertBefore(w,M))}}w!==null&&Sb(w,C,k)})(t,o,a)}finally{f!==null&&f.observe(o,Wk),Wt=u,Vt=c}}h!==null&&(function(C,k,T,w,S){let N=Array.from(C._listeners.mutation),D=N.length;for(let O=0;O<D;O++){let[M,I]=N[O];for(let L of I){let K=k.get(L);K!==void 0&&M(K,{dirtyLeaves:w,prevEditorState:S,updateTags:T})}}})(t,h,y,m,i),de(a)||a===null||s!==null&&s.is(a)||t.dispatchCommand(zb,void 0);let E=t._pendingDecorators;E!==null&&(t._decorators=E,t._pendingDecorators=null,mc("decorator",t,!0,E)),(function(C,k,T){let w=eN(k),S=eN(T);w!==S&&mc("textcontent",C,!0,S)})(t,e||i,n),mc("update",t,!0,{dirtyElements:_,dirtyLeaves:m,editorState:n,mutatedNodes:h,normalizedNodes:b,prevEditorState:e||i,tags:y}),(function(C,k){if(C._deferred=[],k.length!==0){let T=C._updating;C._updating=!0;try{for(let w=0;w<k.length;w++)k[w]()}finally{C._updating=T}}})(t,x),(function(C){let k=C._updates;if(k.length!==0){let T=k.shift();if(T){let[w,S]=T;Xb(C,w,S)}}})(t)}function mc(t,e,n,...o){let r=e._updating;e._updating=n;try{let i=Array.from(e._listeners[t]);for(let s=0;s<i.length;s++)i[s].apply(null,o)}finally{e._updating=r}}function Xk(t,e){let n=t._updates,o=e||!1;for(;n.length!==0;){let r=n.shift();if(r){let[i,s]=r,a;if(s!==void 0){if(a=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete){let l=t._pendingEditorState;l===null&&V(191),l._flushSync=!0}a&&t._deferred.push(a),c1(t,s.tag)}i()}}return o}function Xb(t,e,n){let o=t._updateTags,r,i=!1,s=!1;n!==void 0&&(r=n.onUpdate,c1(t,n.tag),i=n.skipTransforms||!1,s=n.discrete||!1),r&&t._deferred.push(r);let a=t._editorState,l=t._pendingEditorState,c=!1;(l===null||l._readOnly)&&(l=t._pendingEditorState=d1(l||a),c=!0),l._flushSync=s;let d=Vt,u=Dn,p=Wt,f=t._updating;Vt=l,Dn=!1,t._updating=!0,Wt=t;let h=t._headless||t.getRootElement()===null;Zb(null);try{c&&(h?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=(function(y,x){let v=y.getEditorState()._selection,E=Vo(co(y));return de(v)||v==null?Op(v,E,y,x):v.clone()})(t,n&&n.event||null));let _=t._compositionKey;e(),i=Xk(t,i),(function(y,x){let v=x.getEditorState()._selection,E=y._selection;if(de(E)){let C=E.anchor,k=E.focus,T;if(C.type==="text"&&(T=C.getNode(),T.selectionTransform(v,E)),k.type==="text"){let w=k.getNode();T!==w&&w.selectionTransform(v,E)}}})(l,t),t._dirtyType!==as&&(i?(function(y,x){let v=x._dirtyLeaves,E=y._nodeMap;for(let C of v){let k=E.get(C);ee(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&kk(k)}})(l,t):(function(y,x){let v=x._dirtyLeaves,E=x._dirtyElements,C=y._nodeMap,k=ii(),T=new Map,w=v,S=w.size,N=E,D=N.size;for(;S>0||D>0;){if(S>0){x._dirtyLeaves=new Set;for(let O of w){let M=C.get(O);ee(M)&&M.isAttached()&&M.isSimpleText()&&!M.isUnmergeable()&&kk(M),M!==void 0&&Yk(M,k)&&Gk(x,M,T),v.add(O)}if(w=x._dirtyLeaves,S=w.size,S>0){rp++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,N.delete("root")&&N.set("root",!0);for(let O of N){let M=O[0],I=O[1];if(E.set(M,I),!I)continue;let L=C.get(M);L!==void 0&&Yk(L,k)&&Gk(x,L,T)}w=x._dirtyLeaves,S=w.size,N=x._dirtyElements,D=N.size,rp++}x._dirtyLeaves=v,x._dirtyElements=E})(l,t),Xk(t),(function(y,x,v,E){let C=y._nodeMap,k=x._nodeMap,T=[];for(let[w]of E){let S=k.get(w);S!==void 0&&(S.isAttached()||(U(S)&&hN(S,w,C,k,T,E),C.has(w)||E.delete(w),T.push(w)))}for(let w of T)k.delete(w);for(let w of v){let S=k.get(w);S===void 0||S.isAttached()||(C.has(w)||v.delete(w),k.delete(w))}})(a,l,t._dirtyLeaves,t._dirtyElements)),_!==t._compositionKey&&(l._flushSync=!0);let b=l._selection;if(de(b)){let y=l._nodeMap,x=b.anchor.key,v=b.focus.key;y.get(x)!==void 0&&y.get(v)!==void 0||V(19)}else Dp(b)&&b._nodes.size===0&&(l._selection=null)}catch(_){return _ instanceof Error&&t._onError(_),t._pendingEditorState=a,t._dirtyType=ka,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void Sr(t)}finally{Vt=d,Dn=u,Wt=p,t._updating=f,rp=0}t._dirtyType!==as||t._deferred.length>0||(function(_,b){let y=b.getEditorState()._selection,x=_._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(l,t)?l._flushSync?(l._flushSync=!1,Sr(t)):c&&aU((()=>{Sr(t)})):(l._flushSync=!1,c&&(o.clear(),t._deferred=[],t._pendingEditorState=null))}function Yn(t,e,n){Wt===t&&n===void 0?e():Xb(t,e,n)}var wb=class t{constructor(e,n,o){this.element=e,this.before=n||null,this.after=o||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&V(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&V(224),this.element.replaceChild(e,n),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let n=e==="decorator"&&(Sa||yc);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let n=this.element,o=e.nodeName==="IMG"?e.nextSibling:null;o&&n.removeChild(o),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,i=document.createElement("br");if(o.insertBefore(i,r),e){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,i),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let n=this.after;n!==null;n=n.previousSibling)e++;return e}resolveChildIndex(e,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,r))]}let i=Jk(n,o);i.push(r);let s=Jk(n,this.element),a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){let c=i[l],d=s[l];if(c===void 0||c<d)break;if(c>d){a+=1;break}}return[e.getParentOrThrow(),a]}};function Jk(t,e){let n=[],o=e;for(;o!==t&&o!==null;o=o.parentNode){let r=0;for(let i=o.previousSibling;i!==null;i=i.previousSibling)r++;n.push(r)}return o!==t&&V(225),n.reverse()}var di=class extends ci{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return iK[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getChildrenKeys(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n.__key),n=n.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=nt()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(e)}getAllTextNodes(){let e=[],n=this.getFirstChild();for(;n!==null;){if(ee(n)&&e.push(n),U(n)){let o=n.getAllTextNodes();e.push(...o)}n=n.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;U(e);){let n=e.getFirstChild();if(n===null)break;e=n}return e}getLastDescendant(){let e=this.getLastChild();for(;U(e);){let n=e.getLastChild();if(n===null)break;e=n}return e}getDescendantByIndex(e){let n=this.getChildren(),o=n.length;if(e>=o){let i=n[o-1];return U(i)&&i.getLastDescendant()||i||null}let r=n[e];return U(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:At(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:At(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){let n=this.getChildrenSize(),o,r;if(e<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContent(),U(i)&&r!==o-1&&!i.isInline()&&(e+=Or)}return e}getTextContentSize(){let e=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContentSize(),U(i)&&r!==o-1&&!i.isInline()&&(e+=Or.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let n=yk[e];return!!(this.getFormat()&n)}return!1}hasTextFormat(e){let n=ln[e];return!!(this.getTextFormat()&n)}getFormatFlags(e,n){return vp(this.getLatest().__textFormat,e,n)}getTextStyle(){return this.getLatest().__textStyle}select(e,n){Ut();let o=Pe(),r=e,i=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&n===0){let l=this.getFirstChild();if(ee(l)||U(l))return l.select(0,0)}else if(!(e!==void 0&&e!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(ee(l)||U(l))return l.select()}}r===void 0&&(r=s),i===void 0&&(i=s);let a=this.__key;return de(o)?(o.anchor.set(a,r,"element"),o.focus.set(a,i,"element"),o.dirty=!0,o):r1(a,r,a,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach((n=>n.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let n=this.getWritable();return n.__dir=e,n}setFormat(e){return this.getWritable().__format=e!==""?yk[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let n=this.getWritable();return n.__textFormat=e,n}setTextStyle(e){let n=this.getWritable();return n.__textStyle=e,n}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,o){let r=o.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||V(226,String(e),String(n),String(i));let a=s.__key,l=[],c=[],d=this.getChildAtIndex(e+n),u=null,p=i-n+r;if(e!==0)if(e===i)u=this.getLastChild();else{let h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(n>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let m=0;m<n;m++){h===null&&V(100);let _=h.getNextSibling(),b=h.__key;ai(h.getWritable()),c.push(b),h=_}}let f=u;for(let h=0;h<r;h++){let m=o[h];f!==null&&m.is(f)&&(u=f=f.getPreviousSibling());let _=m.getWritable();_.__parent===a&&p--,ai(_);let b=m.__key;if(f===null)s.__first=b,_.__prev=null;else{let y=f.getWritable();y.__next=b,_.__prev=y.__key}m.__key===a&&V(76),_.__parent=a,l.push(b),f=m}if(e+n===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(d!==null){let h=d.getWritable();if(f!==null){let m=f.getWritable();h.__prev=f.__key,m.__next=d.__key}else h.__prev=null}if(s.__size=p,c.length){let h=Pe();if(de(h)){let m=new Set(c),_=new Set(l),{anchor:b,focus:y}=h;Zk(b,m,_)&&bp(b,b.getNode(),this,u,d),Zk(y,m,_)&&bp(y,y.getNode(),this,u,d),p!==0||this.canBeEmpty()||xo(this)||this.remove()}}return s}getDOMSlot(e){return new wb(e)}exportDOM(e){let{element:n}=super.exportDOM(e);if(yn(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n!==0&&(e.textFormat=n),o!==""&&(e.textStyle=o),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,n){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,n){let o=this.getDOMSlot(e),r=o.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let s=n.getElementByKey(i.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function U(t){return t instanceof di}function Zk(t,e,n){let o=t.getNode();for(;o;){let r=o.__key;if(e.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Nc=class extends ci{decorate(e,n){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Ye(t){return t instanceof Nc}var Ia=class t extends di{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){let e=this.__cachedText;return!za()&&nt()._dirtyType!==as||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,n){return!1}splice(e,n,o){for(let r of o)U(r)||Ye(r)||V(282);return super.splice(e,n,o)}static importJSON(e){return On().updateFromJSON(e)}collapseAtStart(){return!0}};function Nn(t){return t instanceof Ia}function d1(t){return new yp(new Map(t._nodeMap))}function Jb(){return new yp(new Map([["root",new Ia]]))}function u1(t){let e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&V(130,n.name),U(t)){let o=e.children;Array.isArray(o)||V(59,n.name);let r=t.getChildren();for(let i=0;i<r.length;i++){let s=u1(r[i]);o.push(s)}}return e}var yp=class t{constructor(e,n){this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return qk(n&&n.editor||null,this,e)}clone(e){let n=new t(this._nodeMap,e===void 0?this._selection:e);return n._readOnly=!0,n}toJSON(){return qk(null,this,(()=>({root:u1(On())})))}},YK="historic",qK="history-push",ip="history-merge",XK="paste",p1="collaboration",JK="skip-collab",f1="skip-scroll-into-view",h1="skip-dom-selection",xp=class extends di{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},Ma=class t extends di{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("p"),o=Ta(e.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(e,n,o){return!1}static importDOM(){return{p:e=>({conversion:ZK,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(yn(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(e){return Nr().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,n){let o=Nr();o.setTextFormat(e.format),o.setTextStyle(e.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let e=this.getChildren();if(e.length===0||ee(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function ZK(t){let e=Nr();return t.style&&(e.setFormat(t.style.textAlign),P1(t,e)),{node:e}}function Nr(){return Ac(new Ma)}function QK(t){return t instanceof Ma}var eU=0,tU=1,nU=2,oU=3,rU=4;function g1(t,e,n,o){let r=t._keyToDOMMap;r.clear(),t._editorState=Jb(),t._pendingEditorState=o,t._compositionKey=null,t._dirtyType=as,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function iU(t){let e=t||{},n=WK(),o=e.theme||{},r=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=Jb(),a=e.namespace||(r!==null?r._config.namespace:E1()),l=e.editorState,c=[Ia,cs,Na,Oa,Ma,xp,...e.nodes||[]],{onError:d,html:u}=e,p=e.editable===void 0||e.editable,f;if(t===void 0&&n!==null)f=n._nodes;else{f=new Map;for(let m=0;m<c.length;m++){let _=c[m],b=null,y=null;if(typeof _!="function"){let k=_;_=k.replace,b=k.with,y=k.withKlass||null}let{ownNodeConfig:x}=uy(_),v=_.getType(),E=_.transform(),C=new Set;x&&x.$transform&&C.add(x.$transform),E!==null&&C.add(E),f.set(v,{exportDOM:u&&u.export?u.export.get(_):void 0,klass:_,replace:b,replaceWithKlass:y,sharedNodeState:bN(c[m]),transforms:C})}}let h=new Aa(s,r,f,{disableEvents:i,namespace:a,theme:o},d||console.error,(function(m,_){let b=new Map,y=new Set,x=v=>{Object.keys(v).forEach((E=>{let C=b.get(E);C===void 0&&(C=[],b.set(E,C)),C.push(v[E])}))};return m.forEach((v=>{let E=v.klass.importDOM;if(E==null||y.has(E))return;y.add(E);let C=E.call(v.klass);C!==null&&x(C)})),_&&x(_),b})(f,u?u.import:void 0),p,t);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=ka),h}var Aa=class{constructor(e,n,o,r,i,s,a,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=as,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=E1(),this._onError=i,this._htmlConversions=s,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,o){o===void 0&&V(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&V(36,String(e));let s=i[o];return s.add(n),()=>{s.delete(n),i.every((a=>a.size===0))&&r.delete(e)}}registerMutationListener(e,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(r);let a=o&&o.skipInitialization;return a!==void 0&&a||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&i.delete(n)}}getRegisteredNode(e){let n=this._nodes.get(e.getType());return n===void 0&&V(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){let o=this._editorState,r=Nb(o).get(n.getType());if(!r)return;let i=new Map;for(let s of r.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){let o=this.getRegisteredNode(e);return o.transforms.add(n),o}registerNodeTransform(e,n){let o=this.registerNodeTransformToKlass(e,n),r=[o],i=o.replaceWithKlass;if(i!=null){let s=this.registerNodeTransformToKlass(i,n);r.push(s)}return(function(s,a){let l=Nb(s.getEditorState()),c=[];for(let d of a){let u=l.get(d);u&&c.push(u)}c.length!==0&&s.update((()=>{for(let d of c)for(let u of d.keys()){let p=At(u);p&&p.markDirty()}}),s._pendingEditorState===null?{tag:ip}:void 0)})(this,r.map((s=>s.klass.getType()))),()=>{r.forEach((s=>s.transforms.delete(n)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return J(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){let o=Ta(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,g1(this,n,e,r),n!==null&&(this._config.disableEvents||IK(n),o!=null&&n.classList.remove(...o)),e!==null){let i=ly(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=ka,_N(this),this._updateTags.add(ip),Sr(this),this._config.disableEvents||(function(a,l){let c=a.ownerDocument,d=gp.get(c);(d===void 0||d<1)&&c.addEventListener("selectionchange",QN),gp.set(c,(d||0)+1),a.__lexicalEditor=l;let u=ZN(a);for(let p=0;p<bb.length;p++){let[f,h]=bb[p],m=typeof h=="function"?_=>{Ak(_)||(Mk(_),(l.isEditable()||f==="click")&&h(_,l))}:_=>{if(Ak(_))return;Mk(_);let b=l.isEditable();switch(f){case"cut":return b&&J(l,Vb,_);case"copy":return J(l,jb,_);case"paste":return b&&J(l,Hb,_);case"dragstart":return b&&J(l,zN,_);case"dragover":return b&&J(l,HN,_);case"dragend":return b&&J(l,KN,_);case"focus":return b&&J(l,UN,_);case"blur":return b&&J(l,jN,_);case"drop":return b&&J(l,$N,_)}};a.addEventListener(f,m),u.push((()=>{a.removeEventListener(f,m)}))}})(e,this),o!=null&&e.classList.add(...o)}else this._window=null,this._updateTags.add(ip),Sr(this);mc("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&V(38);let o=e;o._readOnly&&(o=d1(e),o._selection=e._selection?e._selection.clone():null),mN(this);let r=this._pendingEditorState,i=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Sr(this)),this._pendingEditorState=o,this._dirtyType=ka,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||Sr(this)}parseEditorState(e,n){return(function(o,r,i){let s=Jb(),a=Vt,l=Dn,c=Wt,d=r._dirtyElements,u=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Vt=s,Dn=!1,Wt=r,Zb(null);try{let h=r._nodes;qb(o.root,h),i&&i(),s._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=d,r._dirtyLeaves=u,r._cloneNotNeeded=p,r._dirtyType=f,Vt=a,Dn=l,Wt=c}return s})(typeof e=="string"?JSON.parse(e):e,this,n)}read(e){return Sr(this),this.getEditorState().read(e,{editor:this})}update(e,n){(function(o,r,i){o._updating?o._updates.push([r,i]):Xb(o,r,i)})(this,e,n)}focus(e,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Yn(this,(()=>{let r=Pe(),i=On();r!==null?r.dirty||In(r.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),N1("focus"),D1((()=>{o.removeAttribute("autocapitalize"),e&&e()}))})),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let n=Vo(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,mc("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};Aa.version="0.33.1+prod.esm";var Tb=null;function Zb(t){Tb=t}var m1=1;function sU(){m1=1}function Qb(t,e){let n=ey(t,e);return n===void 0&&V(30,e),n}function ey(t,e){return t._nodes.get(e)}var aU=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function Qk(t){return Ye(Ap(t))}function ty(t){let e=document.activeElement;if(!yn(e))return!1;let n=e.nodeName;return Ye(Ap(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&Ic(e)==null)}function Oc(t,e,n){let o=t.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(n)&&e!==null&&!ty(e)&&ny(e)===t}catch{return!1}}function Ip(t){return t instanceof Aa}function ny(t){let e=t;for(;e!=null;){let n=Ic(e);if(Ip(n))return n;e=Mc(e)}return null}function Ic(t){return t?t.__lexicalEditor:null}function si(t){return Gb(t)||t.isToken()}function wr(t){return si(t)||t.isSegmented()}function Wo(t){return Ha(t)&&t.nodeType===j6}function _1(t){return Ha(t)&&t.nodeType===V6}function us(t){let e=t;for(;e!=null;){if(Wo(e))return e;e=e.firstChild}return null}function vp(t,e,n){let o=ln[e];if(n!==null&&(t&o)==(n&o))return t;let r=t^o;return e==="subscript"?r&=~ln.superscript:e==="superscript"?r&=~ln.subscript:e==="lowercase"?(r&=~ln.uppercase,r&=~ln.capitalize):e==="uppercase"?(r&=~ln.lowercase,r&=~ln.capitalize):e==="capitalize"&&(r&=~ln.lowercase,r&=~ln.uppercase),r}function lU(t){return ee(t)||is(t)||Ye(t)}function b1(t,e){let n=(function(){let s=Tb;return Tb=null,s})();if((e=e||n&&n.__key)!=null)return void(t.__key=e);Ut(),a1();let o=nt(),r=Mr(),i=""+m1++;r._nodeMap.set(i,t),U(t)?o._dirtyElements.set(i,!0):o._dirtyLeaves.add(i),o._cloneNotNeeded.add(i),o._dirtyType=dN,t.__key=i}function ai(t){let e=t.getParent();if(e!==null){let n=t.getWritable(),o=e.getWritable(),r=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,a=r!==null?r.__key:null,l=r!==null?r.getWritable():null,c=i!==null?i.getWritable():null;r===null&&(o.__first=s),i===null&&(o.__last=a),l!==null&&(l.__next=s),c!==null&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Cp(t){a1();let e=t.getLatest(),n=e.__parent,o=Mr(),r=nt(),i=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,c,d){let u=l;for(;u!==null;){if(d.has(u))return;let p=c.get(u);if(p===void 0)break;d.set(u,!1),u=p.__parent}})(n,i,s);let a=e.__key;r._dirtyType=dN,U(t)?s.set(a,!0):r._dirtyLeaves.add(a)}function jt(t){Ut();let e=nt(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){let o=At(n);o!==null&&o.getWritable()}if(t!==null){let o=At(t);o!==null&&o.getWritable()}}}function ii(){return za()?null:nt()._compositionKey}function At(t,e){let n=(e||Mr())._nodeMap.get(t);return n===void 0?null:n}function y1(t,e){let n=Mp(t,nt());return n!==void 0?At(n,e):null}function Mp(t,e){return t[`__lexicalKey_${e._key}`]}function Ap(t,e){let n=t;for(;n!=null;){let o=y1(n,e);if(o!==null)return o;n=Mc(n)}return null}function x1(t){let e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function eN(t){return t.read((()=>On().getTextContent()))}function On(){return v1(Mr())}function v1(t){return t._nodeMap.get("root")}function In(t){Ut();let e=Mr();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Ca(t){let e=nt(),n=(function(o,r){let i=o;for(;i!=null;){let s=Mp(i,r);if(s!==void 0)return s;i=Mc(i)}return null})(t,e);return n===null?t===e.getRootElement()?At("root"):null:At(n)}function tN(t,e){return e?t.getTextContentSize():0}function C1(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function oy(t){let e=[],n=t;for(;n!==null;)e.push(n),n=n._parentEditor;return e}function E1(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function w1(t){return Wo(t)?t.nodeValue:null}function ry(t,e,n){let o=Vo(co(e));if(o===null)return;let r=o.anchorNode,{anchorOffset:i,focusOffset:s}=o;if(r!==null){let a=w1(r),l=Ap(r);if(a!==null&&ee(l)){if(a===Sp&&n){let c=n.length;a=n,i=c,s=c}a!==null&&iy(l,a,i,s,t)}}}function iy(t,e,n,o,r){let i=t;if(i.isAttached()&&(r||!i.isDirty())){let s=i.isComposing(),a=e;(s||r)&&e[e.length-1]===Sp&&(a=e.slice(0,-1));let l=i.getTextContent();if(r||a!==l){if(a===""){if(jt(null),yc||Sa||ap)i.remove();else{let m=nt();setTimeout((()=>{m.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}let c=i.getParent(),d=hs(),u=i.getTextContentSize(),p=ii(),f=i.getKey();if(i.isToken()||p!==null&&f===p&&!s||de(d)&&(c!==null&&!c.canInsertTextBefore()&&d.anchor.offset===0||d.anchor.key===t.__key&&d.anchor.offset===0&&!i.canInsertTextBefore()&&!s||d.focus.key===t.__key&&d.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();let h=Pe();if(!de(h)||n===null||o===null)return void i.setTextContent(a);if(h.setTextNodeRange(i,n,i,o),i.isSegmented()){let m=Kt(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function ep(t,e,n){let o=e[n]||!1;return o==="any"||o===t[n]}function T1(t,e){return ep(t,e,"altKey")&&ep(t,e,"ctrlKey")&&ep(t,e,"shiftKey")&&ep(t,e,"metaKey")}function je(t,e,n){return T1(t,n)&&t.key.toLowerCase()===e.toLowerCase()}var Er={ctrlKey:!jo,metaKey:jo},nN={altKey:jo,ctrlKey:!jo};function oN(t){return t.key==="Backspace"}function rN(t){return je(t,"a",Er)}function cU(t){let e=On();if(de(t)){let n=t.anchor,o=t.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),dp(t),t}{let n=e.select(0,e.getChildrenSize());return In(dp(n)),n}}function Ta(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let n=t.__lexicalClassNameCache,o=n[e];if(o!==void 0)return o;let r=t[e];if(typeof r=="string"){let i=lp(r);return n[e]=i,i}return r}function sy(t,e,n,o,r){if(n.size===0)return;let i=o.__type,s=o.__key,a=e.get(i);a===void 0&&V(33,i);let l=a.klass,c=t.get(l);c===void 0&&(c=new Map,t.set(l,c));let d=c.get(s),u=d==="destroyed"&&r==="created";(d===void 0||u)&&c.set(s,u?"updated":r)}function dU(t){let e=t.getType(),n=Mr();if(n._readOnly){let i=Nb(n).get(e);return i?Array.from(i.values()):[]}let o=n._nodeMap,r=[];for(let[,i]of o)i instanceof t&&i.__type===e&&i.isAttached()&&r.push(i);return r}function iN(t,e,n){let o=t.getParent(),r=n,i=t;return o!==null&&(e&&n===0?(r=i.getIndexWithinParent(),i=o):e||n!==i.getChildrenSize()||(r=i.getIndexWithinParent()+1,i=o)),i.getChildAtIndex(e?r-1:r)}function S1(t,e){let n=t.offset;if(t.type==="element")return iN(t.getNode(),e,n);{let o=t.getNode();if(e&&n===0||!e&&n===o.getTextContentSize()){let r=e?o.getPreviousSibling():o.getNextSibling();return r===null?iN(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function k1(t){let e=co(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function J(t,e,n){return(function(o,r,i){let s=oy(o);for(let a=4;a>=0;a--)for(let l=0;l<s.length;l++){let c=s[l],d=c._commands.get(r);if(d!==void 0){let u=d[a];if(u!==void 0){let p=Array.from(u),f=p.length,h=!1;if(Yn(c,(()=>{for(let m=0;m<f;m++)if(p[m](i,o))return void(h=!0)})),h)return h}}}return!1})(t,e,n)}function Lp(t){return!Nn(t)&&!t.isLastChild()&&!t.isInline()}function La(t,e){let n=t._keyToDOMMap.get(e);return n===void 0&&V(75,e),n}function Mc(t){let e=t.assignedSlot||t.parentElement;return A1(e)?e.host:e}function ay(t){return _1(t)?t:yn(t)?t.ownerDocument:null}function uU(t){return nt()._updateTags.has(t)}function N1(t){Ut(),nt()._updateTags.add(t)}function D1(t){Ut(),nt()._deferred.push(t)}function Ep(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function ly(t){let e=ay(t);return e?e.defaultView:null}function co(t){let e=t._window;return e===null&&V(78),e}function pU(t){return U(t)&&t.isInline()||Ye(t)&&t.isInline()}function O1(t){let e=t.getParentOrThrow();for(;e!==null;){if(xo(e))return e;e=e.getParentOrThrow()}return e}function xo(t){return Nn(t)||U(t)&&t.isShadowRoot()}function cy(t){let e=t.constructor.clone(t);return b1(e,null),e.afterCloneFrom(t),e}function Ac(t){let e=nt(),n=t.getType(),o=ey(e,n);o===void 0&&V(200,t.constructor.name,n);let{replace:r,replaceWithKlass:i}=o;if(r!==null){let s=r(t),a=s.constructor;return i!==null?s instanceof i||V(201,i.name,i.getType(),a.name,a.getType(),t.constructor.name,n):s instanceof t.constructor&&a!==t.constructor||V(202,a.name,a.getType(),t.constructor.name,n),s.__key===t.__key&&V(203,t.constructor.name,n,a.name,a.getType()),s}return t}function tb(t,e){!Nn(t.getParent())||U(e)||Ye(e)||V(99)}function I1(t){let e=At(t);return e===null&&V(63,t),e}function nb(t){return(Ye(t)||U(t)&&!t.canBeEmpty())&&!t.isInline()}function Sb(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;let o=t.parentElement;o!==null&&o.removeChild(t)}function Vo(t){return vo?(t||window).getSelection():null}function M1(t){let e=ly(t);return e?e.getSelection():null}function fU(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),xo(t)&&V(102);let o=s=>{let a=s.getParentOrThrow(),l=xo(a),c=s!==n||l?cy(s):s;if(l)return U(s)&&U(c)||V(133),s.insertAfter(c),[s,c,c];{let[d,u,p]=o(a),f=s.getNextSiblings();return p.append(c,...f),[d,u,c]}},[r,i]=o(n);return[r,i]}function hU(t){return yn(t)&&t.tagName==="A"}function yn(t){return Ha(t)&&t.nodeType===U6}function Ha(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function A1(t){return Ha(t)&&t.nodeType===W6}function L1(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function kb(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function kr(t){if(Ye(t)&&!t.isInline())return!0;if(!U(t)||xo(t))return!1;let e=t.getFirstChild(),n=e===null||is(e)||ee(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function ob(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}function dy(){return nt()}var sN=new WeakMap,gU=new Map;function Nb(t){if(!t._readOnly&&t.isEmpty())return gU;t._readOnly||V(192);let e=sN.get(t);return e||(e=(function(n){let o=new Map;for(let[r,i]of n._nodeMap){let s=i.__type,a=o.get(s);a||(a=new Map,o.set(s,a)),a.set(r,i)}return o})(t),sN.set(t,e)),e}function R1(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function P1(t,e){let n=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(n/40);e.setIndent(o)}function mU(t){t.__lexicalUnmanaged=!0}function F1(t){return t.__lexicalUnmanaged===!0}function uc(t,e){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(t,e)&&t[e]!==ci[e]}function uy(t){let e=xk in t.prototype?t.prototype[xk]():void 0,n=(function(s){return s===Nc||s===di||s===ci})(t),o=!n&&uc(t,"getType")?t.getType():void 0,r,i=o;if(e)if(o)r=e[o];else for(let[s,a]of Object.entries(e))i=s,r=a;if(!n&&i&&(uc(t,"getType")||(t.getType=()=>i),uc(t,"clone")||(t.clone=s=>(Zb(s),new t)),uc(t,"importJSON")||(t.importJSON=r&&r.$importJSON||(s=>new t().updateFromJSON(s))),!uc(t,"importDOM")&&r)){let{importDOM:s}=r;s&&(t.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:i}}function _U(t){let e=dy();return Ut(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var bU={next:"previous",previous:"next"},Ra=class{constructor(e){this.origin=e}[Symbol.iterator](){return hy({hasNext:ps,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Gt(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Gt(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){let o=this.getNodeAtCaret();return e.is(this.origin)||e.is(o)||(o===null?this.insert(e):o.replace(e,n)),this}splice(e,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),i=this,s=this.getParentAtCaret(),a=new Map;for(let l=i.getAdjacentCaret();l!==null&&a.size<e;l=l.getAdjacentCaret()){let c=l.origin.getWritable();a.set(c.getKey(),c)}for(let l of r){if(a.size>0){let c=i.getNodeAtCaret();if(c){if(a.delete(c.getKey()),a.delete(l.getKey()),!(c.is(l)||i.origin.is(l))){let d=l.getParent();d&&d.is(s)&&l.remove(),c.replace(l)}}else c===null&&V(263,Array.from(a).join(" "))}else i.insert(l);i=Gt(l,this.direction)}for(let l of a.values())l.remove();return this}},Dc=class t extends Ra{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Ir(e,this.direction)}getParentCaret(e="root"){return Gt(py(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=gi(this.direction);return Gt(this.getNodeAtCaret(),e)||Ir(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},yU={root:Nn,shadowRoot:xo};function gi(t){return bU[t]}function py(t,e="root"){return yU[e](t)?null:t}var Pa=class t extends Ra{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Gt(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return U(this.origin)?Ir(this.origin,this.direction):null}getParentCaret(e="root"){return Gt(py(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=gi(this.direction);return Gt(this.getNodeAtCaret(),e)||Ir(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof t||e instanceof Fa)&&this.direction===e.direction&&this.origin.is(e.origin)}},Fa=class t extends Ra{type="text";constructor(e,n){super(e),this.offset=n}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:ui(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Gt(py(this.getParentAtCaret(),e),this.direction)}getFlipped(){return ui(this.origin,gi(this.direction),this.offset)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Pa||e instanceof t)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Gt(this.origin,this.direction)}};function Dr(t){return t instanceof Fa}function xU(t){return t instanceof Ra}function ps(t){return t instanceof Pa}function bo(t){return t instanceof Dc}var vU={next:class extends Fa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},CU={next:class extends Pa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Pa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},EU={next:class extends Dc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Dc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Gt(t,e){return t?new CU[e](t):null}function ui(t,e,n){return t?new vU[e](t,fs(t,n)):null}function fs(t,e){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&((function(r,...i){let s=new URL("https://lexical.dev/docs/error"),a=new URLSearchParams;a.append("code",r);for(let l of i)a.append("v",l);s.search=a.toString(),console.warn(`Minified Lexical warning #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function Db(t,e){return new wp(t,e)}function Ir(t,e){return U(t)?new EU[e](t):null}function B1(t){return t&&t.getChildCaret()||t}function Ba(t){return t&&B1(t.getAdjacentCaret())}var Ob=class t{type="node-caret-range";constructor(e,n,o){this.anchor=e,this.focus=n,this.direction=o}getLatest(){let e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new t(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=r=>{let i=this[r].getLatest();return Dr(i)?(function(s,a){let{direction:l,origin:c}=s,d=fs(c,a==="focus"?gi(l):l);return Db(s,d-s.offset)})(i,r):null},n=e("anchor"),o=e("focus");if(n&&o){let{caret:r}=n,{caret:i}=o;if(r.isSameNodeCaret(i))return[Db(r,i.offset-r.offset),null]}return[n,o]}iterNodeCarets(e="root"){let n=Dr(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Dr(o),i=s=>s.isSameNodeCaret(o)?null:Ba(s)||s.getParentCaret(e);return hy({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},wp=class{type="slice";constructor(e,n){this.caret=e,this.distance=n}getSliceIndices(){let{distance:e,caret:{offset:n}}=this,o=n+e;return o<n?[o,n]:[n,o]}getTextContent(){let[e,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:n}}=this,[o,r]=this.getSliceIndices(),i=e.getTextContent();return ui(e.setTextContent(i.slice(0,o)+i.slice(r)),n,o)}};function wU(t){return t instanceof wp}function fy(t){return pi(t,Gt(On(),t.direction))}function $1(t){return pi(t,t)}function pi(t,e){return t.direction!==e.direction&&V(265),new Ob(t,e,t.direction)}function hy(t){let{initial:e,hasNext:n,step:o,map:r}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};let s={done:!1,value:r(i)};return i=o(i),s}}}function gy(t,e){let n=_c(t.origin,e.origin);switch(n===null&&V(275,t.origin.getKey(),e.origin.getKey()),n.type){case"same":{let o=t.type==="text",r=e.type==="text";return o&&r?(function(i,s){return Math.sign(i-s)})(t.offset,e.offset):t.type===e.type?0:o?-1:r?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return my(n)}}function my(t){let{a:e,b:n}=t,o=e.__key,r=n.__key,i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===r)return-1;if(s.__key===o)return 1}return i===null?1:-1}function tp(t,e){return e.is(t)}function aN(t){return U(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function _c(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let n=new Map;for(let[o,r]=aN(t);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=aN(e);o;r=o,o=o.getParent()){let i=n.get(o);if(i!==void 0)return i===null?(tp(t,o)||V(276),{commonAncestor:o,type:"ancestor"}):r===null?(tp(e,o)||V(277),{commonAncestor:o,type:"descendant"}):((U(i)||tp(t,i))&&(U(r)||tp(e,r))&&o.is(i.getParent())&&o.is(r.getParent())||V(278),{a:i,b:r,commonAncestor:o,type:"branch"})}return null}function fi(t,e){let{type:n,key:o,offset:r}=t,i=I1(t.key);return n==="text"?(ee(i)||V(266,i.getType(),o),ui(i,e,r)):(U(i)||V(267,i.getType(),o),U1(i,t.offset,e))}function $a(t,e){let{origin:n,direction:o}=e,r=o==="next";Dr(e)?t.set(n.getKey(),e.offset,"text"):ps(e)?ee(n)?t.set(n.getKey(),fs(n,o),"text"):t.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(bo(e)&&U(n)||V(268),t.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function z1(t){let e=Pe(),n=de(e)?e:i1();return bc(n,t),In(n),n}function bc(t,e){$a(t.anchor,e.anchor),$a(t.focus,e.focus)}function Ib(t){let{anchor:e,focus:n}=t,o=fi(e,"next"),r=fi(n,"next"),i=gy(o,r)<=0?"next":"previous";return pi(hi(o,i),hi(r,i))}function Ka(t){let{direction:e,origin:n}=t,o=Gt(n,gi(e)).getNodeAtCaret();return o?Gt(o,e):Ir(n.getParentOrThrow(),e)}function lN(t,e="root"){let n=[t];for(let o=bo(t)?t.getParentCaret(e):t.getSiblingCaret();o!==null;o=o.getParentCaret(e))n.push(Ka(o));return n}function rb(t){return!!t&&t.origin.isAttached()}function H1(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let n="root",o="next",r=e,i=_y(t,o),s=lN(i.anchor,n),a=lN(i.focus.getFlipped(),n),l=new Set,c=[];for(let h of i.iterNodeCarets(n))if(bo(h))l.add(h.origin.getKey());else if(ps(h)){let{origin:m}=h;U(m)&&!l.has(m.getKey())||c.push(m)}for(let h of c)h.remove();for(let h of i.getTextSlices()){if(!h)continue;let{origin:m}=h.caret,_=m.getTextContentSize(),b=Ka(Gt(m,o)),y=m.getMode();if(Math.abs(h.distance)===_&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)b.remove();else if(h.distance!==0){r="removeEmptySlices";let x=h.removeTextSlice(),v=h.caret.origin;if(y==="segmented"){let E=x.origin,C=Kt(E.getTextContent()).setStyle(E.getStyle()).setFormat(E.getFormat());b.replaceOrInsert(C),x=ui(C,o,x.offset)}v.is(s[0].origin)&&(s[0]=x),v.is(a[0].origin)&&(a[0]=x.getFlipped())}}let d,u;for(let h of s)if(rb(h)){d=mo(h);break}for(let h of a)if(rb(h)){u=mo(h);break}let p=(function(h,m,_){if(!h||!m)return null;let b=h.getParentAtCaret(),y=m.getParentAtCaret();if(!b||!y)return null;let x=b.getParents().reverse();x.push(b);let v=y.getParents().reverse();v.push(y);let E=Math.min(x.length,v.length),C;for(C=0;C<E&&x[C]===v[C];C++);let k=(S,N)=>{let D;for(let O=C;O<S.length;O++){let M=S[O];if(xo(M))return;!D&&N(M)&&(D=M)}return D},T=k(x,kr),w=T&&k(v,(S=>_.has(S.getKey())&&kr(S)));return T&&w?[T,w]:null})(d,u,l);if(p){let[h,m]=p;Ir(h,"previous").splice(0,m.getChildren()),m.remove()}let f=[d,u,...s,...a].find(rb);if(f)return $1(hi(mo(f),t.direction));V(269,JSON.stringify(s.map((h=>h.origin.__key))))}function mo(t){let e=(function(r){let i=r;for(;bo(i);){let s=Ba(i);if(!bo(s))break;i=s}return i})(t.getLatest()),{direction:n}=e;if(ee(e.origin))return Dr(e)?e:ui(e.origin,n,n);let o=e.getAdjacentCaret();return ps(o)&&ee(o.origin)?ui(o.origin,n,gi(n)):e}function K1(t){return Dr(t)&&t.offset!==fs(t.origin,t.direction)}function hi(t,e){return t.direction===e?t:t.getFlipped()}function _y(t,e){return t.direction===e?t:pi(hi(t.focus,e),hi(t.anchor,e))}function U1(t,e,n){let o=Ir(t,"next");for(let r=0;r<e;r++){let i=o.getAdjacentCaret();if(i===null)break;o=i}return hi(o,n)}function TU(t,e="root"){let n=0,o=t,r=Ba(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=Ba(o)}return r&&[r,n]}function SU(t){let{origin:e,offset:n,direction:o}=t;if(n===fs(e,o))return t.getSiblingCaret();if(n===fs(e,gi(o)))return Ka(t.getSiblingCaret());let[r]=e.splitText(n);return ee(r)||V(281),hi(Gt(r,"next"),o)}function kU(t,e){return!0}function NU(t,{$copyElementNode:e=cy,$splitTextPointCaretNext:n=SU,rootMode:o="shadowRoot",$shouldSplit:r=kU}={}){if(Dr(t))return n(t);let i=t.getParentCaret(o);if(i){let{origin:s}=i;if(bo(t)&&(!s.canBeEmpty()||!r(s,"first")))return Ka(i);let a=(function(l){let c=[];for(let d=l.getAdjacentCaret();d;d=d.getAdjacentCaret())c.push(d.origin);return c})(t);(a.length>0||s.canBeEmpty()&&r(s,"last"))&&i.insert(e(s).splice(0,0,a))}return i}var A=by,oQ=A.$addUpdateTag,Tt=A.$applyNodeReplacement,mi=A.$caretFromPoint,j1=A.$caretRangeFromSelection,_i=A.$cloneWithProperties,rQ=A.$comparePointCaretNext,iQ=A.$copyNode,sQ=A.$create,Co=A.$createLineBreakNode,V1=A.$createNodeSelection,fe=A.$createParagraphNode,Go=A.$createPoint,Yo=A.$createRangeSelection,W1=A.$createRangeSelectionFromDom,Eo=A.$createTabNode,vt=A.$createTextNode,Lc=A.$extendCaretToRange,gs=A.$getAdjacentChildCaret,yy=A.$getAdjacentNode,aQ=A.$getAdjacentSiblingOrParentSiblingCaret,xy=A.$getCaretInDirection,Rp=A.$getCaretRange,G1=A.$getCaretRangeInDirection,Y1=A.$getCharacterOffsets,qn=A.$getChildCaret,lQ=A.$getChildCaretAtIndex,vy=A.$getChildCaretOrSelf,q1=A.$getCollapsedCaretRange,cQ=A.$getCommonAncestor,dQ=A.$getCommonAncestorResultBranchOrder,ms=A.$getEditor,on=A.$getNearestNodeFromDOMNode,uQ=A.$getNearestRootOrShadowRoot,St=A.$getNodeByKey,pQ=A.$getNodeByKeyOrThrow,Ar=A.$getPreviousSelection,Qe=A.$getRoot,$=A.$getSelection,xn=A.$getSiblingCaret,X1=A.$getState,fQ=A.$getStateChange,hQ=A.$getTextContent,gQ=A.$getTextNodeOffset,J1=A.$getTextPointCaret,mQ=A.$getTextPointCaretSlice,_Q=A.$getWritableNodeState,Z1=A.$hasAncestor,bQ=A.$hasUpdateTag,wo=A.$insertNodes,Ua=A.$isBlockElementNode,bi=A.$isChildCaret,Mn=A.$isDecoratorNode,G=A.$isElementNode,Pp=A.$isExtendableTextPointCaret,Q1=A.$isInlineElementOrDecoratorNode,Rc=A.$isLeafNode,qe=A.$isLineBreakNode,yQ=A.$isNodeCaret,lt=A.$isNodeSelection,Yt=A.$isParagraphNode,F=A.$isRangeSelection,qo=A.$isRootNode,Lt=A.$isRootOrShadowRoot,Fp=A.$isSiblingCaret,An=A.$isTabNode,Z=A.$isTextNode,Bp=A.$isTextPointCaret,xQ=A.$isTextPointCaretSlice,Cy=A.$isTokenOrSegmented,vQ=A.$isTokenOrTab,CQ=A.$nodesOfType,Xo=A.$normalizeCaret,Lr=A.$normalizeSelection__EXPERIMENTAL,EQ=A.$onUpdate,eD=A.$parseSerializedNode,wQ=A.$removeTextFromCaretRange,tD=A.$rewindSiblingCaret,$p=A.$selectAll,TQ=A.$setCompositionKey,yi=A.$setPointFromCaret,ht=A.$setSelection,zp=A.$setSelectionFromCaretRange,nD=A.$setState,oD=A.$splitAtPointCaretNext,rD=A.$splitNode,SQ=A.$updateRangeSelectionFromCaretRange,Ey=A.ArtificialNode__DO_NOT_USE,kQ=A.BLUR_COMMAND,_s=A.CAN_REDO_COMMAND,bs=A.CAN_UNDO_COMMAND,iD=A.CLEAR_EDITOR_COMMAND,sD=A.CLEAR_HISTORY_COMMAND,Jo=A.CLICK_COMMAND,aD=A.COLLABORATION_TAG,Ct=A.COMMAND_PRIORITY_CRITICAL,Ce=A.COMMAND_PRIORITY_EDITOR,xi=A.COMMAND_PRIORITY_HIGH,Ae=A.COMMAND_PRIORITY_LOW,Hp=A.COMMAND_PRIORITY_NORMAL,Kp=A.CONTROLLED_TEXT_INSERTION_COMMAND,Up=A.COPY_COMMAND,jp=A.CUT_COMMAND,ja=A.DELETE_CHARACTER_COMMAND,Pc=A.DELETE_LINE_COMMAND,Vp=A.DELETE_WORD_COMMAND,NQ=A.DRAGEND_COMMAND,lD=A.DRAGOVER_COMMAND,cD=A.DRAGSTART_COMMAND,dD=A.DROP_COMMAND,Va=A.DecoratorNode,Rt=A.ElementNode,uD=A.FOCUS_COMMAND,Wp=A.FORMAT_ELEMENT_COMMAND,ot=A.FORMAT_TEXT_COMMAND,Wa=A.HISTORIC_TAG,Ga=A.HISTORY_MERGE_TAG,pD=A.HISTORY_PUSH_TAG,Ln=A.INDENT_CONTENT_COMMAND,wy=A.INSERT_LINE_BREAK_COMMAND,vi=A.INSERT_PARAGRAPH_COMMAND,ys=A.INSERT_TAB_COMMAND,Fc=A.INTERNAL_$isBlock,DQ=A.IS_ALL_FORMATTING,OQ=A.IS_BOLD,IQ=A.IS_CODE,MQ=A.IS_HIGHLIGHT,AQ=A.IS_ITALIC,LQ=A.IS_STRIKETHROUGH,RQ=A.IS_SUBSCRIPT,PQ=A.IS_SUPERSCRIPT,FQ=A.IS_UNDERLINE,Rr=A.KEY_ARROW_DOWN_COMMAND,Ya=A.KEY_ARROW_LEFT_COMMAND,Gp=A.KEY_ARROW_RIGHT_COMMAND,To=A.KEY_ARROW_UP_COMMAND,Yp=A.KEY_BACKSPACE_COMMAND,qp=A.KEY_DELETE_COMMAND,fD=A.KEY_DOWN_COMMAND,hD=A.KEY_ENTER_COMMAND,Ci=A.KEY_ESCAPE_COMMAND,BQ=A.KEY_MODIFIER_COMMAND,Xp=A.KEY_SPACE_COMMAND,Ei=A.KEY_TAB_COMMAND,$Q=A.LineBreakNode,Ty=A.MOVE_TO_END,Jp=A.MOVE_TO_START,zQ=A.NODE_STATE_KEY,uo=A.OUTDENT_CONTENT_COMMAND,wi=A.PASTE_COMMAND,gD=A.PASTE_TAG,HQ=A.ParagraphNode,mD=A.REDO_COMMAND,_D=A.REMOVE_TEXT_COMMAND,bD=A.RootNode,cn=A.SELECTION_CHANGE_COMMAND,Bc=A.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,yD=A.SELECT_ALL_COMMAND,KQ=A.SKIP_COLLAB_TAG,UQ=A.SKIP_DOM_SELECTION_TAG,jQ=A.SKIP_SCROLL_INTO_VIEW_TAG,xD=A.TEXT_TYPE_TO_FORMAT,VQ=A.TabNode,Pt=A.TextNode,vD=A.UNDO_COMMAND,Sy=A.buildImportMap,Rn=A.createCommand,CD=A.createEditor,WQ=A.createSharedNodeState,GQ=A.createState,YQ=A.flipDirection,qQ=A.getDOMOwnerDocument,Xn=A.getDOMSelection,XQ=A.getDOMSelectionFromTarget,ED=A.getDOMTextNode,JQ=A.getEditorPropertyFromDOMNode,wD=A.getNearestEditorFromDOMNode,TD=A.getRegisteredNode,ZQ=A.getRegisteredNodeOrThrow,SD=A.isBlockDomNode,kD=A.isCurrentlyReadOnlyMode,QQ=A.isDOMDocumentNode,Ti=A.isDOMNode,eee=A.isDOMTextNode,tee=A.isDOMUnmanaged,ky=A.isDocumentFragment,nee=A.isExactShortcutMatch,ND=A.isHTMLAnchorElement,xs=A.isHTMLElement,$c=A.isInlineDomNode,oee=A.isLexicalEditor,Pn=A.isModifierMatch,DD=A.isSelectionCapturedInDecoratorInput,OD=A.isSelectionWithinEditor,Ny=A.makeStepwiseIterator,ree=A.removeFromParent,iee=A.resetRandomKey,ID=A.setDOMUnmanaged,Dy=A.setNodeIndentFromDOM;var Ly={};Re(Ly,{$addNodeStyle:()=>AU,$cloneWithProperties:()=>_i,$copyBlockFormatIndent:()=>zD,$ensureForwardRangeSelection:()=>$D,$forEachSelectedTextNode:()=>BD,$getSelectionStyleValueForProperty:()=>HU,$isAtNodeEnd:()=>MU,$isParentElementRTL:()=>UD,$moveCaretSelection:()=>KD,$moveCharacter:()=>$U,$patchStyleText:()=>LU,$selectAll:()=>$p,$setBlocksType:()=>RU,$shouldOverrideDefaultCharacterSelection:()=>BU,$sliceSelectedTextNodeContent:()=>IU,$trimTextContentFromAnchor:()=>FD,$wrapNodes:()=>FU,createDOMRange:()=>DU,createRectsFromDOMRange:()=>OU,getCSSFromStyleObject:()=>PD,getStyleObjectFromCSS:()=>Qp,trimTextContentFromAnchor:()=>KU});function Ay(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Zp=new Map;function MD(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function AD(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function DU(t,e,n,o,r){let i=e.getKey(),s=o.getKey(),a=document.createRange(),l=t.getElementByKey(i),c=t.getElementByKey(s),d=n,u=r;if(Z(e)&&(l=MD(l)),Z(o)&&(c=MD(c)),e===void 0||o===void 0||l===null||c===null)return null;l.nodeName==="BR"&&([l,d]=AD(l)),c.nodeName==="BR"&&([c,u]=AD(c));let p=l.firstChild;l===c&&p!=null&&p.nodeName==="BR"&&d===0&&u===0&&(u=1);try{a.setStart(l,d),a.setEnd(c,u)}catch{return null}return!a.collapsed||d===u&&i===s||(a.setStart(c,u),a.setEnd(l,d)),a}function OU(t,e){let n=t.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(e.getClientRects()),a,l=s.length;s.sort(((c,d)=>{let u=c.top-d.top;return Math.abs(u)<=3?c.left-d.left:u}));for(let c=0;c<l;c++){let d=s[c],u=a&&a.top<=d.top&&a.top+a.height>d.top&&a.left+a.width>d.left,p=d.width+i===o.width;u||p?(s.splice(c--,1),l--):a=d}return s}function RD(t){let e={};if(!t)return e;let n=t.split(";");for(let o of n)if(o!==""){let[r,i]=o.split(/:([^]+)/);r&&i&&(e[r.trim()]=i.trim())}return e}function Qp(t){let e=Zp.get(t);return e===void 0&&(e=RD(t),Zp.set(t,e)),e}function PD(t){let e="";for(let n in t)n&&(e+=`${n}: ${t[n]};`);return e}function IU(t,e){let n=t.getStartEndPoints();if(e.isSelected(t)&&!Cy(e)&&n!==null){let[o,r]=n,i=t.isBackward(),s=o.getNode(),a=r.getNode(),l=e.is(s),c=e.is(a);if(l||c){let[d,u]=Y1(t),p=s.is(a),f=e.is(i?a:s),h=e.is(i?s:a),m,_=0;p?(_=d>u?u:d,m=d>u?d:u):f?(_=i?u:d,m=void 0):h&&(_=0,m=i?d:u),e.__text=e.__text.slice(_,m)}}return e}function MU(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return G(e)||Ay(177),t.offset===e.getChildrenSize()}function FD(t,e,n){let o=e.getNode(),r=n;if(G(o)){let i=o.getDescendantByIndex(e.offset);i!==null&&(o=i)}for(;r>0&&o!==null;){if(G(o)){let c=o.getLastDescendant();c!==null&&(o=c)}let i=o.getPreviousSibling(),s=0;if(i===null){let c=o.getParentOrThrow(),d=c.getPreviousSibling();for(;d===null;){if(c=c.getParent(),c===null){i=null;break}d=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,i=d)}let a=o.getTextContent();a===""&&G(o)&&!o.isInline()&&(a=`
114
+
115
+ `);let l=a.length;if(!Z(o)||r>=l){let c=o.getParent();o.remove(),c==null||c.getChildrenSize()!==0||qo(c)||c.remove(),r-=l+s,o=i}else{let c=o.getKey(),d=t.getEditorState().read((()=>{let f=St(c);return Z(f)&&f.isSimpleText()?f.getTextContent():null})),u=l-r,p=a.slice(0,u);if(d!==null&&d!==a){let f=Ar(),h=o;if(o.isSimpleText())o.setTextContent(d);else{let m=vt(d);o.replace(m),h=m}if(F(f)&&f.isCollapsed()){let m=f.anchor.offset;h.select(m,m)}}else if(o.isSimpleText()){let f=e.key===c,h=e.offset;h<r&&(h=l);let m=f?h-r:0,_=f?h:u;if(f&&m===0){let[b]=o.splitText(m,_);b.remove()}else{let[,b]=o.splitText(m,_);b.remove()}}else{let f=vt(p);o.replace(f)}r=0}}}function AU(t){let e=t.getStyle(),n=RD(e);Zp.set(e,n)}function Oy(t,e){(F(t)?t.isCollapsed():Z(t)||G(t))||Ay(280);let n=Qp(F(t)?t.style:Z(t)?t.getStyle():t.getTextStyle()),o=Object.entries(e).reduce(((i,[s,a])=>(typeof a=="function"?i[s]=a(n[s],t):a===null?delete i[s]:i[s]=a,i)),{...n}),r=PD(o);F(t)||Z(t)?t.setStyle(r):t.setTextStyle(r),Zp.set(r,o)}function LU(t,e){if(F(t)&&t.isCollapsed()){Oy(t,e);let n=t.anchor.getNode();G(n)&&n.isEmpty()&&Oy(n,e)}BD((n=>{Oy(n,e)}))}function BD(t){let e=$();if(!e)return;let n=new Map;if(F(e))for(let i of j1(e).getTextSlices())i&&n.set(i.caret.origin.getKey(),i.getSliceIndices());let o=e.getNodes();for(let i of o){if(!Z(i)||!i.canHaveFormat())continue;let[s,a]=(r=i,n.get(r.getKey())||[0,r.getTextContentSize()]);a!==s&&(Cy(i)||s===0&&a===i.getTextContentSize()?t(i):t(i.splitText(s,a)[s===0?0:1]))}var r;F(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&$D(e)}function $D(t){if(t.isBackward()){let{anchor:e,focus:n}=t,{key:o,offset:r,type:i}=e;e.set(n.key,n.offset,n.type),n.set(o,r,i)}}function zD(t,e){let n=t.getFormatType(),o=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),o!==e.getIndent()&&e.setIndent(o)}function RU(t,e,n=zD){if(t===null)return;let o=t.getStartEndPoints(),r=new Map,i=null;if(o){let[s,a]=o;i=Yo(),i.anchor.set(s.key,s.offset,s.type),i.focus.set(a.key,a.offset,a.type);let l=My(s.getNode(),Fc),c=My(a.getNode(),Fc);G(l)&&r.set(l.getKey(),l),G(c)&&r.set(c.getKey(),c)}for(let s of t.getNodes())if(G(s)&&Fc(s))r.set(s.getKey(),s);else if(o===null){let a=My(s,Fc);G(a)&&r.set(a.getKey(),a)}for(let[s,a]of r){let l=e();n(a,l),a.replace(l,!0),i&&(s===i.anchor.key&&i.anchor.set(l.getKey(),i.anchor.offset,i.anchor.type),s===i.focus.key&&i.focus.set(l.getKey(),i.focus.offset,i.focus.type))}i&&t.is($())&&ht(i)}function LD(t){return t.getNode().isAttached()}function PU(t){let e=t;for(;e!==null&&!Lt(e);){let n=e.getLatest(),o=e.getParent();n.getChildrenSize()===0&&e.remove(!0),e=o}}function FU(t,e,n=null){let o=t.getStartEndPoints(),r=o?o[0]:null,i=t.getNodes(),s=i.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),d=c.getChildren(),u=e();return u.setFormat(c.getFormatType()),u.setIndent(c.getIndent()),d.forEach((p=>u.append(p))),n&&(u=n.append(u)),void c.replace(u)}let a=null,l=[];for(let c=0;c<s;c++){let d=i[c];Lt(d)?(Iy(t,l,l.length,e,n),l=[],a=d):a===null||a!==null&&Z1(d,a)?l.push(d):(Iy(t,l,l.length,e,n),l=[d])}Iy(t,l,l.length,e,n)}function Iy(t,e,n,o,r=null){if(e.length===0)return;let i=e[0],s=new Map,a=[],l=G(i)?i:i.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let c=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,c=!0;break}if(l=l.getParentOrThrow(),Lt(l))break}let d=new Set;for(let h=0;h<n;h++){let m=e[h];G(m)&&m.getChildrenSize()===0&&d.add(m.getKey())}let u=new Set;for(let h=0;h<n;h++){let m=e[h],_=m.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Rc(m)&&!u.has(m.getKey())){let b=_.getKey();if(s.get(b)===void 0){let y=o();y.setFormat(_.getFormatType()),y.setIndent(_.getIndent()),a.push(y),s.set(b,y),_.getChildren().forEach((x=>{y.append(x),u.add(x.getKey()),G(x)&&x.getChildrenKeys().forEach((v=>u.add(v)))})),PU(_)}}else if(d.has(m.getKey())){G(m)||Ay(179);let b=o();b.setFormat(m.getFormatType()),b.setIndent(m.getIndent()),a.push(b),m.remove(!0)}}if(r!==null)for(let h=0;h<a.length;h++){let m=a[h];r.append(m)}let p=null;if(Lt(l))if(c)if(r!==null)l.insertAfter(r);else for(let h=a.length-1;h>=0;h--){let m=a[h];l.insertAfter(m)}else{let h=l.getFirstChild();if(G(h)&&(l=h),h===null)if(r)l.append(r);else for(let m=0;m<a.length;m++){let _=a[m];l.append(_),p=_}else if(r!==null)h.insertBefore(r);else for(let m=0;m<a.length;m++){let _=a[m];h.insertBefore(_),p=_}}else if(r)l.insertAfter(r);else for(let h=a.length-1;h>=0;h--){let m=a[h];l.insertAfter(m),p=m}let f=Ar();F(f)&&LD(f.anchor)&&LD(f.focus)?ht(f.clone()):p!==null?p.selectEnd():t.dirty=!0}function HD(t){let e=t.anchor.getNode(),n=qo(e)?e:e.getParentOrThrow(),o=ms().getElementByKey(n.getKey());if(o===null)return!1;let r=o.ownerDocument.defaultView;return r===null?!1:r.getComputedStyle(o).writingMode==="vertical-rl"}function BU(t,e){let n=HD(t)?!e:e,o=mi(t.focus,n?"previous":"next");if(Pp(o))return!1;for(let r of Lc(o)){if(bi(r))return!r.origin.isInline();if(!G(r.origin)){if(Mn(r.origin))return!0;break}}return!1}function KD(t,e,n,o){t.modify(e?"extend":"move",n,o)}function UD(t){let e=t.anchor.getNode();return(qo(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function $U(t,e,n){let o=UD(t),r;r=HD(t)||o?!n:n,KD(t,e,r,"character")}function zU(t,e,n){let o=Qp(t.getStyle());return o!==null&&o[e]||n}function HU(t,e,n=""){let o=null,r=t.getNodes(),i=t.anchor,s=t.focus,a=t.isBackward(),l=a?s.offset:i.offset,c=a?s.getNode():i.getNode();if(F(t)&&t.isCollapsed()&&t.style!==""){let d=Qp(t.style);if(d!==null&&e in d)return d[e]}for(let d=0;d<r.length;d++){let u=r[d];if((d===0||l!==0||!u.is(c))&&Z(u)){let p=zU(u,e,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}function My(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var KU=FD;var gt=Ly,jD=gt.$addNodeStyle,cee=gt.$cloneWithProperties,dee=gt.$copyBlockFormatIndent,uee=gt.$ensureForwardRangeSelection,pee=gt.$forEachSelectedTextNode,fee=gt.$getSelectionStyleValueForProperty,Ry=gt.$isAtNodeEnd,VD=gt.$isParentElementRTL,hee=gt.$moveCaretSelection,Py=gt.$moveCharacter,gee=gt.$patchStyleText,mee=gt.$selectAll,ef=gt.$setBlocksType,Fy=gt.$shouldOverrideDefaultCharacterSelection,tf=gt.$sliceSelectedTextNodeContent,_ee=gt.$trimTextContentFromAnchor,bee=gt.$wrapNodes,yee=gt.createDOMRange,WD=gt.createRectsFromDOMRange,xee=gt.getCSSFromStyleObject,By=gt.getStyleObjectFromCSS,vee=gt.trimTextContentFromAnchor;var Ky={};Re(Ky,{$descendantsMatching:()=>k3,$dfs:()=>d3,$dfsIterator:()=>tO,$filter:()=>C3,$findMatchingParent:()=>iO,$firstToLastIterator:()=>N3,$getAdjacentCaret:()=>u3,$getAdjacentSiblingOrParentSiblingCaret:()=>zc,$getDepth:()=>oO,$getNearestBlockElementAncestorOrThrow:()=>m3,$getNearestNodeOfType:()=>g3,$getNextRightPreorderNode:()=>h3,$getNextSiblingOrParentSibling:()=>f3,$insertFirst:()=>E3,$insertNodeToNearestRoot:()=>y3,$insertNodeToNearestRootAtCaret:()=>sO,$isEditorIsNestedEditor:()=>T3,$lastToFirstIterator:()=>Hy,$restoreEditorState:()=>b3,$reverseDfs:()=>p3,$reverseDfsIterator:()=>rO,$splitNode:()=>rD,$unwrapAndFilterDescendants:()=>S3,$unwrapNode:()=>D3,$wrapNodeInElement:()=>x3,CAN_USE_BEFORE_INPUT:()=>QU,CAN_USE_DOM:()=>ZD,IS_ANDROID:()=>e3,IS_ANDROID_CHROME:()=>t3,IS_APPLE:()=>n3,IS_APPLE_WEBKIT:()=>o3,IS_CHROME:()=>r3,IS_FIREFOX:()=>QD,IS_IOS:()=>i3,IS_SAFARI:()=>s3,addClassNamesToElement:()=>a3,calculateZoomLevel:()=>w3,isBlockDomNode:()=>SD,isHTMLAnchorElement:()=>ND,isHTMLElement:()=>xs,isInlineDomNode:()=>$c,isMimeType:()=>eO,makeStateWrapper:()=>O3,markSelection:()=>JD,mediaFileReader:()=>c3,mergeRegister:()=>qD,objectKlassEquals:()=>v3,positionNodeOnRange:()=>XD,registerNestedElementResolver:()=>_3,removeClassNamesFromElement:()=>l3,selectionAlwaysOnDisplay:()=>ZU});function of(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var So=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,UU=So&&"documentMode"in document?document.documentMode:null,jU=So&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),VU=So&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),WU=!(!So||!("InputEvent"in window)||UU)&&"getTargetRanges"in new window.InputEvent("input"),GU=So&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),YU=So&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,GD=So&&/Android/.test(navigator.userAgent),zy=So&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qU=So&&GD&&zy,XU=So&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!zy;function YD(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}function qD(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function Zo(t){return`${t}px`}var JU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function XD(t,e,n){let o=null,r=null,i=null,s=[],a=document.createElement("div");function l(){o===null&&of(182),r===null&&of(183);let{left:u,top:p}=r.getBoundingClientRect(),f=WD(t,e);var h,m;a.isConnected||(m=a,(h=r).insertBefore(m,h.firstChild));let _=!1;for(let b=0;b<f.length;b++){let y=f[b],x=s[b]||document.createElement("div"),v=x.style;v.position!=="absolute"&&(v.position="absolute",_=!0);let E=Zo(y.left-u);v.left!==E&&(v.left=E,_=!0);let C=Zo(y.top-p);v.top!==C&&(x.style.top=C,_=!0);let k=Zo(y.width);v.width!==k&&(x.style.width=k,_=!0);let T=Zo(y.height);v.height!==T&&(x.style.height=T,_=!0),x.parentNode!==a&&(a.append(x),_=!0),s[b]=x}for(;s.length>f.length;)s.pop();_&&n(s)}function c(){r=null,o=null,i!==null&&i.disconnect(),i=null,a.remove();for(let u of s)u.remove();s=[]}a.style.position="relative";let d=t.registerRootListener((function u(){let p=t.getRootElement();if(p===null)return c();let f=p.parentElement;if(!xs(f))return c();c(),o=p,r=f,i=new MutationObserver((h=>{let m=t.getRootElement(),_=m&&m.parentElement;if(m!==o||_!==r)return u();for(let b of h)if(!a.contains(b.target))return l()})),i.observe(f,JU),l()}));return()=>{d(),c()}}function nf(t,e,n){if(t.type!=="text"&&G(e)){let o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[ED(n)||n,t.offset]}function JD(t,e){let n=null,o=null,r=null,i=null,s=null,a=null,l=()=>{};function c(d){d.read((()=>{let u=$();if(!F(u))return n=null,r=null,i=null,a=null,l(),void(l=()=>{});let{anchor:p,focus:f}=u,h=p.getNode(),m=h.getKey(),_=p.offset,b=f.getNode(),y=b.getKey(),x=f.offset,v=t.getElementByKey(m),E=t.getElementByKey(y),C=n===null||v!==o||_!==r||m!==n.getKey(),k=i===null||E!==s||x!==a||y!==i.getKey();if((C||k)&&v!==null&&E!==null){let T=(function(w,S,N,D,O,M,I){let L=(w._window?w._window.document:document).createRange();return M.isBefore(N)?(L.setStart(...nf(O,M,I)),L.setEnd(...nf(S,N,D))):(L.setStart(...nf(S,N,D)),L.setEnd(...nf(O,M,I))),L})(t,p,h,v,f,b,E);l(),l=XD(t,T,(w=>{if(e===void 0)for(let S of w){let N=S.style;N.background!=="Highlight"&&(N.background="Highlight"),N.color!=="HighlightText"&&(N.color="HighlightText"),N.marginTop!==Zo(-1.5)&&(N.marginTop=Zo(-1.5)),N.paddingTop!==Zo(4)&&(N.paddingTop=Zo(4)),N.paddingBottom!==Zo(0)&&(N.paddingBottom=Zo(0))}else e(w)}))}n=h,o=v,r=_,i=b,s=E,a=x}))}return c(t.getEditorState()),qD(t.registerUpdateListener((({editorState:d})=>c(d))),(()=>{l()}))}function ZU(t){let e=null,n=()=>{let o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();r!==null&&i!==null&&i.contains(r)?e!==null&&(e(),e=null):e===null&&(e=JD(t))};return document.addEventListener("selectionchange",n),()=>{e!==null&&e(),document.removeEventListener("selectionchange",n)}}var QU=WU,ZD=So,e3=GD,t3=qU,n3=jU,o3=XU,r3=zy,QD=VU,i3=YU,s3=GU;function a3(t,...e){let n=YD(...e);n.length>0&&t.classList.add(...n)}function l3(t,...e){let n=YD(...e);n.length>0&&t.classList.remove(...n)}function eO(t,e){for(let n of e)if(t.type.startsWith(n))return!0;return!1}function c3(t,e){let n=t[Symbol.iterator]();return new Promise(((o,r)=>{let i=[],s=()=>{let{done:a,value:l}=n.next();if(a)return o(i);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",(()=>{let d=c.result;typeof d=="string"&&i.push({file:l,result:d}),s()})),eO(l,e)?c.readAsDataURL(l):s()};s()}))}function d3(t,e){return Array.from(tO(t,e))}function u3(t){return t?t.getAdjacentCaret():null}function p3(t,e){return Array.from(rO(t,e))}function tO(t,e){return nO("next",t,e)}function nO(t,e,n){let o=Qe(),r=e||o,i=G(r)?qn(r,t):xn(r,t),s=oO(r),a=n?gs(vy(xn(n,t))):(function(c,d){let u=zc(xn(c,d));return u&&u[0]})(r,t),l=s;return Ny({hasNext:c=>c!==null,initial:i,map:c=>({depth:l,node:c.origin}),step:c=>{if(c.isSameNodeCaret(a))return null;bi(c)&&l++;let d=zc(c);return!d||d[0].isSameNodeCaret(a)?null:(l+=d[1],d[0])}})}function f3(t){let e=zc(xn(t,"next"));return e&&[e[0].origin,e[1]]}function oO(t){let e=-1;for(let n=t;n!==null;n=n.getParent())e++;return e}function h3(t){let e=zc(vy(xn(t,"previous")),"root");return e&&e[0].origin}function rO(t,e){return nO("previous",t,e)}function g3(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function m3(t){let e=iO(t,(n=>G(n)&&!n.isInline()));return G(e)||of(4,t.__key),e}var iO=(t,e)=>{let n=t;for(;n!==Qe()&&n!=null;){if(e(n))return n;n=n.getParent()}return null};function _3(t,e,n,o){let r=i=>i instanceof e;return t.registerNodeTransform(e,(i=>{let s=(a=>{let l=a.getChildren();for(let u=0;u<l.length;u++){let p=l[u];if(r(p))return null}let c=a,d=a;for(;c!==null;)if(d=c,c=c.getParent(),r(c))return{child:d,parent:c};return null})(i);if(s!==null){let{child:a,parent:l}=s;if(a.is(i)){o(l,i);let c=a.getNextSiblings(),d=c.length;if(l.insertAfter(a),d!==0){let u=n(l);a.insertAfter(u);for(let p=0;p<d;p++)u.append(c[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}}))}function b3(t,e){let n=new Map,o=t._pendingEditorState;for(let[i,s]of e._nodeMap)n.set(i,_i(s));o&&(o._nodeMap=n),t._dirtyType=2;let r=e._selection;ht(r===null?null:r.clone())}function y3(t){let e=$()||Ar(),n;if(F(e))n=mi(e.focus,"next");else{if(e!=null){let s=e.getNodes(),a=s[s.length-1];a&&(n=xn(a,"next"))}n=n||qn(Qe(),"previous").getFlipped().insert(fe())}let o=sO(t,n),r=gs(o),i=bi(r)?Xo(r):o;return zp(q1(i)),t.getLatest()}function sO(t,e,n){let o=xy(e,"next");for(let r=o;r;r=oD(r,n))o=r;return Bp(o)&&of(283),o.insert(t.isInline()?fe().append(t):t),xy(xn(t.getLatest(),"next"),e.direction)}function x3(t,e){let n=e();return t.replace(n),n.append(t),n}function v3(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function C3(t,e){let n=[];for(let o=0;o<t.length;o++){let r=e(t[o]);r!==null&&n.push(r)}return n}function E3(t,e){qn(t,"next").insert(e)}var $y=!(QD||!ZD)&&void 0;function w3(t){let e=1;if((function(){if($y===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let o=n.getBoundingClientRect();n.style.setProperty("zoom","2"),$y=n.getBoundingClientRect().width===o.width,document.body.removeChild(n)}return $y})())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function T3(t){return t._parentEditor!==null}function S3(t,e){return aO(t,e,null)}function aO(t,e,n){let o=!1;for(let r of Hy(t))e(r)?n!==null&&n(r):(o=!0,G(r)&&aO(r,e,n||(i=>r.insertAfter(i))),r.remove());return o}function k3(t,e){let n=[],o=Array.from(t).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(e(r))n.push(r);else if(G(r))for(let i of Hy(r))o.push(i);return n}function N3(t){return lO(qn(t,"next"))}function Hy(t){return lO(qn(t,"previous"))}function lO(t){return Ny({hasNext:Fp,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function D3(t){tD(xn(t,"next")).splice(1,t.getChildren())}function zc(t,e="root"){let n=0,o=t,r=gs(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=gs(o)}return r&&[r,n]}function O3(t){let e=o=>X1(o,t),n=(o,r)=>nD(o,t,r);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:t}}var he=Ky,Uy=he.$descendantsMatching,cO=he.$dfs,See=he.$dfsIterator,dO=he.$filter,le=he.$findMatchingParent,kee=he.$firstToLastIterator,uO=he.$getAdjacentCaret,Nee=he.$getAdjacentSiblingOrParentSiblingCaret,Dee=he.$getDepth,vs=he.$getNearestBlockElementAncestorOrThrow,rf=he.$getNearestNodeOfType,Oee=he.$getNextRightPreorderNode,Iee=he.$getNextSiblingOrParentSibling,pO=he.$insertFirst,sf=he.$insertNodeToNearestRoot,Mee=he.$insertNodeToNearestRootAtCaret,fO=he.$isEditorIsNestedEditor,Aee=he.$lastToFirstIterator,Lee=he.$restoreEditorState,Ree=he.$reverseDfs,Pee=he.$reverseDfsIterator,Fee=he.$splitNode,jy=he.$unwrapAndFilterDescendants,Bee=he.$unwrapNode,$ee=he.$wrapNodeInElement,zee=he.CAN_USE_BEFORE_INPUT,Hee=he.CAN_USE_DOM,Kee=he.IS_ANDROID,Uee=he.IS_ANDROID_CHROME,Et=he.IS_APPLE,jee=he.IS_APPLE_WEBKIT,Vee=he.IS_CHROME,Wee=he.IS_FIREFOX,Gee=he.IS_IOS,Yee=he.IS_SAFARI,Ve=he.addClassNamesToElement,hO=he.calculateZoomLevel,Vy=he.isBlockDomNode,Wy=he.isHTMLAnchorElement,qt=he.isHTMLElement,qee=he.isInlineDomNode,Xee=he.isMimeType,Jee=he.makeStateWrapper,Zee=he.markSelection,Qee=he.mediaFileReader,Fe=he.mergeRegister,Jn=he.objectKlassEquals,ete=he.positionNodeOnRange,tte=he.registerNestedElementResolver,Fn=he.removeClassNamesFromElement,nte=he.selectionAlwaysOnDisplay;var qy={};Re(qy,{$createAutoLinkNode:()=>Gy,$createLinkNode:()=>Xa,$isAutoLinkNode:()=>Hc,$isLinkNode:()=>Si,$toggleLink:()=>_O,AutoLinkNode:()=>Kc,LinkNode:()=>qa,TOGGLE_LINK_COMMAND:()=>A3,formatUrl:()=>Yy,toggleLink:()=>L3});var I3=new Set(["http:","https:","mailto:","sms:","tel:"]),qa=class t extends Rt{static getType(){return"link"}static clone(e){return new t(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",n={},o){super(o);let{target:r=null,rel:i=null,title:s=null}=n;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){let n=document.createElement("a");return this.updateLinkDOM(null,n,e),Ve(n,e.theme.link),n}updateLinkDOM(e,n,o){if(Wy(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let r of["target","rel","title"]){let i=`__${r}`,s=this[i];e&&e[i]===s||(s?n[r]=s:n.removeAttribute(r))}}}updateDOM(e,n,o){return this.updateLinkDOM(e,n,o),!1}static importDOM(){return{a:e=>({conversion:M3,priority:1})}}static importJSON(e){return Xa().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Yy(e);try{let n=new URL(Yy(e));if(!I3.has(n.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let n=this.getWritable();return n.__url=e,n}getTarget(){return this.getLatest().__target}setTarget(e){let n=this.getWritable();return n.__target=e,n}getRel(){return this.getLatest().__rel}setRel(e){let n=this.getWritable();return n.__rel=e,n}getTitle(){return this.getLatest().__title}setTitle(e){let n=this.getWritable();return n.__title=e,n}insertNewAfter(e,n=!0){let o=Xa(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,n),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,o){if(!F(n))return!1;let r=n.anchor.getNode(),i=n.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function M3(t){let e=null;if(Wy(t)){let n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=Xa(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function Xa(t="",e){return Tt(new qa(t,e))}function Si(t){return t instanceof qa}var Kc=class t extends qa{constructor(e="",n={},o){super(e,n,o),this.__isUnlinked=n.isUnlinked!==void 0&&n.isUnlinked!==null&&n.isUnlinked}static getType(){return"autolink"}static clone(e){return new t(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let n=this.getWritable();return n.__isUnlinked=e,n}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,n,o){return super.updateDOM(e,n,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Gy().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,n=!0){let o=this.getParentOrThrow().insertNewAfter(e,n);if(G(o)){let r=Gy(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}};function Gy(t="",e){return Tt(new Kc(t,e))}function Hc(t){return t instanceof Kc}var A3=Rn("TOGGLE_LINK_COMMAND");function gO(t,e){if(t.type==="element"){let n=t.getNode();return G(n)||(function(o,...r){let i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",o);for(let a of r)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${o}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[t.offset+e]||null}return null}function _O(t,e={}){let{target:n,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,i=$();if(i===null||!F(i)&&!lt(i))return;if(lt(i)){let c=i.getNodes();return c.length===0?void 0:void c.forEach((d=>{if(t===null){let u=le(d,(p=>!Hc(p)&&Si(p)));u&&(u.insertBefore(d),u.getChildren().length===0&&u.remove())}else{let u=le(d,(p=>!Hc(p)&&Si(p)));if(u)u.setURL(t),n!==void 0&&u.setTarget(n),r!==void 0&&u.setRel(r);else{let p=Xa(t,{rel:r,target:n});d.insertBefore(p),p.append(d)}}}))}let s=i.extract();if(t===null)return void s.forEach((c=>{let d=le(c,(u=>!Hc(u)&&Si(u)));if(d){let u=d.getChildren();for(let p=0;p<u.length;p++)d.insertBefore(u[p]);d.remove()}}));let a=new Set,l=c=>{a.has(c.getKey())||(a.add(c.getKey()),c.setURL(t),n!==void 0&&c.setTarget(n),r!==void 0&&c.setRel(r),o!==void 0&&c.setTitle(o))};if(s.length===1){let c=mO(s[0],Si);if(c!==null)return l(c)}(function(c){let d=$();if(!F(d))return c();let u=Lr(d),p=u.isBackward(),f=gO(u.anchor,p?-1:0),h=gO(u.focus,p?0:-1),m=c();if(f||h){let _=$();if(F(_)){let b=_.clone();if(f){let y=f.getParent();y&&b.anchor.set(y.getKey(),f.getIndexWithinParent()+(p?1:0),"element")}if(h){let y=h.getParent();y&&b.focus.set(y.getKey(),h.getIndexWithinParent()+(p?0:1),"element")}ht(Lr(b))}}})((()=>{let c=null;for(let d of s){if(!d.isAttached())continue;let u=mO(d,Si);if(u){l(u);continue}if(G(d)){if(!d.isInline())continue;if(Si(d)){if(!(Hc(d)||c!==null&&c.getParentOrThrow().isParentOf(d))){l(d),c=d;continue}for(let f of d.getChildren())d.insertBefore(f);d.remove();continue}}let p=d.getPreviousSibling();Si(p)&&p.is(c)?p.append(d):(c=Xa(t,{rel:r,target:n,title:o}),d.insertAfter(c),c.append(d))}}))}var L3=_O;function mO(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var R3=/^\+?[0-9\s()-]{5,}$/;function Yy(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:R3.test(t)?`tel:${t}`:`https://${t}`}var Qo=qy,ste=Qo.$createAutoLinkNode,af=Qo.$createLinkNode,Uc=Qo.$isAutoLinkNode,Xe=Qo.$isLinkNode,lf=Qo.$toggleLink,bO=Qo.AutoLinkNode,Ja=Qo.LinkNode,Bn=Qo.TOGGLE_LINK_COMMAND,ate=Qo.formatUrl,lte=Qo.toggleLink;var ex={};Re(ex,{$createListItemNode:()=>Zn,$createListNode:()=>$n,$getListDepth:()=>cf,$handleListInsertParagraph:()=>DO,$insertList:()=>jc,$isListItemNode:()=>Oe,$isListNode:()=>Te,$removeList:()=>Qy,INSERT_CHECK_LIST_COMMAND:()=>OO,INSERT_ORDERED_LIST_COMMAND:()=>LO,INSERT_UNORDERED_LIST_COMMAND:()=>AO,ListItemNode:()=>Es,ListNode:()=>Za,REMOVE_LIST_COMMAND:()=>RO,UPDATE_LIST_START_COMMAND:()=>MO,insertList:()=>V3,registerCheckList:()=>K3,registerList:()=>U3,registerListStrictIndentTransform:()=>j3,removeList:()=>W3});function ki(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function cf(t){let e=1,n=t.getParent();for(;n!=null;){if(Oe(n)){let o=n.getParent();if(Te(o)){e++,n=o.getParent();continue}ki(40)}return e}return e}function Xy(t){let e=t.getParent();Te(e)||ki(40);let n=e;for(;n!==null;)n=n.getParent(),Te(n)&&(e=n);return e}function SO(t){let e=[],n=t.getChildren().filter(Oe);for(let o=0;o<n.length;o++){let r=n[o],i=r.getFirstChild();Te(i)?e=e.concat(SO(i)):e.push(r)}return e}function er(t){return Oe(t)&&Te(t.getFirstChild())}function yO(t){return Zn().append(t)}function kO(t,e){return Oe(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function jc(t){let e=$();if(e!==null){let n=e.getNodes();if(F(e)){let r=e.getStartEndPoints();r===null&&ki(143);let[i]=r,s=i.getNode(),a=s.getParent();if(Lt(s)){let l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{let c=fe();s.append(c),n=c.select().getNodes()}}else if(kO(s,n)){let l=$n(t);if(Lt(a)){s.replace(l);let c=Zn();G(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Oe(s)){let c=s.getParentOrThrow();Cs(l,c.getChildren()),c.replace(l)}return}}let o=new Set;for(let r=0;r<n.length;r++){let i=n[r];if(G(i)&&i.isEmpty()&&!Oe(i)&&!o.has(i.getKey())){xO(i,t);continue}let s=Rc(i)?i.getParent():Oe(i)&&i.isEmpty()?i:null;for(;s!=null;){let a=s.getKey();if(Te(s)){if(!o.has(a)){let l=$n(t);Cs(l,s.getChildren()),s.replace(l),o.add(a)}break}{let l=s.getParent();if(Lt(l)&&!o.has(a)){o.add(a),xO(s,t);break}s=l}}}}}function Cs(t,e){t.splice(t.getChildrenSize(),0,e)}function xO(t,e){if(Te(t))return t;let n=t.getPreviousSibling(),o=t.getNextSibling(),r=Zn(),i;if(Cs(r,t.getChildren()),Te(n)&&e===n.getListType())n.append(r),Te(o)&&e===o.getListType()&&(Cs(n,o.getChildren()),o.remove()),i=n;else if(Te(o)&&e===o.getListType())o.getFirstChildOrThrow().insertBefore(r),i=o;else{let s=$n(e);s.append(r),t.replace(s),i=s}return r.setFormat(t.getFormatType()),r.setIndent(t.getIndent()),t.remove(),i}function Zy(t,e){let n=t.getLastChild(),o=e.getFirstChild();n&&o&&er(n)&&er(o)&&(Zy(n.getFirstChild(),o.getFirstChild()),o.remove());let r=e.getChildren();r.length>0&&t.append(...r),e.remove()}function Qy(){let t=$();if(F(t)){let e=new Set,n=t.getNodes(),o=t.anchor.getNode();if(kO(o,n))e.add(Xy(o));else for(let r=0;r<n.length;r++){let i=n[r];if(Rc(i)){let s=rf(i,Es);s!=null&&e.add(Xy(s))}}for(let r of e){let i=r,s=SO(r);for(let a of s){let l=fe().setTextStyle(t.style).setTextFormat(t.format);Cs(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===t.anchor.key&&yi(t.anchor,Xo(qn(l,"next"))),a.__key===t.focus.key&&yi(t.focus,Xo(qn(l,"next"))),a.remove()}r.remove()}}}function NO(t){let e=t.getListType()!=="check",n=t.getStart();for(let o of t.getChildren())Oe(o)&&(o.getValue()!==n&&o.setValue(n),e&&o.getLatest().__checked!=null&&o.setChecked(void 0),Te(o.getFirstChild())||n++)}function P3(t){let e=new Set;if(er(t)||e.has(t.getKey()))return;let n=t.getParent(),o=t.getNextSibling(),r=t.getPreviousSibling();if(er(o)&&er(r)){let i=r.getFirstChild();if(Te(i)){i.append(t);let s=o.getFirstChild();Te(s)&&(Cs(i,s.getChildren()),o.remove(),e.add(o.getKey()))}}else if(er(o)){let i=o.getFirstChild();if(Te(i)){let s=i.getFirstChild();s!==null&&s.insertBefore(t)}}else if(er(r)){let i=r.getFirstChild();Te(i)&&i.append(t)}else if(Te(n)){let i=Zn().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=$n(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(t),r?r.insertAfter(i):o?o.insertBefore(i):n.append(i)}}function F3(t){if(er(t))return;let e=t.getParent(),n=e?e.getParent():void 0;if(Te(n?n.getParent():void 0)&&Oe(n)&&Te(e)){let o=e?e.getFirstChild():void 0,r=e?e.getLastChild():void 0;if(t.is(o))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(r))n.insertAfter(t),e.isEmpty()&&n.remove();else{let i=e.getListType(),s=Zn(),a=$n(i);s.append(a),t.getPreviousSiblings().forEach((d=>a.append(d)));let l=Zn(),c=$n(i);l.append(c),Cs(c,t.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(t)}}}function DO(){let t=$();if(!F(t)||!t.isCollapsed())return!1;let e=t.anchor.getNode();if(!Oe(e)||e.getChildrenSize()!==0)return!1;let n=Xy(e),o=e.getParent();Te(o)||ki(40);let r=o.getParent(),i;if(Lt(r))i=fe(),n.insertAfter(i);else{if(!Oe(r))return!1;i=Zn(),r.insertAfter(i)}i.setTextStyle(t.style).setTextFormat(t.format).select();let s=e.getNextSiblings();if(s.length>0){let a=$n(o.getListType());if(Oe(i)){let l=Zn();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){let c=l.getParent();if(c==null||!Oe(c)&&!Te(c))break;l=c}l.remove()})(e),!0}function df(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var Es=class extends Rt{$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;let n=e.getParent();Te(n)&&n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:Rt,importDOM:Sy({li:()=>({conversion:B3,priority:0})})})}constructor(e=1,n=void 0,o){super(o),this.__value=e===void 0?1:e,this.__checked=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let n=document.createElement("li");return this.updateListItemDOM(null,n,e),n}updateListItemDOM(e,n,o){let r=this.getParent();Te(r)&&r.getListType()==="check"&&(function(a,l,c,d){Te(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(n,this,e),n.value=this.__value,(function(a,l,c){let d=[],u=[],p=l.list,f=p?p.listitem:void 0,h;if(p&&p.nested&&(h=p.nested.listitem),f!==void 0&&d.push(...df(f)),p){let m=c.getParent(),_=Te(m)&&m.getListType()==="check",b=c.getChecked();_&&!b||u.push(p.listitemUnchecked),_&&b||u.push(p.listitemChecked),_&&d.push(b?p.listitemChecked:p.listitemUnchecked)}if(h!==void 0){let m=df(h);c.getChildren().some((_=>Te(_)))?d.push(...m):u.push(...m)}u.length>0&&Fn(a,...u),d.length>0&&Ve(a,...d)})(n,o.theme,this);let i=e?e.__style:"",s=this.__style;i!==s&&(s===""?n.removeAttribute("style"):n.style.cssText=s),(function(a,l,c){let d=By(l.__textStyle);for(let u in d)a.style.setProperty(`--listitem-marker-${u}`,d[u]);if(c)for(let u in By(c.__textStyle))u in d||a.style.removeProperty(`--listitem-marker-${u}`)})(n,this,e)}updateDOM(e,n,o){let r=n;return this.updateListItemDOM(e,r,o),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let n=this.createDOM(e._config),o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();return r&&(n.dir=r),{element:n}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let n=0;n<e.length;n++){let o=e[n];if(G(o)&&this.canMergeWith(o)){let r=o.getChildren();this.append(...r),o.remove()}else super.append(o)}return this}replace(e,n){if(Oe(e))return super.replace(e);this.setIndent(0);let o=this.getParentOrThrow();if(!Te(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{let r=$n(o.getListType()),i=this.getNextSibling();for(;i;){let s=i;i=i.getNextSibling(),r.append(s)}o.insertAfter(e),e.insertAfter(r)}return n&&(G(e)||ki(139),this.getChildren().forEach((r=>{e.append(r)}))),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,n=!0){let o=this.getParentOrThrow();if(Te(o)||ki(39),Oe(e))return super.insertAfter(e,n);let r=this.getNextSiblings();if(o.insertAfter(e,n),r.length!==0){let i=$n(o.getListType());r.forEach((s=>i.append(s))),e.insertAfter(i,n)}return e}remove(e){let n=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),n&&o&&er(n)&&er(o)&&(Zy(n.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,n=!0){let o=Zn().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,n),o}collapseAtStart(e){let n=fe();this.getChildren().forEach((s=>n.append(s)));let o=this.getParentOrThrow(),r=o.getParentOrThrow(),i=Oe(r);if(o.getChildrenSize()===1)if(i)o.remove(),r.select();else{o.insertBefore(n),o.remove();let s=e.anchor,a=e.focus,l=n.getKey();s.type==="element"&&s.getNode().is(this)&&s.set(l,s.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else o.insertBefore(n),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let n=this.getWritable();return n.__value=e,n}getChecked(){let e=this.getLatest(),n,o=this.getParent();return Te(o)&&(n=o.getListType()),n==="check"?!!e.__checked:void 0}setChecked(e){let n=this.getWritable();return n.__checked=e,n}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let n=e.getParentOrThrow(),o=0;for(;Oe(n);)n=n.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&ki(117),(e=Math.floor(e))>=0||ki(199);let n=this.getIndent();for(;n!==e;)n<e?(P3(this),n++):(F3(this),n--);return this}canInsertAfter(e){return Oe(e)}canReplaceWith(e){return Oe(e)}canMergeWith(e){return Oe(e)||Yt(e)}extractWithChild(e,n){if(!F(n))return!1;let o=n.anchor.getNode(),r=n.focus.getNode();return this.isParentOf(o)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return $n("bullet")}canMergeWhenEmpty(){return!0}};function B3(t){if(t.classList.contains("task-list-item")){for(let n of t.children)if(n.tagName==="INPUT")return $3(n)}let e=t.getAttribute("aria-checked");return{node:Zn(e==="true"||e!=="false"&&void 0)}}function $3(t){return t.getAttribute("type")!=="checkbox"?{node:null}:{node:Zn(t.hasAttribute("checked"))}}function Zn(t){return Tt(new Es(void 0,t))}function Oe(t){return t instanceof Es}var Za=class extends Rt{$config(){return this.config("list",{$transform:e=>{(function(n){let o=n.getNextSibling();Te(o)&&n.getListType()===o.getListType()&&Zy(n,o)})(e),NO(e)},extends:Rt,importDOM:Sy({ol:()=>({conversion:CO,priority:0}),ul:()=>({conversion:CO,priority:0})})})}constructor(e="number",n=1,o){super(o);let r=H3[e]||e;this.__listType=r,this.__tag=r==="number"?"ol":"ul",this.__start=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let n=this.getWritable();return n.__listType=e,n.__tag=e==="number"?"ol":"ul",n}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let n=this.getWritable();return n.__start=e,n}createDOM(e,n){let o=this.__tag,r=document.createElement(o);return this.__start!==1&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,vO(r,e.theme,this),r}updateDOM(e,n,o){return e.__tag!==this.__tag||(vO(n,o.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let n=this.createDOM(e._config,e);return qt(n)&&(this.__start!==1&&n.setAttribute("start",String(this.__start)),this.__listType==="check"&&n.setAttribute("__lexicalListType","check")),{element:n}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,n,o){let r=o;for(let i=0;i<o.length;i++){let s=o[i];Oe(s)||(r===o&&(r=[...o]),r[i]=Zn().append(!G(s)||Te(s)||s.isInline()?s:vt(s.getTextContent())))}return super.splice(e,n,r)}extractWithChild(e){return Oe(e)}};function vO(t,e,n){let o=[],r=[],i=e.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[],a=cf(n)-1,l=a%s.length,c=s[l],d=i[n.__tag],u,p=i.nested,f=i.checklist;if(p!==void 0&&p.list&&(u=p.list),d!==void 0&&o.push(d),f!==void 0&&n.__listType==="check"&&o.push(f),c!==void 0){o.push(...df(c));for(let h=0;h<s.length;h++)h!==l&&r.push(n.__tag+h)}if(u!==void 0){let h=df(u);a>1?o.push(...h):r.push(...h)}}r.length>0&&Fn(t,...r),o.length>0&&Ve(t,...o)}function z3(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];if(Oe(o)){e.push(o);let r=o.getChildren();r.length>1&&r.forEach((i=>{Te(i)&&e.push(yO(i))}))}else e.push(yO(o))}return e}function CO(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=$n("number",t.start):e==="ul"&&(n=(function(o){if(o.getAttribute("__lexicallisttype")==="check"||o.classList.contains("contains-task-list"))return!0;for(let r of o.childNodes)if(qt(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(t)?$n("check"):$n("bullet")),{after:z3,node:n}}var H3={ol:"number",ul:"bullet"};function $n(t="number",e=1){return Tt(new Za(t,e))}function Te(t){return t instanceof Za}var OO=Rn("INSERT_CHECK_LIST_COMMAND");function K3(t){return Fe(t.registerCommand(OO,(()=>(jc("check"),!0)),Ae),t.registerCommand(Rr,(e=>TO(e,t,!1)),Ae),t.registerCommand(To,(e=>TO(e,t,!0)),Ae),t.registerCommand(Ci,(()=>{if(Jy()!=null){let e=t.getRootElement();return e?.focus(),!0}return!1}),Ae),t.registerCommand(Xp,(e=>{let n=Jy();return!(n==null||!t.isEditable())&&(t.update((()=>{let o=on(n);Oe(o)&&(e.preventDefault(),o.toggleChecked())})),!0)}),Ae),t.registerCommand(Ya,(e=>t.getEditorState().read((()=>{let n=$();if(F(n)&&n.isCollapsed()){let{anchor:o}=n,r=o.type==="element";if(r||o.offset===0){let i=o.getNode(),s=le(i,(a=>G(a)&&!a.isInline()));if(Oe(s)){let a=s.getParent();if(Te(a)&&a.getListType()==="check"&&(r||s.getFirstDescendant()===i)){let l=t.getElementByKey(s.__key);if(l!=null&&document.activeElement!==l)return l.focus(),e.preventDefault(),!0}}}}return!1}))),Ae),t.registerRootListener(((e,n)=>{e!==null&&(e.addEventListener("click",EO),e.addEventListener("pointerdown",wO)),n!==null&&(n.removeEventListener("click",EO),n.removeEventListener("pointerdown",wO))})))}function IO(t,e){let n=t.target;if(!qt(n))return;let o=n.firstChild;if(qt(o)&&(o.tagName==="UL"||o.tagName==="OL"))return;let r=n.parentNode;if(!r||r.__lexicalListType!=="check")return;let i=n.getBoundingClientRect(),s=hO(n),a=t.clientX/s,l=window.getComputedStyle?window.getComputedStyle(n,"::before"):{width:"0px"},c=parseFloat(l.width),d=t.pointerType==="touch"?32:0;(n.dir==="rtl"?a<i.right+d&&a>i.right-c-d:a>i.left-d&&a<i.left+c+d)&&e()}function EO(t){IO(t,(()=>{if(qt(t.target)){let e=t.target,n=wD(e);n!=null&&n.isEditable()&&n.update((()=>{let o=on(e);Oe(o)&&(e.focus(),o.toggleChecked())}))}}))}function wO(t){IO(t,(()=>{t.preventDefault()}))}function Jy(){let t=document.activeElement;return qt(t)&&t.tagName==="LI"&&t.parentNode!=null&&t.parentNode.__lexicalListType==="check"?t:null}function TO(t,e,n){let o=Jy();return o!=null&&e.update((()=>{let r=on(o);if(!Oe(r))return;let i=(function(s,a){let l=a?s.getPreviousSibling():s.getNextSibling(),c=s;for(;l==null&&Oe(c);)c=c.getParentOrThrow().getParent(),c!=null&&(l=a?c.getPreviousSibling():c.getNextSibling());for(;Oe(l);){let d=a?l.getLastChild():l.getFirstChild();if(!Te(d))return l;l=a?d.getLastChild():d.getFirstChild()}return null})(r,n);if(i!=null){i.selectStart();let s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout((()=>{s.focus()}),0))}})),!1}var MO=Rn("UPDATE_LIST_START_COMMAND"),AO=Rn("INSERT_UNORDERED_LIST_COMMAND"),LO=Rn("INSERT_ORDERED_LIST_COMMAND"),RO=Rn("REMOVE_LIST_COMMAND");function U3(t){return Fe(t.registerCommand(LO,(()=>(jc("number"),!0)),Ae),t.registerCommand(MO,(e=>{let{listNodeKey:n,newStart:o}=e,r=St(n);return!!Te(r)&&(r.getListType()==="number"&&(r.setStart(o),NO(r)),!0)}),Ae),t.registerCommand(AO,(()=>(jc("bullet"),!0)),Ae),t.registerCommand(RO,(()=>(Qy(),!0)),Ae),t.registerCommand(vi,(()=>DO()),Ae),t.registerNodeTransform(Es,(e=>{let n=e.getFirstChild();if(n){if(Z(n)){let o=n.getStyle(),r=n.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let o=$();F(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}})),t.registerNodeTransform(Pt,(e=>{let n=e.getParent();if(Oe(n)&&e.is(n.getFirstChild())){let o=e.getStyle(),r=e.getFormat();o===n.getTextStyle()&&r===n.getTextFormat()||n.setTextStyle(o).setTextFormat(r)}})))}function j3(t){let e=n=>{let o=n.getParent();if(Te(n.getFirstChild())||!Te(o))return;let r=le(n,(i=>Oe(i)&&Te(i.getParent())&&Oe(i.getPreviousSibling())));if(r===null&&n.getIndent()>0)n.setIndent(0);else if(Oe(r)){let i=r.getPreviousSibling();if(Oe(i)){let s=(function(l){let c=l,d=c.getFirstChild();for(;Te(d);){let u=d.getLastChild();if(!Oe(u))break;c=u,d=c.getFirstChild()}return c})(i),a=s.getParent();if(Te(a)){let l=cf(a);l+1<cf(o)&&n.setIndent(l)}}}};return t.registerNodeTransform(Za,(n=>{let o=[n];for(;o.length>0;){let r=o.shift();if(Te(r)){for(let i of r.getChildren())if(Oe(i)){e(i);let s=i.getFirstChild();Te(s)&&o.push(s)}}}}))}function V3(t,e){t.update((()=>jc(e)))}function W3(t){t.update((()=>Qy()))}var kt=ex,Vc=kt.$createListItemNode,Qa=kt.$createListNode,fte=kt.$getListDepth,hte=kt.$handleListInsertParagraph,gte=kt.$insertList,Wc=kt.$isListItemNode,vn=kt.$isListNode,mte=kt.$removeList,_te=kt.INSERT_CHECK_LIST_COMMAND,PO=kt.INSERT_ORDERED_LIST_COMMAND,FO=kt.INSERT_UNORDERED_LIST_COMMAND,Ni=kt.ListItemNode,tr=kt.ListNode,bte=kt.REMOVE_LIST_COMMAND,yte=kt.UPDATE_LIST_START_COMMAND,xte=kt.insertList,vte=kt.registerCheckList,BO=kt.registerList,$O=kt.registerListStrictIndentTransform,Cte=kt.removeList;var tx={};Re(tx,{LexicalComposerContext:()=>zO,createLexicalComposerContext:()=>G3,useLexicalComposerContext:()=>Y3});ut();var zO=Ot(null);function G3(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}}function Y3(){let t=It(zO);return t==null&&(function(e,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(let i of n)r.append("v",i);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),t}var nx=tx,HO=nx.LexicalComposerContext,KO=nx.createLexicalComposerContext,be=nx.useLexicalComposerContext;var ox={};Re(ox,{AutoFocusPlugin:()=>q3});ut();function q3({defaultSelection:t}){let[e]=be();return P((()=>{e.focus((()=>{let n=document.activeElement,o=e.getRootElement();o===null||n!==null&&o.contains(n)||o.focus({preventScroll:!0})}),{defaultSelection:t})}),[t,e]),null}var X3=ox,UO=X3.AutoFocusPlugin;var rx={};Re(rx,{LexicalComposer:()=>Z3});ut();var jO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,J3=jO?un:P,uf={tag:Ga};function Z3({initialConfig:t,children:e}){let n=X((()=>{let{theme:o,namespace:r,nodes:i,onError:s,editorState:a,html:l}=t,c=KO(null,o),d=CD({editable:t.editable,html:l,namespace:r,nodes:i,onError:u=>s(u,d),theme:o});return(function(u,p){if(p!==null){if(p===void 0)u.update((()=>{let f=Qe();if(f.isEmpty()){let h=fe();f.append(h);let m=jO?document.activeElement:null;($()!==null||m!==null&&m===u.getRootElement())&&h.select()}}),uf);else if(p!==null)switch(typeof p){case"string":{let f=u.parseEditorState(p);u.setEditorState(f,uf);break}case"object":u.setEditorState(p,uf);break;case"function":u.update((()=>{Qe().isEmpty()&&p(u)}),uf)}}})(d,a),[d,c]}),[]);return J3((()=>{let o=t.editable,[r]=n;r.setEditable(o===void 0||o)}),[]),g(HO.Provider,{value:n,children:e})}var Q3=rx,VO=Q3.LexicalComposer;var sx={};Re(sx,{$canShowPlaceholder:()=>GO,$canShowPlaceholderCurry:()=>tj,$findTextIntersectionFromCharacters:()=>nj,$isRootTextContentEmpty:()=>ix,$isRootTextContentEmptyCurry:()=>ej,$rootTextContent:()=>WO,registerLexicalTextEntity:()=>rj});function WO(){return Qe().getTextContent()}function ix(t,e=!0){if(t)return!1;let n=WO();return e&&(n=n.trim()),n===""}function ej(t,e){return()=>ix(t,e)}function GO(t){if(!ix(t,!1))return!1;let e=Qe().getChildren(),n=e.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=e[o];if(Mn(r))return!1;if(G(r)){if(!Yt(r)||r.__indent!==0)return!1;let i=r.getChildren(),s=i.length;for(let a=0;a<s;a++){let l=i[o];if(!Z(l))return!1}}}return!0}function tj(t){return()=>GO(t)}function nj(t,e){let n=t.getFirstChild(),o=0;e:for(;n!==null;){if(G(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(Z(n)){let s=n.getTextContentSize();if(o+s>e)return{node:n,offset:e-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let i=n.getParent();for(;i!==null;){let s=i.getNextSibling();if(s!==null){n=s;continue e}i=i.getParent()}break}return null}function oj(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function rj(t,e,n,o){let r=s=>s instanceof n,i=s=>{let a=vt(s.getTextContent());a.setFormat(s.getFormat()),s.replace(a)};return[t.registerNodeTransform(Pt,(s=>{if(!s.isSimpleText())return;let a,l=s.getPreviousSibling(),c=s.getTextContent(),d=s;if(Z(l)){let p=l.getTextContent(),f=e(p+c);if(r(l)){if(f===null||(h=>h.getLatest().__mode)(l)!==0)return void i(l);{let h=f.end-p.length;if(h>0){let m=p+c.slice(0,h);if(l.select(),l.setTextContent(m),h===c.length)s.remove();else{let _=c.slice(h);s.setTextContent(_)}return}}}else if(f===null||f.start<p.length)return}let u=0;for(;;){a=e(c);let p,f=a===null?"":c.slice(a.end);if(c=f,f===""){let m=d.getNextSibling();if(Z(m)){f=d.getTextContent()+m.getTextContent();let _=e(f);if(_===null)return void(r(m)?i(m):m.markDirty());if(_.start!==0)return}}if(a===null)return;if(a.start===0&&Z(l)&&l.isTextEntity()){u+=a.end;continue}a.start===0?[p,d]=d.splitText(a.end):[,p,d]=d.splitText(a.start+u,a.end+u),p===void 0&&oj(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),d==null)return;u=0,l=h}})),t.registerNodeTransform(n,(s=>{let a=s.getTextContent(),l=e(a);if(l===null||l.start!==0)return void i(s);if(a.length>l.end)return void s.splitText(l.end);let c=s.getPreviousSibling();Z(c)&&c.isTextEntity()&&(i(c),i(s));let d=s.getNextSibling();Z(d)&&d.isTextEntity()&&(i(d),r(s)&&i(s))}))]}var ws=sx,Fte=ws.$canShowPlaceholder,pf=ws.$canShowPlaceholderCurry,Bte=ws.$findTextIntersectionFromCharacters,$te=ws.$isRootTextContentEmpty,zte=ws.$isRootTextContentEmptyCurry,Hte=ws.$rootTextContent,Kte=ws.registerLexicalTextEntity;var ax={};Re(ax,{ContentEditable:()=>sj,ContentEditableElement:()=>XO});ut();var qO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function ij({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:d,ariaOwns:u,ariaRequired:p,autoCapitalize:f,className:h,id:m,role:_="textbox",spellCheck:b=!0,style:y,tabIndex:x,"data-testid":v,...E},C){let[k,T]=R(t.isEditable()),w=Ee((N=>{N&&N.ownerDocument&&N.ownerDocument.defaultView?t.setRootElement(N):t.setRootElement(null)}),[t]),S=X((()=>(function(...N){return D=>{N.forEach((O=>{typeof O=="function"?O(D):O!=null&&(O.current=D)}))}})(C,w)),[w,C]);return qO((()=>(T(t.isEditable()),t.registerEditableListener((N=>{T(N)})))),[t]),g("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":k&&_==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":d,"aria-owns":k?u:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:f,className:h,contentEditable:k,"data-testid":v,id:m,ref:S,role:_,spellCheck:b,style:y,tabIndex:x,...E})}var XO=$i(ij);function YO(t){return t.getEditorState().read(pf(t.isComposing()))}var sj=$i(aj);function aj(t,e){let{placeholder:n,...o}=t,[r]=be();return g(Me,{children:[g(XO,{editor:r,...o,ref:e}),n!=null&&g(lj,{editor:r,content:n})]})}function lj({content:t,editor:e}){let n=(function(s){let[a,l]=R((()=>YO(s)));return qO((()=>{function c(){let d=YO(s);l(d)}return c(),Fe(s.registerUpdateListener((()=>{c()})),s.registerEditableListener((()=>{c()})))}),[s]),a})(e),[o,r]=R(e.isEditable());if(un((()=>(r(e.isEditable()),e.registerEditableListener((s=>{r(s)})))),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(o):t!==null&&(i=t),i===null?null:g("div",{"aria-hidden":!0,children:i})}var JO=ax,ZO=JO.ContentEditable,qte=JO.ContentEditableElement;var cx={};Re(cx,{LexicalErrorBoundary:()=>dj});ut();function lx(t,e){return lx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},lx(t,e)}var QO={error:null},cj=(function(t){var e,n;function o(){for(var i,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return(i=t.call.apply(t,[this].concat(a))||this).state=QO,i.resetErrorBoundary=function(){for(var c,d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];i.props.onReset==null||(c=i.props).onReset.apply(c,u),i.reset()},i}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,lx(e,n),o.getDerivedStateFromError=function(i){return{error:i}};var r=o.prototype;return r.reset=function(){this.setState(QO)},r.componentDidCatch=function(i,s){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,s)},r.componentDidUpdate=function(i,s){var a,l,c,d,u=this.state.error,p=this.props.resetKeys;u!==null&&s.error!==null&&((c=i.resetKeys)===void 0&&(c=[]),(d=p)===void 0&&(d=[]),c.length!==d.length||c.some((function(f,h){return!Object.is(f,d[h])})))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,p),this.reset())},r.render=function(){var i=this.state.error,s=this.props,a=s.fallbackRender,l=s.FallbackComponent,c=s.fallback;if(i!==null){var d={error:i,resetErrorBoundary:this.resetErrorBoundary};if($v(c))return c;if(typeof a=="function")return a(d);if(l)return Bi(l,d);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},o})(Av);function dj({children:t,onError:e}){return g(cj,{fallback:g("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var uj=cx,eI=uj.LexicalErrorBoundary;var px={};Re(px,{createEmptyHistoryState:()=>bj,registerHistory:()=>_j});var ff=0,dx=1,ux=2,ko=0,pj=1,tI=2,fj=3,hj=4;function gj(t,e,n,o,r){if(t===null||n.size===0&&o.size===0&&!r)return ko;let i=e._selection,s=t._selection;if(r)return pj;if(!(F(i)&&F(s)&&s.isCollapsed()&&i.isCollapsed()))return ko;let a=(function(b,y,x){let v=b._nodeMap,E=[];for(let C of y){let k=v.get(C);k!==void 0&&E.push(k)}for(let[C,k]of x){if(!k)continue;let T=v.get(C);T===void 0||qo(T)||E.push(T)}return E})(e,n,o);if(a.length===0)return ko;if(a.length>1){let b=e._nodeMap,y=b.get(i.anchor.key),x=b.get(s.anchor.key);return y&&x&&!t._nodeMap.has(y.__key)&&Z(y)&&y.__text.length===1&&i.anchor.offset===1?tI:ko}let l=a[0],c=t._nodeMap.get(l.__key);if(!Z(c)||!Z(l)||c.__mode!==l.__mode)return ko;let d=c.__text,u=l.__text;if(d===u)return ko;let p=i.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return ko;let h=p.offset,m=f.offset,_=u.length-d.length;return _===1&&m===h-1?tI:_===-1&&m===h+1?fj:_===-1&&m===h?hj:ko}function mj(t,e){let n=Date.now(),o=ko;return(r,i,s,a,l,c)=>{let d=Date.now();if(c.has(Wa))return o=ko,n=d,ux;let u=gj(r,i,a,l,t.isComposing()),p=(()=>{let f=s===null||s.editor===t,h=c.has(pD);if(!h&&f&&c.has(Ga))return ff;if(r===null)return dx;let m=i._selection;return a.size>0||l.size>0?h===!1&&u!==ko&&u===o&&d<n+e&&f||a.size===1&&(function(_,b,y){let x=b._nodeMap.get(_),v=y._nodeMap.get(_),E=b._selection,C=y._selection;return!(F(E)&&F(C)&&E.anchor.type==="element"&&E.focus.type==="element"&&C.anchor.type==="text"&&C.focus.type==="text"||!Z(x)||!Z(v)||x.__parent!==v.__parent)&&JSON.stringify(b.read((()=>x.exportJSON())))===JSON.stringify(y.read((()=>v.exportJSON())))})(Array.from(a)[0],r,i)?ff:dx:m!==null?ff:ux})();return n=d,o=u,p}}function nI(t){t.undoStack=[],t.redoStack=[],t.current=null}function _j(t,e,n){let o=mj(t,n);return Fe(t.registerCommand(vD,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(l.length!==0){let c=s.current,d=l.pop();c!==null&&(a.push(c),i.dispatchCommand(_s,!0)),l.length===0&&i.dispatchCommand(bs,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:Wa})}})(t,e),!0)),Ce),t.registerCommand(mD,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(a.length!==0){let c=s.current;c!==null&&(l.push(c),i.dispatchCommand(bs,!0));let d=a.pop();a.length===0&&i.dispatchCommand(_s,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:Wa})}})(t,e),!0)),Ce),t.registerCommand(iD,(()=>(nI(e),!1)),Ce),t.registerCommand(sD,(()=>(nI(e),t.dispatchCommand(_s,!1),t.dispatchCommand(bs,!1),!0)),Ce),t.registerUpdateListener((({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{let d=e.current,u=e.redoStack,p=e.undoStack,f=d===null?null:d.editorState;if(d!==null&&i===f)return;let h=o(s,i,d,a,l,c);if(h===dx)u.length!==0&&(e.redoStack=[],t.dispatchCommand(_s,!1)),d!==null&&(p.push({...d}),t.dispatchCommand(bs,!0));else if(h===ux)return;e.current={editor:t,editorState:i}})))}function bj(){return{current:null,redoStack:[],undoStack:[]}}var oI=px,hf=oI.createEmptyHistoryState,rI=oI.registerHistory;var fx={};Re(fx,{HistoryPlugin:()=>yj,createEmptyHistoryState:()=>hf});ut();function yj({delay:t,externalHistoryState:e}){let[n]=be();return(function(o,r,i=1e3){let s=X((()=>r||hf()),[r]);P((()=>rI(o,s,i)),[i,o,s])})(n,e,t),null}var iI=fx,sI=iI.HistoryPlugin,aI=iI.createEmptyHistoryState;var hx={};Re(hx,{useLexicalNodeSelection:()=>xj});ut();function lI(t,e){return t.getEditorState().read((()=>{let n=St(e);return n!==null&&n.isSelected()}))}function xj(t){let[e]=be(),[n,o]=R((()=>lI(e,t)));return P((()=>{let r=!0,i=e.registerUpdateListener((()=>{r&&o(lI(e,t))}));return()=>{r=!1,i()}}),[e,t]),[n,Ee((r=>{e.update((()=>{let i=$();lt(i)||(i=V1(),ht(i)),lt(i)&&(r?i.add(t):i.delete(t))}))}),[e,t]),Ee((()=>{e.update((()=>{let r=$();lt(r)&&r.clear()}))}),[e])]}var vj=hx,gf=vj.useLexicalNodeSelection;var mx={};Re(mx,{$createHorizontalRuleNode:()=>gx,$isHorizontalRuleNode:()=>Tj,HorizontalRuleNode:()=>Gc,INSERT_HORIZONTAL_RULE_COMMAND:()=>Cj});ut();var Cj=Rn("INSERT_HORIZONTAL_RULE_COMMAND");function Ej({nodeKey:t}){let[e]=be(),[n,o,r]=gf(t);return P((()=>Fe(e.registerCommand(Jo,(i=>{let s=e.getElementByKey(t);return i.target===s&&(i.shiftKey||r(),o(!n),!0)}),Ae))),[r,e,n,t,o]),P((()=>{let i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?Ve(i,s):Fn(i,s))}),[e,n,t]),null}var Gc=class t extends Va{static getType(){return"horizontalrule"}static clone(e){return new t(e.__key)}static importJSON(e){return gx().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:wj,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){let n=document.createElement("hr");return Ve(n,e.theme.hr),n}getTextContent(){return`
116
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return g(Ej,{nodeKey:this.__key})}};function wj(){return{node:gx()}}function gx(){return Tt(new Gc)}function Tj(t){return t instanceof Gc}var mf=mx,el=mf.$createHorizontalRuleNode,cI=mf.$isHorizontalRuleNode,_f=mf.HorizontalRuleNode,bf=mf.INSERT_HORIZONTAL_RULE_COMMAND;var _x={};Re(_x,{HorizontalRulePlugin:()=>Sj});ut();function Sj(){let[t]=be();return P((()=>t.registerCommand(bf,(e=>{let n=$();if(!F(n))return!1;if(n.focus.getNode()!==null){let o=el();sf(o)}return!0}),Ce)),[t]),null}var kj=_x,dI=kj.HorizontalRulePlugin;var bx={};Re(bx,{LinkPlugin:()=>Nj});ut();function Nj({validateUrl:t,attributes:e}){let[n]=be();return P((()=>{if(!n.hasNodes([Ja]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Fe(n.registerCommand(Bn,(o=>{if(o===null)return lf(o),!0;if(typeof o=="string")return!(t!==void 0&&!t(o))&&(lf(o,e),!0);{let{url:r,target:i,rel:s,title:a}=o;return lf(r,{...e,rel:s,target:i,title:a}),!0}}),Ae),t!==void 0?n.registerCommand(wi,(o=>{let r=$();if(!F(r)||r.isCollapsed()||!Jn(o,ClipboardEvent)||o.clipboardData===null)return!1;let i=o.clipboardData.getData("text");return!!t(i)&&!r.getNodes().some((s=>G(s)))&&(n.dispatchCommand(Bn,{...e,url:i}),o.preventDefault(),!0)}),Ae):()=>{})}),[n,t,e]),null}var Dj=bx,uI=Dj.LinkPlugin;var yx={};Re(yx,{ListPlugin:()=>Oj});ut();function Oj({hasStrictIndent:t=!1}){let[e]=be();return P((()=>{if(!e.hasNodes([tr,Ni]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[e]),P((()=>{if(t)return $O(e)}),[e,t]),(function(n){P((()=>BO(n)),[n])})(e),null}var Ij=yx,pI=Ij.ListPlugin;var xx={};Re(xx,{useLexicalEditable:()=>Lj});ut();var Mj=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function Aj(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function Lj(){return(function(t){let[e]=be(),n=X((()=>t(e)),[e,t]),[o,r]=R((()=>n.initialValueFn())),i=Y(o);return Mj((()=>{let{initialValueFn:s,subscribe:a}=n,l=s();return i.current!==l&&(i.current=l,r(l)),a((c=>{i.current=c,r(c)}))}),[n,t]),o})(Aj)}var Rj=xx,fI=Rj.useLexicalEditable;var vx={};Re(vx,{registerDragonSupport:()=>Pj});function Pj(t){let e=window.location.origin,n=o=>{if(o.origin!==e)return;let r=t.getRootElement();if(document.activeElement!==r)return;let i=o.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let a=s.payload;if(a&&a.functionId==="makeChanges"){let l=a.args;if(l){let[c,d,u,p,f,h]=l;t.update((()=>{let m=$();if(F(m)){let _=m.anchor,b=_.getNode(),y=0,x=0;if(Z(b)&&c>=0&&d>=0&&(y=c,x=c+d,m.setTextNodeRange(b,y,b,x)),y===x&&u===""||(m.insertRawText(u),b=_.getNode()),Z(b)){y=p,x=p+f;let v=b.getTextContentSize();y=y>v?v:y,x=x>v?v:x,m.setTextNodeRange(b,y,b,x)}o.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var Fj=vx,hI=Fj.registerDragonSupport;var Cx={};Re(Cx,{$generateHtmlFromNodes:()=>$j,$generateNodesFromDOM:()=>Bj});function Bj(t,e){let n=e.body?e.body.childNodes:[],o=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];if(!mI.has(s.nodeName)){let a=_I(s,t,r,!1);a!==null&&(o=o.concat(a))}}return(function(i){for(let s of i)s.getNextSibling()instanceof Ey&&s.insertAfter(Co());for(let s of i){let a=s.getChildren();for(let l of a)s.insertBefore(l);s.remove()}})(r),o}function $j(t,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Qe().getChildren();for(let r=0;r<o.length;r++)gI(t,o[r],n,e);return n.innerHTML}function gI(t,e,n,o=null){let r=o===null||e.isSelected(o),i=G(e)&&e.excludeFromCopy("html"),s=e;if(o!==null){let f=_i(e);f=Z(f)&&o!==null?tf(o,f):f,s=f}let a=G(s)?s.getChildren():[],l=TD(t,s.getType()),c;c=l&&l.exportDOM!==void 0?l.exportDOM(t,s):s.exportDOM(t);let{element:d,after:u}=c;if(!d)return!1;let p=document.createDocumentFragment();for(let f=0;f<a.length;f++){let h=a[f],m=gI(t,h,p,o);!r&&G(e)&&m&&e.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!i){if((qt(d)||ky(d))&&d.append(p),n.append(d),u){let f=u.call(s,d);f&&(ky(d)?d.replaceChildren(f):d.replaceWith(f))}}else n.append(p);return r}var mI=new Set(["STYLE","SCRIPT"]);function _I(t,e,n,o,r=new Map,i){let s=[];if(mI.has(t.nodeName))return s;let a=null,l=(function(h,m){let{nodeName:_}=h,b=m._htmlConversions.get(_.toLowerCase()),y=null;if(b!==void 0)for(let x of b){let v=x(h);v!==null&&(y===null||(y.priority||0)<=(v.priority||0))&&(y=v)}return y!==null?y.conversion:null})(t,e),c=l?l(t):null,d=null;if(c!==null){d=c.after;let h=c.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(let[,m]of r)if(a=m(a,i),!a)break;a&&s.push(...Array.isArray(h)?h:[a])}c.forChild!=null&&r.set(t.nodeName,c.forChild)}let u=t.childNodes,p=[],f=(a==null||!Lt(a))&&(a!=null&&Ua(a)||o);for(let h=0;h<u.length;h++)p.push(..._I(u[h],e,n,f,new Map(r),a));return d!=null&&(p=d(p)),Vy(t)&&(p=zj(t,p,f?()=>{let h=new Ey;return n.push(h),h}:fe)),a==null?p.length>0?s=s.concat(p):Vy(t)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:$c(h.nextSibling)&&$c(h.previousSibling)})(t)&&(s=s.concat(Co())):G(a)&&a.append(...p),s}function zj(t,e,n){let o=t.style.textAlign,r=[],i=[];for(let s=0;s<e.length;s++){let a=e[s];if(Ua(a))o&&!a.getFormat()&&a.setFormat(o),r.push(a);else if(i.push(a),s===e.length-1||s<e.length-1&&Ua(e[s+1])){let l=n();l.setFormat(o),l.append(...i),r.push(l),i=[]}}return r}var bI=Cx,yI=bI.$generateHtmlFromNodes,yf=bI.$generateNodesFromDOM;var wx={};Re(wx,{$generateJSONFromSelectedNodes:()=>wI,$generateNodesFromSerializedNodes:()=>TI,$getClipboardDataFromSelection:()=>SI,$getHtmlContent:()=>vI,$getLexicalContent:()=>CI,$insertDataTransferForPlainText:()=>Hj,$insertDataTransferForRichText:()=>Kj,$insertGeneratedNodes:()=>Ex,copyToClipboard:()=>Uj,setLexicalClipboardDataTransfer:()=>kI});function xf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function vI(t,e=$()){return e==null&&xf(166),F(e)&&e.isCollapsed()||e.getNodes().length===0?"":yI(t,e)}function CI(t,e=$()){return e==null&&xf(166),F(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(wI(t,e))}function Hj(t,e){let n=t.getData("text/plain")||t.getData("text/uri-list");n!=null&&e.insertRawText(n)}function Kj(t,e,n){let o=t.getData("application/x-lexical-editor");if(o)try{let a=JSON.parse(o);if(a.namespace===n._config.namespace&&Array.isArray(a.nodes))return Ex(n,TI(a.nodes),e)}catch{}let r=t.getData("text/html"),i=t.getData("text/plain");if(r&&i!==r)try{let a=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(l):l})(r),"text/html");return Ex(n,yf(n,a),e)}catch{}let s=i||t.getData("text/uri-list");if(s!=null)if(F(e)){let a=s.split(/(\r?\n|\t)/);a[a.length-1]===""&&a.pop();for(let l=0;l<a.length;l++){let c=$();if(F(c)){let d=a[l];d===`
117
+ `||d===`\r
118
+ `?c.insertParagraph():d===" "?c.insertNodes([Eo()]):c.insertText(d)}}}else e.insertRawText(s)}function Ex(t,e,n){t.dispatchCommand(Bc,{nodes:e,selection:n})||(n.insertNodes(e),(function(o){if(F(o)&&o.isCollapsed()){let r=o.anchor,i=null,s=mi(r,"previous");if(s)if(Bp(s))i=s.origin;else{let a=Rp(s,qn(Qe(),"next").getFlipped());for(let l of a){if(Z(l.origin)){i=l.origin;break}if(G(l.origin)&&!l.origin.isInline())break}}if(i&&Z(i)){let a=i.getFormat(),l=i.getStyle();o.format===a&&o.style===l||(o.format=a,o.style=l,o.dirty=!0)}}})(n))}function EI(t,e,n,o=[]){let r=e===null||n.isSelected(e),i=G(n)&&n.excludeFromCopy("html"),s=n;if(e!==null){let c=_i(n);c=Z(c)&&e!==null?tf(e,c):c,s=c}let a=G(s)?s.getChildren():[],l=(function(c){let d=c.exportJSON(),u=c.constructor;if(d.type!==u.getType()&&xf(58,u.name),G(c)){let p=d.children;Array.isArray(p)||xf(59,u.name)}return d})(s);if(Z(s)){let c=s.__text;c.length>0?l.text=c:r=!1}for(let c=0;c<a.length;c++){let d=a[c],u=EI(t,e,d,l.children);!r&&G(n)&&u&&n.extractWithChild(d,e,"clone")&&(r=!0)}if(r&&!i)o.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){let d=l.children[c];o.push(d)}return r}function wI(t,e){let n=[],o=Qe().getChildren();for(let r=0;r<o.length;r++)EI(t,e,o[r],n);return{namespace:t._config.namespace,nodes:n}}function TI(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=eD(o);Z(r)&&jD(r),e.push(r)}return e}var tl=null;async function Uj(t,e,n){if(tl!==null)return!1;if(e!==null)return new Promise(((c,d)=>{t.update((()=>{c(xI(t,e,n))}))}));let o=t.getRootElement(),r=t._window||window,i=window.document,s=Xn(r);if(o===null||s===null)return!1;let a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),o.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise(((c,d)=>{let u=t.registerCommand(Up,(p=>(Jn(p,ClipboardEvent)&&(u(),tl!==null&&(window.clearTimeout(tl),tl=null),c(xI(t,p,n))),!0)),Ct);tl=window.setTimeout((()=>{u(),tl=null,c(!1)}),50),i.execCommand("copy"),a.remove()}))}function xI(t,e,n){if(n===void 0){let r=Xn(t._window);if(!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!OD(t,i,s))return!1;let a=$();if(a===null)return!1;n=SI(a)}e.preventDefault();let o=e.clipboardData;return o!==null&&(kI(o,n),!0)}var jj=[["text/html",vI],["application/x-lexical-editor",CI]];function SI(t=$()){let e={"text/plain":t?t.getTextContent():""};if(t){let n=ms();for(let[o,r]of jj){let i=r(n,t);i!==null&&(e[o]=i)}}return e}function kI(t,e){for(let n in e){let o=e[n];o!==void 0&&t.setData(n,o)}}var nr=wx,Gne=nr.$generateJSONFromSelectedNodes,Yne=nr.$generateNodesFromSerializedNodes,NI=nr.$getClipboardDataFromSelection,qne=nr.$getHtmlContent,Xne=nr.$getLexicalContent,Jne=nr.$insertDataTransferForPlainText,Tx=nr.$insertDataTransferForRichText,Zne=nr.$insertGeneratedNodes,Yc=nr.copyToClipboard,Qne=nr.setLexicalClipboardDataTransfer;var Dx={};Re(Dx,{$createHeadingNode:()=>ol,$createQuoteNode:()=>Nx,$isHeadingNode:()=>Zj,$isQuoteNode:()=>Xj,DRAG_DROP_PASTE:()=>kx,HeadingNode:()=>Jc,QuoteNode:()=>Xc,eventFiles:()=>qc,registerRichText:()=>Qj});function DI(t,e){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(t,e);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){let n=document.caretPositionFromPoint(t,e);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}var rl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Vj=rl&&"documentMode"in document?document.documentMode:null,Wj=!(!rl||!("InputEvent"in window)||Vj)&&"getTargetRanges"in new window.InputEvent("input"),Gj=rl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),OI=rl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Yj=rl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qj=rl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Yj,kx=Rn("DRAG_DROP_PASTE_FILE"),Xc=class t extends Rt{static getType(){return"quote"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("blockquote");return Ve(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:Jj,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(qt(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return Nx().updateFromJSON(e)}insertNewAfter(e,n){let o=fe(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,n),o}collapseAtStart(){let e=fe();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Nx(){return Tt(new Xc)}function Xj(t){return t instanceof Xc}var Jc=class t extends Rt{static getType(){return"heading"}static clone(e){return new t(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}setTag(e){let n=this.getWritable();return this.__tag=e,n}createDOM(e){let n=this.__tag,o=document.createElement(n),r=e.theme.heading;if(r!==void 0){let i=r[n];Ve(o,i)}return o}updateDOM(e,n,o){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:nl,priority:0}),h2:e=>({conversion:nl,priority:0}),h3:e=>({conversion:nl,priority:0}),h4:e=>({conversion:nl,priority:0}),h5:e=>({conversion:nl,priority:0}),h6:e=>({conversion:nl,priority:0}),p:e=>{let n=e.firstChild;return n!==null&&II(n)?{conversion:()=>({node:null}),priority:3}:null},span:e=>II(e)?{conversion:n=>({node:ol("h1")}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(qt(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return ol(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let o=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?fe():ol(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,n),o===0&&!this.isEmpty()&&e){let a=fe();a.select(),this.replace(a,!0)}return i}collapseAtStart(){let e=this.isEmpty()?fe():ol(this.getTag());return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}extractWithChild(){return!0}};function II(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function nl(t){let e=t.nodeName.toLowerCase(),n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=ol(e),t.style!==null&&(Dy(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Jj(t){let e=Nx();return t.style!==null&&(e.setFormat(t.style.textAlign),Dy(t,e)),{node:e}}function ol(t="h1"){return Tt(new Jc(t))}function Zj(t){return t instanceof Jc}function qc(t){let e=null;if(Jn(t,DragEvent)?e=t.dataTransfer:Jn(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];let n=e.types,o=n.includes("Files"),r=n.includes("text/html")||n.includes("text/plain");return[o,Array.from(e.files),r]}function MI(t){let e=$();if(!F(e))return!1;let n=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){let i=o[r],s=i.getKey();if(n.has(s))continue;let a=le(i,(c=>G(c)&&!c.isInline()));if(a===null)continue;let l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),t(a))}return n.size>0}function AI(t){let e=on(t);return Mn(e)}function Sx(t){for(let e of["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e)}function Qj(t){return Fe(t.registerCommand(Jo,(e=>{let n=$();return!!lt(n)&&(n.clear(),!0)}),Ce),t.registerCommand(ja,(e=>{let n=$();return F(n)?(n.deleteCharacter(e),!0):!!lt(n)&&(n.deleteNodes(),!0)}),Ce),t.registerCommand(Vp,(e=>{let n=$();return!!F(n)&&(n.deleteWord(e),!0)}),Ce),t.registerCommand(Pc,(e=>{let n=$();return!!F(n)&&(n.deleteLine(e),!0)}),Ce),t.registerCommand(Kp,(e=>{let n=$();if(typeof e=="string")n!==null&&n.insertText(e);else{if(n===null)return!1;let o=e.dataTransfer;if(o!=null)Tx(o,n,t);else if(F(n)){let r=e.data;return r&&n.insertText(r),!0}}return!0}),Ce),t.registerCommand(_D,(()=>{let e=$();return!!F(e)&&(e.removeText(),!0)}),Ce),t.registerCommand(ot,(e=>{let n=$();return!!F(n)&&(n.formatText(e),!0)}),Ce),t.registerCommand(Wp,(e=>{let n=$();if(!F(n)&&!lt(n))return!1;let o=n.getNodes();for(let r of o){let i=le(r,(s=>G(s)&&!s.isInline()));i!==null&&i.setFormat(e)}return!0}),Ce),t.registerCommand(wy,(e=>{let n=$();return!!F(n)&&(n.insertLineBreak(e),!0)}),Ce),t.registerCommand(vi,(()=>{let e=$();return!!F(e)&&(e.insertParagraph(),!0)}),Ce),t.registerCommand(ys,(()=>(wo([Eo()]),!0)),Ce),t.registerCommand(Ln,(()=>MI((e=>{let n=e.getIndent();e.setIndent(n+1)}))),Ce),t.registerCommand(uo,(()=>MI((e=>{let n=e.getIndent();n>0&&e.setIndent(Math.max(0,n-1))}))),Ce),t.registerCommand(To,(e=>{let n=$();if(lt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(F(n)){let o=yy(n.focus,!0);if(!e.shiftKey&&Mn(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),e.preventDefault(),!0}return!1}),Ce),t.registerCommand(Rr,(e=>{let n=$();if(lt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(F(n)){if((function(r){let i=r.focus;return i.key==="root"&&i.offset===Qe().getChildrenSize()})(n))return e.preventDefault(),!0;let o=yy(n.focus,!1);if(!e.shiftKey&&Mn(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),e.preventDefault(),!0}return!1}),Ce),t.registerCommand(Ya,(e=>{let n=$();if(lt(n)){let o=n.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectPrevious(),!0}if(!F(n))return!1;if(Fy(n,!0)){let o=e.shiftKey;return e.preventDefault(),Py(n,o,!0),!0}return!1}),Ce),t.registerCommand(Gp,(e=>{let n=$();if(lt(n)){let r=n.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}if(!F(n))return!1;let o=e.shiftKey;return!!Fy(n,!1)&&(e.preventDefault(),Py(n,o,!1),!0)}),Ce),t.registerCommand(Yp,(e=>{if(AI(e.target))return!1;let n=$();if(F(n)){if((function(o){if(!o.isCollapsed())return!1;let{anchor:r}=o;if(r.offset!==0)return!1;let i=r.getNode();if(qo(i))return!1;let s=vs(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return e.preventDefault(),t.dispatchCommand(uo,void 0);if(OI&&navigator.language==="ko-KR")return!1}else if(!lt(n))return!1;return e.preventDefault(),t.dispatchCommand(ja,!0)}),Ce),t.registerCommand(qp,(e=>{if(AI(e.target))return!1;let n=$();return!(!F(n)&&!lt(n))&&(e.preventDefault(),t.dispatchCommand(ja,!1))}),Ce),t.registerCommand(hD,(e=>{let n=$();if(!F(n))return!1;if(Sx(n),e!==null){if((OI||Gj||qj)&&Wj)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(wy,!1)}return t.dispatchCommand(vi,void 0)}),Ce),t.registerCommand(Ci,(()=>{let e=$();return!!F(e)&&(t.blur(),!0)}),Ce),t.registerCommand(dD,(e=>{let[,n]=qc(e);if(n.length>0){let r=DI(e.clientX,e.clientY);if(r!==null){let{offset:i,node:s}=r,a=on(s);if(a!==null){let l=Yo();if(Z(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{let d=a.getParentOrThrow().getKey(),u=a.getIndexWithinParent()+1;l.anchor.set(d,u,"element"),l.focus.set(d,u,"element")}let c=Lr(l);ht(c)}t.dispatchCommand(kx,n)}return e.preventDefault(),!0}let o=$();return!!F(o)}),Ce),t.registerCommand(cD,(e=>{let[n]=qc(e),o=$();return!(n&&!F(o))}),Ce),t.registerCommand(lD,(e=>{let[n]=qc(e),o=$();if(n&&!F(o))return!1;let r=DI(e.clientX,e.clientY);if(r!==null){let i=on(r.node);Mn(i)&&e.preventDefault()}return!0}),Ce),t.registerCommand(yD,(()=>($p(),!0)),Ce),t.registerCommand(Up,(e=>(Yc(t,Jn(e,ClipboardEvent)?e:null),!0)),Ce),t.registerCommand(jp,(e=>((async function(n,o){await Yc(o,Jn(n,ClipboardEvent)?n:null),o.update((()=>{let r=$();F(r)?r.removeText():lt(r)&&r.getNodes().forEach((i=>i.remove()))}))})(e,t),!0)),Ce),t.registerCommand(wi,(e=>{let[,n,o]=qc(e);return n.length>0&&!o?(t.dispatchCommand(kx,n),!0):Ti(e.target)&&DD(e.target)?!1:$()!==null&&((function(r,i){r.preventDefault(),i.update((()=>{let s=$(),a=Jn(r,InputEvent)||Jn(r,KeyboardEvent)?null:r.clipboardData;a!=null&&s!==null&&Tx(a,s,i)}),{tag:gD})})(e,t),!0)}),Ce),t.registerCommand(Xp,(e=>{let n=$();return F(n)&&Sx(n),!1}),Ce),t.registerCommand(Ei,(e=>{let n=$();return F(n)&&Sx(n),!1}),Ce))}var Pr=Dx,Ts=Pr.$createHeadingNode,Ss=Pr.$createQuoteNode,Fr=Pr.$isHeadingNode,Br=Pr.$isQuoteNode,ioe=Pr.DRAG_DROP_PASTE,vf=Pr.HeadingNode,Cf=Pr.QuoteNode,soe=Pr.eventFiles,LI=Pr.registerRichText;var Ix={};Re(Ix,{RichTextPlugin:()=>e8});ut();ut();var Ox=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function RI(t){return t.getEditorState().read(pf(t.isComposing()))}function e8({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){let[o]=be(),r=(function(i,s){let[a,l]=R((()=>i.getDecorators()));return Ox((()=>i.registerDecoratorListener((c=>{xl((()=>{l(c)}))}))),[i]),P((()=>{l(i.getDecorators())}),[i]),X((()=>{let c=[],d=Object.keys(a);for(let u=0;u<d.length;u++){let p=d[u],f=g(s,{onError:m=>i._onError(m),children:g(Fv,{fallback:null,children:a[p]})}),h=i.getElementByKey(p);h!==null&&c.push(Yr(f,h,p))}return c}),[s,a,i])})(o,n);return(function(i){Ox((()=>Fe(LI(i),hI(i))),[i])})(o),g(Me,{children:[t,g(t8,{content:e}),r]})}function t8({content:t}){let[e]=be(),n=(function(r){let[i,s]=R((()=>RI(r)));return Ox((()=>{function a(){let l=RI(r);s(l)}return a(),Fe(r.registerUpdateListener((()=>{a()})),r.registerEditableListener((()=>{a()})))}),[r]),i})(e),o=fI();return n?typeof t=="function"?t(o):t:null}var n8=Ix,PI=n8.RichTextPlugin;var Mx={};Re(Mx,{TabIndentationPlugin:()=>o8,registerTabIndentation:()=>FI});ut();function FI(t,e){return Fe(t.registerCommand(Ei,(n=>{let o=$();if(!F(o))return!1;n.preventDefault();let r=(function(i){let s=i.getNodes();if(dO(s,(p=>Ua(p)&&p.canIndent()?p:null)).length>0)return!0;let a=i.anchor,l=i.focus,c=l.isBefore(a)?l:a,d=c.getNode(),u=vs(d);if(u.canIndent()){let p=u.getKey(),f=Yo();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=Lr(f),f.anchor.is(c))return!0}return!1})(o)?n.shiftKey?uo:Ln:ys;return t.dispatchCommand(r,void 0)}),Ce),t.registerCommand(Ln,(()=>{if(e==null)return!1;let n=$();if(!F(n))return!1;let o=n.getNodes().map((r=>vs(r).getIndent()));return Math.max(...o)+1>=e}),Ct))}function o8({maxIndent:t}){let[e]=be();return P((()=>FI(e,t)),[e,t]),null}var BI=Mx,$I=BI.TabIndentationPlugin,Coe=BI.registerTabIndentation;var Jx={};Re(Jx,{$computeTableMap:()=>rn,$computeTableMapSkipCellCheck:()=>zr,$createTableCellNode:()=>zn,$createTableNode:()=>If,$createTableNodeWithDimensions:()=>qI,$createTableRowNode:()=>Ds,$createTableSelection:()=>Gx,$createTableSelectionFrom:()=>oM,$deleteTableColumn:()=>h8,$deleteTableColumnAtSelection:()=>eM,$deleteTableColumn__EXPERIMENTAL:()=>m8,$deleteTableRowAtSelection:()=>QI,$deleteTableRow__EXPERIMENTAL:()=>g8,$findCellNode:()=>al,$findTableNode:()=>Ns,$getElementForTableNode:()=>lM,$getNodeTriplet:()=>Ft,$getTableAndElementByKey:()=>Yx,$getTableCellNodeFromLexicalNode:()=>s8,$getTableCellNodeRect:()=>Bx,$getTableColumnIndexFromTableCellNode:()=>l8,$getTableNodeFromLexicalNodeOrThrow:()=>Of,$getTableRowIndexFromTableCellNode:()=>a8,$getTableRowNodeFromTableCellNodeOrThrow:()=>Vx,$insertTableColumn:()=>p8,$insertTableColumnAtSelection:()=>ZI,$insertTableColumn__EXPERIMENTAL:()=>f8,$insertTableRow:()=>d8,$insertTableRowAtSelection:()=>JI,$insertTableRow__EXPERIMENTAL:()=>u8,$isScrollableTablesActive:()=>Df,$isTableCellNode:()=>ce,$isTableNode:()=>rt,$isTableRowNode:()=>We,$isTableSelection:()=>ze,$mergeCells:()=>tM,$removeTableRowAtIndex:()=>c8,$unmergeCell:()=>b8,INSERT_TABLE_COMMAND:()=>YI,TableCellHeaderStates:()=>Ge,TableCellNode:()=>Di,TableNode:()=>Ii,TableObserver:()=>Nf,TableRowNode:()=>cl,applyTableHandlers:()=>rM,getDOMCellFromTarget:()=>ed,getTableElement:()=>Oi,getTableObserverFromTableElement:()=>zx,registerTableCellUnmergeTransform:()=>L8,registerTablePlugin:()=>P8,registerTableSelectionObserver:()=>R8,setScrollableTablesActive:()=>k8});var Ux=/^(\d+(?:\.\d+)?)px$/,Ge={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},Di=class t extends Rt{static getType(){return"tablecell"}static clone(e){return new t(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:zI,priority:0}),th:e=>({conversion:zI,priority:0})}}static importJSON(e){return zn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Ge.NO_STATUS,n=1,o,r){super(r),this.__colSpan=n,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),Lx(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),Ve(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(xs(n.element)){let o=n.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return n}exportJSON(){return{...super.exportJSON(),...Lx(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let n=this.getWritable();return n.__colSpan=e,n}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let n=this.getWritable();return n.__rowSpan=e,n}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,n=Ge.BOTH){let o=this.getWritable();return o.__headerState=e&n|o.__headerState&~n,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let n=this.getWritable();return n.__width=e,n}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let n=this.getWritable();return n.__backgroundColor=e,n}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let n=this.getWritable();return n.__verticalAlign=e||void 0,n}toggleHeaderStyle(e){let n=this.getWritable();return(n.__headerState&e)===e?n.__headerState-=e:n.__headerState+=e,n}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Ge.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function Lx(t){return t==="middle"||t==="bottom"}function zI(t){let e=t,n=t.nodeName.toLowerCase(),o;Ux.test(e.style.width)&&(o=parseFloat(e.style.width));let r=zn(n==="th"?Ge.ROW:Ge.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;let i=e.style.backgroundColor;i!==""&&(r.__backgroundColor=i);let s=e.style.verticalAlign;Lx(s)&&(r.__verticalAlign=s);let a=e.style,l=(a&&a.textDecoration||"").split(" "),c=a.fontWeight==="700"||a.fontWeight==="bold",d=l.includes("line-through"),u=a.fontStyle==="italic",p=l.includes("underline");return{after:f=>{let h=[],m=null,_=()=>{if(m){let b=m.getFirstChild();qe(b)&&m.getChildrenSize()===1&&b.remove()}};for(let b of f)Q1(b)||Z(b)||qe(b)?(Z(b)&&(c&&b.toggleFormat("bold"),d&&b.toggleFormat("strikethrough"),u&&b.toggleFormat("italic"),p&&b.toggleFormat("underline")),m?m.append(b):(m=fe().append(b),h.push(m))):(h.push(b),_(),m=null);return _(),h.length===0&&h.push(fe()),h},node:r}}function zn(t=Ge.NO_STATUS,e=1,n){return Tt(new Di(t,e,n))}function ce(t){return t instanceof Di}var YI=Rn("INSERT_TABLE_COMMAND");function re(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var cl=class t extends Rt{static getType(){return"tablerow"}static clone(e){return new t(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:r8,priority:0})}}static importJSON(e){return Ds().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,n){super(n),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),Ve(n,e.theme.tableRow),n}extractWithChild(e,n,o){return o==="html"}isShadowRoot(){return!0}setHeight(e){let n=this.getWritable();return n.__height=e,n}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function r8(t){let e=t,n;return Ux.test(e.style.height)&&(n=parseFloat(e.style.height)),{after:o=>Uy(o,ce),node:Ds(n)}}function Ds(t){return Tt(new cl(t))}function We(t){return t instanceof cl}var jx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,i8=jx&&"documentMode"in document?document.documentMode:null,HI=jx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function qI(t,e,n=!0){let o=If();for(let r=0;r<t;r++){let i=Ds();for(let s=0;s<e;s++){let a=Ge.NO_STATUS;typeof n=="object"?(r===0&&n.rows&&(a|=Ge.ROW),s===0&&n.columns&&(a|=Ge.COLUMN)):n&&(r===0&&(a|=Ge.ROW),s===0&&(a|=Ge.COLUMN));let l=zn(a),c=fe();c.append(vt()),l.append(c),i.append(l)}o.append(i)}return o}function s8(t){let e=le(t,(n=>ce(n)));return ce(e)?e:null}function Vx(t){let e=le(t,(n=>We(n)));if(We(e))return e;throw new Error("Expected table cell to be inside of table row.")}function Of(t){let e=le(t,(n=>rt(n)));if(rt(e))return e;throw new Error("Expected table cell to be inside of table.")}function a8(t){let e=Vx(t);return Of(e).getChildren().findIndex((n=>n.is(e)))}function l8(t){return Vx(t).getChildren().findIndex((e=>e.is(t)))}function XI(t,e){let n=Of(t),{x:o,y:r}=n.getCordsFromCellNode(t,e);return{above:n.getCellNodeFromCords(o,r-1,e),below:n.getCellNodeFromCords(o,r+1,e),left:n.getCellNodeFromCords(o-1,r,e),right:n.getCellNodeFromCords(o+1,r,e)}}function c8(t,e){let n=t.getChildren();if(e>=n.length||e<0)throw new Error("Expected table cell to be inside of table row.");return n[e].remove(),t}function d8(t,e,n=!0,o,r){let i=t.getChildren();if(e>=i.length||e<0)throw new Error("Table row target index out of range");let s=i[e];if(!We(s))throw new Error("Row before insertion index does not exist.");for(let a=0;a<o;a++){let l=s.getChildren(),c=l.length,d=Ds();for(let u=0;u<c;u++){let p=l[u];ce(p)||re(12);let{above:f,below:h}=XI(p,r),m=Ge.NO_STATUS,_=f&&f.getWidth()||h&&h.getWidth()||void 0;(f&&f.hasHeaderState(Ge.COLUMN)||h&&h.hasHeaderState(Ge.COLUMN))&&(m|=Ge.COLUMN);let b=zn(m,1,_);b.append(fe()),d.append(b)}n?s.insertAfter(d):s.insertBefore(d)}return t}jx&&"InputEvent"in window&&!i8&&new window.InputEvent("input");var Rx=(t,e)=>t===Ge.BOTH||t===e?e:Ge.NO_STATUS;function JI(t=!0){let e=$();F(e)||ze(e)||re(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Ft(n),[i,,s]=Ft(o),[,a,l]=rn(s,i,r),{startRow:c}=l,{startRow:d}=a;return t?Px(c+r.__rowSpan>d+i.__rowSpan?r:i,!0):Px(d<c?i:r,!1)}var u8=JI;function Px(t,e=!0){let[,,n]=Ft(t),[o,r]=rn(n,t,t),i=o[0].length,{startRow:s}=r,a=null;if(e){let l=s+t.__rowSpan-1,c=o[l],d=Ds();for(let p=0;p<i;p++){let{cell:f,startRow:h}=c[p];if(h+f.__rowSpan-1<=l){let m=c[p].cell.__headerState,_=Rx(m,Ge.COLUMN);d.append(zn(_).append(fe()))}else f.setRowSpan(f.__rowSpan+1)}let u=n.getChildAtIndex(l);We(u)||re(256),u.insertAfter(d),a=d}else{let l=s,c=o[l],d=Ds();for(let p=0;p<i;p++){let{cell:f,startRow:h}=c[p];if(h===l){let m=c[p].cell.__headerState,_=Rx(m,Ge.COLUMN);d.append(zn(_).append(fe()))}else f.setRowSpan(f.__rowSpan+1)}let u=n.getChildAtIndex(l);We(u)||re(257),u.insertBefore(d),a=d}return a}function p8(t,e,n=!0,o,r){let i=t.getChildren(),s=[];for(let a=0;a<i.length;a++){let l=i[a];if(We(l))for(let c=0;c<o;c++){let d=l.getChildren();if(e>=d.length||e<0)throw new Error("Table column target index out of range");let u=d[e];ce(u)||re(12);let{left:p,right:f}=XI(u,r),h=Ge.NO_STATUS;(p&&p.hasHeaderState(Ge.ROW)||f&&f.hasHeaderState(Ge.ROW))&&(h|=Ge.ROW);let m=zn(h);m.append(fe()),s.push({newTableCell:m,targetCell:u})}}return s.forEach((({newTableCell:a,targetCell:l})=>{n?l.insertAfter(a):l.insertBefore(a)})),t}function ZI(t=!0){let e=$();F(e)||ze(e)||re(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Ft(n),[i,,s]=Ft(o),[,a,l]=rn(s,i,r),{startColumn:c}=l,{startColumn:d}=a;return t?Fx(c+r.__colSpan>d+i.__colSpan?r:i,!0):Fx(d<c?i:r,!1)}var f8=ZI;function Fx(t,e=!0,n=!0){let[,,o]=Ft(t),[r,i]=rn(o,t,t),s=r.length,{startColumn:a}=i,l=e?a+t.__colSpan-1:a-1,c=o.getFirstChild();We(c)||re(120);let d=null;function u(h=Ge.NO_STATUS){let m=zn(h).append(fe());return d===null&&(d=m),m}let p=c;e:for(let h=0;h<s;h++){if(h!==0){let E=p.getNextSibling();We(E)||re(121),p=E}let m=r[h],_=m[l<0?0:l].cell.__headerState,b=Rx(_,Ge.ROW);if(l<0){Wx(p,u(b));continue}let{cell:y,startColumn:x,startRow:v}=m[l];if(x+y.__colSpan-1<=l){let E=y,C=v,k=l;for(;C!==h&&E.__rowSpan>1;){if(k-=y.__colSpan,!(k>=0)){p.append(u(b));continue e}{let{cell:T,startRow:w}=m[k];E=T,C=w}}E.insertAfter(u(b))}else y.setColSpan(y.__colSpan+1)}d!==null&&n&&Qc(d);let f=o.getColWidths();if(f){let h=[...f],m=l<0?0:l,_=h[m];h.splice(m,0,_),o.setColWidths(h)}return d}function h8(t,e){let n=t.getChildren();for(let o=0;o<n.length;o++){let r=n[o];if(We(r)){let i=r.getChildren();if(e>=i.length||e<0)throw new Error("Table column target index out of range");i[e].remove()}}return t}function QI(){let t=$();F(t)||ze(t)||re(188);let[e,n]=t.isBackward()?[t.focus.getNode(),t.anchor.getNode()]:[t.anchor.getNode(),t.focus.getNode()],[o,,r]=Ft(e),[i]=Ft(n),[s,a,l]=rn(r,o,i),{startRow:c}=a,{startRow:d}=l,u=d+i.__rowSpan-1;if(s.length===u-c+1)return void r.remove();let p=s[0].length,f=s[u+1],h=r.getChildAtIndex(u+1);for(let m=u;m>=c;m--){for(let b=p-1;b>=0;b--){let{cell:y,startRow:x,startColumn:v}=s[m][b];if(v===b){if(x<c||x+y.__rowSpan-1>u){let E=Math.max(x,c),C=Math.min(y.__rowSpan+x-1,u),k=E<=C?C-E+1:0;y.setRowSpan(y.__rowSpan-k)}if(x>=c&&x+y.__rowSpan-1>u&&m===u){h===null&&re(122);let E=null;for(let C=0;C<b;C++){let k=f[C],T=k.cell;k.startRow===m+1&&(E=T),T.__colSpan>1&&(C+=T.__colSpan-1)}E===null?Wx(h,y):E.insertAfter(y)}}}let _=r.getChildAtIndex(m);We(_)||re(206,String(m)),_.remove()}if(f!==void 0){let{cell:m}=f[0];Qc(m)}else{let m=s[c-1],{cell:_}=m[0];Qc(_)}}var g8=QI;function eM(){let t=$();F(t)||ze(t)||re(188);let e=t.anchor.getNode(),n=t.focus.getNode(),[o,,r]=Ft(e),[i]=Ft(n),[s,a,l]=rn(r,o,i),{startColumn:c}=a,{startRow:d,startColumn:u}=l,p=Math.min(c,u),f=Math.max(c+o.__colSpan-1,u+i.__colSpan-1),h=f-p+1;if(s[0].length===f-p+1)return r.selectPrevious(),void r.remove();let m=s.length;for(let x=0;x<m;x++)for(let v=p;v<=f;v++){let{cell:E,startColumn:C}=s[x][v];if(C<p){if(v===p){let k=p-C;E.setColSpan(E.__colSpan-Math.min(h,E.__colSpan-k))}}else if(C+E.__colSpan-1>f){if(v===f){let k=f-C+1;E.setColSpan(E.__colSpan-k)}}else E.remove()}let _=s[d],b=c>u?_[c+o.__colSpan]:_[u+i.__colSpan];if(b!==void 0){let{cell:x}=b;Qc(x)}else{let x=u<c?_[u-1]:_[c-1],{cell:v}=x;Qc(v)}let y=r.getColWidths();if(y){let x=[...y];x.splice(p,h),r.setColWidths(x)}}var m8=eM;function Qc(t){let e=t.getFirstDescendant();e==null?t.selectStart():e.getParentOrThrow().selectStart()}function Wx(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)}function tM(t){if(t.length===0)return null;let e=Of(t[0]),[n]=zr(e,null,null),o=1/0,r=-1/0,i=1/0,s=-1/0,a=new Set;for(let f of n)for(let h of f){if(!h||!h.cell)continue;let m=h.cell.getKey();if(!a.has(m)&&t.some((_=>_.is(h.cell)))){a.add(m);let _=h.startRow,b=h.startColumn,y=h.cell.__rowSpan||1,x=h.cell.__colSpan||1;o=Math.min(o,_),r=Math.max(r,_+y-1),i=Math.min(i,b),s=Math.max(s,b+x-1)}}if(o===1/0||i===1/0)return null;let l=r-o+1,c=s-i+1,d=n[o][i];if(!d.cell)return null;let u=d.cell;u.setColSpan(c),u.setRowSpan(l);let p=new Set([u.getKey()]);for(let f=o;f<=r;f++)for(let h=i;h<=s;h++){let m=n[f][h];if(!m.cell)continue;let _=m.cell,b=_.getKey();p.has(b)||(p.add(b),_8(_)||u.append(..._.getChildren()),_.remove())}return u.getChildrenSize()===0&&u.append(fe()),u}function _8(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Yt(e)||!e.isEmpty())}function b8(){let t=$();F(t)||ze(t)||re(188);let e=t.anchor.getNode(),n=le(e,ce);return ce(n)||re(148),nM(n)}function nM(t){let[e,n,o]=Ft(t),r=e.__colSpan,i=e.__rowSpan;if(r===1&&i===1)return;let[s,a]=rn(o,e,e),{startColumn:l,startRow:c}=a,d=e.__headerState&Ge.COLUMN,u=Array.from({length:r},((h,m)=>{let _=d;for(let b=0;_!==0&&b<s.length;b++)_&=s[b][m+l].cell.__headerState;return _})),p=e.__headerState&Ge.ROW,f=Array.from({length:i},((h,m)=>{let _=p;for(let b=0;_!==0&&b<s[0].length;b++)_&=s[m+c][b].cell.__headerState;return _}));if(r>1){for(let h=1;h<r;h++)e.insertAfter(zn(u[h]|f[0]).append(fe()));e.setColSpan(1)}if(i>1){let h;for(let m=1;m<i;m++){let _=c+m,b=s[_];h=(h||n).getNextSibling(),We(h)||re(125);let y=null;for(let x=0;x<l;x++){let v=b[x],E=v.cell;v.startRow===_&&(y=E),E.__colSpan>1&&(x+=E.__colSpan-1)}if(y===null)for(let x=r-1;x>=0;x--)Wx(h,zn(u[x]|f[m]).append(fe()));else for(let x=r-1;x>=0;x--)y.insertAfter(zn(u[x]|f[m]).append(fe()))}e.setRowSpan(1)}}function rn(t,e,n){let[o,r,i]=zr(t,e,n);return r===null&&re(207),i===null&&re(208),[o,r,i]}function zr(t,e,n){let o=[],r=null,i=null;function s(l){let c=o[l];return c===void 0&&(o[l]=c=[]),c}let a=t.getChildren();for(let l=0;l<a.length;l++){let c=a[l];We(c)||re(209);let d=s(l);for(let u=c.getFirstChild(),p=0;u!=null;u=u.getNextSibling()){for(ce(u)||re(147);d[p]!==void 0;)p++;let f={cell:u,startColumn:p,startRow:l},{__rowSpan:h,__colSpan:m}=u;for(let _=0;_<h&&!(l+_>=a.length);_++){let b=s(l+_);for(let y=0;y<m;y++)b[p+y]=f}e!==null&&r===null&&e.is(u)&&(r=f),n!==null&&i===null&&n.is(u)&&(i=f)}}return[o,r,i]}function Ft(t){let e;if(t instanceof Di)e=t;else if("__type"in t){let r=le(t,ce);ce(r)||re(148),e=r}else{let r=le(t.getNode(),ce);ce(r)||re(148),e=r}let n=e.getParent();We(n)||re(149);let o=n.getParent();return rt(o)||re(210),[e,n,o]}function Sf(t,e,n){let o,r=Math.min(e.startColumn,n.startColumn),i=Math.min(e.startRow,n.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),a=Math.max(e.startRow+e.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{o=!1;for(let l=0;l<t.length;l++)for(let c=0;c<t[0].length;c++){let d=t[l][c];if(!d)continue;let u=d.startColumn+d.cell.__colSpan-1,p=d.startRow+d.cell.__rowSpan-1,f=d.startColumn<=s&&u>=r,h=d.startRow<=a&&p>=i;if(f&&h){let m=Math.min(r,d.startColumn),_=Math.max(s,u),b=Math.min(i,d.startRow),y=Math.max(a,p);m===r&&_===s&&b===i&&y===a||(r=m,s=_,i=b,a=y,o=!0)}}}while(o);return{maxColumn:s,maxRow:a,minColumn:r,minRow:i}}function Bx(t){let[e,,n]=Ft(t),o=n.getChildren(),r=o.length,i=o[0].getChildren().length,s=new Array(r);for(let a=0;a<r;a++)s[a]=new Array(i);for(let a=0;a<r;a++){let l=o[a].getChildren(),c=0;for(let d=0;d<l.length;d++){for(;s[a][c];)c++;let u=l[d],p=u.__rowSpan||1,f=u.__colSpan||1;for(let h=0;h<p;h++)for(let m=0;m<f;m++)s[a+h][c+m]=u;if(e===u)return{colSpan:f,columnIndex:c,rowIndex:a,rowSpan:p};c+=f}}return null}function KI(t){let[[e,n,o,r],[i,s,a,l]]=["anchor","focus"].map((c=>{let d=t[c].getNode(),u=le(d,ce);ce(u)||re(238,c,d.getKey(),d.getType());let p=u.getParent();We(p)||re(239,c);let f=p.getParent();return rt(f)||re(240,c),[d,u,p,f]}));return r.is(l)||re(241),{anchorCell:n,anchorNode:e,anchorRow:o,anchorTable:r,focusCell:s,focusNode:i,focusRow:a,focusTable:l}}var kf=class t{constructor(e,n,o){this.anchor=n,this.focus=o,n._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){return this.tableKey!=="root"&&this.anchor.key!=="root"&&this.anchor.type==="element"&&this.focus.key!=="root"&&this.focus.type==="element"}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ze(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,n,o){this.dirty=this.dirty||e!==this.tableKey||n!==this.anchor.key||o!==this.focus.key,this.tableKey=e,this.anchor.key=n,this.focus.key=o,this._cachedNodes=null}clone(){return new t(this.tableKey,Go(this.anchor.key,this.anchor.offset,this.anchor.type),Go(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(ce).forEach((r=>{let i=r.getFirstChild();Yt(i)&&(n|=i.getTextFormat())}));let o=xD[e];return!!(n&o)}insertNodes(e){let n=this.focus.getNode();G(n)||re(151),Lr(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:n}=KI(this),o=Bx(e);o===null&&re(153);let r=Bx(n);r===null&&re(155);let i=Math.min(o.columnIndex,r.columnIndex),s=Math.max(o.columnIndex+o.colSpan-1,r.columnIndex+r.colSpan-1),a=Math.min(o.rowIndex,r.rowIndex),l=Math.max(o.rowIndex+o.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(a,l),toX:Math.max(i,s),toY:Math.max(a,l)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:o,focusCell:r}=KI(this),i=r.getParents()[1];if(i!==n){if(n.isParentOf(r)){let _=i.getParent();_==null&&re(159),this.set(this.tableKey,r.getKey(),_.getKey())}else{let _=n.getParent();_==null&&re(158),this.set(this.tableKey,_.getKey(),r.getKey())}return this.getNodes()}let[s,a,l]=rn(n,o,r),{minColumn:c,maxColumn:d,minRow:u,maxRow:p}=Sf(s,a,l),f=new Map([[n.getKey(),n]]),h=null;for(let _=u;_<=p;_++)for(let b=c;b<=d;b++){let{cell:y}=s[_][b],x=y.getParent();We(x)||re(160),x!==h&&(f.set(x.getKey(),x),h=x),f.has(y.getKey())||y8(y,(v=>{f.set(v.getKey(),v)}))}let m=Array.from(f.values());return kD()||(this._cachedNodes=m),m}getTextContent(){let e=this.getNodes().filter((o=>ce(o))),n="";for(let o=0;o<e.length;o++){let r=e[o],i=r.__parent,s=(e[o+1]||{}).__parent;n+=r.getTextContent()+(s!==i?`
119
+ `:" ")}return n}};function ze(t){return t instanceof kf}function Gx(){let t=Go("root",0,"element"),e=Go("root",0,"element");return new kf("root",t,e)}function oM(t,e,n){t.getKey(),e.getKey(),n.getKey();let o=$(),r=ze(o)?o.clone():Gx();return r.set(t.getKey(),e.getKey(),n.getKey()),r}function y8(t,e){let n=[[t]];for(let o=n.at(-1);o!==void 0&&n.length>0;o=n.at(-1)){let r=o.pop();r===void 0?n.pop():e(r)!==!1&&G(r)&&n.push(r.getChildren())}}function Yx(t,e=ms()){let n=St(t);rt(n)||re(231,t);let o=Oi(n,e.getElementByKey(t));return o===null&&re(232,t),{tableElement:o,tableNode:n}}var Nf=class{constructor(e,n){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Yx(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver((n=>{this.editor.getEditorState().read((()=>{let o=!1;for(let s=0;s<n.length;s++){let a=n[s].target.nodeName;if(a==="TABLE"||a==="TBODY"||a==="THEAD"||a==="TR"){o=!0;break}}if(!o)return;let{tableNode:r,tableElement:i}=this.$lookup();this.table=ll(r,i)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{let{tableNode:n,tableElement:o}=this.$lookup();this.table=ll(n,o),e.observe(o,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:n,tableElement:o}=this.$lookup();Ef(e,ll(n,o),null),$()!==null&&(ht(null),e.dispatchCommand(cn,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();Fn(n,e._config.theme.tableSelection),n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();Ve(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&re(233,e.tableKey,this.tableNodeKey);let n=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Ef(n,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=Xn(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let o=this.editor,{tableNode:r}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===i&&this.anchorY===s&&!n){if(i===this.focusX&&s===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=i,this.focusY=s,this.isHighlightingCells){let a=Hx(r,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&a!==null)return this.focusCellNodeKey=a.getKey(),this.tableSelection=oM(r,this.$getAnchorTableCellOrThrow(),a),ht(this.tableSelection),o.dispatchCommand(cn,void 0),Ef(o,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?St(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&re(234),e}$getFocusTableCell(){return this.focusCellNodeKey?St(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&re(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;let{tableNode:n}=this.$lookup(),o=Hx(n,e.elem);if(o!==null){let r=o.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Gx(),this.anchorCellNodeKey=r}}$formatCells(e){let n=$();ze(n)||re(236);let o=Yo(),r=o.anchor,i=o.focus,s=n.getNodes().filter(ce);s.length>0||re(237);let a=s[0].getFirstChild(),l=Yt(a)?a.getFormatFlags(e,null):null;s.forEach((c=>{r.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),o.formatText(e,l)})),ht(n),this.editor.dispatchCommand(cn,void 0)}$clearText(){let{editor:e}=this,n=St(this.tableNodeKey);if(!rt(n))throw new Error("Expected TableNode.");let o=$();ze(o)||re(253);let r=o.getNodes().filter(ce),i=n.getFirstChild(),s=n.getLastChild();if(r.length>0&&i!==null&&s!==null&&We(i)&&We(s)&&r[0]===i.getFirstChild()&&r[r.length-1]===s.getLastChild()){n.selectPrevious();let a=n.getParent();return n.remove(),void(qo(a)&&a.isEmpty()&&e.dispatchCommand(vi,void 0))}r.forEach((a=>{if(G(a)){let l=fe(),c=vt();l.append(c),a.append(l),a.getChildren().forEach((d=>{d!==l&&d.remove()}))}})),Ef(e,this.table,null),ht(null),e.dispatchCommand(cn,void 0)}},$x="__lexicalTableSelection",x8=t=>!(1&~t.buttons);function sl(t){return xs(t)&&t.nodeName==="TABLE"}function Oi(t,e){if(!e)return e;let n=sl(e)?e:t.getDOMSlot(e).element;return n.nodeName!=="TABLE"&&re(245,e.nodeName),n}function qx(t){return t._window}function Zc(t,e){for(let n=e,o=null;n!==null;n=n.getParent()){if(t.is(n))return o;ce(n)&&(o=n)}return null}var v8=[[Rr,"down"],[To,"up"],[Ya,"backward"],[Gp,"forward"]],C8=[Vp,Pc,ja],E8=[Yp,qp];function rM(t,e,n,o){let r=n.getRootElement(),i=qx(n);r!==null&&i!==null||re(246);let s=new Nf(n,t.getKey()),a=Oi(t,e);(function(f,h){zx(f)!==null&&re(205),f[$x]=h})(a,s),s.listenersToRemove.add((()=>(function(f,h){zx(f)===h&&delete f[$x]})(a,s)));let l=f=>{if(s.pointerType=f.pointerType,f.button!==0||!Ti(f.target)||!i)return;let h=ed(f.target);h!==null&&n.update((()=>{let m=Ar();if(HI&&f.shiftKey&&or(m,t)&&(F(m)||ze(m))){let _=m.anchor.getNode(),b=Zc(t,m.anchor.getNode());b?(s.$setAnchorCellForSelection(ks(s,b)),s.$setFocusCellForSelection(h),$r(f)):(t.isBefore(_)?t.selectStart():t.selectEnd()).anchor.set(m.anchor.key,m.anchor.offset,m.anchor.type)}else f.pointerType!=="touch"&&s.$setAnchorCellForSelection(h)})),(()=>{if(s.isSelecting)return;let m=()=>{s.isSelecting=!1,i.removeEventListener("pointerup",m),i.removeEventListener("pointermove",_)},_=b=>{if(!x8(b)&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("pointerup",m),void i.removeEventListener("pointermove",_);if(!Ti(b.target))return;let y=null,x=!(HI||a.contains(b.target));if(x)y=UI(a,b.target);else for(let v of document.elementsFromPoint(b.clientX,b.clientY))if(y=UI(a,v),y)break;!y||s.focusCell!==null&&y.elem===s.focusCell.elem||(s.setNextFocus({focusCell:y,override:x}),n.dispatchCommand(cn,void 0))};s.isSelecting=!0,i.addEventListener("pointerup",m,s.listenerOptions),i.addEventListener("pointermove",_,s.listenerOptions)})()};a.addEventListener("pointerdown",l,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("pointerdown",l)}));let c=f=>{f.detail>=3&&Ti(f.target)&&ed(f.target)!==null&&f.preventDefault()};a.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));let d=f=>{let h=f.target;f.button===0&&Ti(h)&&n.update((()=>{let m=$();ze(m)&&m.tableKey===s.tableNodeKey&&r.contains(h)&&s.$clearHighlight()}))};i.addEventListener("pointerdown",d,s.listenerOptions),s.listenersToRemove.add((()=>{i.removeEventListener("pointerdown",d)}));for(let[f,h]of v8)s.listenersToRemove.add(n.registerCommand(f,(m=>aM(n,m,h,t,s)),xi));s.listenersToRemove.add(n.registerCommand(Ci,(f=>{let h=$();if(ze(h)){let m=Zc(t,h.focus.getNode());if(m!==null)return $r(f),m.selectEnd(),!0}return!1}),xi));let u=f=>()=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$clearText(),!0;if(F(h)){if(!ce(Zc(t,h.anchor.getNode())))return!1;let m=h.anchor.getNode(),_=h.focus.getNode(),b=t.isParentOf(m),y=t.isParentOf(_);if(b&&!y||y&&!b)return s.$clearText(),!0;let x=le(h.anchor.getNode(),(E=>G(E))),v=x&&le(x,(E=>G(E)&&ce(E.getParent())));if(!G(v)||!G(x))return!1;if(f===Pc&&v.getPreviousSibling()===null)return!0}return!1};for(let f of C8)s.listenersToRemove.add(n.registerCommand(f,u(f),Ct));let p=f=>{let h=$();if(!ze(h)&&!F(h))return!1;let m=t.isParentOf(h.anchor.getNode());if(m!==t.isParentOf(h.focus.getNode())){let _=m?"anchor":"focus",b=m?"focus":"anchor",{key:y,offset:x,type:v}=h[b];return t[h[_].isBefore(h[b])?"selectPrevious":"selectNext"]()[b].set(y,x,v),!1}return!!or(h,t)&&!!ze(h)&&(f&&(f.preventDefault(),f.stopPropagation()),s.$clearText(),!0)};for(let f of E8)s.listenersToRemove.add(n.registerCommand(f,p,Ct));return s.listenersToRemove.add(n.registerCommand(jp,(f=>{let h=$();if(h){if(!ze(h)&&!F(h))return!1;Yc(n,Jn(f,ClipboardEvent)?f:null,NI(h));let m=p(f);return F(h)?(h.removeText(),!0):m}return!1}),Ct)),s.listenersToRemove.add(n.registerCommand(ot,(f=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$formatCells(f),!0;if(F(h)){let m=le(h.anchor.getNode(),(_=>ce(_)));if(!ce(m))return!1}return!1}),Ct)),s.listenersToRemove.add(n.registerCommand(Wp,(f=>{let h=$();if(!ze(h)||!or(h,t))return!1;let m=h.anchor.getNode(),_=h.focus.getNode();if(!ce(m)||!ce(_))return!1;if((function(w,S){if(ze(w)){let N=w.anchor.getNode(),D=w.focus.getNode();if(S&&N&&D){let[O]=rn(S,N,D);return N.getKey()===O[0][0].cell.getKey()&&D.getKey()===O[O.length-1].at(-1).cell.getKey()}}return!1})(h,t))return t.setFormat(f),!0;let[b,y,x]=rn(t,m,_),v=Math.max(y.startRow+y.cell.__rowSpan-1,x.startRow+x.cell.__rowSpan-1),E=Math.max(y.startColumn+y.cell.__colSpan-1,x.startColumn+x.cell.__colSpan-1),C=Math.min(y.startRow,x.startRow),k=Math.min(y.startColumn,x.startColumn),T=new Set;for(let w=C;w<=v;w++)for(let S=k;S<=E;S++){let N=b[w][S].cell;if(T.has(N))continue;T.add(N),N.setFormat(f);let D=N.getChildren();for(let O=0;O<D.length;O++){let M=D[O];G(M)&&!M.isInline()&&M.setFormat(f)}}return!0}),Ct)),s.listenersToRemove.add(n.registerCommand(Kp,(f=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$clearHighlight(),!1;if(F(h)){let m=le(h.anchor.getNode(),(_=>ce(_)));if(!ce(m))return!1;if(typeof f=="string"){let _=WI(n,h,t);if(_)return VI(_,t,[vt(f)]),!0}}return!1}),Ct)),o&&s.listenersToRemove.add(n.registerCommand(Ei,(f=>{let h=$();if(!F(h)||!h.isCollapsed()||!or(h,t))return!1;let m=al(h.anchor.getNode());return!(m===null||!t.is(Ns(m)))&&($r(f),(function(_,b){let y=b==="next"?"getNextSibling":"getPreviousSibling",x=b==="next"?"getFirstChild":"getLastChild",v=_[y]();if(G(v))return v.selectEnd();let E=le(_,We);E===null&&re(247);for(let k=E[y]();We(k);k=k[y]()){let T=k[x]();if(G(T))return T.selectEnd()}let C=le(E,rt);C===null&&re(248),b==="next"?C.selectNext():C.selectPrevious()})(m,f.shiftKey?"previous":"next"),!0)}),Ct)),s.listenersToRemove.add(n.registerCommand(uD,(f=>t.isSelected()),xi)),s.listenersToRemove.add(n.registerCommand(Bc,((f,h)=>{if(n!==h)return!1;let{nodes:m,selection:_}=f,b=_.getStartEndPoints(),y=ze(_),x=F(_)&&le(_.anchor.getNode(),(ye=>ce(ye)))!==null&&le(_.focus.getNode(),(ye=>ce(ye)))!==null||y;if(m.length!==1||!rt(m[0])||!x||b===null)return!1;let[v,E]=b,[C,k,T]=Ft(v),w=le(E.getNode(),(ye=>ce(ye)));if(!(ce(C)&&ce(w)&&We(k)&&rt(T)))return!1;let S=m[0],[N,D,O]=rn(T,C,w),[M]=zr(S,null,null),I=N.length,L=I>0?N[0].length:0,K=D.startRow,W=D.startColumn,q=M.length,B=q>0?M[0].length:0;if(y){let ye=Sf(N,D,O),Je=ye.maxRow-ye.minRow+1,st=ye.maxColumn-ye.minColumn+1;K=ye.minRow,W=ye.minColumn,q=Math.min(q,Je),B=Math.min(B,st)}let se=!1,me=Math.min(I,K+q)-1,mt=Math.min(L,W+B)-1,Jt=new Set;for(let ye=K;ye<=me;ye++)for(let Je=W;Je<=mt;Je++){let st=N[ye][Je];Jt.has(st.cell.getKey())||st.cell.__rowSpan===1&&st.cell.__colSpan===1||(nM(st.cell),Jt.add(st.cell.getKey()),se=!0)}let[dt]=zr(T.getWritable(),null,null),_t=q-I+K;for(let ye=0;ye<_t;ye++)Px(dt[I-1][0].cell);let sn=B-L+W;for(let ye=0;ye<sn;ye++)Fx(dt[0][L-1].cell,!0,!1);[dt]=zr(T.getWritable(),null,null);for(let ye=K;ye<K+q;ye++)for(let Je=W;Je<W+B;Je++){let st=ye-K,ml=Je-W,Bt=M[st][ml];if(Bt.startRow!==st||Bt.startColumn!==ml)continue;let wn=Bt.cell;if(wn.__rowSpan!==1||wn.__colSpan!==1){let eo=[],id=Math.min(ye+wn.__rowSpan,K+q)-1,H=Math.min(Je+wn.__colSpan,W+B)-1;for(let te=ye;te<=id;te++)for(let pe=Je;pe<=H;pe++){let ie=dt[te][pe];eo.push(ie.cell)}tM(eo),se=!0}let{cell:_l}=dt[ye][Je],ir=_l.getChildren();wn.getChildren().forEach((eo=>{Z(eo)&&fe().append(eo),_l.append(eo)})),ir.forEach((eo=>eo.remove()))}if(y&&se){let[ye]=zr(T.getWritable(),null,null);ye[D.startRow][D.startColumn].cell.selectEnd()}return!0}),Ct)),s.listenersToRemove.add(n.registerCommand(cn,(()=>{let f=$(),h=Ar(),m=s.getAndClearNextFocus();if(m!==null){let{focusCell:_}=m;if(ze(f)&&f.tableKey===s.tableNodeKey)return(_.x!==s.focusX||_.y!==s.focusY)&&(s.$setFocusCellForSelection(_),!0);if(_!==s.anchorCell&&or(f,t))return s.$setFocusCellForSelection(_),!0}if(s.getAndClearShouldCheckSelection()&&F(h)&&F(f)&&f.isCollapsed()){let _=f.anchor.getNode(),b=t.getFirstChild(),y=al(_);if(y!==null&&We(b)){let x=b.getFirstChild();if(ce(x)&&t.is(le(y,(v=>v.is(t)||v.is(x)))))return x.selectStart(),!0}}if(F(f)){let{anchor:_,focus:b}=f,y=_.getNode(),x=b.getNode(),v=al(y),E=al(x),C=!(!v||!t.is(Ns(v))),k=!(!E||!t.is(Ns(E))),T=C!==k,w=C&&k,S=f.isBackward();if(T){let N=f.clone();if(k){let[D]=rn(t,E,E),O=D[0][0].cell,M=D[D.length-1].at(-1).cell;N.focus.set(S?O.getKey():M.getKey(),S?O.getChildrenSize():M.getChildrenSize(),"element")}else if(C){let[D]=rn(t,v,v),O=D[0][0].cell,M=D[D.length-1].at(-1).cell;N.anchor.set(S?M.getKey():O.getKey(),S?M.getChildrenSize():0,"element")}ht(N),jI(n,s)}else if(w&&(v.is(E)||(s.$setAnchorCellForSelection(ks(s,v)),s.$setFocusCellForSelection(ks(s,E),!0)),s.pointerType==="touch"&&s.isSelecting&&f.isCollapsed()&&F(h)&&h.isCollapsed())){let N=al(h.anchor.getNode());N&&!N.is(E)&&(s.$setAnchorCellForSelection(ks(s,N)),s.$setFocusCellForSelection(ks(s,E),!0),s.pointerType=null)}}else if(f&&ze(f)&&f.is(h)&&f.tableKey===t.getKey()){let _=Xn(i);if(_&&_.anchorNode&&_.focusNode){let b=on(_.focusNode),y=b&&!t.isParentOf(b),x=on(_.anchorNode),v=x&&t.isParentOf(x);if(y&&v&&_.rangeCount>0){let E=W1(_,n);E&&(E.anchor.set(t.getKey(),f.isBackward()?t.getChildrenSize():0,"element"),_.removeAllRanges(),ht(E))}}}return f&&!f.is(h)&&(ze(f)||ze(h))&&s.tableSelection&&!s.tableSelection.is(h)?(ze(f)&&f.tableKey===s.tableNodeKey?s.$updateTableTableSelection(f):!ze(f)&&ze(h)&&h.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!t.isSelected()?(function(_,b){b.$enableHighlightStyle(),Xx(b.table,(y=>{let x=y.elem;y.highlighted=!1,sM(_,y),x.getAttribute("style")||x.removeAttribute("style")}))})(n,s):!s.hasHijackedSelectionStyles&&t.isSelected()&&jI(n,s),!1)}),Ct)),s.listenersToRemove.add(n.registerCommand(vi,(()=>{let f=$();if(!F(f)||!f.isCollapsed()||!or(f,t))return!1;let h=WI(n,f,t);return!!h&&(VI(h,t),!0)}),Ct)),s}function zx(t){return t[$x]||null}function ed(t){let e=t;for(;e!=null;){let n=e.nodeName;if(n==="TD"||n==="TH"){let o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function UI(t,e){if(!t.contains(e))return null;let n=null;for(let o=e;o!=null;o=o.parentNode){if(o===t)return n;let r=o.nodeName;r!=="TD"&&r!=="TH"||(n=o._cell||null)}return null}function ll(t,e){let n=[],o={columns:0,domRows:n,rows:0},r=Oi(t,e).querySelector("tr"),i=0,s=0;for(n.length=0;r!=null;){let a=r.nodeName;if(a==="TD"||a==="TH"){let d={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=d;let u=n[s];u===void 0&&(u=n[s]=[]),u[i]=d}else{let d=r.firstChild;if(d!=null){r=d;continue}}let l=r.nextSibling;if(l!=null){i++,r=l;continue}let c=r.parentNode;if(c!=null){let d=c.nextSibling;if(d==null)break;s++,i=0,r=d}}return o.columns=i+1,o.rows=s+1,o}function Ef(t,e,n){let o=new Set(n?n.getNodes():[]);Xx(e,((r,i)=>{let s=r.elem;o.has(i)?(r.highlighted=!0,iM(t,r)):(r.highlighted=!1,sM(t,r),s.getAttribute("style")||s.removeAttribute("style"))}))}function Xx(t,e){let{domRows:n}=t;for(let o=0;o<n.length;o++){let r=n[o];if(r)for(let i=0;i<r.length;i++){let s=r[i];if(!s)continue;let a=on(s.elem);a!==null&&e(s,a,{x:i,y:o})}}}function jI(t,e){e.$disableHighlightStyle(),Xx(e.table,(n=>{n.highlighted=!0,iM(t,n)}))}var w8=(t,e,n,o,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return n!==(i?t.table.columns-1:0)?Tf(e.getCellNodeFromCordsOrThrow(n+(i?1:-1),o,t.table),i):o!==(i?t.table.rows-1:0)?Tf(e.getCellNodeFromCordsOrThrow(i?0:t.table.columns-1,o+(i?1:-1),t.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?Tf(e.getCellNodeFromCordsOrThrow(n,o-1,t.table),!1):e.selectPrevious(),!0;case"down":return o!==t.table.rows-1?Tf(e.getCellNodeFromCordsOrThrow(n,o+1,t.table),!0):e.selectNext(),!0;default:return!1}};function Ax(t,e){let n,o;if(e.startColumn===t.minColumn)n="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==t.maxColumn)return null;n="maxColumn"}if(e.startRow===t.minRow)o="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==t.maxRow)return null;o="maxRow"}return[n,o]}function wf([t,e]){return[t==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function il(t,e,[n,o]){let r=e[o],i=t[r];i===void 0&&re(250,o,String(r));let s=e[n],a=i[s];return a===void 0&&re(250,n,String(s)),a}function T8(t,e,n,o,r){let i=Sf(e,n,o),s=(function(C,k){let{minColumn:T,maxColumn:w,minRow:S,maxRow:N}=k,D=1,O=1,M=1,I=1,L=C[S],K=C[N];for(let W=T;W<=w;W++)D=Math.max(D,L[W].cell.__rowSpan),I=Math.max(I,K[W].cell.__rowSpan);for(let W=S;W<=N;W++)O=Math.max(O,C[W][T].cell.__colSpan),M=Math.max(M,C[W][w].cell.__colSpan);return{bottomSpan:I,leftSpan:O,rightSpan:M,topSpan:D}})(e,i),{topSpan:a,leftSpan:l,bottomSpan:c,rightSpan:d}=s,u=(function(C,k){let T=Ax(C,k);return T===null&&re(249,k.cell.getKey()),T})(i,n),[p,f]=wf(u),h=i[p],m=i[f];r==="forward"?h+=p==="maxColumn"?1:l:r==="backward"?h-=p==="minColumn"?1:d:r==="down"?m+=f==="maxRow"?1:a:r==="up"&&(m-=f==="minRow"?1:c);let _=e[m];if(_===void 0)return!1;let b=_[h];if(b===void 0)return!1;let[y,x]=(function(C,k,T){let w=Sf(C,k,T),S=Ax(w,k);if(S)return[il(C,w,S),il(C,w,wf(S))];let N=Ax(w,T);if(N)return[il(C,w,wf(N)),il(C,w,N)];let D=["minColumn","minRow"];return[il(C,w,D),il(C,w,wf(D))]})(e,n,b),v=ks(t,y.cell),E=ks(t,x.cell);return t.$setAnchorCellForSelection(v),t.$setFocusCellForSelection(E,!0),!0}function or(t,e){if(F(t)||ze(t)){let n=e.isParentOf(t.anchor.getNode()),o=e.isParentOf(t.focus.getNode());return n&&o}return!1}function Tf(t,e){e?t.selectStart():t.selectEnd()}function iM(t,e){let n=e.elem,o=t._config.theme;ce(on(n))||re(131),Ve(n,o.tableCellSelected)}function sM(t,e){let n=e.elem;ce(on(n))||re(131);let o=t._config.theme;Fn(n,o.tableCellSelected)}function al(t){let e=le(t,ce);return ce(e)?e:null}function Ns(t){let e=le(t,rt);return rt(e)?e:null}function S8(t,e,n,o,r,i,s){let a=mi(n.focus,r?"previous":"next");if(Pp(a))return!1;let l=a;for(let _ of Lc(a).iterNodeCarets("shadowRoot")){if(!Fp(_)||!G(_.origin))return!1;l=_}let c=l.getParentAtCaret();if(!ce(c))return!1;let d=c,u=(function(_){for(let b of Lc(_).iterNodeCarets("root")){let{origin:y}=b;if(ce(y)){if(bi(b))return qn(y,_.direction)}else if(!We(y))break}return null})(xn(d,l.direction)),p=le(d,rt);if(!p||!p.is(i))return!1;let f=t.getElementByKey(d.getKey()),h=ed(f);if(!f||!h)return!1;let m=lM(t,p);if(s.table=m,u)if(o==="extend"){let _=ed(t.getElementByKey(u.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(_,!0)}else{let _=Xo(u);yi(n.anchor,_),yi(n.focus,_)}else if(o==="extend")s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{let _=(function(b){let y=gs(b);return bi(y)?Xo(y):b})(xn(p,a.direction));yi(n.anchor,_),yi(n.focus,_)}return $r(e),!0}function aM(t,e,n,o,r){if((n==="up"||n==="down")&&(function(s){let a=s.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1})(t))return!1;let i=$();if(!or(i,o)){if(F(i)){if(n==="backward"){if(i.focus.offset>0)return!1;let s=(function(l){for(let c=l,d=l;d!==null;c=d,d=d.getParent())if(G(d)){if(d!==c&&d.getFirstChild()!==c)return null;if(!d.isInline())return d}return null})(i.focus.getNode());if(!s)return!1;let a=s.getPreviousSibling();return!!rt(a)&&($r(e),e.shiftKey?i.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(n==="up"||n==="down")){let s=i.focus.getNode();if(!i.isCollapsed()&&(n==="up"&&!i.isBackward()||n==="down"&&i.isBackward())){let a=le(s,(p=>rt(p)));if(ce(a)&&(a=le(a,rt)),a!==o||!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(!l)return!1;let c=0;n==="up"&&G(l)&&(c=l.getChildrenSize());let d=l;n==="up"&&G(l)&&(d=l.getLastChild()||l,c=Z(d)?d.getTextContentSize():0);let u=i.clone();return u.focus.set(d.getKey(),c,Z(d)?"text":"element"),ht(u),$r(e),!0}if(Lt(s)){let a=n==="up"?i.getNodes()[i.getNodes().length-1]:i.getNodes()[0];if(a&&Zc(o,a)!==null){let l=o.getFirstDescendant(),c=o.getLastDescendant();if(!l||!c)return!1;let[d]=Ft(l),[u]=Ft(c),p=o.getCordsFromCellNode(d,r.table),f=o.getCordsFromCellNode(u,r.table),h=o.getDOMCellFromCordsOrThrow(p.x,p.y,r.table),m=o.getDOMCellFromCordsOrThrow(f.x,f.y,r.table);return r.$setAnchorCellForSelection(h),r.$setFocusCellForSelection(m,!0),!0}return!1}{let a=le(s,(c=>G(c)&&!c.isInline()));if(ce(a)&&(a=le(a,rt)),!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(rt(l)&&r.tableNodeKey===l.getKey()){let c=l.getFirstDescendant(),d=l.getLastDescendant();if(!c||!d)return!1;let[u]=Ft(c),[p]=Ft(d),f=i.clone();return f.focus.set((n==="up"?u:p).getKey(),n==="up"?0:p.getChildrenSize(),"element"),$r(e),ht(f),!0}}}}return n==="down"&&Df(t)&&r.setShouldCheckSelection(),!1}if(F(i)){if(n==="backward"||n==="forward")return S8(t,e,i,e.shiftKey?"extend":"move",n==="backward",o,r);if(i.isCollapsed()){let{anchor:s,focus:a}=i,l=le(s.getNode(),ce),c=le(a.getNode(),ce);if(!ce(l)||!l.is(c))return!1;let d=Ns(l);if(d!==o&&d!=null){let b=Oi(d,t.getElementByKey(d.getKey()));if(b!=null)return r.table=ll(d,b),aM(t,e,n,d,r)}let u=t.getElementByKey(l.__key),p=t.getElementByKey(s.key);if(p==null||u==null)return!1;let f;if(s.type==="element")f=p.getBoundingClientRect();else{let b=Xn(qx(t));if(b===null||b.rangeCount===0)return!1;f=b.getRangeAt(0).getBoundingClientRect()}let h=n==="up"?l.getFirstChild():l.getLastChild();if(h==null)return!1;let m=t.getElementByKey(h.__key);if(m==null)return!1;let _=m.getBoundingClientRect();if(n==="up"?_.top>f.top-f.height:f.bottom+f.height>_.bottom){$r(e);let b=o.getCordsFromCellNode(l,r.table);if(!e.shiftKey)return w8(r,o,b.x,b.y,n);{let y=o.getDOMCellFromCordsOrThrow(b.x,b.y,r.table);r.$setAnchorCellForSelection(y),r.$setFocusCellForSelection(y,!0)}return!0}}}else if(ze(i)){let{anchor:s,focus:a}=i,l=le(s.getNode(),ce),c=le(a.getNode(),ce),[d]=i.getNodes();rt(d)||re(251);let u=Oi(d,t.getElementByKey(d.getKey()));if(!ce(l)||!ce(c)||!rt(d)||u==null)return!1;r.$updateTableTableSelection(i);let p=ll(d,u),f=o.getCordsFromCellNode(l,p),h=o.getDOMCellFromCordsOrThrow(f.x,f.y,p);if(r.$setAnchorCellForSelection(h),$r(e),e.shiftKey){let[m,_,b]=rn(o,l,c);return T8(r,m,_,b,n)}return c.selectEnd(),!0}return!1}function $r(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}function VI(t,e,n){let o=fe();t==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...n||[]),o.selectEnd()}function WI(t,e,n){let o=n.getParent();if(!o)return;let r=Xn(qx(t));if(!r)return;let i=r.anchorNode,s=t.getElementByKey(o.getKey()),a=Oi(n,t.getElementByKey(n.getKey()));if(!i||!s||!a||!s.contains(i)||a.contains(i))return;let l=le(e.anchor.getNode(),(y=>ce(y)));if(!l)return;let c=le(l,(y=>rt(y)));if(!rt(c)||!c.is(n))return;let[d,u]=rn(n,l,l),p=d[0][0],f=d[d.length-1][d[0].length-1],{startRow:h,startColumn:m}=u,_=h===p.startRow&&m===p.startColumn,b=h===f.startRow&&m===f.startColumn;return _?"first":b?"last":void 0}function ks(t,e){let{tableNode:n}=t.$lookup(),o=n.getCordsFromCellNode(e,t.table);return n.getDOMCellFromCordsOrThrow(o.x,o.y,t.table)}function Hx(t,e,n){return Zc(t,on(e,n))}function GI(t,e,n){if(!e.theme.tableAlignment)return;let o=[],r=[];for(let i of["center","right"]){let s=e.theme.tableAlignment[i];s&&(i===n?r:o).push(s)}Fn(t,...o),Ve(t,...r)}var Kx=new WeakSet;function Df(t=ms()){return Kx.has(t)}function k8(t,e){e?Kx.add(t):Kx.delete(t)}var Ii=class t extends Rt{static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let n=this.getWritable();return n.__colWidths=e,n}static clone(e){return new t(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:N8,priority:1})}}static importJSON(e){return If().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,n,o){return o==="html"}getDOMSlot(e){let n=sl(e)?e:e.querySelector("table");return sl(n)||re(229),super.getDOMSlot(e).withElement(n).withAfter(n.querySelector("colgroup"))}createDOM(e,n){let o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);let r=document.createElement("colgroup");if(o.appendChild(r),ID(r),Ve(o,e.theme.table),this.updateTableElement(null,o,e),Df(n)){let i=document.createElement("div"),s=e.theme.tableScrollableWrapper;return s?Ve(i,s):i.style.cssText="overflow-x: auto;",i.appendChild(o),this.updateTableWrapper(null,i,o,e),i}return o}updateTableWrapper(e,n,o,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,s,a,l){l>0?(Ve(i,a.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(Fn(i,a.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(n,o,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,s,a,l){l>0?(Ve(i,a.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(Fn(i,a.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(n,o,r,this.__frozenRowCount)}updateTableElement(e,n,o){this.__style!==(e?e.__style:"")&&(n.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(r,i,s){s?(Ve(r,i.theme.tableRowStriping),r.setAttribute("data-lexical-row-striping","true")):(Fn(r,i.theme.tableRowStriping),r.removeAttribute("data-lexical-row-striping"))})(n,o,this.__rowStriping),(function(r,i,s,a){let l=r.querySelector("colgroup");if(!l)return;let c=[];for(let d=0;d<s;d++){let u=document.createElement("col"),p=a&&a[d];p&&(u.style.width=`${p}px`),c.push(u)}l.replaceChildren(...c)})(n,0,this.getColumnCount(),this.getColWidths()),GI(n,o,this.getFormatType())}updateDOM(e,n,o){let r=this.getDOMSlot(n).element;return n===r===Df()||(qt(i=n)&&i.nodeName==="DIV"&&this.updateTableWrapper(e,n,r,o),this.updateTableElement(e,r,o),!1);var i}exportDOM(e){let n=super.exportDOM(e),{element:o}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!sl(r)&&qt(r)&&(r=r.querySelector("table")),!sl(r))return null;GI(r,e._config,this.getFormatType());let[i]=zr(this,null,null),s=new Map;for(let d of i)for(let u of d){let p=u.cell.getKey();s.has(p)||s.set(p,{colSpan:u.cell.getColSpan(),startColumn:u.startColumn})}let a=new Set;for(let d of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){let u=d.getAttribute("data-temporary-table-cell-lexical-key");if(u){let p=s.get(u);if(d.removeAttribute("data-temporary-table-cell-lexical-key"),p){s.delete(u);for(let f=0;f<p.colSpan;f++)a.add(f+p.startColumn)}}}let l=r.querySelector(":scope > colgroup");if(l){let d=Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((u,p)=>a.has(p)));l.replaceChildren(...d)}let c=r.querySelectorAll(":scope > tr");if(c.length>0){let d=document.createElement("tbody");for(let u of c)d.appendChild(u);r.append(d)}return r},element:!sl(o)&&qt(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,n){let{rows:o,domRows:r}=n;for(let i=0;i<o;i++){let s=r[i];if(s!=null)for(let a=0;a<s.length;a++){let l=s[a];if(l==null)continue;let{elem:c}=l,d=Hx(this,c);if(d!==null&&e.is(d))return{x:a,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,n,o){let{domRows:r}=o,i=r[n];if(i==null)return null;let s=i[e<i.length?e:i.length-1];return s??null}getDOMCellFromCordsOrThrow(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(r==null)return null;let i=on(r.elem);return ce(i)?i:null}getCellNodeFromCordsOrThrow(e,n,o){let r=this.getCellNodeFromCords(e,n,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let n=this.getWritable();return n.__rowStriping=e,n}setFrozenColumns(e){let n=this.getWritable();return n.__frozenColumnCount=e,n}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let n=this.getWritable();return n.__frozenRowCount=e,n}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!e)return 0;let n=0;return e.getChildren().forEach((o=>{ce(o)&&(n+=o.getColSpan())})),n}};function lM(t,e){let n=t.getElementByKey(e.getKey());return n===null&&re(230),ll(e,n)}function N8(t){let e=If();t.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),t.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),t.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);let n=t.querySelector(":scope > colgroup");if(n){let o=[];for(let r of n.querySelectorAll(":scope > col")){let i=r.style.width||"";if(!Ux.test(i)&&(i=r.getAttribute("width")||"",!/^\d+$/.test(i))){o=void 0;break}o.push(parseFloat(i))}o&&e.setColWidths(o)}return{after:o=>Uy(o,We),node:e}}function If(){return Tt(new Ii)}function rt(t){return t instanceof Ii}function D8({rows:t,columns:e,includeHeaders:n}){let o=$()||Ar();if(!o||!F(o)||Ns(o.anchor.getNode()))return!1;let r=qI(Number(t),Number(e),n);sf(r);let i=r.getFirstDescendant();return Z(i)&&i.select(),!0}function O8(t){We(t.getParent())?t.isEmpty()&&t.append(fe()):t.remove()}function I8(t){rt(t.getParent())?jy(t,ce):t.remove()}function M8(t){jy(t,We);let[e]=zr(t,null,null),n=e.reduce(((r,i)=>Math.max(r,i.length)),0),o=t.getChildren();for(let r=0;r<e.length;++r){let i=o[r];if(!i)continue;We(i)||re(254,i.constructor.name,i.getType());let s=e[r].reduce(((a,l)=>l?1+a:a),0);if(s!==n)for(let a=s;a<n;++a){let l=zn();l.append(fe()),i.append(l)}}}function A8(t){if(t.detail<3||!Ti(t.target))return!1;let e=on(t.target);if(e===null)return!1;let n=le(e,(o=>G(o)&&!o.isInline()));return n===null?!1:!!ce(n.getParent())&&(n.select(0),!0)}function L8(t){return t.registerNodeTransform(Di,(e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,n]=Ft(e),[o]=rn(n,e,e),r=o.length,i=o[0].length,s=n.getFirstChild();We(s)||re(175);let a=[];for(let l=0;l<r;l++){l!==0&&(s=s.getNextSibling(),We(s)||re(175));let c=null;for(let d=0;d<i;d++){let u=o[l][d],p=u.cell;if(u.startRow===l&&u.startColumn===d)c=p,a.push(p);else if(p.getColSpan()>1||p.getRowSpan()>1){ce(p)||re(176);let f=zn(p.__headerState);c!==null?c.insertAfter(f):pO(s,f)}}}for(let l of a)l.setColSpan(1),l.setRowSpan(1)}}))}function R8(t,e=!0){let n=new Map,o=(i,s,a)=>{let l=Oi(i,a),c=rM(i,l,t,e);n.set(s,[c,l])},r=t.registerMutationListener(Ii,(i=>{t.getEditorState().read((()=>{for(let[s,a]of i){let l=n.get(s);if(a==="created"||a==="updated"){let{tableNode:c,tableElement:d}=Yx(s);l===void 0?o(c,s,d):d!==l[1]&&(l[0].removeListeners(),n.delete(s),o(c,s,d))}else a==="destroyed"&&l!==void 0&&(l[0].removeListeners(),n.delete(s))}}),{editor:t})}),{skipInitialization:!1});return()=>{r();for(let[,[i]]of n)i.removeListeners()}}function P8(t){return t.hasNodes([Ii])||re(255),Fe(t.registerCommand(YI,D8,Ce),t.registerCommand(Bc,(({nodes:e,selection:n},o)=>t!==o||!F(n)?!1:Ns(n.anchor.getNode())!==null&&e.some(rt)),Ce),t.registerCommand(Jo,A8,Ce),t.registerNodeTransform(Ii,M8),t.registerNodeTransform(cl,I8),t.registerNodeTransform(Di,O8))}var ue=Jx,koe=ue.$computeTableMap,Noe=ue.$computeTableMapSkipCellCheck,cM=ue.$createTableCellNode,dM=ue.$createTableNode,Doe=ue.$createTableNodeWithDimensions,uM=ue.$createTableRowNode,Ooe=ue.$createTableSelection,Ioe=ue.$createTableSelectionFrom,Moe=ue.$deleteTableColumn,pM=ue.$deleteTableColumnAtSelection,Aoe=ue.$deleteTableColumn__EXPERIMENTAL,fM=ue.$deleteTableRowAtSelection,Loe=ue.$deleteTableRow__EXPERIMENTAL,Roe=ue.$findCellNode,Poe=ue.$findTableNode,Foe=ue.$getElementForTableNode,Boe=ue.$getNodeTriplet,$oe=ue.$getTableAndElementByKey,Zx=ue.$getTableCellNodeFromLexicalNode,zoe=ue.$getTableCellNodeRect,Hoe=ue.$getTableColumnIndexFromTableCellNode,td=ue.$getTableNodeFromLexicalNodeOrThrow,Koe=ue.$getTableRowIndexFromTableCellNode,Uoe=ue.$getTableRowNodeFromTableCellNodeOrThrow,joe=ue.$insertTableColumn,Qx=ue.$insertTableColumnAtSelection,Voe=ue.$insertTableColumn__EXPERIMENTAL,Woe=ue.$insertTableRow,ev=ue.$insertTableRowAtSelection,Goe=ue.$insertTableRow__EXPERIMENTAL,hM=ue.$isScrollableTablesActive,No=ue.$isTableCellNode,gM=ue.$isTableNode,po=ue.$isTableRowNode,mM=ue.$isTableSelection,Yoe=ue.$mergeCells,qoe=ue.$removeTableRowAtIndex,Xoe=ue.$unmergeCell,_M=ue.INSERT_TABLE_COMMAND,Cn=ue.TableCellHeaderStates,Mf=ue.TableCellNode,Af=ue.TableNode,Joe=ue.TableObserver,bM=ue.TableRowNode,Zoe=ue.applyTableHandlers,Qoe=ue.getDOMCellFromTarget,ere=ue.getTableElement,tre=ue.getTableObserverFromTableElement,yM=ue.registerTableCellUnmergeTransform,xM=ue.registerTablePlugin,vM=ue.registerTableSelectionObserver,CM=ue.setScrollableTablesActive;var tv={};Re(tv,{TablePlugin:()=>F8});ut();function F8({hasCellMerge:t=!0,hasCellBackgroundColor:e=!0,hasTabHandler:n=!0,hasHorizontalScroll:o=!1}){let[r]=be();return P((()=>{hM(r)!==o&&(CM(r,o),r.registerNodeTransform(Af,(()=>{}))())}),[r,o]),P((()=>xM(r)),[r]),P((()=>vM(r,n)),[r,n]),P((()=>{if(!t)return yM(r)}),[r,t]),P((()=>{if(!e)return r.registerNodeTransform(Mf,(i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)}))}),[r,e,t]),null}var B8=tv,EM=B8.TablePlugin;Se();function nv(t){return{type:"string",...t}}function wM(t){return{type:"image",...t}}function $8(t){return t}var ov=$8;var SM=new Set(["paragraph","heading","quote","orderedList","unorderedList","table","delimiter"]),TM=40,H8=200,sv="root:openRichTextBlock",av="root:openRichTextInline";function are(t,e,n,o={}){let r=(t||"").trim();if(!r)return[];let i={query:r,queryLower:r.toLowerCase(),results:[],types:o},s=[];for(rv(s,i,n,e,"fields",[]);s.length>0&&i.results.length<H8;)s.shift()();return i.results}function rv(t,e,n,o,r,i){if(o)for(let s of n){if(!s.id||s.hidden)continue;let a=o[s.id],l=`${r}.${s.id}`,c=s.label||s.id;t.push(()=>kM(t,e,s,a,l,[...i,c]))}}function kM(t,e,n,o,r,i){if(o!=null)switch(n.type){case"object":{rv(t,e,n.fields||[],o,r,i);return}case"array":{let s=n;(o?._array||[]).forEach((l,c)=>{let d=o?.[l];if(d==null)return;let u=`[${c}]`,p=s.of;t.push(()=>kM(t,e,p,d,`${r}.${l}`,[...i,u]))});return}case"oneof":{let s=n,a=o?._type;if(!a)return;let l=s.types||[],c;if(typeof l[0]=="string"?l.includes(a)&&(c=e.types[a]):c=l.find(d=>d?.name===a),!c)return;rv(t,e,c.fields||[],o,r,[...i.slice(0,-1),`${i.at(-1)} (${a})`]);return}case"string":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"select":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"multiselect":{if(Array.isArray(o)){let s=o.filter(a=>typeof a=="string").join(", ");s&&dn(e,s,n.type,r,i)}return}case"number":{typeof o=="number"&&dn(e,String(o),n.type,r,i);return}case"boolean":return;case"date":case"datetime":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"image":case"file":{if(o&&typeof o=="object"){let s=[];typeof o.alt=="string"&&s.push(o.alt),typeof o.filename=="string"&&s.push(o.filename),typeof o.src=="string"&&s.push(o.src),s.length>0&&dn(e,s.join(" "),n.type,r,i)}return}case"reference":{o&&typeof o=="object"&&typeof o.id=="string"&&dn(e,o.id,n.type,r,i);return}case"references":{if(Array.isArray(o)){let s=o.map(a=>a&&typeof a=="object"?a.id:null).filter(a=>typeof a=="string").join(", ");s&&dn(e,s,n.type,r,i)}return}case"richtext":{NM(e,n,o,r,i);return}default:return}}function NM(t,e,n,o,r){if(!n||!Array.isArray(n.blocks))return;let i=new Map;(e.blockComponents||[]).forEach(a=>{a?.name&&i.set(a.name,a)});let s=-1;n.blocks.forEach(a=>{if(!a?.type)return;if(SM.has(a.type)){OM(t,a,o,r);return}s+=1;let l=s,c={block:{richTextDeepKey:o,blockIndex:l,blockName:a.type}},d=i.get(a.type);if(!d){Lf(t,a.data,o,[...r,`${a.type} [block ${l}]`],c);return}let u=[...r,`${d.label||d.name} [block ${l}]`];iv(t,d.fields||[],a.data||{},o,u,c)})}function iv(t,e,n,o,r,i){for(let s of e){if(!s.id||s.hidden)continue;let a=n?.[s.id];if(a==null)continue;let l=[...r,s.label||s.id];DM(t,s,a,o,l,i)}}function DM(t,e,n,o,r,i){switch(e.type){case"object":{iv(t,e.fields||[],n,o,r,i);return}case"array":{let s=e;(n?._array||[]).forEach((l,c)=>{let d=n?.[l];d!=null&&DM(t,s.of,d,o,[...r,`[${c}]`],i)});return}case"oneof":{let s=e,a=n?._type;if(!a)return;let l=s.types||[],c;typeof l[0]=="string"?l.includes(a)&&(c=t.types[a]):c=l.find(d=>d?.name===a),c&&iv(t,c.fields||[],n,o,[...r.slice(0,-1),`${r.at(-1)} (${a})`],i);return}case"string":case"select":{typeof n=="string"&&dn(t,n,e.type,o,r,i);return}case"multiselect":{if(Array.isArray(n)){let s=n.filter(a=>typeof a=="string").join(", ");s&&dn(t,s,e.type,o,r,i)}return}case"number":{typeof n=="number"&&dn(t,String(n),e.type,o,r,i);return}case"image":case"file":{if(n&&typeof n=="object"){let s=[];typeof n.alt=="string"&&s.push(n.alt),typeof n.filename=="string"&&s.push(n.filename),typeof n.src=="string"&&s.push(n.src),s.length>0&&dn(t,s.join(" "),e.type,o,r,i)}return}case"richtext":{NM(t,e,n,o,r);return}default:return}}function Lf(t,e,n,o,r){if(e!=null){if(typeof e=="string"){dn(t,e,"string",n,o,r);return}if(typeof e=="number"){dn(t,String(e),"number",n,o,r);return}if(Array.isArray(e)){e.forEach((i,s)=>Lf(t,i,n,[...o,`[${s}]`],r));return}if(typeof e=="object")for(let i of Object.keys(e))i.startsWith("_")||Lf(t,e[i],n,[...o,i],r)}}function OM(t,e,n,o){switch(e.type){case"heading":case"paragraph":{let r=AM(e.data?.text);r&&dn(t,r,"richtext",n,[...o,e.type]),MM(t,e.data?.components,n,o);return}case"orderedList":case"unorderedList":{IM(t,e.data?.items,n,[...o,e.type]);return}case"table":{(e.data?.rows||[]).forEach((i,s)=>{(i.cells||[]).forEach((a,l)=>{(a.blocks||[]).forEach(c=>{SM.has(c.type)&&OM(t,c,n,[...o,`table [${s},${l}]`])})})});return}default:return}}function IM(t,e,n,o){e&&e.forEach((r,i)=>{let s=AM(r.content);s&&dn(t,s,"richtext",n,[...o,`[${i}]`]),MM(t,r.components,n,o),IM(t,r.items,n,[...o,`[${i}]`])})}function MM(t,e,n,o){if(e)for(let r of Object.keys(e)){let i=e[r];if(!i?.type)continue;let s={inline:{richTextDeepKey:n,componentId:r,componentName:i.type}};Lf(t,i?.data,n,[...o,`inline:${i.type}`],s)}}function AM(t){return t?t.replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim():""}function dn(t,e,n,o,r,i){if(!e||e.toLowerCase().indexOf(t.queryLower)===-1)return;let{snippet:l,matches:c}=K8(e,t.queryLower);t.results.push({deepKey:o,label:r.join(" \u203A "),snippet:l,matches:c,fieldType:n,richTextBlock:i?.block,richTextInline:i?.inline})}function K8(t,e){let n=t.toLowerCase(),o=e.length,r=n.indexOf(e);if(r===-1)return{snippet:t,matches:[]};let i=Math.max(0,r-TM),s=Math.min(t.length,r+o+TM),a=i>0?"\u2026":"",l=s<t.length?"\u2026":"",c=t.slice(i,s),d=`${a}${c}${l}`,u=[],p=c.toLowerCase(),f=0;for(;f<p.length;){let h=p.indexOf(e,f);if(h===-1)break;u.push({start:h+a.length,end:h+a.length+o}),f=h+o}return{snippet:d,matches:u}}$s();Se();var LM=Ot({blocks:new Map});function RM(t){return g(LM.Provider,{value:{blocks:t.blocks,onEditBlock:t.onEditBlock},children:t.children})}function PM(){return It(LM)}$s();Se();var FM=Ot({components:new Map});function BM(t){return g(FM.Provider,{value:{components:t.components,onEditComponent:t.onEditComponent},children:t.children})}function $M(){return It(FM)}$s();Se();var zM=Ot({});function HM(t){let e=X(()=>({historyState:aI()}),[]);return g(zM.Provider,{value:e,children:t.children})}function KM(){return It(zM)}$s();Se();var Rf={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",bullet:"Bulleted List",number:"Numbered List",quote:"Quote"},U8={blockType:"paragraph",canRedo:!1,canUndo:!1,codeLanguage:"",elementFormat:"left",isBold:!1,isCode:!1,isHighlight:!1,isImageCaption:!1,isItalic:!1,isLink:!1,isRTL:!1,isStrikethrough:!1,isSubscript:!1,isSuperscript:!1,isUnderline:!1,isLowercase:!1,isUppercase:!1,isCapitalize:!1,rootType:"root"},UM=Ot(void 0);function jM(t){let[e,n]=R(U8),o=Ee((i,s)=>{n(a=>({...a,[i]:s}))},[]),r=X(()=>({toolbarState:e,updateToolbarState:o}),[e,o]);return g(UM.Provider,{value:r,children:t.children})}function Pf(){let t=It(UM);if(t===void 0)throw new Error("useToolbar must be used within a ToolbarProvider");return t}var VM={autocomplete:"LexicalTheme__autocomplete",blockCursor:"LexicalTheme__blockCursor",characterLimit:"LexicalTheme__characterLimit",code:"LexicalTheme__code",codeHighlight:{atrule:"LexicalTheme__tokenAttr",attr:"LexicalTheme__tokenAttr",boolean:"LexicalTheme__tokenProperty",builtin:"LexicalTheme__tokenSelector",cdata:"LexicalTheme__tokenComment",char:"LexicalTheme__tokenSelector",class:"LexicalTheme__tokenFunction","class-name":"LexicalTheme__tokenFunction",comment:"LexicalTheme__tokenComment",constant:"LexicalTheme__tokenProperty",deleted:"LexicalTheme__tokenProperty",doctype:"LexicalTheme__tokenComment",entity:"LexicalTheme__tokenOperator",function:"LexicalTheme__tokenFunction",important:"LexicalTheme__tokenVariable",inserted:"LexicalTheme__tokenSelector",keyword:"LexicalTheme__tokenAttr",namespace:"LexicalTheme__tokenVariable",number:"LexicalTheme__tokenProperty",operator:"LexicalTheme__tokenOperator",prolog:"LexicalTheme__tokenComment",property:"LexicalTheme__tokenProperty",punctuation:"LexicalTheme__tokenPunctuation",regex:"LexicalTheme__tokenVariable",selector:"LexicalTheme__tokenSelector",string:"LexicalTheme__tokenSelector",symbol:"LexicalTheme__tokenProperty",tag:"LexicalTheme__tokenProperty",url:"LexicalTheme__tokenOperator",variable:"LexicalTheme__tokenVariable"},embedBlock:{base:"LexicalTheme__embedBlock",focus:"LexicalTheme__embedBlockFocus"},hashtag:"LexicalTheme__hashtag",heading:{h1:"LexicalTheme__h1",h2:"LexicalTheme__h2",h3:"LexicalTheme__h3",h4:"LexicalTheme__h4",h5:"LexicalTheme__h5",h6:"LexicalTheme__h6"},hr:"LexicalTheme__hr",hrSelected:"LexicalTheme__hrSelected",htmlCode:"LexicalTheme__htmlCode",image:"LexicalTheme__image",indent:"LexicalTheme__indent",layoutContainer:"LexicalTheme__layoutContainer",layoutItem:"LexicalTheme__layoutItem",link:"LexicalTheme__link",list:{checklist:"LexicalTheme__checklist",listitem:"LexicalTheme__listItem",listitemChecked:"LexicalTheme__listItemChecked",listitemUnchecked:"LexicalTheme__listItemUnchecked",nested:{listitem:"LexicalTheme__nestedListItem"},ol:"LexicalTheme__ol",olDepth:["LexicalTheme__ol1","LexicalTheme__ol2","LexicalTheme__ol3","LexicalTheme__ol4","LexicalTheme__ol5"],ul:"LexicalTheme__ul"},ltr:"LexicalTheme__ltr",mark:"LexicalTheme__mark",markOverlap:"LexicalTheme__markOverlap",paragraph:"LexicalTheme__paragraph",quote:"LexicalTheme__quote",rtl:"LexicalTheme__rtl",specialText:"LexicalTheme__specialText",tab:"LexicalTheme__tabNode",table:"LexicalTheme__table",tableAddColumns:"LexicalTheme__tableAddColumns",tableAddRows:"LexicalTheme__tableAddRows",tableCell:"LexicalTheme__tableCell",tableCellActionButton:"LexicalTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalTheme__tableCellEditing",tableCellHeader:"LexicalTheme__tableCellHeader",tableCellPrimarySelected:"LexicalTheme__tableCellPrimarySelected",tableCellResizer:"LexicalTheme__tableCellResizer",tableCellSelected:"LexicalTheme__tableCellSelected",tableCellSortedIndicator:"LexicalTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalTheme__tableResizeRuler",tableSelected:"LexicalTheme__tableSelected",tableSelection:"LexicalTheme__tableSelection",text:{bold:"LexicalTheme__textBold",capitalize:"LexicalTheme__textCapitalize",code:"LexicalTheme__textCode",highlight:"LexicalTheme__textHighlight",italic:"LexicalTheme__textItalic",lowercase:"LexicalTheme__textLowercase",strikethrough:"LexicalTheme__textStrikethrough",subscript:"LexicalTheme__textSubscript",superscript:"LexicalTheme__textSuperscript",underline:"LexicalTheme__textUnderline",underlineStrikethrough:"LexicalTheme__textUnderlineStrikethrough",uppercase:"LexicalTheme__textUppercase"}};Se();var dl=class extends Js{constructor(n,o="block"){super();this.listeners=new Map;this.docId="custom-block";this.collectionId="custom-block";this.slug="custom-block";this.data={[o]:Ze(n)}}getValue(n){return Ro(this.data,n)}async updateKey(n,o){WM(this.data,n,o),this.notify(n)}async updateKeys(n){for(let[o,r]of Object.entries(n))WM(this.data,o,r),this.notify(o)}async removeKey(n){j8(this.data,n),this.notify(n)}subscribe(n,o){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(o),o(this.getValue(n)),()=>{this.listeners.get(n)?.delete(o)}}subscribeSubtree(n,o){return this.subscribe(n,o)}getDataSnapshot(){return Ze(this.data)}getData(){return this.getDataSnapshot()}notify(n){this.dispatch("VALUE_CHANGE",n,this.getValue(n));for(let o of V8(n)){let r=this.listeners.get(o);if(!r)continue;let i=this.getValue(o);r.forEach(s=>s(i))}}};function WM(t,e,n){let o=e.split("."),r=t;for(let i=0;i<o.length-1;i++){let s=o[i];(typeof r[s]!="object"||r[s]===null||Array.isArray(r[s]))&&(r[s]={}),r=r[s]}r[o.at(-1)]=n}function j8(t,e){let n=e.split("."),o=t;for(let r=0;r<n.length-1;r++)if(o=o?.[n[r]],typeof o!="object"||o===null)return;o&&delete o[n.at(-1)]}function V8(t){let e=t.split("."),n=[];for(let o=e.length;o>0;o--)n.push(e.slice(0,o).join("."));return n}function GM(t){let e=X(()=>new dl(t.initialValue||{}),[t.schema,t.initialValue]),n=X(()=>({loading:!1,controller:e}),[e]),o=X(()=>({type:"object",id:"block",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),r=()=>{let s=e.getValue("block")||{},a=Ze(s);t.schema.name==="image"&&a?.file?.src&&(a.file.url=W8(a.file.src)),t.onSubmit(a)},i=yt();return g(ld,{...i,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:g(qr,{spacing:"md",children:[t.schema.fields.length>0?g(Fd,{value:n,children:g(Ne.ObjectField,{field:o,deepKey:"block"})}):g(sr,{size:"sm",color:"dimmed",children:"This block does not define any editable fields."}),g(ar,{position:"right",spacing:"sm",children:[g(Q,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),g(Q,{size:"xs",onClick:r,children:t.mode==="edit"?"Save block":"Insert block"})]})]})})}function W8(t){return G8(t)?`${t}=s0-e365`:t}function G8(t){return t.startsWith("https://lh3.googleusercontent.com/")}var lv={};Re(lv,{$isDecoratorBlockNode:()=>Y8,DecoratorBlockNode:()=>Ff});var Ff=class extends Va{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||"")}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){let n=this.getWritable();return n.__format=e,n}isInline(){return!1}};function Y8(t){return t instanceof Ff}var YM=lv,qM=YM.$isDecoratorBlockNode,XM=YM.DecoratorBlockNode;Se();function q8(t){let{nodeKey:e}=t,[n]=be(),[o,r,i]=gf(e),{blocks:s,onEditBlock:a}=PM(),l=s.get(t.blockName),c=l?.label||l?.name||t.blockName,d=X(()=>{if(l)return Xw(l,t.data)},[l,t.data]),u=X(()=>{if(l)return Jw(l,t.data)},[l,t.data]);return P(()=>Fe(n.registerCommand(Jo,p=>{let f=p.target;return!f||!f.closest(`[data-node-key="${e}"]`)?!1:(p.preventDefault(),p.stopPropagation(),o?r(!1):(i(),r(!0)),!0)},Ae)),[n,o,e,i,r]),g("div",{className:we("LexicalEditor__customBlock",o&&"LexicalEditor__customBlock--selected"),"data-node-key":e,children:[g("div",{className:"LexicalEditor__customBlock__header",children:[g("div",{className:"LexicalEditor__customBlock__header__title",children:c}),l&&a&&g("div",{className:"LexicalEditor__customBlock__actions",children:g(Q,{size:"xs",variant:"default",compact:!0,onClick:()=>a(t.blockName,{mode:"edit",nodeKey:t.nodeKey,initialValue:t.data}),children:"Edit block"})})]}),u&&aE(u)&&g("div",{className:"LexicalEditor__customBlock__previewImage",children:[g("img",{src:u,alt:""}),t.data.loading&&g("div",{className:"LexicalEditor__customBlock__previewImage__loading",children:g(Zt,{variant:"oval",color:"gray"})})]}),d&&g("div",{className:we("LexicalEditor__customBlock__preview",l?.name==="html"&&"LexicalEditor__customBlock__preview--html"),children:d})]})}var ul=class t extends XM{static getType(){return"block-component"}static clone(e){return new t(e.__blockName,e.__blockData,e.__key)}static importJSON(e){let{blockName:n,data:o}=e;return new t(n,o)}exportJSON(){return{...super.exportJSON(),type:"block-component",blockName:this.__blockName,data:Ze(this.__blockData),version:1}}constructor(e,n,o){super("",o),this.__blockName=e,this.__blockData=n?Ze(n):{}}createDOM(){let e=document.createElement("div");return e.className="LexicalEditor__customBlockWrapper",e}updateDOM(){return!1}decorate(){return g(q8,{blockName:this.__blockName,data:this.__blockData,nodeKey:this.__key})}getBlockName(){return this.__blockName}getBlockData(){return this.__blockData}setBlockData(e){let n=this.getWritable();n.__blockData=Ze(e)}};function Os(t,e){return new ul(t,e)}function Hr(t){return t instanceof ul}Se();function JM(t){let[e,n]=R(t.componentId);P(()=>{n(t.componentId)},[t.componentId]);let o=X(()=>new dl(t.initialValue||{},"component"),[t.schema,t.initialValue]),r=X(()=>({loading:!1,controller:o}),[o]),i=X(()=>({type:"object",id:"component",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),s=()=>{let l=o.getValue("component")||{},c=Ze(l);t.onSubmit({componentId:e.trim(),data:c})},a=yt();return g(ld,{...a,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:g(qr,{spacing:"md",children:[g(lr,{label:"Component ID",value:e,onChange:l=>n(l.currentTarget.value),placeholder:"component-id",required:!0}),t.schema.fields.length>0?g(Fd,{value:r,children:g(Ne.ObjectField,{field:i,deepKey:"component"})}):g(sr,{size:"sm",color:"dimmed",children:"This component does not define any editable fields."}),g(ar,{position:"right",spacing:"sm",children:[g(Q,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),g(Q,{size:"xs",onClick:s,disabled:!e.trim(),children:t.mode==="edit"?"Save component":"Insert component"})]})]})})}zs();function X8(t){let{componentName:e,componentId:n,nodeKey:o}=t,{components:r,onEditComponent:i}=$M(),s=r.get(e),a=s?.label||s?.name||e,l=Ee(c=>{c.preventDefault(),c.stopPropagation(),i&&i(e,{componentId:n,initialValue:t.data,mode:"edit",nodeKey:o})},[e,n,o,i,t.data]);return g("span",{className:"LexicalEditor__inlineComponent","data-node-key":o,contentEditable:!1,children:g("button",{type:"button",className:we("LexicalEditor__inlineComponent__button",!i&&"LexicalEditor__inlineComponent__button--disabled"),onClick:i?l:void 0,title:a?`${a} (${n})`:n,contentEditable:!1,children:[g("span",{className:"LexicalEditor__inlineComponent__label",children:a}),g("span",{className:"LexicalEditor__inlineComponent__id",children:n})]})})}var pl=class t extends Va{static getType(){return"inline-component"}static clone(e){return new t(e.__componentName,e.__componentId,e.__componentData,e.__key)}static importJSON(e){let{componentName:n,componentId:o,data:r}=e;return new t(n,o,r)}exportJSON(){return{...super.exportJSON(),type:"inline-component",componentName:this.__componentName,componentId:this.__componentId,data:Ze(this.__componentData),version:1}}constructor(e,n,o,r){super(r),this.__componentName=e,this.__componentId=n,this.__componentData=o?Ze(o):{}}createDOM(){let e=document.createElement("span");return e.className="LexicalEditor__inlineComponentWrapper",e.contentEditable="false",e}updateDOM(){return!1}isInline(){return!0}isIsolated(){return!0}decorate(){return g(X8,{componentName:this.__componentName,componentId:this.__componentId,data:this.__componentData,nodeKey:this.__key})}getComponentName(){return this.__componentName}setComponentName(e){let n=this.getWritable();n.__componentName=e}getComponentId(){return this.__componentId}setComponentId(e){let n=this.getWritable();n.__componentId=e}getComponentData(){return this.__componentData}setComponentData(e){let n=this.getWritable();n.__componentData=Ze(e)}};function Bf(t,e,n){return new pl(t,e,n)}function fl(t){return t instanceof pl}var Mi=class t extends Pt{static getType(){return"special-character"}static clone(e){return new t(e.__text,e.__key)}static importJSON(e){return cv(e.text)}constructor(e,n){super(e,n)}exportJSON(){return{...super.exportJSON(),type:"special-character"}}createDOM(e){let n=super.createDOM(e);return Ve(n,"SpecialCharacterNode"),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o);return Ve(n,"SpecialCharacterNode"),r}isTextEntity(){return!0}canInsertTextAfter(){return!1}};function cv(t){return new Mi(t)}function ZM(t){return t instanceof Mi}zs();Se();function Kr(t){let e=t.anchor,n=t.focus,o=t.anchor.getNode(),r=t.focus.getNode();return o===r?o:t.isBackward()?Ry(n)?o:r:Ry(e)?o:r}function QM(t,e){let n=t.getRangeAt(0),o;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!==null;)r=r.firstElementChild;o=r.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}var J8=10,Z8=5;function Q8(t){let{editor:e,isLink:n,setIsLink:o,anchorElem:r,isLinkEditMode:i,setIsLinkEditMode:s,onDismiss:a}=t,l=Y(null),c=Y(null),[d,u]=R(""),[p,f]=R(""),[h,m]=R(null),[_,b]=R(null),[y,x]=R(null),v=Y(""),E=Ee(()=>{let S=$();if(F(S)){let I=Kr(S),L=le(I,Xe),K="",W=null;L?(K=L.getURL(),W=L.getTarget()||null):Xe(I)&&(K=I.getURL(),W=I.getTarget()||null),u(K),m(W);let q=c.current===document.activeElement,B=K!==v.current;(!q||B)&&(f(Ur(K)),b(W)),v.current=K}else if(lt(S)){let I=S.getNodes();if(I.length>0){let L=I[0],K=L.getParent(),W="",q=null;Xe(K)?(W=K.getURL(),q=K.getTarget()||null):Xe(L)&&(W=L.getURL(),q=L.getTarget()||null),u(W),m(q);let B=c.current===document.activeElement,se=W!==v.current;(!B||se)&&(f(Ur(W)),b(q)),v.current=W}}let N=l.current,D=Xn(e._window),O=document.activeElement;if(N===null)return;let M=e.getRootElement();if(S!==null&&M!==null&&e.isEditable()){let I;if(lt(S)){let L=S.getNodes();if(L.length>0){let K=e.getElementByKey(L[0].getKey());K&&(I=K.getBoundingClientRect())}}else D!==null&&M.contains(D.anchorNode)&&(I=D.focusNode?.parentElement?.getBoundingClientRect());I&&(I.y+=40,eA(I,N,r)),x(S)}else(!O||O.className!=="link-input")&&(M!==null&&eA(null,N,r),x(null),s(!1),u(""),v.current="");return!0},[r,e,s,i,d]);P(()=>{let S=r.parentElement,N=()=>{e.getEditorState().read(()=>{E()})};return window.addEventListener("resize",N),S&&S.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),S&&S.removeEventListener("scroll",N)}},[r.parentElement,e,E]),P(()=>Fe(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{E()})}),e.registerCommand(cn,()=>(E(),!0),Ae),e.registerCommand(Ci,()=>n?(o(!1),a?.(),!0):!1,xi)),[e,E,o,n]),P(()=>{e.getEditorState().read(()=>{E()})},[e,E]),P(()=>{n&&e.getEditorState().read(()=>{E()})},[n,e,E]),P(()=>{i&&c.current&&c.current.focus()},[i,n]),P(()=>{if(!n)return;let S=()=>{o(!1),s(!1),a?.()},N=O=>{let M=O.target;M&&(l.current&&l.current.contains(M)||r.contains(M)||r.parentElement&&r.parentElement.contains(M)||S())},D=O=>{O.key==="Escape"&&l.current&&l.current.contains(document.activeElement)&&(O.preventDefault(),S())};return window.addEventListener("mousedown",N),window.addEventListener("keydown",D),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",D)}},[n,r,o,s]);let C=S=>{S.key==="Enter"?(S.preventDefault(),k()):S.key==="Escape"&&(S.preventDefault(),o(!1),s(!1),a?.())},k=S=>{if(S&&S.preventDefault(),y!==null){if(d!==null){let N=_==="_blank"?"_blank":null;e.update(()=>{let D=$();if(F(D)){let O=Kr(D),M=le(O,Xe);M?(M.setURL(Ur(p)),M.setTarget(N)):Xe(O)?(O.setURL(Ur(p)),O.setTarget(N)):e.dispatchCommand(Bn,{url:Ur(p),target:N})}else if(lt(D)){let O=D.getNodes();if(O.length>0){let M=O[0],I=M.getParent();Xe(I)?(I.setURL(Ur(p)),I.setTarget(N)):Xe(M)&&(M.setURL(Ur(p)),M.setTarget(N))}}})}s(!1)}},T=Ur(p)!==Ur(d)||_!==h,w=()=>{f(d),b(h)};return g("div",{ref:l,className:we("LexicalEditor__linkEditor",!n&&"LexicalEditor__linkEditor--hidden"),children:!n||!y?null:g("div",{className:"LexicalEditor__link__editForm",children:[g(Ao,{ref:c,className:"LexicalEditor__link__input",value:p,onChange:S=>{let N=S.target;f(N.value)},onKeyDown:S=>{C(S)},autosize:!0,minRows:1,radius:"xs",placeholder:"https://"}),g("div",{className:"LexicalEditor__link__row",children:[g(Mo,{className:"LexicalEditor__link__target",label:"Open in new tab",checked:_==="_blank",onChange:S=>b(S.currentTarget.checked?"_blank":null),size:"xs"}),g("div",{className:"LexicalEditor__link__controls",children:[g(dv,{tooltip:"Remove",onClick:()=>{e.dispatchCommand(Bn,null)},children:g(Po,{size:12})}),g(dv,{tooltip:"Undo",onClick:w,disabled:!T,children:g(Xr,{size:12})}),g(dv,{tooltip:"Save",onClick:()=>k(),disabled:!T,color:"green",children:g(zi,{size:12})})]})]})]})})}function dv(t){return g(De,{label:t.tooltip,position:"top",withArrow:!0,children:g(Be,{radius:"xl",variant:t.color?"filled":"default",color:t.color||"dark",size:"sm",title:t.tooltip,onClick:t.onClick,disabled:t.disabled,children:t.children})})}function eV(t,e,n,o){let[r,i]=R(t),[s,a]=R(!1),l=Y(0),c=300,d=Ee(()=>{l.current=Date.now()},[]);return P(()=>{function u(){if(Date.now()-l.current<c)return;let p=$();if(F(p)){let f=Kr(p),h=le(f,Xe),m=le(f,Uc);if(!(h||m)){a(!1);return}let _=p.getNodes().filter(b=>!qe(b)).find(b=>{let y=le(b,Xe),x=le(b,Uc);return h&&!h.is(y)||y&&!y.is(h)||m&&!m.is(x)||x&&(!x.is(m)||x.getIsUnlinked())});a(!_)}else if(lt(p)){let f=p.getNodes();if(f.length===0){a(!1);return}let h=f[0],m=h.getParent();Xe(m)||Xe(h)?a(!0):a(!1)}}return Fe(t.registerUpdateListener(({editorState:p})=>{p.read(()=>{u()})}),t.registerCommand(cn,(p,f)=>(u(),i(f),!1),Ct),t.registerCommand(Jo,p=>{let f=$();if(F(f)){let h=Kr(f),m=le(h,Xe);if(m)return p.metaKey||p.ctrlKey?(window.open(m.getURL(),"_blank"),!0):(p.preventDefault(),p.stopPropagation(),!0)}return!1},Ae))},[t]),Yr(g(Q8,{editor:r,isLink:s,anchorElem:e,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:o,onDismiss:d}),e)}function tA(t){let{anchorElem:e=document.body,isLinkEditMode:n,setIsLinkEditMode:o}=t,[r]=be();return eV(r,e,n,o)}function eA(t,e,n,o=J8,r=Z8){let i=n.parentElement;if(t===null||!i){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect(),c=t.top-o,d=t.left-r;c<l.top&&(c+=s.height+t.height+o*2),d+s.width>l.right&&(d=l.right-s.width-r),c-=a.top,d-=a.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}function Ur(t){return t&&t.trim()}var pse=Zf(uv(),1);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:Prism.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(d){return d=d.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+d+")")}var o=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return o}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+i+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+i+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(o),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(o),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(d){["url","bold","italic","strike","code-snippet"].forEach(function(u){d!==u&&(t.languages.markdown[d].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(d){if(d.language!=="markdown"&&d.language!=="md")return;function u(p){if(!(!p||typeof p=="string"))for(var f=0,h=p.length;f<h;f++){var m=p[f];if(m.type!=="code"){u(m.content);continue}var _=m.content[1],b=m.content[3];if(_&&b&&_.type==="code-language"&&b.type==="code-block"&&typeof _.content=="string"){var y=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");y=(/[a-z][\w-]*/i.exec(y)||[""])[0].toLowerCase();var x="language-"+y;b.alias?typeof b.alias=="string"?b.alias=[b.alias,x]:b.alias.push(x):b.alias=[x]}}}u(d.tokens)}),t.hooks.add("wrap",function(d){if(d.type==="code-block"){for(var u="",p=0,f=d.classes.length;p<f;p++){var h=d.classes[p],m=/language-(.+)/.exec(h);if(m){u=m[1];break}}var _=t.languages[u];if(_)d.content=t.highlight(c(d.content),_,u);else if(u&&u!=="none"&&t.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);d.attributes.id=b,t.plugins.autoloader.loadLanguages(u,function(){var y=document.getElementById(b);y&&(y.innerHTML=t.highlight(y.textContent,t.languages[u],u))})}}});var s=RegExp(t.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function c(d){var u=d.replace(s,"");return u=u.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,f){if(f=f.toLowerCase(),f[0]==="#"){var h;return f[1]==="x"?h=parseInt(f.slice(2),16):h=Number(f.slice(1)),l(h)}else{var m=a[f];return m||p}}),u}t.languages.md=t.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var e=t.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism);Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=Prism.languages.swift});(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,o={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[o,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:o.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:o.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":o,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:o.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:o.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);(function(t){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(Prism);(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
120
+ ?|
121
+ |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var Nse=globalThis.Prism||window.Prism;var xv={};Re(xv,{$createCodeHighlightNode:()=>Kf,$createCodeNode:()=>hl,$getEndOfCodeInLine:()=>yv,$getFirstCodeNodeOfLine:()=>Li,$getLastCodeNodeOfLine:()=>Ms,$getStartOfCodeInLine:()=>bv,$isCodeHighlightNode:()=>Nt,$isCodeNode:()=>Do,CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>pA,CODE_LANGUAGE_MAP:()=>fA,CodeHighlightNode:()=>As,CodeNode:()=>Ai,DEFAULT_CODE_LANGUAGE:()=>_v,PrismTokenizer:()=>mA,getCodeLanguages:()=>sV,getDefaultCodeLanguage:()=>iV,getEndOfCodeInLine:()=>uV,getFirstCodeNodeOfLine:()=>cV,getLanguageFriendlyName:()=>rV,getLastCodeNodeOfLine:()=>dV,getStartOfCodeInLine:()=>pV,normalizeCodeLang:()=>hA,registerCodeHighlighting:()=>lV});var Mse=Zf(uv(),1);function Hf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach((function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
122
+ ?|
123
+ |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var fo=globalThis.Prism||window.Prism;function gv(t){return typeof t=="string"?t:Array.isArray(t)?t.map(gv).join(""):gv(t.content)}var nA=t=>{let e=/^diff-([\w-]+)/i;try{if(!t)return!1;let n=e.exec(t);return n?fo.languages.hasOwnProperty("diff")&&fo.languages.hasOwnProperty(n[1]):fo.languages.hasOwnProperty(t)}catch{return!1}};function uA(t,e){for(let n of t.childNodes){if(qt(n)&&n.tagName===e)return!0;uA(n,e)}return!1}var nd="data-language",zf="data-highlight-language",Ai=class t extends Rt{static getType(){return"code"}static clone(e){return new t(e.__language,e.__key)}constructor(e,n){super(n),this.__language=e||void 0,this.__isSyntaxHighlightSupported=nA(e)}createDOM(e){let n=document.createElement("code");Ve(n,e.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(nd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(zf,o)),n}updateDOM(e,n,o){let r=this.__language,i=e.__language;return r?r!==i&&(n.setAttribute(nd,r),this.__isSyntaxHighlightSupported&&n.setAttribute(zf,r)):i&&(n.removeAttribute(nd),e.__isSyntaxHighlightSupported&&n.removeAttribute(zf)),!1}exportDOM(e){let n=document.createElement("pre");Ve(n,e._config.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(nd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(zf,o)),{element:n}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||uA(e,"BR"))?{conversion:oA,priority:1}:null,div:()=>({conversion:nV,priority:1}),pre:()=>({conversion:oA,priority:0}),table:e=>pv(e)?{conversion:oV,priority:3}:null,td:e=>{let n=e,o=n.closest("table");return n.classList.contains("js-file-line")||o&&pv(o)?{conversion:rA,priority:3}:null},tr:e=>{let n=e.closest("table");return n&&pv(n)?{conversion:rA,priority:3}:null}}}static importJSON(e){return hl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,n=!0){let o=this.getChildren(),r=o.length;if(r>=2&&o[r-1].getTextContent()===`
124
+ `&&o[r-2].getTextContent()===`
125
+ `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){o[r-1].remove(),o[r-2].remove();let l=fe();return this.insertAfter(l,n),l}let{anchor:i,focus:s}=e,a=(i.isBefore(s)?i:s).getNode();if(Z(a)){let l=Li(a),c=[];for(;;)if(An(l))c.push(Eo()),l=l.getNextSibling();else{if(!Nt(l))break;{let _=0,b=l.getTextContent(),y=l.getTextContentSize();for(;_<y&&b[_]===" ";)_++;if(_!==0&&c.push(Kf(" ".repeat(_))),_!==y)break;l=l.getNextSibling()}}let d=a.splitText(i.offset)[0],u=i.offset===0?0:1,p=d.getIndexWithinParent()+u,f=a.getParentOrThrow(),h=[Co(),...c];f.splice(p,0,h);let m=c[c.length-1];m?m.select():i.offset===0?d.selectPrevious():d.getNextSibling().selectNext(0,0)}if(Do(a)){let{offset:l}=e.anchor;a.splice(l,0,[Co()]),a.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){let e=fe();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}setLanguage(e){let n=this.getWritable();return n.__language=e||void 0,n.__isSyntaxHighlightSupported=nA(e),n}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function hl(t){return Tt(new Ai(t))}function Do(t){return t instanceof Ai}function oA(t){return{node:hl(t.getAttribute(nd))}}function nV(t){let e=t,n=iA(e);return n||(function(o){let r=o.parentElement;for(;r!==null;){if(iA(r))return!0;r=r.parentElement}return!1})(e)?{node:n?hl():null}:{node:null}}function oV(){return{node:hl()}}function rA(){return{node:null}}function iA(t){return t.style.fontFamily.match("monospace")!==null}function pv(t){return t.classList.contains("js-file-line-container")}var _v="javascript",pA={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},fA={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function hA(t){return fA[t]||t}function rV(t){let e=hA(t);return pA[e]||e}var iV=()=>_v,sV=()=>Object.keys(fo.languages).filter((t=>typeof fo.languages[t]!="function")).sort(),As=class t extends Pt{constructor(e="",n,o){super(e,o),this.__highlightType=n}static getType(){return"code-highlight"}static clone(e){return new t(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let n=this.getWritable();return n.__highlightType=e||void 0,n}canHaveFormat(){return!1}createDOM(e){let n=super.createDOM(e),o=fv(e.theme,this.__highlightType);return Ve(n,o),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o),i=fv(o.theme,e.__highlightType),s=fv(o.theme,this.__highlightType);return i!==s&&(i&&Fn(n,i),s&&Ve(n,s)),r}static importJSON(e){return Kf().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return hl()}};function fv(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function Kf(t="",e){return Tt(new As(t,e))}function Nt(t){return t instanceof As}function gA(t,e){let n=t;for(let o=xn(t,e);o&&(Nt(o.origin)||An(o.origin));o=uO(o))n=o.origin;return n}function Li(t){return gA(t,"previous")}function Ms(t){return gA(t,"next")}var mA={defaultLanguage:_v,tokenize(t,e){return fo.tokenize(t,fo.languages[e||""]||fo.languages[this.defaultLanguage])}};function bv(t,e){let n=null,o=null,r=t,i=e,s=t.getTextContent();for(;;){if(i===0){if(r=r.getPreviousSibling(),r===null)break;if(Nt(r)||An(r)||qe(r)||Hf(167),qe(r)){n={node:r,offset:1};break}i=Math.max(0,r.getTextContentSize()-1),s=r.getTextContent()}else i--;let l=s[i];Nt(r)&&l!==" "&&(o={node:r,offset:i})}if(o!==null)return o;let a=null;if(e<t.getTextContentSize())Nt(t)&&(a=t.getTextContent()[e]);else{let l=t.getNextSibling();Nt(l)&&(a=l.getTextContent()[0])}if(a!==null&&a!==" ")return n;{let l=(function(c,d){let u=c,p=d,f=c.getTextContent(),h=c.getTextContentSize();for(;;){if(!Nt(u)||p===h){if(u=u.getNextSibling(),u===null||qe(u))return null;Nt(u)&&(p=0,f=u.getTextContent(),h=u.getTextContentSize())}if(Nt(u)){if(f[p]!==" ")return{node:u,offset:p};p++}}})(t,e);return l!==null?l:n}}function yv(t){let e=Ms(t);return qe(e)&&Hf(168),e}function sA(t,e,n){let o=t.getParent();Do(o)?_A(o,e,n):Nt(t)&&t.replace(vt(t.__text))}function aV(t,e){let n=e.getElementByKey(t.getKey());if(n===null)return;let o=t.getChildren(),r=o.length;if(r===n.__cachedChildrenLength)return;n.__cachedChildrenLength=r;let i="1",s=1;for(let a=0;a<r;a++)qe(o[a])&&(i+=`
126
+ `+ ++s);n.setAttribute("data-gutter",i)}var hv=new Set;function _A(t,e,n){let o=t.getKey();hv.has(o)||(hv.add(o),t.getLanguage()===void 0&&t.setLanguage(n.defaultLanguage),e.update((()=>{(function(r,i){let s=St(r);if(!Do(s)||!s.isAttached())return;let a=$();if(!F(a))return void i();let l=a.anchor,c=l.offset,d=l.type==="element"&&qe(s.getChildAtIndex(l.offset-1)),u=0;if(!d){let p=l.getNode();u=c+p.getPreviousSiblings().reduce(((f,h)=>f+h.getTextContentSize()),0)}if(i()){if(d)return void l.getNode().select(c,c);s.getChildren().some((p=>{let f=Z(p);if(f||qe(p)){let h=p.getTextContentSize();if(f&&h>=u)return p.select(u,u),!0;u-=h}return!1}))}})(o,(()=>{let r=St(o);if(!Do(r)||!r.isAttached())return!1;let i=r.getLanguage()||n.defaultLanguage,s=/^diff-([\w-]+)/i.exec(i),a=r.getTextContent(),l=n.tokenize(a,s?"diff":i);s&&(l=(function(h,m){let _=m,b=fo.languages[_],y={tokens:h},x=fo.languages.diff.PREFIXES;for(let v of y.tokens){if(typeof v=="string"||!(v.type in x)||!Array.isArray(v.content))continue;let E=v.type,C=0,k=()=>(C++,new fo.Token("prefix",x[E],E.replace(/^(\w+).*/,"$1"))),T=v.content.filter((M=>typeof M=="string"||M.type!=="prefix")),w=v.content.length-T.length,S=fo.tokenize(gv(T),b);S.unshift(k());let N=/\r\n|\n/g,D=M=>{let I=[];N.lastIndex=0;let L,K=0;for(;C<w&&(L=N.exec(M));){let W=L.index+L[0].length;I.push(M.slice(K,W)),K=W,I.push(k())}if(I.length!==0)return K<M.length&&I.push(M.slice(K)),I},O=M=>{for(let I=0;I<M.length&&C<w;I++){let L=M[I];if(typeof L=="string"){let K=D(L);K&&(M.splice(I,1,...K),I+=K.length-1)}else if(typeof L.content=="string"){let K=D(L.content);K&&(L.content=K)}else Array.isArray(L.content)?O(L.content):O([L.content])}};O(S),C<w&&S.push(k()),v.content=S}return y.tokens})(l,s[1]));let c=mv(l),d=(function(h,m){let _=0;for(;_<h.length&&aA(h[_],m[_]);)_++;let b=h.length,y=m.length,x=Math.min(b,y)-_,v=0;for(;v<x;)if(v++,!aA(h[b-v],m[y-v])){v--;break}let E=_,C=b-v,k=m.slice(_,y-v);return{from:E,nodesForReplacement:k,to:C}})(r.getChildren(),c),{from:u,to:p,nodesForReplacement:f}=d;return!(u===p&&!f.length)&&(t.splice(u,p-u,f),!0)}))}),{onUpdate:()=>{hv.delete(o)},skipTransforms:!0}))}function mv(t,e){let n=[];for(let o of t)if(typeof o=="string"){let r=o.split(/(\n|\t)/),i=r.length;for(let s=0;s<i;s++){let a=r[s];a===`
127
+ `||a===`\r
128
+ `?n.push(Co()):a===" "?n.push(Eo()):a.length>0&&n.push(Kf(a,e))}}else{let{content:r,alias:i}=o;typeof r=="string"?n.push(...mv([r],o.type==="prefix"&&typeof i=="string"?i:o.type)):Array.isArray(r)&&n.push(...mv(r,o.type==="unchanged"?void 0:o.type))}return n}function aA(t,e){return Nt(t)&&Nt(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||An(t)&&An(e)||qe(t)&&qe(e)}function Is(t){if(!F(t))return!1;let e=t.anchor.getNode(),n=Do(e)?e:e.getParent(),o=t.focus.getNode(),r=Do(o)?o:o.getParent();return Do(n)&&n.is(r)}function bA(t){let e=t.getNodes(),n=[];if(e.length===1&&Do(e[0]))return n;let o=[];for(let r=0;r<e.length;r++){let i=e[r];Nt(i)||An(i)||qe(i)||Hf(169),qe(i)?o.length>0&&(n.push(o),o=[]):o.push(i)}if(o.length>0){let r=t.isBackward()?t.anchor:t.focus,i=Go(o[0].getKey(),0,"text");r.is(i)||n.push(o)}return n}function lA(t){let e=$();if(!F(e)||!Is(e))return!1;let n=bA(e),o=n.length;if(o===0&&e.isCollapsed())return t===Ln&&e.insertNodes([Eo()]),!0;if(o===0&&t===Ln&&e.getTextContent()===`
129
+ `){let r=Eo(),i=Co(),s=e.isBackward()?"previous":"next";return e.insertNodes([r,i]),zp(G1(Rp(J1(r,"next",0),Xo(xn(i,"next"))),s)),!0}for(let r=0;r<o;r++){let i=n[r];if(i.length>0){let s=i[0];if(r===0&&(s=Li(s)),t===Ln){let a=Eo();if(s.insertBefore(a),r===0){let l=e.isBackward()?"focus":"anchor",c=Go(s.getKey(),0,"text");e[l].is(c)&&e[l].set(a.getKey(),0,"text")}}else An(s)&&s.remove()}}return!0}function cA(t,e){let n=$();if(!F(n))return!1;let{anchor:o,focus:r}=n,i=o.offset,s=r.offset,a=o.getNode(),l=r.getNode(),c=t===To;if(!Is(n)||!Nt(a)&&!An(a)||!Nt(l)&&!An(l))return!1;if(!e.altKey){if(n.isCollapsed()){let b=a.getParentOrThrow();if(c&&i===0&&a.getPreviousSibling()===null){if(b.getPreviousSibling()===null)return b.selectPrevious(),e.preventDefault(),!0}else if(!c&&i===a.getTextContentSize()&&a.getNextSibling()===null&&b.getNextSibling()===null)return b.selectNext(),e.preventDefault(),!0}return!1}let d,u;if(a.isBefore(l)?(d=Li(a),u=Ms(l)):(d=Li(l),u=Ms(a)),d==null||u==null)return!1;let p=d.getNodesBetween(u);for(let b=0;b<p.length;b++){let y=p[b];if(!Nt(y)&&!An(y)&&!qe(y))return!1}e.preventDefault(),e.stopPropagation();let f=c?d.getPreviousSibling():u.getNextSibling();if(!qe(f))return!0;let h=c?f.getPreviousSibling():f.getNextSibling();if(h==null)return!0;let m=Nt(h)||An(h)||qe(h)?c?Li(h):Ms(h):null,_=m??h;return f.remove(),p.forEach((b=>b.remove())),t===To?(p.forEach((b=>_.insertBefore(b))),_.insertBefore(f)):(_.insertAfter(f),_=f,p.forEach((b=>{_.insertAfter(b),_=b}))),n.setTextNodeRange(a,i,l,s),!0}function dA(t,e){let n=$();if(!F(n))return!1;let{anchor:o,focus:r}=n,i=o.getNode(),s=r.getNode(),a=t===Jp;if(!Is(n)||!Nt(i)&&!An(i)||!Nt(s)&&!An(s))return!1;if(a){let l=bv(s,r.offset);if(l!==null){let{node:c,offset:d}=l;qe(c)?c.selectNext(0,0):n.setTextNodeRange(c,d,c,d)}else s.getParentOrThrow().selectStart()}else yv(s).select();return e.preventDefault(),e.stopPropagation(),!0}function lV(t,e){if(!t.hasNodes([Ai,As]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");e==null&&(e=mA);let n=[];return t._headless!==!0&&n.push(t.registerMutationListener(Ai,(o=>{t.update((()=>{for(let[r,i]of o)if(i!=="destroyed"){let s=St(r);s!==null&&aV(s,t)}}))}),{skipInitialization:!1})),n.push(t.registerNodeTransform(Ai,(o=>_A(o,t,e))),t.registerNodeTransform(Pt,(o=>sA(o,t,e))),t.registerNodeTransform(As,(o=>sA(o,t,e))),t.registerCommand(Ei,(o=>{let r=(function(i){let s=$();if(!F(s)||!Is(s))return null;let a=i?uo:Ln,l=i?uo:ys,c=s.anchor,d=s.focus;if(c.is(d))return l;let u=bA(s);if(u.length!==1)return a;let p=u[0],f,h;p.length===0&&Hf(285),s.isBackward()?(f=d,h=c):(f=c,h=d);let m=Li(p[0]),_=Ms(p[0]),b=Go(m.getKey(),0,"text"),y=Go(_.getKey(),_.getTextContentSize(),"text");return f.isBefore(b)||y.isBefore(h)?a:b.isBefore(f)||h.isBefore(y)?l:a})(o.shiftKey);return r!==null&&(o.preventDefault(),t.dispatchCommand(r,void 0),!0)}),Ae),t.registerCommand(ys,(()=>!!Is($())&&(wo([Eo()]),!0)),Ae),t.registerCommand(Ln,(o=>lA(Ln)),Ae),t.registerCommand(uo,(o=>lA(uo)),Ae),t.registerCommand(To,(o=>{let r=$();if(!F(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Is(r)&&(r.isCollapsed()&&i.offset===0&&s.getPreviousSibling()===null&&Do(s.getParentOrThrow())?(o.preventDefault(),!0):cA(To,o))}),Ae),t.registerCommand(Rr,(o=>{let r=$();if(!F(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Is(r)&&(r.isCollapsed()&&i.offset===s.getTextContentSize()&&s.getNextSibling()===null&&Do(s.getParentOrThrow())?(o.preventDefault(),!0):cA(Rr,o))}),Ae),t.registerCommand(Jp,(o=>dA(Jp,o)),Ae),t.registerCommand(Ty,(o=>dA(Ty,o)),Ae)),Fe(...n)}var cV=Li,dV=Ms,uV=yv,pV=bv;var ct=xv,qse=ct.$createCodeHighlightNode,od=ct.$createCodeNode,Xse=ct.$getEndOfCodeInLine,Jse=ct.$getFirstCodeNodeOfLine,Zse=ct.$getLastCodeNodeOfLine,Qse=ct.$getStartOfCodeInLine,yA=ct.$isCodeHighlightNode,vv=ct.$isCodeNode,eae=ct.CODE_LANGUAGE_FRIENDLY_NAME_MAP,tae=ct.CODE_LANGUAGE_MAP,nae=ct.CodeHighlightNode,xA=ct.CodeNode,oae=ct.DEFAULT_CODE_LANGUAGE,rae=ct.PrismTokenizer,iae=ct.getCodeLanguages,sae=ct.getDefaultCodeLanguage,aae=ct.getEndOfCodeInLine,lae=ct.getFirstCodeNodeOfLine,cae=ct.getLanguageFriendlyName,dae=ct.getLastCodeNodeOfLine,uae=ct.getStartOfCodeInLine,pae=ct.normalizeCodeLang,fae=ct.registerCodeHighlighting;zs();Se();var Xt=Object.freeze({NORMAL:Et?"\u2318+Opt+0":"Ctrl+Alt+0",HEADING1:Et?"\u2318+Opt+1":"Ctrl+Alt+1",HEADING2:Et?"\u2318+Opt+2":"Ctrl+Alt+2",HEADING3:Et?"\u2318+Opt+3":"Ctrl+Alt+3",NUMBERED_LIST:Et?"\u2318+Shift+7":"Ctrl+Shift+7",BULLET_LIST:Et?"\u2318+Shift+8":"Ctrl+Shift+8",STRIKETHROUGH:Et?"\u2318+Shift+X":"Ctrl+Shift+X",SUBSCRIPT:Et?"\u2318+,":"Ctrl+,",SUPERSCRIPT:Et?"\u2318+.":"Ctrl+.",INDENT:Et?"\u2318+]":"Ctrl+]",OUTDENT:Et?"\u2318+[":"Ctrl+[",CLEAR_FORMATTING:Et?"\u2318+\\":"Ctrl+\\",REDO:Et?"\u2318+Shift+Z":"Ctrl+Y",UNDO:Et?"\u2318+Z":"Ctrl+Z",BOLD:Et?"\u2318+B":"Ctrl+B",ITALIC:Et?"\u2318+I":"Ctrl+I",UNDERLINE:Et?"\u2318+U":"Ctrl+U",INSERT_LINK:Et?"\u2318+K":"Ctrl+K"}),Oo={ctrlKey:!Et,metaKey:Et};function vA(t){let{code:e}=t;return(e==="Numpad0"||e==="Digit0")&&Pn(t,{...Oo,altKey:!0})}function CA(t){let{code:e}=t,n=e[e.length-1];return["1","2","3","4","5"].includes(n)&&Pn(t,{...Oo,altKey:!0})}function EA(t){let{code:e}=t;return(e==="Numpad7"||e==="Digit7")&&Pn(t,{...Oo,shiftKey:!0})}function wA(t){let{code:e}=t;return(e==="Numpad8"||e==="Digit8")&&Pn(t,{...Oo,shiftKey:!0})}function TA(t){let{code:e}=t;return e==="KeyX"&&Pn(t,{...Oo,shiftKey:!0})}function SA(t){let{code:e}=t;return e==="BracketRight"&&Pn(t,Oo)}function kA(t){let{code:e}=t;return e==="BracketLeft"&&Pn(t,Oo)}function NA(t){let{code:e}=t;return e==="Comma"&&Pn(t,Oo)}function DA(t){let{code:e}=t;return e==="Period"&&Pn(t,Oo)}function OA(t){let{code:e}=t;return e==="Backslash"&&Pn(t,Oo)}function IA(t){let{code:e}=t;return e==="KeyK"&&Pn(t,Oo)}var Ls=t=>{t.update(()=>{let e=$();ef(e,()=>fe())})},Ri=(t,e,n)=>{e!==n&&t.update(()=>{let o=$();ef(o,()=>Ts(n))})},Uf=(t,e)=>{e!=="bullet"?t.dispatchCommand(FO,void 0):Ls(t)},jf=(t,e)=>{console.log("formatNumberedList"),e!=="number"?t.dispatchCommand(PO,void 0):Ls(t)},gl=t=>{t.update(()=>{let e=$();if(F(e)){let n=e.anchor,o=e.focus,r=e.getNodes(),i=e.extract();if(n.key===o.key&&n.offset===o.offset)return;r.forEach((s,a)=>{if(Z(s)){let l=s;a===0&&n.offset!==0&&(l=l.splitText(n.offset)[1]||l),a===r.length-1&&(l=l.splitText(o.offset)[0]||l);let c=i[0];r.length===1&&Z(c)&&(l=c),l.__style!==""&&l.setStyle(""),l.__format!==0&&l.setFormat(0);let d=vs(l);d.__format!==0&&d.setFormat(""),d.__indent!==0&&d.setIndent(0)}else Fr(s)||Br(s)?s.replace(fe(),!0):qM(s)&&s.setFormat("")})}})},MA=(t,e)=>{e!=="quote"?t.update(()=>{let n=$();ef(n,()=>Ss())}):Ls(t)};zs();var fV=new Set(["http:","https:","mailto:","sms:","tel:"]);function AA(t){try{let e=new URL(t);if(!fV.has(e.protocol))return"about:blank"}catch{return t}return t}var kae=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function Qn(t){return t?"active dropdown-item-active":""}function rr(t){let{blockType:e}=t;return e==="paragraph"?g(mC,{size:16}):e==="h1"?g(MC,{size:16}):e==="h2"?g(AC,{size:16}):e==="h3"?g(LC,{size:16}):e==="h4"?g(RC,{size:16}):e==="h5"?g(PC,{size:16}):e==="number"?g(KC,{size:16}):e==="bullet"?g(UC,{size:16}):e==="quote"?g(JC,{size:16}):null}function hV(t){let{editor:e,blockType:n}=t;return g(ne,{control:g(Q,{className:we("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__blockFormatDropdown"),variant:"default",compact:!0,leftIcon:g(rr,{blockType:n}),rightIcon:g(Hn,{size:16}),children:Rf[n]}),children:[g(ne.Item,{icon:g(rr,{blockType:"paragraph"}),className:Qn(n==="paragraph"),onClick:()=>Ls(e),children:"Normal"}),g(ne.Item,{icon:g(rr,{blockType:"bullet"}),className:Qn(n==="bullet"),onClick:()=>Uf(e,n),children:"Bullet List"}),g(ne.Item,{icon:g(rr,{blockType:"number"}),className:Qn(n==="number"),onClick:()=>jf(e,n),children:"Numbered List"}),g(ne.Item,{icon:g(rr,{blockType:"h1"}),className:Qn(n==="h1"),onClick:()=>Ri(e,n,"h1"),children:"Heading 1"}),g(ne.Item,{icon:g(rr,{blockType:"h2"}),className:Qn(n==="h2"),onClick:()=>Ri(e,n,"h2"),children:"Heading 2"}),g(ne.Item,{icon:g(rr,{blockType:"h3"}),className:Qn(n==="h3"),onClick:()=>Ri(e,n,"h3"),children:"Heading 3"}),g(ne.Item,{icon:g(rr,{blockType:"h4"}),className:Qn(n==="h4"),onClick:()=>Ri(e,n,"h4"),children:"Heading 4"}),g(ne.Item,{icon:g(rr,{blockType:"h5"}),className:Qn(n==="h5"),onClick:()=>Ri(e,n,"h5"),children:"Heading 5"}),g(ne.Item,{icon:g(rr,{blockType:"quote"}),className:Qn(n==="quote"),onClick:()=>MA(e,n),children:"Quote"})]})}function rd(){return g("div",{className:"divider"})}function gV(t){let{editor:e,isStrikethrough:n,isSuperscript:o,isSubscript:r,isCode:i}=t;return g(ne,{styles:{body:{minWidth:"240px"}},control:g(De,{className:we("LexicalEditor__toolbar__actionIcon",(n||o||r||i)&&"LexicalEditor__toolbar__actionIcon--active"),label:"More formatting",position:"top",withArrow:!0,children:g(Be,{variant:"default",title:"More formatting",children:g(Hn,{size:16})})}),children:[g(ne.Item,{icon:g(Nd,{size:16}),className:Qn(n),onClick:()=>{e.dispatchCommand(ot,"strikethrough")},children:["Strikethrough (",Xt.STRIKETHROUGH,")"]}),g(ne.Item,{icon:g(Od,{size:16}),className:Qn(o),onClick:()=>{e.dispatchCommand(ot,"superscript")},children:["Superscript (",Xt.SUPERSCRIPT,")"]}),g(ne.Item,{icon:g(Dd,{size:16}),className:Qn(r),onClick:()=>{e.dispatchCommand(ot,"subscript")},children:["Subscript (",Xt.SUBSCRIPT,")"]}),g(ne.Item,{icon:g(xd,{size:16}),className:Qn(i),onClick:()=>{e.dispatchCommand(ot,"code")},children:"Code"})]})}function LA(t){let{editor:e,blockComponents:n,inlineComponents:o,activeEditor:r,setActiveEditor:i,setIsLinkEditMode:s,variant:a="document",onInsertBlockComponent:l,onInsertInlineComponent:c}=t,[d,u]=R(()=>e.isEditable()),{toolbarState:p,updateToolbarState:f}=Pf(),h=Ee(()=>{let v=$();if(F(v)){if(r!==e&&fO(r)){let O=r.getRootElement();f("isImageCaption",!!O?.parentElement?.classList.contains("image-caption-container"))}else f("isImageCaption",!1);let E=v.anchor.getNode(),C=E.getKey()==="root"?E:le(E,O=>{let M=O.getParent();return M!==null&&Lt(M)});C===null&&(C=E.getTopLevelElementOrThrow());let k=C.getKey(),T=r.getElementByKey(k);f("isRTL",VD(v));let w=Kr(v),S=w.getParent(),N=Xe(S)||Xe(w);if(f("isLink",N),f("rootType","root"),T!==null)if(vn(C)){let O=rf(E,tr),M=O?O.getListType():C.getListType();f("blockType",M)}else{let O=Fr(C)?C.getTag():C.getType();O in Rf&&f("blockType",O)}let D;Xe(S)&&(D=le(w,O=>G(O)&&!O.isInline())),f("elementFormat",G(D)?D.getFormatType():G(w)?w.getFormatType():S?.getFormatType()||"left")}F(v)&&(f("isBold",v.hasFormat("bold")),f("isItalic",v.hasFormat("italic")),f("isUnderline",v.hasFormat("underline")),f("isStrikethrough",v.hasFormat("strikethrough")),f("isSuperscript",v.hasFormat("superscript")),f("isSubscript",v.hasFormat("subscript")),f("isCode",v.hasFormat("code")))},[r,e,f]);P(()=>e.registerCommand(cn,(v,E)=>(i(E),h(),!1),Ct),[e,h,i]),P(()=>{r.getEditorState().read(()=>{h()})},[r,h]),P(()=>Fe(e.registerEditableListener(v=>{u(v)}),r.registerUpdateListener(({editorState:v})=>{v.read(()=>{h()})}),r.registerCommand(bs,v=>(f("canUndo",v),!1),Ct),r.registerCommand(_s,v=>(f("canRedo",v),!1),Ct)),[h,r,e,f]);let m=Ee(()=>{p.isLink?(s(!1),r.dispatchCommand(Bn,null)):(s(!0),r.dispatchCommand(Bn,AA("https://")))},[r,s,p.isLink]),_=X(()=>n?[...n].sort((v,E)=>{let C=v.label||v.name,k=E.label||E.name;return C.localeCompare(k)}):[],[n]),b=X(()=>o?[...o].sort((v,E)=>{let C=v.label||v.name,k=E.label||E.name;return C.localeCompare(k)}):[],[o]),y=v=>{switch(v){case"image":return g(GC,{size:16});case"html":return g(bC,{size:16});default:break}return g(tE,{size:16})},x=a==="comment";return g("div",{className:we("LexicalEditor__toolbar",x&&"LexicalEditor__toolbar--comment"),children:[!x&&p.blockType in Rf&&r===e&&g(Me,{children:[g(hV,{disabled:!d,blockType:p.blockType,rootType:p.rootType,editor:r}),g(rd,{})]}),g(Me,{children:[g("div",{className:"LexicalEditor__toolbar__group",children:[g(En,{tooltip:`Bold (${Xt.BOLD})`,active:p.isBold,onClick:()=>{r.dispatchCommand(ot,"bold")},children:g(bd,{size:16})}),g(En,{tooltip:`Italic (${Xt.ITALIC})`,active:p.isItalic,onClick:()=>{r.dispatchCommand(ot,"italic")},children:g(Cd,{size:16})}),g(En,{tooltip:`Underline (${Xt.UNDERLINE})`,active:p.isUnderline,onClick:()=>{r.dispatchCommand(ot,"underline")},children:g(Md,{size:16})}),g(gV,{editor:r,isStrikethrough:p.isStrikethrough,isSuperscript:p.isSuperscript,isSubscript:p.isSubscript,isCode:p.isCode})]}),g(rd,{}),g("div",{className:"LexicalEditor__toolbar__group",children:g(En,{tooltip:`Insert link (${Xt.INSERT_LINK})`,active:p.isLink,onClick:m,children:g(Ed,{size:16})})}),g(rd,{}),g(En,{tooltip:`Clear formatting (${Xt.CLEAR_FORMATTING})`,onClick:()=>{gl(r)},children:g(yd,{size:16})}),g(rd,{}),!x&&g(Me,{children:[g(ne,{control:g(Q,{className:we("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__insertDropdown"),variant:"default",compact:!0,leftIcon:g(XC,{size:16}),rightIcon:g(Hn,{size:16}),children:"Components"}),children:[g(ne.Label,{children:"Insert"}),g(ne.Item,{icon:g(Id,{size:16}),onClick:()=>{r.dispatchCommand(_M,{columns:"3",rows:"3"})},children:"Table"}),g(ne.Item,{icon:g(eE,{size:16}),onClick:()=>{r.dispatchCommand(bf,void 0)},children:"Horizontal Rule"}),b.length>0&&g(Me,{children:[g(ne.Label,{children:"Inline Components"}),b.map(v=>g(ne.Item,{icon:g(yC,{size:16}),onClick:()=>c?.(v.name),children:v.label||v.name},v.name))]}),_.length>0&&g(Me,{children:[g(ne.Label,{children:"Block Components"}),_.map(v=>g(ne.Item,{icon:y(v.name),onClick:()=>l?.(v.name),children:v.label||v.name},v.name))]})]}),g(rd,{})]})]})]})}function En(t){return g(De,{className:we("LexicalEditor__toolbar__actionIcon",t.active&&"LexicalEditor__toolbar__actionIcon--active"),label:t.tooltip,position:"top",withArrow:!0,children:g(Be,{variant:t.variant||"default",onClick:t.onClick,title:t.tooltip,children:t.children})})}var mV=12,_V=5;function bV(t){let{editor:e,anchorElem:n,isLink:o,isBold:r,isCode:i,isItalic:s,isUnderline:a,isStrikethrough:l,isSubscript:c,isSuperscript:d,setIsLinkEditMode:u}=t,p=Y(null),f=Ee(()=>{o?(u(!1),e.dispatchCommand(Bn,null)):(u(!0),e.dispatchCommand(Bn,""))},[e,o,u]);function h(b){if(p?.current&&(b.buttons===1||b.buttons===3)&&p.current.style.pointerEvents!=="none"){let y=b.clientX,x=b.clientY,v=document.elementFromPoint(y,x);p.current.contains(v)||(p.current.style.pointerEvents="none")}}function m(){p?.current&&p.current.style.pointerEvents!=="auto"&&(p.current.style.pointerEvents="auto")}P(()=>{if(p?.current)return document.addEventListener("mousemove",h),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m)}},[p]);let _=Ee(()=>{let b=$(),y=p.current,x=Xn(e._window);if(y===null)return;let v=e.getRootElement();if(b!==null&&x!==null&&!x.isCollapsed&&v!==null&&v.contains(x.anchorNode)){let E=QM(x,v);xV(E,y,n,o)}},[e,n,o]);return P(()=>{let b=n.parentElement,y=()=>{e.getEditorState().read(()=>{_()})};return window.addEventListener("resize",y),b&&b.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),b&&b.removeEventListener("scroll",y)}},[e,_,n]),P(()=>(e.getEditorState().read(()=>{_()}),Fe(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{_()})}),e.registerCommand(cn,()=>(_(),!1),Ae))),[e,_]),g("div",{ref:p,className:"LexicalEditor__floatingToolbar",children:e.isEditable()&&g(Me,{children:[g(En,{variant:"hover",tooltip:`Bold (${Xt.BOLD})`,active:r,onClick:()=>{e.dispatchCommand(ot,"bold")},children:g(bd,{size:16})}),g(En,{variant:"hover",tooltip:`Italic (${Xt.ITALIC})`,active:s,onClick:()=>{e.dispatchCommand(ot,"italic")},children:g(Cd,{size:16})}),g(En,{variant:"hover",tooltip:`Underline (${Xt.UNDERLINE})`,active:a,onClick:()=>{e.dispatchCommand(ot,"underline")},children:g(Md,{size:16})}),g(En,{variant:"hover",tooltip:`Strikethrough (${Xt.STRIKETHROUGH})`,active:l,onClick:()=>{e.dispatchCommand(ot,"strikethrough")},children:g(Nd,{size:16})}),g(En,{variant:"hover",tooltip:`Superscript (${Xt.SUPERSCRIPT})`,active:d,onClick:()=>{e.dispatchCommand(ot,"superscript")},children:g(Od,{size:16})}),g(En,{variant:"hover",tooltip:`Subscript (${Xt.SUBSCRIPT})`,active:c,onClick:()=>{e.dispatchCommand(ot,"subscript")},children:g(Dd,{size:16})}),g(En,{variant:"hover",tooltip:"Code",active:i,onClick:()=>{e.dispatchCommand(ot,"code")},children:g(xd,{size:16})}),g(En,{variant:"hover",tooltip:`Insert link (${Xt.INSERT_LINK})`,active:o,onClick:f,children:g(Ed,{size:16})}),g(En,{variant:"hover",tooltip:`Clear formatting (${Xt.CLEAR_FORMATTING})`,onClick:()=>{gl(e)},children:g(yd,{size:16})})]})})}function yV(t,e,n){let[o,r]=R(!1),[i,s]=R(!1),[a,l]=R(!1),[c,d]=R(!1),[u,p]=R(!1),[f,h]=R(!1),[m,_]=R(!1),[b,y]=R(!1),[x,v]=R(!1),E=Ee(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let C=$(),k=Xn(t._window),T=t.getRootElement();if(k!==null&&(!F(C)||T===null||!T.contains(k.anchorNode))){r(!1);return}if(!F(C))return;let w=Kr(C);l(C.hasFormat("bold")),d(C.hasFormat("code")),p(C.hasFormat("italic")),y(C.hasFormat("underline")),h(C.hasFormat("strikethrough")),_(C.hasFormat("subscript")),v(C.hasFormat("superscript"));let S=w.getParent();Xe(S)||Xe(w)?s(!0):s(!1),!yA(C.anchor.getNode())&&C.getTextContent()!==""?r(Z(w)||Yt(w)):r(!1);let N=C.getTextContent().replace(/\n/g,"");if(!C.isCollapsed()&&N===""){r(!1);return}})},[t]);return P(()=>(document.addEventListener("selectionchange",E),()=>{document.removeEventListener("selectionchange",E)}),[E]),P(()=>Fe(t.registerUpdateListener(()=>{E()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,E]),o?Yr(g(bV,{editor:t,anchorElem:e,isLink:i,isBold:a,isCode:c,isItalic:u,isStrikethrough:f,isSubscript:m,isSuperscript:x,isUnderline:b,setIsLinkEditMode:n}),e):null}function RA(t){let{anchorElem:e=document.body,setIsLinkEditMode:n}=t,[o]=be();return yV(o,e,n)}function xV(t,e,n,o=!1,r=mV,i=_V){let s=n.parentElement;if(t===null||!s){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let a=e.getBoundingClientRect(),l=n.getBoundingClientRect(),c=s.getBoundingClientRect(),d=t.top-a.height-r,u=t.left-i,p=window.getSelection();if(p&&p.rangeCount>0){let h=p.getRangeAt(0).startContainer;if(h.nodeType===Node.ELEMENT_NODE||h.parentElement){let m=h.nodeType===Node.ELEMENT_NODE?h:h.parentElement,_=window.getComputedStyle(m).textAlign;(_==="right"||_==="end")&&(u=t.right-a.width+i)}}d<c.top&&(d+=a.height+t.height+r*(o?9:2)),u+a.width>c.right&&(u=c.right-a.width-i),u<c.left&&(u=c.left+i),d-=l.top,u-=l.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${d}px)`}Se();function PA(){let[t]=be();P(()=>t.registerCommand(wi,n=>{let{clipboardData:o}=n;if(!o)return!1;let i=Array.from(o.files).find(s=>s.type.startsWith("image/"));return i?(n.preventDefault(),e(i),!0):!1},Ae),[t]);let e=async n=>{let o=URL.createObjectURL(n),r=null;t.update(()=>{let i=Os("image",{file:{src:o,width:0,height:0},loading:!0}),s=$();if(F(s)){wo([i]);let a=fe();i.insertAfter(a),a.select()}r=i.getKey()});try{let i=await qs(n);t.update(()=>{if(r){let s=St(r);Hr(s)&&s.setBlockData({file:i,loading:!1})}})}catch(i){console.error("Failed to upload image",i),ke({type:"error",message:"Failed to upload image"})}};return null}var kv={};Re(kv,{$convertFromMarkdownString:()=>AV,$convertToMarkdownString:()=>LV,BOLD_ITALIC_STAR:()=>tL,BOLD_ITALIC_UNDERSCORE:()=>nL,BOLD_STAR:()=>oL,BOLD_UNDERSCORE:()=>rL,CHECK_LIST:()=>MV,CODE:()=>XA,ELEMENT_TRANSFORMERS:()=>cL,HEADING:()=>YA,HIGHLIGHT:()=>eL,INLINE_CODE:()=>QA,ITALIC_STAR:()=>sL,ITALIC_UNDERSCORE:()=>aL,LINK:()=>lL,MULTILINE_ELEMENT_TRANSFORMERS:()=>dL,ORDERED_LIST:()=>ZA,QUOTE:()=>qA,STRIKETHROUGH:()=>iL,TEXT_FORMAT_TRANSFORMERS:()=>uL,TEXT_MATCH_TRANSFORMERS:()=>pL,TRANSFORMERS:()=>qf,UNORDERED_LIST:()=>JA,registerMarkdownShortcuts:()=>NV});function Cv(t,e){let n={};for(let o of t){let r=e(o);r&&(n[r]?n[r].push(o):n[r]=[o])}return n}function Tv(t){let e=Cv(t,(n=>n.type));return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}var Wf=/[!-/:-@[-`{-~\s]/,vV=/^\s{0,3}$/;function Ev(t){if(!Yt(t))return!1;let e=t.getFirstChild();return e==null||t.getChildrenSize()===1&&Z(e)&&vV.test(e.getTextContent())}function CV(t,e,n,o){for(let r of e){if(!r.export)continue;let i=r.export(t,(s=>Gf(s,n,o)));if(i!=null)return i}return G(t)?Gf(t,n,o):Mn(t)?t.getTextContent():null}function Gf(t,e,n,o,r){let i=[],s=t.getChildren();o||(o=[]),r||(r=[]);e:for(let a of s){for(let l of n){if(!l.export)continue;let c=l.export(a,(d=>Gf(d,e,n,o,[...r,...o])),((d,u)=>FA(d,u,e,o,r)));if(c!=null){i.push(c);continue e}}qe(a)?i.push(`
130
+ `):Z(a)?i.push(FA(a,a.getTextContent(),e,o,r)):G(a)?i.push(Gf(a,e,n,o,r)):Mn(a)&&i.push(a.getTextContent())}return i.join("")}function FA(t,e,n,o,r){let i=t.getFormat()===0?e:(function(p){return p.replace(/^\s+|\s+$/g,(f=>[...f].map((h=>"&#"+h.codePointAt(0)+";")).join("")))})(e);t.hasFormat("code")||(i=i.replace(/([*_`~\\])/g,"\\$1"));let s="",a="",l="",c=BA(t,!0),d=BA(t,!1),u=new Set;for(let p of n){let f=p.format[0],h=p.tag;Vf(t,f)&&!u.has(f)&&(u.add(f),Vf(c,f)&&o.find((m=>m.tag===h))||(o.push({format:f,tag:h}),s+=h))}for(let p=0;p<o.length;p++){let f=Vf(t,o[p].format),h=Vf(d,o[p].format);if(f&&h)continue;let m=[...o];for(;m.length>p;){let _=m.pop();r&&_&&r.find((b=>b.tag===_.tag))||(_&&typeof _.tag=="string"&&(f?h||(l+=_.tag):a+=_.tag),o.pop())}break}return i=s+i+l,a+i}function BA(t,e){let n=e?t.getPreviousSibling():t.getNextSibling();if(!n){let o=t.getParentOrThrow();o.isInline()&&(n=e?o.getPreviousSibling():o.getNextSibling())}for(;n;){if(G(n)){if(!n.isInline())break;let o=e?n.getLastDescendant():n.getFirstDescendant();if(Z(o))return o;n=e?n.getPreviousSibling():n.getNextSibling()}if(Z(n))return n;if(!G(n))return null}return null}function Vf(t,e){return Z(t)&&t.hasFormat(e)}function EV(t,e){let n=(function(r,i){let s=r.match(i.openTagsRegExp);if(s==null)return null;for(let a of s){let l=a.replace(/^\s/,""),c=i.fullMatchRegExpByTag[l];if(c==null)continue;let d=r.match(c),u=i.transformersByTag[l];if(d!=null&&u!=null){if(u.intraword!==!1)return d;let{index:p=0}=d,f=r[p-1],h=r[p+d[0].length];if((!f||Wf.test(f))&&(!h||Wf.test(h)))return d}}return null})(t.getTextContent(),e);if(!n)return null;let o=n.index||0;return{endIndex:o+n[0].length,match:n,startIndex:o,transformer:e.transformersByTag[n[1]]}}function Rs(t){return Z(t)&&!t.hasFormat("code")}function Ps(t,e,n){let o=EV(t,e),r=(function(s,a){let l=s,c,d,u,p;for(let f of a){if(!f.replace||!f.importRegExp)continue;let h=l.getTextContent().match(f.importRegExp);if(!h)continue;let m=h.index||0,_=f.getEndIndex?f.getEndIndex(l,h):m+h[0].length;_!==!1&&(c===void 0||d===void 0||m<c&&_>d)&&(c=m,d=_,u=f,p=h)}return c===void 0||d===void 0||u===void 0||p===void 0?null:{endIndex:d,match:p,startIndex:c,transformer:u}})(t,n);if(o&&r&&(o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null),o){let s=(function(a,l,c,d,u){let p=a.getTextContent(),f,h,m;if(u[0]===p?f=a:l===0?[f,h]=a.splitText(c):[m,f,h]=a.splitText(l,c),f.setTextContent(u[2]),d)for(let _ of d.format)f.hasFormat(_)||f.toggleFormat(_);return{nodeAfter:h,nodeBefore:m,transformedNode:f}})(t,o.startIndex,o.endIndex,o.transformer,o.match);Rs(s.nodeAfter)&&Ps(s.nodeAfter,e,n),Rs(s.nodeBefore)&&Ps(s.nodeBefore,e,n),Rs(s.transformedNode)&&Ps(s.transformedNode,e,n)}else if(r){let s=(function(a,l,c,d,u){let p,f,h;return l===0?[p,f]=a.splitText(c):[h,p,f]=a.splitText(l,c),d.replace?{nodeAfter:f,nodeBefore:h,transformedNode:d.replace(p,u)||void 0}:null})(t,r.startIndex,r.endIndex,r.transformer,r.match);if(!s)return;Rs(s.nodeAfter)&&Ps(s.nodeAfter,e,n),Rs(s.nodeBefore)&&Ps(s.nodeBefore,e,n),Rs(s.transformedNode)&&Ps(s.transformedNode,e,n)}let i=t.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,((s,a)=>String.fromCodePoint(a)));t.setTextContent(i)}function wV(t,e=!1){let n=Tv(t),o=(function(r){let i={},s={},a=[],l="(?<![\\\\])";for(let c of r){let{tag:d}=c;i[d]=c;let u=d.replace(/(\*|\^|\+)/g,"\\$1");a.push(u),d.length===1?s[d]=new RegExp(`(?<![\\\\${u}])(${u})((\\\\${u})?.*?[^${u}\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?![\\\\${u}])`):s[d]=new RegExp(`(?<!\\\\)(${u})((\\\\${u})?.*?[^\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?!\\\\)`)}return{fullMatchRegExpByTag:s,openTagsRegExp:new RegExp(`${l}(${a.join("|")})`,"g"),transformersByTag:i}})(n.textFormat);return(r,i)=>{let s=r.split(`
131
+ `),a=s.length,l=i||Qe();l.clear();for(let d=0;d<a;d++){let u=s[d],[p,f]=TV(s,d,n.multilineElement,l);p?d=f:SV(u,l,n.element,o,n.textMatch,e)}let c=l.getChildren();for(let d of c)!e&&Ev(d)&&l.getChildrenSize()>1&&d.remove();$()!==null&&l.selectStart()}}function TV(t,e,n,o){for(let r of n){let{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:a,replace:l}=r,c=t[e].match(a);if(!c)continue;if(i){let h=i({lines:t,rootNode:o,startLineIndex:e,startMatch:c,transformer:r});if(h===null)continue;if(h)return h}let d=typeof s=="object"&&"regExp"in s?s.regExp:s,u=s&&typeof s=="object"&&"optional"in s?s.optional:!s,p=e,f=t.length;for(;p<f;){let h=d?t[p].match(d):null;if(!h&&(!u||u&&p<f-1)){p++;continue}if(h&&e===p&&h.index===c.index){p++;continue}let m=[];if(h&&e===p)m.push(t[e].slice(c[0].length,-h[0].length));else for(let _=e;_<=p;_++)if(_===e){let b=t[_].slice(c[0].length);m.push(b)}else if(_===p&&h){let b=t[_].slice(0,-h[0].length);m.push(b)}else m.push(t[_]);if(l(o,null,c,h,m,!0)!==!1)return[!0,p];break}}return[!1,e]}function SV(t,e,n,o,r,i){let s=vt(t),a=fe();a.append(s),e.append(a);for(let{regExp:l,replace:c}of n){let d=t.match(l);if(d&&(s.setTextContent(t.slice(d[0].length)),c(a,[s],d,!0)!==!1))break}if(Ps(s,o,r),a.isAttached()&&t.length>0){let l=a.getPreviousSibling();if(!i&&(Yt(l)||Br(l)||vn(l))){let c=l;if(vn(l)){let d=l.getLastDescendant();c=d==null?null:le(d,Wc)}c!=null&&c.getTextContentSize()>0&&(c.splice(c.getChildrenSize(),0,[Co(),...a.getChildren()]),a.remove())}}}function kV(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $A(t,e,n){let o=n.length;for(let r=e;r>=o;r--){let i=r-o;if(zA(t,i,n,0,o)&&t[i+o]!==" ")return i}return-1}function zA(t,e,n,o,r){for(let i=0;i<r;i++)if(t[e+i]!==n[o+i])return!1;return!0}function NV(t,e=qf){let n=Tv(e),o=Cv(n.textFormat,(({tag:s})=>s[s.length-1])),r=Cv(n.textMatch,(({trigger:s})=>s));for(let s of e){let a=s.type;if(a==="element"||a==="text-match"||a==="multiline-element"){let l=s.dependencies;for(let c of l)t.hasNode(c)||kV(173,c.getType())}}let i=(s,a,l)=>{(function(c,d,u,p){let f=c.getParent();if(!Lt(f)||c.getFirstChild()!==d)return!1;let h=d.getTextContent();if(h[u-1]!==" ")return!1;for(let{regExp:m,replace:_}of p){let b=h.match(m);if(b&&b[0].length===(b[0].endsWith(" ")?u:u-1)){let y=d.getNextSiblings(),[x,v]=d.splitText(u);if(_(c,v?[v,...y]:y,b,!1)!==!1)return x.remove(),!0}}return!1})(s,a,l,n.element)||(function(c,d,u,p){let f=c.getParent();if(!Lt(f)||c.getFirstChild()!==d)return!1;let h=d.getTextContent();if(h[u-1]!==" ")return!1;for(let{regExpStart:m,replace:_,regExpEnd:b}of p){if(b&&!("optional"in b)||b&&"optional"in b&&!b.optional)continue;let y=h.match(m);if(y&&y[0].length===(y[0].endsWith(" ")?u:u-1)){let x=d.getNextSiblings(),[v,E]=d.splitText(u);if(_(c,E?[E,...x]:x,y,null,null,!1)!==!1)return v.remove(),!0}}return!1})(s,a,l,n.multilineElement)||(function(c,d,u){let p=c.getTextContent(),f=u[p[d-1]];if(f==null)return!1;d<p.length&&(p=p.slice(0,d));for(let h of f){if(!h.replace||!h.regExp)continue;let m=p.match(h.regExp);if(m===null)continue;let _=m.index||0,b=_+m[0].length,y;return _===0?[y]=c.splitText(b):[,y]=c.splitText(_,b),y.selectNext(0,0),h.replace(y,m),!0}return!1})(a,l,r)||(function(c,d,u){let p=c.getTextContent(),f=d-1,h=p[f],m=u[h];if(!m)return!1;for(let _ of m){let{tag:b}=_,y=b.length,x=f-y+1;if(y>1&&!zA(p,x,b,0,y)||p[x-1]===" ")continue;let v=p[f+1];if(_.intraword===!1&&v&&!Wf.test(v))continue;let E=c,C=E,k=$A(p,x,b),T=C;for(;k<0&&(T=T.getPreviousSibling())&&!qe(T);)if(Z(T)){if(T.hasFormat("code"))continue;let K=T.getTextContent();C=T,k=$A(K,K.length,b)}if(k<0||C===E&&k+y===x)continue;let w=C.getTextContent();if(k>0&&w[k-1]===h)continue;let S=w[k-1];if(_.intraword===!1&&S&&!Wf.test(S))continue;let N=E.getTextContent(),D=N.slice(0,x)+N.slice(f+1);E.setTextContent(D);let O=C===E?D:w;C.setTextContent(O.slice(0,k)+O.slice(k+y));let M=$(),I=Yo();ht(I);let L=f-y*(C===E?2:1)+1;I.anchor.set(C.__key,k,"text"),I.focus.set(E.__key,L,"text");for(let K of _.format)I.hasFormat(K)||I.formatText(K);I.anchor.set(I.focus.key,I.focus.offset,I.focus.type);for(let K of _.format)I.hasFormat(K)&&I.toggleFormat(K);return F(M)&&(I.format=M.format),!0}})(a,l,o)};return t.registerUpdateListener((({tags:s,dirtyLeaves:a,editorState:l,prevEditorState:c})=>{if(s.has(aD)||s.has(Wa)||t.isComposing())return;let d=l.read($),u=c.read($);if(!F(u)||!F(d)||!d.isCollapsed()||d.is(u))return;let p=d.anchor.key,f=d.anchor.offset,h=l._nodeMap.get(p);!Z(h)||!a.has(p)||f!==1&&f>u.anchor.offset+1||t.update((()=>{if(!Rs(h))return;let m=h.getParent();m===null||vv(m)||i(m,h,d.anchor.offset)}))}))}var HA=/^(\s*)(\d{1,})\.\s/,KA=/^(\s*)[-*+]\s/,UA=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,wv=/^(#{1,6})\s/,jA=/^>\s/,VA=/^[ \t]*```([\w-]+)?/,WA=/[ \t]*```$/,DV=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,OV=/^(?:\|)(.+)(?:\|)\s?$/,IV=/^(\| ?:?-*:? ?)+\|\s?$/,GA=t=>(e,n,o,r)=>{let i=t(o);i.append(...n),e.replace(i),r||i.select(0,0)},Sv=t=>(e,n,o,r)=>{let i=e.getPreviousSibling(),s=e.getNextSibling(),a=Vc(t==="check"?o[3]==="x":void 0);if(vn(s)&&s.getListType()===t){let c=s.getFirstChild();c!==null?c.insertBefore(a):s.append(a),e.remove()}else if(vn(i)&&i.getListType()===t)i.append(a),e.remove();else{let c=Qa(t,t==="number"?Number(o[2]):void 0);c.append(a),e.replace(c)}a.append(...n),r||a.select(0,0);let l=(function(c){let d=c.match(/\t/g),u=c.match(/ /g),p=0;return d&&(p+=d.length),u&&(p+=Math.floor(u.length/4)),p})(o[1]);l&&a.setIndent(l)},Yf=(t,e,n)=>{let o=[],r=t.getChildren(),i=0;for(let s of r)if(Wc(s)){if(s.getChildrenSize()===1){let d=s.getFirstChild();if(vn(d)){o.push(Yf(d,e,n+1));continue}}let a=" ".repeat(4*n),l=t.getListType(),c=l==="number"?`${t.getStart()+i}. `:l==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(a+c+e(s)),i++}return o.join(`
132
+ `)},YA={dependencies:[vf],export:(t,e)=>{if(!Fr(t))return null;let n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:wv,replace:GA((t=>{let e="h"+t[1].length;return Ts(e)})),type:"element"},qA={dependencies:[Cf],export:(t,e)=>{if(!Br(t))return null;let n=e(t).split(`
133
+ `),o=[];for(let r of n)o.push("> "+r);return o.join(`
134
+ `)},regExp:jA,replace:(t,e,n,o)=>{if(o){let i=t.getPreviousSibling();if(Br(i))return i.splice(i.getChildrenSize(),0,[Co(),...e]),void t.remove()}let r=Ss();r.append(...e),t.replace(r),o||r.select(0,0)},type:"element"},XA={dependencies:[xA],export:t=>{if(!vv(t))return null;let e=t.getTextContent();return"```"+(t.getLanguage()||"")+(e?`
135
+ `+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:WA},regExpStart:VA,replace:(t,e,n,o,r,i)=>{let s,a;if(!e&&r){if(r.length===1)o?(s=od(),a=n[1]+r[0]):(s=od(n[1]),a=r[0].startsWith(" ")?r[0].slice(1):r[0]);else{if(s=od(n[1]),r[0].trim().length===0)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();a=r.join(`
136
+ `)}let l=vt(a);s.append(l),t.append(s)}else e&&GA((l=>od(l?l[1]:void 0)))(t,e,n,i)},type:"multiline-element"},JA={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Yf(t,e,0):null,regExp:KA,replace:Sv("bullet"),type:"element"},MV={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Yf(t,e,0):null,regExp:UA,replace:Sv("check"),type:"element"},ZA={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Yf(t,e,0):null,regExp:HA,replace:Sv("number"),type:"element"},QA={format:["code"],tag:"`",type:"text-format"},eL={format:["highlight"],tag:"==",type:"text-format"},tL={format:["bold","italic"],tag:"***",type:"text-format"},nL={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},oL={format:["bold"],tag:"**",type:"text-format"},rL={format:["bold"],intraword:!1,tag:"__",type:"text-format"},iL={format:["strikethrough"],tag:"~~",type:"text-format"},sL={format:["italic"],tag:"*",type:"text-format"},aL={format:["italic"],intraword:!1,tag:"_",type:"text-format"},lL={dependencies:[Ja],export:(t,e,n)=>{if(!Xe(t)||Uc(t))return null;let o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{let[,n,o,r]=e,i=af(o,{title:r}),s=vt(n);return s.setFormat(t.getFormat()),i.append(s),t.replace(i),s},trigger:")",type:"text-match"},cL=[YA,qA,JA,ZA],dL=[XA],uL=[QA,tL,nL,oL,rL,eL,sL,aL,iL],pL=[lL],qf=[...cL,...dL,...uL,...pL];function AV(t,e=qf,n,o=!1,r=!1){let i=o?t:(function(s,a=!1){let l=s.split(`
137
+ `),c=!1,d=[];for(let u=0;u<l.length;u++){let p=l[u],f=d[d.length-1];DV.test(p)?d.push(p):VA.test(p)||WA.test(p)?(c=!c,d.push(p)):c||p===""||f===""||!f||wv.test(f)||wv.test(p)||jA.test(p)||HA.test(p)||KA.test(p)||UA.test(p)||OV.test(p)||IV.test(p)||!a?d.push(p):d[d.length-1]=f+p}return d.join(`
138
+ `)})(t,r);return wV(e,o)(i,n)}function LV(t=qf,e,n=!1){return(function(r,i=!1){let s=Tv(r),a=[...s.multilineElement,...s.element],l=!i,c=s.textFormat.filter((d=>d.format.length===1)).sort(((d,u)=>Number(d.format.includes("code"))-Number(u.format.includes("code"))));return d=>{let u=[],p=(d||Qe()).getChildren();for(let f=0;f<p.length;f++){let h=p[f],m=CV(h,a,c,s.textMatch);m!=null&&u.push(l&&f>0&&!Ev(h)&&!Ev(p[f-1])?`
139
+ `.concat(m):m)}return u.join(`
140
+ `)}})(t,n)(e)}var it=kv,Nle=it.$convertFromMarkdownString,Dle=it.$convertToMarkdownString,Ole=it.BOLD_ITALIC_STAR,Ile=it.BOLD_ITALIC_UNDERSCORE,Mle=it.BOLD_STAR,Ale=it.BOLD_UNDERSCORE,Lle=it.CHECK_LIST,Rle=it.CODE,Ple=it.ELEMENT_TRANSFORMERS,fL=it.HEADING,Fle=it.HIGHLIGHT,hL=it.INLINE_CODE,Ble=it.ITALIC_STAR,$le=it.ITALIC_UNDERSCORE,zle=it.LINK,Hle=it.MULTILINE_ELEMENT_TRANSFORMERS,gL=it.ORDERED_LIST,mL=it.QUOTE,Kle=it.STRIKETHROUGH,Ule=it.TEXT_FORMAT_TRANSFORMERS,jle=it.TEXT_MATCH_TRANSFORMERS,_L=it.TRANSFORMERS,bL=it.UNORDERED_LIST,yL=it.registerMarkdownShortcuts;var Nv={};Re(Nv,{DEFAULT_TRANSFORMERS:()=>xL,MarkdownShortcutPlugin:()=>RV});ut();var xL=[{dependencies:[_f],export:t=>cI(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,o)=>{let r=el();o||t.getNextSibling()!=null?t.replace(r):t.insertBefore(r),r.selectNext()},type:"element"},..._L];function RV({transformers:t=xL}){let[e]=be();return P((()=>yL(e,t)),[e,t]),null}var vL=Nv,Xle=vL.DEFAULT_TRANSFORMERS,CL=vL.MarkdownShortcutPlugin;function EL(){return g(CL,{transformers:[fL,bL,gL,mL,hL]})}var Dv={};Re(Dv,{OnChangePlugin:()=>FV});ut();var PV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function FV({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[o]=be();return PV((()=>{if(n)return o.registerUpdateListener((({editorState:r,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{e&&i.size===0&&s.size===0||t&&l.has(Ga)||a.isEmpty()||n(r,o,l)}))}),[o,t,e,n]),null}var BV=Dv,wL=BV.OnChangePlugin;Se();function $V(){return{text:"",components:{}}}var zV=[{tag:"code",format:"code"},{tag:"s",format:"strikethrough"},{tag:"u",format:"underline"},{tag:"i",format:"italic"},{tag:"b",format:"bold"},{tag:"sup",format:"superscript"},{tag:"sub",format:"subscript"}];function SL(t){let e=[];return zV.forEach(({tag:n,format:o})=>{t.hasFormat(o)&&e.push(n)}),e}function Ov(t,e){t.text+=e.text,Object.assign(t.components,e.components)}function HV(t,e,n){for(let o=t.length-1;o>=0;o-=1){let r=t[o];e.includes(r)||(n.text+=`</${r}>`,t.splice(o,1))}e.forEach(o=>{t.includes(o)||(n.text+=`<${o}>`,t.push(o))})}function TL(t,e){for(let n=t.length-1;n>=0;n-=1)e.text+=`</${t[n]}>`;t.length=0}function kL(t,e){let n=t.getChildren();for(let o of n)if(Z(o)){let r=SL(o);if(r.length!==e.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==e[i])return!1}else{if(qe(o)||fl(o))continue;if(o instanceof Rt){if(!kL(o,e))return!1}else return!1}return!0}function KV(t){let e=t.getComponentId(),n=t.getComponentName(),o=Ze(t.getComponentData()),r={[e]:{type:n,data:o}};return{text:`{${n}:${e}}`,components:r}}function UV(t){let e=Xe(t)&&t.getURL()||"",n=Xe(t)&&t.getTarget()||"",o=jr(t),r=qV(n)?` target="${n}"`:"";return{text:`<a href="${e}"${r}>${o.text}</a>`,components:o.components}}function jr(t){let e=$V(),n=[];return t.getChildren().forEach(r=>{if(qe(r)){e.text+="<br>";return}if(fl(r)){Ov(e,KV(r));return}if(Z(r)){let i=SL(r);HV(n,i,e);let s=r.getTextContent();s&&(e.text+=GV(s));return}if(Xe(r)){n.length>0&&!kL(r,n)&&TL(n,e),Ov(e,UV(r));return}if(r instanceof Rt){Ov(e,jr(r));return}console.log("unhandled node"),console.log(r)}),n.length>0&&TL(n,e),e}function Iv(t){let e=[];return t.getChildren().forEach(n=>{Wc(n)&&e.push(jV(n))}),YV(e)}function jV(t){let e=t.getFirstChild();if(e&&vn(e))return{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:Iv(e)};let n=jr(t),o={content:n.text};return Pi(n.components)&&(o.components=n.components),o}function VV(t){let e=[];return t.getChildren().forEach(n=>{if(po(n)){let o=[];n.getChildren().forEach(r=>{if(No(r)){let s=r.getHeaderStyles()>0,a=r.getChildren(),l=[];a.forEach(c=>{if(Hr(c))l.push({type:c.getBlockName(),data:Ze(c.getBlockData())});else if(Yt(c)){let d=jr(c),u={type:"paragraph",data:{text:d.text}};Pi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Fr(c)){let d=c.getTag().slice(1),u=jr(c),p={type:"heading",data:{text:u.text,level:parseInt(d)}};Pi(u.components)&&(p.data.components=u.components),l.push(p)}else if(Br(c)){let d=jr(c),u={type:"quote",data:{text:d.text}};Pi(d.components)&&(u.data.components=d.components),l.push(u)}else if(vn(c)){let d=c.getTag(),u={type:d==="ol"?"orderedList":"unorderedList",data:{style:d==="ol"?"ordered":"unordered",items:Iv(c)}};l.push(u)}}),o.push({blocks:l,type:s?"header":"data"})}}),e.push({cells:o})}}),{rows:e}}function NL(){let t=[];for(Qe().getChildren().forEach(o=>{if(Yt(o)){let r=jr(o),i={type:"paragraph",data:{text:r.text}};Pi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Fr(o)){let r=o.getTag().slice(1),i=jr(o),s={type:"heading",data:{text:i.text,level:parseInt(r)}};Pi(i.components)&&(s.data.components=i.components),t.push(s)}else if(Br(o)){let r=jr(o),i={type:"quote",data:{text:r.text}};Pi(r.components)&&(i.data.components=r.components),t.push(i)}else if(vn(o)){let r=o.getTag(),i={type:r==="ol"?"orderedList":"unorderedList",data:{style:r==="ol"?"ordered":"unordered",items:Iv(o)}};t.push(i)}else if(gM(o)){let i={type:"table",data:VV(o)};t.push(i)}else if(Hr(o)){let r={type:o.getBlockName(),data:Ze(o.getBlockData())};t.push(r)}else if(Mn(o)&&o.getType()==="horizontalrule"){let r={type:"delimiter",data:{}};t.push(r)}});WV(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function WV(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text&&!Pi(e.data?.components||{}))}function Pi(t){return t?Object.keys(t).length>0:!1}function GV(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function YV(t){let e=[];return t.forEach(n=>{n.itemsType&&n.items&&e.length>0?(e.at(-1).itemsType=n.itemsType,e.at(-1).items=n.items):e.push(n)}),e}function qV(t){return["_blank","_self","_parent","_top"].includes(t)}function DL(t){let e=Qe();e.clear();let n=t?.blocks||[];for(let o of n)if(o.type==="paragraph"){let r=fe();if(o.data.text){let i=Fs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="heading"){let r=`h${o.data?.level||2}`,i=Ts(r);if(o.data.text){let s=Fs(o.data.text,o.data.components);i.append(...s)}e.append(i)}else if(o.type==="quote"){let r=Ss();if(o.data?.text){let i=Fs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="orderedList"||o.type==="unorderedList"){let r=o.data.style==="ordered"?"number":"bullet",i=Qa(r);for(let s of o.data.items)i.append(...Mv(s,r));e.append(i)}else if(o.type==="table"){let r=dM();(o.data?.rows||[]).forEach(s=>{let a=uM();(s.cells||[]).forEach(c=>{let d=c.blocks||[],p=(c.type||"data")==="header"?1:0,f=cM(p);d.forEach(h=>{if(h.type==="paragraph"){let m=fe();if(h.data?.text){let _=Fs(h.data.text,h.data.components);m.append(..._)}f.append(m)}else if(h.type==="heading"){let m=`h${h.data?.level||2}`,_=Ts(m);if(h.data?.text){let b=Fs(h.data.text,h.data.components);_.append(...b)}f.append(_)}else if(h.type==="quote"){let m=Ss();if(h.data?.text){let _=Fs(h.data.text,h.data.components);m.append(..._)}f.append(m)}else if(h.type==="orderedList"||h.type==="unorderedList"){let m=h.data.style==="ordered"?"number":"bullet",_=Qa(m);for(let b of h.data.items)_.append(...Mv(b,m));f.append(_)}else{let m=Os(h.type,h.data||{});f.append(m)}}),a.append(f)}),r.append(a)}),e.append(r)}else if(o.type==="delimiter"){let r=el();e.append(r)}else if(o.type){let r=Os(o.type,o.data||{});e.append(r)}}function Fs(t,e){let n=document.createElement("template");n.innerHTML=t;let o=n.content,r=[];function i(s){if(s.nodeType===Node.TEXT_NODE)return XV(s.textContent||"",e);if(s.nodeType===Node.ELEMENT_NODE){let a=s,l=Array.from(a.childNodes).map(i).filter(c=>!!c).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return l.map(c=>(c instanceof Pt&&c.toggleFormat("bold"),c));case"i":case"em":return l.map(c=>(c instanceof Pt&&c.toggleFormat("italic"),c));case"u":return l.map(c=>(c instanceof Pt&&c.toggleFormat("underline"),c));case"s":return l.map(c=>(c instanceof Pt&&c.toggleFormat("strikethrough"),c));case"sup":return l.map(c=>(c instanceof Pt&&c.toggleFormat("superscript"),c));case"sub":return l.map(c=>(c instanceof Pt&&c.toggleFormat("subscript"),c));case"code":return l.map(c=>(c instanceof Pt&&c.toggleFormat("code"),c));case"br":return[];case"a":{let c=af(a.getAttribute("href")||""),d=a.getAttribute("target");return d&&c.setTarget(d),c.append(...l),[Tt(c)]}default:return console.log("unhandled tag: "+a.tagName),console.log(l),l}}return null}return o.childNodes.forEach(s=>{let a=i(s);Array.isArray(a)?r.push(...a):a&&r.push(a)}),r}function XV(t,e){let n=[];if(!t)return n;let o=/\{([^:{}]+):([^}]+)\}/g,r=0,i;for(;(i=o.exec(t))!==null;){let a=t.slice(r,i.index);a&&n.push(vt(a));let l=i[1],c=i[2],d=e?.[c];d?n.push(Bf(l||d.type,c,d.data?Ze(d.data):{})):n.push(vt(i[0])),r=o.lastIndex}let s=t.slice(r);return s&&n.push(vt(s)),n}function Mv(t,e){let n=[];if(t.content){let o=JV(t);n.push(o)}if(t.items&&t.items.length>0){let o=ZV(t,e);n.push(o)}return n}function JV(t){let e=Vc();if(t.content){let n=Fs(t.content,t.components);e.append(...n)}return e}function ZV(t,e){let n=Vc();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let r=Qa(o);for(let i of t.items)r.append(...Mv(i,o));n.append(r)}return n}function OL(t){let[e]=be(),n=Y(0),o=Y(!1);return P(()=>{let i=t.value?.time||0;i>n.current&&(n.current=i,e.update(()=>{o.current=!0,DL(t.value)}))},[e,t.value]),g(wL,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let s=NL();n.current=s?.time||0,t.onChange&&t.onChange(s)})},ignoreSelectionChange:!0})}Se();function QV(t){let e=!1;return t.querySelectorAll("a [style]").forEach(n=>{if(!(n instanceof HTMLElement))return;let o=n.style;(o.textDecoration?.includes("underline")||o.getPropertyValue("text-decoration")?.includes("underline"))&&(o.removeProperty("text-decoration"),o.removeProperty("text-decoration-skip-ink"),o.removeProperty("-webkit-text-decoration-skip"),e=!0)}),e}function eW(t){let e=!1;return t.querySelectorAll("[style]").forEach(n=>{n instanceof HTMLElement&&n.style.textAlign&&(n.style.removeProperty("text-align"),e=!0)}),e}function IL(){let[t]=be();return P(()=>t.registerCommand(wi,e=>{let{clipboardData:n}=e;if(!n)return!1;let o=n.getData("text/html");if(!o)return!1;let i=new DOMParser().parseFromString(o,"text/html"),s=!1;if(s=QV(i)||s,s=eW(i)||s,!s)return!1;e.preventDefault();let a=yf(t,i),l=$();return F(l)?l.insertNodes(a):wo(a),!0},Hp),[t]),null}Se();function ML(t){let{editor:e,setIsLinkEditMode:n}=t,{toolbarState:o}=Pf();return P(()=>{let r=i=>{if(Pn(i,{}))return!1;if(vA(i))Ls(e);else if(CA(i)){let{code:s}=i,a=`h${s[s.length-1]}`;Ri(e,o.blockType,a)}else if(wA(i))Uf(e,o.blockType);else if(EA(i))jf(e,o.blockType);else if(TA(i))e.dispatchCommand(ot,"strikethrough");else if(SA(i))e.dispatchCommand(Ln,void 0);else if(kA(i))e.dispatchCommand(uo,void 0);else if(NA(i))e.dispatchCommand(ot,"subscript");else if(DA(i))e.dispatchCommand(ot,"superscript");else if(OA(i))gl(e);else if(IA(i)){let s=o.isLink?null:"";n(!o.isLink),e.dispatchCommand(Bn,s)}else return!1;return i.preventDefault(),!0};return e.registerCommand(fD,r,Hp)},[e,o.isLink,o.blockType,n]),null}Se();var tW=/[\u00A0\u2011]/;function AL(){let[t]=be();return P(()=>{if(!t.hasNodes([Mi]))throw new Error("SpecialCharacterPlugin: SpecialCharacterNode not registered on editor");return t.registerNodeTransform(Pt,e=>{if(ZM(e))return;let n=e.getTextContent(),o=tW.exec(n);if(o){let r=o.index,i=o[0],s;r===0?[s]=e.splitText(r+1):[,s]=e.splitText(r,r+1);let a=cv(i);s.replace(a)}})},[t]),null}zs();Se();function LL(t){let{editor:e}=t,n=Y(null),o=Y(null),[r,i]=R(null),[s,a]=R(!1),[l,c]=R(!1),[d,u]=R(!1),p=Ee(()=>{if(!r){c(!1),u(!1);return}e.getEditorState().read(()=>{try{let w=td(r).getChildren(),S=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!po(O))continue;if(O.getChildren().some(I=>I.getKey()===r.getKey())){S=D;break}}if(S!==-1){let D=w[S];if(po(D)){let M=D.getChildren()[0];if(No(M)){let I=M.getHeaderStyles();c((I&Cn.ROW)===Cn.ROW)}}}let N=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!po(O))continue;let M=O.getChildren();for(let I=0;I<M.length;I++)if(M[I].getKey()===r.getKey()){N=I;break}if(N!==-1)break}if(N!==-1){let D=w[0];if(po(D)){let M=D.getChildren()[N];if(No(M)){let I=M.getHeaderStyles();u((I&Cn.COLUMN)===Cn.COLUMN)}}}}catch{c(!1),u(!1)}})},[e,r]);P(()=>{r&&s&&p()},[r,s,p]),P(()=>{if(!(!r||!s))return e.registerUpdateListener(()=>{p()})},[e,r,s,p]);let f=Ee(()=>{let T=o.current,w=n.current;if(!w||!r)return;let S=e.getElementByKey(r.getKey());if(!S)return;let N=S.getBoundingClientRect(),D=window.innerWidth,O=window.innerHeight;if(w.style.left=`${N.right-25}px`,w.style.top=`${N.top+5}px`,w.style.display="flex",T)if(s){let L=N.right-185,K=N.top+30;L<10&&(L=N.left),L+185>D-10&&(L=D-185-10),K+280>O-10&&(K=N.top-280-5,K<10&&(K=10)),T.style.left=`${L}px`,T.style.top=`${K}px`,T.style.display="block"}else T.style.display="none"},[e,r,s]);P(()=>{if(!r){n.current&&(n.current.style.display="none"),o.current&&(o.current.style.display="none"),a(!1);return}f();let T=()=>{f()},w=N=>{N.key==="Escape"&&s&&(a(!1),N.preventDefault(),N.stopPropagation())},S=N=>{o.current&&n.current&&!o.current.contains(N.target)&&!n.current.contains(N.target)&&a(!1)};return window.addEventListener("scroll",T,!0),document.addEventListener("keydown",w),document.addEventListener("mousedown",S),()=>{window.removeEventListener("scroll",T,!0),document.removeEventListener("keydown",w),document.removeEventListener("mousedown",S)}},[r,f,s]),P(()=>e.registerCommand(cn,()=>{let T=$();if(F(T)){let w=T.anchor.getNode(),S=Zx(w);No(S)?(r&&S.getKey()!==r.getKey()&&a(!1),i(S)):i(null)}else if(mM(T)){let w=T.getNodes();if(w.length>0){let S=Zx(w[0]);No(S)&&(r&&S.getKey()!==r.getKey()&&a(!1),i(S))}}else i(null);return!1},xi),[e,r]);let h=Ee(()=>{e.update(()=>{r&&ev(!1)}),a(!1)},[e,r]),m=Ee(()=>{e.update(()=>{r&&ev(!0)}),a(!1)},[e,r]),_=Ee(()=>{e.update(()=>{r&&Qx(!1)}),a(!1)},[e,r]),b=Ee(()=>{e.update(()=>{r&&Qx(!0)}),a(!1)},[e,r]),y=Ee(()=>{e.update(()=>{r&&pM()}),a(!1)},[e,r]),x=Ee(()=>{e.update(()=>{r&&fM()}),a(!1)},[e,r]),v=Ee(()=>{e.update(()=>{if(!r)return;td(r).remove()}),a(!1)},[e,r]),E=Ee(()=>{e.update(()=>{if(!r)return;let w=td(r).getChildren(),S=-1;for(let L=0;L<w.length;L++){let K=w[L];if(!po(K))continue;if(K.getChildren().some(q=>q.getKey()===r.getKey())){S=L;break}}if(S===-1)return;let N=w[S];if(!po(N))return;let D=N.getChildren(),O=D[0],I=((No(O)?O.getHeaderStyles():0)&Cn.ROW)===Cn.ROW;D.forEach(L=>{if(No(L)){let K=L.getHeaderStyles(),W=I?K^Cn.ROW:K|Cn.ROW;L.setHeaderStyles(W,Cn.ROW)}})}),a(!1)},[e,r]),C=Ee(()=>{e.update(()=>{if(!r)return;let w=td(r).getChildren(),S=-1;for(let L=0;L<w.length;L++){let K=w[L];if(!po(K))continue;let W=K.getChildren();for(let q=0;q<W.length;q++)if(W[q].getKey()===r.getKey()){S=q;break}if(S!==-1)break}if(S===-1)return;let N=w[0];if(!po(N))return;let O=N.getChildren()[S],I=((No(O)?O.getHeaderStyles():0)&Cn.COLUMN)===Cn.COLUMN;w.forEach(L=>{if(!po(L))return;let W=L.getChildren()[S];if(No(W)){let q=W.getHeaderStyles(),B=I?q^Cn.COLUMN:q|Cn.COLUMN;W.setHeaderStyles(B,Cn.COLUMN)}})}),a(!1)},[e,r]);if(!r)return null;let k=e.getRootElement();return k?Yr(g(Me,{children:[g("button",{ref:n,className:"LexicalEditor__tableActionMenuButton",onClick:()=>a(!s),type:"button",children:"\u22EE"}),s&&g("div",{ref:o,className:"LexicalEditor__tableActionMenu",children:[g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:h,children:"Insert row above"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:m,children:"Insert row below"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:_,children:"Insert column left"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:b,children:"Insert column right"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:y,children:"Delete column"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:x,children:"Delete row"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:v,children:"Delete table"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:E,children:l?"Remove row header":"Convert to row header"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:C,children:d?"Remove column header":"Convert to column header"})]})]}),k.parentElement||document.body):null}Se();function RL(){let[t]=be();return P(()=>t.registerNodeTransform(bD,e=>{let n=e.getLastChild();Yt(n)||e.append(fe())}),[t]),null}var nW={namespace:"RootCMS",theme:VM,nodes:[bO,vf,Cf,Ja,tr,Ni,_f,Af,Mf,bM,ul,pl,Mi],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function FL(t){return g(VO,{initialConfig:nW,children:g(HM,{children:g(jM,{children:g("div",{className:we(t.className,"LexicalEditor",t.variant==="comment"&&"LexicalEditor--comment",!t.autosize&&"LexicalEditor--withMaxHeight"),children:g(sW,{deepKey:t.deepKey,placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur,variant:t.variant,autoFocus:t.autoFocus,blockComponents:t.blockComponents,inlineComponents:t.inlineComponents})})})})})}var oW=ov({name:"image",label:"Image Embed",preview:{title:"{file.alt}",image:"{file.src}"},fields:[wM({id:"file",label:"Image"}),nv({id:"caption",label:"Caption",variant:"textarea",translate:!0,deprecated:!0})]}),rW=ov({name:"html",label:"HTML Code",preview:{title:"{html}"},fields:[nv({id:"html",label:"HTML",help:"HTML code to embed. Please use caution when inserting HTML.",variant:"textarea",autosize:!0,maxRows:50})]}),iW=[oW,rW];function sW(t){let{historyState:e}=KM(),[n]=be(),[o,r]=R(n),[i,s]=R(!1),[a,l]=R(null),c=X(()=>{let D=new Map;return t.variant!=="comment"&&iW.forEach(O=>{D.set(O.name,O)}),t.blockComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.blockComponents]),d=Array.from(c.values()),[u,p]=R(null),f=X(()=>{let D=new Map;return t.inlineComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.inlineComponents]),h=Array.from(f.values()),[m,_]=R(null),b=D=>{D&&l(D)},y=(D,O)=>{let M=c.get(D);if(!M)return;let I=O?.initialValue?Ze(O.initialValue):Xs(M);p({schema:M,mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},x=(D,O)=>{n.update(()=>{let M=Os(D,O);wo([M]),M.selectNext()})},v=(D,O)=>{n.update(()=>{let M=St(D);Hr(M)&&M.setBlockData(O)})},E=()=>{p(null)};P(()=>{if(!t.deepKey)return;let D=O=>{let M=O.detail;if(!M||M.richTextDeepKey!==t.deepKey)return;let I=c.get(M.blockName);if(!I)return;let L=null,K=null;n.getEditorState().read(()=>{let W=Qe(),q=-1;for(let B of W.getChildren())if(Hr(B)){q+=1;let se=B.getBlockName();if(q===M.blockIndex&&se===M.blockName){L=B.getKey(),K=B.getBlockData();break}}if(!L){for(let B of W.getChildren())if(Hr(B)&&B.getBlockName()===M.blockName){L=B.getKey(),K=B.getBlockData();break}}}),L&&p({schema:I,mode:"edit",initialValue:K?Ze(K):{},nodeKey:L})};return window.addEventListener(sv,D),()=>window.removeEventListener(sv,D)},[n,t.deepKey,c]),P(()=>{if(!t.deepKey)return;let D=O=>{let M=O.detail;if(!M||M.richTextDeepKey!==t.deepKey)return;let I=f.get(M.componentName);if(!I)return;let L=null,K=null,W=null;n.getEditorState().read(()=>{for(let{node:q}of cO())if(fl(q)&&q.getComponentId()===M.componentId){L=q.getKey(),K=q.getComponentData(),W=q.getComponentName();break}}),L&&_({schema:I,componentName:W||M.componentName,componentId:M.componentId,mode:"edit",initialValue:K?Ze(K):{},nodeKey:L})};return window.addEventListener(av,D),()=>window.removeEventListener(av,D)},[n,t.deepKey,f]);let C=D=>{u&&(u.mode==="edit"&&u.nodeKey?v(u.nodeKey,D):x(u.schema.name,D),E())},k=(D,O)=>{let M=f.get(D);if(!M)return;let I=O?.initialValue?Ze(O.initialValue):Xs(M);_({schema:M,componentName:D,componentId:O?.componentId||pr(),mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},T=(D,O,M)=>{n.update(()=>{let I=Bf(D,O,M);wo([I]),I.selectNext()})},w=(D,O,M,I)=>{n.update(()=>{let L=St(D);fl(L)&&(L.setComponentName(O),L.setComponentId(M),L.setComponentData(I))})},S=()=>{_(null)},N=D=>{if(!m)return;let{componentName:O,mode:M,nodeKey:I}=m;M==="edit"&&I?w(I,O,D.componentId,D.data):T(O,D.componentId,D.data),S()};return g(BM,{components:f,onEditComponent:(D,O)=>k(D,{mode:O?.mode??"edit",initialValue:O?.initialValue,componentId:O?.componentId,nodeKey:O?.nodeKey}),children:g(RM,{blocks:c,onEditBlock:y,children:[g(OL,{value:t.value,onChange:t.onChange}),g(LA,{editor:n,activeEditor:o,setActiveEditor:r,setIsLinkEditMode:s,variant:t.variant,blockComponents:d,inlineComponents:h,onInsertBlockComponent:D=>y(D,{mode:"create"}),onInsertInlineComponent:D=>k(D,{mode:"create"})}),g(ML,{editor:o,setIsLinkEditMode:s}),g(sI,{externalHistoryState:e}),g(PI,{contentEditable:g("div",{className:"LexicalEditor__scroller",children:g("div",{className:"LexicalEditor__root",ref:b,children:g(ZO,{className:"LexicalEditor__editor",placeholder:g(lW,{placeholder:t.placeholder})})})}),ErrorBoundary:eI}),g(uI,{}),g(pI,{}),t.variant!=="comment"&&g(Me,{children:[g(dI,{}),g(EM,{}),g(LL,{editor:o}),g($I,{maxIndent:7})]}),g(EL,{}),t.autoFocus&&g(UO,{}),g(RL,{}),g(AL,{}),g(IL,{}),t.variant!=="comment"&&g(PA,{}),a&&g(Me,{children:[g(RA,{anchorElem:a,setIsLinkEditMode:s}),g(tA,{anchorElem:a,isLinkEditMode:i,setIsLinkEditMode:s})]}),u&&g(GM,{schema:u.schema,opened:!0,initialValue:u.initialValue,mode:u.mode,onClose:E,onSubmit:C}),m&&g(JM,{schema:m.schema,opened:!0,componentId:m.componentId,initialValue:m.initialValue,mode:m.mode,onClose:S,onSubmit:N})]})})}var PL=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance...","This is where the magic happens...","Let the words flow...","In the beginning, there was a blank page...","To write, or not to write, that is the question..."];function aW(){let t=Math.floor(Math.random()*PL.length);return PL[t]}function lW(t){let e=X(()=>t.placeholder||aW(),[]);return g("div",{className:"LexicalEditor__placeholder",children:e})}function BL(t){if(kE().preferences.EnableEditorJSEditor){let{deepKey:n,...o}=t;return g(_k,{...o})}return g(FL,{...t})}function $L(t){let e=t.field,[n,o]=R(null),r=to().controller,i=s=>{o(a=>(a?.time!==s?.time&&r.updateKey(t.deepKey,s),s))};return Fo(t.deepKey,s=>{o(s)}),g(BL,{deepKey:t.deepKey,value:n,placeholder:e.placeholder,blockComponents:e.blockComponents,inlineComponents:e.inlineComponents,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur,autosize:e.autosize})}Se();function zL(t){let e=t.field,[n,o]=en(t.deepKey,""),r=X(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return g("div",{className:"DocEditor__SelectField",children:g(Lo,{data:r,placeholder:e.placeholder,value:n,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,clearable:!0,dropdownComponent:"div"})})}Se();function HL(t){let{value:e,variant:n,scrollRef:o}=t,r=e.split(/([\u00A0\u2011])/g);return g("div",{ref:o,className:`StringField__highlighter StringField__highlighter--${n}`,"aria-hidden":"true",children:[r.map((i,s)=>i==="\xA0"||i==="\u2011"?g("span",{className:"StringField__highlight",children:i},s):g("span",{children:i},s)),n==="textarea"&&e.endsWith(`
141
+ `)&&g("br",{})]})}function KL(t){let e=t.field,[n,o]=en(t.deepKey,""),r=Y(null),i=Y(null),[s,a]=R(null),l=h=>{o(h.currentTarget.value)},c=h=>{t.onFocus?.(h),Vn(t.deepKey,{scroll:!0})},d=h=>{t.onBlur?.(h),Vn(null)},u=h=>{let m=h.target.value;if(m.trim()){let _=m;try{let b=m.replace(/'([^'\\]*(?:\\.[^'\\]*)*)'/g,'"$1"').replace(/,\s*([\]}])/g,"$1");JSON.parse(b),_=b}catch{}try{let b=JSON.parse(_),y=JSON.stringify(b,null,2);o(y),a(null)}catch(b){a(b.message)}}else a(null);t.onBlur?.(h),Vn(null)},p=h=>{r.current&&(r.current.scrollTop=h.target.scrollTop,r.current.scrollLeft=h.target.scrollLeft)},f=h=>{i.current&&(i.current.scrollLeft=h.target.scrollLeft)};return e.variant==="json"?g("div",{className:"StringField__container",children:[g(Ao,{className:we("StringField__input","StringField__input--json",s&&"StringField__input--error"),size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||20,value:n,onChange:l,onFocus:c,onBlur:u,onScroll:p}),s&&g("div",{className:"StringField__jsonError",children:["Invalid JSON: ",s]})]}):e.variant==="textarea"?g("div",{className:"StringField__container",children:[g(HL,{value:n||"",variant:"textarea",scrollRef:r}),g(Ao,{className:"StringField__input",size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||12,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:p})]}):g("div",{className:"StringField__container",children:[g(HL,{value:n||"",variant:"input",scrollRef:i}),g(lr,{className:"StringField__input",size:"xs",radius:0,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:f})]})}var jL=Ot({});function Xf(){return It(jL)}function Ne(t){let e=t.docId.split("/")[0],n=dE(e),o=to(),r=n.loading||o.loading,i=n.schema?.fields||[];return g(jL.Provider,{value:n?.schema?.types||{},children:g(Ww,{children:g("div",{className:we(t.className,"DocEditor"),children:[g(Hv,{visible:r,loaderProps:{color:"gray",size:"xl"}}),!r&&!t.hideStatusBar&&g(Ne.StatusBar,{...t,draft:o,collection:n.schema}),g("div",{className:"DocEditor__fields",children:i.map(s=>g(Ne.Field,{field:s,deepKey:`fields.${s.id}`},s.id))})]})})})}Ne.StatusBar=t=>{let{route:e,query:n}=Jv(),{roles:o}=Rd(),r=window.firebase.user.email||"",i=Pd(o,r),s=bE(o,r),a=t.draft,[l,c]=R(a.controller.getData());Fo("sys",S=>{c({sys:S})});let d=Ee(S=>{S==="unlocked"&&a.controller.removePublishingLock()},[a.controller]),u=_E({docId:t.docId,onChange:d}),p=Ee(S=>{if(S.action==="delete"){let N=t.docId.split("/")[0];e(`/cms/content/${N}`)}else S.action==="unlocked"&&a.controller.removePublishingLock()},[t.docId]),f=Ee(()=>{if(!s)return;let S=l?.sys?.publishingLocked;S&&u.open({existingLock:{reason:S.reason,until:S.until?S.until.toMillis():void 0}})},[s,l?.sys?.publishingLocked,u]),h=GE({docId:t.docId}),m=UE(),[_,b]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::checksVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[y,x]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::searchVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[v,E]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::aiVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),C=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai);P(()=>{let S=N=>{b(N.detail===!0)};return window.addEventListener("root:checks-visible",S),()=>window.removeEventListener("root:checks-visible",S)},[]),P(()=>{let S=N=>{x(N.detail===!0)};return window.addEventListener("root:search-visible",S),()=>window.removeEventListener("root:search-visible",S)},[]),P(()=>{let S=N=>{E(N.detail===!0)};return window.addEventListener("root:ai-visible",S),()=>window.removeEventListener("root:ai-visible",S)},[]);let k=n.locale||"",T=n.modal||"";P(()=>{T==="localization"&&a.controller&&m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:k||void 0})},[]);let w=!l?.sys;return w?null:g("div",{className:"DocEditor__statusBar",children:[g("div",{className:"DocEditor__statusBar__viewers",children:g(eT,{id:`doc/${t.docId}`})}),g(Ne.SaveState,{}),l?.sys&&g("div",{className:"DocEditor__statusBar__statusBadges",children:g(fC,{doc:l,docId:t.docId,onPublishingLockClick:s?f:void 0})}),g("div",{className:"DocEditor__statusBar__buttonGroup",children:[g("div",{className:"DocEditor__statusBar__search",children:g(De,{label:"\u2318 + Shift + f",transition:"pop",withArrow:!0,children:g(Q,{className:we("DocEditor__statusBar__buttonGroup__button",y?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(kd,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},children:"Search"})})}),(window.__ROOT_CTX.checks||[]).length>0&&g("div",{className:"DocEditor__statusBar__checks",children:g(Q,{className:we("DocEditor__statusBar__buttonGroup__button",_?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(HC,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-checks"))},children:"Checks"})}),C&&g("div",{className:"DocEditor__statusBar__ai",children:g(De,{label:"\u2318 + i",transition:"pop",withArrow:!0,children:g(Q,{className:we("DocEditor__statusBar__buttonGroup__button",v?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(Ki,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-ai"))},children:"Root AI"})})})]}),g("div",{className:"DocEditor__statusBar__i18n",children:g(Q,{variant:"default",color:"dark",size:"xs",leftIcon:g(YC,{size:16}),onClick:()=>{m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:n.locale||void 0})},children:"Localization"})}),g("div",{className:"DocEditor__statusBar__publishButton",children:w?g(Q,{color:"dark",size:"xs",onClick:()=>h.open(),loading:!0,disabled:!0,children:"Publish"}):sC(l)?g(De,{label:`Scheduled ${Qv(l.sys.scheduledAt)} by ${l.sys.scheduledBy}`,transition:"pop",children:g(Q,{color:"dark",size:"xs",leftIcon:g(dh,{size:16}),disabled:!0,children:"Publish"})}):aC(l)?g(De,{label:hC(l),transition:"pop",children:g(Q,{color:"dark",size:"xs",leftIcon:g(jC,{size:16}),disabled:!0,children:"Publish"})}):g(wE,{label:"You don't have access to publish this document",condition:!i,children:g(Q,{color:"dark",size:"xs",leftIcon:g(dh,{size:16}),onClick:()=>h.open(),disabled:!i,children:"Publish"})})}),g("div",{className:"DocEditor__statusBar__actionsMenu",children:g(TE,{docId:t.docId,data:l,onAction:p})})]})};Ne.SaveState=()=>{let[t,e]=R("NO_CHANGES");return EE(n=>{e(n)}),g("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};Ne.Field=t=>t.field.deprecated?g(Ne.DeprecatedField,{...t}):g(Ne.FieldBody,{...t});Ne.DeprecatedField=t=>{let[e,n]=R(!0),o=Xf();return Fo(t.deepKey,r=>{n(Gi(t.field,r,o))}),e?null:g(Ne.FieldBody,{...t})};Ne.FieldBody=t=>{let e=t.field,n=t.level??0,r=Vl().value===t.deepKey,i=Y(null),s=X(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return P(()=>{r&&Cg(i.current)},[r]),g("div",{className:we("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",r&&"deeplink-target"),"data-type":e.type,"data-level":n,id:t.deepKey,ref:i,children:[s&&g(Ne.FieldHeader,{...t}),g("div",{className:"DocEditor__field__input",children:e.type==="array"?g(Ne.ArrayField,{...t}):e.type==="boolean"?g(tT,{...t}):e.type==="date"?g(nT,{...t}):e.type==="datetime"?g(UT,{...t}):e.type==="file"?g(Bd,{...t}):e.type==="image"?g(jT,{...t}):e.type==="multiselect"?g(VT,{...t}):e.type==="number"?g(WT,{...t}):e.type==="object"?g(Ne.ObjectField,{...t}):e.type==="oneof"?g(Ne.OneOfField,{...t}):e.type==="reference"?g(da,{...t}):e.type==="references"?g(YT,{...t}):e.type==="richtext"?g($L,{...t}):e.type==="select"?g(zL,{...t}):e.type==="string"?g(KL,{...t}):g("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};Ne.FieldHeader=t=>{let e=t.field,n=e.label||e.id,o=Vl(),r=X(()=>Gw(t.deepKey||""),[t.deepKey]);return g("div",{className:we(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?g("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",n]}):g("div",{className:"DocEditor__FieldHeader__label",children:[g("span",{children:n}),t.deepKey&&g("a",{className:"DocEditor__FieldHeader__label__deeplink",href:r,tabIndex:-1,title:"Link to field",onClick:i=>{i.preventDefault(),window.history.replaceState({},"",r),o.setValue(t.deepKey)},children:"#"})]}),e.help&&g("div",{className:"DocEditor__FieldHeader__help",children:e.help}),g(Ne.FieldHeaderTranslationsActionIcon,{field:e,deepKey:t.deepKey})]})};Ne.FieldHeaderTranslationsActionIcon=t=>{let n=!!t.field.translate,r=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];return!n||r.length<=1?null:g(Ne.FieldHeaderTranslationsActionIconInner,{...t})};Ne.FieldHeaderTranslationsActionIconInner=t=>{let e=t.field,n=BE(),o=to(),[r,i]=R(()=>o.controller.getValue(t.deepKey));Fo(t.deepKey,d=>{i(d)});let s=Xf(),a=X(()=>Gi(e,r,s),[e,s,r]),[l,c]=R(!1);return P(()=>{if(!t.deepKey||!o.controller)return;let d=fW(t.deepKey);return o.controller.subscribe(d,p=>{c(p?.disableTranslations||!1)})},[t.deepKey,o.controller]),g("div",{className:"DocEditor__FieldHeader__translate",children:l?g(De,{label:"Translations are disabled",children:g(Be,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;hh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:g(BC,{size:16})})}):a?g("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:g(Hi,{size:16})}):g(De,{label:"Show translations",children:g(Be,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;hh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:g(Hi,{size:16})})})})};Ne.ObjectField=t=>{let e=t.field,n=e.variant;return n||(t.isArrayChild?n="inline":n="drawer"),n==="drawer"?g(Ne.ObjectFieldDrawer,{...t}):g("div",{className:"DocEditor__ObjectField",children:g("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>g(Ne.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};Ne.ObjectFieldDrawer=t=>{let e=t.field,n=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,r=o?"left":"right",i=Vl(),s=!n||i.value.includes(t.deepKey);return g("div",{className:we("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:g("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:s,children:[g("summary",{className:we("DocEditor__ObjectFieldDrawer__drawer__toggle",`DocEditor__ObjectFieldDrawer__drawer__toggle--icon-${r}`),children:[g(Ne.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),g("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:g(Hn,{size:16})})]}),g("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(a=>g(Ne.Field,{field:a,deepKey:`${t.deepKey}.${a.id}`},a.id))})]})})};function cW(t,e){switch(e.type){case"update":{let n=t._new||[];return{...e.newValue,_new:n}}case"updateItem":{let n=t??{},r=[...n._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${r}`,i),{...n,[r]:i}}case"add":{let n=t??{},o=pr(),r=structuredClone(e.defaultValue||{}),i=[...n._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:i,[`${e.deepKey}.${o}`]:r});let s=t._new||[];return{...n,[o]:r,_array:i,_new:[...s,o]}}case"insertBefore":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.defaultValue||{});o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"insertAfter":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.defaultValue||{});o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"duplicate":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.value);o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"moveUp":{if(e.index===0)return t;let n=t??{},o=[...n._array||[]];return UL(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index-1]}}case"moveDown":{let n=t??{},o=[...n._array||[]];return e.index>=o.length-1?t:(UL(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index+1]})}case"moveTo":{let n=t??{},o=[...n._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let r=o[e.fromIndex];return dW(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:r}}case"removeAt":{let n={...t??{}},r=[...n._array||[]],i=r[e.index];return delete n[i],r.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:r}),e.draft.removeKey(`${e.deepKey}.${i}`),{...n,_array:r}}case"pasteAfter":{let n=t??{},o=[...n._array||[]],r=pr(),i=e.data;if(!i)return ke({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}case"pasteBefore":{let n=t??{},o=[...n._array||[]],r=pr(),i=e.data;if(!i)return ke({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}default:return console.error("unknown action",e),t}}Ne.ArrayField=t=>{let e=to().controller,n=t.field,[o,r]=Lv(cW,{_array:[]}),i=Vl(),s=Yw(),a=window.__ROOT_CTX.experiments||{},c=(o??{})._array||[],d=o._new||[],[u,p]=R(null);Fo(t.deepKey,B=>{r({type:"update",newValue:B})}),P(()=>{o._moved?k(t.deepKey,c.indexOf(o._moved)):o._pasted&&k(t.deepKey,c.indexOf(o._pasted))},[o]);let f=B=>{let se=c[B],me=`${t.deepKey}.${se}`;return e.getValue(me)||{}},h=()=>{r({type:"add",draft:e,deepKey:t.deepKey,defaultValue:n.itemDefault||{}})},m=(B,se)=>{r({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:B,data:se})},_=(B,se)=>{r({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:B,data:se})},b=async B=>{m(B,await s.get())},y=async B=>{_(B,await s.get())},x=B=>{r({type:"insertBefore",draft:e,deepKey:t.deepKey,index:B,defaultValue:n.itemDefault||{}})},v=B=>{r({type:"insertAfter",draft:e,deepKey:t.deepKey,index:B,defaultValue:n.itemDefault||{}})},E=B=>{r({type:"duplicate",draft:e,deepKey:t.deepKey,index:B,value:f(B)})},C=B=>{r({type:"removeAt",draft:e,deepKey:t.deepKey,index:B})},k=(B,se)=>{document.getElementById(`summary-for-${B}.${c[se]}`)?.focus()},T=B=>{B>0&&r({type:"moveUp",draft:e,deepKey:t.deepKey,index:B})},w=B=>{B<c.length-1&&r({type:"moveDown",draft:e,deepKey:t.deepKey,index:B})},S=B=>{let se=f(B);s.set(se),p(null),ke({message:"Copied to clipboard",autoClose:2e3})},N=B=>{let se=f(B);s.set(se),p(B),ke({message:"Cut to clipboard",autoClose:2e3})},D=async B=>{let se=await s.get();if(!se){ke({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}if(_(B,se),u!==null){let me=u;B<u&&(me+=1),C(me),p(null)}ke({message:"Pasted item",autoClose:2e3})},O=LE(),M=ME(),I=B=>{let se=f(B);O.open({data:se,onSave:me=>{console.log("[edit json] onSave()",me),r({type:"updateItem",draft:e,index:B,newValue:me,deepKey:t.deepKey}),O.close()}})},L=B=>{let se=f(B);M.open({data:se,onSave:me=>{console.log("[ai edit] onSave()",me),r({type:"updateItem",draft:e,index:B,newValue:me,deepKey:t.deepKey}),M.close()}})};function K(B){return!!i.value.startsWith(`${t.deepKey}.${B}`)}let W=Ee((B,se)=>{if(!B.target)return;let me=c.indexOf(se);B.metaKey&&B.key==="x"?(B.preventDefault(),N(me)):B.metaKey&&B.key==="c"?(B.preventDefault(),S(me)):B.metaKey&&B.key==="v"?(B.preventDefault(),D(me)):B.metaKey&&(B.key==="Backspace"||B.key==="Delete")?(B.preventDefault(),C(me),ke({message:"Deleted item",autoClose:2e3})):B.key==="ArrowUp"?(B.preventDefault(),T(me)):B.key==="ArrowDown"?(B.preventDefault(),w(me)):B.key==="ArrowLeft"?B.target.closest("details").open=!1:B.key==="ArrowRight"&&(B.target.closest("details").open=!0)},[t.deepKey,c,u]),q=g("div",{className:"DocEditor__ArrayField__add",children:[g(Q,{className:"DocEditor__ArrayField__add__button",color:"dark",size:"xs",leftIcon:g(CC,{size:16}),onClick:()=>h(),children:n.buttonLabel||"Add"}),g(ne,{className:"DocEditor__ArrayField__add__menu",control:g(Be,{className:"DocEditor__ArrayField__item__header__controls__dots",children:g(ah,{size:16})}),children:[g(ne.Label,{children:"CLIPBOARD"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Sd,{size:18}),onClick:()=>D(c.length-1),children:"Paste item to end"})]})]});return c.length===0&&!o._new?g("div",{className:"DocEditor__ArrayField",children:[g("div",{className:"DocEditor__ArrayField__items",children:g("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),q]}):g("div",{className:"DocEditor__ArrayField",children:[g(nu,{onDragEnd:B=>{let{source:se,destination:me}=B;me&&r({type:"moveTo",fromIndex:se.index,toIndex:me.index,draft:e,deepKey:t.deepKey})},children:g(ru,{droppableId:"dnd-list",direction:"vertical",children:B=>g("div",{...B.droppableProps,ref:B.innerRef,className:"DocEditor__ArrayField__items",children:[c.map((se,me)=>g(Ne.ArrayFieldItem,{field:n,parentDeepKey:t.deepKey,itemKey:se,index:me,initialOpen:d.includes(se)||K(se)||!!n.defaultOpen,isCut:u===me,aiEnabled:!!a.ai,onFocusHeader:k,onHeaderKeyDown:W,onMoveUp:T,onMoveDown:w,onInsertBefore:x,onInsertAfter:v,onDuplicate:E,onCopy:S,onPasteBefore:b,onPasteAfter:y,onEditJson:I,onAiEdit:L,onRemove:C},se)),B.placeholder]})})}),q]})};Ne.ArrayFieldItem=t=>{let e=`${t.parentDeepKey}.${t.itemKey}`;return g(ou,{index:t.index,draggableId:t.itemKey,children:(n,o)=>g("div",{ref:n.innerRef,...n.draggableProps,className:we("DocEditor__ArrayField__item__wrapper",o.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging",t.isCut&&"DocEditor__ArrayField__item__wrapper--cut"),children:[g("div",{className:"DocEditor__ArrayField__item__handle",...n.dragHandleProps,onClick:()=>t.onFocusHeader(t.parentDeepKey,t.index),children:g(vd,{size:18,stroke:"1.5"})}),g("details",{className:"DocEditor__ArrayField__item",open:t.initialOpen,onToggle:r=>{r.target.open?Vn(e,{scroll:!0}):Vn(null)},onMouseEnter:()=>{Vn(e)},onMouseLeave:()=>{Vn(null)},children:[g("summary",{id:`summary-for-${e}`,className:"DocEditor__ArrayField__item__header",onKeyDown:r=>t.onHeaderKeyDown(r,t.itemKey),tabIndex:0,children:[g("div",{className:"DocEditor__ArrayField__item__header__icon",children:g(nE,{size:6})}),g(Ne.ArrayFieldPreview,{field:t.field,deepKey:e,index:t.index}),g("div",{className:"DocEditor__ArrayField__item__header__controls",children:[g("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[g("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>t.onMoveUp(t.index),children:g(vC,{size:20,strokeWidth:1.75})}),g("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>t.onMoveDown(t.index),children:g(xC,{size:20,strokeWidth:1.75})})]}),g(ne,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:g(Be,{className:"DocEditor__ArrayField__item__header__controls__dots",children:g(ah,{size:16})}),children:[g(ne.Label,{children:"INSERT"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(uh,{size:18}),onClick:()=>t.onInsertBefore(t.index),children:"Add before"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Sd,{size:18}),onClick:()=>t.onInsertAfter(t.index),children:"Add after"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(TC,{size:18}),onClick:()=>t.onDuplicate(t.index),children:"Duplicate"}),g(ne.Label,{children:"CLIPBOARD"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(EC,{size:18}),onClick:()=>t.onCopy(t.index),children:"Copy"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(uh,{size:18}),onClick:()=>t.onPasteBefore(t.index),children:"Paste before"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Sd,{size:18}),onClick:()=>t.onPasteAfter(t.index),children:"Paste after"}),g(ne.Label,{children:"CODE"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(_C,{size:18}),onClick:()=>t.onEditJson(t.index),children:"Edit JSON"}),t.aiEnabled&&g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g($d,{size:16}),onClick:()=>t.onAiEdit(t.index),children:"Edit with Root AI"}),g(ne.Label,{children:"REMOVE"}),g(ne.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Po,{size:18}),onClick:()=>t.onRemove(t.index),children:"Remove"})]})]})]}),g("div",{className:"DocEditor__ArrayField__item__body",children:g(Ne.Field,{field:t.field.of,deepKey:e,hideHeader:!0,isArrayChild:!0,onFocus:()=>{Vn(e,{scroll:!0})},onBlur:()=>{Vn(null)}},e)})]})]})},t.itemKey)};Ne.ArrayFieldPreview=t=>{let e=to().controller,n=Xf(),[o,r]=R(e.getValue(t.deepKey)),i=X(()=>uW(t.field,o,n),[t.field,n,o]),s=X(()=>pW(t.field,o,t.index,n),[t.field,t.index,n,o]),a=X(()=>vE(l=>{r(l&&typeof l=="object"?{...l}:l)},250),[]);return P(()=>e.subscribeSubtree(t.deepKey,a),[t.deepKey,e,a]),g("div",{className:"DocEditor__ArrayField__item__header__preview",children:[i&&g("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:g("img",{src:i,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),g("div",{className:"DocEditor__ArrayField__item__header__preview__title","data-preview":s})]})};Ne.OneOfField=t=>{let e=t.field,n=e.variant||window.__ROOT_CTX.defaultOneOfVariant||"dropdown",[o,r]=R(""),i=Xf(),s=Array.isArray(e.types)?e.types:[],a={},l=[],c=[{value:"",label:e.placeholder||"Select type"}];s.forEach(v=>{let E,C;typeof v=="string"?(E=i[v],C=v):(E=v,C=v.name),C&&(E&&(a[C]=E,l.push(E)),c.push({value:C,label:C}))});let d=a[o||""],u=to().controller,p=AE(),f=X(()=>({}),[]);async function h(v,E){let C={};if(v){let k=a[v];if(E&&k){let T=Xs(k),w=uE(k,E,i);Object.assign(C,pC(T,w))}else v in f?Object.assign(C,f[v]):k&&Object.assign(C,Xs(k))}C._type=v,await u.updateKey(t.deepKey,C),r(v)}async function m(v){await h(v)}Fo(t.deepKey,v=>{v?._type&&(r(v._type||""),f[v._type]=v)});function _(v){let E=v.target;E&&E.select&&E.select()}function b(){let v=[];return l.forEach(E=>{v.push({key:`${E.name}::__blank__`,schema:E}),(E.presets||[]).forEach(C=>{v.push({key:`${E.name}::${C.id}`,schema:E,preset:C})})}),v}function y(){p.open({options:b(),onSelect:async v=>{await h(v.schema.name,v.preset?.data),p.close()},onRemove:d?async()=>{await h(""),p.close()}:void 0})}let x=d&&g("div",{className:"DocEditor__OneOfField__fields",children:d.fields.map(v=>g(Ne.Field,{field:v,deepKey:`${t.deepKey}.${v.id}`,onBlur:()=>{Vn(null)},onFocus:()=>{Vn(`${t.deepKey}.${v.id}`,{scroll:!0})}},`${o}::${v.id}`))});if(n==="picker"){let v=d?d.label||d.name:e.placeholder||"Select type";return g("div",{className:"DocEditor__OneOfField DocEditor__OneOfField--picker",children:[g("div",{className:"DocEditor__OneOfField__pickerButton",children:[g("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),g(Q,{variant:"default",color:"dark",size:"xs",onClick:y,rightIcon:g(Hn,{size:16}),children:v})]}),x]})}return g("div",{className:"DocEditor__OneOfField",children:[g("div",{className:"DocEditor__OneOfField__select",children:[g("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),g(Lo,{data:c,value:o,placeholder:e.placeholder,onChange:v=>m(v||""),onFocus:_,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),x]})};function UL(t,e,n){if(t.length<=1)return t;let o=t[e];return t[e]=t[n],t[n]=o,t}function dW(t,e,n){let[o]=t.splice(e,1);t.splice(n,0,o)}function VL(t,e,n,o="title"){if(t.type==="oneof"){let r=t,i=e?._type;if(i){let s,a=Array.isArray(r.types)?r.types:[];return typeof a[0]=="string"?s=n[i]:s=a.find(l=>l.name===i),s?.preview?.[o]||null}}return null}function uW(t,e,n){let o=VL(t.of,e,n,"image");if(o)return ia(o,e)}function pW(t,e,n,o){let r=VL(t.of,e,o,"title");if(r){let i=ia(r,e,{index:n});if(i)return i}return t.preview?ia(t.preview,e,{index:n})??`item ${n}`:`item ${n}`}function fW(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}export{cR as a,_h as b,LE as c,pR as d,xh as e,vh as f,Bo as g,bR as h,sv as i,av as j,are as k,FL as l,Ne as m,Hg as n};