@grapesjs/studio-sdk-plugins 1.0.15 → 1.0.16

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 (66) hide show
  1. package/dist/accordionComponent/index.cjs.js +3 -3
  2. package/dist/accordionComponent/index.es.js +29 -30
  3. package/dist/accordionComponent/index.umd.js +4 -4
  4. package/dist/canvasEmptyState/index.cjs.js +1 -1
  5. package/dist/canvasEmptyState/index.es.js +14 -15
  6. package/dist/canvasEmptyState/index.umd.js +1 -1
  7. package/dist/canvasFullSize/index.cjs.d.ts +2 -2
  8. package/dist/canvasFullSize/index.cjs.js +1 -1
  9. package/dist/canvasFullSize/index.d.ts +2 -2
  10. package/dist/canvasFullSize/index.es.d.ts +2 -2
  11. package/dist/canvasFullSize/index.es.js +2 -3
  12. package/dist/canvasFullSize/index.umd.js +2 -2
  13. package/dist/canvasFullSize/types.d.ts +1 -1
  14. package/dist/dialogComponent/index.cjs.js +2 -2
  15. package/dist/dialogComponent/index.es.js +2 -3
  16. package/dist/dialogComponent/index.umd.js +2 -2
  17. package/dist/flexComponent/index.cjs.js +1 -1
  18. package/dist/flexComponent/index.es.js +2 -3
  19. package/dist/flexComponent/index.umd.js +1 -1
  20. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  21. package/dist/fsLightboxComponent/index.es.js +2 -3
  22. package/dist/fsLightboxComponent/index.umd.js +2 -2
  23. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  24. package/dist/googleFontsAssetProvider/index.es.js +39 -40
  25. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  26. package/dist/iconifyComponent/index.cjs.js +2 -2
  27. package/dist/iconifyComponent/index.es.js +31 -32
  28. package/dist/iconifyComponent/index.umd.js +2 -2
  29. package/dist/index.cjs.d.ts +1 -0
  30. package/dist/index.cjs.js +42 -42
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.es.d.ts +1 -0
  33. package/dist/index.es.js +3171 -2944
  34. package/dist/index.umd.js +36 -36
  35. package/dist/layoutSidebarButtons/index.cjs.d.ts +3 -0
  36. package/dist/layoutSidebarButtons/index.cjs.js +1 -0
  37. package/dist/layoutSidebarButtons/index.d.ts +3 -0
  38. package/dist/layoutSidebarButtons/index.es.d.ts +3 -0
  39. package/dist/layoutSidebarButtons/index.es.js +328 -0
  40. package/dist/layoutSidebarButtons/index.umd.js +1 -0
  41. package/dist/layoutSidebarButtons/layout.d.ts +8 -0
  42. package/dist/layoutSidebarButtons/types.d.ts +75 -0
  43. package/dist/layoutSidebarButtons/typesSchema.d.ts +49 -0
  44. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  45. package/dist/lightGalleryComponent/index.es.js +2 -3
  46. package/dist/lightGalleryComponent/index.umd.js +1 -1
  47. package/dist/listPagesComponent/index.cjs.js +3 -3
  48. package/dist/listPagesComponent/index.es.js +2 -3
  49. package/dist/listPagesComponent/index.umd.js +3 -3
  50. package/dist/prosemirror/index.cjs.js +2 -2
  51. package/dist/prosemirror/index.es.js +3 -4
  52. package/dist/prosemirror/index.umd.js +2 -2
  53. package/dist/rteTinyMce/index.cjs.js +1 -1
  54. package/dist/rteTinyMce/index.es.js +20 -21
  55. package/dist/rteTinyMce/index.umd.js +1 -1
  56. package/dist/swiperComponent/index.cjs.js +3 -3
  57. package/dist/swiperComponent/index.es.js +2 -3
  58. package/dist/swiperComponent/index.umd.js +3 -3
  59. package/dist/tableComponent/index.cjs.js +1 -1
  60. package/dist/tableComponent/index.es.js +13 -14
  61. package/dist/tableComponent/index.umd.js +1 -1
  62. package/dist/types.d.ts +4 -3
  63. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  64. package/dist/youtubeAssetProvider/index.es.js +7 -8
  65. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  66. package/package.json +1 -1
package/dist/index.umd.js CHANGED
@@ -1,13 +1,13 @@
1
- (function(F,Dt){typeof exports=="object"&&typeof module<"u"?Dt(exports,require("grapesjs")):typeof define=="function"&&define.amd?define(["exports","grapesjs"],Dt):(F=typeof globalThis<"u"?globalThis:F||self,Dt(F.StudioSdkPlugins={}))})(this,function(F){"use strict";const Dt="app.grapesjs.com",Di="app-stage.grapesjs.com",zi=[Dt,Di,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Uc="license:check:start",Zc="license:check:end",Yc=()=>typeof window<"u",Xc=({isDev:n,isStage:e})=>`${n?"":`https://${e?Di:Dt}`}/api`,Qc=()=>{const n=Yc()&&window.location.hostname;return!!n&&(zi.includes(n)||zi.some(e=>n.endsWith(e)))},ed=n=>n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase()),td=n=>typeof n<"u";function Jn(n){return typeof n=="function"}async function nd({path:n,baseApiUrl:e,method:t="GET",headers:s={},params:o,body:i}){const l=`${e||Xc({isDev:!1,isStage:!1})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...s}};i&&(a.body=JSON.stringify(i));const c=o?new URLSearchParams(o).toString():"",d=c?`?${c}`:"",u=await fetch(`${l}${d}`,a);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var W=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(W||{}),Vi=(n=>(n.Info="info",n.Error="error",n.Success="success",n.Warning="warning",n))(Vi||{}),G=(n=>(n.toastAdd="studio:toastAdd",n.dialogOpen="studio:dialogOpen",n.dialogClose="studio:dialogClose",n.sidebarLeftSet="studio:sidebarLeft:set",n.sidebarLeftGet="studio:sidebarLeft:get",n.sidebarLeftToggle="studio:sidebarLeft:toggle",n.sidebarRightSet="studio:sidebarRight:set",n.sidebarRightGet="studio:sidebarRight:get",n.sidebarRightToggle="studio:sidebarRight:toggle",n.sidebarTopSet="studio:sidebarTop:set",n.sidebarTopGet="studio:sidebarTop:get",n.sidebarTopToggle="studio:sidebarTop:toggle",n.sidebarBottomSet="studio:sidebarBottom:set",n.sidebarBottomGet="studio:sidebarBottom:get",n.sidebarBottomToggle="studio:sidebarBottom:toggle",n.symbolAdd="studio:symbolAdd",n.symbolDetach="studio:symbolDetach",n.symbolOverride="studio:symbolOverride",n.symbolPropagateStyles="studio:propagateStyles",n.getPagesConfig="studio:getPagesConfig",n.setPagesConfig="studio:setPagesConfig",n.getPageSettings="studio:getPageSettings",n.setPageSettings="studio:setPageSettings",n.projectFiles="studio:projectFiles",n.canvasReload="studio:canvasReload",n.getBlocksPanel="studio:getBlocksPanel",n.setBlocksPanel="studio:setBlocksPanel",n.getStateContextMenu="studio:getStateContextMenu",n.setStateContextMenu="studio:setStateContextMenu",n.contextMenuComponent="studio:contextMenuComponent",n.layoutAdd="studio:layoutAdd",n.layoutRemove="studio:layoutRemove",n.layoutToggle="studio:layoutToggle",n.layoutUpdate="studio:layoutUpdate",n.layoutGet="studio:layoutGet",n.getStateTheme="studio:getStateTheme",n.setStateTheme="studio:setStateTheme",n.assetProviderGet="studio:assetProviderGet",n.assetProviderAdd="studio:assetProviderAdd",n.assetProviderRemove="studio:assetProviderRemove",n.fontGet="studio:fontGet",n.fontAdd="studio:fontAdd",n.fontRemove="studio:fontRemove",n))(G||{}),Li=(n=>(n.dark="dark",n.light="light",n.auto="auto",n))(Li||{}),Bi=(n=>(n.web="web",n.email="email",n))(Bi||{});const Hi={[W.free]:0,[W.startup]:10,[W.business]:20,[W.enterprise]:30};function sd(n){const e=n;return e.init=t=>s=>n(s,t),e}const ne=n=>sd(n);async function se({editor:n,plan:e,pluginName:t,licenseKey:s,cleanup:o}){let i="",r=!1;const l=Qc(),a=d=>{console.warn("Cleanup plugin:",t,"Reason:",d),o()},c=(d={})=>{var m;const{error:u,sdkLicense:h}=d,f=(m=d.plan)==null?void 0:m.category;if(!(h||d.license)||u)a(u||"Invalid license");else if(f){const g=Hi[e],b=Hi[f];g>b&&a({pluginRequiredPlan:e,licensePlan:f})}};n.on(Uc,d=>{i=d==null?void 0:d.baseApiUrl,r=!0}),n.on(Zc,d=>{c(d)}),setTimeout(async()=>{if(!r){if(l)return;if(s){const d=await od({licenseKey:s,pluginName:t,baseApiUrl:i});d&&c(d)}else a("The `licenseKey` option not provided")}},2e3)}async function od(n){const{licenseKey:e,pluginName:t,baseApiUrl:s}=n;try{return(await nd({baseApiUrl:s,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const Un=(n,e)=>{var t;return!!((t=n==null?void 0:n.hasAttribute)!=null&&t.call(n,e))},ct=(n,e)=>{var t;return!!((t=n==null?void 0:n.classList)!=null&&t.contains(e))},dt=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,qe))===n},Ys=(...n)=>e=>n.some(t=>e.is(t)),$i=(...n)=>(e,t)=>n.some(s=>t.is(s)),id=(n,e={})=>{var i;const t={},s=[],o=[];for(const r in n){const{value:l,...a}=n[r];s.push({id:r,name:r,changeProp:!0,category:e.category,...a}),t[r]=l,!td(l)&&o.push(r);const{subTraits:c={}}=a;for(const d in a.subTraits)(i=c[d])==null||i.forEach(u=>{const h=u.id||u.name;t[h]=u.value})}return{propKeys:Object.keys(t),propsNoValues:o,props:t,traits:s}},rd=(n,e)=>{e.forEach(t=>{if(t.subTraits){const s=`${t.id||t.name}`,o=t.changeProp?`change:${s}`:`change:attributes:${s}`;n.on(o,()=>Fi(n,s)),Fi(n,s)}})},Fi=(n,e)=>{const t=n.getTrait(e),s=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(r);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:s,...c})),{at:a})},ld=(n,e)=>{e.forEach(t=>{const s=ed(t);s!==t&&n.has(s)&&n.set({[t]:n.get(s),[s]:void 0})})},De="gjs-plg-",qe="data-type-role",Wi=(...n)=>n.map(e=>`[data-gjs-type="${e}"]`).join(","),ad="dialogComponent",cd=ne(function(n,e={}){const{Blocks:t,Components:s}=n,{licenseKey:o}=e,i="gjs-plg-dialog",r="gjs-plg-dialog-overlay",l="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",d="gjs-plg-dialog-body",u="gjs-plg-dialog-description",h="gjs-plg-dialog-placeholder";t.add(i,{label:"Dialog",media:`
1
+ (function($,zt){typeof exports=="object"&&typeof module<"u"?zt(exports):typeof define=="function"&&define.amd?define(["exports"],zt):($=typeof globalThis<"u"?globalThis:$||self,zt($.StudioSdkPlugins={}))})(this,function($){"use strict";const zt="app.grapesjs.com",Bi="app-stage.grapesjs.com",Hi=[zt,Bi,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],rd="license:check:start",ld="license:check:end",ad=()=>typeof window<"u",cd=({isDev:n,isStage:e})=>`${n?"":`https://${e?Bi:zt}`}/api`,dd=()=>{const n=ad()&&window.location.hostname;return!!n&&(Hi.includes(n)||Hi.some(e=>n.endsWith(e)))},ud=n=>n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase()),hd=n=>typeof n<"u";function Un(n){return typeof n=="function"}async function fd({path:n,baseApiUrl:e,method:t="GET",headers:s={},params:o,body:i}){const l=`${e||cd({isDev:!1,isStage:!1})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...s}};i&&(a.body=JSON.stringify(i));const c=o?new URLSearchParams(o).toString():"",d=c?`?${c}`:"",u=await fetch(`${l}${d}`,a);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var F=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(F||{}),$i=(n=>(n.Info="info",n.Error="error",n.Success="success",n.Warning="warning",n))($i||{}),B=(n=>(n.toastAdd="studio:toastAdd",n.dialogOpen="studio:dialogOpen",n.dialogClose="studio:dialogClose",n.sidebarLeftSet="studio:sidebarLeft:set",n.sidebarLeftGet="studio:sidebarLeft:get",n.sidebarLeftToggle="studio:sidebarLeft:toggle",n.sidebarRightSet="studio:sidebarRight:set",n.sidebarRightGet="studio:sidebarRight:get",n.sidebarRightToggle="studio:sidebarRight:toggle",n.sidebarTopSet="studio:sidebarTop:set",n.sidebarTopGet="studio:sidebarTop:get",n.sidebarTopToggle="studio:sidebarTop:toggle",n.sidebarBottomSet="studio:sidebarBottom:set",n.sidebarBottomGet="studio:sidebarBottom:get",n.sidebarBottomToggle="studio:sidebarBottom:toggle",n.symbolAdd="studio:symbolAdd",n.symbolDetach="studio:symbolDetach",n.symbolOverride="studio:symbolOverride",n.symbolPropagateStyles="studio:propagateStyles",n.getPagesConfig="studio:getPagesConfig",n.setPagesConfig="studio:setPagesConfig",n.getPageSettings="studio:getPageSettings",n.setPageSettings="studio:setPageSettings",n.projectFiles="studio:projectFiles",n.canvasReload="studio:canvasReload",n.getBlocksPanel="studio:getBlocksPanel",n.setBlocksPanel="studio:setBlocksPanel",n.getStateContextMenu="studio:getStateContextMenu",n.setStateContextMenu="studio:setStateContextMenu",n.contextMenuComponent="studio:contextMenuComponent",n.layoutAdd="studio:layoutAdd",n.layoutRemove="studio:layoutRemove",n.layoutToggle="studio:layoutToggle",n.layoutUpdate="studio:layoutUpdate",n.layoutGet="studio:layoutGet",n.layoutConfigGet="studio:layoutConfigGet",n.layoutConfigSet="studio:layoutConfigSet",n.getStateTheme="studio:getStateTheme",n.setStateTheme="studio:setStateTheme",n.assetProviderGet="studio:assetProviderGet",n.assetProviderAdd="studio:assetProviderAdd",n.assetProviderRemove="studio:assetProviderRemove",n.fontGet="studio:fontGet",n.fontAdd="studio:fontAdd",n.fontRemove="studio:fontRemove",n))(B||{}),Fi=(n=>(n.layoutToggleId="studio:layoutToggle:",n.toggleBlocksPanel="studio:toggleBlocksPanel",n.pageSettingsUpdate="studio:pageSettingsUpdate",n))(Fi||{}),Wi=(n=>(n.dark="dark",n.light="light",n.auto="auto",n))(Wi||{}),_i=(n=>(n.web="web",n.email="email",n))(_i||{});const qi={[F.free]:0,[F.startup]:10,[F.business]:20,[F.enterprise]:30};function pd(n){const e=n;return e.init=t=>s=>n(s,t),e}const X=n=>pd(n);async function Q({editor:n,plan:e,pluginName:t,licenseKey:s,cleanup:o}){let i="",r=!1;const l=dd(),a=d=>{console.warn("Cleanup plugin:",t,"Reason:",d),o()},c=(d={})=>{var m;const{error:u,sdkLicense:h}=d,f=(m=d.plan)==null?void 0:m.category;if(!(h||d.license)||u)a(u||"Invalid license");else if(f){const g=qi[e],b=qi[f];g>b&&a({pluginRequiredPlan:e,licensePlan:f})}};n.on(rd,d=>{i=d==null?void 0:d.baseApiUrl,r=!0}),n.on(ld,d=>{c(d)}),setTimeout(async()=>{if(!r){if(l)return;if(s){const d=await md({licenseKey:s,pluginName:t,baseApiUrl:i});d&&c(d)}else a("The `licenseKey` option not provided")}},2e3)}async function md(n){const{licenseKey:e,pluginName:t,baseApiUrl:s}=n;try{return(await fd({baseApiUrl:s,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const Zn=(n,e)=>{var t;return!!((t=n==null?void 0:n.hasAttribute)!=null&&t.call(n,e))},dt=(n,e)=>{var t;return!!((t=n==null?void 0:n.classList)!=null&&t.contains(e))},ut=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,qe))===n},Qs=(...n)=>e=>n.some(t=>e.is(t)),Gi=(...n)=>(e,t)=>n.some(s=>t.is(s)),gd=(n,e={})=>{var i;const t={},s=[],o=[];for(const r in n){const{value:l,...a}=n[r];s.push({id:r,name:r,changeProp:!0,category:e.category,...a}),t[r]=l,!hd(l)&&o.push(r);const{subTraits:c={}}=a;for(const d in a.subTraits)(i=c[d])==null||i.forEach(u=>{const h=u.id||u.name;t[h]=u.value})}return{propKeys:Object.keys(t),propsNoValues:o,props:t,traits:s}},yd=(n,e)=>{e.forEach(t=>{if(t.subTraits){const s=`${t.id||t.name}`,o=t.changeProp?`change:${s}`:`change:attributes:${s}`;n.on(o,()=>ji(n,s)),ji(n,s)}})},ji=(n,e)=>{const t=n.getTrait(e),s=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(r);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:s,...c})),{at:a})},bd=(n,e)=>{e.forEach(t=>{const s=ud(t);s!==t&&n.has(s)&&n.set({[t]:n.get(s),[s]:void 0})})},De="gjs-plg-",qe="data-type-role",Ki=(...n)=>n.map(e=>`[data-gjs-type="${e}"]`).join(","),vd="dialogComponent",Sd=X(function(n,e={}){const{Blocks:t,Components:s}=n,{licenseKey:o}=e,i="gjs-plg-dialog",r="gjs-plg-dialog-overlay",l="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",d="gjs-plg-dialog-body",u="gjs-plg-dialog-description",h="gjs-plg-dialog-placeholder";t.add(i,{label:"Dialog",media:`
2
2
  <svg viewBox="0 0 24 24">
3
3
  <path d="M4 4h16v10H8l-4 4V4z"></path>
4
4
  </svg>
5
- `,category:"Extra",content:{type:i},activate:!0,...e.block}),s.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:r},{type:h}],draggable:Wi("wrapper"),droppable:Wi(i),styles:`
5
+ `,category:"Extra",content:{type:i},activate:!0,...e.block}),s.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:r},{type:h}],draggable:Ki("wrapper"),droppable:Ki(i),styles:`
6
6
  .${i} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
10
- `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(p){var m;(m=p.getSelected())==null||m.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(p){const m=this;function g(v){const w=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),S=m.querySelector('[data-type-role="gjs-plg-dialog-close"]');function k(){w.style.display="none"}v?(m._onCloseWhenPressingX=k,S.addEventListener("click",m._onCloseWhenPressingX)):(S.removeEventListener("click",m._onCloseWhenPressingX),m._onCloseWhenPressingX=null)}function b(v){const w=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function S(k){k.key==="Escape"&&(w.style.display="none")}v?(m._onCloseWhenPressingEsc=S,m.addEventListener("keydown",m._onCloseWhenPressingEsc)):(m.removeEventListener("keydown",m._onCloseWhenPressingEsc),m._onCloseWhenPressingEsc=null)}function C(v){const w=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function S(){w.style.display="flex"}v?(m._onOpenWhenLeavingWindow=S,document.addEventListener("mouseleave",m._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",m._onOpenWhenLeavingWindow),m._onOpenWhenLeavingWindow=null)}function y(v){const w=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function S(){const k=document.documentElement.scrollTop;v&&k>=Number(v)&&(w.style.display="flex")}v?(m._onOpenWhenScrollingToLevel=S,document.addEventListener("scroll",m._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",m._onOpenWhenScrollingToLevel),m._onOpenWhenScrollingToLevel=null)}g(p.closeWhenPressingX),b(p.closeWhenPressingEsc),C(p.openWhenLeavingWindow),y(p.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const m=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');m.style.display="flex"})}},view:{onActive(){const p=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');p.style.display="flex"}}}),s.addType(r,{model:{defaults:{tagName:"div",attributes:{class:r,"data-type-role":r},components:{type:l},droppable:!1,draggable:!1,styles:`
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(p){var m;(m=p.getSelected())==null||m.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(p){const m=this;function g(v){const S=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),w=m.querySelector('[data-type-role="gjs-plg-dialog-close"]');function k(){S.style.display="none"}v?(m._onCloseWhenPressingX=k,w.addEventListener("click",m._onCloseWhenPressingX)):(w.removeEventListener("click",m._onCloseWhenPressingX),m._onCloseWhenPressingX=null)}function b(v){const S=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(k){k.key==="Escape"&&(S.style.display="none")}v?(m._onCloseWhenPressingEsc=w,m.addEventListener("keydown",m._onCloseWhenPressingEsc)):(m.removeEventListener("keydown",m._onCloseWhenPressingEsc),m._onCloseWhenPressingEsc=null)}function C(v){const S=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(){S.style.display="flex"}v?(m._onOpenWhenLeavingWindow=w,document.addEventListener("mouseleave",m._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",m._onOpenWhenLeavingWindow),m._onOpenWhenLeavingWindow=null)}function y(v){const S=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(){const k=document.documentElement.scrollTop;v&&k>=Number(v)&&(S.style.display="flex")}v?(m._onOpenWhenScrollingToLevel=w,document.addEventListener("scroll",m._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",m._onOpenWhenScrollingToLevel),m._onOpenWhenScrollingToLevel=null)}g(p.closeWhenPressingX),b(p.closeWhenPressingEsc),C(p.openWhenLeavingWindow),y(p.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const m=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');m.style.display="flex"})}},view:{onActive(){const p=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');p.style.display="flex"}}}),s.addType(r,{model:{defaults:{tagName:"div",attributes:{class:r,"data-type-role":r},components:{type:l},droppable:!1,draggable:!1,styles:`
11
11
  .${r} {
12
12
  position: fixed;
13
13
  top: 0;
@@ -56,24 +56,24 @@
56
56
  .${u} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),s.addType(h,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:h,"data-type-role":h},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:p,el:m}=this,g="core:preview",b=p.Commands.events;this.listenTo(p,`${b.runCommand}${g}`,()=>{m.style.display="none"}),this.listenTo(p,`${b.stopCommand}${g}`,()=>{m.style.display=""})}}}),se({editor:n,licenseKey:o,plan:W.startup,pluginName:ad,cleanup:()=>{t.remove(i),s.removeType(i)}})}),dd={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},Xs=`<svg viewBox="0 0 24 24">
59
+ `}}}),s.addType(h,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:h,"data-type-role":h},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:p,el:m}=this,g="core:preview",b=p.Commands.events;this.listenTo(p,`${b.runCommand}${g}`,()=>{m.style.display="none"}),this.listenTo(p,`${b.stopCommand}${g}`,()=>{m.style.display=""})}}}),Q({editor:n,licenseKey:o,plan:F.startup,pluginName:vd,cleanup:()=>{t.remove(i),s.removeType(i)}})}),wd={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},eo=`<svg viewBox="0 0 24 24">
60
60
  <path d="M19 0H9C7.9 0 7 .9 7 2V18C7 19.1 7.9 20 9 20H19C20.1 20 21 19.1 21 18V2C21 .9 20.1 0 19 0M19 18H9V2H19V18M3 4V22C3 23.1 3.9 24 5 24H17V22H5V4H3M14 5L11 10L14 15L17 10L14 5Z" />
61
- </svg>`,_i="layout-icon-picker",ud="icons-layout-",qi="icons-list-layout",Gi="gs-iconify-picker",Qs="__iconify_collection",hd="https://api.iconify.design",eo=new Map;let Zn;const fd=({collectionId:n})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${n}@latest/icons.json`;async function ji({collectionId:n,editor:e}){try{if(eo.has(n))return eo.get(n);const t=await fetch(fd({collectionId:n}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const s=await t.json();return eo.set(n,s),s}catch(t){console.error("Error fetching collection",t),e.runCommand(G.toastAdd,Sd());return}}async function pd({collectionIds:n,editor:e}){try{if(Zn)return Zn;const t=n?`?prefixes=${n.join(",")}`:"",s=await fetch(`${hd}/collections${t}`);if(!s.ok)throw new Error(`Failed to fetch collections: ${s.statusText}`);return Zn=await s.json(),Zn}catch(t){console.error("Error fetching collections",t),e.runCommand(G.toastAdd,Ji());return}}function Ki(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(n){var e;(e=n.getSelected())==null||e.trigger("active")}}}async function md({collectionIds:n,editor:e,component:t}){const s=await pd({collectionIds:n,editor:e});if(!s)return;const o=({icon:a,collectionId:c,iconId:d})=>{t.components(a),t.set({collectionId:c,iconId:d})},i=Object.entries(s).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),r=t.get("collectionId")??i[0].id;e.runCommand(G.layoutToggle,{id:_i,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[bd({collectionsList:i,collectionId:r,editor:e,handleClick:o}),{id:qi,type:"column",grow:!0}]}});const l=await ji({collectionId:r,editor:e});l&&to({editor:e,collection:l,handleClick:o,collectionId:r})}function gd({editor:n,collection:e}){n.em.set(Qs,e)}function yd(n){return n.em.get(Qs)}function to(n){const{editor:e}=n,t={id:ud,layout:vd(n),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:qi}};e.runCommand(G.layoutRemove,{id:t.id,force:!0}),setTimeout(()=>e.runCommand(G.layoutAdd,t),10)}function bd(n){const{collectionsList:e,collectionId:t,editor:s,handleClick:o}=n,i=e.map(({id:r,name:l,total:a})=>({id:r,label:`${l} (${a})`})).sort((r,l)=>r.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${Gi}__header`,children:[{type:"selectField",value:t,options:i,emptyState:"Select an icon collection",onChange:async({setState:r,value:l})=>{const a=await ji({collectionId:l,editor:s});a&&(r({value:l}),gd({editor:s,collection:a}),to({editor:s,collection:a,handleClick:o,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${Qs}`]:({setState:r})=>r({value:""})},onInput:({setState:r,value:l,editor:a})=>{const c=yd(a);if(!c)return;const d=Object.fromEntries(Object.entries(c.icons).filter(([u])=>u.includes(l)));r({value:l}),to({editor:a,collection:c,handleClick:o,collectionId:l,collectionFiltered:{...c,icons:d}})}}]}}function vd({collection:n,collectionFiltered:e,handleClick:t}){const{height:s=24,width:o=24,icons:i,prefix:r}=e||n,l=Object.entries(i).map(([a,{body:c}])=>({name:a,body:c}),{});return{type:"column",className:`${Gi}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>[{type:"custom",render:c=>{const{editor:d,addEl:u,removeEl:h}=c,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.innerHTML=a.body,f.setAttribute("viewBox",`0 0 ${o} ${s}`);const{cssWidth:p,cssHeight:m}=wd(o,s);f.style.cssText=`width: ${p}px; height: ${m}px; cursor: pointer;`,f.addEventListener("mouseover",()=>{f.style.border="2px solid currentColor",f.style.borderRadius="4px",f.style.padding="4px"}),f.addEventListener("mouseout",()=>{f.style.border="none"});const g=()=>{const b=f.cloneNode(!0);b.removeAttribute("style");const C=b.outerHTML;t({icon:C,collectionId:r,iconId:a.name}),d==null||d.runCommand(G.layoutRemove,{id:_i})};return f.addEventListener("click",g),u(f),()=>{f.removeEventListener("click",g),h(f)}}}]}}}function wd(n,e){const t=n/e;let s=48,o=48;return t>1?o=48/t:t<1&&(s=48*t),{cssWidth:s,cssHeight:o}}function Ji(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:Vi.Error}}function Sd(){return{...Ji(),id:"toast-error-getCollection",content:"Error fetching collection"}}const Cd="iconifyComponent",xd=ne(function(n,e={}){var f;const{Components:t,Blocks:s}=n,{collections:o,extendIconComponent:i=!0,licenseKey:r,block:l={}}=e,a="icon",c="iconify",d="Iconify",u="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){md({collectionIds:o,editor:n,component:this.model})}};if(t.addType(c,{block:l&&{label:d,media:Xs,content:{type:c},category:"Extra",activate:!0,...l},isComponent:p=>Un(p,u),model:{defaults:{name:d,icon:Xs,droppable:!1,attributes:{[u]:!0},resizable:dd,components:Xs,style:{width:"50px",height:"50px"},traits:[Ki()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(p=>p.set({layerable:!1,locked:!0}))}},view:h}),i){const p=(f=t.getType(a))==null?void 0:f.model,[m,g,...b]=p.getDefaults().traits;t.addType(a,{model:{defaults:{traits:[m,g,Ki(),...b]}},view:h})}se({editor:n,licenseKey:r,plan:W.startup,pluginName:Cd,cleanup:()=>{s.remove(c),t.removeType(c)}})});function no(n,e,t){let s,o,i,r,l;const a=e===void 0?100:e;function c(){const u=Date.now()-r;u<a&&u>=0?s=setTimeout(c,a-u):(s=null,l=n.apply(i,o),i=o=null)}const d=function(){return i=this,o=arguments,r=Date.now(),s||(s=setTimeout(c,a)),l};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(l=n.apply(i,o),i=o=null,clearTimeout(s),s=null)},d}var O=(n=>(n.table="table",n.tableSettings="tableSettings",n.tableDelete="tableDelete",n.tableHead="tableHead",n.tableFoot="tableFoot",n.tableCellItems="tableCellItems",n.tableCellProperties="tableCellProperties",n.tableCellMerge="tableCellMerge",n.tableCellSplit="tableCellSplit",n.tableRowItems="tableRowItems",n.tableRowInsertBefore="tableRowInsertBefore",n.tableRowInsertAfter="tableRowInsertAfter",n.tableRowDelete="tableRowDelete",n.tableRowProperties="tableRowProperties",n.tableRowCut="tableRowCut",n.tableRowCopy="tableRowCopy",n.tableRowPasteBefore="tableRowPasteBefore",n.tableRowPasteAfter="tableRowPasteAfter",n.tableColumn="tableColumn",n.tableColumnItems="tableColumnItems",n.tableColumnInsertBefore="tableColumnInsertBefore",n.tableColumnInsertAfter="tableColumnInsertAfter",n.tableColumnDelete="tableColumnDelete",n.tableColumnCut="tableColumnCut",n.tableColumnCopy="tableColumnCopy",n.tableColumnPasteBefore="tableColumnPasteBefore",n.tableColumnPasteAfter="tableColumnPasteAfter",n))(O||{});const z={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},Ae="table",Ui="thead",Zi="tfoot",so="tbody",ae="row",H="cell",oo="clipboardTable",kd=[Ae,Ui,Zi,so,ae,H],Yn=n=>n.em.get(oo)||[],Td=n=>n.every(e=>e.is(H)),io=(n,e)=>{const{editor:t,event:s,opts:o}=n,i=s.currentTarget||s.target,{x:r,y:l,width:a,height:c}=i.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:l,w:a,h:c},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...e};Jn(o.openSettings)?o.openSettings({...n,layoutProps:d}):t.runCommand(G.layoutToggle,d)},Md=(n,{rows:e=1,cells:t=5,text:s}={})=>({type:n,components:Array.from(Array(e).keys()).map(o=>({type:ae,components:Array.from(Array(t).keys()).map(i=>({type:H,components:s?{type:"text",content:Jn(s)?s({y:o,x:i}):s}:void 0}))}))}),Yi="Table settings",Xi=n=>{const{component:e}=n;return e.is(Ae)?e:e.closestType(Ae)},Ad=n=>{var e;(e=Xi(n))==null||e.remove(n.opts)},Ed=n=>{const e=Xi(n);e&&(n.editor.select(e),io(n,{id:"tableSettings",header:{label:Yi}}))},Qi=n=>[{id:O.table,icon:z[O.table],label:"Table",items:[{id:O.tableSettings,label:Yi,icon:z[O.tableSettings],onClick:({event:t})=>Ed({...n,event:t})},{id:O.tableDelete,label:"Delete table",icon:z[O.tableDelete],onClick:()=>Ad(n)}]}],er=({editor:n})=>{const e=Yn(n);return e.length&&Td(e)},tr=({component:n,editor:e,after:t})=>{if(!n.is(H))return;const s=n.closestType(Ae),o=n.closestType(ae),i=n.index()+(t?1:0);s==null||s.findType(ae).forEach(l=>l.append({type:H},{at:i}));const r=o==null?void 0:o.components().at(i);r&&e.select(r)},nr=({component:n,opts:e})=>{if(!n.is(H))return;const t=n.closestType(Ae),s=n.index();t==null||t.findType(ae).forEach(o=>{var i;return(i=o.components().at(s))==null?void 0:i.remove(e)})},sr=({component:n,editor:e})=>{if(!n.is(H))return;const t=n.closestType(Ae),s=n.index(),o=(t==null?void 0:t.findType(ae).map(i=>i.components().at(s)))||[];o.length&&e.em.set(oo,o)},or=n=>{const{component:e,editor:t,after:s}=n;if(!e.is(H)||!er(n))return;const o=Yn(t),i=e.closestType(Ae),r=e.index()+(s?1:0);i==null||i.findType(ae).forEach((l,a)=>{const c=o[a],d=(c==null?void 0:c.clone())||{type:H};l.append(d,{at:r})})},Od=n=>{const{component:e}=n;e.is(H)&&(sr(n),nr({...n,opts:{temporary:!0}}))},Nd=n=>{const e=er(n);return[{id:O.tableColumnItems,icon:z[O.tableColumn],label:"Column",items:[{id:O.tableColumnInsertBefore,label:"Insert column before",icon:z[O.tableColumnInsertBefore],onClick:()=>tr(n)},{id:O.tableColumnInsertAfter,label:"Insert column after",icon:z[O.tableColumnInsertAfter],onClick:()=>tr({...n,after:!0})},{id:O.tableColumnDelete,label:"Delete column",icon:z[O.tableColumnDelete],onClick:()=>nr(n)},{id:O.tableColumnCut,label:"Cut column",icon:z[O.tableColumnCut],onClick:()=>Od(n)},{id:O.tableColumnCopy,label:"Copy column",icon:z[O.tableColumnCopy],onClick:()=>sr(n)},{id:O.tableColumnPasteBefore,label:"Paste column before",icon:z[O.tableColumnPasteBefore],disabled:!e,onClick:()=>or(n)},{id:O.tableColumnPasteAfter,label:"Paste column after",icon:z[O.tableColumnPasteAfter],disabled:!e,onClick:()=>or({...n,after:!0})}]}]},ir="Row settings",Pd=n=>n.every(e=>e.is(ae)),zt=n=>{const{component:e}=n,t=e.is(H),s=e.is(ae);if(!(!t&&!s))return s?e:e.closestType(ae)},rr=n=>{const{component:e,editor:t,after:s}=n,o=zt(n);if(!o)return;const i=o.index()+(s?1:0),r=o.components().length,l=Array.from(Array(r).keys()).map(()=>({type:H})),a=o.parent();if(a){const c=a.append({type:ae,components:l},{at:i})[0];if(e.is(H)&&c){const d=e.index(),u=c.components().at(d);u&&t.select(u)}}},lr=n=>{var e;(e=zt(n))==null||e.remove(n.opts)},ar=n=>{const e=zt(n);e&&n.editor.em.set(oo,[e])},cr=n=>{var l;const{editor:e,after:t}=n,s=zt(n);if(!s||!dr(n))return;const i=Yn(e)[0],r=s.index()+(t?1:0);i&&((l=s.parent())==null||l.append(i.clone(),{at:r}))},Id=n=>{zt(n)&&(ar(n),lr({...n,opts:{temporary:!0}}))},dr=({editor:n})=>{const e=Yn(n);return e.length&&Pd(e)},Rd=n=>{const e=zt(n);e&&(n.editor.select(e),io(n,{id:"tableRowSettings",header:{label:ir}}))},ur=n=>{const e=dr(n);return[{id:O.tableRowItems,icon:z[O.tableRowProperties],label:"Row",items:[{id:O.tableRowInsertBefore,label:"Insert row before",icon:z[O.tableRowInsertBefore],onClick:()=>rr(n)},{id:O.tableRowInsertAfter,label:"Insert row after",icon:z[O.tableRowInsertAfter],onClick:()=>rr({...n,after:!0})},{id:O.tableRowDelete,label:"Delete row",icon:z[O.tableRowDelete],onClick:()=>lr(n)},{id:O.tableRowProperties,label:ir,icon:z[O.tableRowProperties],onClick:({event:s})=>Rd({...n,event:s})},{id:O.tableRowCut,label:"Cut row",icon:z[O.tableRowCut],onClick:()=>Id(n)},{id:O.tableRowCopy,label:"Copy row",icon:z[O.tableRowCopy],onClick:()=>ar(n)},{id:O.tableRowPasteBefore,label:"Paste row before",icon:z[O.tableRowPasteBefore],disabled:!e,onClick:()=>cr(n)},{id:O.tableRowPasteAfter,label:"Paste row after",icon:z[O.tableRowPasteAfter],disabled:!e,onClick:()=>cr({...n,after:!0})}]},...Qi(n)]},ro=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),s=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:s}};function hr(n){const e=[];return n.components().forEach((t,s)=>{t.components().each((o,i)=>{const{rowspan:r,colspan:l}=ro(o);if(e[s])for(;e[s][i];)i++;for(let a=s;a<s+r;a++){e[a]||(e[a]=[]);for(let c=i;c<i+l;c++)e[a][c]={real:a===s&&c===i,cell:o,rowspan:r,colspan:l}}})}),e}function Vt(n,e,t){var s;return(s=n[t])==null?void 0:s[e]}const lo=n=>n.closestType(ae);function Dd(n,{x:e,y:t,rows:s,cols:o}){var l;let i=lo(n[t][e].cell),r;for(let a=1;a<=s;a++)if(i=(l=i==null?void 0:i.parent())==null?void 0:l.components().at(i.index()+1),i){for(r=e;r>=0;r--){const{cell:c}=n[t+a][r],d=lo(c);if(d===i){for(let u=1;u<=o;u++){const h=c.index();d.append({type:H},{at:h+1})}break}}if(r===-1){const d=i.components().at(0).index();for(let u=1;u<=o;u++)i.append({type:H},{at:d})}}}function fr(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const o=n[e][t].cell;if(o.em.selected.hasComponent(o)){const{rowspan:i,colspan:r}=ro(o);if(r>1||i>1){o.addAttributes({colspan:1,rowspan:1});for(let l=0;l<r-1;l++){const a=o.index();lo(o).append({type:H},{at:a+1})}Dd(n,{x:t,y:e,rows:i-1,cols:r})}}}}function zd(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const Xn=(n,e={})=>{var r;const t=hr(n),{em:s}=n;let o,i;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((r=e.selected)!=null&&r.includes(c.cell)||s.selected.hasComponent(c.cell)){const d={x:a,y:l};o||(o=d),i=d}}return{grid:t,startPos:o,endPos:i}};function Vd(n,e={}){const t=Xn(n),{startPos:s,endPos:o}=t;let{grid:i}=t;const{em:r}=n;if(!s||!o)return;const l=s.x,a=s.y,c=o.x,d=o.y,u=Vt(i,l,a),h=Vt(i,c,d);if(u&&h){fr(i),i=hr(n);const f=[],p=Vt(i,l,a).cell;p.addAttributes({colspan:c-l+1,rowspan:d-a+1});for(let m=a;m<=d;m++)for(let g=l;g<=c;g++){const b=Vt(i,g,m);if(!b)continue;const{cell:C}=b;C!==p&&f.push(C)}f.forEach(m=>{e.mergeContent&&p.append(m.components().models),m.remove()}),r.setSelected(p),zd(n)}}const pr="Cell settings",Ld="Merge cells",Bd="Split cell",Hd=n=>n.closestType(ae),Lt=n=>{var e;return(e=Hd(n))==null?void 0:e.parent()},$d=n=>{const e=n.editor.getSelectedAll(),t=Lt(e[0]),s=e[0];if(!t||!(s!=null&&s.is(H))||e.length>1)return!1;const{rowspan:o,colspan:i}=ro(s);return!(i<2&&o<2)},Fd=n=>{const t=n.editor.getSelectedAll()[0],s=Lt(t),{grid:o}=Xn(s);fr(o)},mr=n=>{const e=n.editor.getSelectedAll(),t=Lt(e[0]);if(!t||e.length<2||e.some(l=>!l.is(H)||Lt(l)!==t))return!1;const{grid:s,startPos:o,endPos:i}=Xn(t),{em:r}=t;if(!o||!i)return!1;for(let l=o.y;l<=i.y;l++)for(let a=o.x;a<=i.x;a++){const c=Vt(s,a,l);if(!c||!r.selected.hasComponent(c.cell))return!1}return!0},Wd=n=>{const{editor:e}=n;if(!mr(n))return;const t=e.getSelectedAll(),s=Lt(t[0]);Vd(s,{mergeContent:!0})},_d=n=>{io(n,{id:"tableCellSettings",header:{label:pr}})},qd=n=>[{id:O.tableCellItems,icon:z[O.tableCellProperties],label:"Cell",items:[{id:O.tableCellProperties,label:pr,icon:z[O.tableCellProperties],onClick:({event:t})=>_d({...n,event:t})},{id:O.tableCellMerge,label:Ld,icon:z[O.tableCellMerge],onClick:()=>Wd(n),disabled:!mr(n)},{id:O.tableCellSplit,label:Bd,icon:z[O.tableCellSplit],onClick:()=>Fd(n),disabled:!$d(n)}]},...Nd(n),...ur(n)],Gd=n=>{const e=n[0]&&Lt(n[0]);if(!e)return;const{grid:t,startPos:s,endPos:o}=Xn(e,{selected:n});if(!s||!o)return;const i=[];for(let r=s.y;r<=o.y;r++)for(let l=s.x;l<=o.x;l++){const a=Vt(t,l,r);a&&i.push(a.cell)}i.length&&e.em.setSelected(i,{fromCell:!0})},jd="tableComponent",Kd=ne(function(n,e={}){const t={block:{},...e},{Components:s}=n,o={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};s.addType(Ae,{block:t.block&&{label:"Table",media:z.table,category:"Extra",content:{type:Ae,style:{width:"100%"}},select:!0,...t.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:z.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:r,value:l,emitUpdate:a}){const c=r.find("caption")[0];l?!c&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Md(so,{rows:5}),contextMenu:({items:r,editor:l,component:a})=>[...Qi({editor:l,component:a,opts:t}),...r]}}}),s.addType(Ui,{model:{defaults:{icon:z.tableHead,...o}}}),s.addType(Zi,{model:{defaults:{icon:z.tableFoot,...o}}}),s.addType(so,{model:{defaults:{icon:z.tableRowProperties,...o}}}),s.addType(ae,{model:{defaults:{icon:z.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:l,component:a})=>[...ur({editor:l,component:a,opts:t}),...r]}}}),s.addType(H,{model:{defaults:{icon:z.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:r,editor:l,component:a})=>[...qd({editor:l,component:a,opts:t}),...r]}}});const i=no((r,l)=>{var u;const a=n.getSelectedAll(),c=!!((u=l==null?void 0:l.event)!=null&&u.shiftKey);if(a.length<2||!c||l.fromCell)return;const d=a.map(h=>h.is(H)?h:h.closestType(H)).filter(Boolean);d.length===a.length&&Gd(d)},0);n.on("component:select",i),se({editor:n,plan:W.startup,licenseKey:t.licenseKey,pluginName:jd,cleanup:()=>{n.off("component:select",i),n.Blocks.remove(Ae),kd.forEach(r=>s.removeType(r))}})}),gr="page://",ut="list-pages",Bt="list-pages-item",ht="list-pages-link",Jd=n=>n.components().reduce((e,t)=>{var r;const s=t.findFirstType(ht),o=(r=s==null?void 0:s.attributes.attributes)==null?void 0:r.href,i=o!=null&&o.startsWith(gr)?o.replace(gr,""):"";if(i&&s){const l=e[i];l?l.push(s):e[i]=[s]}return e},{}),Ud="listPagesComponent",Qn="data-type-role",Zd="page_root",Yd=n=>e=>e.is(n),Xd=n=>(e,t)=>t.is(n),ao=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,Qn))===n},Qd=ne(function(n,e={}){const{Blocks:t,Components:s,Pages:o}=n,{licenseKey:i,block:r={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${De}${ut}`,u=`${De}${ht}`,h='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',f='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';s.addType(ut,{block:r&&{label:l,media:h,category:"Extra",select:!0,...e.block},isComponent:ao(ut),model:{defaults:{tagName:"ul",name:l,[Zd]:"",classes:d,attributes:{[Qn]:ut,role:"navigation"},droppable:Yd(Bt),styles:`
61
+ </svg>`,Ji="layout-icon-picker",Cd="icons-layout-",Ui="icons-list-layout",Zi="gs-iconify-picker",to="__iconify_collection",xd="https://api.iconify.design",no=new Map;let Yn;const kd=({collectionId:n})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${n}@latest/icons.json`;async function Yi({collectionId:n,editor:e}){try{if(no.has(n))return no.get(n);const t=await fetch(kd({collectionId:n}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const s=await t.json();return no.set(n,s),s}catch(t){console.error("Error fetching collection",t),e.runCommand(B.toastAdd,Id());return}}async function Td({collectionIds:n,editor:e}){try{if(Yn)return Yn;const t=n?`?prefixes=${n.join(",")}`:"",s=await fetch(`${xd}/collections${t}`);if(!s.ok)throw new Error(`Failed to fetch collections: ${s.statusText}`);return Yn=await s.json(),Yn}catch(t){console.error("Error fetching collections",t),e.runCommand(B.toastAdd,Qi());return}}function Xi(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(n){var e;(e=n.getSelected())==null||e.trigger("active")}}}async function Md({collectionIds:n,editor:e,component:t}){const s=await Td({collectionIds:n,editor:e});if(!s)return;const o=({icon:a,collectionId:c,iconId:d})=>{t.components(a),t.set({collectionId:c,iconId:d})},i=Object.entries(s).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),r=t.get("collectionId")??i[0].id;e.runCommand(B.layoutToggle,{id:Ji,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[Od({collectionsList:i,collectionId:r,editor:e,handleClick:o}),{id:Ui,type:"column",grow:!0}]}});const l=await Yi({collectionId:r,editor:e});l&&so({editor:e,collection:l,handleClick:o,collectionId:r})}function Ad({editor:n,collection:e}){n.em.set(to,e)}function Ed(n){return n.em.get(to)}function so(n){const{editor:e}=n,t={id:Cd,layout:Nd(n),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:Ui}};e.runCommand(B.layoutRemove,{id:t.id,force:!0}),setTimeout(()=>e.runCommand(B.layoutAdd,t),10)}function Od(n){const{collectionsList:e,collectionId:t,editor:s,handleClick:o}=n,i=e.map(({id:r,name:l,total:a})=>({id:r,label:`${l} (${a})`})).sort((r,l)=>r.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${Zi}__header`,children:[{type:"selectField",value:t,options:i,emptyState:"Select an icon collection",onChange:async({setState:r,value:l})=>{const a=await Yi({collectionId:l,editor:s});a&&(r({value:l}),Ad({editor:s,collection:a}),so({editor:s,collection:a,handleClick:o,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${to}`]:({setState:r})=>r({value:""})},onInput:({setState:r,value:l,editor:a})=>{const c=Ed(a);if(!c)return;const d=Object.fromEntries(Object.entries(c.icons).filter(([u])=>u.includes(l)));r({value:l}),so({editor:a,collection:c,handleClick:o,collectionId:l,collectionFiltered:{...c,icons:d}})}}]}}function Nd({collection:n,collectionFiltered:e,handleClick:t}){const{height:s=24,width:o=24,icons:i,prefix:r}=e||n,l=Object.entries(i).map(([a,{body:c}])=>({name:a,body:c}),{});return{type:"column",className:`${Zi}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>[{type:"custom",render:c=>{const{editor:d,addEl:u,removeEl:h}=c,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.innerHTML=a.body,f.setAttribute("viewBox",`0 0 ${o} ${s}`);const{cssWidth:p,cssHeight:m}=Pd(o,s);f.style.cssText=`width: ${p}px; height: ${m}px; cursor: pointer;`,f.addEventListener("mouseover",()=>{f.style.border="2px solid currentColor",f.style.borderRadius="4px",f.style.padding="4px"}),f.addEventListener("mouseout",()=>{f.style.border="none"});const g=()=>{const b=f.cloneNode(!0);b.removeAttribute("style");const C=b.outerHTML;t({icon:C,collectionId:r,iconId:a.name}),d==null||d.runCommand(B.layoutRemove,{id:Ji})};return f.addEventListener("click",g),u(f),()=>{f.removeEventListener("click",g),h(f)}}}]}}}function Pd(n,e){const t=n/e;let s=48,o=48;return t>1?o=48/t:t<1&&(s=48*t),{cssWidth:s,cssHeight:o}}function Qi(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:$i.Error}}function Id(){return{...Qi(),id:"toast-error-getCollection",content:"Error fetching collection"}}const Rd="iconifyComponent",Dd=X(function(n,e={}){var f;const{Components:t,Blocks:s}=n,{collections:o,extendIconComponent:i=!0,licenseKey:r,block:l={}}=e,a="icon",c="iconify",d="Iconify",u="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){Md({collectionIds:o,editor:n,component:this.model})}};if(t.addType(c,{block:l&&{label:d,media:eo,content:{type:c},category:"Extra",activate:!0,...l},isComponent:p=>Zn(p,u),model:{defaults:{name:d,icon:eo,droppable:!1,attributes:{[u]:!0},resizable:wd,components:eo,style:{width:"50px",height:"50px"},traits:[Xi()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(p=>p.set({layerable:!1,locked:!0}))}},view:h}),i){const p=(f=t.getType(a))==null?void 0:f.model,[m,g,...b]=p.getDefaults().traits;t.addType(a,{model:{defaults:{traits:[m,g,Xi(),...b]}},view:h})}Q({editor:n,licenseKey:r,plan:F.startup,pluginName:Rd,cleanup:()=>{s.remove(c),t.removeType(c)}})});function oo(n,e,t){let s,o,i,r,l;const a=e===void 0?100:e;function c(){const u=Date.now()-r;u<a&&u>=0?s=setTimeout(c,a-u):(s=null,l=n.apply(i,o),i=o=null)}const d=function(){return i=this,o=arguments,r=Date.now(),s||(s=setTimeout(c,a)),l};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(l=n.apply(i,o),i=o=null,clearTimeout(s),s=null)},d}var O=(n=>(n.table="table",n.tableSettings="tableSettings",n.tableDelete="tableDelete",n.tableHead="tableHead",n.tableFoot="tableFoot",n.tableCellItems="tableCellItems",n.tableCellProperties="tableCellProperties",n.tableCellMerge="tableCellMerge",n.tableCellSplit="tableCellSplit",n.tableRowItems="tableRowItems",n.tableRowInsertBefore="tableRowInsertBefore",n.tableRowInsertAfter="tableRowInsertAfter",n.tableRowDelete="tableRowDelete",n.tableRowProperties="tableRowProperties",n.tableRowCut="tableRowCut",n.tableRowCopy="tableRowCopy",n.tableRowPasteBefore="tableRowPasteBefore",n.tableRowPasteAfter="tableRowPasteAfter",n.tableColumn="tableColumn",n.tableColumnItems="tableColumnItems",n.tableColumnInsertBefore="tableColumnInsertBefore",n.tableColumnInsertAfter="tableColumnInsertAfter",n.tableColumnDelete="tableColumnDelete",n.tableColumnCut="tableColumnCut",n.tableColumnCopy="tableColumnCopy",n.tableColumnPasteBefore="tableColumnPasteBefore",n.tableColumnPasteAfter="tableColumnPasteAfter",n))(O||{});const z={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},Ae="table",er="thead",tr="tfoot",io="tbody",ae="row",W="cell",ro="clipboardTable",zd=[Ae,er,tr,io,ae,W],Xn=n=>n.em.get(ro)||[],Ld=n=>n.every(e=>e.is(W)),lo=(n,e)=>{const{editor:t,event:s,opts:o}=n,i=s.currentTarget||s.target,{x:r,y:l,width:a,height:c}=i.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:l,w:a,h:c},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...e};Un(o.openSettings)?o.openSettings({...n,layoutProps:d}):t.runCommand(B.layoutToggle,d)},Vd=(n,{rows:e=1,cells:t=5,text:s}={})=>({type:n,components:Array.from(Array(e).keys()).map(o=>({type:ae,components:Array.from(Array(t).keys()).map(i=>({type:W,components:s?{type:"text",content:Un(s)?s({y:o,x:i}):s}:void 0}))}))}),nr="Table settings",sr=n=>{const{component:e}=n;return e.is(Ae)?e:e.closestType(Ae)},Bd=n=>{var e;(e=sr(n))==null||e.remove(n.opts)},Hd=n=>{const e=sr(n);e&&(n.editor.select(e),lo(n,{id:"tableSettings",header:{label:nr}}))},or=n=>[{id:O.table,icon:z[O.table],label:"Table",items:[{id:O.tableSettings,label:nr,icon:z[O.tableSettings],onClick:({event:t})=>Hd({...n,event:t})},{id:O.tableDelete,label:"Delete table",icon:z[O.tableDelete],onClick:()=>Bd(n)}]}],ir=({editor:n})=>{const e=Xn(n);return e.length&&Ld(e)},rr=({component:n,editor:e,after:t})=>{if(!n.is(W))return;const s=n.closestType(Ae),o=n.closestType(ae),i=n.index()+(t?1:0);s==null||s.findType(ae).forEach(l=>l.append({type:W},{at:i}));const r=o==null?void 0:o.components().at(i);r&&e.select(r)},lr=({component:n,opts:e})=>{if(!n.is(W))return;const t=n.closestType(Ae),s=n.index();t==null||t.findType(ae).forEach(o=>{var i;return(i=o.components().at(s))==null?void 0:i.remove(e)})},ar=({component:n,editor:e})=>{if(!n.is(W))return;const t=n.closestType(Ae),s=n.index(),o=(t==null?void 0:t.findType(ae).map(i=>i.components().at(s)))||[];o.length&&e.em.set(ro,o)},cr=n=>{const{component:e,editor:t,after:s}=n;if(!e.is(W)||!ir(n))return;const o=Xn(t),i=e.closestType(Ae),r=e.index()+(s?1:0);i==null||i.findType(ae).forEach((l,a)=>{const c=o[a],d=(c==null?void 0:c.clone())||{type:W};l.append(d,{at:r})})},$d=n=>{const{component:e}=n;e.is(W)&&(ar(n),lr({...n,opts:{temporary:!0}}))},Fd=n=>{const e=ir(n);return[{id:O.tableColumnItems,icon:z[O.tableColumn],label:"Column",items:[{id:O.tableColumnInsertBefore,label:"Insert column before",icon:z[O.tableColumnInsertBefore],onClick:()=>rr(n)},{id:O.tableColumnInsertAfter,label:"Insert column after",icon:z[O.tableColumnInsertAfter],onClick:()=>rr({...n,after:!0})},{id:O.tableColumnDelete,label:"Delete column",icon:z[O.tableColumnDelete],onClick:()=>lr(n)},{id:O.tableColumnCut,label:"Cut column",icon:z[O.tableColumnCut],onClick:()=>$d(n)},{id:O.tableColumnCopy,label:"Copy column",icon:z[O.tableColumnCopy],onClick:()=>ar(n)},{id:O.tableColumnPasteBefore,label:"Paste column before",icon:z[O.tableColumnPasteBefore],disabled:!e,onClick:()=>cr(n)},{id:O.tableColumnPasteAfter,label:"Paste column after",icon:z[O.tableColumnPasteAfter],disabled:!e,onClick:()=>cr({...n,after:!0})}]}]},dr="Row settings",Wd=n=>n.every(e=>e.is(ae)),Lt=n=>{const{component:e}=n,t=e.is(W),s=e.is(ae);if(!(!t&&!s))return s?e:e.closestType(ae)},ur=n=>{const{component:e,editor:t,after:s}=n,o=Lt(n);if(!o)return;const i=o.index()+(s?1:0),r=o.components().length,l=Array.from(Array(r).keys()).map(()=>({type:W})),a=o.parent();if(a){const c=a.append({type:ae,components:l},{at:i})[0];if(e.is(W)&&c){const d=e.index(),u=c.components().at(d);u&&t.select(u)}}},hr=n=>{var e;(e=Lt(n))==null||e.remove(n.opts)},fr=n=>{const e=Lt(n);e&&n.editor.em.set(ro,[e])},pr=n=>{var l;const{editor:e,after:t}=n,s=Lt(n);if(!s||!mr(n))return;const i=Xn(e)[0],r=s.index()+(t?1:0);i&&((l=s.parent())==null||l.append(i.clone(),{at:r}))},_d=n=>{Lt(n)&&(fr(n),hr({...n,opts:{temporary:!0}}))},mr=({editor:n})=>{const e=Xn(n);return e.length&&Wd(e)},qd=n=>{const e=Lt(n);e&&(n.editor.select(e),lo(n,{id:"tableRowSettings",header:{label:dr}}))},gr=n=>{const e=mr(n);return[{id:O.tableRowItems,icon:z[O.tableRowProperties],label:"Row",items:[{id:O.tableRowInsertBefore,label:"Insert row before",icon:z[O.tableRowInsertBefore],onClick:()=>ur(n)},{id:O.tableRowInsertAfter,label:"Insert row after",icon:z[O.tableRowInsertAfter],onClick:()=>ur({...n,after:!0})},{id:O.tableRowDelete,label:"Delete row",icon:z[O.tableRowDelete],onClick:()=>hr(n)},{id:O.tableRowProperties,label:dr,icon:z[O.tableRowProperties],onClick:({event:s})=>qd({...n,event:s})},{id:O.tableRowCut,label:"Cut row",icon:z[O.tableRowCut],onClick:()=>_d(n)},{id:O.tableRowCopy,label:"Copy row",icon:z[O.tableRowCopy],onClick:()=>fr(n)},{id:O.tableRowPasteBefore,label:"Paste row before",icon:z[O.tableRowPasteBefore],disabled:!e,onClick:()=>pr(n)},{id:O.tableRowPasteAfter,label:"Paste row after",icon:z[O.tableRowPasteAfter],disabled:!e,onClick:()=>pr({...n,after:!0})}]},...or(n)]},ao=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),s=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:s}};function yr(n){const e=[];return n.components().forEach((t,s)=>{t.components().each((o,i)=>{const{rowspan:r,colspan:l}=ao(o);if(e[s])for(;e[s][i];)i++;for(let a=s;a<s+r;a++){e[a]||(e[a]=[]);for(let c=i;c<i+l;c++)e[a][c]={real:a===s&&c===i,cell:o,rowspan:r,colspan:l}}})}),e}function Vt(n,e,t){var s;return(s=n[t])==null?void 0:s[e]}const co=n=>n.closestType(ae);function Gd(n,{x:e,y:t,rows:s,cols:o}){var l;let i=co(n[t][e].cell),r;for(let a=1;a<=s;a++)if(i=(l=i==null?void 0:i.parent())==null?void 0:l.components().at(i.index()+1),i){for(r=e;r>=0;r--){const{cell:c}=n[t+a][r],d=co(c);if(d===i){for(let u=1;u<=o;u++){const h=c.index();d.append({type:W},{at:h+1})}break}}if(r===-1){const d=i.components().at(0).index();for(let u=1;u<=o;u++)i.append({type:W},{at:d})}}}function br(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const o=n[e][t].cell;if(o.em.selected.hasComponent(o)){const{rowspan:i,colspan:r}=ao(o);if(r>1||i>1){o.addAttributes({colspan:1,rowspan:1});for(let l=0;l<r-1;l++){const a=o.index();co(o).append({type:W},{at:a+1})}Gd(n,{x:t,y:e,rows:i-1,cols:r})}}}}function jd(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const Qn=(n,e={})=>{var r;const t=yr(n),{em:s}=n;let o,i;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((r=e.selected)!=null&&r.includes(c.cell)||s.selected.hasComponent(c.cell)){const d={x:a,y:l};o||(o=d),i=d}}return{grid:t,startPos:o,endPos:i}};function Kd(n,e={}){const t=Qn(n),{startPos:s,endPos:o}=t;let{grid:i}=t;const{em:r}=n;if(!s||!o)return;const l=s.x,a=s.y,c=o.x,d=o.y,u=Vt(i,l,a),h=Vt(i,c,d);if(u&&h){br(i),i=yr(n);const f=[],p=Vt(i,l,a).cell;p.addAttributes({colspan:c-l+1,rowspan:d-a+1});for(let m=a;m<=d;m++)for(let g=l;g<=c;g++){const b=Vt(i,g,m);if(!b)continue;const{cell:C}=b;C!==p&&f.push(C)}f.forEach(m=>{e.mergeContent&&p.append(m.components().models),m.remove()}),r.setSelected(p),jd(n)}}const vr="Cell settings",Jd="Merge cells",Ud="Split cell",Zd=n=>n.closestType(ae),Bt=n=>{var e;return(e=Zd(n))==null?void 0:e.parent()},Yd=n=>{const e=n.editor.getSelectedAll(),t=Bt(e[0]),s=e[0];if(!t||!(s!=null&&s.is(W))||e.length>1)return!1;const{rowspan:o,colspan:i}=ao(s);return!(i<2&&o<2)},Xd=n=>{const t=n.editor.getSelectedAll()[0],s=Bt(t),{grid:o}=Qn(s);br(o)},Sr=n=>{const e=n.editor.getSelectedAll(),t=Bt(e[0]);if(!t||e.length<2||e.some(l=>!l.is(W)||Bt(l)!==t))return!1;const{grid:s,startPos:o,endPos:i}=Qn(t),{em:r}=t;if(!o||!i)return!1;for(let l=o.y;l<=i.y;l++)for(let a=o.x;a<=i.x;a++){const c=Vt(s,a,l);if(!c||!r.selected.hasComponent(c.cell))return!1}return!0},Qd=n=>{const{editor:e}=n;if(!Sr(n))return;const t=e.getSelectedAll(),s=Bt(t[0]);Kd(s,{mergeContent:!0})},eu=n=>{lo(n,{id:"tableCellSettings",header:{label:vr}})},tu=n=>[{id:O.tableCellItems,icon:z[O.tableCellProperties],label:"Cell",items:[{id:O.tableCellProperties,label:vr,icon:z[O.tableCellProperties],onClick:({event:t})=>eu({...n,event:t})},{id:O.tableCellMerge,label:Jd,icon:z[O.tableCellMerge],onClick:()=>Qd(n),disabled:!Sr(n)},{id:O.tableCellSplit,label:Ud,icon:z[O.tableCellSplit],onClick:()=>Xd(n),disabled:!Yd(n)}]},...Fd(n),...gr(n)],nu=n=>{const e=n[0]&&Bt(n[0]);if(!e)return;const{grid:t,startPos:s,endPos:o}=Qn(e,{selected:n});if(!s||!o)return;const i=[];for(let r=s.y;r<=o.y;r++)for(let l=s.x;l<=o.x;l++){const a=Vt(t,l,r);a&&i.push(a.cell)}i.length&&e.em.setSelected(i,{fromCell:!0})},su="tableComponent",ou=X(function(n,e={}){const t={block:{},...e},{Components:s}=n,o={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};s.addType(Ae,{block:t.block&&{label:"Table",media:z.table,category:"Extra",content:{type:Ae,style:{width:"100%"}},select:!0,...t.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:z.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:r,value:l,emitUpdate:a}){const c=r.find("caption")[0];l?!c&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Vd(io,{rows:5}),contextMenu:({items:r,editor:l,component:a})=>[...or({editor:l,component:a,opts:t}),...r]}}}),s.addType(er,{model:{defaults:{icon:z.tableHead,...o}}}),s.addType(tr,{model:{defaults:{icon:z.tableFoot,...o}}}),s.addType(io,{model:{defaults:{icon:z.tableRowProperties,...o}}}),s.addType(ae,{model:{defaults:{icon:z.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:l,component:a})=>[...gr({editor:l,component:a,opts:t}),...r]}}}),s.addType(W,{model:{defaults:{icon:z.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:r,editor:l,component:a})=>[...tu({editor:l,component:a,opts:t}),...r]}}});const i=oo((r,l)=>{var u;const a=n.getSelectedAll(),c=!!((u=l==null?void 0:l.event)!=null&&u.shiftKey);if(a.length<2||!c||l.fromCell)return;const d=a.map(h=>h.is(W)?h:h.closestType(W)).filter(Boolean);d.length===a.length&&nu(d)},0);n.on("component:select",i),Q({editor:n,plan:F.startup,licenseKey:t.licenseKey,pluginName:su,cleanup:()=>{n.off("component:select",i),n.Blocks.remove(Ae),zd.forEach(r=>s.removeType(r))}})}),wr="page://",ht="list-pages",Ht="list-pages-item",ft="list-pages-link",iu=n=>n.components().reduce((e,t)=>{var r;const s=t.findFirstType(ft),o=(r=s==null?void 0:s.attributes.attributes)==null?void 0:r.href,i=o!=null&&o.startsWith(wr)?o.replace(wr,""):"";if(i&&s){const l=e[i];l?l.push(s):e[i]=[s]}return e},{}),ru="listPagesComponent",es="data-type-role",lu="page_root",au=n=>e=>e.is(n),cu=n=>(e,t)=>t.is(n),uo=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,es))===n},du=X(function(n,e={}){const{Blocks:t,Components:s,Pages:o}=n,{licenseKey:i,block:r={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${De}${ht}`,u=`${De}${ft}`,h='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',f='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';s.addType(ht,{block:r&&{label:l,media:h,category:"Extra",select:!0,...e.block},isComponent:uo(ht),model:{defaults:{tagName:"ul",name:l,[lu]:"",classes:d,attributes:{[es]:ht,role:"navigation"},droppable:au(Ht),styles:`
62
62
  .${d} {
63
63
  list-style: none;
64
64
  margin: 0;
65
65
  padding: 0;
66
66
  }
67
- `},init(){this.syncPageItems=no(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(n.Components.getSymbolInfo(this).isInstance)return;const p=this.em.Pages.getAll(),m=this.components(),g=Jd(this);p.forEach((b,C)=>{const y=b.id,v=b.getName(),w=g[y];w?w==null||w.forEach(S=>{S.getInnerHTML()!==v&&S.components(v)}):m.add({type:Bt,components:[{type:ht,attributes:{href:`page://${y}`},components:{type:"textnode",content:v}}]},{at:C})})}}}),s.addType(Bt,{isComponent:ao(Bt),model:{defaults:{name:a,tagName:"li",icon:f,attributes:{[Qn]:Bt},components:{type:ht},draggable:Xd(ut)}}}),s.addType(ht,{extend:"link",isComponent:ao(ht),model:{defaults:{removable:!1,copyable:!1,delegate:{move:p=>p.closestType(Bt)},name:c,classes:u,attributes:{[Qn]:ht},components:{type:"textnode",content:"Item"},styles:`
67
+ `},init(){this.syncPageItems=oo(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(n.Components.getSymbolInfo(this).isInstance)return;const p=this.em.Pages.getAll(),m=this.components(),g=iu(this);p.forEach((b,C)=>{const y=b.id,v=b.getName(),S=g[y];S?S==null||S.forEach(w=>{w.getInnerHTML()!==v&&w.components(v)}):m.add({type:Ht,components:[{type:ft,attributes:{href:`page://${y}`},components:{type:"textnode",content:v}}]},{at:C})})}}}),s.addType(Ht,{isComponent:uo(Ht),model:{defaults:{name:a,tagName:"li",icon:f,attributes:{[es]:Ht},components:{type:ft},draggable:cu(ht)}}}),s.addType(ft,{extend:"link",isComponent:uo(ft),model:{defaults:{removable:!1,copyable:!1,delegate:{move:p=>p.closestType(Ht)},name:c,classes:u,attributes:{[es]:ft},components:{type:"textnode",content:"Item"},styles:`
68
68
  .${u} {
69
69
  text-decoration: none;
70
70
  }
71
- `}}}),se({editor:n,licenseKey:i,plan:W.startup,pluginName:Ud,cleanup:()=>{t.remove(ut),s.removeType(ut)}})}),eu="fsLightboxComponent",es="data-fslightbox",ts="data-type",tu="fslightbox-open",Ht="fslightbox",$t={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},nu=ne(function(n,e={}){const{Blocks:t,Components:s}=n,o="Lightbox",i=`${De}${Ht}`,r={toolbarIconOpen:$t.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=r,d=function(C){const y=this,v="data-fslightbox",w=window,S=()=>{var A;const k=w.refreshFsLightbox;k==null||k();const E=y.getAttribute(v);if((A=w.fsLightboxInstances)==null||A[E],!w._isEditor)return;Array.from(document.querySelectorAll(`[${v}]`)).forEach(P=>{const D=P.onclick;P.onclick=function(L){L.preventDefault();const B=P;!B.__skipLb&&(D==null||D(L)),B.__skipLb=!0}})};if(w.refreshFsLightbox)S();else{const k=document.createElement("script");k.src=C.cdnScript,k.onload=S,document.head.appendChild(k)}},u=C=>({id:`${Ht}-open-lb`,label:a,command:()=>{const y=C.getView();y==null||y.toggleLightbox()}}),h="source-type",f={type:"radio",name:h,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:$t.image},{id:"video",label:"Video",icon:$t.video},{id:"el",label:"Custom Element",icon:$t.external}],labelToTitle:!0},p={id:"href-image",name:"href",type:"file",label:"Source Image"},m={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},g={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},b={image:[p],video:[m],el:[g]};s.addType(Ht,{block:l&&{label:o,media:$t.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:C=>{var y;return(y=C.hasAttribute)==null?void 0:y.call(C,es)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:o,icon:$t.imageLightbox,classes:i,draggable:(C,y)=>!y.is(Ht),attributes:{[es]:"lightbox",[ts]:"image",href:c},components:{type:"image",src:c},script:d,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[h]:"image",traits:[f,{name:es,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(C,y){var w;const v=(w=y.target)==null?void 0:w.getView();v==null||v.toggleLightbox()}}],styles:`
71
+ `}}}),Q({editor:n,licenseKey:i,plan:F.startup,pluginName:ru,cleanup:()=>{t.remove(ht),s.removeType(ht)}})}),uu="fsLightboxComponent",ts="data-fslightbox",ns="data-type",hu="fslightbox-open",$t="fslightbox",Ft={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},fu=X(function(n,e={}){const{Blocks:t,Components:s}=n,o="Lightbox",i=`${De}${$t}`,r={toolbarIconOpen:Ft.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=r,d=function(C){const y=this,v="data-fslightbox",S=window,w=()=>{var A;const k=S.refreshFsLightbox;k==null||k();const E=y.getAttribute(v);if((A=S.fsLightboxInstances)==null||A[E],!S._isEditor)return;Array.from(document.querySelectorAll(`[${v}]`)).forEach(P=>{const D=P.onclick;P.onclick=function(V){V.preventDefault();const H=P;!H.__skipLb&&(D==null||D(V)),H.__skipLb=!0}})};if(S.refreshFsLightbox)w();else{const k=document.createElement("script");k.src=C.cdnScript,k.onload=w,document.head.appendChild(k)}},u=C=>({id:`${$t}-open-lb`,label:a,command:()=>{const y=C.getView();y==null||y.toggleLightbox()}}),h="source-type",f={type:"radio",name:h,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:Ft.image},{id:"video",label:"Video",icon:Ft.video},{id:"el",label:"Custom Element",icon:Ft.external}],labelToTitle:!0},p={id:"href-image",name:"href",type:"file",label:"Source Image"},m={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},g={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},b={image:[p],video:[m],el:[g]};s.addType($t,{block:l&&{label:o,media:Ft.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:C=>{var y;return(y=C.hasAttribute)==null?void 0:y.call(C,ts)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:o,icon:Ft.imageLightbox,classes:i,draggable:(C,y)=>!y.is($t),attributes:{[ts]:"lightbox",[ns]:"image",href:c},components:{type:"image",src:c},script:d,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[h]:"image",traits:[f,{name:ts,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(C,y){var S;const v=(S=y.target)==null?void 0:S.getView();v==null||v.toggleLightbox()}}],styles:`
72
72
  .${i} {
73
73
  display: inline-block;
74
74
  padding: 10px;
75
75
  }
76
- `},init(){const C=[h].map(y=>`change:${y}`).join(" ");this.on(C,this.updateTraits),this.on(`change:${h}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(C,y,v){if(v.adjust)return;const S=this.get(h)==="video"?"video":"image";this.addAttributes({[ts]:S,href:""})},adjustSourceType(){const C=this.get(h),y=this.getAttributes().href||"",v={adjust:!0};if(C==="video"){const w=y.includes("youtube.com")?"youtube":"video";this.addAttributes({[ts]:w},v)}else C!=="el"&&y.startsWith("#")?this.set(h,"el",v):C==="image"&&this.addAttributes({[ts]:"image"},v)},updateTraits(C={}){const{changed:y}=this,{init:v}=C;if(y[f.name]||v){this.removeTrait([p.name,m.name,g.name]);const w=this.get(h)||"image",S=this.getTraitIndex(h)+1;this.addTrait(b[w],{at:S})}},initToolbar(){if(!a)return;const{toolbar:C}=this,y=u(this);!C.find(w=>w.id===y.id)&&(C==null||C.unshift(y))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var P;const{em:C,el:y,model:v}=this,{Canvas:w}=C,S=v.getAttributes()[es],{defaultView:k,documentElement:E}=y.ownerDocument,T=(P=k.fsLightboxInstances)==null?void 0:P[S];if(E.classList.contains(tu))T.close();else{y.__skipLb=!1;let D;T.props.onOpen=()=>{D=w.getSpots(),setTimeout(()=>w.removeSpots())},T.props.onClose=()=>{D.forEach(L=>w.addSpot(L.attributes))},y.click()}}}}),se({editor:n,plan:W.startup,licenseKey:r.licenseKey,pluginName:eu,cleanup:()=>{t.remove(Ht),s.removeType(Ht)}})});var Ft=(n=>(n.image="image",n.video="video",n.external="external",n))(Ft||{});const ft="lightGallery",yr=`${ft}-item`,ns="data-lightgallery",br=`${ns}-item`,ss="toggle",pt={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},co={propKeys:[],props:{},traits:[]},un=(n,e={})=>{var o;const t={},s=[];for(const i in n){const{value:r,...l}=n[i];s.push({id:i,name:i,changeProp:!0,category:e.category,...l}),t[i]=r;const{subTraits:a={}}=l;for(const c in l.subTraits)(o=a[c])==null||o.forEach(d=>{const u=d.id||d.name;t[u]=d.value})}return{propKeys:Object.keys(t),props:t,traits:s}},uo=(n,e)=>{const t=n.getTrait(e),s=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(r);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:s,...c})),{at:a})},ho=(n,e)=>{e.forEach(t=>{const s=n.getTrait(t);if(!s||!s.get("subTraits"))return;const o=s.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(o,()=>uo(n,t)),uo(n,t)})},su=(n,e,t)=>{const o=n.getTrait(e).get("subTraits")||{},r=(Object.values(o).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(r));l.length&&n.on(l.join(" "),t)},ou={[ss]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var t,s;return(s=(t=e.target)==null?void 0:t.getView())==null?void 0:s.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0}},iu={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},ru={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},lu={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},Ge="sourceType",is="data-iframe",fo={name:"href",type:"file",label:"Image Source"},rs={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},po={name:"data-poster",label:"Video Poster",type:"file"},vr={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},wr={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},au={[ss]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var o,i;const t=e.target,s=(o=t==null?void 0:t.closestType(ft))==null?void 0:o.getView();if(s&&t){const r=((i=s.getLightGallery())==null?void 0:i.items)||[],l=Array.from(r).indexOf(t.getEl());l>=0&&s.toggleGallery(l)}}},[Ge]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[fo],video:[rs,po],external:[vr]},options:[{id:"image",label:fo.label||"",icon:pt.image},{id:"video",label:rs.label||"",icon:pt.video},{id:"external",label:vr.label||"",icon:pt.external}]},subHtml:wr},cu="lightGalleryComponent",Sr="lgThumbnail",du="lgVideo",Cr="lgAutoplay",xr="lgZoom",Wt="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",uu=ne(function(n,e={}){const{Blocks:t,Components:s}=n,o="LightGallery",i="LightGallery Item",r={toolbarIconOpen:pt.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[Sr,du,Cr,xr],cdnScript:[`${Wt}/lightgallery.min.js`,`${Wt}/plugins/thumbnail/lg-thumbnail.min.js`,`${Wt}/plugins/video/lg-video.min.js`,`${Wt}/plugins/autoplay/lg-autoplay.min.js`,`${Wt}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Wt}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=r,d=function(y){const v=this,w=window,{plugins:S,cdnScript:k,cdnStyle:E,inline:T,lgLicenseKey:A,...P}=y||{},D=B=>isNaN(B)?void 0:parseInt(B,10),L=()=>{var Te;const B={...P,licenseKey:A,speed:D(P.speed),startAnimationDuration:D(P.startAnimationDuration),thumbMargin:D(P.thumbMargin),thumbWidth:D(P.thumbWidth),slideShowInterval:D(P.slideShowInterval),scale:D(P.scale),enableZoomAfter:D(P.enableZoomAfter),plugins:(S||[]).map(Rt=>w[Rt])};T&&(B.container=v,B.closable=!1);const ke=(Te=w.lightGallery)==null?void 0:Te.call(w,v,B);T&&ke.openGallery()};if(w.lightGallery)L();else{const{head:B}=document,ke=Array.isArray(k)?[...k]:[k],Te=Array.isArray(E)?[...E]:[E],Rt=Re=>{if(Re.length){const at=document.createElement("link");at.href=Re.shift(),at.rel="stylesheet",B.appendChild(at),Rt(Re)}},Me=Re=>{if(Re.length){const at=document.createElement("script");at.src=Re.shift(),at.onerror=at.onload=Me.bind(null,Re),B.appendChild(at)}else L()};Rt(Te),Me(ke)}},u=y=>{const v=y.getTrait(ss);if(!a||!v)return;const{toolbar:w}=y,S={id:ss,label:a,command:()=>setTimeout(()=>v.runCommand(),100)};!w.find(E=>E.id===S.id)&&(w==null||w.unshift(S))};let h=[];const f=r.plugins||[],p=un(ou),m=f.includes(Sr)?un(iu):co,g=f.includes(Cr)?un(ru):co,b=f.includes(xr)?un(lu):co;s.addType(ft,{block:l&&{label:o,media:pt.gallery,category:"Extra",select:!0,...r.block},isComponent:y=>Un(y,ns),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:pt.gallery,draggable:(y,v)=>!v.is(ft),attributes:{[ns]:!0},components:{type:yr},script:d,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...p.propKeys,...m.propKeys,...g.propKeys,...b.propKeys],...p.props,...m.props,...g.props,...b.props,traits:[...p.traits,...m.traits,...g.traits,...b.traits]},init(){ho(this,["thumbnail"]),ho(this,["autoplay"]),ho(this,["zoom"])},initToolbar(){u(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,s.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const y=this.getLightGallery();y==null||y.destroy()},disableLgInCanvas(){const y=this.getLightGallery();y.lgOpened=!0},isInlineGallery(){var v;const y=this.getLightGallery();return((v=y==null?void 0:y.settings)==null?void 0:v.container)===this.el},onLgInit(y){this.el.__lg=y.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:y}=this,{Canvas:v}=y,w=this.getLightGallery();h=v.getSpots(),setTimeout(()=>v.removeSpots()),w.__lgOpened=!0},onLgClose(){const y=this.getLightGallery();h.forEach(v=>this.em.Canvas.addSpot(v.attributes)),h=[],y.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(y){const v=this.getLightGallery();if(v.__lgOpened)return v.closeGallery(!0);v.lgOpened=!1,v.openGallery(y)}}});const C=un(au);s.addType(yr,{isComponent:y=>Un(y,br)||y.tagName==="A"&&Un(y.parentElement,ns),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:i,icon:pt.galleryItem,attributes:{[br]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...C.props,traits:[...C.traits]},init(){const y=[Ge].map(v=>`change:${v}`).join(" ");this.initSourceType(),this.on(y,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),su(this,Ge,this.triggerGalleryUpdate)},initToolbar(){u(this)},initScriptUpdate(){const y=[wr.name].map(v=>`change:attributes:${v}`).join(" ");this.on(y,this.triggerGalleryUpdate)},triggerGalleryUpdate(...y){var v;(v=this.closestType(ft))==null||v.__scriptPropsChange(...y)},updateTraits(y={}){const{changed:v}=this,{init:w}=y;if(v[Ge]||w){uo(this,Ge);const S=this.getTrait(Ge).getValue();if(S===Ft.image){this.removeAttributes([rs.name,po.name,is]);const k=this.getTrait(fo.name);k.setValue(k.getValue()||c)}else S===Ft.video?this.removeAttributes([is]):S===Ft.external&&this.addAttributes({[is]:!0})}},initSourceType(){const y=this.getAttributes({noClass:!0,noStyle:!0});y[is]?this.set(Ge,Ft.external):(y[rs.name]||y[po.name])&&this.set(Ge,Ft.video)}}}),se({editor:n,plan:W.startup,licenseKey:r.licenseKey,pluginName:cu,cleanup:()=>{t.remove(ft),s.removeType(ft)}})}),ve="swiper",hn=`${ve}-slide`,_t=`${ve}-wrapper`,qt=`${ve}-nav-prev`,ls=`${ve}-nav-next`,Gt=`${ve}-pagination`,fn=`${ve}-scrollbar`,oe={slider:`<svg viewBox="0 0 24 24">
76
+ `},init(){const C=[h].map(y=>`change:${y}`).join(" ");this.on(C,this.updateTraits),this.on(`change:${h}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(C,y,v){if(v.adjust)return;const w=this.get(h)==="video"?"video":"image";this.addAttributes({[ns]:w,href:""})},adjustSourceType(){const C=this.get(h),y=this.getAttributes().href||"",v={adjust:!0};if(C==="video"){const S=y.includes("youtube.com")?"youtube":"video";this.addAttributes({[ns]:S},v)}else C!=="el"&&y.startsWith("#")?this.set(h,"el",v):C==="image"&&this.addAttributes({[ns]:"image"},v)},updateTraits(C={}){const{changed:y}=this,{init:v}=C;if(y[f.name]||v){this.removeTrait([p.name,m.name,g.name]);const S=this.get(h)||"image",w=this.getTraitIndex(h)+1;this.addTrait(b[S],{at:w})}},initToolbar(){if(!a)return;const{toolbar:C}=this,y=u(this);!C.find(S=>S.id===y.id)&&(C==null||C.unshift(y))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var P;const{em:C,el:y,model:v}=this,{Canvas:S}=C,w=v.getAttributes()[ts],{defaultView:k,documentElement:E}=y.ownerDocument,T=(P=k.fsLightboxInstances)==null?void 0:P[w];if(E.classList.contains(hu))T.close();else{y.__skipLb=!1;let D;T.props.onOpen=()=>{D=S.getSpots(),setTimeout(()=>S.removeSpots())},T.props.onClose=()=>{D.forEach(V=>S.addSpot(V.attributes))},y.click()}}}}),Q({editor:n,plan:F.startup,licenseKey:r.licenseKey,pluginName:uu,cleanup:()=>{t.remove($t),s.removeType($t)}})});var Wt=(n=>(n.image="image",n.video="video",n.external="external",n))(Wt||{});const pt="lightGallery",Cr=`${pt}-item`,ss="data-lightgallery",xr=`${ss}-item`,is="toggle",mt={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},ho={propKeys:[],props:{},traits:[]},hn=(n,e={})=>{var o;const t={},s=[];for(const i in n){const{value:r,...l}=n[i];s.push({id:i,name:i,changeProp:!0,category:e.category,...l}),t[i]=r;const{subTraits:a={}}=l;for(const c in l.subTraits)(o=a[c])==null||o.forEach(d=>{const u=d.id||d.name;t[u]=d.value})}return{propKeys:Object.keys(t),props:t,traits:s}},fo=(n,e)=>{const t=n.getTrait(e),s=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(r);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:s,...c})),{at:a})},po=(n,e)=>{e.forEach(t=>{const s=n.getTrait(t);if(!s||!s.get("subTraits"))return;const o=s.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(o,()=>fo(n,t)),fo(n,t)})},pu=(n,e,t)=>{const o=n.getTrait(e).get("subTraits")||{},r=(Object.values(o).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(r));l.length&&n.on(l.join(" "),t)},mu={[is]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var t,s;return(s=(t=e.target)==null?void 0:t.getView())==null?void 0:s.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0}},gu={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},yu={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},bu={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},Ge="sourceType",rs="data-iframe",mo={name:"href",type:"file",label:"Image Source"},ls={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},go={name:"data-poster",label:"Video Poster",type:"file"},kr={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},Tr={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},vu={[is]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var o,i;const t=e.target,s=(o=t==null?void 0:t.closestType(pt))==null?void 0:o.getView();if(s&&t){const r=((i=s.getLightGallery())==null?void 0:i.items)||[],l=Array.from(r).indexOf(t.getEl());l>=0&&s.toggleGallery(l)}}},[Ge]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[mo],video:[ls,go],external:[kr]},options:[{id:"image",label:mo.label||"",icon:mt.image},{id:"video",label:ls.label||"",icon:mt.video},{id:"external",label:kr.label||"",icon:mt.external}]},subHtml:Tr},Su="lightGalleryComponent",Mr="lgThumbnail",wu="lgVideo",Ar="lgAutoplay",Er="lgZoom",_t="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Cu=X(function(n,e={}){const{Blocks:t,Components:s}=n,o="LightGallery",i="LightGallery Item",r={toolbarIconOpen:mt.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[Mr,wu,Ar,Er],cdnScript:[`${_t}/lightgallery.min.js`,`${_t}/plugins/thumbnail/lg-thumbnail.min.js`,`${_t}/plugins/video/lg-video.min.js`,`${_t}/plugins/autoplay/lg-autoplay.min.js`,`${_t}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${_t}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=r,d=function(y){const v=this,S=window,{plugins:w,cdnScript:k,cdnStyle:E,inline:T,lgLicenseKey:A,...P}=y||{},D=H=>isNaN(H)?void 0:parseInt(H,10),V=()=>{var Te;const H={...P,licenseKey:A,speed:D(P.speed),startAnimationDuration:D(P.startAnimationDuration),thumbMargin:D(P.thumbMargin),thumbWidth:D(P.thumbWidth),slideShowInterval:D(P.slideShowInterval),scale:D(P.scale),enableZoomAfter:D(P.enableZoomAfter),plugins:(w||[]).map(Dt=>S[Dt])};T&&(H.container=v,H.closable=!1);const ke=(Te=S.lightGallery)==null?void 0:Te.call(S,v,H);T&&ke.openGallery()};if(S.lightGallery)V();else{const{head:H}=document,ke=Array.isArray(k)?[...k]:[k],Te=Array.isArray(E)?[...E]:[E],Dt=Re=>{if(Re.length){const ct=document.createElement("link");ct.href=Re.shift(),ct.rel="stylesheet",H.appendChild(ct),Dt(Re)}},Me=Re=>{if(Re.length){const ct=document.createElement("script");ct.src=Re.shift(),ct.onerror=ct.onload=Me.bind(null,Re),H.appendChild(ct)}else V()};Dt(Te),Me(ke)}},u=y=>{const v=y.getTrait(is);if(!a||!v)return;const{toolbar:S}=y,w={id:is,label:a,command:()=>setTimeout(()=>v.runCommand(),100)};!S.find(E=>E.id===w.id)&&(S==null||S.unshift(w))};let h=[];const f=r.plugins||[],p=hn(mu),m=f.includes(Mr)?hn(gu):ho,g=f.includes(Ar)?hn(yu):ho,b=f.includes(Er)?hn(bu):ho;s.addType(pt,{block:l&&{label:o,media:mt.gallery,category:"Extra",select:!0,...r.block},isComponent:y=>Zn(y,ss),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:mt.gallery,draggable:(y,v)=>!v.is(pt),attributes:{[ss]:!0},components:{type:Cr},script:d,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...p.propKeys,...m.propKeys,...g.propKeys,...b.propKeys],...p.props,...m.props,...g.props,...b.props,traits:[...p.traits,...m.traits,...g.traits,...b.traits]},init(){po(this,["thumbnail"]),po(this,["autoplay"]),po(this,["zoom"])},initToolbar(){u(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,s.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const y=this.getLightGallery();y==null||y.destroy()},disableLgInCanvas(){const y=this.getLightGallery();y.lgOpened=!0},isInlineGallery(){var v;const y=this.getLightGallery();return((v=y==null?void 0:y.settings)==null?void 0:v.container)===this.el},onLgInit(y){this.el.__lg=y.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:y}=this,{Canvas:v}=y,S=this.getLightGallery();h=v.getSpots(),setTimeout(()=>v.removeSpots()),S.__lgOpened=!0},onLgClose(){const y=this.getLightGallery();h.forEach(v=>this.em.Canvas.addSpot(v.attributes)),h=[],y.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(y){const v=this.getLightGallery();if(v.__lgOpened)return v.closeGallery(!0);v.lgOpened=!1,v.openGallery(y)}}});const C=hn(vu);s.addType(Cr,{isComponent:y=>Zn(y,xr)||y.tagName==="A"&&Zn(y.parentElement,ss),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:i,icon:mt.galleryItem,attributes:{[xr]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...C.props,traits:[...C.traits]},init(){const y=[Ge].map(v=>`change:${v}`).join(" ");this.initSourceType(),this.on(y,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),pu(this,Ge,this.triggerGalleryUpdate)},initToolbar(){u(this)},initScriptUpdate(){const y=[Tr.name].map(v=>`change:attributes:${v}`).join(" ");this.on(y,this.triggerGalleryUpdate)},triggerGalleryUpdate(...y){var v;(v=this.closestType(pt))==null||v.__scriptPropsChange(...y)},updateTraits(y={}){const{changed:v}=this,{init:S}=y;if(v[Ge]||S){fo(this,Ge);const w=this.getTrait(Ge).getValue();if(w===Wt.image){this.removeAttributes([ls.name,go.name,rs]);const k=this.getTrait(mo.name);k.setValue(k.getValue()||c)}else w===Wt.video?this.removeAttributes([rs]):w===Wt.external&&this.addAttributes({[rs]:!0})}},initSourceType(){const y=this.getAttributes({noClass:!0,noStyle:!0});y[rs]?this.set(Ge,Wt.external):(y[ls.name]||y[go.name])&&this.set(Ge,Wt.video)}}}),Q({editor:n,plan:F.startup,licenseKey:r.licenseKey,pluginName:Su,cleanup:()=>{t.remove(pt),s.removeType(pt)}})}),ve="swiper",fn=`${ve}-slide`,qt=`${ve}-wrapper`,Gt=`${ve}-nav-prev`,as=`${ve}-nav-next`,jt=`${ve}-pagination`,pn=`${ve}-scrollbar`,oe={slider:`<svg viewBox="0 0 24 24">
77
77
  <path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
78
78
  <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
79
79
  </svg>`,effect:`<svg viewBox="0 0 24 24">
@@ -96,28 +96,28 @@
96
96
  <path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
97
97
  </svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
98
98
  <path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
99
- </svg>`},kr={id:"swiper-responsive",label:"Responsive",icon:oe.responsive},Tr={id:"swiper-extra",label:"Extra",icon:oe.extra},hu={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:oe.reload},{id:"p",label:"Previous slide",icon:oe.prev},{id:"n",label:"Next slide",icon:oe.next},{id:"a",label:"Add new slide",icon:oe.add}],setValue:({component:n,value:e})=>{var s;const t=(s=n.getView())==null?void 0:s.getSwiper();switch(e){case"r":n.reloadSlider();break;case"p":t==null||t.slidePrev();break;case"n":t==null||t.slideNext();break;case"a":n.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:n})=>!!n.findFirstType(qt),setValue:({component:n,value:e})=>{var t,s;e?n.append([{type:qt},{type:ls}]):((t=n.findFirstType(qt))==null||t.remove(),(s=n.findFirstType(ls))==null||s.remove()),n.set({navigation:e})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:oe.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:oe.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:oe.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:n})=>n.findFirstType(Gt)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(Gt);t==null||t.remove(),e!=="none"&&n.append({type:Gt}),n.set({pagination:e})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:oe.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(fn),setValue:({component:n,value:e})=>{const t=n.findFirstType(fn);t==null||t.remove(),e&&n.append({type:fn}),n.set({scrollbar:e})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:oe.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:kr,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:kr,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Tr,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Tr,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Mr="Slider",mo="swiper",jt=`${mo}-`,fu=(n,e)=>{const{Components:t,Blocks:s,Commands:o}=n,{block:i}=e,r=id(hu),l="core:preview",a=o.events,c=function(h){const f=this,p=window,m=f.__onLoad,g=f.__activeSlide,b=f.__inPreview,{cdnScript:C,cdnStyle:y,slidesPerView:v}=h||{},w=k=>isNaN(k)?void 0:parseFloat(k),S=()=>{const k={loop:h.loop,speed:h.speed,initialSlide:h.initialSlide,direction:h.vertical?"vertical":"horizontal",effect:h.effect,freeMode:h.freeMode,parallax:h.parallax,autoHeight:h.autoHeight,allowTouchMove:h.allowTouchMove,grabCursor:h.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(v)?v:w(v),slidesPerGroup:w(h.slidesPerGroup),spaceBetween:w(h.spaceBetween),slidesOffsetBefore:w(h.slidesOffsetBefore),slidesOffsetAfter:w(h.slidesOffsetAfter),centeredSlides:h.centeredSlides,fadeEffect:{crossFade:h.crossFade},cubeEffect:{shadow:h.cubeEffectShadow,slideShadows:h.cubeEffectSlideShadows,shadowOffset:w(h.cubeEffectShadowOffset),shadowScale:w(h.cubeEffectShadowScale)},coverflowEffect:{depth:w(h.coverflowEffectDepth),modifier:w(h.coverflowEffectModifier),rotate:w(h.coverflowEffectRotate),scale:w(h.coverflowEffectScale),stretch:w(h.coverflowEffectStretch),slideShadows:h.coverflowEffectSlideShadows},flipEffect:{limitRotation:h.flipEffectLimitRotation,slideShadows:h.flipEffectSlideShadows},cardsEffect:{perSlideOffset:w(h.cardsEffectPerSlideOffset),perSlideRotate:w(h.cardsEffectPerSlideRotate),rotate:h.cardsEffectRotate,slideShadows:h.cardsEffectSlideShadows},navigation:{nextEl:f.querySelector(".swiper-button-next"),prevEl:f.querySelector(".swiper-button-prev")},pagination:{type:h.pagination||"bullets",dynamicBullets:h.dynamicBullets,clickable:h.clickableBullets,progressbarOpposite:h.progressbarOpposite,el:f.querySelector(".swiper-pagination")},scrollbar:{el:f.querySelector(".swiper-scrollbar"),draggable:h.scrollbarDraggable,hide:h.scrollbarHide},autoplay:h.autoplay&&{delay:h.autoplayDelay,disableOnInteraction:h.autoplayDisableOnInteraction,pauseOnMouseEnter:h.autoplayPauseOnMouseEnter,reverseDirection:h.autoplayReverseDirection,stopOnLastSlide:h.autoplayStopOnLastSlide,waitForTransition:h.autoplayWaitForTransition}};if(h.tablet){const{tabletBreakpoint:T,tabletSlidesPerView:A}=h,P=w(T);k.breakpoints[P]={slidesPerView:isNaN(A)?A:w(A),slidesPerGroup:w(h.tabletSlidesPerGroup),spaceBetween:w(h.tabletSpaceBetween)}}if(h.mobile){const{mobileBreakpoint:T,mobileSlidesPerView:A}=h,P=w(T);k.breakpoints[P]={slidesPerView:isNaN(A)?A:w(A),slidesPerGroup:w(h.mobileSlidesPerGroup),spaceBetween:w(h.mobileSpaceBetween)}}m&&!b&&(k.simulateTouch=!1),g&&(k.initialSlide=g);const E=new p.Swiper(f,k);m==null||m(E)};if(p.Swiper)S();else{const{head:k}=document,E=Array.isArray(C)?[...C]:[C],T=Array.isArray(y)?[...y]:[y],A=D=>{if(D.length){const L=document.createElement("link");L.href=D.shift(),L.rel="stylesheet",k.appendChild(L),A(D)}},P=D=>{if(D.length){const L=document.createElement("script");L.src=D.shift(),L.onerror=L.onload=P.bind(null,D),k.appendChild(L)}else S()};A(T),P(E)}},d=(h=0)=>({type:hn,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${h}`}}}),u=t.getType("default").model;return t.addType(ve,{block:i&&{label:Mr,media:oe.slider,category:"Extra",select:!0,...e.block},isComponent:h=>ct(h,mo),model:{defaults:()=>({name:Mr,icon:oe.slider,classes:mo,draggable:(h,f)=>!f.is(ve),components:[{type:_t,components:[d(1),d(2),d(3)]},{type:Gt}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...r.propKeys],...r.props,traits:[...r.traits]}),init(){const{em:h}=this;rd(this,r.traits),ld(this,r.propKeys),this.listenTo(h,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(h,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const h=this.findFirstType(_t);h==null||h.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var f;const h=((f=this.findFirstType(_t))==null?void 0:f.components().length)||0;return{type:hn,components:{type:"text",components:{type:"textnode",content:`Slide ${h+1}`}}}},toJSON(...h){const f=u.prototype.toJSON.apply(this,h);return r.propsNoValues.forEach(p=>delete f[p]),delete f["script-props"],f}},view:{init(){this.listenTo(this.model,t.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var h;(h=this.getSwiper())==null||h.destroy()},onRender(){const h=this.el;h.__onLoad=f=>f.on("slideChange",()=>this.__activeSlide=f.activeIndex),h.__activeSlide=this.__activeSlide,h.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(ve),s.remove(ve)}},pu="Nav Prev",mu="Nav Next",as=`${jt}button-prev`,cs=`${jt}button-next`,gu=n=>{const{Components:e}=n,t=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return e.addType(qt,{isComponent:s=>ct(s,as),model:{defaults:{name:pu,classes:as,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:t("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
100
- .${as} {
99
+ </svg>`},Or={id:"swiper-responsive",label:"Responsive",icon:oe.responsive},Nr={id:"swiper-extra",label:"Extra",icon:oe.extra},xu={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:oe.reload},{id:"p",label:"Previous slide",icon:oe.prev},{id:"n",label:"Next slide",icon:oe.next},{id:"a",label:"Add new slide",icon:oe.add}],setValue:({component:n,value:e})=>{var s;const t=(s=n.getView())==null?void 0:s.getSwiper();switch(e){case"r":n.reloadSlider();break;case"p":t==null||t.slidePrev();break;case"n":t==null||t.slideNext();break;case"a":n.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:n})=>!!n.findFirstType(Gt),setValue:({component:n,value:e})=>{var t,s;e?n.append([{type:Gt},{type:as}]):((t=n.findFirstType(Gt))==null||t.remove(),(s=n.findFirstType(as))==null||s.remove()),n.set({navigation:e})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:oe.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:oe.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:oe.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:n})=>n.findFirstType(jt)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(jt);t==null||t.remove(),e!=="none"&&n.append({type:jt}),n.set({pagination:e})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:oe.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(pn),setValue:({component:n,value:e})=>{const t=n.findFirstType(pn);t==null||t.remove(),e&&n.append({type:pn}),n.set({scrollbar:e})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:oe.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Or,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:Or,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Nr,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Nr,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Pr="Slider",yo="swiper",Kt=`${yo}-`,ku=(n,e)=>{const{Components:t,Blocks:s,Commands:o}=n,{block:i}=e,r=gd(xu),l="core:preview",a=o.events,c=function(h){const f=this,p=window,m=f.__onLoad,g=f.__activeSlide,b=f.__inPreview,{cdnScript:C,cdnStyle:y,slidesPerView:v}=h||{},S=k=>isNaN(k)?void 0:parseFloat(k),w=()=>{const k={loop:h.loop,speed:h.speed,initialSlide:h.initialSlide,direction:h.vertical?"vertical":"horizontal",effect:h.effect,freeMode:h.freeMode,parallax:h.parallax,autoHeight:h.autoHeight,allowTouchMove:h.allowTouchMove,grabCursor:h.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(v)?v:S(v),slidesPerGroup:S(h.slidesPerGroup),spaceBetween:S(h.spaceBetween),slidesOffsetBefore:S(h.slidesOffsetBefore),slidesOffsetAfter:S(h.slidesOffsetAfter),centeredSlides:h.centeredSlides,fadeEffect:{crossFade:h.crossFade},cubeEffect:{shadow:h.cubeEffectShadow,slideShadows:h.cubeEffectSlideShadows,shadowOffset:S(h.cubeEffectShadowOffset),shadowScale:S(h.cubeEffectShadowScale)},coverflowEffect:{depth:S(h.coverflowEffectDepth),modifier:S(h.coverflowEffectModifier),rotate:S(h.coverflowEffectRotate),scale:S(h.coverflowEffectScale),stretch:S(h.coverflowEffectStretch),slideShadows:h.coverflowEffectSlideShadows},flipEffect:{limitRotation:h.flipEffectLimitRotation,slideShadows:h.flipEffectSlideShadows},cardsEffect:{perSlideOffset:S(h.cardsEffectPerSlideOffset),perSlideRotate:S(h.cardsEffectPerSlideRotate),rotate:h.cardsEffectRotate,slideShadows:h.cardsEffectSlideShadows},navigation:{nextEl:f.querySelector(".swiper-button-next"),prevEl:f.querySelector(".swiper-button-prev")},pagination:{type:h.pagination||"bullets",dynamicBullets:h.dynamicBullets,clickable:h.clickableBullets,progressbarOpposite:h.progressbarOpposite,el:f.querySelector(".swiper-pagination")},scrollbar:{el:f.querySelector(".swiper-scrollbar"),draggable:h.scrollbarDraggable,hide:h.scrollbarHide},autoplay:h.autoplay&&{delay:h.autoplayDelay,disableOnInteraction:h.autoplayDisableOnInteraction,pauseOnMouseEnter:h.autoplayPauseOnMouseEnter,reverseDirection:h.autoplayReverseDirection,stopOnLastSlide:h.autoplayStopOnLastSlide,waitForTransition:h.autoplayWaitForTransition}};if(h.tablet){const{tabletBreakpoint:T,tabletSlidesPerView:A}=h,P=S(T);k.breakpoints[P]={slidesPerView:isNaN(A)?A:S(A),slidesPerGroup:S(h.tabletSlidesPerGroup),spaceBetween:S(h.tabletSpaceBetween)}}if(h.mobile){const{mobileBreakpoint:T,mobileSlidesPerView:A}=h,P=S(T);k.breakpoints[P]={slidesPerView:isNaN(A)?A:S(A),slidesPerGroup:S(h.mobileSlidesPerGroup),spaceBetween:S(h.mobileSpaceBetween)}}m&&!b&&(k.simulateTouch=!1),g&&(k.initialSlide=g);const E=new p.Swiper(f,k);m==null||m(E)};if(p.Swiper)w();else{const{head:k}=document,E=Array.isArray(C)?[...C]:[C],T=Array.isArray(y)?[...y]:[y],A=D=>{if(D.length){const V=document.createElement("link");V.href=D.shift(),V.rel="stylesheet",k.appendChild(V),A(D)}},P=D=>{if(D.length){const V=document.createElement("script");V.src=D.shift(),V.onerror=V.onload=P.bind(null,D),k.appendChild(V)}else w()};A(T),P(E)}},d=(h=0)=>({type:fn,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${h}`}}}),u=t.getType("default").model;return t.addType(ve,{block:i&&{label:Pr,media:oe.slider,category:"Extra",select:!0,...e.block},isComponent:h=>dt(h,yo),model:{defaults:()=>({name:Pr,icon:oe.slider,classes:yo,draggable:(h,f)=>!f.is(ve),components:[{type:qt,components:[d(1),d(2),d(3)]},{type:jt}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...r.propKeys],...r.props,traits:[...r.traits]}),init(){const{em:h}=this;yd(this,r.traits),bd(this,r.propKeys),this.listenTo(h,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(h,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const h=this.findFirstType(qt);h==null||h.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var f;const h=((f=this.findFirstType(qt))==null?void 0:f.components().length)||0;return{type:fn,components:{type:"text",components:{type:"textnode",content:`Slide ${h+1}`}}}},toJSON(...h){const f=u.prototype.toJSON.apply(this,h);return r.propsNoValues.forEach(p=>delete f[p]),delete f["script-props"],f}},view:{init(){this.listenTo(this.model,t.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var h;(h=this.getSwiper())==null||h.destroy()},onRender(){const h=this.el;h.__onLoad=f=>f.on("slideChange",()=>this.__activeSlide=f.activeIndex),h.__activeSlide=this.__activeSlide,h.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(ve),s.remove(ve)}},Tu="Nav Prev",Mu="Nav Next",cs=`${Kt}button-prev`,ds=`${Kt}button-next`,Au=n=>{const{Components:e}=n,t=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return e.addType(Gt,{isComponent:s=>dt(s,cs),model:{defaults:{name:Tu,classes:cs,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:t("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
100
+ .${cs} {
101
101
  color: inherit;
102
102
  }
103
- .${as}:after {
103
+ .${cs}:after {
104
104
  content: none;
105
105
  }
106
- `}}}),e.addType(ls,{extend:qt,isComponent:s=>ct(s,cs),model:{defaults:{name:mu,classes:cs,components:t("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
107
- .${cs} {
106
+ `}}}),e.addType(as,{extend:Gt,isComponent:s=>dt(s,ds),model:{defaults:{name:Mu,classes:ds,components:t("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
107
+ .${ds} {
108
108
  color: inherit;
109
109
  }
110
- .${cs}:after {
110
+ .${ds}:after {
111
111
  content: none;
112
112
  }
113
- `}}}),()=>{e.removeType(qt),e.removeType(ls)}},yu=n=>{const{Components:e}=n,t=`${jt}pagination`;return e.addType(Gt,{isComponent:s=>ct(s,t),model:{defaults:{name:"Pagination",classes:t,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
113
+ `}}}),()=>{e.removeType(Gt),e.removeType(as)}},Eu=n=>{const{Components:e}=n,t=`${Kt}pagination`;return e.addType(jt,{isComponent:s=>dt(s,t),model:{defaults:{name:"Pagination",classes:t,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
114
114
  .${t}-bullet-active {
115
115
  background-color: currentColor;
116
116
  }
117
117
  .${t}-progressbar-fill {
118
118
  --swiper-pagination-color: currentColor;
119
119
  }
120
- `}}}),()=>{e.removeType(Gt)}},bu="Scrollbar",Ar=`${jt}scrollbar`,vu=n=>{const{Components:e}=n;return e.addType(fn,{isComponent:t=>ct(t,Ar),model:{defaults:{name:bu,classes:Ar,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(fn)}},wu="Slide",Er=`${jt}slide`,Su=n=>{const{Components:e}=n;return e.addType(hn,{isComponent:t=>ct(t,Er),model:{defaults:{name:wu,classes:Er,icon:oe.slider,draggable:(t,s)=>s.is(_t)}}}),()=>{e.removeType(hn)}},Cu="Wrapper",Or=`${jt}wrapper`,xu=n=>{const{Components:e}=n,{events:t}=e;return e.addType(_t,{isComponent:s=>ct(s,Or),model:{defaults:{name:Cu,icon:oe.slider,classes:Or,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(hn)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const o=this.closestType(ve);if(o){const i=o.getView();o.reloadSlider(),this.em.once(t.scriptMount,()=>{setTimeout(()=>{var r;return(r=i.getSwiper())==null?void 0:r.slideTo(s.index())},100)})}}}}),()=>{e.removeType(_t)}},ku="swiperComponent",Tu=ne(function(n,e={}){const t={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...e},s=[fu(n,t),gu(n),xu(n),Su(n),yu(n),vu(n)];se({editor:n,plan:W.startup,licenseKey:t.licenseKey,pluginName:ku,cleanup:()=>{s.forEach(o=>o())}})}),ce="accordion",pn=`${ce}-group`,ze=`${ce}-header`,je=`${ce}-content`,mt=`${ce}-marker`,Nr=`${De}${ze}`,go=`${De}${mt}`,Mu=`${De}${je}`,Pr=`${go}-open`,gt={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},Ir=(n,e)=>{const{toolbarIconOpen:t=gt.eye}=e,s=n.is(ce)?n:n.closestType(ce);if(!t||!s)return;const{toolbar:o}=n,i={id:"accordion-toggle-open",label:t,command:()=>s.toggleOpen()};!o.find(l=>l.id===i.id)&&(o==null||o.unshift(i))},Au=(n,e)=>{const{Components:t,Blocks:s}=n,{block:o={}}=e,i="Accordion",r=`${De}${ce}`,l=function(a={}){const c=this,d=()=>{const{clsMarkerOpen:u}=a,h=c.querySelector('[data-type-role="accordion-marker"]');!h||!u||(c.open?h.classList.add(u):h.classList.remove(u))};c.addEventListener("toggle",()=>{d(),c.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),d()};return t.addType(ce,{block:o&&{label:i,media:gt.accordion,category:"Extra",select:!0,...o},isComponent:dt(ce),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:i,classes:r,emptyState:!0,clsMarkerOpen:Pr,attributes:{[qe]:ce},droppable:Ys(ze,je),components:[{type:ze},{type:je}],"script-props":["clsMarkerOpen"],script:l,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
120
+ `}}}),()=>{e.removeType(jt)}},Ou="Scrollbar",Ir=`${Kt}scrollbar`,Nu=n=>{const{Components:e}=n;return e.addType(pn,{isComponent:t=>dt(t,Ir),model:{defaults:{name:Ou,classes:Ir,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(pn)}},Pu="Slide",Rr=`${Kt}slide`,Iu=n=>{const{Components:e}=n;return e.addType(fn,{isComponent:t=>dt(t,Rr),model:{defaults:{name:Pu,classes:Rr,icon:oe.slider,draggable:(t,s)=>s.is(qt)}}}),()=>{e.removeType(fn)}},Ru="Wrapper",Dr=`${Kt}wrapper`,Du=n=>{const{Components:e}=n,{events:t}=e;return e.addType(qt,{isComponent:s=>dt(s,Dr),model:{defaults:{name:Ru,icon:oe.slider,classes:Dr,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(fn)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const o=this.closestType(ve);if(o){const i=o.getView();o.reloadSlider(),this.em.once(t.scriptMount,()=>{setTimeout(()=>{var r;return(r=i.getSwiper())==null?void 0:r.slideTo(s.index())},100)})}}}}),()=>{e.removeType(qt)}},zu="swiperComponent",Lu=X(function(n,e={}){const t={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...e},s=[ku(n,t),Au(n),Du(n),Iu(n),Eu(n),Nu(n)];Q({editor:n,plan:F.startup,licenseKey:t.licenseKey,pluginName:zu,cleanup:()=>{s.forEach(o=>o())}})}),ce="accordion",mn=`${ce}-group`,ze=`${ce}-header`,je=`${ce}-content`,gt=`${ce}-marker`,zr=`${De}${ze}`,bo=`${De}${gt}`,Vu=`${De}${je}`,Lr=`${bo}-open`,yt={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},Vr=(n,e)=>{const{toolbarIconOpen:t=yt.eye}=e,s=n.is(ce)?n:n.closestType(ce);if(!t||!s)return;const{toolbar:o}=n,i={id:"accordion-toggle-open",label:t,command:()=>s.toggleOpen()};!o.find(l=>l.id===i.id)&&(o==null||o.unshift(i))},Bu=(n,e)=>{const{Components:t,Blocks:s}=n,{block:o={}}=e,i="Accordion",r=`${De}${ce}`,l=function(a={}){const c=this,d=()=>{const{clsMarkerOpen:u}=a,h=c.querySelector('[data-type-role="accordion-marker"]');!h||!u||(c.open?h.classList.add(u):h.classList.remove(u))};c.addEventListener("toggle",()=>{d(),c.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),d()};return t.addType(ce,{block:o&&{label:i,media:yt.accordion,category:"Extra",select:!0,...o},isComponent:ut(ce),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:i,classes:r,emptyState:!0,clsMarkerOpen:Lr,attributes:{[qe]:ce},droppable:Qs(ze,je),components:[{type:ze},{type:je}],"script-props":["clsMarkerOpen"],script:l,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
121
121
  .${r}::details-content {
122
122
  opacity: 0;
123
123
  block-size: 0;
@@ -134,40 +134,40 @@
134
134
  transform: translateY(0);
135
135
  block-size: auto;
136
136
  }
137
- `},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){Ir(this,e)}}}),()=>{s.remove(ce),t.removeType(ce)}},Eu=n=>{const{Components:e}=n;return e.addType(je,{isComponent:dt(je),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:Mu,icon:gt.accordionContent,attributes:{[qe]:je},components:"<div>Accordion content</div>"}}}),()=>{e.removeType(je)}},Ou=(n,e)=>{const{Components:t,Blocks:s}=n,{blockGroup:o={}}=e,i="Accordion Group",r=function(a={}){if(!a.single)return;const c=this;c.addEventListener("details-toggle",d=>{const u=d.target;if(!a.single||!u||!u.open)return;c.querySelectorAll('[data-type-role="accordion"]').forEach(f=>{u!==f&&f.open&&(f.open=!1)})})},l=(a={})=>({type:ce,attributes:{open:a.open},components:[{type:ze,components:[`<div>${a.header}</div>`,{type:mt}]},{type:je,components:`<div>${a.content}</div>`}]});return t.addType(pn,{block:o&&{label:i,media:gt.accordionGroup,category:"Extra",select:!0,...o},isComponent:dt(pn),model:{defaults:{name:i,attributes:{[qe]:pn},droppable:Ys(ce),single:!0,emptyState:!0,components:Array(3).fill(0).map((a,c)=>l({open:c===0,header:`Accordion header ${c+1}`,content:`Accordion content ${c+1}`})),traits:[{type:"checkbox",name:"single",changeProp:!0,tip:"Only one accordion can be open at a time",label:"Single open"}],"script-props":["single"],script:r}}}),()=>{s.remove(pn),t.removeType(pn)}},Nu=(n,e)=>{const{Components:t}=n;return t.addType(ze,{isComponent:dt(ze),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:gt.accordionHeader,classes:Nr,attributes:{[qe]:ze},components:["<div>Accordion header</div>",{type:mt}],styles:`
137
+ `},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){Vr(this,e)}}}),()=>{s.remove(ce),t.removeType(ce)}},Hu=n=>{const{Components:e}=n;return e.addType(je,{isComponent:ut(je),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:Vu,icon:yt.accordionContent,attributes:{[qe]:je},components:"<div>Accordion content</div>"}}}),()=>{e.removeType(je)}},$u=(n,e)=>{const{Components:t,Blocks:s}=n,{blockGroup:o={}}=e,i="Accordion Group",r=function(a={}){if(!a.single)return;const c=this;c.addEventListener("details-toggle",d=>{const u=d.target;if(!a.single||!u||!u.open)return;c.querySelectorAll('[data-type-role="accordion"]').forEach(f=>{u!==f&&f.open&&(f.open=!1)})})},l=(a={})=>({type:ce,attributes:{open:a.open},components:[{type:ze,components:[`<div>${a.header}</div>`,{type:gt}]},{type:je,components:`<div>${a.content}</div>`}]});return t.addType(mn,{block:o&&{label:i,media:yt.accordionGroup,category:"Extra",select:!0,...o},isComponent:ut(mn),model:{defaults:{name:i,attributes:{[qe]:mn},droppable:Qs(ce),single:!0,emptyState:!0,components:Array(3).fill(0).map((a,c)=>l({open:c===0,header:`Accordion header ${c+1}`,content:`Accordion content ${c+1}`})),traits:[{type:"checkbox",name:"single",changeProp:!0,tip:"Only one accordion can be open at a time",label:"Single open"}],"script-props":["single"],script:r}}}),()=>{s.remove(mn),t.removeType(mn)}},Fu=(n,e)=>{const{Components:t}=n;return t.addType(ze,{isComponent:ut(ze),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:yt.accordionHeader,classes:zr,attributes:{[qe]:ze},components:["<div>Accordion header</div>",{type:gt}],styles:`
138
138
  summary {
139
139
  list-style: none;
140
140
  }
141
- .${Nr} {
141
+ .${zr} {
142
142
  cursor: pointer;
143
143
  display: flex;
144
144
  align-items: center;
145
145
  justify-content: space-between;
146
146
  gap: 1rem;
147
147
  }
148
- `},initToolbar(){Ir(this,e)}}}),()=>{t.removeType(ze)}},Pu=n=>{const{Components:e}=n;return e.addType(mt,{extend:"icon",isComponent:dt(mt),model:{defaults:{name:"Accordion Marker",icon:gt.accordionMarker,classes:go,attributes:{[qe]:mt},components:gt.caret,droppable:!1,draggable:$i(ze),styles:`
149
- .${go} {
148
+ `},initToolbar(){Vr(this,e)}}}),()=>{t.removeType(ze)}},Wu=n=>{const{Components:e}=n;return e.addType(gt,{extend:"icon",isComponent:ut(gt),model:{defaults:{name:"Accordion Marker",icon:yt.accordionMarker,classes:bo,attributes:{[qe]:gt},components:yt.caret,droppable:!1,draggable:Gi(ze),styles:`
149
+ .${bo} {
150
150
  min-width: 24px;
151
151
  width: 24px;
152
152
  height: 24px;
153
153
  transition: transform 0.2s ease-in-out;
154
154
  }
155
- .${Pr} {
155
+ .${Lr} {
156
156
  transform: rotateZ(180deg);
157
157
  }
158
- `}}}),()=>{e.removeType(mt)}},Iu="accordionComponent",Ru=ne(function(n,e={}){const t=[Au(n,e),Ou(n,e),Nu(n,e),Pu(n),Eu(n)];se({editor:n,licenseKey:e.licenseKey,plan:W.startup,pluginName:Iu,cleanup:()=>{t.forEach(s=>s())}})}),Gn=class Gn{constructor(e){this.config=e}getSize(e){var t;return(t=this.config)!=null&&t.getSize?this.config.getSize(e):Co(e.componentColumn,Gn.CSS_FLEX_BASIS)}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:o,partial:i}=e;s.addStyle({[Gn.CSS_FLEX_BASIS]:o},{partial:i})}}};Gn.CSS_FLEX_BASIS="flex-basis";let yo=Gn;const jn=class jn{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var t;return(t=this.config)!=null&&t.getGap?this.config.getGap(e):Co(e.componentRow,jn.CSS_GAP)}setGap(e){var t;if((t=this.config)!=null&&t.setGap)this.config.setGap(e);else{const{componentRow:s,gapValue:o,partial:i}=e;s.addStyle({[jn.CSS_GAP]:o},{partial:i})}}};jn.CSS_GAP="gap";let bo=jn;const Js=class Js{constructor(e){this.config=e}getParentSize(e){var i;if((i=this.config)!=null&&i.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,o=t.getEl();return o?s?o.clientHeight:o.clientWidth:0}isLayoutVertical(e){var s;if((s=this.config)!=null&&s.isParentVertical)return this.config.isParentVertical(e);const t=Co(e.componentRow,Js.CSS_FLEX_DIRECTION,!0);return t==="column"||t==="column-reverse"}};Js.CSS_FLEX_DIRECTION="flex-direction";let vo=Js;const Kn=class Kn{constructor(e){this.config=e}getSize(e){var s;if((s=this.config)!=null&&s.getSize)return this.config.getSize(e);const t=e.componentColumn;if(t.is(Kn.MJML_COLUMN_TYPE)){const i=t.getAttributes().width;if(i&&(i.includes("%")||!isNaN(parseFloat(i))))return parseFloat(i);const r=t.parent();return 100/(r?r.components().length:1)}return 0}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:o,partial:i}=e;s.is(Kn.MJML_COLUMN_TYPE)&&s.addAttributes({width:`${parseFloat(o)}%`},{partial:i})}}};Kn.MJML_COLUMN_TYPE="mj-column";let wo=Kn;const Us=class Us{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var s;if((s=this.config)!=null&&s.getGap)return this.config.getGap(e);const{componentRow:t}=e;if(t.is(Us.MJML_SECTION_TYPE)){const o=t.getAttributes();if(o&&o.padding)return parseInt(o.padding,10)||0}return 0}setGap(e){var t,s;(s=(t=this.config)==null?void 0:t.setGap)==null||s.call(t,e)}};Us.MJML_SECTION_TYPE="mj-section";let So=Us;class Du{constructor(e){this.config=e}getParentSize(e){var r;if((r=this.config)!=null&&r.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,o=t.getEl();if(!o)return 0;let i=o;if(o.tagName!=="TABLE"){const l=o.querySelectorAll("table");l.length&&(i=l[0])}return s?i.clientHeight:i.clientWidth}isLayoutVertical(e){var t;return(t=this.config)!=null&&t.isParentVertical?this.config.isParentVertical(e):!1}}class Kt{constructor(){this.handlerCache=new Map}static getInstance(){return Kt.instance||(Kt.instance=new Kt),Kt.instance}getHandlers(e){const t=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(t)||(Jt(e)?this.handlerCache.set(t,{sizeHandler:new wo(e),gapHandler:new So(e),parentSizeHandler:new Du(e)}):this.handlerCache.set(t,{sizeHandler:new yo(e),gapHandler:new bo(e),parentSizeHandler:new vo(e)})),this.handlerCache.get(t)}}function yt(n){return Kt.getInstance().getHandlers(n)}const Rr=n=>{n.style.display="none"},Dr=n=>{n.style.display="block"},mn=n=>+parseFloat(`${n}`).toFixed(2),Jt=n=>n.projectType===Bi.email,ds=(n,e)=>{const t=n.Canvas.getFramesEl();t&&(t.style.pointerEvents=e?"none":"")},zu=n=>n?["top","bottom"]:["left","right"],Vu=n=>{const e=n.parent();return e?e.components().models.indexOf(n)===0:!1},Lu=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.indexOf(n)===t.length-1},Bu=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.length>1&&n.index()===t.length-1},Hu=(n,e,t,s)=>{const i=n+(t?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return i>=0&&i<s?i:-1},us=n=>n==="top"||n==="bottom",$u=(n,e)=>!!(Vu(n)&&(e==="left"||e==="top")||Lu(n)&&(e==="right"||e==="bottom")),Fu=n=>{const e=n.parent();return e?e.components().models.length>1:!1},zr=(n,e)=>n==="right"||n==="bottom"?e>0:e<0,Co=(n,e,t=!1)=>{const s=!t,o=n.getEl();if(!o)return s?0:"";const r=window.getComputedStyle(o)[e]||"";if(s){let l;return typeof r=="string"?(l=parseFloat(r.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(r)||0,l}return r},Vr=(n,e,t)=>{const s=xo({componentRow:n,isVertical:e},t),o=n.components().models;return s*(o.length-1)},gn=(n,e)=>yt(e).parentSizeHandler.isLayoutVertical({componentRow:n}),yn=(n,e)=>yt(e).sizeHandler.getSize(n),xo=(n,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:t,parentSizeHandler:s}=yt(e);if(!t.isGapSupported())return 0;const o=t.getGap(n),i=s.getParentSize(n);return o/100*i},ko=(n,e)=>yt(e).parentSizeHandler.getParentSize(n),bn=(n,e)=>{yt(e).sizeHandler.setSize(n)},Lr=(n,e)=>{const t=yn(n,e);bn({...n,sizeValue:`${t}%`,partial:!1},e)},Br=(n,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:t}=yt(e);t.isGapSupported()&&t.setGap(n)},Wu=(n,e)=>{const t=n.getStyle().gap;if(!t)return;const s=n.components().models,o={componentRow:n,isVertical:gn(n,e)};s.map(i=>Lr({...o,componentColumn:i},e)),Br({...o,gapValue:String(t),partial:!1},e)};function _u(n,e){const{Blocks:t}=n,{typeColumn:s,typeRow:o,blocks:i}=e;if(i===!1||Jt(e))return;const r=u=>({type:o,components:u.map(h=>({type:s,style:{"flex-basis":`${h}%`}}))}),l=u=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
158
+ `}}}),()=>{e.removeType(gt)}},_u="accordionComponent",qu=X(function(n,e={}){const t=[Bu(n,e),$u(n,e),Fu(n,e),Wu(n),Hu(n)];Q({editor:n,licenseKey:e.licenseKey,plan:F.startup,pluginName:_u,cleanup:()=>{t.forEach(s=>s())}})}),jn=class jn{constructor(e){this.config=e}getSize(e){var t;return(t=this.config)!=null&&t.getSize?this.config.getSize(e):ko(e.componentColumn,jn.CSS_FLEX_BASIS)}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:o,partial:i}=e;s.addStyle({[jn.CSS_FLEX_BASIS]:o},{partial:i})}}};jn.CSS_FLEX_BASIS="flex-basis";let vo=jn;const Kn=class Kn{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var t;return(t=this.config)!=null&&t.getGap?this.config.getGap(e):ko(e.componentRow,Kn.CSS_GAP)}setGap(e){var t;if((t=this.config)!=null&&t.setGap)this.config.setGap(e);else{const{componentRow:s,gapValue:o,partial:i}=e;s.addStyle({[Kn.CSS_GAP]:o},{partial:i})}}};Kn.CSS_GAP="gap";let So=Kn;const Zs=class Zs{constructor(e){this.config=e}getParentSize(e){var i;if((i=this.config)!=null&&i.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,o=t.getEl();return o?s?o.clientHeight:o.clientWidth:0}isLayoutVertical(e){var s;if((s=this.config)!=null&&s.isParentVertical)return this.config.isParentVertical(e);const t=ko(e.componentRow,Zs.CSS_FLEX_DIRECTION,!0);return t==="column"||t==="column-reverse"}};Zs.CSS_FLEX_DIRECTION="flex-direction";let wo=Zs;const Jn=class Jn{constructor(e){this.config=e}getSize(e){var s;if((s=this.config)!=null&&s.getSize)return this.config.getSize(e);const t=e.componentColumn;if(t.is(Jn.MJML_COLUMN_TYPE)){const i=t.getAttributes().width;if(i&&(i.includes("%")||!isNaN(parseFloat(i))))return parseFloat(i);const r=t.parent();return 100/(r?r.components().length:1)}return 0}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:o,partial:i}=e;s.is(Jn.MJML_COLUMN_TYPE)&&s.addAttributes({width:`${parseFloat(o)}%`},{partial:i})}}};Jn.MJML_COLUMN_TYPE="mj-column";let Co=Jn;const Ys=class Ys{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var s;if((s=this.config)!=null&&s.getGap)return this.config.getGap(e);const{componentRow:t}=e;if(t.is(Ys.MJML_SECTION_TYPE)){const o=t.getAttributes();if(o&&o.padding)return parseInt(o.padding,10)||0}return 0}setGap(e){var t,s;(s=(t=this.config)==null?void 0:t.setGap)==null||s.call(t,e)}};Ys.MJML_SECTION_TYPE="mj-section";let xo=Ys;class Gu{constructor(e){this.config=e}getParentSize(e){var r;if((r=this.config)!=null&&r.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,o=t.getEl();if(!o)return 0;let i=o;if(o.tagName!=="TABLE"){const l=o.querySelectorAll("table");l.length&&(i=l[0])}return s?i.clientHeight:i.clientWidth}isLayoutVertical(e){var t;return(t=this.config)!=null&&t.isParentVertical?this.config.isParentVertical(e):!1}}class Jt{constructor(){this.handlerCache=new Map}static getInstance(){return Jt.instance||(Jt.instance=new Jt),Jt.instance}getHandlers(e){const t=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(t)||(Ut(e)?this.handlerCache.set(t,{sizeHandler:new Co(e),gapHandler:new xo(e),parentSizeHandler:new Gu(e)}):this.handlerCache.set(t,{sizeHandler:new vo(e),gapHandler:new So(e),parentSizeHandler:new wo(e)})),this.handlerCache.get(t)}}function bt(n){return Jt.getInstance().getHandlers(n)}const Br=n=>{n.style.display="none"},Hr=n=>{n.style.display="block"},gn=n=>+parseFloat(`${n}`).toFixed(2),Ut=n=>n.projectType===_i.email,us=(n,e)=>{const t=n.Canvas.getFramesEl();t&&(t.style.pointerEvents=e?"none":"")},ju=n=>n?["top","bottom"]:["left","right"],Ku=n=>{const e=n.parent();return e?e.components().models.indexOf(n)===0:!1},Ju=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.indexOf(n)===t.length-1},Uu=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.length>1&&n.index()===t.length-1},Zu=(n,e,t,s)=>{const i=n+(t?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return i>=0&&i<s?i:-1},hs=n=>n==="top"||n==="bottom",Yu=(n,e)=>!!(Ku(n)&&(e==="left"||e==="top")||Ju(n)&&(e==="right"||e==="bottom")),Xu=n=>{const e=n.parent();return e?e.components().models.length>1:!1},$r=(n,e)=>n==="right"||n==="bottom"?e>0:e<0,ko=(n,e,t=!1)=>{const s=!t,o=n.getEl();if(!o)return s?0:"";const r=window.getComputedStyle(o)[e]||"";if(s){let l;return typeof r=="string"?(l=parseFloat(r.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(r)||0,l}return r},Fr=(n,e,t)=>{const s=To({componentRow:n,isVertical:e},t),o=n.components().models;return s*(o.length-1)},yn=(n,e)=>bt(e).parentSizeHandler.isLayoutVertical({componentRow:n}),bn=(n,e)=>bt(e).sizeHandler.getSize(n),To=(n,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:t,parentSizeHandler:s}=bt(e);if(!t.isGapSupported())return 0;const o=t.getGap(n),i=s.getParentSize(n);return o/100*i},Mo=(n,e)=>bt(e).parentSizeHandler.getParentSize(n),vn=(n,e)=>{bt(e).sizeHandler.setSize(n)},Wr=(n,e)=>{const t=bn(n,e);vn({...n,sizeValue:`${t}%`,partial:!1},e)},_r=(n,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:t}=bt(e);t.isGapSupported()&&t.setGap(n)},Qu=(n,e)=>{const t=n.getStyle().gap;if(!t)return;const s=n.components().models,o={componentRow:n,isVertical:yn(n,e)};s.map(i=>Wr({...o,componentColumn:i},e)),_r({...o,gapValue:String(t),partial:!1},e)};function eh(n,e){const{Blocks:t}=n,{typeColumn:s,typeRow:o,blocks:i}=e;if(i===!1||Ut(e))return;const r=u=>({type:o,components:u.map(h=>({type:s,style:{"flex-basis":`${h}%`}}))}),l=u=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
159
159
  ${u.map(h=>`<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
160
- </div>`,a=(u,h)=>({id:`flex-row-${h.join("-")}`,label:u,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:r(h)}),c=[a("1 Column",[100]),a("2 Columns 50/50",[50,50]),a("2 Columns 25/75",[25,75]),a("2 Columns 75/25",[75,25]),a("3 Columns",[33.33,33.33,33.33]),a("3 Columns 50/25/25",[50,25,25]),a("3 Columns 25/50/25",[25,50,25]),a("3 Columns 25/25/50",[25,25,50]),a("4 Columns",[25,25,25,25]),a("5 Columns",[20,20,20,20,20])],d=Jn(i)?i({blocks:c}):c;return d.forEach(u=>t.add(u.id,u)),()=>{d.forEach(u=>t.remove(u.id))}}const qu=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:o,extendTypeColumn:i}=e,r=`${De}${o}`,a=!!o&&!!t.getType(o)&&!i;if(!(!o||a||Jt(e)))return t.addType(o,{isComponent:dt(o),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:r,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:$i(s),attributes:{[qe]:o},styles:`
160
+ </div>`,a=(u,h)=>({id:`flex-row-${h.join("-")}`,label:u,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:r(h)}),c=[a("1 Column",[100]),a("2 Columns 50/50",[50,50]),a("2 Columns 25/75",[25,75]),a("2 Columns 75/25",[75,25]),a("3 Columns",[33.33,33.33,33.33]),a("3 Columns 50/25/25",[50,25,25]),a("3 Columns 25/50/25",[25,50,25]),a("3 Columns 25/25/50",[25,25,50]),a("4 Columns",[25,25,25,25]),a("5 Columns",[20,20,20,20,20])],d=Un(i)?i({blocks:c}):c;return d.forEach(u=>t.add(u.id,u)),()=>{d.forEach(u=>t.remove(u.id))}}const th=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:o,extendTypeColumn:i}=e,r=`${De}${o}`,a=!!o&&!!t.getType(o)&&!i;if(!(!o||a||Ut(e)))return t.addType(o,{isComponent:ut(o),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:r,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:Gi(s),attributes:{[qe]:o},styles:`
161
161
  .${r} {
162
162
  flex-grow: 1;
163
163
  }
164
- `}}}),()=>{t.removeType(o)}},Gu=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:o,extendTypeRow:i}=e,r=`${De}${s}`,a=!!s&&!!t.getType(s)&&!i;if(!(!s||a||Jt(e)))return t.addType(s,{isComponent:dt(s),model:{defaults:{name:"Row",classes:r,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[qe]:s},droppable:Ys(o),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
164
+ `}}}),()=>{t.removeType(o)}},nh=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:o,extendTypeRow:i}=e,r=`${De}${s}`,a=!!s&&!!t.getType(s)&&!i;if(!(!s||a||Ut(e)))return t.addType(s,{isComponent:ut(s),model:{defaults:{name:"Row",classes:r,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[qe]:s},droppable:Qs(o),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
165
165
  .${r} {
166
166
  display: flex;
167
167
  align-items: stretch;
168
168
  flex-wrap: nowrap;
169
169
  }
170
- `}}}),()=>{t.removeType(s)}};class ju{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,t){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(t),this.registerResizableChild(t),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,t){const s=e.get("type"),o=t.get("type");return this.typeRelationships.has(s)?this.typeRelationships.get(s).has(o):!1}}class Ku{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,t,s){const{opts:o}=this,i=this.getState(e);i.direction=t,i.startX=s.clientX,i.startY=s.clientY,i.resizing=!0,i.lastSnappedPercent=void 0;const r=e.parent();if(!r||!this.registry.isValidRelationship(r,e))return;i.snapEnabled=r.get("snap")??o.snapEnabled,i.snapDivisions=r.get("snap-divisions")??o.snapDivisions??12;const l=r.components().models,a=l.findIndex(h=>h.cid===e.cid),c=gn(r,o),d=Hu(a,t,c,l.length);d!==-1&&(i.adjacentIdx=d);const u={componentColumn:e,componentRow:r,isVertical:c};if(i.startPercent=yn(u,o),typeof i.adjacentIdx<"u"){const h=l[i.adjacentIdx];i.neighborStartPercent=yn({...u,componentColumn:h},o)}}updateResizeByDelta(e,t,s){const o=this.getState(e),i=e.parent();!o.resizing||!i||(o.snapEnabled?this.updateSnapResize(e,t,s):this.updateContinuesResize(e,t,s))}finishResize(e){const t=e.parent(),s=t==null?void 0:t.components().models,o={componentRow:t,isVertical:!!t&&gn(t,this.opts)};s==null||s.forEach(i=>Lr({...o,componentColumn:i},this.opts)),this.clearState(e)}updateContinuesResize(e,t,s){const o=this.getState(e),i=e.parent(),{opts:r}=this;if(!i)return;const l=r.minItemPercent??0,a=us(t),c=ko({componentRow:i,isVertical:a},r),d=Vr(i,a,this.opts),h=100-d/c*100,f=s/(c-d)*h,{startPercent:p=0,neighborStartPercent:m=0}=o,g={componentRow:i,isVertical:a,componentColumn:e,partial:!0},b=zr(t,s)?p+Math.abs(f):p-Math.abs(f);if(typeof o.adjacentIdx<"u"){const C=i.components().models[o.adjacentIdx],y=p+m,v=y-l,S=Math.min(v,Math.max(l,b)),k=y-S;bn({...g,sizeValue:`${mn(S)}%`},r),bn({...g,componentColumn:C,sizeValue:`${mn(k)}%`},r)}else{const C=Math.max(l,Math.min(h,b));bn({...g,sizeValue:`${mn(C)}%`},r)}}updateSnapResize(e,t,s){const o=this.getState(e),i=e.parent(),r=us(t),l=ko({componentRow:i,isVertical:r},this.opts),a=Vr(i,r,this.opts),c=l-a,d=s/c*100,u=zr(t,s),{startPercent:h=0,snapDivisions:f=12}=o,p=u?h+Math.abs(d):h-Math.abs(d),m=100/f,g=Math.floor(p/m)*m,b=Math.ceil(p/m)*m,C=Math.abs(b-p),y=Math.abs(p-g),v=m*.2,w=C<y?b:g;if(w>0&&w<100&&(C<v||y<v)&&o.lastSnappedPercent!==w){o.lastSnappedPercent=w;let E=Math.abs(w-h)/100*c;(u&&(t==="left"||t==="top")||!u&&(t==="right"||t==="bottom"))&&(E=-E),this.updateContinuesResize(e,t,E)}else C>=v&&y>=v&&(o.lastSnappedPercent=void 0)}}class Ju{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s}updateGapByDelta(e,t,s,o){if(!this.registry.isGapAdjustableParent(e))return;const{opts:i}=this,r=Math.max(0,s+t),l=ko({componentRow:e,isVertical:o},i),a=r/l*100,c=e.components().models,d=c.length-1,u={componentRow:e,isVertical:o},h=c.reduce((v,w)=>v+yn({...u,componentColumn:w},i),0),p=100-a*d,m=i.minItemPercent||5;if(p<m*c.length)return;const b=100-d*a,C=h-b,y={componentRow:e,isVertical:o,partial:!0};c.map(v=>{const w=yn({...u,componentColumn:v},i),S=w-w/h*C;bn({...y,componentColumn:v,sizeValue:`${mn(S)}%`},i)}),Br({...y,gapValue:`${mn(a)}%`},i)}finishGapAdjust(e){Wu(e,this.opts)}}class Uu{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeHandler=new Ku(e,t,s),this.gapHandler=new Ju(e,t,s)}startResize(e,t,s){this.resizeHandler.startResize(e,t,s)}updateResizeByDelta(e,t,s){this.resizeHandler.updateResizeByDelta(e,t,s)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,t,s,o){this.gapHandler.updateGapByDelta(e,t,s,o)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const t=e.parent();return t?this.registry.isValidRelationship(t,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const hs="gs-flex-spots",Hr=`${hs}__handle-size`,Zu=`${hs}__handle-gap`;function Yu(n,e){const{Canvas:t}=n,s="flex-resize-spot";let o,i,r,l,a=null,c=null;const d=new ju,u=new Uu(n,d,e),h=()=>{var S;o=document.createElement("div"),o.className=hs,o.style.display="none",i=document.createElement("div"),i.className=`${hs}__handles`,i.style.position="absolute",i.style.pointerEvents="none",i.style.zIndex="21",r={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(r).forEach(([k,E])=>{const T=k,A=us(T);E.className=`${Hr} ${Hr}-${T} gjs-resizer-h gjs-cv-unscale`,E.style.cssText=`
170
+ `}}}),()=>{t.removeType(s)}};class sh{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,t){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(t),this.registerResizableChild(t),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,t){const s=e.get("type"),o=t.get("type");return this.typeRelationships.has(s)?this.typeRelationships.get(s).has(o):!1}}class oh{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,t,s){const{opts:o}=this,i=this.getState(e);i.direction=t,i.startX=s.clientX,i.startY=s.clientY,i.resizing=!0,i.lastSnappedPercent=void 0;const r=e.parent();if(!r||!this.registry.isValidRelationship(r,e))return;i.snapEnabled=r.get("snap")??o.snapEnabled,i.snapDivisions=r.get("snap-divisions")??o.snapDivisions??12;const l=r.components().models,a=l.findIndex(h=>h.cid===e.cid),c=yn(r,o),d=Zu(a,t,c,l.length);d!==-1&&(i.adjacentIdx=d);const u={componentColumn:e,componentRow:r,isVertical:c};if(i.startPercent=bn(u,o),typeof i.adjacentIdx<"u"){const h=l[i.adjacentIdx];i.neighborStartPercent=bn({...u,componentColumn:h},o)}}updateResizeByDelta(e,t,s){const o=this.getState(e),i=e.parent();!o.resizing||!i||(o.snapEnabled?this.updateSnapResize(e,t,s):this.updateContinuesResize(e,t,s))}finishResize(e){const t=e.parent(),s=t==null?void 0:t.components().models,o={componentRow:t,isVertical:!!t&&yn(t,this.opts)};s==null||s.forEach(i=>Wr({...o,componentColumn:i},this.opts)),this.clearState(e)}updateContinuesResize(e,t,s){const o=this.getState(e),i=e.parent(),{opts:r}=this;if(!i)return;const l=r.minItemPercent??0,a=hs(t),c=Mo({componentRow:i,isVertical:a},r),d=Fr(i,a,this.opts),h=100-d/c*100,f=s/(c-d)*h,{startPercent:p=0,neighborStartPercent:m=0}=o,g={componentRow:i,isVertical:a,componentColumn:e,partial:!0},b=$r(t,s)?p+Math.abs(f):p-Math.abs(f);if(typeof o.adjacentIdx<"u"){const C=i.components().models[o.adjacentIdx],y=p+m,v=y-l,w=Math.min(v,Math.max(l,b)),k=y-w;vn({...g,sizeValue:`${gn(w)}%`},r),vn({...g,componentColumn:C,sizeValue:`${gn(k)}%`},r)}else{const C=Math.max(l,Math.min(h,b));vn({...g,sizeValue:`${gn(C)}%`},r)}}updateSnapResize(e,t,s){const o=this.getState(e),i=e.parent(),r=hs(t),l=Mo({componentRow:i,isVertical:r},this.opts),a=Fr(i,r,this.opts),c=l-a,d=s/c*100,u=$r(t,s),{startPercent:h=0,snapDivisions:f=12}=o,p=u?h+Math.abs(d):h-Math.abs(d),m=100/f,g=Math.floor(p/m)*m,b=Math.ceil(p/m)*m,C=Math.abs(b-p),y=Math.abs(p-g),v=m*.2,S=C<y?b:g;if(S>0&&S<100&&(C<v||y<v)&&o.lastSnappedPercent!==S){o.lastSnappedPercent=S;let E=Math.abs(S-h)/100*c;(u&&(t==="left"||t==="top")||!u&&(t==="right"||t==="bottom"))&&(E=-E),this.updateContinuesResize(e,t,E)}else C>=v&&y>=v&&(o.lastSnappedPercent=void 0)}}class ih{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s}updateGapByDelta(e,t,s,o){if(!this.registry.isGapAdjustableParent(e))return;const{opts:i}=this,r=Math.max(0,s+t),l=Mo({componentRow:e,isVertical:o},i),a=r/l*100,c=e.components().models,d=c.length-1,u={componentRow:e,isVertical:o},h=c.reduce((v,S)=>v+bn({...u,componentColumn:S},i),0),p=100-a*d,m=i.minItemPercent||5;if(p<m*c.length)return;const b=100-d*a,C=h-b,y={componentRow:e,isVertical:o,partial:!0};c.map(v=>{const S=bn({...u,componentColumn:v},i),w=S-S/h*C;vn({...y,componentColumn:v,sizeValue:`${gn(w)}%`},i)}),_r({...y,gapValue:`${gn(a)}%`},i)}finishGapAdjust(e){Qu(e,this.opts)}}class rh{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeHandler=new oh(e,t,s),this.gapHandler=new ih(e,t,s)}startResize(e,t,s){this.resizeHandler.startResize(e,t,s)}updateResizeByDelta(e,t,s){this.resizeHandler.updateResizeByDelta(e,t,s)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,t,s,o){this.gapHandler.updateGapByDelta(e,t,s,o)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const t=e.parent();return t?this.registry.isValidRelationship(t,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const fs="gs-flex-spots",qr=`${fs}__handle-size`,lh=`${fs}__handle-gap`;function ah(n,e){const{Canvas:t}=n,s="flex-resize-spot";let o,i,r,l,a=null,c=null;const d=new sh,u=new rh(n,d,e),h=()=>{var w;o=document.createElement("div"),o.className=fs,o.style.display="none",i=document.createElement("div"),i.className=`${fs}__handles`,i.style.position="absolute",i.style.pointerEvents="none",i.style.zIndex="21",r={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(r).forEach(([k,E])=>{const T=k,A=hs(T);E.className=`${qr} ${qr}-${T} gjs-resizer-h gjs-cv-unscale`,E.style.cssText=`
171
171
  pointer-events: all;
172
172
  position: absolute;
173
173
  z-index: 1;
@@ -177,7 +177,7 @@
177
177
  ${T==="right"?"right: 0px;":""}
178
178
  ${T==="top"?"top: 0px;":""}
179
179
  ${T==="bottom"?"bottom: 0px;":""}
180
- `,E.addEventListener("pointerdown",f(T)),i.appendChild(E)}),!e.disableGapHandler&&!Jt(e)&&(l=document.createElement("div"),l.className=Zu,l.style.cssText=`
180
+ `,E.addEventListener("pointerdown",f(T)),i.appendChild(E)}),!e.disableGapHandler&&!Ut(e)&&(l=document.createElement("div"),l.className=lh,l.style.cssText=`
181
181
  position: absolute;
182
182
  background-color: #3b97e3;
183
183
  border-width: 2px;
@@ -187,17 +187,17 @@
187
187
  pointer-events: all;
188
188
  max-width: 3rem;
189
189
  max-height: 3rem;
190
- `,l.addEventListener("pointerdown",p()),i.appendChild(l)),o.append(i),(S=t.getSpotsEl())==null||S.appendChild(o)},f=S=>k=>{if(!a)return;ds(n,!0),k.stopPropagation(),k.preventDefault(),u.startResize(a,S,k);const E=k.clientX,T=k.clientY;k.target.setPointerCapture(k.pointerId);const A=D=>{const L=n.Canvas.getZoomMultiplier(),B=(D.clientX-E)*L,ke=(D.clientY-T)*L,Te=us(S)?ke:B;u.updateResizeByDelta(a,S,Te)},P=()=>{ds(n,!1),u.finishResize(a),k.target.releasePointerCapture(k.pointerId),document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",P)};document.addEventListener("pointermove",A),document.addEventListener("pointerup",P)},p=()=>S=>{if(!c)return;const k=c;ds(n,!0),S.stopPropagation(),S.preventDefault();const E=gn(k,e),T=xo({componentRow:k,isVertical:E},e),A=S.clientX,P=S.clientY;S.target.setPointerCapture(S.pointerId);const D=B=>{const ke=n.Canvas.getZoomMultiplier(),Te=E?(B.clientY-P)*ke:(B.clientX-A)*ke;u.updateGapByDelta(k,Te,T,E)},L=()=>{ds(n,!1),u.finishGapAdjust(k),S.target.releasePointerCapture(S.pointerId),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",L)};document.addEventListener("pointermove",D),document.addEventListener("pointerup",L)},m=S=>{const k=S.component;if(!k||!o||(a=k,c=k.parent(),!c))return;const E=c;Dr(o);const T=S.getStyle();i&&Object.assign(i.style,T);const A=gn(E,e),P=zu(A);if(Object.values(r).forEach(Rr),P.forEach(L=>{if($u(k,L))return;const B=r[L];Dr(B)}),yt(e).gapHandler.isGapSupported()&&l&&Fu(k)){const L=xo({componentRow:E,isVertical:A},e);g(L,A,Bu(k))}},g=(S,k,E=!1)=>{const T=e.gapHandleSize,A=l.style;if(k){A.height=`${T}px`;const P=l.offsetHeight;E?(A.top=`-${(S+P)/2}px`,A.bottom=""):(A.bottom=`-${(S+P)/2}px`,A.top=""),A.width="50%",A.left="50%",A.transform="translateX(-50%)",A.cursor="row-resize"}else{A.width=`${T}px`;const P=l.offsetWidth;E?(A.left=`-${(S+P)/2}px`,A.right=""):(A.right=`-${(S+P)/2}px`,A.left=""),A.height="50%",A.top="50%",A.transform="translateY(-50%)",A.cursor="col-resize"}},b=()=>{o&&(Rr(o),a=null,c=null)},C=()=>{t.removeSpots({type:s});const S=n.getSelected(),k=S==null?void 0:S.parent();S&&k&&d.isValidRelationship(k,S)?t.addSpot({type:s,component:S}):b()},y=()=>{const S=t.getSpots().filter(k=>k.type===s)[0];S&&m(S)},v=(S,k)=>{d.registerTypeRelationship(S,k)};n.onReady(()=>{h(),Jt(e)?v("mj-section","mj-column"):v(e.typeRow,e.typeColumn)});const w="component:toggled";return n.on(t.events.spot,y),n.on(w,C),()=>{n.off(t.events.spot,y),n.off(w,C)}}const Xu="flexComponent",Qu=ne(function(n,e={}){const t={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},s=[Gu(n,t),qu(n,t)],o=Yu(n,t),i=_u(n,t);se({editor:n,licenseKey:t.licenseKey,plan:W.startup,pluginName:Xu,cleanup:()=>{s.forEach(r=>r==null?void 0:r()),o(),i==null||i()}})}),eh=n=>n.dispatchEvent(new CustomEvent("input"));function th(n,e){if(!e)return()=>{};const t=n.Components.events,s=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),i=d=>d.isChildOf("text"),r=d=>n.getEditing()===d,l=(d,u={})=>{d.trigger("focus",u.event)},a=(d,u)=>{s(d)&&o(d)&&!r(d)&&l(d,u)},c=(d,u)=>{if(s(d)&&!o(d)&&i(d)){const h=d.parents().find(f=>f.isInstanceOf("text"));h&&(l(h,u),setTimeout(()=>n.select(h),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const To=new WeakMap,nh=(n,e)=>{To.set(n,e)},sh=n=>{To.delete(n)},Mo=n=>To.get(n),fs=n=>{const e=n.target,t=e.closest(".tox"),s=e.matches(".ephox-snooker-resizer-bar");(t||s)&&n.stopPropagation()},$r=n=>{n.stopPropagation(),n.preventDefault()},oh=(n,e)=>{const t=n.getDoc(),s=n.getWin();if(e!=null&&e.event){const{event:o}=e,{clientX:i,clientY:r}=o;let l;if(t.caretRangeFromPoint)l=t.caretRangeFromPoint(i,r);else if(t.caretPositionFromPoint){const a=t.caretPositionFromPoint(i,r);l=t.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=s.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),n.selection.setRng(l)}}else n.execCommand("SelectAll")},ih=n=>{var c,d;const{el:e,editor:t,componentView:s}=n,o=t.runCommand(G.getStateTheme),i=s.model,r={target:e,inline:!0,skin:(o==null?void 0:o.theme)===Li.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},l=((d=(c=n.pluginOpts)==null?void 0:c.loadConfig)==null?void 0:d.call(c,{config:r,editor:t,componentView:s,component:i}))||{};return{...r,...l}},Fr=(n,e=document)=>new Promise((t,s)=>{const o=Array.isArray(n)?[...n]:[n],{head:i}=e,r=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=r.bind(null,l),a.onerror=s,i.appendChild(a)}else t()};r(o)}),rh="rteTinyMce",lh=ne(function(n,e={}){const t={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:s}=t,o=n.Canvas.events,i=async(a,c)=>{const d=a.ownerDocument,u=d.defaultView,h=c==null?void 0:c.view;if(!u||!h){console.warn("Missing required data",{win:u,componentView:h});return}const f=ih({el:a,editor:n,componentView:h,pluginOpts:t}),m=(await u.tinymce.init(f))[0];if(!m)return;const b=(await window.tinymce.init({...f,target:document.createElement("div")}))[0];return m.ui.show(),d.body.addEventListener("mousedown",fs),document.body.addEventListener("mousedown",fs),m.on("Change",()=>eh(a)),m.on("blur",()=>m.ui.show()),m.on("OpenWindow",function(){var v;const C=(v=d.querySelector(".tox-dialog"))==null?void 0:v.closest(".tox");C&&(C==null?void 0:C.ownerDocument)!==document&&(document.body.appendChild(C),m.once("CloseWindow",()=>{C&&C.ownerDocument===document&&d.body.appendChild(C)}))}),a.addEventListener("dragstart",$r,{capture:!0}),n.runCommand(G.setStateContextMenu,{enabled:!1}),oh(m,c),{rteEditor:m,rteEditorShallow:b}},r=(a,c)=>{a.ownerDocument.body.removeEventListener("mousedown",fs),document.body.removeEventListener("mousedown",fs),a.removeEventListener("dragstart",$r,{capture:!0}),n.runCommand(G.setStateContextMenu,{enabled:!0}),c.rteEditor.destroy(),c.rteEditorShallow.destroy()};n.on(o.frameLoad,async({window:a})=>{Fr(s,a.document)}),n.onReady(()=>{Fr(s,document)}),n.setCustomRte({parseContent:!0,async enable(a,c,d){const u=Mo(a);if(u)return u.rteEditor;const h=await i(a,d);return h&&nh(a,h),h==null?void 0:h.rteEditor},disable(a){const c=Mo(a);c&&(sh(a),r(a,c))},getContent(a){var d,u;const c=Mo(a);return c?(u=(d=c.rteEditor).getContent)==null?void 0:u.call(d):a.innerHTML}});const l=th(n,t.enableOnClick);se({editor:n,licenseKey:t.licenseKey,plan:W.startup,pluginName:rh,cleanup:()=>{n.RichTextEditor.customRte=void 0,l()}})});function J(n){this.content=n}J.prototype={constructor:J,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var s=t&&t!=n?this.remove(t):this,o=s.find(n),i=s.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new J(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new J(t)},addToStart:function(n,e){return new J([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new J(t)},addBefore:function(n,e,t){var s=this.remove(e),o=s.content.slice(),i=s.find(n);return o.splice(i==-1?o.length:i,0,e,t),new J(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=J.from(n),n.size?new J(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=J.from(n),n.size?new J(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=J.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},J.from=function(n){if(n instanceof J)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new J(e)};function Wr(n,e,t){for(let s=0;;s++){if(s==n.childCount||s==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(s),i=e.child(s);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let r=0;o.text[r]==i.text[r];r++)t++;return t}if(o.content.size||i.content.size){let r=Wr(o.content,i.content,t+1);if(r!=null)return r}t+=o.nodeSize}}function _r(n,e,t,s){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:s};let r=n.child(--o),l=e.child(--i),a=r.nodeSize;if(r==l){t-=a,s-=a;continue}if(!r.sameMarkup(l))return{a:t,b:s};if(r.isText&&r.text!=l.text){let c=0,d=Math.min(r.text.length,l.text.length);for(;c<d&&r.text[r.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,s--;return{a:t,b:s}}if(r.content.size||l.content.size){let c=_r(r.content,l.content,t-1,s-1);if(c)return c}t-=a,s-=a}}class x{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let s=0;s<e.length;s++)this.size+=e[s].nodeSize}nodesBetween(e,t,s,o=0,i){for(let r=0,l=0;l<t;r++){let a=this.content[r],c=l+a.nodeSize;if(c>e&&s(a,o+l,i||null,r)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),s,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,s,o){let i="",r=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&s&&(r?r=!1:i+=s),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,s=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(s)&&(o[o.length-1]=t.withText(t.text+s.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new x(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let s=[],o=0;if(t>e)for(let i=0,r=0;r<t;i++){let l=this.content[i],a=r+l.nodeSize;a>e&&((r<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-r),Math.min(l.text.length,t-r)):l=l.cut(Math.max(0,e-r-1),Math.min(l.content.size,t-r-1))),s.push(l),o+=l.nodeSize),r=a}return new x(s,o)}cutByIndex(e,t){return e==t?x.empty:e==0&&t==this.content.length?this:new x(this.content.slice(e,t))}replaceChild(e,t){let s=this.content[e];if(s==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-s.nodeSize;return o[e]=t,new x(o,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,s=0;t<this.content.length;t++){let o=this.content[t];e(o,s,t),s+=o.nodeSize}}findDiffStart(e,t=0){return Wr(this,e,t)}findDiffEnd(e,t=this.size,s=e.size){return _r(this,e,t,s)}findIndex(e,t=-1){if(e==0)return ps(0,e);if(e==this.size)return ps(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let s=0,o=0;;s++){let i=this.child(s),r=o+i.nodeSize;if(r>=e)return r==e||t>0?ps(s+1,r):ps(s,o);o=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return x.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let t,s=0;for(let o=0;o<e.length;o++){let i=e[o];s+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new x(t||e,s)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const Ao={index:0,offset:0};function ps(n,e){return Ao.index=n,Ao.offset=e,Ao}function ms(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let s=0;s<n.length;s++)if(!ms(n[s],e[s]))return!1}else{for(let s in n)if(!(s in e)||!ms(n[s],e[s]))return!1;for(let s in e)if(!(s in n))return!1}return!0}class V{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,s=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!s&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),s=!0),t&&t.push(i)}}return t||(t=e.slice()),s||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ms(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let s=e.marks[t.type];if(!s)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=s.create(t.attrs);return s.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!e[s].eq(t[s]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return V.none;if(e instanceof V)return[e];let t=e.slice();return t.sort((s,o)=>s.type.rank-o.type.rank),t}}V.none=[];class gs extends Error{}class M{constructor(e,t,s){this.content=e,this.openStart=t,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let s=Gr(this.content,e+this.openStart,t);return s&&new M(s,this.openStart,this.openEnd)}removeBetween(e,t){return new M(qr(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return M.empty;let s=t.openStart||0,o=t.openEnd||0;if(typeof s!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(x.fromJSON(e,t.content),s,o)}static maxOpen(e,t=!0){let s=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)s++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new M(e,s,o)}}M.empty=new M(x.empty,0,0);function qr(n,e,t){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s),{index:r,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(r).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(s!=r)throw new RangeError("Removing non-flat range");return n.replaceChild(s,i.copy(qr(i.content,e-o-1,t-o-1)))}function Gr(n,e,t,s){let{index:o,offset:i}=n.findIndex(e),r=n.maybeChild(o);if(i==e||r.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Gr(r.content,e-i-1,t);return l&&n.replaceChild(o,r.copy(l))}function ah(n,e,t){if(t.openStart>n.depth)throw new gs("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gs("Inconsistent open depths");return jr(n,e,t,0)}function jr(n,e,t,s){let o=n.index(s),i=n.node(s);if(o==e.index(s)&&s<n.depth-t.openStart){let r=jr(n,e,t,s+1);return i.copy(i.content.replaceChild(o,r))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==s&&e.depth==s){let r=n.parent,l=r.content;return vt(r,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:r,end:l}=ch(t,n);return vt(i,Jr(n,r,l,e,s))}else return vt(i,ys(n,e,s))}function Kr(n,e){if(!e.type.compatibleContent(n.type))throw new gs("Cannot join "+e.type.name+" onto "+n.type.name)}function Eo(n,e,t){let s=n.node(t);return Kr(s,e.node(t)),s}function bt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function vn(n,e,t,s){let o=(e||n).node(t),i=0,r=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(bt(n.nodeAfter,s),i++));for(let l=i;l<r;l++)bt(o.child(l),s);e&&e.depth==t&&e.textOffset&&bt(e.nodeBefore,s)}function vt(n,e){return n.type.checkContent(e),n.copy(e)}function Jr(n,e,t,s,o){let i=n.depth>o&&Eo(n,e,o+1),r=s.depth>o&&Eo(t,s,o+1),l=[];return vn(null,n,o,l),i&&r&&e.index(o)==t.index(o)?(Kr(i,r),bt(vt(i,Jr(n,e,t,s,o+1)),l)):(i&&bt(vt(i,ys(n,e,o+1)),l),vn(e,t,o,l),r&&bt(vt(r,ys(t,s,o+1)),l)),vn(s,null,o,l),new x(l)}function ys(n,e,t){let s=[];if(vn(null,n,t,s),n.depth>t){let o=Eo(n,e,t+1);bt(vt(o,ys(n,e,t+1)),s)}return vn(e,null,t,s),new x(s)}function ch(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(x.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class wn{constructor(e,t,s){this.pos=e,this.path=t,this.parentOffset=s,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],o=e.child(t);return s?e.child(t).cut(s):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let s=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=s.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return V.none;if(this.textOffset)return e.child(t).marks;let s=e.maybeChild(t-1),o=e.maybeChild(t);if(!s){let l=s;s=o,o=l}let i=s.marks;for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!o||!i[r].isInSet(o.marks))&&(i=i[r--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let s=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);s>=0;s--)if(e.pos<=this.end(s)&&(!t||t(this.node(s))))return new bs(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let s=[],o=0,i=t;for(let r=e;;){let{index:l,offset:a}=r.content.findIndex(i),c=i-a;if(s.push(r,l,o+a),!c||(r=r.child(l),r.isText))break;i=c-1,o+=a+1}return new wn(t,s,i)}static resolveCached(e,t){let s=Ur.get(e);if(s)for(let i=0;i<s.elts.length;i++){let r=s.elts[i];if(r.pos==t)return r}else Ur.set(e,s=new dh);let o=s.elts[s.i]=wn.resolve(e,t);return s.i=(s.i+1)%uh,o}}class dh{constructor(){this.elts=[],this.i=0}}const uh=12,Ur=new WeakMap;class bs{constructor(e,t,s){this.$from=e,this.$to=t,this.depth=s}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const hh=Object.create(null);let wt=class Ri{constructor(e,t,s,o=V.none){this.type=e,this.attrs=t,this.marks=o,this.content=s||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,s,o=0){this.content.nodesBetween(e,t,s,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,s,o){return this.content.textBetween(e,t,s,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,s){return this.type==e&&ms(this.attrs,t||e.defaultAttrs||hh)&&V.sameSet(this.marks,s||V.none)}copy(e=null){return e==this.content?this:new Ri(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ri(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,s=!1){if(e==t)return M.empty;let o=this.resolve(e),i=this.resolve(t),r=s?0:o.sharedDepth(t),l=o.start(r),c=o.node(r).content.cut(o.pos-l,i.pos-l);return new M(c,o.depth-r,i.depth-r)}replace(e,t,s){return ah(this.resolve(e),this.resolve(t),s)}nodeAt(e){for(let t=this;;){let{index:s,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(s),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:s}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:s}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:s}=this.content.findIndex(e);if(s<e)return{node:this.content.child(t),index:t,offset:s};let o=this.content.child(t-1);return{node:o,index:t-1,offset:s-o.nodeSize}}resolve(e){return wn.resolveCached(this,e)}resolveNoCache(e){return wn.resolve(this,e)}rangeHasMark(e,t,s){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(s.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Zr(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,s=x.empty,o=0,i=s.childCount){let r=this.contentMatchAt(e).matchFragment(s,o,i),l=r&&r.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(s.child(a).marks))return!1;return!0}canReplaceWith(e,t,s,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(s),r=i&&i.matchFragment(this.content,t);return r?r.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=V.none;for(let t=0;t<this.marks.length;t++){let s=this.marks[t];s.type.checkAttrs(s.attrs),e=s.addToSet(e)}if(!V.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let s;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,s)}let o=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,s);return i.type.checkAttrs(i.attrs),i}};wt.prototype.text=void 0;class vs extends wt{constructor(e,t,s,o){if(super(e,t,null,o),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zr(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new vs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new vs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Zr(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class St{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let s=new fh(e,t);if(s.next==null)return St.empty;let o=Yr(s);s.next&&s.err("Unexpected trailing text");let i=wh(vh(o));return Sh(i,s),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,s=e.childCount){let o=this;for(let i=t;o&&i<s;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let s=0;s<e.next.length;s++)if(this.next[t].type==e.next[s].type)return!0;return!1}fillBefore(e,t=!1,s=0){let o=[this];function i(r,l){let a=r.matchFragment(e,s);if(a&&(!t||a.validEnd))return x.from(l.map(c=>c.createAndFill()));for(let c=0;c<r.next.length;c++){let{type:d,next:u}=r.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let h=i(u,l.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let s=0;s<this.wrapCache.length;s+=2)if(this.wrapCache[s]==e)return this.wrapCache[s+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let o=s.shift(),i=o.match;if(i.matchType(e)){let r=[];for(let l=o;l.type;l=l.via)r.push(l.type);return r.reverse()}for(let r=0;r<i.next.length;r++){let{type:l,next:a}=i.next[r];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(s.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(s){e.push(s);for(let o=0;o<s.next.length;o++)e.indexOf(s.next[o].next)==-1&&t(s.next[o].next)}return t(this),e.map((s,o)=>{let i=o+(s.validEnd?"*":" ")+" ";for(let r=0;r<s.next.length;r++)i+=(r?", ":"")+s.next[r].type.name+"->"+e.indexOf(s.next[r].next);return i}).join(`
191
- `)}}St.empty=new St(!0);class fh{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Yr(n){let e=[];do e.push(ph(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ph(n){let e=[];do e.push(mh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function mh(n){let e=bh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=gh(n,e);else break;return e}function Xr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function gh(n,e){let t=Xr(n),s=t;return n.eat(",")&&(n.next!="}"?s=Xr(n):s=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:s,expr:e}}function yh(n,e){let t=n.nodeTypes,s=t[e];if(s)return[s];let o=[];for(let i in t){let r=t[i];r.isInGroup(e)&&o.push(r)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function bh(n){if(n.eat("(")){let e=Yr(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=yh(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function vh(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function s(r,l,a){let c={term:a,to:l};return e[r].push(c),c}function o(r,l){r.forEach(a=>a.to=l)}function i(r,l){if(r.type=="choice")return r.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(r.type=="seq")for(let a=0;;a++){let c=i(r.exprs[a],l);if(a==r.exprs.length-1)return c;o(c,l=t())}else if(r.type=="star"){let a=t();return s(l,a),o(i(r.expr,a),a),[s(a)]}else if(r.type=="plus"){let a=t();return o(i(r.expr,l),a),o(i(r.expr,a),a),[s(a)]}else{if(r.type=="opt")return[s(l)].concat(i(r.expr,l));if(r.type=="range"){let a=l;for(let c=0;c<r.min;c++){let d=t();o(i(r.expr,a),d),a=d}if(r.max==-1)o(i(r.expr,a),a);else for(let c=r.min;c<r.max;c++){let d=t();s(a,d),o(i(r.expr,a),d),a=d}return[s(a)]}else{if(r.type=="name")return[s(l,void 0,r.value)];throw new Error("Unknown expr type")}}}}function Qr(n,e){return e-n}function el(n,e){let t=[];return s(e),t.sort(Qr);function s(o){let i=n[o];if(i.length==1&&!i[0].term)return s(i[0].to);t.push(o);for(let r=0;r<i.length;r++){let{term:l,to:a}=i[r];!l&&t.indexOf(a)==-1&&s(a)}}}function wh(n){let e=Object.create(null);return t(el(n,0));function t(s){let o=[];s.forEach(r=>{n[r].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);el(n,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[s.join(",")]=new St(s.indexOf(n.length-1)>-1);for(let r=0;r<o.length;r++){let l=o[r][1].sort(Qr);i.next.push({type:o[r][0],next:e[l.join(",")]||t(l)})}return i}}function Sh(n,e){for(let t=0,s=[n];t<s.length;t++){let o=s[t],i=!o.validEnd,r=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];r.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),s.indexOf(c)==-1&&s.push(c)}i&&e.err("Only non-generatable nodes ("+r.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tl(n){let e=Object.create(null);for(let t in n){let s=n[t];if(!s.hasDefault)return null;e[t]=s.default}return e}function nl(n,e){let t=Object.create(null);for(let s in n){let o=e&&e[s];if(o===void 0){let i=n[s];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+s)}t[s]=o}return t}function sl(n,e,t,s){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let i=n[o];i.validate&&i.validate(e[o])}}function ol(n,e){let t=Object.create(null);if(e)for(let s in e)t[s]=new xh(n,s,e[s]);return t}let il=class Kc{constructor(e,t,s){this.name=e,this.schema=t,this.spec=s,this.markSet=null,this.groups=s.group?s.group.split(" "):[],this.attrs=ol(e,s.attrs),this.defaultAttrs=tl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(s.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==St.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:nl(this.attrs,e)}create(e=null,t,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wt(this,this.computeAttrs(e),x.from(t),V.setFrom(s))}createChecked(e=null,t,s){return t=x.from(t),this.checkContent(t),new wt(this,this.computeAttrs(e),t,V.setFrom(s))}createAndFill(e=null,t,s){if(e=this.computeAttrs(e),t=x.from(t),t.size){let r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(x.empty,!0);return i?new wt(this,e,t.append(i),V.setFrom(s)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let s=0;s<e.childCount;s++)if(!this.allowsMarks(e.child(s).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){sl(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let s=0;s<e.length;s++)this.allowsMarkType(e[s].type)?t&&t.push(e[s]):t||(t=e.slice(0,s));return t?t.length?t:V.none:e}static compile(e,t){let s=Object.create(null);e.forEach((i,r)=>s[i]=new Kc(i,t,r));let o=t.spec.topNode||"doc";if(!s[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let i in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function Ch(n,e,t){let s=t.split("|");return o=>{let i=o===null?"null":typeof o;if(s.indexOf(i)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${n}, got ${i}`)}}class xh{constructor(e,t,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Ch(e,t,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class ws{constructor(e,t,s,o){this.name=e,this.rank=t,this.schema=s,this.spec=o,this.attrs=ol(e,o.attrs),this.excluded=null;let i=tl(this.attrs);this.instance=i?new V(this,i):null}create(e=null){return!e&&this.instance?this.instance:new V(this,nl(this.attrs,e))}static compile(e,t){let s=Object.create(null),o=0;return e.forEach((i,r)=>s[i]=new ws(i,o++,t,r)),s}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){sl(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class kh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=J.from(e.nodes),t.marks=J.from(e.marks||{}),this.nodes=il.compile(this.spec.nodes,this),this.marks=ws.compile(this.spec.marks,this);let s=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],r=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=s[r]||(s[r]=St.parse(r,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?rl(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],r=i.spec.excludes;i.excluded=r==null?[i]:r==""?[]:rl(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,s,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof il){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,s,o)}text(e,t){let s=this.nodes.text;return new vs(s,s.defaultAttrs,e,V.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return wt.fromJSON(this,e)}markFromJSON(e){return V.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function rl(n,e){let t=[];for(let s=0;s<e.length;s++){let o=e[s],i=n.marks[o],r=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(r=a)}if(!r)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return t}function Th(n){return n.tag!=null}function Mh(n){return n.style!=null}class Ut{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let s=this.matchedStyles=[];t.forEach(o=>{if(Th(o))this.tags.push(o);else if(Mh(o)){let i=/[^=]*/.exec(o.style)[0];s.indexOf(i)<0&&s.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let s=new dl(this,t,!1);return s.addAll(e,V.none,t.from,t.to),s.finish()}parseSlice(e,t={}){let s=new dl(this,t,!0);return s.addAll(e,V.none,t.from,t.to),M.maxOpen(s.finish())}matchTag(e,t,s){for(let o=s?this.tags.indexOf(s)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Oh(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let r=i.getAttrs(e);if(r===!1)continue;i.attrs=r||void 0}return i}}}matchStyle(e,t,s,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let r=this.styles[i],l=r.style;if(!(l.indexOf(e)!=0||r.context&&!s.matchesContext(r.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(r.getAttrs){let a=r.getAttrs(t);if(a===!1)continue;r.attrs=a||void 0}return r}}}static schemaRules(e){let t=[];function s(o){let i=o.priority==null?50:o.priority,r=0;for(;r<t.length;r++){let l=t[r];if((l.priority==null?50:l.priority)<i)break}t.splice(r,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(r=>{s(r=ul(r)),r.mark||r.ignore||r.clearMark||(r.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(r=>{s(r=ul(r)),r.node||r.ignore||r.mark||(r.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ut(e,Ut.schemaRules(e)))}}const ll={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ah={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},al={ol:!0,ul:!0},Ss=1,Cs=2,Sn=4;function cl(n,e,t){return e!=null?(e?Ss:0)|(e==="full"?Cs:0):n&&n.whitespace=="pre"?Ss|Cs:t&~Sn}class xs{constructor(e,t,s,o,i,r){this.type=e,this.attrs=t,this.marks=s,this.solid=o,this.options=r,this.content=[],this.activeMarks=V.none,this.match=i||(r&Sn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let s=this.type.contentMatch,o;return(o=s.findWrapping(e.type))?(this.match=s,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ss)){let s=this.content[this.content.length-1],o;if(s&&s.isText&&(o=/[ \t\r\n\u000c]+$/.exec(s.text))){let i=s;s.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ll.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class dl{constructor(e,t,s){this.parser=e,this.options=t,this.isOpen=s,this.open=0;let o=t.topNode,i,r=cl(null,t.preserveWhitespace,0)|(s?Sn:0);o?i=new xs(o.type,o.attrs,V.none,!0,t.topMatch||o.type.contentMatch,r):s?i=new xs(null,null,V.none,!0,null,r):i=new xs(e.schema.topNodeType,null,V.none,!0,null,r),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let s=e.nodeValue,o=this.top;if(o.options&Cs||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o.options&Ss)o.options&Cs?s=s.replace(/\r\n?/g,`
192
- `):s=s.replace(/\r?\n|\r/g," ");else if(s=s.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(s)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],r=e.previousSibling;(!i||r&&r.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(s=s.slice(1))}s&&this.insertNode(this.parser.schema.text(s),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,s){let o=e.nodeName.toLowerCase(),i;al.hasOwnProperty(o)&&this.parser.normalizeLists&&Eh(e);let r=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,s));if(r?r.ignore:Ah.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!r||r.skip||r.closeParent){r&&r.closeParent?this.open=Math.max(0,this.open-1):r&&r.skip.nodeType&&(e=r.skip);let l,a=this.top,c=this.needsBlock;if(ll.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let d=r&&r.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,r,l,r.consuming===!1?i:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
193
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let s=e.style;if(s&&s.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],r=s.getPropertyValue(i);if(r)for(let l=void 0;;){let a=this.parser.matchStyle(i,r,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,s,o){let i,r;if(t.node)if(r=this.parser.schema.nodes[t.node],r.isLeaf)this.insertNode(r.create(t.attrs),s)||this.leafFallback(e,s);else{let a=this.enter(r,t.attrs||null,s,t.preserveWhitespace);a&&(i=!0,s=a)}else{let a=this.parser.schema.marks[t.mark];s=s.concat(a.create(t.attrs))}let l=this.top;if(r&&r.isLeaf)this.findInside(e);else if(o)this.addElement(e,s,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,s));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,s),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,s,o){let i=s||0;for(let r=s?e.childNodes[s]:e.firstChild,l=o==null?null:e.childNodes[o];r!=l;r=r.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(r,t);this.findAtPoint(e,i)}findPlace(e,t){let s,o;for(let i=this.open;i>=0;i--){let r=this.nodes[i],l=r.findWrapping(e);if(l&&(!s||s.length>l.length)&&(s=l,o=r,!l.length)||r.solid)break}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=V.none;for(let r of s.concat(e.marks))(o.type?o.type.allowsMarkType(r.type):hl(r.type,e.type))&&(i=r.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,s,o){let i=this.findPlace(e.create(t),s);return i&&(i=this.enterInner(e,t,s,!0,o)),i}enterInner(e,t,s,o=!1,i){this.closeExtra();let r=this.top;r.match=r.match&&r.match.matchType(e);let l=cl(e,i,r.options);r.options&Sn&&r.content.length==0&&(l|=Sn);let a=V.none;return s=s.filter(c=>(r.type?r.type.allowsMarkType(c.type):hl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new xs(e,t,a,o,null,l)),this.open++,s}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let s=this.nodes[t].content;for(let o=s.length-1;o>=0;o--)e+=s[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&this.find[s].offset==t&&(this.find[s].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,s){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(s?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),s=this.options.context,o=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),i=-(s?s.depth+1:0)+(o?0:1),r=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(r(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:s&&a>=i?s.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return r(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let t in this.parser.schema.nodes){let s=this.parser.schema.nodes[t];if(s.isTextblock&&s.defaultAttrs)return s}}}function Eh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&al.hasOwnProperty(s)&&t?(t.appendChild(e),e=t):s=="li"?t=e:s&&(t=null)}}function Oh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ul(n){let e={};for(let t in n)e[t]=n[t];return e}function hl(n,e){let t=e.schema.nodes;for(let s in t){let o=t[s];if(!o.allowsMarkType(n))continue;let i=[],r=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&r(d))return!0}};if(r(o.contentMatch))return!0}}class Ct{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},s){s||(s=Oo(t).createDocumentFragment());let o=s,i=[];return e.forEach(r=>{if(i.length||r.marks.length){let l=0,a=0;for(;l<i.length&&a<r.marks.length;){let c=r.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<r.marks.length;){let c=r.marks[a++],d=this.serializeMark(c,r.isInline,t);d&&(i.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(r,t))}),s}serializeNodeInner(e,t){let{dom:s,contentDOM:o}=ks(Oo(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return s}serializeNode(e,t={}){let s=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(s),s=i.dom)}return s}serializeMark(e,t,s={}){let o=this.marks[e.type.name];return o&&ks(Oo(s),o(e,t),null,e.attrs)}static renderSpec(e,t,s=null,o){return ks(e,t,s,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ct(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=fl(e.nodes);return t.text||(t.text=s=>s.text),t}static marksFromSchema(e){return fl(e.marks)}}function fl(n){let e={};for(let t in n){let s=n[t].spec.toDOM;s&&(e[t]=s)}return e}function Oo(n){return n.document||window.document}const pl=new WeakMap;function Nh(n){let e=pl.get(n);return e===void 0&&pl.set(n,e=Ph(n)),e}function Ph(n){let e=null;function t(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let o=0;o<s.length;o++)t(s[o]);else for(let o in s)t(s[o])}return t(n),e}function ks(n,e,t,s){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(s&&(i=Nh(s))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let r=o.indexOf(" ");r>0&&(t=o.slice(0,r),o=o.slice(r+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=ks(n,h,t,s);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const ml=65535,gl=Math.pow(2,16);function Ih(n,e){return n+e*gl}function yl(n){return n&ml}function Rh(n){return(n-(n&ml))/gl}const bl=1,vl=2,Ts=4,wl=8;class No{constructor(e,t,s){this.pos=e,this.delInfo=t,this.recover=s}get deleted(){return(this.delInfo&wl)>0}get deletedBefore(){return(this.delInfo&(bl|Ts))>0}get deletedAfter(){return(this.delInfo&(vl|Ts))>0}get deletedAcross(){return(this.delInfo&Ts)>0}}class he{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&he.empty)return he.empty}recover(e){let t=0,s=yl(e);if(!this.inverted)for(let o=0;o<s;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[s*3]+t+Rh(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,s){let o=0,i=this.inverted?2:1,r=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+r],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:t:t,f=a+o+(h<0?0:d);if(s)return f;let p=e==(t<0?a:u)?null:Ih(l/3,e-a),m=e==a?vl:e==u?bl:Ts;return(t<0?e!=a:e!=u)&&(m|=wl),new No(f,m,p)}o+=d-c}return s?e+o:new No(e+o,0,null)}touches(e,t){let s=0,o=yl(t),i=this.inverted?2:1,r=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==o*3)return!0;s+=this.ranges[l+r]-c}return!1}forEach(e){let t=this.inverted?2:1,s=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let r=this.ranges[o],l=r-(this.inverted?i:0),a=r+(this.inverted?0:i),c=this.ranges[o+t],d=this.ranges[o+s];e(l,l+c,a,a+d),i+=d-c}}invert(){return new he(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?he.empty:new he(e<0?[0,-e,0]:[0,0,e])}}he.empty=new he([]);class Zt{constructor(e=[],t,s=0,o=e.length){this.maps=e,this.mirror=t,this.from=s,this.to=o}slice(e=0,t=this.maps.length){return new Zt(this.maps,this.mirror,e,t)}copy(){return new Zt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,s=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?s+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,s=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?s-o-1:void 0)}}invert(){let e=new Zt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let s=this.from;s<this.to;s++)e=this.maps[s].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,s){let o=0;for(let i=this.from;i<this.to;i++){let r=this.maps[i],l=r.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return s?e:new No(e,o,null)}}const Po=Object.create(null);class X{getMap(){return he.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=Po[t.stepType];if(!s)throw new RangeError(`No step type ${t.stepType} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in Po)throw new RangeError("Duplicate use of step JSON ID "+e);return Po[e]=t,t.prototype.jsonID=e,t}}class _{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new _(e,null)}static fail(e){return new _(null,e)}static fromReplace(e,t,s,o){try{return _.ok(e.replace(t,s,o))}catch(i){if(i instanceof gs)return _.fail(i.message);throw i}}}function Io(n,e,t){let s=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Io(i.content,e,i))),i.isInline&&(i=e(i,t,o)),s.push(i)}return x.fromArray(s)}class Ke extends X{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=e.resolve(this.from),o=s.node(s.sharedDepth(this.to)),i=new M(Io(t.content,(r,l)=>!r.isAtom||!l.type.allowsMarkType(this.mark.type)?r:r.mark(this.mark.addToSet(r.marks)),o),t.openStart,t.openEnd);return _.fromReplace(e,this.from,this.to,i)}invert(){return new Ee(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new Ke(t.pos,s.pos,this.mark)}merge(e){return e instanceof Ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ke(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ke(t.from,t.to,e.markFromJSON(t.mark))}}X.jsonID("addMark",Ke);class Ee extends X{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=new M(Io(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return _.fromReplace(e,this.from,this.to,s)}invert(){return new Ke(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new Ee(t.pos,s.pos,this.mark)}merge(e){return e instanceof Ee&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ee(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ee(t.from,t.to,e.markFromJSON(t.mark))}}X.jsonID("removeMark",Ee);class Je extends X{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return _.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return _.fromReplace(e,this.pos,this.pos+1,new M(x.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let s=this.mark.addToSet(t.marks);if(s.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(s))return new Je(this.pos,t.marks[o]);return new Je(this.pos,this.mark)}}return new Yt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Je(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Je(t.pos,e.markFromJSON(t.mark))}}X.jsonID("addNodeMark",Je);class Yt extends X{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return _.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return _.fromReplace(e,this.pos,this.pos+1,new M(x.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Je(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yt(t.pos,e.markFromJSON(t.mark))}}X.jsonID("removeNodeMark",Yt);class Q extends X{constructor(e,t,s,o=!1){super(),this.from=e,this.to=t,this.slice=s,this.structure=o}apply(e){return this.structure&&Ro(e,this.from,this.to)?_.fail("Structure replace would overwrite content"):_.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new he([this.from,this.to-this.from,this.slice.size])}invert(e){return new Q(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deletedAcross&&s.deletedAcross?null:new Q(t.pos,Math.max(t.pos,s.pos),this.slice)}merge(e){if(!(e instanceof Q)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Q(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Q(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Q(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}X.jsonID("replace",Q);class U extends X{constructor(e,t,s,o,i,r,l=!1){super(),this.from=e,this.to=t,this.gapFrom=s,this.gapTo=o,this.slice=i,this.insert=r,this.structure=l}apply(e){if(this.structure&&(Ro(e,this.from,this.gapFrom)||Ro(e,this.gapTo,this.to)))return _.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return _.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,t.content);return s?_.fromReplace(e,this.from,this.to,s):_.fail("Content does not fit in gap")}getMap(){return new he([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new U(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?s.pos:e.map(this.gapTo,1);return t.deletedAcross&&s.deletedAcross||o<t.pos||i>s.pos?null:new U(t.pos,s.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new U(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}X.jsonID("replaceAround",U);function Ro(n,e,t){let s=n.resolve(e),o=t-e,i=s.depth;for(;o>0&&i>0&&s.indexAfter(i)==s.node(i).childCount;)i--,o--;if(o>0){let r=s.node(i).maybeChild(s.indexAfter(i));for(;o>0;){if(!r||r.isLeaf)return!0;r=r.firstChild,o--}}return!1}function Dh(n,e,t,s){let o=[],i=[],r,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!s.isInSet(u)&&d.type.allowsMarkType(s.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=s.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(r&&r.to==h&&r.mark.eq(u[m])?r.to=f:o.push(r=new Ee(h,f,u[m])));l&&l.to==h?l.to=f:i.push(l=new Ke(h,f,s))}}),o.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function zh(n,e,t,s){let o=[],i=0;n.doc.nodesBetween(e,t,(r,l)=>{if(!r.isInline)return;i++;let a=null;if(s instanceof ws){let c=r.marks,d;for(;d=s.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else s?s.isInSet(r.marks)&&(a=[s]):a=r.marks;if(a&&a.length){let c=Math.min(l+r.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],h;for(let f=0;f<o.length;f++){let p=o[f];p.step==i-1&&u.eq(o[f].style)&&(h=p)}h?(h.to=c,h.step=i):o.push({style:u,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(r=>n.step(new Ee(r.from,r.to,r.style)))}function Do(n,e,t,s=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),r=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,u=s.matchType(c.type);if(!u)r.push(new Q(l,d,M.empty));else{s=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Ee(l,d,c.marks[h]));if(o&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new M(x.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),r.push(new Q(l+h.index,l+h.index+h[0].length,p))}}l=d}if(!s.validEnd){let a=s.fillBefore(x.empty,!0);n.replace(l,l,new M(a,0,0))}for(let a=r.length-1;a>=0;a--)n.step(r[a])}function Vh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ms(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let s=n.depth;;--s){let o=n.$from.node(s),i=n.$from.index(s),r=n.$to.indexAfter(s);if(s<n.depth&&o.canReplace(i,r,t))return s;if(s==0||o.type.spec.isolating||!Vh(o,i,r))break}return null}function Lh(n,e,t){let{$from:s,$to:o,depth:i}=e,r=s.before(i+1),l=o.after(i+1),a=r,c=l,d=x.empty,u=0;for(let p=i,m=!1;p>t;p--)m||s.index(p)>0?(m=!0,d=x.from(s.node(p).copy(d)),u++):a--;let h=x.empty,f=0;for(let p=i,m=!1;p>t;p--)m||o.after(p+1)<o.end(p)?(m=!0,h=x.from(o.node(p).copy(h)),f++):c++;n.step(new U(a,c,r,l,new M(d.append(h),u,f),d.size-u,!0))}function Sl(n,e,t=null,s=n){let o=Bh(n,e),i=o&&Hh(s,e);return i?o.map(Cl).concat({type:e,attrs:t}).concat(i.map(Cl)):null}function Cl(n){return{type:n,attrs:null}}function Bh(n,e){let{parent:t,startIndex:s,endIndex:o}=n,i=t.contentMatchAt(s).findWrapping(e);if(!i)return null;let r=i.length?i[0]:e;return t.canReplaceWith(s,o,r)?i:null}function Hh(n,e){let{parent:t,startIndex:s,endIndex:o}=n,i=t.child(s),r=e.contentMatch.findWrapping(i.type);if(!r)return null;let a=(r.length?r[r.length-1]:e).contentMatch;for(let c=s;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:r}function $h(n,e,t){let s=x.empty;for(let r=t.length-1;r>=0;r--){if(s.size){let l=t[r].type.contentMatch.matchFragment(s);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=x.from(t[r].type.create(t[r].attrs,s))}let o=e.start,i=e.end;n.step(new U(o,i,o,i,new M(s,0,0),t.length,!0))}function Fh(n,e,t,s,o){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(r,l)=>{let a=typeof o=="function"?o(r):o;if(r.isTextblock&&!r.hasMarkup(s,a)&&Wh(n.doc,n.mapping.slice(i).map(l),s)){let c=null;if(s.schema.linebreakReplacement){let f=s.whitespace=="pre",p=!!s.contentMatch.matchType(s.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&kl(n,r,l,i),Do(n,n.mapping.slice(i).map(l,1),s,void 0,c===null);let d=n.mapping.slice(i),u=d.map(l,1),h=d.map(l+r.nodeSize,1);return n.step(new U(u,h,u+1,h-1,new M(x.from(s.create(a,null,r.marks)),0,0),1,!0)),c===!0&&xl(n,r,l,i),!1}})}function xl(n,e,t,s){e.forEach((o,i)=>{if(o.isText){let r,l=/\r?\n|\r/g;for(;r=l.exec(o.text);){let a=n.mapping.slice(s).map(t+1+i+r.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function kl(n,e,t,s){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let r=n.mapping.slice(s).map(t+1+i);n.replaceWith(r,r+1,e.type.schema.text(`
194
- `))}})}function Wh(n,e,t){let s=n.resolve(e),o=s.index();return s.parent.canReplaceWith(o,o+1,t)}function _h(n,e,t,s,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let r=t.create(s,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,r);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new U(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new M(x.from(r),0,0),1,!0))}function Xt(n,e,t=1,s){let o=n.resolve(e),i=o.depth-t,r=s&&s[s.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!r.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),h=o.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=s&&s[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=s&&s[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let l=o.indexAfter(i),a=s&&s[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function qh(n,e,t=1,s){let o=n.doc.resolve(e),i=x.empty,r=x.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=x.from(o.node(l).copy(i));let d=s&&s[c];r=x.from(d?d.type.create(d.attrs,r):o.node(l).copy(r))}n.step(new Q(e,e,new M(i.append(r),t,t),!0))}function As(n,e){let t=n.resolve(e),s=t.index();return jh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(s,s+1)}function Gh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:s}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),r=i.type==s?n.type.schema.nodes.text:i.type;if(t=t.matchType(r),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function jh(n,e){return!!(n&&e&&!n.isLeaf&&Gh(n,e))}function Kh(n,e,t){let s=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),r=i.node().type;if(o&&r.inlineContent){let d=r.whitespace=="pre",u=!!r.contentMatch.matchType(o);d&&!u?s=!1:!d&&u&&(s=!0)}let l=n.steps.length;if(s===!1){let d=n.doc.resolve(e+t);kl(n,d.node(),d.before(),l)}r.inlineContent&&Do(n,e+t-1,r,i.node().contentMatchAt(i.index()),s==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Q(c,a.map(e+t,-1),M.empty,!0)),s===!0){let d=n.doc.resolve(c);xl(n,d.node(),d.before(),n.steps.length)}return n}function Jh(n,e,t){let s=n.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),t))return e;if(s.parentOffset==0)for(let o=s.depth-1;o>=0;o--){let i=s.index(o);if(s.node(o).canReplaceWith(i,i,t))return s.before(o+1);if(i>0)return null}if(s.parentOffset==s.parent.content.size)for(let o=s.depth-1;o>=0;o--){let i=s.indexAfter(o);if(s.node(o).canReplaceWith(i,i,t))return s.after(o+1);if(i<s.node(o).childCount)return null}return null}function Uh(n,e,t){let s=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let r=s.depth;r>=0;r--){let l=r==s.depth?0:s.pos<=(s.start(r+1)+s.end(r+1))/2?-1:1,a=s.index(r)+(l>0?1:0),c=s.node(r),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?s.pos:l<0?s.before(r+1):s.after(r+1)}return null}function zo(n,e,t=e,s=M.empty){if(e==t&&!s.size)return null;let o=n.resolve(e),i=n.resolve(t);return Tl(o,i,s)?new Q(e,t,s):new Zh(o,i,s).fit()}function Tl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Zh{constructor(e,t,s){this.$from=e,this.$to=t,this.unplaced=s,this.frontier=[],this.placed=x.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=x.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,s=this.$from,o=this.close(e<0?this.$to:s.doc.resolve(e));if(!o)return null;let i=this.placed,r=s.depth,l=o.depth;for(;r&&l&&i.childCount==1;)i=i.firstChild.content,r--,l--;let a=new M(i,r,l);return e>-1?new U(s.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||s.pos!=this.$to.pos?new Q(s.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,s=0,o=this.unplaced.openEnd;s<e;s++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=s){e=s;break}t=i.content}for(let t=1;t<=2;t++)for(let s=t==1?e:this.unplaced.openStart;s>=0;s--){let o,i=null;s?(i=Vo(this.unplaced.content,s-1).firstChild,o=i.content):o=this.unplaced.content;let r=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(r?c.matchType(r.type)||(u=c.fillBefore(x.from(r),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:s,frontierDepth:l,parent:i,inject:u};if(t==2&&r&&(d=c.findWrapping(r.type)))return{sliceDepth:s,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:s}=this.unplaced,o=Vo(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(s,o.size+t>=e.size-s?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:s}=this.unplaced,o=Vo(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new M(Cn(e,t-1,1),t-1,i?t-1:s)}else this.unplaced=new M(Cn(e,t,1),t,s)}placeNodes({sliceDepth:e,frontierDepth:t,parent:s,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let r=this.unplaced,l=s?s.content:r.content,a=r.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)d.push(o.child(m));u=u.matchFragment(o)}let f=l.size+e-(r.content.size-r.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,d.push(Ml(m.mark(h.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=xn(this.placed,t,x.from(d)),this.frontier[t].match=u,p&&f<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?M.empty:new M(Cn(r.content,e-1,1),e-1,f<0?r.openEnd:e-1):new M(Cn(r.content,e,c),r.openStart,r.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Lo(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:s}=this.$to,o=this.$to.after(s);for(;s>1&&o==this.$to.end(--s);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:s,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),r=Lo(e,t,o,s,i);if(r){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Lo(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:r,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=xn(this.placed,t.depth,t.fit)),e=t.move;for(let s=t.depth+1;s<=e.depth;s++){let o=e.node(s),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(s));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,s){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=xn(this.placed,this.depth,x.from(e.create(t,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(x.empty,!0);t.childCount&&(this.placed=xn(this.placed,this.frontier.length,t))}}function Cn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Cn(n.firstChild.content,e-1,t)))}function xn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(xn(n.lastChild.content,e-1,t)))}function Vo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Ml(n,e,t){if(e<=0)return n;let s=n.content;return e>1&&(s=s.replaceChild(0,Ml(s.firstChild,e-1,s.childCount==1?t-1:0))),e>0&&(s=n.type.contentMatch.fillBefore(s).append(s),t<=0&&(s=s.append(n.type.contentMatch.matchFragment(s).fillBefore(x.empty,!0)))),n.copy(s)}function Lo(n,e,t,s,o){let i=n.node(e),r=o?n.indexAfter(e):n.index(e);if(r==i.childCount&&!t.compatibleContent(i.type))return null;let l=s.fillBefore(i.content,!0,r);return l&&!Yh(t,i.content,r)?l:null}function Yh(n,e,t){for(let s=t;s<e.childCount;s++)if(!n.allowsMarks(e.child(s).marks))return!0;return!1}function Xh(n){return n.spec.defining||n.spec.definingForContent}function Qh(n,e,t,s){if(!s.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(Tl(o,i,s))return n.step(new Q(e,t,s));let r=El(o,n.doc.resolve(t));r[r.length-1]==0&&r.pop();let l=-(o.depth+1);r.unshift(l);for(let h=o.depth,f=o.pos-1;h>0;h--,f--){let p=o.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;r.indexOf(h)>-1?l=h:o.before(h)==f&&r.splice(1,0,-h)}let a=r.indexOf(l),c=[],d=s.openStart;for(let h=s.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==s.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Xh(f.type);if(p&&!f.sameMarkup(o.node(Math.abs(l)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=s.openStart;h>=0;h--){let f=(h+d+1)%(s.openStart+1),p=c[f];if(p)for(let m=0;m<r.length;m++){let g=r[(m+a)%r.length],b=!0;g<0&&(b=!1,g=-g);let C=o.node(g-1),y=o.index(g-1);if(C.canReplaceWith(y,y,p.type,p.marks))return n.replace(o.before(g),b?i.after(g):t,new M(Al(s.content,0,s.openStart,f),f,s.openEnd))}}let u=n.steps.length;for(let h=r.length-1;h>=0&&(n.replace(e,t,s),!(n.steps.length>u));h--){let f=r[h];f<0||(e=o.before(f),t=i.after(f))}}function Al(n,e,t,s,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Al(i.content,e+1,t,s,i)))}if(e>s){let i=o.contentMatchAt(0),r=i.fillBefore(n).append(n);n=r.append(i.matchFragment(r).fillBefore(x.empty,!0))}return n}function ef(n,e,t,s){if(!s.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Jh(n.doc,e,s.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new M(x.from(s),0,0))}function tf(n,e,t){let s=n.doc.resolve(e),o=n.doc.resolve(t),i=El(s,o);for(let r=0;r<i.length;r++){let l=i[r],a=r==i.length-1;if(a&&l==0||s.node(l).type.contentMatch.validEnd)return n.delete(s.start(l),o.end(l));if(l>0&&(a||s.node(l-1).canReplace(s.index(l-1),o.indexAfter(l-1))))return n.delete(s.before(l),o.after(l))}for(let r=1;r<=s.depth&&r<=o.depth;r++)if(e-s.start(r)==s.depth-r&&t>s.end(r)&&o.end(r)-t!=o.depth-r&&s.start(r-1)==o.start(r-1)&&s.node(r-1).canReplace(s.index(r-1),o.index(r-1)))return n.delete(s.before(r),t);n.delete(e,t)}function El(n,e){let t=[],s=Math.min(n.depth,e.depth);for(let o=s;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class Qt extends X{constructor(e,t,s){super(),this.pos=e,this.attr=t,this.value=s}apply(e){let t=e.nodeAt(this.pos);if(!t)return _.fail("No node at attribute step's position");let s=Object.create(null);for(let i in t.attrs)s[i]=t.attrs[i];s[this.attr]=this.value;let o=t.type.create(s,null,t.marks);return _.fromReplace(e,this.pos,this.pos+1,new M(x.from(o),0,t.isLeaf?0:1))}getMap(){return he.empty}invert(e){return new Qt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Qt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Qt(t.pos,t.attr,t.value)}}X.jsonID("attr",Qt);class kn extends X{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let s=e.type.create(t,e.content,e.marks);return _.ok(s)}getMap(){return he.empty}invert(e){return new kn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kn(t.attr,t.value)}}X.jsonID("docAttr",kn);let en=class extends Error{};en=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},en.prototype=Object.create(Error.prototype),en.prototype.constructor=en,en.prototype.name="TransformError";class Ol{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new en(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,s=M.empty){let o=zo(this.doc,e,t,s);return o&&this.step(o),this}replaceWith(e,t,s){return this.replace(e,t,new M(x.from(s),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,s){return Qh(this,e,t,s),this}replaceRangeWith(e,t,s){return ef(this,e,t,s),this}deleteRange(e,t){return tf(this,e,t),this}lift(e,t){return Lh(this,e,t),this}join(e,t=1){return Kh(this,e,t),this}wrap(e,t){return $h(this,e,t),this}setBlockType(e,t=e,s,o=null){return Fh(this,e,t,s,o),this}setNodeMarkup(e,t,s=null,o){return _h(this,e,t,s,o),this}setNodeAttribute(e,t,s){return this.step(new Qt(e,t,s)),this}setDocAttribute(e,t){return this.step(new kn(e,t)),this}addNodeMark(e,t){return this.step(new Je(e,t)),this}removeNodeMark(e,t){if(!(t instanceof V)){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(t=t.isInSet(s.marks),!t)return this}return this.step(new Yt(e,t)),this}split(e,t=1,s){return qh(this,e,t,s),this}addMark(e,t,s){return Dh(this,e,t,s),this}removeMark(e,t,s){return zh(this,e,t,s),this}clearIncompatible(e,t,s){return Do(this,e,t,s),this}}const Bo=Object.create(null);class I{constructor(e,t,s){this.$anchor=e,this.$head=t,this.ranges=s||[new Nl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=M.empty){let s=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=s,s=s.lastChild;let i=e.steps.length,r=this.ranges;for(let l=0;l<r.length;l++){let{$from:a,$to:c}=r[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?M.empty:t),l==0&&Rl(e,i,(s?s.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let s=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:r,$to:l}=o[i],a=e.mapping.slice(s),c=a.map(r.pos),d=a.map(l.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Rl(e,s,t.isInline?-1:1))}}static findFrom(e,t,s=!1){let o=e.parent.inlineContent?new R(e):tn(e.node(0),e.parent,e.pos,e.index(),t,s);if(o)return o;for(let i=e.depth-1;i>=0;i--){let r=t<0?tn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,s):tn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,s);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new fe(e.node(0))}static atStart(e){return tn(e,e,0,0,1)||new fe(e)}static atEnd(e){return tn(e,e,e.content.size,e.childCount,-1)||new fe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=Bo[t.type];if(!s)throw new RangeError(`No selection type ${t.type} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in Bo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class Nl{constructor(e,t){this.$from=e,this.$to=t}}let Pl=!1;function Il(n){!Pl&&!n.parent.inlineContent&&(Pl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class R extends I{constructor(e,t=e){Il(e),Il(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let s=e.resolve(t.map(this.head));if(!s.parent.inlineContent)return I.near(s);let o=e.resolve(t.map(this.anchor));return new R(o.parent.inlineContent?o:s,s)}replace(e,t=M.empty){if(super.replace(e,t),t==M.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Es(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new R(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,s=t){let o=e.resolve(t);return new this(o,s==t?o:e.resolve(s))}static between(e,t,s){let o=e.pos-t.pos;if((!s||o)&&(s=o>=0?1:-1),!t.parent.inlineContent){let i=I.findFrom(t,s,!0)||I.findFrom(t,-s,!0);if(i)t=i.$head;else return I.near(t,s)}return e.parent.inlineContent||(o==0?e=t:(e=(I.findFrom(e,-s,!0)||I.findFrom(e,s,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new R(e,t)}}I.jsonID("text",R);class Es{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Es(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class N extends I{constructor(e){let t=e.nodeAfter,s=e.node(0).resolve(e.pos+t.nodeSize);super(e,s),this.node=t}map(e,t){let{deleted:s,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return s?I.near(i):new N(i)}content(){return new M(x.from(this.node),0,0)}eq(e){return e instanceof N&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ho(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new N(e.resolve(t.anchor))}static create(e,t){return new N(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}N.prototype.visible=!1,I.jsonID("node",N);class Ho{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:s}=e.mapResult(this.anchor);return t?new Es(s,s):new Ho(s)}resolve(e){let t=e.resolve(this.anchor),s=t.nodeAfter;return s&&N.isSelectable(s)?new N(t):I.near(t)}}class fe extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.empty){e.delete(0,e.doc.content.size);let s=I.atStart(e.doc);s.eq(e.selection)||e.setSelection(s)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new fe(e)}map(e){return new fe(e)}eq(e){return e instanceof fe}getBookmark(){return nf}}I.jsonID("all",fe);const nf={map(){return this},resolve(n){return new fe(n)}};function tn(n,e,t,s,o,i=!1){if(e.inlineContent)return R.create(n,t);for(let r=s-(o>0?0:1);o>0?r<e.childCount:r>=0;r+=o){let l=e.child(r);if(l.isAtom){if(!i&&N.isSelectable(l))return N.create(n,t-(o<0?l.nodeSize:0))}else{let a=tn(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function Rl(n,e,t){let s=n.steps.length-1;if(s<e)return;let o=n.steps[s];if(!(o instanceof Q||o instanceof U))return;let i=n.mapping.maps[s],r;i.forEach((l,a,c,d)=>{r==null&&(r=d)}),n.setSelection(I.near(n.doc.resolve(r),t))}const Dl=1,Os=2,zl=4;class sf extends Ol{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Dl)&~Os,this.storedMarks=null,this}get selectionSet(){return(this.updated&Dl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Os,this}ensureMarks(e){return V.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Os)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Os,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let s=this.selection;return t&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||V.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,s){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(s==null&&(s=t),s=s??t,!e)return this.deleteRange(t,s);let i=this.storedMarks;if(!i){let r=this.doc.resolve(t);i=s==t?r.marks():r.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(t,s,o.text(e,i)),this.selection.empty||this.setSelection(I.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zl,this}get scrolledIntoView(){return(this.updated&zl)>0}}function Vl(n,e){return!e||!n?n:n.bind(e)}class Tn{constructor(e,t,s){this.name=e,this.init=Vl(t.init,s),this.apply=Vl(t.apply,s)}}const of=[new Tn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Tn("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new Tn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,s){return s.selection.$cursor?n.storedMarks:null}}),new Tn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class $o{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=of.slice(),t&&t.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new Tn(s.key,s.spec.state,s))})}}class nn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let s=0;s<this.config.plugins.length;s++)if(s!=t){let o=this.config.plugins[s];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],s=this.applyInner(e),o=null;for(;;){let i=!1;for(let r=0;r<this.config.plugins.length;r++){let l=this.config.plugins[r];if(l.spec.appendTransaction){let a=o?o[r].n:0,c=o?o[r].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,s);if(d&&s.filterTransaction(d,r)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<r?{state:s,n:t.length}:{state:this,n:0})}t.push(d),s=s.applyInner(d),i=!0}o&&(o[r]={state:s,n:t.length})}}if(!i)return{state:s,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new nn(this.config),s=this.config.fields;for(let o=0;o<s.length;o++){let i=s[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new sf(this)}static create(e){let t=new $o(e.doc?e.doc.type.schema:e.schema,e.plugins),s=new nn(t);for(let o=0;o<t.fields.length;o++)s[t.fields[o].name]=t.fields[o].init(e,s);return s}reconfigure(e){let t=new $o(this.schema,e.plugins),s=t.fields,o=new nn(t);for(let i=0;i<s.length;i++){let r=s[i].name;o[r]=this.hasOwnProperty(r)?this[r]:s[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(s=>s.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[s],i=o.spec.state;i&&i.toJSON&&(t[s]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,s){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new $o(e.schema,e.plugins),i=new nn(o);return o.fields.forEach(r=>{if(r.name=="doc")i.doc=wt.fromJSON(e.schema,t.doc);else if(r.name=="selection")i.selection=I.fromJSON(i.doc,t.selection);else if(r.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let l in s){let a=s[l],c=a.spec.state;if(a.key==r.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[r.name]=c.fromJSON.call(a,e,t[l],i);return}}i[r.name]=r.init(e,i)}}),i}}function Ll(n,e,t){for(let s in n){let o=n[s];o instanceof Function?o=o.bind(e):s=="handleDOMEvents"&&(o=Ll(o,e,{})),t[s]=o}return t}class Mn{constructor(e){this.spec=e,this.props={},e.props&&Ll(e.props,this,this.props),this.key=e.key?e.key.key:Bl("plugin")}getState(e){return e[this.key]}}const Fo=Object.create(null);function Bl(n){return n in Fo?n+"$"+ ++Fo[n]:(Fo[n]=0,n+"$")}class An{constructor(e="key"){this.key=Bl(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Hl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function rf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const lf=(n,e,t)=>{let s=rf(n,t);if(!s)return!1;let o=$l(s);if(!o){let r=s.blockRange(),l=r&&Ms(r);return l==null?!1:(e&&e(n.tr.lift(r,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(jl(n,o,e,-1))return!0;if(s.parent.content.size==0&&(sn(i,"end")||N.isSelectable(i)))for(let r=s.depth;;r--){let l=zo(n.doc,s.before(r),s.after(r),M.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(sn(i,"end")?I.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):N.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(r==1||s.node(r-1).childCount>1)break}return i.isAtom&&o.depth==s.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function sn(n,e,t=!1){for(let s=n;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(t&&s.childCount!=1)return!1}return!1}const af=(n,e,t)=>{let{$head:s,empty:o}=n.selection,i=s;if(!o)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):s.parentOffset>0)return!1;i=$l(s)}let r=i&&i.nodeBefore;return!r||!N.isSelectable(r)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,i.pos-r.nodeSize)).scrollIntoView()),!0)};function $l(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function cf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const df=(n,e,t)=>{let s=cf(n,t);if(!s)return!1;let o=Fl(s);if(!o)return!1;let i=o.nodeAfter;if(jl(n,o,e,1))return!0;if(s.parent.content.size==0&&(sn(i,"start")||N.isSelectable(i))){let r=zo(n.doc,s.before(),s.after(),M.empty);if(r&&r.slice.size<r.to-r.from){if(e){let l=n.tr.step(r);l.setSelection(sn(i,"start")?I.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):N.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==s.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},uf=(n,e,t)=>{let{$head:s,empty:o}=n.selection,i=s;if(!o)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):s.parentOffset<s.parent.content.size)return!1;i=Fl(s)}let r=i&&i.nodeAfter;return!r||!N.isSelectable(r)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,i.pos)).scrollIntoView()),!0)};function Fl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const hf=(n,e)=>{let{$head:t,$anchor:s}=n.selection;return!t.parent.type.spec.code||!t.sameParent(s)?!1:(e&&e(n.tr.insertText(`
195
- `).scrollIntoView()),!0)};function Wo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Wl=(n,e)=>{let{$head:t,$anchor:s}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(s))return!1;let o=t.node(-1),i=t.indexAfter(-1),r=Wo(o.contentMatchAt(i));if(!r||!o.canReplaceWith(i,i,r))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,r.createAndFill());a.setSelection(I.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},ff=(n,e)=>{let t=n.selection,{$from:s,$to:o}=t;if(t instanceof fe||s.parent.inlineContent||o.parent.inlineContent)return!1;let i=Wo(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let r=(!s.parentOffset&&o.index()<o.parent.childCount?s:o).pos,l=n.tr.insert(r,i.createAndFill());l.setSelection(R.create(l.doc,r+1)),e(l.scrollIntoView())}return!0},_l=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Xt(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let s=t.blockRange(),o=s&&Ms(s);return o==null?!1:(e&&e(n.tr.lift(s,o).scrollIntoView()),!0)};function ql(n){return(e,t)=>{let{$from:s,$to:o}=e.selection;if(e.selection instanceof N&&e.selection.node.isBlock)return!s.parentOffset||!Xt(e.doc,s.pos)?!1:(t&&t(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let i=[],r,l,a=!1,c=!1;for(let f=s.depth;;f--)if(s.node(f).isBlock){a=s.end(f)==s.pos+(s.depth-f),c=s.start(f)==s.pos-(s.depth-f),l=Wo(s.node(f-1).contentMatchAt(s.indexAfter(f-1)));let m=n&&n(o.parent,a,s);i.unshift(m||(a&&l?{type:l}:null)),r=f;break}else{if(f==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof R||e.selection instanceof fe)&&d.deleteSelection();let u=d.mapping.map(s.pos),h=Xt(d.doc,u,i.length,i);if(h||(i[0]=l?{type:l}:null,h=Xt(d.doc,u,i.length,i)),d.split(u,i.length,i),!a&&c&&s.node(r).type!=l){let f=d.mapping.map(s.before(r)),p=d.doc.resolve(f);l&&s.node(r-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(s.before(r)),l)}return t&&t(d.scrollIntoView()),!0}}const pf=ql(),Gl=(n,e)=>(e&&e(n.tr.setSelection(new fe(n.doc))),!0);function mf(n,e,t){let s=e.nodeBefore,o=e.nodeAfter,i=e.index();return!s||!o||!s.type.compatibleContent(o.type)?!1:!s.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||As(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function jl(n,e,t,s){let o=e.nodeBefore,i=e.nodeAfter,r,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&mf(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(r=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(r[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,p=x.empty;for(let b=r.length-1;b>=0;b--)p=x.from(r[b].create(null,p));p=x.from(o.copy(p));let m=n.tr.step(new U(e.pos-1,f,e.pos,f,new M(p,1,0),r.length,!0)),g=m.doc.resolve(f+2*r.length);g.nodeAfter&&g.nodeAfter.type==o.type&&As(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||s>0&&a?null:I.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Ms(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&sn(i,"start",!0)&&sn(o,"end")){let f=o,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let b=x.empty;for(let y=p.length-1;y>=0;y--)b=x.from(p[y].copy(b));let C=n.tr.step(new U(e.pos-p.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new M(b,p.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function Kl(n){return function(e,t){let s=e.selection,o=n<0?s.$from:s.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(R.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}const gf=Kl(-1),yf=Kl(1);function bf(n,e=null){return function(t,s){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(r,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,n)}})}if(!o)return!1;if(s){let i=t.tr;for(let r=0;r<t.selection.ranges.length;r++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[r];i.setBlockType(l,a,n,e)}s(i.scrollIntoView())}return!0}}function vf(n,e,t,s){for(let o=0;o<e.length;o++){let{$from:i,$to:r}=e[o],l=i.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(i.pos,r.pos,(a,c)=>{if(l||!s)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function xt(n,e=null,t){let s=t!==!1;return function(o,i){let{empty:r,$cursor:l,ranges:a}=o.selection;if(r&&!l||!vf(o.doc,a,n,s))return!1;if(i)if(l)n.isInSet(o.storedMarks||l.marks())?i(o.tr.removeStoredMark(n)):i(o.tr.addStoredMark(n.create(e)));else{let c,d=o.tr;c=!a.some(u=>o.doc.rangeHasMark(u.$from.pos,u.$to.pos,n));for(let u=0;u<a.length;u++){let{$from:h,$to:f}=a[u];if(!c)d.removeMark(h.pos,f.pos,n);else{let p=h.pos,m=f.pos,g=h.nodeAfter,b=f.nodeBefore,C=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,y=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;p+C<m&&(p+=C,m-=y),d.addMark(p,m,n.create(e))}}i(d.scrollIntoView())}return!0}}function En(...n){return function(e,t,s){for(let o=0;o<n.length;o++)if(n[o](e,t,s))return!0;return!1}}let _o=En(Hl,lf,af),Jl=En(Hl,df,uf);const Ve={Enter:En(hf,ff,_l,pf),"Mod-Enter":Wl,Backspace:_o,"Mod-Backspace":_o,"Shift-Backspace":_o,Delete:Jl,"Mod-Delete":Jl,"Mod-a":Gl},Ul={"Ctrl-h":Ve.Backspace,"Alt-Backspace":Ve["Mod-Backspace"],"Ctrl-d":Ve.Delete,"Ctrl-Alt-Backspace":Ve["Mod-Delete"],"Alt-Delete":Ve["Mod-Delete"],"Alt-d":Ve["Mod-Delete"],"Ctrl-a":gf,"Ctrl-e":yf};for(let n in Ve)Ul[n]=Ve[n];const wf=(typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1)?Ul:Ve;var Ns=200,j=function(){};j.prototype.append=function(e){return e.length?(e=j.from(e),!this.length&&e||e.length<Ns&&this.leafAppend(e)||this.length<Ns&&e.leafPrepend(this)||this.appendInner(e)):this},j.prototype.prepend=function(e){return e.length?j.from(e).append(this):this},j.prototype.appendInner=function(e){return new Sf(this,e)},j.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?j.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},j.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},j.prototype.forEach=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length),t<=s?this.forEachInner(e,t,s,0):this.forEachInvertedInner(e,t,s,0)},j.prototype.map=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length);var o=[];return this.forEach(function(i,r){return o.push(e(i,r))},t,s),o},j.from=function(e){return e instanceof j?e:e&&e.length?new Zl(e):j.empty};var Zl=function(n){function e(s){n.call(this),this.values=s}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,r,l){for(var a=i;a<r;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,r,l){for(var a=i-1;a>=r;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ns)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ns)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(j);j.empty=new Zl([]);var Sf=function(n){function e(t,s){n.call(this),this.left=t,this.right=s,this.length=t.length+s.length,this.depth=Math.max(t.depth,s.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},e.prototype.forEachInner=function(s,o,i,r){var l=this.left.length;if(o<l&&this.left.forEachInner(s,o,Math.min(i,l),r)===!1||i>l&&this.right.forEachInner(s,Math.max(o-l,0),Math.min(this.length,i)-l,r+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,r){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(s,o-l,Math.max(i,l)-l,r+l)===!1||i<l&&this.left.forEachInvertedInner(s,Math.min(o,l),i,r)===!1)return!1},e.prototype.sliceInner=function(s,o){if(s==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(s,o):s>=i?this.right.slice(s-i,o-i):this.left.slice(s,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(s){var o=this.right.leafAppend(s);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(s){var o=this.left.leafPrepend(s);if(o)return new e(o,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e}(j);const Cf=500;class we{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let o,i;t&&(o=this.remapping(s,this.items.length),i=o.maps.length);let r=e.tr,l,a,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){o||(o=this.remapping(s,h+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Oe(u.map));let f=u.step.map(o.slice(i)),p;f&&r.maybeStep(f).doc&&(p=r.mapping.maps[r.mapping.maps.length-1],c.push(new Oe(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else r.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new we(this.items.slice(0,s).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:r,selection:l}}addTransform(e,t,s,o){let i=[],r=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Oe(e.mapping.maps[d],u,t),f;(f=a&&a.merge(h))&&(h=f,d?i.pop():l=l.slice(0,l.length-1)),i.push(h),t&&(r++,t=void 0),o||(a=h)}let c=r-s.depth;return c>kf&&(l=xf(l,c),r-=c),new we(l.append(i),r)}remapping(e,t){let s=new Zt;return this.items.forEach((o,i)=>{let r=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?s.maps.length-o.mirrorOffset:void 0;s.appendMap(o.map,r)},e,t),s}addMaps(e){return this.eventCount==0?this:new we(this.items.append(e.map(t=>new Oe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let s=[],o=Math.max(0,this.items.length-t),i=e.mapping,r=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},o);let a=t;this.items.forEach(h=>{let f=i.getMirror(--a);if(f==null)return;r=Math.min(r,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(i.slice(a+1,f));g&&l++,s.push(new Oe(p,m,g))}else s.push(new Oe(p))},o);let c=[];for(let h=t;h<r;h++)c.push(new Oe(i.maps[h]));let d=this.items.slice(0,o).append(c).append(s),u=new we(d,l);return u.emptyItemCount()>Cf&&(u=u.compress(this.items.length-s.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),s=t.maps.length,o=[],i=0;return this.items.forEach((r,l)=>{if(l>=e)o.push(r),r.selection&&i++;else if(r.step){let a=r.step.map(t.slice(s)),c=a&&a.getMap();if(s--,c&&t.appendMap(c,s),a){let d=r.selection&&r.selection.map(t.slice(s));d&&i++;let u=new Oe(c.invert(),a,d),h,f=o.length-1;(h=o.length&&o[f].merge(u))?o[f]=h:o.push(u)}}else r.map&&s--},this.items.length,0),new we(j.from(o.reverse()),i)}}we.empty=new we(j.empty,0);function xf(n,e){let t;return n.forEach((s,o)=>{if(s.selection&&e--==0)return t=o,!1}),n.slice(t)}class Oe{constructor(e,t,s,o){this.map=e,this.step=t,this.selection=s,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Oe(t.getMap().invert(),t,this.selection)}}}class Ue{constructor(e,t,s,o,i){this.done=e,this.undone=t,this.prevRanges=s,this.prevTime=o,this.prevComposition=i}}const kf=20;function Tf(n,e,t,s){let o=t.getMeta(kt),i;if(o)return o.historyState;t.getMeta(Ef)&&(n=new Ue(n.done,n.undone,null,0,-1));let r=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(r&&r.getMeta(kt))return r.getMeta(kt).redo?new Ue(n.done.addTransform(t,void 0,s,Ps(e)),n.undone,Yl(t.mapping.maps),n.prevTime,n.prevComposition):new Ue(n.done,n.undone.addTransform(t,void 0,s,Ps(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(r&&r.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!r&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-s.newGroupDelay||!Mf(t,n.prevRanges)),c=r?qo(n.prevRanges,t.mapping):Yl(t.mapping.maps);return new Ue(n.done.addTransform(t,a?e.selection.getBookmark():void 0,s,Ps(e)),we.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new Ue(n.done.rebased(t,i),n.undone.rebased(t,i),qo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ue(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),qo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Mf(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((s,o)=>{for(let i=0;i<e.length;i+=2)s<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function Yl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((s,o,i,r)=>e.push(i,r));return e}function qo(n,e){if(!n)return null;let t=[];for(let s=0;s<n.length;s+=2){let o=e.map(n[s],1),i=e.map(n[s+1],-1);o<=i&&t.push(o,i)}return t}function Af(n,e,t){let s=Ps(e),o=kt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,s);if(!i)return null;let r=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),o,s),a=new Ue(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(r).setMeta(kt,{redo:t,historyState:a})}let Go=!1,Xl=null;function Ps(n){let e=n.plugins;if(Xl!=e){Go=!1,Xl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Go=!0;break}}return Go}const kt=new An("history"),Ef=new An("closeHistory");function Of(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Mn({key:kt,state:{init(){return new Ue(we.empty,we.empty,null,0,-1)},apply(e,t,s){return Tf(t,s,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let s=t.inputType,o=s=="historyUndo"?ea:s=="historyRedo"?jo:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Ql(n,e){return(t,s)=>{let o=kt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(s){let i=Af(o,t,n);i&&s(e?i.scrollIntoView():i)}return!0}}const ea=Ql(!1,!0),jo=Ql(!0,!0);for(var Ze={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Is={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Nf=typeof navigator<"u"&&/Mac/.test(navigator.platform),Pf=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Z=0;Z<10;Z++)Ze[48+Z]=Ze[96+Z]=String(Z);for(var Z=1;Z<=24;Z++)Ze[Z+111]="F"+Z;for(var Z=65;Z<=90;Z++)Ze[Z]=String.fromCharCode(Z+32),Is[Z]=String.fromCharCode(Z);for(var Ko in Ze)Is.hasOwnProperty(Ko)||(Is[Ko]=Ze[Ko]);function If(n){var e=Nf&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Pf&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Is:Ze)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Rf=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Df(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let s,o,i,r;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))s=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Rf?r=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return s&&(t="Alt-"+t),o&&(t="Ctrl-"+t),r&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function zf(n){let e=Object.create(null);for(let t in n)e[Df(t)]=n[t];return e}function Jo(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Uo(n){return new Mn({props:{handleKeyDown:ta(n)}})}function ta(n){let e=zf(n);return function(t,s){let o=If(s),i,r=e[Jo(o,s)];if(r&&r(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(s.shiftKey){let l=e[Jo(o,s,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((s.shiftKey||s.altKey||s.metaKey||o.charCodeAt(0)>127)&&(i=Ze[s.keyCode])&&i!=o){let l=e[Jo(i,s)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function na(n,e=null){return function(t,s){let{$from:o,$to:i}=t.selection,r=o.blockRange(i),l=!1,a=r;if(!r)return!1;if(r.depth>=2&&o.node(r.depth-1).type.compatibleContent(n)&&r.startIndex==0){if(o.index(r.depth-1)==0)return!1;let d=t.doc.resolve(r.start-2);a=new bs(d,d,r.depth),r.endIndex<r.parent.childCount&&(r=new bs(o,t.doc.resolve(i.end(r.depth)),r.depth)),l=!0}let c=Sl(a,n,e,r);return c?(s&&s(Vf(t.tr,r,c,l,n).scrollIntoView()),!0):!1}}function Vf(n,e,t,s,o){let i=x.empty;for(let d=t.length-1;d>=0;d--)i=x.from(t[d].type.create(t[d].attrs,i));n.step(new U(e.start-(s?2:0),e.end,e.start,e.end,new M(i,0,0),t.length,!0));let r=0;for(let d=0;d<t.length;d++)t[d].type==o&&(r=d+1);let l=t.length-r,a=e.start+t.length-(s?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&Xt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Lf(n,e){return function(t,s){let{$from:o,$to:i,node:r}=t.selection;if(r&&r.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(l.type!=n)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=n||o.index(-2)!=o.node(-2).childCount-1)return!1;if(s){let u=x.empty,h=o.index(-1)?1:o.index(-2)?2:3;for(let b=o.depth-h;b>=o.depth-3;b--)u=x.from(o.node(b).copy(u));let f=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;u=u.append(x.from(n.createAndFill()));let p=o.before(o.depth-(h-1)),m=t.tr.replace(p,o.after(-f),new M(u,4-h,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(b,C)=>{if(g>-1)return!1;b.isTextblock&&b.content.size==0&&(g=C+1)}),g>-1&&m.setSelection(I.near(m.doc.resolve(g))),s(m.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,i.pos),d=a?[null,{type:a}]:void 0;return Xt(c.doc,o.pos,2,d)?(s&&s(c.split(o.pos,2,d).scrollIntoView()),!0):!1}}function Zo(n){return function(e,t){let{$from:s,$to:o}=e.selection,i=s.blockRange(o,r=>r.childCount>0&&r.firstChild.type==n);return i?t?s.node(i.depth-1).type==n?Bf(e,t,n,i):Hf(e,t,i):!0:!1}}function Bf(n,e,t,s){let o=n.tr,i=s.end,r=s.$to.end(s.depth);i<r&&(o.step(new U(i-1,r,i,r,new M(x.from(t.create(null,s.parent.copy())),1,0),1,!0)),s=new bs(o.doc.resolve(s.$from.pos),o.doc.resolve(r),s.depth));const l=Ms(s);if(l==null)return!1;o.lift(s,l);let a=o.mapping.map(i,-1)-1;return As(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function Hf(n,e,t){let s=n.tr,o=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=o.child(p).nodeSize,s.delete(f-1,f+1);let i=s.doc.resolve(t.start),r=i.nodeAfter;if(s.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,r.content.append(a?x.empty:x.from(o))))return!1;let u=i.pos,h=u+r.nodeSize;return s.step(new U(u-(l?1:0),h+(a?1:0),u+1,h-1,new M((l?x.empty:x.from(o.copy(x.empty))).append(a?x.empty:x.from(o.copy(x.empty))),l?0:1,a?0:1),l?0:1)),e(s.scrollIntoView()),!0}function $f(n){return function(e,t){let{$from:s,$to:o}=e.selection,i=s.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let r=i.startIndex;if(r==0)return!1;let l=i.parent,a=l.child(r-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=x.from(c?n.create():null),u=new M(x.from(n.create(null,x.from(l.type.create(null,d)))),c?3:1,0),h=i.start,f=i.end;t(e.tr.step(new U(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const Y=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},On=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Yo=null;const Le=function(n,e,t){let s=Yo||(Yo=document.createRange());return s.setEnd(n,t??n.nodeValue.length),s.setStart(n,e||0),s},Ff=function(){Yo=null},Tt=function(n,e,t,s){return t&&(sa(n,e,t,s,-1)||sa(n,e,t,s,1))},Wf=/^(img|br|input|textarea|hr)$/i;function sa(n,e,t,s,o){for(;;){if(n==t&&e==s)return!0;if(e==(o<0?0:me(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Nn(n)||Wf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Y(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?me(n):0}else return!1}}function me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _f(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=me(n)}else if(n.parentNode&&!Nn(n))e=Y(n),n=n.parentNode;else return null}}function qf(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Nn(n))e=Y(n)+1,n=n.parentNode;else return null}}function Gf(n,e,t){for(let s=e==0,o=e==me(n);s||o;){if(n==t)return!0;let i=Y(n);if(n=n.parentNode,!n)return!1;s=s&&i==0,o=o&&i==me(n)}}function Nn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Rs=function(n){return n.focusNode&&Tt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Mt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function jf(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Kf(n,e,t){if(n.caretPositionFromPoint)try{let s=n.caretPositionFromPoint(e,t);if(s)return{node:s.offsetNode,offset:Math.min(me(s.offsetNode),s.offset)}}catch{}if(n.caretRangeFromPoint){let s=n.caretRangeFromPoint(e,t);if(s)return{node:s.startContainer,offset:Math.min(me(s.startContainer),s.startOffset)}}}const Ne=typeof navigator<"u"?navigator:null,oa=typeof document<"u"?document:null,Ye=Ne&&Ne.userAgent||"",Xo=/Edge\/(\d+)/.exec(Ye),ia=/MSIE \d/.exec(Ye),Qo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ye),de=!!(ia||Qo||Xo),Xe=ia?document.documentMode:Qo?+Qo[1]:Xo?+Xo[1]:0,Se=!de&&/gecko\/(\d+)/i.test(Ye);Se&&+(/Firefox\/(\d+)/.exec(Ye)||[0,0])[1];const ei=!de&&/Chrome\/(\d+)/.exec(Ye),ee=!!ei,ra=ei?+ei[1]:0,ie=!de&&!!Ne&&/Apple Computer/.test(Ne.vendor),on=ie&&(/Mobile\/\w+/.test(Ye)||!!Ne&&Ne.maxTouchPoints>2),ge=on||(Ne?/Mac/.test(Ne.platform):!1),Jf=Ne?/Win/.test(Ne.platform):!1,Ce=/Android \d/.test(Ye),Pn=!!oa&&"webkitFontSmoothing"in oa.documentElement.style,Uf=Pn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Zf(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Be(n,e){return typeof n=="number"?n:n[e]}function Yf(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,s=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*s}}function la(n,e,t){let s=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let r=t||n.dom;r;r=On(r)){if(r.nodeType!=1)continue;let l=r,a=l==i.body,c=a?Zf(i):Yf(l),d=0,u=0;if(e.top<c.top+Be(s,"top")?u=-(c.top-e.top+Be(o,"top")):e.bottom>c.bottom-Be(s,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Be(o,"top")-c.top:e.bottom-c.bottom+Be(o,"bottom")),e.left<c.left+Be(s,"left")?d=-(c.left-e.left+Be(o,"left")):e.right>c.right-Be(s,"right")&&(d=e.right-c.right+Be(o,"right")),d||u)if(a)i.defaultView.scrollBy(d,u);else{let h=l.scrollLeft,f=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-h,m=l.scrollTop-f;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(r).position))break}}function Xf(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),s,o;for(let i=(e.left+e.right)/2,r=t+1;r<Math.min(innerHeight,e.bottom);r+=5){let l=n.root.elementFromPoint(i,r);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){s=l,o=a.top;break}}return{refDOM:s,refTop:o,stack:aa(n.dom)}}function aa(n){let e=[],t=n.ownerDocument;for(let s=n;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),n!=t);s=On(s));return e}function Qf({refDOM:n,refTop:e,stack:t}){let s=n?n.getBoundingClientRect().top:0;ca(t,s==0?0:s-e)}function ca(n,e){for(let t=0;t<n.length;t++){let{dom:s,top:o,left:i}=n[t];s.scrollTop!=o+e&&(s.scrollTop=o+e),s.scrollLeft!=i&&(s.scrollLeft=i)}}let rn=null;function ep(n){if(n.setActive)return n.setActive();if(rn)return n.focus(rn);let e=aa(n);n.focus(rn==null?{get preventScroll(){return rn={preventScroll:!0},!0}}:void 0),rn||(rn=!1,ca(e,0))}function da(n,e){let t,s=2e8,o,i=0,r=e.top,l=e.top,a,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Le(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=r&&p.bottom>=l){r=Math.max(p.bottom,r),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<s){t=d,s=m,o=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(i=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!t&&a&&(t=a,o=c,s=0),t&&t.nodeType==3?tp(t,o):!t||s&&t.nodeType==1?{node:n,offset:i}:da(t,o)}function tp(n,e){let t=n.nodeValue.length,s=document.createRange();for(let o=0;o<t;o++){s.setEnd(n,o+1),s.setStart(n,o);let i=Qe(s,1);if(i.top!=i.bottom&&ti(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function ti(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function np(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function sp(n,e,t){let{node:s,offset:o}=da(e,t),i=-1;if(s.nodeType==1&&!s.firstChild){let r=s.getBoundingClientRect();i=r.left!=r.right&&t.left>(r.left+r.right)/2?1:-1}return n.docView.posFromDOM(s,o,i)}function op(n,e,t,s){let o=-1;for(let i=e,r=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!r&&a.left>s.left||a.top>s.top?o=l.posBefore:(!r&&a.right<s.left||a.bottom<s.top)&&(o=l.posAfter),r=!0),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?s.top<(a.top+a.bottom)/2:s.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function ua(n,e,t){let s=n.childNodes.length;if(s&&t.top<t.bottom)for(let o=Math.max(0,Math.min(s-1,Math.floor(s*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let r=n.childNodes[i];if(r.nodeType==1){let l=r.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(ti(e,c))return ua(r,e,c)}}if((i=(i+1)%s)==o)break}return n}function ip(n,e){let t=n.dom.ownerDocument,s,o=0,i=Kf(t,e.left,e.top);i&&({node:s,offset:o}=i);let r=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!r||!n.dom.contains(r.nodeType!=1?r.parentNode:r)){let c=n.dom.getBoundingClientRect();if(!ti(e,c)||(r=ua(n.dom,e,c),!r))return null}if(ie)for(let c=r;s&&c;c=On(c))c.draggable&&(s=void 0);if(r=np(r,e),s){if(Se&&s.nodeType==1&&(o=Math.min(o,s.childNodes.length),o<s.childNodes.length)){let d=s.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++}let c;Pn&&o&&s.nodeType==1&&(c=s.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,s==n.dom&&o==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||s.nodeType!=1||s.childNodes[o-1].nodeName!="BR")&&(l=op(n,s,o,e))}l==null&&(l=sp(n,r,e));let a=n.docView.nearestDesc(r,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ha(n){return n.top<n.bottom||n.left<n.right}function Qe(n,e){let t=n.getClientRects();if(t.length){let s=t[e<0?0:t.length-1];if(ha(s))return s}return Array.prototype.find.call(t,ha)||n.getBoundingClientRect()}const rp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function fa(n,e,t){let{node:s,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),r=Pn||Se;if(s.nodeType==3)if(r&&(rp.test(s.nodeValue)||(t<0?!o:o==s.nodeValue.length))){let a=Qe(Le(s,o,o),t);if(Se&&o&&/\s/.test(s.nodeValue[o-1])&&o<s.nodeValue.length){let c=Qe(Le(s,o-1,o-1),-1);if(c.top==a.top){let d=Qe(Le(s,o,o+1),-1);if(d.top!=a.top)return In(d,d.left<c.left)}}return a}else{let a=o,c=o,d=t<0?1:-1;return t<0&&!o?(c++,d=-1):t>=0&&o==s.nodeValue.length?(a--,d=1):t<0?a--:c++,In(Qe(Le(s,a,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==me(s))){let a=s.childNodes[o-1];if(a.nodeType==1)return ni(a.getBoundingClientRect(),!1)}if(i==null&&o<me(s)){let a=s.childNodes[o];if(a.nodeType==1)return ni(a.getBoundingClientRect(),!0)}return ni(s.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==me(s))){let a=s.childNodes[o-1],c=a.nodeType==3?Le(a,me(a)-(r?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return In(Qe(c,1),!1)}if(i==null&&o<me(s)){let a=s.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Le(a,0,r?0:1):a.nodeType==1?a:null:null;if(c)return In(Qe(c,-1),!0)}return In(Qe(s.nodeType==3?Le(s):s,-t),t>=0)}function In(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ni(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function pa(n,e,t){let s=n.state,o=n.root.activeElement;s!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{s!=e&&n.updateState(s),o!=n.dom&&o&&o.focus()}}function lp(n,e,t){let s=e.selection,o=t=="up"?s.$from:s.$to;return pa(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let r=fa(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Le(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?r.top-d.top>(d.bottom-r.top)*2:d.bottom-r.bottom>(r.bottom-d.top)*2))return!1}}return!0})}const ap=/[\u0590-\u08ac]/;function cp(n,e,t){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let o=s.parentOffset,i=!o,r=o==s.parent.content.size,l=n.domSelection();return l?!ap.test(s.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:r:pa(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let f=s.depth?n.docView.domAfterPos(s.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),g}):s.pos==s.start()||s.pos==s.end()}let ma=null,ga=null,ya=!1;function dp(n,e,t){return ma==e&&ga==t?ya:(ma=e,ga=t,ya=t=="up"||t=="down"?lp(n,e,t):cp(n,e,t))}const ye=0,ba=1,At=2,Pe=3;class Rn{constructor(e,t,s,o){this.parent=e,this.children=t,this.dom=s,this.contentDOM=o,this.dirty=ye,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,s=this.posAtStart;;t++){let o=this.children[t];if(o==e)return s;s+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,s){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(s<0){let i,r;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((r=i.pmViewDesc)&&r.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(r)+r.size:this.posAtStart}else{let i,r;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((r=i.pmViewDesc)&&r.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(r):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Y(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let s=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),r;if(i&&(!t||i.node))if(s&&(r=i.nodeDOM)&&!(r.nodeType==1?r.contains(e.nodeType==1?e:e.parentNode):r==e))s=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let s=t;s;s=s.parent)if(s==this)return t}posFromDOM(e,t,s){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,s)}return-1}descAt(e){for(let t=0,s=0;t<this.children.length;t++){let o=this.children[t],i=s+o.size;if(s==e&&i!=s){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-s-o.border);s=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let s=0,o=0;for(let i=0;s<this.children.length;s++){let r=this.children[s],l=i+r.size;if(l>e||r instanceof Sa){o=e-i;break}i=l}if(o)return this.children[s].domFromPos(o-this.children[s].border,t);for(let i;s&&!(i=this.children[s-1]).size&&i instanceof va&&i.side>=0;s--);if(t<=0){let i,r=!0;for(;i=s?this.children[s-1]:null,!(!i||i.dom.parentNode==this.contentDOM);s--,r=!1);return i&&t&&r&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Y(i.dom)+1:0}}else{let i,r=!0;for(;i=s<this.children.length?this.children[s]:null,!(!i||i.dom.parentNode==this.contentDOM);s++,r=!1);return i&&r&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Y(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,s=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let r=s,l=0;;l++){let a=this.children[l],c=r+a.size;if(o==-1&&e<=c){let d=r+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=r;for(let u=l;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=Y(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=Y(u.dom);break}t+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}r=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:s}=this.domFromPos(e,0);if(t.nodeType!=1||s==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[s]}setSelection(e,t,s,o=!1){let i=Math.min(e,t),r=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(i>p&&r<g)return m.setSelection(e-p-m.border,t-p-m.border,s,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=s.root.getSelection(),d=s.domSelectionRange(),u=!1;if((Se||ie)&&e==t){let{node:f,offset:p}=l;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`
196
- `),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Y(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Se&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||u&&ie)&&Tt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&Tt(a.node,a.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!u){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>t){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let s=0,o=0;o<this.children.length;o++){let i=this.children[o],r=s+i.size;if(s==r?e<=r&&t>=s:e<r&&t>s){let l=s+i.border,a=r-i.border;if(e>=l&&t<=a){this.dirty=e==s||t==r?At:ba,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Pe:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?At:Pe}s=r}this.dirty=At}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let s=e==1?At:ba;t.dirty<s&&(t.dirty=s)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class va extends Rn{constructor(e,t,s,o){let i,r=t.type.toDOM;if(typeof r=="function"&&(r=r(s,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(r.nodeType!=1){let l=document.createElement("span");l.appendChild(r),r=l}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(e,[],r,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==ye&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class up extends Rn{constructor(e,t,s,o){super(e,[],t,null),this.textDOM=s,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Et extends Rn{constructor(e,t,s,o,i){super(e,[],s,o),this.mark=t,this.spec=i}static create(e,t,s,o){let i=o.nodeViews[t.type.name],r=i&&i(t,o,s);return(!r||!r.dom)&&(r=Ct.renderSpec(document,t.type.spec.toDOM(t,s),null,t.attrs)),new Et(e,t,r.dom,r.contentDOM||r.dom,r)}parseRule(){return this.dirty&Pe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Pe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ye){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty<this.dirty&&(s.dirty=this.dirty),this.dirty=ye}}slice(e,t,s){let o=Et.create(this.parent,this.mark,!0,s),i=this.children,r=this.size;t<r&&(i=oi(i,t,r,s)),e>0&&(i=oi(i,0,e,s));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class et extends Rn{constructor(e,t,s,o,i,r,l,a,c){super(e,[],i,r),this.node=t,this.outerDeco=s,this.innerDeco=o,this.nodeDOM=l}static create(e,t,s,o,i,r){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)},s,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=Ct.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=ka(d,s,t),c?a=new hp(e,t,s,o,d,u||null,h,c,i,r+1):t.isText?new Ds(e,t,s,o,d,h,i):new et(e,t,s,o,d,u||null,h,i,r+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let s=this.children[t];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,t,s){return this.dirty==ye&&e.eq(this.node)&&zs(t,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let s=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,r=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new pp(this,r&&r.node,e);yp(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,s,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?V.none:this.node.child(d).marks,s,e),a.placeWidget(c,e,o)},(c,d,u,h)=>{a.syncToMarks(c.marks,s,e);let f;a.findNodeMatch(c,d,u,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(f=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,d,u,f,e)||a.updateNextNode(c,d,u,e,h,o)||a.addNode(c,d,u,e,o),o+=c.nodeSize}),a.syncToMarks([],s,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==At)&&(r&&this.protectLocalComposition(e,r),Ca(this.contentDOM,this.children,e),on&&bp(this.dom))}localCompositionInfo(e,t){let{from:s,to:o}=e.state.selection;if(!(e.state.selection instanceof R)||s<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let r=i.nodeValue,l=vp(this.node.content,r,s-t,o-t);return l<0?null:{node:i,pos:l,text:r}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:s,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let r=new up(this,i,t,o);e.input.compositionNodes.push(r),this.children=oi(this.children,s,s+o.length,e,r)}update(e,t,s,o){return this.dirty==Pe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,s,o),!0)}updateInner(e,t,s,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=ye}updateOuterDeco(e){if(zs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=xa(this.dom,this.nodeDOM,si(this.outerDeco,this.node,t),si(e,this.node,t)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function wa(n,e,t,s,o){ka(s,e,n);let i=new et(void 0,n,e,t,s,s,s,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Ds extends et{constructor(e,t,s,o,i,r,l){super(e,t,s,o,i,null,r,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,s,o){return this.dirty==Pe||this.dirty!=ye&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ye||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=ye,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,s){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,s){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new Ds(this.parent,o,this.outerDeco,this.innerDeco,i,i,s)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Pe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sa extends Rn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ye&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class hp extends et{constructor(e,t,s,o,i,r,l,a,c,d){super(e,t,s,o,i,r,l,c,d),this.spec=a}update(e,t,s,o){if(this.dirty==Pe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,s);return i&&this.updateInner(e,t,s,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,s,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,s,o){this.spec.setSelection?this.spec.setSelection(e,t,s.root):super.setSelection(e,t,s,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ca(n,e,t){let s=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let r=e[i],l=r.dom;if(l.parentNode==n){for(;l!=s;)s=Ta(s),o=!0;s=s.nextSibling}else o=!0,n.insertBefore(l,s);if(r instanceof Et){let a=s?s.previousSibling:n.lastChild;Ca(r.contentDOM,r.children,t),s=a?a.nextSibling:n.firstChild}}for(;s;)s=Ta(s),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const Dn=function(n){n&&(this.nodeName=n)};Dn.prototype=Object.create(null);const Ot=[new Dn];function si(n,e,t){if(n.length==0)return Ot;let s=t?Ot[0]:new Dn,o=[s];for(let i=0;i<n.length;i++){let r=n[i].type.attrs;if(r){r.nodeName&&o.push(s=new Dn(r.nodeName));for(let l in r){let a=r[l];a!=null&&(t&&o.length==1&&o.push(s=new Dn(e.isInline?"span":"div")),l=="class"?s.class=(s.class?s.class+" ":"")+a:l=="style"?s.style=(s.style?s.style+";":"")+a:l!="nodeName"&&(s[l]=a))}}}return o}function xa(n,e,t,s){if(t==Ot&&s==Ot)return e;let o=e;for(let i=0;i<s.length;i++){let r=s[i],l=t[i];if(i){let a;l&&l.nodeName==r.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==r.nodeName||(a=document.createElement(r.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=Ot[0]),o=a}fp(o,l||Ot[0],r)}return o}function fp(n,e,t){for(let s in e)s!="class"&&s!="style"&&s!="nodeName"&&!(s in t)&&n.removeAttribute(s);for(let s in t)s!="class"&&s!="style"&&s!="nodeName"&&t[s]!=e[s]&&n.setAttribute(s,t[s]);if(e.class!=t.class){let s=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<s.length;i++)o.indexOf(s[i])==-1&&n.classList.remove(s[i]);for(let i=0;i<o.length;i++)s.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let s=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=s.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function ka(n,e,t){return xa(n,n,Ot,si(e,t,n.nodeType!=1))}function zs(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Ta(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class pp{constructor(e,t,s){this.lock=t,this.view=s,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=mp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let s=e;s<t;s++)this.top.children[s].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,s){let o=0,i=this.stack.length>>1,r=Math.min(i,e.length);for(;o<r&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=ye,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Et.create(this.top,e[i],t,s);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,s,o){let i=-1,r;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,s))i=this.top.children.indexOf(r,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,s)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,s,o,i){let r=this.top.children[o];return r.dirty==Pe&&r.dom==r.contentDOM&&(r.dirty=At),r.update(e,t,s,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let s=e.pmViewDesc;if(s){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==s)return o}return-1}e=t}}updateNextNode(e,t,s,o,i,r){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof et){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let d=a.dom,u,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Pe&&zs(t,a.outerDeco));if(!h&&a.update(e,t,s,o))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(a,e,t,s,o,r)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=At,u.updateChildren(o,r+1),u.dirty=ye),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,s,o,i,r){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!zs(s,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=et.create(this.top,t,s,o,i,r);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,s,o,i){let r=et.create(this.top,e,t,s,o,i);r.contentDOM&&r.updateChildren(o,i+1),this.top.children.splice(this.index++,0,r),this.changed=!0}placeWidget(e,t,s){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new va(this.top,e,t,s);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Et;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ds)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ie||ee)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let s=document.createElement(e);e=="IMG"&&(s.className="ProseMirror-separator",s.alt=""),e=="BR"&&(s.className="ProseMirror-trailingBreak");let o=new Sa(this.top,[],s,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function mp(n,e){let t=e,s=t.children.length,o=n.childCount,i=new Map,r=[];e:for(;o>0;){let l;for(;;)if(s){let c=t.children[s-1];if(c instanceof Et)t=c,s=c.children.length;else{l=c,s--;break}}else{if(t==e)break e;s=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,i.set(l,o),r.push(l)}}return{index:o,matched:i,matches:r.reverse()}}function gp(n,e){return n.type.side-e.type.side}function yp(n,e,t,s){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);s(d,o,e.forChild(i,d),c),i+=d.nodeSize}return}let r=0,l=[],a=null;for(let c=0;;){let d,u;for(;r<o.length&&o[r].to==i;){let g=o[r++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(gp);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(d,c,!!a);let h,f;if(a)f=-1,h=a,a=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;r<o.length&&o[r].from<=i&&o[r].to>i;)l.push(o[r++]);let p=i+h.nodeSize;if(h.isText){let g=p;r<o.length&&o[r].from<g&&(g=o[r].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=h.cut(g-i),h=h.cut(0,g-i),p=g,f=-1)}else for(;r<o.length&&o[r].to<p;)r++;let m=h.isInline&&!h.isLeaf?l.filter(g=>!g.inline):l.slice();s(h,m,e.forChild(i,h),f),i=p}}function bp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function vp(n,e,t,s){for(let o=0,i=0;o<n.childCount&&i<=s;){let r=n.child(o++),l=i;if(i+=r.nodeSize,!r.isText)continue;let a=r.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=s&&a.slice(s-e.length-l,s-l)==e)return s-e.length;let c=l<s?a.lastIndexOf(e,s-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==s&&a.length>=s+e.length-l&&a.slice(s-l,s-l+e.length)==e)return s}}return-1}function oi(n,e,t,s,o){let i=[];for(let r=0,l=0;r<n.length;r++){let a=n[r],c=l,d=l+=a.size;c>=t||d<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,s)),o&&(i.push(o),o=void 0),d>t&&i.push(a.slice(t-c,a.size,s)))}return i}function ii(n,e=null){let t=n.domSelectionRange(),s=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,r=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(r<0)return null;let l=s.resolve(r),a,c;if(Rs(t)){for(a=r;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&N.isSelectable(u)&&o.parent&&!(u.isInline&&Gf(t.focusNode,t.focusOffset,o.dom))){let h=o.posBefore;c=new N(r==h?l:s.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=r,h=r;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[a,r]=h==n.state.selection.anchor?[h,u]:[u,h],l=s.resolve(r)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=s.resolve(a);if(!c){let u=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=li(n,d,l,u)}return c}function Ma(n){return n.editable?n.hasFocus():Ra(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function He(n,e=!1){let t=n.state.selection;if(Na(n,t),!!Ma(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ee){let s=n.domSelectionRange(),o=n.domObserver.currentSelection;if(s.anchorNode&&o.anchorNode&&Tt(s.anchorNode,s.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Sp(n);else{let{anchor:s,head:o}=t,i,r;Aa&&!(t instanceof R)&&(t.$from.parent.inlineContent||(i=Ea(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(r=Ea(n,t.to))),n.docView.setSelection(s,o,n,e),Aa&&(i&&Oa(i),r&&Oa(r)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&wp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Aa=ie||ee&&ra<63;function Ea(n,e){let{node:t,offset:s}=n.docView.domFromPos(e,0),o=s<t.childNodes.length?t.childNodes[s]:null,i=s?t.childNodes[s-1]:null;if(ie&&o&&o.contentEditable=="false")return ri(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return ri(o);if(i)return ri(i)}}function ri(n){return n.contentEditable="true",ie&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Oa(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function wp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),s=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=s||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ma(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Sp(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let s=n.cursorWrapper.dom,o=s.nodeName=="IMG";o?t.setStart(s.parentNode,Y(s)+1):t.setStart(s,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&de&&Xe<=11&&(s.disabled=!0,s.disabled=!1)}function Na(n,e){if(e instanceof N){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Pa(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Pa(n)}function Pa(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function li(n,e,t,s){return n.someProp("createSelectionBetween",o=>o(n,e,t))||R.between(e,t,s)}function Ia(n){return n.editable&&!n.hasFocus()?!1:Ra(n)}function Ra(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Cp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Tt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function ai(n,e){let{$anchor:t,$head:s}=n.selection,o=e>0?t.max(s):t.min(s),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&I.findFrom(i,e)}function tt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Da(n,e,t){let s=n.state.selection;if(s instanceof R)if(t.indexOf("s")>-1){let{$head:o}=s,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let r=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return tt(n,new R(s.$anchor,r))}else if(s.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=ai(n.state,e);return o&&o instanceof N?tt(n,o):!1}else if(!(ge&&t.indexOf("m")>-1)){let o=s.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,r;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(r=n.docView.descAt(l))&&!r.contentDOM?N.isSelectable(i)?tt(n,new N(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):Pn?tt(n,new R(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(s instanceof N&&s.node.isInline)return tt(n,new R(e>0?s.$to:s.$from));{let o=ai(n.state,e);return o?tt(n,o):!1}}}function Vs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function zn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function ln(n,e){return e<0?xp(n):kp(n)}function xp(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let o,i,r=!1;for(Se&&t.nodeType==1&&s<Vs(t)&&zn(t.childNodes[s],-1)&&(r=!0);;)if(s>0){if(t.nodeType!=1)break;{let l=t.childNodes[s-1];if(zn(l,-1))o=t,i=--s;else if(l.nodeType==3)t=l,s=t.nodeValue.length;else break}}else{if(za(t))break;{let l=t.previousSibling;for(;l&&zn(l,-1);)o=t.parentNode,i=Y(l),l=l.previousSibling;if(l)t=l,s=Vs(t);else{if(t=t.parentNode,t==n.dom)break;s=0}}}r?ci(n,t,s):o&&ci(n,o,i)}function kp(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let o=Vs(t),i,r;for(;;)if(s<o){if(t.nodeType!=1)break;let l=t.childNodes[s];if(zn(l,1))i=t,r=++s;else break}else{if(za(t))break;{let l=t.nextSibling;for(;l&&zn(l,1);)i=l.parentNode,r=Y(l)+1,l=l.nextSibling;if(l)t=l,s=0,o=Vs(t);else{if(t=t.parentNode,t==n.dom)break;s=o=0}}}i&&ci(n,i,r)}function za(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Tp(n,e){for(;n&&e==n.childNodes.length&&!Nn(n);)e=Y(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Mp(n,e){for(;n&&!e&&!Nn(n);)e=Y(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function ci(n,e,t){if(e.nodeType!=3){let i,r;(r=Tp(e,t))?(e=r,t=0):(i=Mp(e,t))&&(e=i,t=i.nodeValue.length)}let s=n.domSelection();if(!s)return;if(Rs(s)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),s.removeAllRanges(),s.addRange(i)}else s.extend&&s.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&He(n)},50)}function Va(n,e){let t=n.state.doc.resolve(e);if(!(ee||Jf)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),r=(i.top+i.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),r=(i.top+i.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function La(n,e,t){let s=n.state.selection;if(s instanceof R&&!s.empty||t.indexOf("s")>-1||ge&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=s;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let r=ai(n.state,e);if(r&&r instanceof N)return tt(n,r)}if(!o.parent.inlineContent){let r=e<0?o:i,l=s instanceof fe?I.near(r,e):I.findFrom(r,e);return l?tt(n,l):!1}return!1}function Ba(n,e){if(!(n.state.selection instanceof R))return!0;let{$head:t,$anchor:s,empty:o}=n.state.selection;if(!t.sameParent(s))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let r=n.state.tr;return e<0?r.delete(t.pos-i.nodeSize,t.pos):r.delete(t.pos,t.pos+i.nodeSize),n.dispatch(r),!0}return!1}function Ha(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ap(n){if(!ie||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let s=e.firstChild;Ha(n,s,"true"),setTimeout(()=>Ha(n,s,"false"),20)}return!1}function Ep(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Op(n,e){let t=e.keyCode,s=Ep(e);if(t==8||ge&&t==72&&s=="c")return Ba(n,-1)||ln(n,-1);if(t==46&&!e.shiftKey||ge&&t==68&&s=="c")return Ba(n,1)||ln(n,1);if(t==13||t==27)return!0;if(t==37||ge&&t==66&&s=="c"){let o=t==37?Va(n,n.state.selection.from)=="ltr"?-1:1:-1;return Da(n,o,s)||ln(n,o)}else if(t==39||ge&&t==70&&s=="c"){let o=t==39?Va(n,n.state.selection.from)=="ltr"?1:-1:1;return Da(n,o,s)||ln(n,o)}else{if(t==38||ge&&t==80&&s=="c")return La(n,-1,s)||ln(n,-1);if(t==40||ge&&t==78&&s=="c")return Ap(n)||La(n,1,s)||ln(n,1);if(s==(ge?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function $a(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:s,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&s.childCount==1&&s.firstChild.childCount==1;){o--,i--;let f=s.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),s=f.content}let r=n.someProp("clipboardSerializer")||Ct.fromSchema(n.state.schema),l=Ja(),a=l.createElement("div");a.appendChild(r.serializeFragment(s,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=ja[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=l.createElement(d[f]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
190
+ `,l.addEventListener("pointerdown",p()),i.appendChild(l)),o.append(i),(w=t.getSpotsEl())==null||w.appendChild(o)},f=w=>k=>{if(!a)return;us(n,!0),k.stopPropagation(),k.preventDefault(),u.startResize(a,w,k);const E=k.clientX,T=k.clientY;k.target.setPointerCapture(k.pointerId);const A=D=>{const V=n.Canvas.getZoomMultiplier(),H=(D.clientX-E)*V,ke=(D.clientY-T)*V,Te=hs(w)?ke:H;u.updateResizeByDelta(a,w,Te)},P=()=>{us(n,!1),u.finishResize(a),k.target.releasePointerCapture(k.pointerId),document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",P)};document.addEventListener("pointermove",A),document.addEventListener("pointerup",P)},p=()=>w=>{if(!c)return;const k=c;us(n,!0),w.stopPropagation(),w.preventDefault();const E=yn(k,e),T=To({componentRow:k,isVertical:E},e),A=w.clientX,P=w.clientY;w.target.setPointerCapture(w.pointerId);const D=H=>{const ke=n.Canvas.getZoomMultiplier(),Te=E?(H.clientY-P)*ke:(H.clientX-A)*ke;u.updateGapByDelta(k,Te,T,E)},V=()=>{us(n,!1),u.finishGapAdjust(k),w.target.releasePointerCapture(w.pointerId),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",V)};document.addEventListener("pointermove",D),document.addEventListener("pointerup",V)},m=w=>{const k=w.component;if(!k||!o||(a=k,c=k.parent(),!c))return;const E=c;Hr(o);const T=w.getStyle();i&&Object.assign(i.style,T);const A=yn(E,e),P=ju(A);if(Object.values(r).forEach(Br),P.forEach(V=>{if(Yu(k,V))return;const H=r[V];Hr(H)}),bt(e).gapHandler.isGapSupported()&&l&&Xu(k)){const V=To({componentRow:E,isVertical:A},e);g(V,A,Uu(k))}},g=(w,k,E=!1)=>{const T=e.gapHandleSize,A=l.style;if(k){A.height=`${T}px`;const P=l.offsetHeight;E?(A.top=`-${(w+P)/2}px`,A.bottom=""):(A.bottom=`-${(w+P)/2}px`,A.top=""),A.width="50%",A.left="50%",A.transform="translateX(-50%)",A.cursor="row-resize"}else{A.width=`${T}px`;const P=l.offsetWidth;E?(A.left=`-${(w+P)/2}px`,A.right=""):(A.right=`-${(w+P)/2}px`,A.left=""),A.height="50%",A.top="50%",A.transform="translateY(-50%)",A.cursor="col-resize"}},b=()=>{o&&(Br(o),a=null,c=null)},C=()=>{t.removeSpots({type:s});const w=n.getSelected(),k=w==null?void 0:w.parent();w&&k&&d.isValidRelationship(k,w)?t.addSpot({type:s,component:w}):b()},y=()=>{const w=t.getSpots().filter(k=>k.type===s)[0];w&&m(w)},v=(w,k)=>{d.registerTypeRelationship(w,k)};n.onReady(()=>{h(),Ut(e)?v("mj-section","mj-column"):v(e.typeRow,e.typeColumn)});const S="component:toggled";return n.on(t.events.spot,y),n.on(S,C),()=>{n.off(t.events.spot,y),n.off(S,C)}}const ch="flexComponent",dh=X(function(n,e={}){const t={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},s=[nh(n,t),th(n,t)],o=ah(n,t),i=eh(n,t);Q({editor:n,licenseKey:t.licenseKey,plan:F.startup,pluginName:ch,cleanup:()=>{s.forEach(r=>r==null?void 0:r()),o(),i==null||i()}})}),uh=n=>n.dispatchEvent(new CustomEvent("input"));function hh(n,e){if(!e)return()=>{};const t=n.Components.events,s=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),i=d=>d.isChildOf("text"),r=d=>n.getEditing()===d,l=(d,u={})=>{d.trigger("focus",u.event)},a=(d,u)=>{s(d)&&o(d)&&!r(d)&&l(d,u)},c=(d,u)=>{if(s(d)&&!o(d)&&i(d)){const h=d.parents().find(f=>f.isInstanceOf("text"));h&&(l(h,u),setTimeout(()=>n.select(h),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const Ao=new WeakMap,fh=(n,e)=>{Ao.set(n,e)},ph=n=>{Ao.delete(n)},Eo=n=>Ao.get(n),ps=n=>{const e=n.target,t=e.closest(".tox"),s=e.matches(".ephox-snooker-resizer-bar");(t||s)&&n.stopPropagation()},Gr=n=>{n.stopPropagation(),n.preventDefault()},mh=(n,e)=>{const t=n.getDoc(),s=n.getWin();if(e!=null&&e.event){const{event:o}=e,{clientX:i,clientY:r}=o;let l;if(t.caretRangeFromPoint)l=t.caretRangeFromPoint(i,r);else if(t.caretPositionFromPoint){const a=t.caretPositionFromPoint(i,r);l=t.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=s.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),n.selection.setRng(l)}}else n.execCommand("SelectAll")},gh=n=>{var c,d;const{el:e,editor:t,componentView:s}=n,o=t.runCommand(B.getStateTheme),i=s.model,r={target:e,inline:!0,skin:(o==null?void 0:o.theme)===Wi.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},l=((d=(c=n.pluginOpts)==null?void 0:c.loadConfig)==null?void 0:d.call(c,{config:r,editor:t,componentView:s,component:i}))||{};return{...r,...l}},jr=(n,e=document)=>new Promise((t,s)=>{const o=Array.isArray(n)?[...n]:[n],{head:i}=e,r=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=r.bind(null,l),a.onerror=s,i.appendChild(a)}else t()};r(o)}),yh="rteTinyMce",bh=X(function(n,e={}){const t={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:s}=t,o=n.Canvas.events,i=async(a,c)=>{const d=a.ownerDocument,u=d.defaultView,h=c==null?void 0:c.view;if(!u||!h){console.warn("Missing required data",{win:u,componentView:h});return}const f=gh({el:a,editor:n,componentView:h,pluginOpts:t}),m=(await u.tinymce.init(f))[0];if(!m)return;const b=(await window.tinymce.init({...f,target:document.createElement("div")}))[0];return m.ui.show(),d.body.addEventListener("mousedown",ps),document.body.addEventListener("mousedown",ps),m.on("Change",()=>uh(a)),m.on("blur",()=>m.ui.show()),m.on("OpenWindow",function(){var v;const C=(v=d.querySelector(".tox-dialog"))==null?void 0:v.closest(".tox");C&&(C==null?void 0:C.ownerDocument)!==document&&(document.body.appendChild(C),m.once("CloseWindow",()=>{C&&C.ownerDocument===document&&d.body.appendChild(C)}))}),a.addEventListener("dragstart",Gr,{capture:!0}),n.runCommand(B.setStateContextMenu,{enabled:!1}),mh(m,c),{rteEditor:m,rteEditorShallow:b}},r=(a,c)=>{a.ownerDocument.body.removeEventListener("mousedown",ps),document.body.removeEventListener("mousedown",ps),a.removeEventListener("dragstart",Gr,{capture:!0}),n.runCommand(B.setStateContextMenu,{enabled:!0}),c.rteEditor.destroy(),c.rteEditorShallow.destroy()};n.on(o.frameLoad,async({window:a})=>{jr(s,a.document)}),n.onReady(()=>{jr(s,document)}),n.setCustomRte({parseContent:!0,async enable(a,c,d){const u=Eo(a);if(u)return u.rteEditor;const h=await i(a,d);return h&&fh(a,h),h==null?void 0:h.rteEditor},disable(a){const c=Eo(a);c&&(ph(a),r(a,c))},getContent(a){var d,u;const c=Eo(a);return c?(u=(d=c.rteEditor).getContent)==null?void 0:u.call(d):a.innerHTML}});const l=hh(n,t.enableOnClick);Q({editor:n,licenseKey:t.licenseKey,plan:F.startup,pluginName:yh,cleanup:()=>{n.RichTextEditor.customRte=void 0,l()}})});function J(n){this.content=n}J.prototype={constructor:J,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var s=t&&t!=n?this.remove(t):this,o=s.find(n),i=s.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new J(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new J(t)},addToStart:function(n,e){return new J([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new J(t)},addBefore:function(n,e,t){var s=this.remove(e),o=s.content.slice(),i=s.find(n);return o.splice(i==-1?o.length:i,0,e,t),new J(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=J.from(n),n.size?new J(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=J.from(n),n.size?new J(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=J.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},J.from=function(n){if(n instanceof J)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new J(e)};function Kr(n,e,t){for(let s=0;;s++){if(s==n.childCount||s==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(s),i=e.child(s);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let r=0;o.text[r]==i.text[r];r++)t++;return t}if(o.content.size||i.content.size){let r=Kr(o.content,i.content,t+1);if(r!=null)return r}t+=o.nodeSize}}function Jr(n,e,t,s){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:s};let r=n.child(--o),l=e.child(--i),a=r.nodeSize;if(r==l){t-=a,s-=a;continue}if(!r.sameMarkup(l))return{a:t,b:s};if(r.isText&&r.text!=l.text){let c=0,d=Math.min(r.text.length,l.text.length);for(;c<d&&r.text[r.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,s--;return{a:t,b:s}}if(r.content.size||l.content.size){let c=Jr(r.content,l.content,t-1,s-1);if(c)return c}t-=a,s-=a}}class x{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let s=0;s<e.length;s++)this.size+=e[s].nodeSize}nodesBetween(e,t,s,o=0,i){for(let r=0,l=0;l<t;r++){let a=this.content[r],c=l+a.nodeSize;if(c>e&&s(a,o+l,i||null,r)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),s,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,s,o){let i="",r=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&s&&(r?r=!1:i+=s),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,s=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(s)&&(o[o.length-1]=t.withText(t.text+s.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new x(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let s=[],o=0;if(t>e)for(let i=0,r=0;r<t;i++){let l=this.content[i],a=r+l.nodeSize;a>e&&((r<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-r),Math.min(l.text.length,t-r)):l=l.cut(Math.max(0,e-r-1),Math.min(l.content.size,t-r-1))),s.push(l),o+=l.nodeSize),r=a}return new x(s,o)}cutByIndex(e,t){return e==t?x.empty:e==0&&t==this.content.length?this:new x(this.content.slice(e,t))}replaceChild(e,t){let s=this.content[e];if(s==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-s.nodeSize;return o[e]=t,new x(o,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,s=0;t<this.content.length;t++){let o=this.content[t];e(o,s,t),s+=o.nodeSize}}findDiffStart(e,t=0){return Kr(this,e,t)}findDiffEnd(e,t=this.size,s=e.size){return Jr(this,e,t,s)}findIndex(e,t=-1){if(e==0)return ms(0,e);if(e==this.size)return ms(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let s=0,o=0;;s++){let i=this.child(s),r=o+i.nodeSize;if(r>=e)return r==e||t>0?ms(s+1,r):ms(s,o);o=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return x.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let t,s=0;for(let o=0;o<e.length;o++){let i=e[o];s+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new x(t||e,s)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const Oo={index:0,offset:0};function ms(n,e){return Oo.index=n,Oo.offset=e,Oo}function gs(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let s=0;s<n.length;s++)if(!gs(n[s],e[s]))return!1}else{for(let s in n)if(!(s in e)||!gs(n[s],e[s]))return!1;for(let s in e)if(!(s in n))return!1}return!0}class L{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,s=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!s&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),s=!0),t&&t.push(i)}}return t||(t=e.slice()),s||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&gs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let s=e.marks[t.type];if(!s)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=s.create(t.attrs);return s.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!e[s].eq(t[s]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return L.none;if(e instanceof L)return[e];let t=e.slice();return t.sort((s,o)=>s.type.rank-o.type.rank),t}}L.none=[];class ys extends Error{}class M{constructor(e,t,s){this.content=e,this.openStart=t,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let s=Zr(this.content,e+this.openStart,t);return s&&new M(s,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Ur(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return M.empty;let s=t.openStart||0,o=t.openEnd||0;if(typeof s!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(x.fromJSON(e,t.content),s,o)}static maxOpen(e,t=!0){let s=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)s++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new M(e,s,o)}}M.empty=new M(x.empty,0,0);function Ur(n,e,t){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s),{index:r,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(r).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(s!=r)throw new RangeError("Removing non-flat range");return n.replaceChild(s,i.copy(Ur(i.content,e-o-1,t-o-1)))}function Zr(n,e,t,s){let{index:o,offset:i}=n.findIndex(e),r=n.maybeChild(o);if(i==e||r.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Zr(r.content,e-i-1,t);return l&&n.replaceChild(o,r.copy(l))}function vh(n,e,t){if(t.openStart>n.depth)throw new ys("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ys("Inconsistent open depths");return Yr(n,e,t,0)}function Yr(n,e,t,s){let o=n.index(s),i=n.node(s);if(o==e.index(s)&&s<n.depth-t.openStart){let r=Yr(n,e,t,s+1);return i.copy(i.content.replaceChild(o,r))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==s&&e.depth==s){let r=n.parent,l=r.content;return St(r,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:r,end:l}=Sh(t,n);return St(i,Qr(n,r,l,e,s))}else return St(i,bs(n,e,s))}function Xr(n,e){if(!e.type.compatibleContent(n.type))throw new ys("Cannot join "+e.type.name+" onto "+n.type.name)}function No(n,e,t){let s=n.node(t);return Xr(s,e.node(t)),s}function vt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Sn(n,e,t,s){let o=(e||n).node(t),i=0,r=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(vt(n.nodeAfter,s),i++));for(let l=i;l<r;l++)vt(o.child(l),s);e&&e.depth==t&&e.textOffset&&vt(e.nodeBefore,s)}function St(n,e){return n.type.checkContent(e),n.copy(e)}function Qr(n,e,t,s,o){let i=n.depth>o&&No(n,e,o+1),r=s.depth>o&&No(t,s,o+1),l=[];return Sn(null,n,o,l),i&&r&&e.index(o)==t.index(o)?(Xr(i,r),vt(St(i,Qr(n,e,t,s,o+1)),l)):(i&&vt(St(i,bs(n,e,o+1)),l),Sn(e,t,o,l),r&&vt(St(r,bs(t,s,o+1)),l)),Sn(s,null,o,l),new x(l)}function bs(n,e,t){let s=[];if(Sn(null,n,t,s),n.depth>t){let o=No(n,e,t+1);vt(St(o,bs(n,e,t+1)),s)}return Sn(e,null,t,s),new x(s)}function Sh(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(x.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class wn{constructor(e,t,s){this.pos=e,this.path=t,this.parentOffset=s,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],o=e.child(t);return s?e.child(t).cut(s):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let s=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=s.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return L.none;if(this.textOffset)return e.child(t).marks;let s=e.maybeChild(t-1),o=e.maybeChild(t);if(!s){let l=s;s=o,o=l}let i=s.marks;for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!o||!i[r].isInSet(o.marks))&&(i=i[r--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let s=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);s>=0;s--)if(e.pos<=this.end(s)&&(!t||t(this.node(s))))return new vs(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let s=[],o=0,i=t;for(let r=e;;){let{index:l,offset:a}=r.content.findIndex(i),c=i-a;if(s.push(r,l,o+a),!c||(r=r.child(l),r.isText))break;i=c-1,o+=a+1}return new wn(t,s,i)}static resolveCached(e,t){let s=el.get(e);if(s)for(let i=0;i<s.elts.length;i++){let r=s.elts[i];if(r.pos==t)return r}else el.set(e,s=new wh);let o=s.elts[s.i]=wn.resolve(e,t);return s.i=(s.i+1)%Ch,o}}class wh{constructor(){this.elts=[],this.i=0}}const Ch=12,el=new WeakMap;class vs{constructor(e,t,s){this.$from=e,this.$to=t,this.depth=s}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const xh=Object.create(null);let wt=class Vi{constructor(e,t,s,o=L.none){this.type=e,this.attrs=t,this.marks=o,this.content=s||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,s,o=0){this.content.nodesBetween(e,t,s,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,s,o){return this.content.textBetween(e,t,s,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,s){return this.type==e&&gs(this.attrs,t||e.defaultAttrs||xh)&&L.sameSet(this.marks,s||L.none)}copy(e=null){return e==this.content?this:new Vi(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Vi(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,s=!1){if(e==t)return M.empty;let o=this.resolve(e),i=this.resolve(t),r=s?0:o.sharedDepth(t),l=o.start(r),c=o.node(r).content.cut(o.pos-l,i.pos-l);return new M(c,o.depth-r,i.depth-r)}replace(e,t,s){return vh(this.resolve(e),this.resolve(t),s)}nodeAt(e){for(let t=this;;){let{index:s,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(s),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:s}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:s}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:s}=this.content.findIndex(e);if(s<e)return{node:this.content.child(t),index:t,offset:s};let o=this.content.child(t-1);return{node:o,index:t-1,offset:s-o.nodeSize}}resolve(e){return wn.resolveCached(this,e)}resolveNoCache(e){return wn.resolve(this,e)}rangeHasMark(e,t,s){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(s.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,s=x.empty,o=0,i=s.childCount){let r=this.contentMatchAt(e).matchFragment(s,o,i),l=r&&r.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(s.child(a).marks))return!1;return!0}canReplaceWith(e,t,s,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(s),r=i&&i.matchFragment(this.content,t);return r?r.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=L.none;for(let t=0;t<this.marks.length;t++){let s=this.marks[t];s.type.checkAttrs(s.attrs),e=s.addToSet(e)}if(!L.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let s;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,s)}let o=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,s);return i.type.checkAttrs(i.attrs),i}};wt.prototype.text=void 0;class Ss extends wt{constructor(e,t,s,o){if(super(e,t,null,o),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ss(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ss(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function tl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ct{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let s=new kh(e,t);if(s.next==null)return Ct.empty;let o=nl(s);s.next&&s.err("Unexpected trailing text");let i=Ph(Nh(o));return Ih(i,s),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,s=e.childCount){let o=this;for(let i=t;o&&i<s;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let s=0;s<e.next.length;s++)if(this.next[t].type==e.next[s].type)return!0;return!1}fillBefore(e,t=!1,s=0){let o=[this];function i(r,l){let a=r.matchFragment(e,s);if(a&&(!t||a.validEnd))return x.from(l.map(c=>c.createAndFill()));for(let c=0;c<r.next.length;c++){let{type:d,next:u}=r.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let h=i(u,l.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let s=0;s<this.wrapCache.length;s+=2)if(this.wrapCache[s]==e)return this.wrapCache[s+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let o=s.shift(),i=o.match;if(i.matchType(e)){let r=[];for(let l=o;l.type;l=l.via)r.push(l.type);return r.reverse()}for(let r=0;r<i.next.length;r++){let{type:l,next:a}=i.next[r];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(s.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(s){e.push(s);for(let o=0;o<s.next.length;o++)e.indexOf(s.next[o].next)==-1&&t(s.next[o].next)}return t(this),e.map((s,o)=>{let i=o+(s.validEnd?"*":" ")+" ";for(let r=0;r<s.next.length;r++)i+=(r?", ":"")+s.next[r].type.name+"->"+e.indexOf(s.next[r].next);return i}).join(`
191
+ `)}}Ct.empty=new Ct(!0);class kh{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function nl(n){let e=[];do e.push(Th(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Th(n){let e=[];do e.push(Mh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Mh(n){let e=Oh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Ah(n,e);else break;return e}function sl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Ah(n,e){let t=sl(n),s=t;return n.eat(",")&&(n.next!="}"?s=sl(n):s=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:s,expr:e}}function Eh(n,e){let t=n.nodeTypes,s=t[e];if(s)return[s];let o=[];for(let i in t){let r=t[i];r.isInGroup(e)&&o.push(r)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Oh(n){if(n.eat("(")){let e=nl(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Eh(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Nh(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function s(r,l,a){let c={term:a,to:l};return e[r].push(c),c}function o(r,l){r.forEach(a=>a.to=l)}function i(r,l){if(r.type=="choice")return r.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(r.type=="seq")for(let a=0;;a++){let c=i(r.exprs[a],l);if(a==r.exprs.length-1)return c;o(c,l=t())}else if(r.type=="star"){let a=t();return s(l,a),o(i(r.expr,a),a),[s(a)]}else if(r.type=="plus"){let a=t();return o(i(r.expr,l),a),o(i(r.expr,a),a),[s(a)]}else{if(r.type=="opt")return[s(l)].concat(i(r.expr,l));if(r.type=="range"){let a=l;for(let c=0;c<r.min;c++){let d=t();o(i(r.expr,a),d),a=d}if(r.max==-1)o(i(r.expr,a),a);else for(let c=r.min;c<r.max;c++){let d=t();s(a,d),o(i(r.expr,a),d),a=d}return[s(a)]}else{if(r.type=="name")return[s(l,void 0,r.value)];throw new Error("Unknown expr type")}}}}function ol(n,e){return e-n}function il(n,e){let t=[];return s(e),t.sort(ol);function s(o){let i=n[o];if(i.length==1&&!i[0].term)return s(i[0].to);t.push(o);for(let r=0;r<i.length;r++){let{term:l,to:a}=i[r];!l&&t.indexOf(a)==-1&&s(a)}}}function Ph(n){let e=Object.create(null);return t(il(n,0));function t(s){let o=[];s.forEach(r=>{n[r].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);il(n,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[s.join(",")]=new Ct(s.indexOf(n.length-1)>-1);for(let r=0;r<o.length;r++){let l=o[r][1].sort(ol);i.next.push({type:o[r][0],next:e[l.join(",")]||t(l)})}return i}}function Ih(n,e){for(let t=0,s=[n];t<s.length;t++){let o=s[t],i=!o.validEnd,r=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];r.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),s.indexOf(c)==-1&&s.push(c)}i&&e.err("Only non-generatable nodes ("+r.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function rl(n){let e=Object.create(null);for(let t in n){let s=n[t];if(!s.hasDefault)return null;e[t]=s.default}return e}function ll(n,e){let t=Object.create(null);for(let s in n){let o=e&&e[s];if(o===void 0){let i=n[s];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+s)}t[s]=o}return t}function al(n,e,t,s){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let i=n[o];i.validate&&i.validate(e[o])}}function cl(n,e){let t=Object.create(null);if(e)for(let s in e)t[s]=new Dh(n,s,e[s]);return t}let dl=class od{constructor(e,t,s){this.name=e,this.schema=t,this.spec=s,this.markSet=null,this.groups=s.group?s.group.split(" "):[],this.attrs=cl(e,s.attrs),this.defaultAttrs=rl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(s.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ct.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ll(this.attrs,e)}create(e=null,t,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wt(this,this.computeAttrs(e),x.from(t),L.setFrom(s))}createChecked(e=null,t,s){return t=x.from(t),this.checkContent(t),new wt(this,this.computeAttrs(e),t,L.setFrom(s))}createAndFill(e=null,t,s){if(e=this.computeAttrs(e),t=x.from(t),t.size){let r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(x.empty,!0);return i?new wt(this,e,t.append(i),L.setFrom(s)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let s=0;s<e.childCount;s++)if(!this.allowsMarks(e.child(s).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){al(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let s=0;s<e.length;s++)this.allowsMarkType(e[s].type)?t&&t.push(e[s]):t||(t=e.slice(0,s));return t?t.length?t:L.none:e}static compile(e,t){let s=Object.create(null);e.forEach((i,r)=>s[i]=new od(i,t,r));let o=t.spec.topNode||"doc";if(!s[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let i in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function Rh(n,e,t){let s=t.split("|");return o=>{let i=o===null?"null":typeof o;if(s.indexOf(i)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${n}, got ${i}`)}}class Dh{constructor(e,t,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Rh(e,t,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class ws{constructor(e,t,s,o){this.name=e,this.rank=t,this.schema=s,this.spec=o,this.attrs=cl(e,o.attrs),this.excluded=null;let i=rl(this.attrs);this.instance=i?new L(this,i):null}create(e=null){return!e&&this.instance?this.instance:new L(this,ll(this.attrs,e))}static compile(e,t){let s=Object.create(null),o=0;return e.forEach((i,r)=>s[i]=new ws(i,o++,t,r)),s}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){al(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class zh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=J.from(e.nodes),t.marks=J.from(e.marks||{}),this.nodes=dl.compile(this.spec.nodes,this),this.marks=ws.compile(this.spec.marks,this);let s=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],r=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=s[r]||(s[r]=Ct.parse(r,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ul(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],r=i.spec.excludes;i.excluded=r==null?[i]:r==""?[]:ul(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,s,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof dl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,s,o)}text(e,t){let s=this.nodes.text;return new Ss(s,s.defaultAttrs,e,L.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return wt.fromJSON(this,e)}markFromJSON(e){return L.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ul(n,e){let t=[];for(let s=0;s<e.length;s++){let o=e[s],i=n.marks[o],r=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(r=a)}if(!r)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return t}function Lh(n){return n.tag!=null}function Vh(n){return n.style!=null}class Zt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let s=this.matchedStyles=[];t.forEach(o=>{if(Lh(o))this.tags.push(o);else if(Vh(o)){let i=/[^=]*/.exec(o.style)[0];s.indexOf(i)<0&&s.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let s=new ml(this,t,!1);return s.addAll(e,L.none,t.from,t.to),s.finish()}parseSlice(e,t={}){let s=new ml(this,t,!0);return s.addAll(e,L.none,t.from,t.to),M.maxOpen(s.finish())}matchTag(e,t,s){for(let o=s?this.tags.indexOf(s)+1:0;o<this.tags.length;o++){let i=this.tags[o];if($h(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let r=i.getAttrs(e);if(r===!1)continue;i.attrs=r||void 0}return i}}}matchStyle(e,t,s,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let r=this.styles[i],l=r.style;if(!(l.indexOf(e)!=0||r.context&&!s.matchesContext(r.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(r.getAttrs){let a=r.getAttrs(t);if(a===!1)continue;r.attrs=a||void 0}return r}}}static schemaRules(e){let t=[];function s(o){let i=o.priority==null?50:o.priority,r=0;for(;r<t.length;r++){let l=t[r];if((l.priority==null?50:l.priority)<i)break}t.splice(r,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(r=>{s(r=gl(r)),r.mark||r.ignore||r.clearMark||(r.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(r=>{s(r=gl(r)),r.node||r.ignore||r.mark||(r.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Zt(e,Zt.schemaRules(e)))}}const hl={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Bh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fl={ol:!0,ul:!0},Cs=1,xs=2,Cn=4;function pl(n,e,t){return e!=null?(e?Cs:0)|(e==="full"?xs:0):n&&n.whitespace=="pre"?Cs|xs:t&~Cn}class ks{constructor(e,t,s,o,i,r){this.type=e,this.attrs=t,this.marks=s,this.solid=o,this.options=r,this.content=[],this.activeMarks=L.none,this.match=i||(r&Cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let s=this.type.contentMatch,o;return(o=s.findWrapping(e.type))?(this.match=s,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Cs)){let s=this.content[this.content.length-1],o;if(s&&s.isText&&(o=/[ \t\r\n\u000c]+$/.exec(s.text))){let i=s;s.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!hl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ml{constructor(e,t,s){this.parser=e,this.options=t,this.isOpen=s,this.open=0;let o=t.topNode,i,r=pl(null,t.preserveWhitespace,0)|(s?Cn:0);o?i=new ks(o.type,o.attrs,L.none,!0,t.topMatch||o.type.contentMatch,r):s?i=new ks(null,null,L.none,!0,null,r):i=new ks(e.schema.topNodeType,null,L.none,!0,null,r),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let s=e.nodeValue,o=this.top;if(o.options&xs||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o.options&Cs)o.options&xs?s=s.replace(/\r\n?/g,`
192
+ `):s=s.replace(/\r?\n|\r/g," ");else if(s=s.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(s)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],r=e.previousSibling;(!i||r&&r.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(s=s.slice(1))}s&&this.insertNode(this.parser.schema.text(s),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,s){let o=e.nodeName.toLowerCase(),i;fl.hasOwnProperty(o)&&this.parser.normalizeLists&&Hh(e);let r=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,s));if(r?r.ignore:Bh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!r||r.skip||r.closeParent){r&&r.closeParent?this.open=Math.max(0,this.open-1):r&&r.skip.nodeType&&(e=r.skip);let l,a=this.top,c=this.needsBlock;if(hl.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let d=r&&r.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,r,l,r.consuming===!1?i:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
193
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let s=e.style;if(s&&s.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],r=s.getPropertyValue(i);if(r)for(let l=void 0;;){let a=this.parser.matchStyle(i,r,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,s,o){let i,r;if(t.node)if(r=this.parser.schema.nodes[t.node],r.isLeaf)this.insertNode(r.create(t.attrs),s)||this.leafFallback(e,s);else{let a=this.enter(r,t.attrs||null,s,t.preserveWhitespace);a&&(i=!0,s=a)}else{let a=this.parser.schema.marks[t.mark];s=s.concat(a.create(t.attrs))}let l=this.top;if(r&&r.isLeaf)this.findInside(e);else if(o)this.addElement(e,s,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,s));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,s),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,s,o){let i=s||0;for(let r=s?e.childNodes[s]:e.firstChild,l=o==null?null:e.childNodes[o];r!=l;r=r.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(r,t);this.findAtPoint(e,i)}findPlace(e,t){let s,o;for(let i=this.open;i>=0;i--){let r=this.nodes[i],l=r.findWrapping(e);if(l&&(!s||s.length>l.length)&&(s=l,o=r,!l.length)||r.solid)break}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=L.none;for(let r of s.concat(e.marks))(o.type?o.type.allowsMarkType(r.type):yl(r.type,e.type))&&(i=r.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,s,o){let i=this.findPlace(e.create(t),s);return i&&(i=this.enterInner(e,t,s,!0,o)),i}enterInner(e,t,s,o=!1,i){this.closeExtra();let r=this.top;r.match=r.match&&r.match.matchType(e);let l=pl(e,i,r.options);r.options&Cn&&r.content.length==0&&(l|=Cn);let a=L.none;return s=s.filter(c=>(r.type?r.type.allowsMarkType(c.type):yl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ks(e,t,a,o,null,l)),this.open++,s}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let s=this.nodes[t].content;for(let o=s.length-1;o>=0;o--)e+=s[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&this.find[s].offset==t&&(this.find[s].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,s){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(s?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),s=this.options.context,o=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),i=-(s?s.depth+1:0)+(o?0:1),r=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(r(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:s&&a>=i?s.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return r(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let t in this.parser.schema.nodes){let s=this.parser.schema.nodes[t];if(s.isTextblock&&s.defaultAttrs)return s}}}function Hh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&fl.hasOwnProperty(s)&&t?(t.appendChild(e),e=t):s=="li"?t=e:s&&(t=null)}}function $h(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function gl(n){let e={};for(let t in n)e[t]=n[t];return e}function yl(n,e){let t=e.schema.nodes;for(let s in t){let o=t[s];if(!o.allowsMarkType(n))continue;let i=[],r=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&r(d))return!0}};if(r(o.contentMatch))return!0}}class xt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},s){s||(s=Po(t).createDocumentFragment());let o=s,i=[];return e.forEach(r=>{if(i.length||r.marks.length){let l=0,a=0;for(;l<i.length&&a<r.marks.length;){let c=r.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<r.marks.length;){let c=r.marks[a++],d=this.serializeMark(c,r.isInline,t);d&&(i.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(r,t))}),s}serializeNodeInner(e,t){let{dom:s,contentDOM:o}=Ts(Po(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return s}serializeNode(e,t={}){let s=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(s),s=i.dom)}return s}serializeMark(e,t,s={}){let o=this.marks[e.type.name];return o&&Ts(Po(s),o(e,t),null,e.attrs)}static renderSpec(e,t,s=null,o){return Ts(e,t,s,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=bl(e.nodes);return t.text||(t.text=s=>s.text),t}static marksFromSchema(e){return bl(e.marks)}}function bl(n){let e={};for(let t in n){let s=n[t].spec.toDOM;s&&(e[t]=s)}return e}function Po(n){return n.document||window.document}const vl=new WeakMap;function Fh(n){let e=vl.get(n);return e===void 0&&vl.set(n,e=Wh(n)),e}function Wh(n){let e=null;function t(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let o=0;o<s.length;o++)t(s[o]);else for(let o in s)t(s[o])}return t(n),e}function Ts(n,e,t,s){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(s&&(i=Fh(s))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let r=o.indexOf(" ");r>0&&(t=o.slice(0,r),o=o.slice(r+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Ts(n,h,t,s);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Sl=65535,wl=Math.pow(2,16);function _h(n,e){return n+e*wl}function Cl(n){return n&Sl}function qh(n){return(n-(n&Sl))/wl}const xl=1,kl=2,Ms=4,Tl=8;class Io{constructor(e,t,s){this.pos=e,this.delInfo=t,this.recover=s}get deleted(){return(this.delInfo&Tl)>0}get deletedBefore(){return(this.delInfo&(xl|Ms))>0}get deletedAfter(){return(this.delInfo&(kl|Ms))>0}get deletedAcross(){return(this.delInfo&Ms)>0}}class he{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&he.empty)return he.empty}recover(e){let t=0,s=Cl(e);if(!this.inverted)for(let o=0;o<s;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[s*3]+t+qh(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,s){let o=0,i=this.inverted?2:1,r=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+r],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:t:t,f=a+o+(h<0?0:d);if(s)return f;let p=e==(t<0?a:u)?null:_h(l/3,e-a),m=e==a?kl:e==u?xl:Ms;return(t<0?e!=a:e!=u)&&(m|=Tl),new Io(f,m,p)}o+=d-c}return s?e+o:new Io(e+o,0,null)}touches(e,t){let s=0,o=Cl(t),i=this.inverted?2:1,r=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==o*3)return!0;s+=this.ranges[l+r]-c}return!1}forEach(e){let t=this.inverted?2:1,s=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let r=this.ranges[o],l=r-(this.inverted?i:0),a=r+(this.inverted?0:i),c=this.ranges[o+t],d=this.ranges[o+s];e(l,l+c,a,a+d),i+=d-c}}invert(){return new he(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?he.empty:new he(e<0?[0,-e,0]:[0,0,e])}}he.empty=new he([]);class Yt{constructor(e=[],t,s=0,o=e.length){this.maps=e,this.mirror=t,this.from=s,this.to=o}slice(e=0,t=this.maps.length){return new Yt(this.maps,this.mirror,e,t)}copy(){return new Yt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,s=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?s+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,s=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?s-o-1:void 0)}}invert(){let e=new Yt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let s=this.from;s<this.to;s++)e=this.maps[s].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,s){let o=0;for(let i=this.from;i<this.to;i++){let r=this.maps[i],l=r.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return s?e:new Io(e,o,null)}}const Ro=Object.create(null);class ee{getMap(){return he.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=Ro[t.stepType];if(!s)throw new RangeError(`No step type ${t.stepType} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in Ro)throw new RangeError("Duplicate use of step JSON ID "+e);return Ro[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,s,o){try{return q.ok(e.replace(t,s,o))}catch(i){if(i instanceof ys)return q.fail(i.message);throw i}}}function Do(n,e,t){let s=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Do(i.content,e,i))),i.isInline&&(i=e(i,t,o)),s.push(i)}return x.fromArray(s)}class Ke extends ee{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=e.resolve(this.from),o=s.node(s.sharedDepth(this.to)),i=new M(Do(t.content,(r,l)=>!r.isAtom||!l.type.allowsMarkType(this.mark.type)?r:r.mark(this.mark.addToSet(r.marks)),o),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,i)}invert(){return new Ee(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new Ke(t.pos,s.pos,this.mark)}merge(e){return e instanceof Ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ke(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ke(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("addMark",Ke);class Ee extends ee{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=new M(Do(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,s)}invert(){return new Ke(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new Ee(t.pos,s.pos,this.mark)}merge(e){return e instanceof Ee&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ee(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ee(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("removeMark",Ee);class Je extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new M(x.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let s=this.mark.addToSet(t.marks);if(s.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(s))return new Je(this.pos,t.marks[o]);return new Je(this.pos,this.mark)}}return new Xt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Je(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Je(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("addNodeMark",Je);class Xt extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new M(x.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Je(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Xt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Xt(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("removeNodeMark",Xt);class te extends ee{constructor(e,t,s,o=!1){super(),this.from=e,this.to=t,this.slice=s,this.structure=o}apply(e){return this.structure&&zo(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new he([this.from,this.to-this.from,this.slice.size])}invert(e){return new te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deletedAcross&&s.deletedAcross?null:new te(t.pos,Math.max(t.pos,s.pos),this.slice)}merge(e){if(!(e instanceof te)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new te(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new te(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new te(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}ee.jsonID("replace",te);class U extends ee{constructor(e,t,s,o,i,r,l=!1){super(),this.from=e,this.to=t,this.gapFrom=s,this.gapTo=o,this.slice=i,this.insert=r,this.structure=l}apply(e){if(this.structure&&(zo(e,this.from,this.gapFrom)||zo(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,t.content);return s?q.fromReplace(e,this.from,this.to,s):q.fail("Content does not fit in gap")}getMap(){return new he([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new U(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?s.pos:e.map(this.gapTo,1);return t.deletedAcross&&s.deletedAcross||o<t.pos||i>s.pos?null:new U(t.pos,s.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new U(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}ee.jsonID("replaceAround",U);function zo(n,e,t){let s=n.resolve(e),o=t-e,i=s.depth;for(;o>0&&i>0&&s.indexAfter(i)==s.node(i).childCount;)i--,o--;if(o>0){let r=s.node(i).maybeChild(s.indexAfter(i));for(;o>0;){if(!r||r.isLeaf)return!0;r=r.firstChild,o--}}return!1}function Gh(n,e,t,s){let o=[],i=[],r,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!s.isInSet(u)&&d.type.allowsMarkType(s.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=s.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(r&&r.to==h&&r.mark.eq(u[m])?r.to=f:o.push(r=new Ee(h,f,u[m])));l&&l.to==h?l.to=f:i.push(l=new Ke(h,f,s))}}),o.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function jh(n,e,t,s){let o=[],i=0;n.doc.nodesBetween(e,t,(r,l)=>{if(!r.isInline)return;i++;let a=null;if(s instanceof ws){let c=r.marks,d;for(;d=s.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else s?s.isInSet(r.marks)&&(a=[s]):a=r.marks;if(a&&a.length){let c=Math.min(l+r.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],h;for(let f=0;f<o.length;f++){let p=o[f];p.step==i-1&&u.eq(o[f].style)&&(h=p)}h?(h.to=c,h.step=i):o.push({style:u,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(r=>n.step(new Ee(r.from,r.to,r.style)))}function Lo(n,e,t,s=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),r=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,u=s.matchType(c.type);if(!u)r.push(new te(l,d,M.empty));else{s=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Ee(l,d,c.marks[h]));if(o&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new M(x.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),r.push(new te(l+h.index,l+h.index+h[0].length,p))}}l=d}if(!s.validEnd){let a=s.fillBefore(x.empty,!0);n.replace(l,l,new M(a,0,0))}for(let a=r.length-1;a>=0;a--)n.step(r[a])}function Kh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function As(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let s=n.depth;;--s){let o=n.$from.node(s),i=n.$from.index(s),r=n.$to.indexAfter(s);if(s<n.depth&&o.canReplace(i,r,t))return s;if(s==0||o.type.spec.isolating||!Kh(o,i,r))break}return null}function Jh(n,e,t){let{$from:s,$to:o,depth:i}=e,r=s.before(i+1),l=o.after(i+1),a=r,c=l,d=x.empty,u=0;for(let p=i,m=!1;p>t;p--)m||s.index(p)>0?(m=!0,d=x.from(s.node(p).copy(d)),u++):a--;let h=x.empty,f=0;for(let p=i,m=!1;p>t;p--)m||o.after(p+1)<o.end(p)?(m=!0,h=x.from(o.node(p).copy(h)),f++):c++;n.step(new U(a,c,r,l,new M(d.append(h),u,f),d.size-u,!0))}function Ml(n,e,t=null,s=n){let o=Uh(n,e),i=o&&Zh(s,e);return i?o.map(Al).concat({type:e,attrs:t}).concat(i.map(Al)):null}function Al(n){return{type:n,attrs:null}}function Uh(n,e){let{parent:t,startIndex:s,endIndex:o}=n,i=t.contentMatchAt(s).findWrapping(e);if(!i)return null;let r=i.length?i[0]:e;return t.canReplaceWith(s,o,r)?i:null}function Zh(n,e){let{parent:t,startIndex:s,endIndex:o}=n,i=t.child(s),r=e.contentMatch.findWrapping(i.type);if(!r)return null;let a=(r.length?r[r.length-1]:e).contentMatch;for(let c=s;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:r}function Yh(n,e,t){let s=x.empty;for(let r=t.length-1;r>=0;r--){if(s.size){let l=t[r].type.contentMatch.matchFragment(s);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=x.from(t[r].type.create(t[r].attrs,s))}let o=e.start,i=e.end;n.step(new U(o,i,o,i,new M(s,0,0),t.length,!0))}function Xh(n,e,t,s,o){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(r,l)=>{let a=typeof o=="function"?o(r):o;if(r.isTextblock&&!r.hasMarkup(s,a)&&Qh(n.doc,n.mapping.slice(i).map(l),s)){let c=null;if(s.schema.linebreakReplacement){let f=s.whitespace=="pre",p=!!s.contentMatch.matchType(s.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Ol(n,r,l,i),Lo(n,n.mapping.slice(i).map(l,1),s,void 0,c===null);let d=n.mapping.slice(i),u=d.map(l,1),h=d.map(l+r.nodeSize,1);return n.step(new U(u,h,u+1,h-1,new M(x.from(s.create(a,null,r.marks)),0,0),1,!0)),c===!0&&El(n,r,l,i),!1}})}function El(n,e,t,s){e.forEach((o,i)=>{if(o.isText){let r,l=/\r?\n|\r/g;for(;r=l.exec(o.text);){let a=n.mapping.slice(s).map(t+1+i+r.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Ol(n,e,t,s){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let r=n.mapping.slice(s).map(t+1+i);n.replaceWith(r,r+1,e.type.schema.text(`
194
+ `))}})}function Qh(n,e,t){let s=n.resolve(e),o=s.index();return s.parent.canReplaceWith(o,o+1,t)}function ef(n,e,t,s,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let r=t.create(s,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,r);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new U(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new M(x.from(r),0,0),1,!0))}function Qt(n,e,t=1,s){let o=n.resolve(e),i=o.depth-t,r=s&&s[s.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!r.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),h=o.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=s&&s[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=s&&s[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let l=o.indexAfter(i),a=s&&s[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function tf(n,e,t=1,s){let o=n.doc.resolve(e),i=x.empty,r=x.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=x.from(o.node(l).copy(i));let d=s&&s[c];r=x.from(d?d.type.create(d.attrs,r):o.node(l).copy(r))}n.step(new te(e,e,new M(i.append(r),t,t),!0))}function Es(n,e){let t=n.resolve(e),s=t.index();return sf(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(s,s+1)}function nf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:s}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),r=i.type==s?n.type.schema.nodes.text:i.type;if(t=t.matchType(r),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function sf(n,e){return!!(n&&e&&!n.isLeaf&&nf(n,e))}function of(n,e,t){let s=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),r=i.node().type;if(o&&r.inlineContent){let d=r.whitespace=="pre",u=!!r.contentMatch.matchType(o);d&&!u?s=!1:!d&&u&&(s=!0)}let l=n.steps.length;if(s===!1){let d=n.doc.resolve(e+t);Ol(n,d.node(),d.before(),l)}r.inlineContent&&Lo(n,e+t-1,r,i.node().contentMatchAt(i.index()),s==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new te(c,a.map(e+t,-1),M.empty,!0)),s===!0){let d=n.doc.resolve(c);El(n,d.node(),d.before(),n.steps.length)}return n}function rf(n,e,t){let s=n.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),t))return e;if(s.parentOffset==0)for(let o=s.depth-1;o>=0;o--){let i=s.index(o);if(s.node(o).canReplaceWith(i,i,t))return s.before(o+1);if(i>0)return null}if(s.parentOffset==s.parent.content.size)for(let o=s.depth-1;o>=0;o--){let i=s.indexAfter(o);if(s.node(o).canReplaceWith(i,i,t))return s.after(o+1);if(i<s.node(o).childCount)return null}return null}function lf(n,e,t){let s=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let r=s.depth;r>=0;r--){let l=r==s.depth?0:s.pos<=(s.start(r+1)+s.end(r+1))/2?-1:1,a=s.index(r)+(l>0?1:0),c=s.node(r),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?s.pos:l<0?s.before(r+1):s.after(r+1)}return null}function Vo(n,e,t=e,s=M.empty){if(e==t&&!s.size)return null;let o=n.resolve(e),i=n.resolve(t);return Nl(o,i,s)?new te(e,t,s):new af(o,i,s).fit()}function Nl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class af{constructor(e,t,s){this.$from=e,this.$to=t,this.unplaced=s,this.frontier=[],this.placed=x.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=x.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,s=this.$from,o=this.close(e<0?this.$to:s.doc.resolve(e));if(!o)return null;let i=this.placed,r=s.depth,l=o.depth;for(;r&&l&&i.childCount==1;)i=i.firstChild.content,r--,l--;let a=new M(i,r,l);return e>-1?new U(s.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||s.pos!=this.$to.pos?new te(s.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,s=0,o=this.unplaced.openEnd;s<e;s++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=s){e=s;break}t=i.content}for(let t=1;t<=2;t++)for(let s=t==1?e:this.unplaced.openStart;s>=0;s--){let o,i=null;s?(i=Bo(this.unplaced.content,s-1).firstChild,o=i.content):o=this.unplaced.content;let r=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(r?c.matchType(r.type)||(u=c.fillBefore(x.from(r),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:s,frontierDepth:l,parent:i,inject:u};if(t==2&&r&&(d=c.findWrapping(r.type)))return{sliceDepth:s,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:s}=this.unplaced,o=Bo(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(s,o.size+t>=e.size-s?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:s}=this.unplaced,o=Bo(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new M(xn(e,t-1,1),t-1,i?t-1:s)}else this.unplaced=new M(xn(e,t,1),t,s)}placeNodes({sliceDepth:e,frontierDepth:t,parent:s,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let r=this.unplaced,l=s?s.content:r.content,a=r.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)d.push(o.child(m));u=u.matchFragment(o)}let f=l.size+e-(r.content.size-r.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,d.push(Pl(m.mark(h.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=kn(this.placed,t,x.from(d)),this.frontier[t].match=u,p&&f<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?M.empty:new M(xn(r.content,e-1,1),e-1,f<0?r.openEnd:e-1):new M(xn(r.content,e,c),r.openStart,r.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ho(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:s}=this.$to,o=this.$to.after(s);for(;s>1&&o==this.$to.end(--s);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:s,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),r=Ho(e,t,o,s,i);if(r){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Ho(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:r,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=kn(this.placed,t.depth,t.fit)),e=t.move;for(let s=t.depth+1;s<=e.depth;s++){let o=e.node(s),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(s));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,s){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=kn(this.placed,this.depth,x.from(e.create(t,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(x.empty,!0);t.childCount&&(this.placed=kn(this.placed,this.frontier.length,t))}}function xn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(xn(n.firstChild.content,e-1,t)))}function kn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(kn(n.lastChild.content,e-1,t)))}function Bo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Pl(n,e,t){if(e<=0)return n;let s=n.content;return e>1&&(s=s.replaceChild(0,Pl(s.firstChild,e-1,s.childCount==1?t-1:0))),e>0&&(s=n.type.contentMatch.fillBefore(s).append(s),t<=0&&(s=s.append(n.type.contentMatch.matchFragment(s).fillBefore(x.empty,!0)))),n.copy(s)}function Ho(n,e,t,s,o){let i=n.node(e),r=o?n.indexAfter(e):n.index(e);if(r==i.childCount&&!t.compatibleContent(i.type))return null;let l=s.fillBefore(i.content,!0,r);return l&&!cf(t,i.content,r)?l:null}function cf(n,e,t){for(let s=t;s<e.childCount;s++)if(!n.allowsMarks(e.child(s).marks))return!0;return!1}function df(n){return n.spec.defining||n.spec.definingForContent}function uf(n,e,t,s){if(!s.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(Nl(o,i,s))return n.step(new te(e,t,s));let r=Rl(o,n.doc.resolve(t));r[r.length-1]==0&&r.pop();let l=-(o.depth+1);r.unshift(l);for(let h=o.depth,f=o.pos-1;h>0;h--,f--){let p=o.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;r.indexOf(h)>-1?l=h:o.before(h)==f&&r.splice(1,0,-h)}let a=r.indexOf(l),c=[],d=s.openStart;for(let h=s.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==s.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=df(f.type);if(p&&!f.sameMarkup(o.node(Math.abs(l)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=s.openStart;h>=0;h--){let f=(h+d+1)%(s.openStart+1),p=c[f];if(p)for(let m=0;m<r.length;m++){let g=r[(m+a)%r.length],b=!0;g<0&&(b=!1,g=-g);let C=o.node(g-1),y=o.index(g-1);if(C.canReplaceWith(y,y,p.type,p.marks))return n.replace(o.before(g),b?i.after(g):t,new M(Il(s.content,0,s.openStart,f),f,s.openEnd))}}let u=n.steps.length;for(let h=r.length-1;h>=0&&(n.replace(e,t,s),!(n.steps.length>u));h--){let f=r[h];f<0||(e=o.before(f),t=i.after(f))}}function Il(n,e,t,s,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Il(i.content,e+1,t,s,i)))}if(e>s){let i=o.contentMatchAt(0),r=i.fillBefore(n).append(n);n=r.append(i.matchFragment(r).fillBefore(x.empty,!0))}return n}function hf(n,e,t,s){if(!s.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=rf(n.doc,e,s.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new M(x.from(s),0,0))}function ff(n,e,t){let s=n.doc.resolve(e),o=n.doc.resolve(t),i=Rl(s,o);for(let r=0;r<i.length;r++){let l=i[r],a=r==i.length-1;if(a&&l==0||s.node(l).type.contentMatch.validEnd)return n.delete(s.start(l),o.end(l));if(l>0&&(a||s.node(l-1).canReplace(s.index(l-1),o.indexAfter(l-1))))return n.delete(s.before(l),o.after(l))}for(let r=1;r<=s.depth&&r<=o.depth;r++)if(e-s.start(r)==s.depth-r&&t>s.end(r)&&o.end(r)-t!=o.depth-r&&s.start(r-1)==o.start(r-1)&&s.node(r-1).canReplace(s.index(r-1),o.index(r-1)))return n.delete(s.before(r),t);n.delete(e,t)}function Rl(n,e){let t=[],s=Math.min(n.depth,e.depth);for(let o=s;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class en extends ee{constructor(e,t,s){super(),this.pos=e,this.attr=t,this.value=s}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at attribute step's position");let s=Object.create(null);for(let i in t.attrs)s[i]=t.attrs[i];s[this.attr]=this.value;let o=t.type.create(s,null,t.marks);return q.fromReplace(e,this.pos,this.pos+1,new M(x.from(o),0,t.isLeaf?0:1))}getMap(){return he.empty}invert(e){return new en(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new en(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new en(t.pos,t.attr,t.value)}}ee.jsonID("attr",en);class Tn extends ee{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let s=e.type.create(t,e.content,e.marks);return q.ok(s)}getMap(){return he.empty}invert(e){return new Tn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Tn(t.attr,t.value)}}ee.jsonID("docAttr",Tn);let tn=class extends Error{};tn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},tn.prototype=Object.create(Error.prototype),tn.prototype.constructor=tn,tn.prototype.name="TransformError";class Dl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Yt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new tn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,s=M.empty){let o=Vo(this.doc,e,t,s);return o&&this.step(o),this}replaceWith(e,t,s){return this.replace(e,t,new M(x.from(s),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,s){return uf(this,e,t,s),this}replaceRangeWith(e,t,s){return hf(this,e,t,s),this}deleteRange(e,t){return ff(this,e,t),this}lift(e,t){return Jh(this,e,t),this}join(e,t=1){return of(this,e,t),this}wrap(e,t){return Yh(this,e,t),this}setBlockType(e,t=e,s,o=null){return Xh(this,e,t,s,o),this}setNodeMarkup(e,t,s=null,o){return ef(this,e,t,s,o),this}setNodeAttribute(e,t,s){return this.step(new en(e,t,s)),this}setDocAttribute(e,t){return this.step(new Tn(e,t)),this}addNodeMark(e,t){return this.step(new Je(e,t)),this}removeNodeMark(e,t){if(!(t instanceof L)){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(t=t.isInSet(s.marks),!t)return this}return this.step(new Xt(e,t)),this}split(e,t=1,s){return tf(this,e,t,s),this}addMark(e,t,s){return Gh(this,e,t,s),this}removeMark(e,t,s){return jh(this,e,t,s),this}clearIncompatible(e,t,s){return Lo(this,e,t,s),this}}const $o=Object.create(null);class I{constructor(e,t,s){this.$anchor=e,this.$head=t,this.ranges=s||[new zl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=M.empty){let s=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=s,s=s.lastChild;let i=e.steps.length,r=this.ranges;for(let l=0;l<r.length;l++){let{$from:a,$to:c}=r[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?M.empty:t),l==0&&Bl(e,i,(s?s.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let s=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:r,$to:l}=o[i],a=e.mapping.slice(s),c=a.map(r.pos),d=a.map(l.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Bl(e,s,t.isInline?-1:1))}}static findFrom(e,t,s=!1){let o=e.parent.inlineContent?new R(e):nn(e.node(0),e.parent,e.pos,e.index(),t,s);if(o)return o;for(let i=e.depth-1;i>=0;i--){let r=t<0?nn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,s):nn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,s);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new fe(e.node(0))}static atStart(e){return nn(e,e,0,0,1)||new fe(e)}static atEnd(e){return nn(e,e,e.content.size,e.childCount,-1)||new fe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=$o[t.type];if(!s)throw new RangeError(`No selection type ${t.type} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in $o)throw new RangeError("Duplicate use of selection JSON ID "+e);return $o[e]=t,t.prototype.jsonID=e,t}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class zl{constructor(e,t){this.$from=e,this.$to=t}}let Ll=!1;function Vl(n){!Ll&&!n.parent.inlineContent&&(Ll=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class R extends I{constructor(e,t=e){Vl(e),Vl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let s=e.resolve(t.map(this.head));if(!s.parent.inlineContent)return I.near(s);let o=e.resolve(t.map(this.anchor));return new R(o.parent.inlineContent?o:s,s)}replace(e,t=M.empty){if(super.replace(e,t),t==M.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Os(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new R(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,s=t){let o=e.resolve(t);return new this(o,s==t?o:e.resolve(s))}static between(e,t,s){let o=e.pos-t.pos;if((!s||o)&&(s=o>=0?1:-1),!t.parent.inlineContent){let i=I.findFrom(t,s,!0)||I.findFrom(t,-s,!0);if(i)t=i.$head;else return I.near(t,s)}return e.parent.inlineContent||(o==0?e=t:(e=(I.findFrom(e,-s,!0)||I.findFrom(e,s,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new R(e,t)}}I.jsonID("text",R);class Os{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Os(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class N extends I{constructor(e){let t=e.nodeAfter,s=e.node(0).resolve(e.pos+t.nodeSize);super(e,s),this.node=t}map(e,t){let{deleted:s,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return s?I.near(i):new N(i)}content(){return new M(x.from(this.node),0,0)}eq(e){return e instanceof N&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Fo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new N(e.resolve(t.anchor))}static create(e,t){return new N(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}N.prototype.visible=!1,I.jsonID("node",N);class Fo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:s}=e.mapResult(this.anchor);return t?new Os(s,s):new Fo(s)}resolve(e){let t=e.resolve(this.anchor),s=t.nodeAfter;return s&&N.isSelectable(s)?new N(t):I.near(t)}}class fe extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.empty){e.delete(0,e.doc.content.size);let s=I.atStart(e.doc);s.eq(e.selection)||e.setSelection(s)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new fe(e)}map(e){return new fe(e)}eq(e){return e instanceof fe}getBookmark(){return pf}}I.jsonID("all",fe);const pf={map(){return this},resolve(n){return new fe(n)}};function nn(n,e,t,s,o,i=!1){if(e.inlineContent)return R.create(n,t);for(let r=s-(o>0?0:1);o>0?r<e.childCount:r>=0;r+=o){let l=e.child(r);if(l.isAtom){if(!i&&N.isSelectable(l))return N.create(n,t-(o<0?l.nodeSize:0))}else{let a=nn(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function Bl(n,e,t){let s=n.steps.length-1;if(s<e)return;let o=n.steps[s];if(!(o instanceof te||o instanceof U))return;let i=n.mapping.maps[s],r;i.forEach((l,a,c,d)=>{r==null&&(r=d)}),n.setSelection(I.near(n.doc.resolve(r),t))}const Hl=1,Ns=2,$l=4;class mf extends Dl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Hl)&~Ns,this.storedMarks=null,this}get selectionSet(){return(this.updated&Hl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ns,this}ensureMarks(e){return L.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ns)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ns,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let s=this.selection;return t&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||L.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,s){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(s==null&&(s=t),s=s??t,!e)return this.deleteRange(t,s);let i=this.storedMarks;if(!i){let r=this.doc.resolve(t);i=s==t?r.marks():r.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(t,s,o.text(e,i)),this.selection.empty||this.setSelection(I.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=$l,this}get scrolledIntoView(){return(this.updated&$l)>0}}function Fl(n,e){return!e||!n?n:n.bind(e)}class Mn{constructor(e,t,s){this.name=e,this.init=Fl(t.init,s),this.apply=Fl(t.apply,s)}}const gf=[new Mn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Mn("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new Mn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,s){return s.selection.$cursor?n.storedMarks:null}}),new Mn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Wo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gf.slice(),t&&t.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new Mn(s.key,s.spec.state,s))})}}class sn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let s=0;s<this.config.plugins.length;s++)if(s!=t){let o=this.config.plugins[s];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],s=this.applyInner(e),o=null;for(;;){let i=!1;for(let r=0;r<this.config.plugins.length;r++){let l=this.config.plugins[r];if(l.spec.appendTransaction){let a=o?o[r].n:0,c=o?o[r].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,s);if(d&&s.filterTransaction(d,r)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<r?{state:s,n:t.length}:{state:this,n:0})}t.push(d),s=s.applyInner(d),i=!0}o&&(o[r]={state:s,n:t.length})}}if(!i)return{state:s,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new sn(this.config),s=this.config.fields;for(let o=0;o<s.length;o++){let i=s[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new mf(this)}static create(e){let t=new Wo(e.doc?e.doc.type.schema:e.schema,e.plugins),s=new sn(t);for(let o=0;o<t.fields.length;o++)s[t.fields[o].name]=t.fields[o].init(e,s);return s}reconfigure(e){let t=new Wo(this.schema,e.plugins),s=t.fields,o=new sn(t);for(let i=0;i<s.length;i++){let r=s[i].name;o[r]=this.hasOwnProperty(r)?this[r]:s[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(s=>s.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[s],i=o.spec.state;i&&i.toJSON&&(t[s]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,s){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Wo(e.schema,e.plugins),i=new sn(o);return o.fields.forEach(r=>{if(r.name=="doc")i.doc=wt.fromJSON(e.schema,t.doc);else if(r.name=="selection")i.selection=I.fromJSON(i.doc,t.selection);else if(r.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let l in s){let a=s[l],c=a.spec.state;if(a.key==r.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[r.name]=c.fromJSON.call(a,e,t[l],i);return}}i[r.name]=r.init(e,i)}}),i}}function Wl(n,e,t){for(let s in n){let o=n[s];o instanceof Function?o=o.bind(e):s=="handleDOMEvents"&&(o=Wl(o,e,{})),t[s]=o}return t}class An{constructor(e){this.spec=e,this.props={},e.props&&Wl(e.props,this,this.props),this.key=e.key?e.key.key:_l("plugin")}getState(e){return e[this.key]}}const _o=Object.create(null);function _l(n){return n in _o?n+"$"+ ++_o[n]:(_o[n]=0,n+"$")}class En{constructor(e="key"){this.key=_l(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ql=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function yf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const bf=(n,e,t)=>{let s=yf(n,t);if(!s)return!1;let o=Gl(s);if(!o){let r=s.blockRange(),l=r&&As(r);return l==null?!1:(e&&e(n.tr.lift(r,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Yl(n,o,e,-1))return!0;if(s.parent.content.size==0&&(on(i,"end")||N.isSelectable(i)))for(let r=s.depth;;r--){let l=Vo(n.doc,s.before(r),s.after(r),M.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(on(i,"end")?I.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):N.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(r==1||s.node(r-1).childCount>1)break}return i.isAtom&&o.depth==s.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function on(n,e,t=!1){for(let s=n;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(t&&s.childCount!=1)return!1}return!1}const vf=(n,e,t)=>{let{$head:s,empty:o}=n.selection,i=s;if(!o)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):s.parentOffset>0)return!1;i=Gl(s)}let r=i&&i.nodeBefore;return!r||!N.isSelectable(r)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,i.pos-r.nodeSize)).scrollIntoView()),!0)};function Gl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Sf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const wf=(n,e,t)=>{let s=Sf(n,t);if(!s)return!1;let o=jl(s);if(!o)return!1;let i=o.nodeAfter;if(Yl(n,o,e,1))return!0;if(s.parent.content.size==0&&(on(i,"start")||N.isSelectable(i))){let r=Vo(n.doc,s.before(),s.after(),M.empty);if(r&&r.slice.size<r.to-r.from){if(e){let l=n.tr.step(r);l.setSelection(on(i,"start")?I.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):N.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==s.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Cf=(n,e,t)=>{let{$head:s,empty:o}=n.selection,i=s;if(!o)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):s.parentOffset<s.parent.content.size)return!1;i=jl(s)}let r=i&&i.nodeAfter;return!r||!N.isSelectable(r)?!1:(e&&e(n.tr.setSelection(N.create(n.doc,i.pos)).scrollIntoView()),!0)};function jl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const xf=(n,e)=>{let{$head:t,$anchor:s}=n.selection;return!t.parent.type.spec.code||!t.sameParent(s)?!1:(e&&e(n.tr.insertText(`
195
+ `).scrollIntoView()),!0)};function qo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Kl=(n,e)=>{let{$head:t,$anchor:s}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(s))return!1;let o=t.node(-1),i=t.indexAfter(-1),r=qo(o.contentMatchAt(i));if(!r||!o.canReplaceWith(i,i,r))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,r.createAndFill());a.setSelection(I.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},kf=(n,e)=>{let t=n.selection,{$from:s,$to:o}=t;if(t instanceof fe||s.parent.inlineContent||o.parent.inlineContent)return!1;let i=qo(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let r=(!s.parentOffset&&o.index()<o.parent.childCount?s:o).pos,l=n.tr.insert(r,i.createAndFill());l.setSelection(R.create(l.doc,r+1)),e(l.scrollIntoView())}return!0},Jl=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Qt(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let s=t.blockRange(),o=s&&As(s);return o==null?!1:(e&&e(n.tr.lift(s,o).scrollIntoView()),!0)};function Ul(n){return(e,t)=>{let{$from:s,$to:o}=e.selection;if(e.selection instanceof N&&e.selection.node.isBlock)return!s.parentOffset||!Qt(e.doc,s.pos)?!1:(t&&t(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let i=[],r,l,a=!1,c=!1;for(let f=s.depth;;f--)if(s.node(f).isBlock){a=s.end(f)==s.pos+(s.depth-f),c=s.start(f)==s.pos-(s.depth-f),l=qo(s.node(f-1).contentMatchAt(s.indexAfter(f-1)));let m=n&&n(o.parent,a,s);i.unshift(m||(a&&l?{type:l}:null)),r=f;break}else{if(f==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof R||e.selection instanceof fe)&&d.deleteSelection();let u=d.mapping.map(s.pos),h=Qt(d.doc,u,i.length,i);if(h||(i[0]=l?{type:l}:null,h=Qt(d.doc,u,i.length,i)),d.split(u,i.length,i),!a&&c&&s.node(r).type!=l){let f=d.mapping.map(s.before(r)),p=d.doc.resolve(f);l&&s.node(r-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(s.before(r)),l)}return t&&t(d.scrollIntoView()),!0}}const Tf=Ul(),Zl=(n,e)=>(e&&e(n.tr.setSelection(new fe(n.doc))),!0);function Mf(n,e,t){let s=e.nodeBefore,o=e.nodeAfter,i=e.index();return!s||!o||!s.type.compatibleContent(o.type)?!1:!s.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Es(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Yl(n,e,t,s){let o=e.nodeBefore,i=e.nodeAfter,r,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Mf(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(r=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(r[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,p=x.empty;for(let b=r.length-1;b>=0;b--)p=x.from(r[b].create(null,p));p=x.from(o.copy(p));let m=n.tr.step(new U(e.pos-1,f,e.pos,f,new M(p,1,0),r.length,!0)),g=m.doc.resolve(f+2*r.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Es(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||s>0&&a?null:I.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&As(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&on(i,"start",!0)&&on(o,"end")){let f=o,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let b=x.empty;for(let y=p.length-1;y>=0;y--)b=x.from(p[y].copy(b));let C=n.tr.step(new U(e.pos-p.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new M(b,p.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function Xl(n){return function(e,t){let s=e.selection,o=n<0?s.$from:s.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(R.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}const Af=Xl(-1),Ef=Xl(1);function Of(n,e=null){return function(t,s){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(r,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,n)}})}if(!o)return!1;if(s){let i=t.tr;for(let r=0;r<t.selection.ranges.length;r++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[r];i.setBlockType(l,a,n,e)}s(i.scrollIntoView())}return!0}}function Nf(n,e,t,s){for(let o=0;o<e.length;o++){let{$from:i,$to:r}=e[o],l=i.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(i.pos,r.pos,(a,c)=>{if(l||!s)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function kt(n,e=null,t){let s=t!==!1;return function(o,i){let{empty:r,$cursor:l,ranges:a}=o.selection;if(r&&!l||!Nf(o.doc,a,n,s))return!1;if(i)if(l)n.isInSet(o.storedMarks||l.marks())?i(o.tr.removeStoredMark(n)):i(o.tr.addStoredMark(n.create(e)));else{let c,d=o.tr;c=!a.some(u=>o.doc.rangeHasMark(u.$from.pos,u.$to.pos,n));for(let u=0;u<a.length;u++){let{$from:h,$to:f}=a[u];if(!c)d.removeMark(h.pos,f.pos,n);else{let p=h.pos,m=f.pos,g=h.nodeAfter,b=f.nodeBefore,C=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,y=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;p+C<m&&(p+=C,m-=y),d.addMark(p,m,n.create(e))}}i(d.scrollIntoView())}return!0}}function On(...n){return function(e,t,s){for(let o=0;o<n.length;o++)if(n[o](e,t,s))return!0;return!1}}let Go=On(ql,bf,vf),Ql=On(ql,wf,Cf);const Le={Enter:On(xf,kf,Jl,Tf),"Mod-Enter":Kl,Backspace:Go,"Mod-Backspace":Go,"Shift-Backspace":Go,Delete:Ql,"Mod-Delete":Ql,"Mod-a":Zl},ea={"Ctrl-h":Le.Backspace,"Alt-Backspace":Le["Mod-Backspace"],"Ctrl-d":Le.Delete,"Ctrl-Alt-Backspace":Le["Mod-Delete"],"Alt-Delete":Le["Mod-Delete"],"Alt-d":Le["Mod-Delete"],"Ctrl-a":Af,"Ctrl-e":Ef};for(let n in Le)ea[n]=Le[n];const Pf=(typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1)?ea:Le;var Ps=200,j=function(){};j.prototype.append=function(e){return e.length?(e=j.from(e),!this.length&&e||e.length<Ps&&this.leafAppend(e)||this.length<Ps&&e.leafPrepend(this)||this.appendInner(e)):this},j.prototype.prepend=function(e){return e.length?j.from(e).append(this):this},j.prototype.appendInner=function(e){return new If(this,e)},j.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?j.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},j.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},j.prototype.forEach=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length),t<=s?this.forEachInner(e,t,s,0):this.forEachInvertedInner(e,t,s,0)},j.prototype.map=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length);var o=[];return this.forEach(function(i,r){return o.push(e(i,r))},t,s),o},j.from=function(e){return e instanceof j?e:e&&e.length?new ta(e):j.empty};var ta=function(n){function e(s){n.call(this),this.values=s}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,r,l){for(var a=i;a<r;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,r,l){for(var a=i-1;a>=r;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ps)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ps)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(j);j.empty=new ta([]);var If=function(n){function e(t,s){n.call(this),this.left=t,this.right=s,this.length=t.length+s.length,this.depth=Math.max(t.depth,s.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},e.prototype.forEachInner=function(s,o,i,r){var l=this.left.length;if(o<l&&this.left.forEachInner(s,o,Math.min(i,l),r)===!1||i>l&&this.right.forEachInner(s,Math.max(o-l,0),Math.min(this.length,i)-l,r+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,r){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(s,o-l,Math.max(i,l)-l,r+l)===!1||i<l&&this.left.forEachInvertedInner(s,Math.min(o,l),i,r)===!1)return!1},e.prototype.sliceInner=function(s,o){if(s==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(s,o):s>=i?this.right.slice(s-i,o-i):this.left.slice(s,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(s){var o=this.right.leafAppend(s);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(s){var o=this.left.leafPrepend(s);if(o)return new e(o,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e}(j);const Rf=500;class Se{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let o,i;t&&(o=this.remapping(s,this.items.length),i=o.maps.length);let r=e.tr,l,a,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){o||(o=this.remapping(s,h+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Oe(u.map));let f=u.step.map(o.slice(i)),p;f&&r.maybeStep(f).doc&&(p=r.mapping.maps[r.mapping.maps.length-1],c.push(new Oe(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else r.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new Se(this.items.slice(0,s).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:r,selection:l}}addTransform(e,t,s,o){let i=[],r=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Oe(e.mapping.maps[d],u,t),f;(f=a&&a.merge(h))&&(h=f,d?i.pop():l=l.slice(0,l.length-1)),i.push(h),t&&(r++,t=void 0),o||(a=h)}let c=r-s.depth;return c>zf&&(l=Df(l,c),r-=c),new Se(l.append(i),r)}remapping(e,t){let s=new Yt;return this.items.forEach((o,i)=>{let r=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?s.maps.length-o.mirrorOffset:void 0;s.appendMap(o.map,r)},e,t),s}addMaps(e){return this.eventCount==0?this:new Se(this.items.append(e.map(t=>new Oe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let s=[],o=Math.max(0,this.items.length-t),i=e.mapping,r=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},o);let a=t;this.items.forEach(h=>{let f=i.getMirror(--a);if(f==null)return;r=Math.min(r,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(i.slice(a+1,f));g&&l++,s.push(new Oe(p,m,g))}else s.push(new Oe(p))},o);let c=[];for(let h=t;h<r;h++)c.push(new Oe(i.maps[h]));let d=this.items.slice(0,o).append(c).append(s),u=new Se(d,l);return u.emptyItemCount()>Rf&&(u=u.compress(this.items.length-s.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),s=t.maps.length,o=[],i=0;return this.items.forEach((r,l)=>{if(l>=e)o.push(r),r.selection&&i++;else if(r.step){let a=r.step.map(t.slice(s)),c=a&&a.getMap();if(s--,c&&t.appendMap(c,s),a){let d=r.selection&&r.selection.map(t.slice(s));d&&i++;let u=new Oe(c.invert(),a,d),h,f=o.length-1;(h=o.length&&o[f].merge(u))?o[f]=h:o.push(u)}}else r.map&&s--},this.items.length,0),new Se(j.from(o.reverse()),i)}}Se.empty=new Se(j.empty,0);function Df(n,e){let t;return n.forEach((s,o)=>{if(s.selection&&e--==0)return t=o,!1}),n.slice(t)}class Oe{constructor(e,t,s,o){this.map=e,this.step=t,this.selection=s,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Oe(t.getMap().invert(),t,this.selection)}}}class Ue{constructor(e,t,s,o,i){this.done=e,this.undone=t,this.prevRanges=s,this.prevTime=o,this.prevComposition=i}}const zf=20;function Lf(n,e,t,s){let o=t.getMeta(Tt),i;if(o)return o.historyState;t.getMeta(Hf)&&(n=new Ue(n.done,n.undone,null,0,-1));let r=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(r&&r.getMeta(Tt))return r.getMeta(Tt).redo?new Ue(n.done.addTransform(t,void 0,s,Is(e)),n.undone,na(t.mapping.maps),n.prevTime,n.prevComposition):new Ue(n.done,n.undone.addTransform(t,void 0,s,Is(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(r&&r.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!r&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-s.newGroupDelay||!Vf(t,n.prevRanges)),c=r?jo(n.prevRanges,t.mapping):na(t.mapping.maps);return new Ue(n.done.addTransform(t,a?e.selection.getBookmark():void 0,s,Is(e)),Se.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new Ue(n.done.rebased(t,i),n.undone.rebased(t,i),jo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ue(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),jo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Vf(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((s,o)=>{for(let i=0;i<e.length;i+=2)s<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function na(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((s,o,i,r)=>e.push(i,r));return e}function jo(n,e){if(!n)return null;let t=[];for(let s=0;s<n.length;s+=2){let o=e.map(n[s],1),i=e.map(n[s+1],-1);o<=i&&t.push(o,i)}return t}function Bf(n,e,t){let s=Is(e),o=Tt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,s);if(!i)return null;let r=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),o,s),a=new Ue(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(r).setMeta(Tt,{redo:t,historyState:a})}let Ko=!1,sa=null;function Is(n){let e=n.plugins;if(sa!=e){Ko=!1,sa=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ko=!0;break}}return Ko}const Tt=new En("history"),Hf=new En("closeHistory");function $f(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new An({key:Tt,state:{init(){return new Ue(Se.empty,Se.empty,null,0,-1)},apply(e,t,s){return Lf(t,s,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let s=t.inputType,o=s=="historyUndo"?ia:s=="historyRedo"?Jo:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function oa(n,e){return(t,s)=>{let o=Tt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(s){let i=Bf(o,t,n);i&&s(e?i.scrollIntoView():i)}return!0}}const ia=oa(!1,!0),Jo=oa(!0,!0);for(var Ze={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ff=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wf=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Z=0;Z<10;Z++)Ze[48+Z]=Ze[96+Z]=String(Z);for(var Z=1;Z<=24;Z++)Ze[Z+111]="F"+Z;for(var Z=65;Z<=90;Z++)Ze[Z]=String.fromCharCode(Z+32),Rs[Z]=String.fromCharCode(Z);for(var Uo in Ze)Rs.hasOwnProperty(Uo)||(Rs[Uo]=Ze[Uo]);function _f(n){var e=Ff&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Wf&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Rs:Ze)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const qf=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Gf(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let s,o,i,r;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))s=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))qf?r=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return s&&(t="Alt-"+t),o&&(t="Ctrl-"+t),r&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function jf(n){let e=Object.create(null);for(let t in n)e[Gf(t)]=n[t];return e}function Zo(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Yo(n){return new An({props:{handleKeyDown:ra(n)}})}function ra(n){let e=jf(n);return function(t,s){let o=_f(s),i,r=e[Zo(o,s)];if(r&&r(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(s.shiftKey){let l=e[Zo(o,s,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((s.shiftKey||s.altKey||s.metaKey||o.charCodeAt(0)>127)&&(i=Ze[s.keyCode])&&i!=o){let l=e[Zo(i,s)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function la(n,e=null){return function(t,s){let{$from:o,$to:i}=t.selection,r=o.blockRange(i),l=!1,a=r;if(!r)return!1;if(r.depth>=2&&o.node(r.depth-1).type.compatibleContent(n)&&r.startIndex==0){if(o.index(r.depth-1)==0)return!1;let d=t.doc.resolve(r.start-2);a=new vs(d,d,r.depth),r.endIndex<r.parent.childCount&&(r=new vs(o,t.doc.resolve(i.end(r.depth)),r.depth)),l=!0}let c=Ml(a,n,e,r);return c?(s&&s(Kf(t.tr,r,c,l,n).scrollIntoView()),!0):!1}}function Kf(n,e,t,s,o){let i=x.empty;for(let d=t.length-1;d>=0;d--)i=x.from(t[d].type.create(t[d].attrs,i));n.step(new U(e.start-(s?2:0),e.end,e.start,e.end,new M(i,0,0),t.length,!0));let r=0;for(let d=0;d<t.length;d++)t[d].type==o&&(r=d+1);let l=t.length-r,a=e.start+t.length-(s?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&Qt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Jf(n,e){return function(t,s){let{$from:o,$to:i,node:r}=t.selection;if(r&&r.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(l.type!=n)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=n||o.index(-2)!=o.node(-2).childCount-1)return!1;if(s){let u=x.empty,h=o.index(-1)?1:o.index(-2)?2:3;for(let b=o.depth-h;b>=o.depth-3;b--)u=x.from(o.node(b).copy(u));let f=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;u=u.append(x.from(n.createAndFill()));let p=o.before(o.depth-(h-1)),m=t.tr.replace(p,o.after(-f),new M(u,4-h,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(b,C)=>{if(g>-1)return!1;b.isTextblock&&b.content.size==0&&(g=C+1)}),g>-1&&m.setSelection(I.near(m.doc.resolve(g))),s(m.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,i.pos),d=a?[null,{type:a}]:void 0;return Qt(c.doc,o.pos,2,d)?(s&&s(c.split(o.pos,2,d).scrollIntoView()),!0):!1}}function Xo(n){return function(e,t){let{$from:s,$to:o}=e.selection,i=s.blockRange(o,r=>r.childCount>0&&r.firstChild.type==n);return i?t?s.node(i.depth-1).type==n?Uf(e,t,n,i):Zf(e,t,i):!0:!1}}function Uf(n,e,t,s){let o=n.tr,i=s.end,r=s.$to.end(s.depth);i<r&&(o.step(new U(i-1,r,i,r,new M(x.from(t.create(null,s.parent.copy())),1,0),1,!0)),s=new vs(o.doc.resolve(s.$from.pos),o.doc.resolve(r),s.depth));const l=As(s);if(l==null)return!1;o.lift(s,l);let a=o.mapping.map(i,-1)-1;return Es(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function Zf(n,e,t){let s=n.tr,o=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=o.child(p).nodeSize,s.delete(f-1,f+1);let i=s.doc.resolve(t.start),r=i.nodeAfter;if(s.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,r.content.append(a?x.empty:x.from(o))))return!1;let u=i.pos,h=u+r.nodeSize;return s.step(new U(u-(l?1:0),h+(a?1:0),u+1,h-1,new M((l?x.empty:x.from(o.copy(x.empty))).append(a?x.empty:x.from(o.copy(x.empty))),l?0:1,a?0:1),l?0:1)),e(s.scrollIntoView()),!0}function Yf(n){return function(e,t){let{$from:s,$to:o}=e.selection,i=s.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let r=i.startIndex;if(r==0)return!1;let l=i.parent,a=l.child(r-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=x.from(c?n.create():null),u=new M(x.from(n.create(null,x.from(l.type.create(null,d)))),c?3:1,0),h=i.start,f=i.end;t(e.tr.step(new U(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const Y=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Nn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Qo=null;const Ve=function(n,e,t){let s=Qo||(Qo=document.createRange());return s.setEnd(n,t??n.nodeValue.length),s.setStart(n,e||0),s},Xf=function(){Qo=null},Mt=function(n,e,t,s){return t&&(aa(n,e,t,s,-1)||aa(n,e,t,s,1))},Qf=/^(img|br|input|textarea|hr)$/i;function aa(n,e,t,s,o){for(;;){if(n==t&&e==s)return!0;if(e==(o<0?0:me(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Pn(n)||Qf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Y(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?me(n):0}else return!1}}function me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ep(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=me(n)}else if(n.parentNode&&!Pn(n))e=Y(n),n=n.parentNode;else return null}}function tp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Pn(n))e=Y(n)+1,n=n.parentNode;else return null}}function np(n,e,t){for(let s=e==0,o=e==me(n);s||o;){if(n==t)return!0;let i=Y(n);if(n=n.parentNode,!n)return!1;s=s&&i==0,o=o&&i==me(n)}}function Pn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ds=function(n){return n.focusNode&&Mt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function At(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function sp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function op(n,e,t){if(n.caretPositionFromPoint)try{let s=n.caretPositionFromPoint(e,t);if(s)return{node:s.offsetNode,offset:Math.min(me(s.offsetNode),s.offset)}}catch{}if(n.caretRangeFromPoint){let s=n.caretRangeFromPoint(e,t);if(s)return{node:s.startContainer,offset:Math.min(me(s.startContainer),s.startOffset)}}}const Ne=typeof navigator<"u"?navigator:null,ca=typeof document<"u"?document:null,Ye=Ne&&Ne.userAgent||"",ei=/Edge\/(\d+)/.exec(Ye),da=/MSIE \d/.exec(Ye),ti=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ye),de=!!(da||ti||ei),Xe=da?document.documentMode:ti?+ti[1]:ei?+ei[1]:0,we=!de&&/gecko\/(\d+)/i.test(Ye);we&&+(/Firefox\/(\d+)/.exec(Ye)||[0,0])[1];const ni=!de&&/Chrome\/(\d+)/.exec(Ye),ne=!!ni,ua=ni?+ni[1]:0,ie=!de&&!!Ne&&/Apple Computer/.test(Ne.vendor),rn=ie&&(/Mobile\/\w+/.test(Ye)||!!Ne&&Ne.maxTouchPoints>2),ge=rn||(Ne?/Mac/.test(Ne.platform):!1),ip=Ne?/Win/.test(Ne.platform):!1,Ce=/Android \d/.test(Ye),In=!!ca&&"webkitFontSmoothing"in ca.documentElement.style,rp=In?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lp(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Be(n,e){return typeof n=="number"?n:n[e]}function ap(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,s=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*s}}function ha(n,e,t){let s=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let r=t||n.dom;r;r=Nn(r)){if(r.nodeType!=1)continue;let l=r,a=l==i.body,c=a?lp(i):ap(l),d=0,u=0;if(e.top<c.top+Be(s,"top")?u=-(c.top-e.top+Be(o,"top")):e.bottom>c.bottom-Be(s,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Be(o,"top")-c.top:e.bottom-c.bottom+Be(o,"bottom")),e.left<c.left+Be(s,"left")?d=-(c.left-e.left+Be(o,"left")):e.right>c.right-Be(s,"right")&&(d=e.right-c.right+Be(o,"right")),d||u)if(a)i.defaultView.scrollBy(d,u);else{let h=l.scrollLeft,f=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-h,m=l.scrollTop-f;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(r).position))break}}function cp(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),s,o;for(let i=(e.left+e.right)/2,r=t+1;r<Math.min(innerHeight,e.bottom);r+=5){let l=n.root.elementFromPoint(i,r);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){s=l,o=a.top;break}}return{refDOM:s,refTop:o,stack:fa(n.dom)}}function fa(n){let e=[],t=n.ownerDocument;for(let s=n;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),n!=t);s=Nn(s));return e}function dp({refDOM:n,refTop:e,stack:t}){let s=n?n.getBoundingClientRect().top:0;pa(t,s==0?0:s-e)}function pa(n,e){for(let t=0;t<n.length;t++){let{dom:s,top:o,left:i}=n[t];s.scrollTop!=o+e&&(s.scrollTop=o+e),s.scrollLeft!=i&&(s.scrollLeft=i)}}let ln=null;function up(n){if(n.setActive)return n.setActive();if(ln)return n.focus(ln);let e=fa(n);n.focus(ln==null?{get preventScroll(){return ln={preventScroll:!0},!0}}:void 0),ln||(ln=!1,pa(e,0))}function ma(n,e){let t,s=2e8,o,i=0,r=e.top,l=e.top,a,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Ve(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=r&&p.bottom>=l){r=Math.max(p.bottom,r),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<s){t=d,s=m,o=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(i=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!t&&a&&(t=a,o=c,s=0),t&&t.nodeType==3?hp(t,o):!t||s&&t.nodeType==1?{node:n,offset:i}:ma(t,o)}function hp(n,e){let t=n.nodeValue.length,s=document.createRange();for(let o=0;o<t;o++){s.setEnd(n,o+1),s.setStart(n,o);let i=Qe(s,1);if(i.top!=i.bottom&&si(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function si(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function fp(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function pp(n,e,t){let{node:s,offset:o}=ma(e,t),i=-1;if(s.nodeType==1&&!s.firstChild){let r=s.getBoundingClientRect();i=r.left!=r.right&&t.left>(r.left+r.right)/2?1:-1}return n.docView.posFromDOM(s,o,i)}function mp(n,e,t,s){let o=-1;for(let i=e,r=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!r&&a.left>s.left||a.top>s.top?o=l.posBefore:(!r&&a.right<s.left||a.bottom<s.top)&&(o=l.posAfter),r=!0),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?s.top<(a.top+a.bottom)/2:s.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function ga(n,e,t){let s=n.childNodes.length;if(s&&t.top<t.bottom)for(let o=Math.max(0,Math.min(s-1,Math.floor(s*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let r=n.childNodes[i];if(r.nodeType==1){let l=r.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(si(e,c))return ga(r,e,c)}}if((i=(i+1)%s)==o)break}return n}function gp(n,e){let t=n.dom.ownerDocument,s,o=0,i=op(t,e.left,e.top);i&&({node:s,offset:o}=i);let r=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!r||!n.dom.contains(r.nodeType!=1?r.parentNode:r)){let c=n.dom.getBoundingClientRect();if(!si(e,c)||(r=ga(n.dom,e,c),!r))return null}if(ie)for(let c=r;s&&c;c=Nn(c))c.draggable&&(s=void 0);if(r=fp(r,e),s){if(we&&s.nodeType==1&&(o=Math.min(o,s.childNodes.length),o<s.childNodes.length)){let d=s.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++}let c;In&&o&&s.nodeType==1&&(c=s.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,s==n.dom&&o==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||s.nodeType!=1||s.childNodes[o-1].nodeName!="BR")&&(l=mp(n,s,o,e))}l==null&&(l=pp(n,r,e));let a=n.docView.nearestDesc(r,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ya(n){return n.top<n.bottom||n.left<n.right}function Qe(n,e){let t=n.getClientRects();if(t.length){let s=t[e<0?0:t.length-1];if(ya(s))return s}return Array.prototype.find.call(t,ya)||n.getBoundingClientRect()}const yp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ba(n,e,t){let{node:s,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),r=In||we;if(s.nodeType==3)if(r&&(yp.test(s.nodeValue)||(t<0?!o:o==s.nodeValue.length))){let a=Qe(Ve(s,o,o),t);if(we&&o&&/\s/.test(s.nodeValue[o-1])&&o<s.nodeValue.length){let c=Qe(Ve(s,o-1,o-1),-1);if(c.top==a.top){let d=Qe(Ve(s,o,o+1),-1);if(d.top!=a.top)return Rn(d,d.left<c.left)}}return a}else{let a=o,c=o,d=t<0?1:-1;return t<0&&!o?(c++,d=-1):t>=0&&o==s.nodeValue.length?(a--,d=1):t<0?a--:c++,Rn(Qe(Ve(s,a,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==me(s))){let a=s.childNodes[o-1];if(a.nodeType==1)return oi(a.getBoundingClientRect(),!1)}if(i==null&&o<me(s)){let a=s.childNodes[o];if(a.nodeType==1)return oi(a.getBoundingClientRect(),!0)}return oi(s.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==me(s))){let a=s.childNodes[o-1],c=a.nodeType==3?Ve(a,me(a)-(r?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Rn(Qe(c,1),!1)}if(i==null&&o<me(s)){let a=s.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Ve(a,0,r?0:1):a.nodeType==1?a:null:null;if(c)return Rn(Qe(c,-1),!0)}return Rn(Qe(s.nodeType==3?Ve(s):s,-t),t>=0)}function Rn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function oi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function va(n,e,t){let s=n.state,o=n.root.activeElement;s!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{s!=e&&n.updateState(s),o!=n.dom&&o&&o.focus()}}function bp(n,e,t){let s=e.selection,o=t=="up"?s.$from:s.$to;return va(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let r=ba(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ve(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?r.top-d.top>(d.bottom-r.top)*2:d.bottom-r.bottom>(r.bottom-d.top)*2))return!1}}return!0})}const vp=/[\u0590-\u08ac]/;function Sp(n,e,t){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let o=s.parentOffset,i=!o,r=o==s.parent.content.size,l=n.domSelection();return l?!vp.test(s.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:r:va(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let f=s.depth?n.docView.domAfterPos(s.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),g}):s.pos==s.start()||s.pos==s.end()}let Sa=null,wa=null,Ca=!1;function wp(n,e,t){return Sa==e&&wa==t?Ca:(Sa=e,wa=t,Ca=t=="up"||t=="down"?bp(n,e,t):Sp(n,e,t))}const ye=0,xa=1,Et=2,Pe=3;class Dn{constructor(e,t,s,o){this.parent=e,this.children=t,this.dom=s,this.contentDOM=o,this.dirty=ye,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,s=this.posAtStart;;t++){let o=this.children[t];if(o==e)return s;s+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,s){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(s<0){let i,r;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((r=i.pmViewDesc)&&r.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(r)+r.size:this.posAtStart}else{let i,r;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((r=i.pmViewDesc)&&r.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(r):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Y(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let s=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),r;if(i&&(!t||i.node))if(s&&(r=i.nodeDOM)&&!(r.nodeType==1?r.contains(e.nodeType==1?e:e.parentNode):r==e))s=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let s=t;s;s=s.parent)if(s==this)return t}posFromDOM(e,t,s){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,s)}return-1}descAt(e){for(let t=0,s=0;t<this.children.length;t++){let o=this.children[t],i=s+o.size;if(s==e&&i!=s){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-s-o.border);s=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let s=0,o=0;for(let i=0;s<this.children.length;s++){let r=this.children[s],l=i+r.size;if(l>e||r instanceof Ma){o=e-i;break}i=l}if(o)return this.children[s].domFromPos(o-this.children[s].border,t);for(let i;s&&!(i=this.children[s-1]).size&&i instanceof ka&&i.side>=0;s--);if(t<=0){let i,r=!0;for(;i=s?this.children[s-1]:null,!(!i||i.dom.parentNode==this.contentDOM);s--,r=!1);return i&&t&&r&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Y(i.dom)+1:0}}else{let i,r=!0;for(;i=s<this.children.length?this.children[s]:null,!(!i||i.dom.parentNode==this.contentDOM);s++,r=!1);return i&&r&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Y(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,s=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let r=s,l=0;;l++){let a=this.children[l],c=r+a.size;if(o==-1&&e<=c){let d=r+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=r;for(let u=l;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=Y(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=Y(u.dom);break}t+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}r=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:s}=this.domFromPos(e,0);if(t.nodeType!=1||s==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[s]}setSelection(e,t,s,o=!1){let i=Math.min(e,t),r=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(i>p&&r<g)return m.setSelection(e-p-m.border,t-p-m.border,s,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=s.root.getSelection(),d=s.domSelectionRange(),u=!1;if((we||ie)&&e==t){let{node:f,offset:p}=l;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`
196
+ `),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Y(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(we&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||u&&ie)&&Mt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&Mt(a.node,a.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!u){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>t){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let s=0,o=0;o<this.children.length;o++){let i=this.children[o],r=s+i.size;if(s==r?e<=r&&t>=s:e<r&&t>s){let l=s+i.border,a=r-i.border;if(e>=l&&t<=a){this.dirty=e==s||t==r?Et:xa,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Pe:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Et:Pe}s=r}this.dirty=Et}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let s=e==1?Et:xa;t.dirty<s&&(t.dirty=s)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class ka extends Dn{constructor(e,t,s,o){let i,r=t.type.toDOM;if(typeof r=="function"&&(r=r(s,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(r.nodeType!=1){let l=document.createElement("span");l.appendChild(r),r=l}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(e,[],r,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==ye&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Cp extends Dn{constructor(e,t,s,o){super(e,[],t,null),this.textDOM=s,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ot extends Dn{constructor(e,t,s,o,i){super(e,[],s,o),this.mark=t,this.spec=i}static create(e,t,s,o){let i=o.nodeViews[t.type.name],r=i&&i(t,o,s);return(!r||!r.dom)&&(r=xt.renderSpec(document,t.type.spec.toDOM(t,s),null,t.attrs)),new Ot(e,t,r.dom,r.contentDOM||r.dom,r)}parseRule(){return this.dirty&Pe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Pe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ye){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty<this.dirty&&(s.dirty=this.dirty),this.dirty=ye}}slice(e,t,s){let o=Ot.create(this.parent,this.mark,!0,s),i=this.children,r=this.size;t<r&&(i=ri(i,t,r,s)),e>0&&(i=ri(i,0,e,s));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class et extends Dn{constructor(e,t,s,o,i,r,l,a,c){super(e,[],i,r),this.node=t,this.outerDeco=s,this.innerDeco=o,this.nodeDOM=l}static create(e,t,s,o,i,r){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)},s,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=xt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Oa(d,s,t),c?a=new xp(e,t,s,o,d,u||null,h,c,i,r+1):t.isText?new zs(e,t,s,o,d,h,i):new et(e,t,s,o,d,u||null,h,i,r+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let s=this.children[t];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,t,s){return this.dirty==ye&&e.eq(this.node)&&Ls(t,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let s=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,r=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new Tp(this,r&&r.node,e);Ep(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,s,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?L.none:this.node.child(d).marks,s,e),a.placeWidget(c,e,o)},(c,d,u,h)=>{a.syncToMarks(c.marks,s,e);let f;a.findNodeMatch(c,d,u,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(f=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,d,u,f,e)||a.updateNextNode(c,d,u,e,h,o)||a.addNode(c,d,u,e,o),o+=c.nodeSize}),a.syncToMarks([],s,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Et)&&(r&&this.protectLocalComposition(e,r),Aa(this.contentDOM,this.children,e),rn&&Op(this.dom))}localCompositionInfo(e,t){let{from:s,to:o}=e.state.selection;if(!(e.state.selection instanceof R)||s<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let r=i.nodeValue,l=Np(this.node.content,r,s-t,o-t);return l<0?null:{node:i,pos:l,text:r}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:s,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let r=new Cp(this,i,t,o);e.input.compositionNodes.push(r),this.children=ri(this.children,s,s+o.length,e,r)}update(e,t,s,o){return this.dirty==Pe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,s,o),!0)}updateInner(e,t,s,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=ye}updateOuterDeco(e){if(Ls(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=Ea(this.dom,this.nodeDOM,ii(this.outerDeco,this.node,t),ii(e,this.node,t)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ta(n,e,t,s,o){Oa(s,e,n);let i=new et(void 0,n,e,t,s,s,s,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class zs extends et{constructor(e,t,s,o,i,r,l){super(e,t,s,o,i,null,r,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,s,o){return this.dirty==Pe||this.dirty!=ye&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ye||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=ye,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,s){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,s){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new zs(this.parent,o,this.outerDeco,this.innerDeco,i,i,s)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Pe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ma extends Dn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ye&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xp extends et{constructor(e,t,s,o,i,r,l,a,c,d){super(e,t,s,o,i,r,l,c,d),this.spec=a}update(e,t,s,o){if(this.dirty==Pe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,s);return i&&this.updateInner(e,t,s,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,s,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,s,o){this.spec.setSelection?this.spec.setSelection(e,t,s.root):super.setSelection(e,t,s,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Aa(n,e,t){let s=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let r=e[i],l=r.dom;if(l.parentNode==n){for(;l!=s;)s=Na(s),o=!0;s=s.nextSibling}else o=!0,n.insertBefore(l,s);if(r instanceof Ot){let a=s?s.previousSibling:n.lastChild;Aa(r.contentDOM,r.children,t),s=a?a.nextSibling:n.firstChild}}for(;s;)s=Na(s),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const zn=function(n){n&&(this.nodeName=n)};zn.prototype=Object.create(null);const Nt=[new zn];function ii(n,e,t){if(n.length==0)return Nt;let s=t?Nt[0]:new zn,o=[s];for(let i=0;i<n.length;i++){let r=n[i].type.attrs;if(r){r.nodeName&&o.push(s=new zn(r.nodeName));for(let l in r){let a=r[l];a!=null&&(t&&o.length==1&&o.push(s=new zn(e.isInline?"span":"div")),l=="class"?s.class=(s.class?s.class+" ":"")+a:l=="style"?s.style=(s.style?s.style+";":"")+a:l!="nodeName"&&(s[l]=a))}}}return o}function Ea(n,e,t,s){if(t==Nt&&s==Nt)return e;let o=e;for(let i=0;i<s.length;i++){let r=s[i],l=t[i];if(i){let a;l&&l.nodeName==r.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==r.nodeName||(a=document.createElement(r.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=Nt[0]),o=a}kp(o,l||Nt[0],r)}return o}function kp(n,e,t){for(let s in e)s!="class"&&s!="style"&&s!="nodeName"&&!(s in t)&&n.removeAttribute(s);for(let s in t)s!="class"&&s!="style"&&s!="nodeName"&&t[s]!=e[s]&&n.setAttribute(s,t[s]);if(e.class!=t.class){let s=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<s.length;i++)o.indexOf(s[i])==-1&&n.classList.remove(s[i]);for(let i=0;i<o.length;i++)s.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let s=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=s.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function Oa(n,e,t){return Ea(n,n,Nt,ii(e,t,n.nodeType!=1))}function Ls(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Na(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Tp{constructor(e,t,s){this.lock=t,this.view=s,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Mp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let s=e;s<t;s++)this.top.children[s].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,s){let o=0,i=this.stack.length>>1,r=Math.min(i,e.length);for(;o<r&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=ye,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Ot.create(this.top,e[i],t,s);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,s,o){let i=-1,r;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,s))i=this.top.children.indexOf(r,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,s)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,s,o,i){let r=this.top.children[o];return r.dirty==Pe&&r.dom==r.contentDOM&&(r.dirty=Et),r.update(e,t,s,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let s=e.pmViewDesc;if(s){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==s)return o}return-1}e=t}}updateNextNode(e,t,s,o,i,r){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof et){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let d=a.dom,u,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Pe&&Ls(t,a.outerDeco));if(!h&&a.update(e,t,s,o))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(a,e,t,s,o,r)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Et,u.updateChildren(o,r+1),u.dirty=ye),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,s,o,i,r){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ls(s,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=et.create(this.top,t,s,o,i,r);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,s,o,i){let r=et.create(this.top,e,t,s,o,i);r.contentDOM&&r.updateChildren(o,i+1),this.top.children.splice(this.index++,0,r),this.changed=!0}placeWidget(e,t,s){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new ka(this.top,e,t,s);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ot;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof zs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ie||ne)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let s=document.createElement(e);e=="IMG"&&(s.className="ProseMirror-separator",s.alt=""),e=="BR"&&(s.className="ProseMirror-trailingBreak");let o=new Ma(this.top,[],s,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Mp(n,e){let t=e,s=t.children.length,o=n.childCount,i=new Map,r=[];e:for(;o>0;){let l;for(;;)if(s){let c=t.children[s-1];if(c instanceof Ot)t=c,s=c.children.length;else{l=c,s--;break}}else{if(t==e)break e;s=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,i.set(l,o),r.push(l)}}return{index:o,matched:i,matches:r.reverse()}}function Ap(n,e){return n.type.side-e.type.side}function Ep(n,e,t,s){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);s(d,o,e.forChild(i,d),c),i+=d.nodeSize}return}let r=0,l=[],a=null;for(let c=0;;){let d,u;for(;r<o.length&&o[r].to==i;){let g=o[r++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(Ap);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(d,c,!!a);let h,f;if(a)f=-1,h=a,a=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;r<o.length&&o[r].from<=i&&o[r].to>i;)l.push(o[r++]);let p=i+h.nodeSize;if(h.isText){let g=p;r<o.length&&o[r].from<g&&(g=o[r].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=h.cut(g-i),h=h.cut(0,g-i),p=g,f=-1)}else for(;r<o.length&&o[r].to<p;)r++;let m=h.isInline&&!h.isLeaf?l.filter(g=>!g.inline):l.slice();s(h,m,e.forChild(i,h),f),i=p}}function Op(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Np(n,e,t,s){for(let o=0,i=0;o<n.childCount&&i<=s;){let r=n.child(o++),l=i;if(i+=r.nodeSize,!r.isText)continue;let a=r.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=s&&a.slice(s-e.length-l,s-l)==e)return s-e.length;let c=l<s?a.lastIndexOf(e,s-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==s&&a.length>=s+e.length-l&&a.slice(s-l,s-l+e.length)==e)return s}}return-1}function ri(n,e,t,s,o){let i=[];for(let r=0,l=0;r<n.length;r++){let a=n[r],c=l,d=l+=a.size;c>=t||d<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,s)),o&&(i.push(o),o=void 0),d>t&&i.push(a.slice(t-c,a.size,s)))}return i}function li(n,e=null){let t=n.domSelectionRange(),s=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,r=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(r<0)return null;let l=s.resolve(r),a,c;if(Ds(t)){for(a=r;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&N.isSelectable(u)&&o.parent&&!(u.isInline&&np(t.focusNode,t.focusOffset,o.dom))){let h=o.posBefore;c=new N(r==h?l:s.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=r,h=r;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[a,r]=h==n.state.selection.anchor?[h,u]:[u,h],l=s.resolve(r)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=s.resolve(a);if(!c){let u=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=ci(n,d,l,u)}return c}function Pa(n){return n.editable?n.hasFocus():Ba(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function He(n,e=!1){let t=n.state.selection;if(za(n,t),!!Pa(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ne){let s=n.domSelectionRange(),o=n.domObserver.currentSelection;if(s.anchorNode&&o.anchorNode&&Mt(s.anchorNode,s.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Ip(n);else{let{anchor:s,head:o}=t,i,r;Ia&&!(t instanceof R)&&(t.$from.parent.inlineContent||(i=Ra(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(r=Ra(n,t.to))),n.docView.setSelection(s,o,n,e),Ia&&(i&&Da(i),r&&Da(r)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Pp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Ia=ie||ne&&ua<63;function Ra(n,e){let{node:t,offset:s}=n.docView.domFromPos(e,0),o=s<t.childNodes.length?t.childNodes[s]:null,i=s?t.childNodes[s-1]:null;if(ie&&o&&o.contentEditable=="false")return ai(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return ai(o);if(i)return ai(i)}}function ai(n){return n.contentEditable="true",ie&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Da(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Pp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),s=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=s||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Pa(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ip(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let s=n.cursorWrapper.dom,o=s.nodeName=="IMG";o?t.setStart(s.parentNode,Y(s)+1):t.setStart(s,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&de&&Xe<=11&&(s.disabled=!0,s.disabled=!1)}function za(n,e){if(e instanceof N){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(La(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else La(n)}function La(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ci(n,e,t,s){return n.someProp("createSelectionBetween",o=>o(n,e,t))||R.between(e,t,s)}function Va(n){return n.editable&&!n.hasFocus()?!1:Ba(n)}function Ba(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Rp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Mt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function di(n,e){let{$anchor:t,$head:s}=n.selection,o=e>0?t.max(s):t.min(s),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&I.findFrom(i,e)}function tt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ha(n,e,t){let s=n.state.selection;if(s instanceof R)if(t.indexOf("s")>-1){let{$head:o}=s,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let r=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return tt(n,new R(s.$anchor,r))}else if(s.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=di(n.state,e);return o&&o instanceof N?tt(n,o):!1}else if(!(ge&&t.indexOf("m")>-1)){let o=s.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,r;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(r=n.docView.descAt(l))&&!r.contentDOM?N.isSelectable(i)?tt(n,new N(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):In?tt(n,new R(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(s instanceof N&&s.node.isInline)return tt(n,new R(e>0?s.$to:s.$from));{let o=di(n.state,e);return o?tt(n,o):!1}}}function Vs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ln(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function an(n,e){return e<0?Dp(n):zp(n)}function Dp(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let o,i,r=!1;for(we&&t.nodeType==1&&s<Vs(t)&&Ln(t.childNodes[s],-1)&&(r=!0);;)if(s>0){if(t.nodeType!=1)break;{let l=t.childNodes[s-1];if(Ln(l,-1))o=t,i=--s;else if(l.nodeType==3)t=l,s=t.nodeValue.length;else break}}else{if($a(t))break;{let l=t.previousSibling;for(;l&&Ln(l,-1);)o=t.parentNode,i=Y(l),l=l.previousSibling;if(l)t=l,s=Vs(t);else{if(t=t.parentNode,t==n.dom)break;s=0}}}r?ui(n,t,s):o&&ui(n,o,i)}function zp(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let o=Vs(t),i,r;for(;;)if(s<o){if(t.nodeType!=1)break;let l=t.childNodes[s];if(Ln(l,1))i=t,r=++s;else break}else{if($a(t))break;{let l=t.nextSibling;for(;l&&Ln(l,1);)i=l.parentNode,r=Y(l)+1,l=l.nextSibling;if(l)t=l,s=0,o=Vs(t);else{if(t=t.parentNode,t==n.dom)break;s=o=0}}}i&&ui(n,i,r)}function $a(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Lp(n,e){for(;n&&e==n.childNodes.length&&!Pn(n);)e=Y(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Vp(n,e){for(;n&&!e&&!Pn(n);)e=Y(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function ui(n,e,t){if(e.nodeType!=3){let i,r;(r=Lp(e,t))?(e=r,t=0):(i=Vp(e,t))&&(e=i,t=i.nodeValue.length)}let s=n.domSelection();if(!s)return;if(Ds(s)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),s.removeAllRanges(),s.addRange(i)}else s.extend&&s.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&He(n)},50)}function Fa(n,e){let t=n.state.doc.resolve(e);if(!(ne||ip)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),r=(i.top+i.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),r=(i.top+i.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Wa(n,e,t){let s=n.state.selection;if(s instanceof R&&!s.empty||t.indexOf("s")>-1||ge&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=s;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let r=di(n.state,e);if(r&&r instanceof N)return tt(n,r)}if(!o.parent.inlineContent){let r=e<0?o:i,l=s instanceof fe?I.near(r,e):I.findFrom(r,e);return l?tt(n,l):!1}return!1}function _a(n,e){if(!(n.state.selection instanceof R))return!0;let{$head:t,$anchor:s,empty:o}=n.state.selection;if(!t.sameParent(s))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let r=n.state.tr;return e<0?r.delete(t.pos-i.nodeSize,t.pos):r.delete(t.pos,t.pos+i.nodeSize),n.dispatch(r),!0}return!1}function qa(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Bp(n){if(!ie||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let s=e.firstChild;qa(n,s,"true"),setTimeout(()=>qa(n,s,"false"),20)}return!1}function Hp(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function $p(n,e){let t=e.keyCode,s=Hp(e);if(t==8||ge&&t==72&&s=="c")return _a(n,-1)||an(n,-1);if(t==46&&!e.shiftKey||ge&&t==68&&s=="c")return _a(n,1)||an(n,1);if(t==13||t==27)return!0;if(t==37||ge&&t==66&&s=="c"){let o=t==37?Fa(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ha(n,o,s)||an(n,o)}else if(t==39||ge&&t==70&&s=="c"){let o=t==39?Fa(n,n.state.selection.from)=="ltr"?1:-1:1;return Ha(n,o,s)||an(n,o)}else{if(t==38||ge&&t==80&&s=="c")return Wa(n,-1,s)||an(n,-1);if(t==40||ge&&t==78&&s=="c")return Bp(n)||Wa(n,1,s)||an(n,1);if(s==(ge?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ga(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:s,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&s.childCount==1&&s.firstChild.childCount==1;){o--,i--;let f=s.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),s=f.content}let r=n.someProp("clipboardSerializer")||xt.fromSchema(n.state.schema),l=Qa(),a=l.createElement("div");a.appendChild(r.serializeFragment(s,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Ya[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=l.createElement(d[f]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
197
197
 
198
- `);return{dom:a,text:h,slice:e}}function Fa(n,e,t,s,o){let i=o.parent.type.spec.code,r,l;if(!t&&!e)return null;let a=e&&(s||i||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,i||s,n)}),i)return e?new M(x.from(n.state.schema.text(e.replace(/\r\n?/g,`
199
- `))),0,0):M.empty;let u=n.someProp("clipboardTextParser",h=>h(e,o,s,n));if(u)l=u;else{let h=o.marks(),{schema:f}=n.state,p=Ct.fromSchema(f);r=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=r.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),r=Rp(t),Pn&&Dp(r);let c=r&&r.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=r.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;r=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Ut.fromSchema(n.state.schema)).parseSlice(r,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Np.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=zp(Ga(l,+d[1],+d[2]),d[4]);else if(l=M.maxOpen(Pp(l.content,o),!0),l.openStart||l.openEnd){let u=0,h=0;for(let f=l.content.firstChild;u<l.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=l.content.lastChild;h<l.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);l=Ga(l,u,h)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const Np=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Pp(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,r=[];if(n.forEach(l=>{if(!r)return;let a=o.findWrapping(l.type),c;if(!a)return r=null;if(c=r.length&&i.length&&_a(a,i,l,r[r.length-1],0))r[r.length-1]=c;else{r.length&&(r[r.length-1]=qa(r[r.length-1],i.length));let d=Wa(l,a);r.push(d),o=o.matchType(d.type),i=a}}),r)return x.from(r)}return n}function Wa(n,e,t=0){for(let s=e.length-1;s>=t;s--)n=e[s].create(null,x.from(n));return n}function _a(n,e,t,s,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=_a(n,e,t,s.lastChild,o+1);if(i)return s.copy(s.content.replaceChild(s.childCount-1,i));if(s.contentMatchAt(s.childCount).matchType(o==n.length-1?t.type:n[o+1]))return s.copy(s.content.append(x.from(Wa(t,n,o+1))))}}function qa(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,qa(n.lastChild,e-1)),s=n.contentMatchAt(n.childCount).fillBefore(x.empty,!0);return n.copy(t.append(s))}function di(n,e,t,s,o,i){let r=e<0?n.firstChild:n.lastChild,l=r.content;return n.childCount>1&&(i=0),o<s-1&&(l=di(l,e,t,s,o+1,i)),o>=t&&(l=e<0?r.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(r.contentMatchAt(r.childCount).fillBefore(x.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,r.copy(l))}function Ga(n,e,t){return e<n.openStart&&(n=new M(di(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(di(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ja={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ka=null;function Ja(){return Ka||(Ka=document.implementation.createHTMLDocument("title"))}let ui=null;function Ip(n){let e=window.trustedTypes;return e?(ui||(ui=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ui.createHTML(n)):n}function Rp(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ja().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(n),o;if((o=s&&ja[s[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Ip(n),o)for(let i=0;i<o.length;i++)t=t.querySelector(o[i])||t;return t}function Dp(n){let e=n.querySelectorAll(ee?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let s=e[t];s.childNodes.length==1&&s.textContent==" "&&s.parentNode&&s.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),s)}}function zp(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,s;try{s=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:r}=n;for(let l=s.length-2;l>=0;l-=2){let a=t.nodes[s[l]];if(!a||a.hasRequiredAttrs())break;o=x.from(a.create(s[l+1],o)),i++,r++}return new M(o,i,r)}const re={},le={},Vp={touchstart:!0,touchmove:!0};class Lp{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Bp(n){for(let e in re){let t=re[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=s=>{$p(n,s)&&!fi(n,s)&&(n.editable||!(s.type in le))&&t(n,s)},Vp[e]?{passive:!0}:void 0)}ie&&n.dom.addEventListener("input",()=>null),hi(n)}function nt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Hp(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function hi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=s=>fi(n,s))})}function fi(n,e){return n.someProp("handleDOMEvents",t=>{let s=t[e.type];return s?s(n,e)||e.defaultPrevented:!1})}function $p(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Fp(n,e){!fi(n,e)&&re[e.type]&&(n.editable||!(e.type in le))&&re[e.type](n,e)}le.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Za(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ce&&ee&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),on&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let s=Date.now();n.input.lastIOSEnter=s,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==s&&(n.someProp("handleKeyDown",o=>o(n,Mt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",s=>s(n,t))||Op(n,t)?t.preventDefault():nt(n,"key")},le.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},le.keypress=(n,e)=>{let t=e;if(Za(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ge&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let s=n.state.selection;if(!(s instanceof R)||!s.$from.sameParent(s.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,s.$from.pos,s.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function Ls(n){return{left:n.clientX,top:n.clientY}}function Wp(n,e){let t=e.x-n.clientX,s=e.y-n.clientY;return t*t+s*s<100}function pi(n,e,t,s,o){if(s==-1)return!1;let i=n.state.doc.resolve(s);for(let r=i.depth+1;r>0;r--)if(n.someProp(e,l=>r>i.depth?l(n,t,i.nodeAfter,i.before(r),o,!0):l(n,t,i.node(r),i.before(r),o,!1)))return!0;return!1}function an(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let s=n.state.tr.setSelection(e);s.setMeta("pointer",!0),n.dispatch(s)}function _p(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),s=t.nodeAfter;return s&&s.isAtom&&N.isSelectable(s)?(an(n,new N(t)),!0):!1}function qp(n,e){if(e==-1)return!1;let t=n.state.selection,s,o;t instanceof N&&(s=t.node);let i=n.state.doc.resolve(e);for(let r=i.depth+1;r>0;r--){let l=r>i.depth?i.nodeAfter:i.node(r);if(N.isSelectable(l)){s&&t.$from.depth>0&&r>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(r);break}}return o!=null?(an(n,N.create(n.state.doc,o)),!0):!1}function Gp(n,e,t,s,o){return pi(n,"handleClickOn",e,t,s)||n.someProp("handleClick",i=>i(n,e,s))||(o?qp(n,t):_p(n,t))}function jp(n,e,t,s){return pi(n,"handleDoubleClickOn",e,t,s)||n.someProp("handleDoubleClick",o=>o(n,e,s))}function Kp(n,e,t,s){return pi(n,"handleTripleClickOn",e,t,s)||n.someProp("handleTripleClick",o=>o(n,e,s))||Jp(n,t,s)}function Jp(n,e,t){if(t.button!=0)return!1;let s=n.state.doc;if(e==-1)return s.inlineContent?(an(n,R.create(s,0,s.content.size)),!0):!1;let o=s.resolve(e);for(let i=o.depth+1;i>0;i--){let r=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(r.inlineContent)an(n,R.create(s,l+1,l+1+r.content.size));else if(N.isSelectable(r))an(n,N.create(s,l));else continue;return!0}}function mi(n){return Bs(n)}const Ua=ge?"metaKey":"ctrlKey";re.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let s=mi(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&Wp(t,n.input.lastClick)&&!t[Ua]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let r=n.posAtCoords(Ls(t));r&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Up(n,r,t,!!s)):(i=="doubleClick"?jp:Kp)(n,r.pos,r.inside,t)?t.preventDefault():nt(n,"pointer"))};class Up{constructor(e,t,s,o){this.view=e,this.pos=t,this.event=s,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[Ua],this.allowDefault=s.shiftKey;let i,r;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),r=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,r=d.depth?d.before():0}const l=o?null:s.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(s.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof N&&c.from<=r&&c.to>r)&&(this.mightDrag={node:i,pos:r,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Se&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),nt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>He(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ls(e))),this.updateAllowDefault(e),this.allowDefault||!t?nt(this.view,"pointer"):Gp(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ie&&this.mightDrag&&!this.mightDrag.node.isAtom||ee&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(an(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):nt(this.view,"pointer")}move(e){this.updateAllowDefault(e),nt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}re.touchstart=n=>{n.input.lastTouch=Date.now(),mi(n),nt(n,"pointer")},re.touchmove=n=>{n.input.lastTouch=Date.now(),nt(n,"pointer")},re.contextmenu=n=>mi(n);function Za(n,e){return n.composing?!0:ie&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Zp=Ce?5e3:-1;le.compositionstart=le.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof R&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Bs(n,!0),n.markCursor=null;else if(Bs(n,!e.selection.empty),Se&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let s=n.domSelectionRange();for(let o=s.focusNode,i=s.focusOffset;o&&o.nodeType==1&&i!=0;){let r=i<0?o.lastChild:o.childNodes[i-1];if(!r)break;if(r.nodeType==3){let l=n.domSelection();l&&l.collapse(r,r.nodeValue.length);break}else o=r,i=-1}}n.input.composing=!0}Ya(n,Zp)},le.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ya(n,20))};function Ya(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Bs(n),e))}function Xa(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Xp());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Yp(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=_f(e.focusNode,e.focusOffset),s=qf(e.focusNode,e.focusOffset);if(t&&s&&t!=s){let o=s.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||s==i)return i;if(!o||!o.isText(s.nodeValue))return s;if(n.input.compositionNode==s){let r=t.pmViewDesc;if(!(!r||!r.isText(t.nodeValue)))return s}}return t||s}function Xp(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Bs(n,e=!1){if(!(Ce&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Xa(n),e||n.docView&&n.docView.dirty){let t=ii(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Qp(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),s.removeAllRanges(),s.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Vn=de&&Xe<15||on&&Uf<604;re.copy=le.cut=(n,e)=>{let t=e,s=n.state.selection,o=t.type=="cut";if(s.empty)return;let i=Vn?null:t.clipboardData,r=s.content(),{dom:l,text:a}=$a(n,r);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Qp(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function em(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function tm(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,s=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),s.parentNode&&s.parentNode.removeChild(s),t?Ln(n,s.value,null,o,e):Ln(n,s.textContent,s.innerHTML,o,e)},50)}function Ln(n,e,t,s,o){let i=Fa(n,e,t,s,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||M.empty)))return!0;if(!i)return!1;let r=em(i),l=r?n.state.tr.replaceSelectionWith(r,s):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qa(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}le.paste=(n,e)=>{let t=e;if(n.composing&&!Ce)return;let s=Vn?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;s&&Ln(n,Qa(s),s.getData("text/html"),o,t)?t.preventDefault():tm(n,t)};class ec{constructor(e,t,s){this.slice=e,this.move=t,this.node=s}}const tc=ge?"altKey":"ctrlKey";re.dragstart=(n,e)=>{let t=e,s=n.input.mouseDown;if(s&&s.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Ls(t)),r;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof N?o.to-1:o.to))){if(s&&s.mightDrag)r=N.create(n.state.doc,s.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(r=N.create(n.state.doc,u.posBefore))}}let l=(r||n.state.selection).content(),{dom:a,text:c,slice:d}=$a(n,l);(!t.dataTransfer.files.length||!ee||ra>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Vn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Vn||t.dataTransfer.setData("text/plain",c),n.dragging=new ec(d,!t[tc],r)},re.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},le.dragover=le.dragenter=(n,e)=>e.preventDefault(),le.drop=(n,e)=>{let t=e,s=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(Ls(t));if(!o)return;let i=n.state.doc.resolve(o.pos),r=s&&s.slice;r?n.someProp("transformPasted",p=>{r=p(r,n)}):r=Fa(n,Qa(t.dataTransfer),Vn?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(s&&!t[tc]);if(n.someProp("handleDrop",p=>p(n,t,r||M.empty,l))){t.preventDefault();return}if(!r)return;t.preventDefault();let a=r?Uh(n.state.doc,i.pos,r):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=s;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,r.content.firstChild):c.replaceRange(d,d,r),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&N.isSelectable(r.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(r.content.firstChild))c.setSelection(new N(f));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,C)=>p=C),c.setSelection(li(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},re.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&He(n)},20))},re.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},re.beforeinput=(n,e)=>{if(ee&&Ce&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:s}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=s||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Mt(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in le)re[n]=le[n];function Bn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Hs{constructor(e,t){this.toDOM=e,this.spec=t||Nt,this.side=this.spec.side||0}map(e,t,s,o){let{pos:i,deleted:r}=e.mapResult(t.from+o,this.side<0?-1:1);return r?null:new ue(i-s,i-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Hs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Bn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class st{constructor(e,t){this.attrs=e,this.spec=t||Nt}map(e,t,s,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-s,r=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-s;return i>=r?null:new ue(i,r,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof st&&Bn(this.attrs,e.attrs)&&Bn(this.spec,e.spec)}static is(e){return e.type instanceof st}destroy(){}}class gi{constructor(e,t){this.attrs=e,this.spec=t||Nt}map(e,t,s,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let r=e.mapResult(t.to+o,-1);return r.deleted||r.pos<=i.pos?null:new ue(i.pos-s,r.pos-s,this)}valid(e,t){let{index:s,offset:o}=e.content.findIndex(t.from),i;return o==t.from&&!(i=e.child(s)).isText&&o+i.nodeSize==t.to}eq(e){return this==e||e instanceof gi&&Bn(this.attrs,e.attrs)&&Bn(this.spec,e.spec)}destroy(){}}class ue{constructor(e,t,s){this.from=e,this.to=t,this.type=s}copy(e,t){return new ue(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,s){return this.type.map(e,this,t,s)}static widget(e,t,s){return new ue(e,e,new Hs(t,s))}static inline(e,t,s,o){return new ue(e,t,new st(s,o))}static node(e,t,s,o){return new ue(e,t,new gi(s,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof st}get widget(){return this.type instanceof Hs}}const cn=[],Nt={};class ${constructor(e,t){this.local=e.length?e:cn,this.children=t.length?t:cn}static create(e,t){return t.length?$s(t,e,0,Nt):te}find(e,t,s){let o=[];return this.findInner(e??0,t??1e9,o,0,s),o}findInner(e,t,s,o,i){for(let r=0;r<this.local.length;r++){let l=this.local[r];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&s.push(l.copy(l.from+o,l.to+o))}for(let r=0;r<this.children.length;r+=3)if(this.children[r]<t&&this.children[r+1]>e){let l=this.children[r]+1;this.children[r+2].findInner(e-l,t-l,s,o+l,i)}}map(e,t,s){return this==te||e.maps.length==0?this:this.mapInner(e,t,0,0,s||Nt)}mapInner(e,t,s,o,i){let r;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,s,o);a&&a.type.valid(t,a)?(r||(r=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?nm(this.children,r||[],e,t,s,o,i):r?new $(r.sort(Pt),cn):te}add(e,t){return t.length?this==te?$.create(e,t):this.addInner(e,t,0):this}addInner(e,t,s){let o,i=0;e.forEach((l,a)=>{let c=a+s,d;if(d=sc(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,d,c+1):o.splice(i,0,a,a+l.nodeSize,$s(d,l,c+1,Nt)),i+=3}});let r=nc(i?oc(t):t,-s);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||r.splice(l--,1);return new $(r.length?this.local.concat(r).sort(Pt):this.local,o||this.children)}remove(e){return e.length==0||this==te?this:this.removeInner(e,0)}removeInner(e,t){let s=this.children,o=this.local;for(let i=0;i<s.length;i+=3){let r,l=s[i]+t,a=s[i+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(r||(r=[])).push(u));if(!r)continue;s==this.children&&(s=this.children.slice());let c=s[i+2].removeInner(r,l+1);c!=te?s[i+2]=c:(s.splice(i,3),i-=3)}if(o.length){for(let i=0,r;i<e.length;i++)if(r=e[i])for(let l=0;l<o.length;l++)o[l].eq(r,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return s==this.children&&o==this.local?this:o.length||s.length?new $(o,s):te}forChild(e,t){if(this==te)return this;if(t.isLeaf)return $.empty;let s,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(s=this.children[l+2]);break}let i=e+1,r=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<r&&a.to>i&&a.type instanceof st){let c=Math.max(i,a.from)-i,d=Math.min(r,a.to)-i;c<d&&(o||(o=[])).push(a.copy(c,d))}}if(o){let l=new $(o.sort(Pt),cn);return s?new ot([l,s]):l}return s||te}eq(e){if(this==e)return!0;if(!(e instanceof $)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return yi(this.localsInner(e))}localsInner(e){if(this==te)return cn;if(e.inlineContent||!this.local.some(st.is))return this.local;let t=[];for(let s=0;s<this.local.length;s++)this.local[s].type instanceof st||t.push(this.local[s]);return t}forEachSet(e){e(this)}}$.empty=new $([],[]),$.removeOverlap=yi;const te=$.empty;class ot{constructor(e){this.members=e}map(e,t){const s=this.members.map(o=>o.map(e,t,Nt));return ot.from(s)}forChild(e,t){if(t.isLeaf)return $.empty;let s=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=te&&(i instanceof ot?s=s.concat(i.members):s.push(i))}return ot.from(s)}eq(e){if(!(e instanceof ot)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,s=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{s&&(t=t.slice(),s=!1);for(let r=0;r<i.length;r++)t.push(i[r])}}return t?yi(s?t:t.sort(Pt)):cn}static from(e){switch(e.length){case 0:return te;case 1:return e[0];default:return new ot(e.every(t=>t instanceof $)?e:e.reduce((t,s)=>t.concat(s instanceof $?s:s.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function nm(n,e,t,s,o,i,r){let l=n.slice();for(let c=0,d=i;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||h>C+d-u)continue;let y=l[b]+d-u;f>=y?l[b+1]=h<=y?-2:-1:h>=d&&g&&(l[b]+=g,l[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=t.map(n[c]+i),u=d-o;if(u<0||u>=s.content.size){a=!0;continue}let h=t.map(n[c+1]+i,-1),f=h-o,{index:p,offset:m}=s.content.findIndex(u),g=s.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=l[c+2].mapInner(t,g,d+1,n[c]+i+1,r);b!=te?(l[c]=u,l[c+1]=f,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=sm(l,n,e,t,o,i,r),d=$s(c,s,0,r);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<l.length&&l[h]<f;)h+=3;l.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new $(e.sort(Pt),l)}function nc(n,e){if(!e||!n.length)return n;let t=[];for(let s=0;s<n.length;s++){let o=n[s];t.push(new ue(o.from+e,o.to+e,o.type))}return t}function sm(n,e,t,s,o,i,r){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(s,o,c);u?t.push(u):r.onRemove&&r.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function sc(n,e,t){if(e.isLeaf)return null;let s=t+e.nodeSize,o=null;for(let i=0,r;i<n.length;i++)(r=n[i])&&r.from>t&&r.to<s&&((o||(o=[])).push(r),n[i]=null);return o}function oc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function $s(n,e,t,s){let o=[],i=!1;e.forEach((l,a)=>{let c=sc(n,l,a+t);if(c){i=!0;let d=$s(c,l,t+a+1,s);d!=te&&o.push(a,a+l.nodeSize,d)}});let r=nc(i?oc(n):n,-t).sort(Pt);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||(s.onRemove&&s.onRemove(r[l].spec),r.splice(l--,1));return r.length||o.length?new $(r,o):te}function Pt(n,e){return n.from-e.from||n.to-e.to}function yi(n){let e=n;for(let t=0;t<e.length-1;t++){let s=e[t];if(s.from!=s.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==s.from){i.to!=s.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,s.to),ic(e,o+1,i.copy(s.to,i.to)));continue}else{i.from<s.to&&(e==n&&(e=n.slice()),e[t]=s.copy(s.from,i.from),ic(e,o,s.copy(i.from,s.to)));break}}}return e}function ic(n,e,t){for(;e<n.length&&Pt(t,n[e])>0;)e++;n.splice(e,0,t)}function bi(n){let e=[];return n.someProp("decorations",t=>{let s=t(n.state);s&&s!=te&&e.push(s)}),n.cursorWrapper&&e.push($.create(n.state.doc,[n.cursorWrapper.deco])),ot.from(e)}const om={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},im=de&&Xe<=11;class rm{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class lm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rm,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let o=0;o<s.length;o++)this.queue.push(s[o]);de&&Xe<=11&&s.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),im&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,om)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ia(this.view)){if(this.suppressingSelectionUpdates)return He(this.view);if(de&&Xe<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,s;for(let i=e.focusNode;i;i=On(i))t.add(i);for(let i=e.anchorNode;i;i=On(i))if(t.has(i)){s=i;break}let o=s&&this.view.docView.nearestDesc(s);if(o&&o.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let s=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&Ia(e)&&!this.ignoreSelectionChange(s),i=-1,r=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],a);u&&(i=i<0?u.from:Math.min(u.from,i),r=r<0?u.to:Math.max(u.to,r),u.typeOver&&(l=!0))}if(Se&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||dm(e,u)!=f)&&h.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Rs(s)&&(c=ii(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,He(e),this.currentSelection.set(s),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,r),am(e)),this.handleDOMChange(i,r,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||He(e),this.currentSelection.set(s))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return{from:s.posBefore,to:s.posAfter};let o=e.previousSibling,i=e.nextSibling;if(de&&Xe<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(o=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let r=o&&o.parentNode==e.target?Y(o)+1:0,l=s.localPosFromDOM(e.target,r,-1),a=i&&i.parentNode==e.target?Y(i):e.target.childNodes.length,c=s.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}:(this.lastChangedTextNode=e.target,{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let rc=new WeakMap,lc=!1;function am(n){if(!rc.has(n)&&(rc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Se,lc)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),lc=!0}}function ac(n,e){let t=e.startContainer,s=e.startOffset,o=e.endContainer,i=e.endOffset,r=n.domAtPos(n.state.selection.anchor);return Tt(r.node,r.offset,o,i)&&([t,s,o,i]=[o,i,t,s]),{anchorNode:t,anchorOffset:s,focusNode:o,focusOffset:i}}function cm(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return ac(n,o)}let t;function s(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",s,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",s,!0),t?ac(n,t):null}function dm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let s=n.docView.nearestDesc(t,!0);if(s&&s.node.isBlock)return t}return null}function um(n,e,t){let{node:s,fromOffset:o,toOffset:i,from:r,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Rs(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ee&&n.input.lastKeyCode===8)for(let g=i;g>o;g--){let b=s.childNodes[g-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=g;break}if(!C||C.size)break}let u=n.state.doc,h=n.someProp("domParser")||Ut.fromSchema(n.state.schema),f=u.resolve(r),p=null,m=h.parse(s,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:hm,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+r,head:b+r}}return{doc:m,sel:p,from:r,to:l}}function hm(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ie&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ie&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const fm=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function pm(n,e,t,s,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=ii(n,T);if(A&&!n.state.selection.eq(A)){if(ee&&Ce&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,Mt(13,"Enter"))))return;let P=n.state.tr.setSelection(A);T=="pointer"?P.setMeta("pointer",!0):T=="key"&&P.scrollIntoView(),i&&P.setMeta("composition",i),n.dispatch(P)}return}let r=n.state.doc.resolve(e),l=r.sharedDepth(t);e=r.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=um(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=ym(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(on&&n.input.lastIOSEnter>Date.now()-225||Ce)&&o.some(T=>T.nodeType==1&&!fm.test(T.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",T=>T(n,Mt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(s&&a instanceof R&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=cc(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let A=n.state.tr.setSelection(T);i&&A.setMeta("composition",i),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof R&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),de&&Xe<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,y;if((on&&n.input.lastIOSEnter>Date.now()-225&&(!C||o.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(y=I.findFrom(c.doc.resolve(m.pos+1),1,!0))&&y.head==g.pos)&&n.someProp("handleKeyDown",T=>T(n,Mt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&gm(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,Mt(8,"Backspace")))){Ce&&ee&&n.domObserver.suppressSelectionUpdates();return}ee&&Ce&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),Ce&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,Mt(13,"Enter"))})},20));let v=p.start,w=p.endA,S,k,E;if(C){if(m.pos==g.pos)de&&Xe<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>He(n),20)),S=n.state.tr.delete(v,w),k=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(E=mm(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))S=n.state.tr,E.type=="add"?S.addMark(v,w,E.mark):S.removeMark(v,w,E.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",A=>A(n,v,w,T)))return;S=n.state.tr.insertText(T,v,w)}}if(S||(S=n.state.tr.replace(v,w,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let T=cc(n,S.doc,c.sel);T&&!(ee&&Ce&&n.composing&&T.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==v||T.head==S.mapping.map(w)-1)||de&&T.empty&&T.head==v)&&S.setSelection(T)}k&&S.ensureMarks(k),i&&S.setMeta("composition",i),n.dispatch(S.scrollIntoView())}function cc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:li(n,e.resolve(t.anchor),e.resolve(t.head))}function mm(n,e){let t=n.firstChild.marks,s=e.firstChild.marks,o=t,i=s,r,l,a;for(let d=0;d<s.length;d++)o=s[d].removeFromSet(o);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],r="add",a=d=>d.mark(l.addToSet(d.marks));else if(o.length==0&&i.length==1)l=i[0],r="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(x.from(c).eq(n))return{mark:l,type:r}}function gm(n,e,t,s,o){if(t-e<=o.pos-s.pos||vi(s,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!s.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let r=n.resolve(vi(i,!0,!0));return!r.parent.isTextblock||r.pos>t||vi(r,!0,!1)<t?!1:s.parent.content.cut(s.parentOffset).eq(r.parent.content)}function vi(n,e,t){let s=n.depth,o=e?n.end():n.pos;for(;s>0&&(e||n.indexAfter(s)==n.node(s).childCount);)s--,o++,e=!1;if(t){let i=n.node(s).maybeChild(n.indexAfter(s));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function ym(n,e,t,s,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:r,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(r,l));s-=r+a-i}if(r<i&&n.size<e.size){let a=s<=i&&s>=r?i-s:0;i-=a,i&&i<e.size&&dc(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-r),r=i}else if(l<i){let a=s<=i&&s>=l?i-s:0;i-=a,i&&i<n.size&&dc(n.textBetween(i-1,i+1))&&(i+=a?1:-1),r=i+(r-l),l=i}return{start:i,endA:r,endB:l}}function dc(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class bm{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Lp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(mc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=fc(this),hc(this),this.nodeViews=pc(this),this.docView=wa(this.state.doc,uc(this),bi(this),this.dom,this),this.domObserver=new lm(this,(s,o,i,r)=>pm(this,s,o,i,r)),this.domObserver.start(),Bp(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&hi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(mc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let s in this._props)t[s]=this._props[s];t.state=this.state;for(let s in e)t[s]=e[s];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var s;let o=this.state,i=!1,r=!1;e.storedMarks&&this.composing&&(Xa(this),r=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=pc(this);wm(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&hi(this),this.editable=fc(this),hc(this);let a=bi(this),c=uc(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(r=!0);let h=d=="preserve"&&r&&this.dom.style.overflowAnchor==null&&Xf(this);if(r){this.domObserver.stop();let f=u&&(de||ee)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&vm(o.selection,e.selection);if(u){let p=ee?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Yp(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=wa(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Cp(this))?He(this,f):(Na(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((s=this.dragging)===null||s===void 0)&&s.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Qf(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof N){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&la(this,t.getBoundingClientRect(),e)}else la(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let s=this.directPlugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let s=this.state.plugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let s=this.pluginViews[t];s.update&&s.update(this,e)}}updateDraggedNode(e,t){let s=e.node,o=-1;if(this.state.doc.nodeAt(s.from)==s.node)o=s.from;else{let i=s.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==s.node&&(o=i)}this.dragging=new ec(e.slice,e.move,o<0?void 0:N.create(this.state.doc,o))}someProp(e,t){let s=this._props&&this._props[e],o;if(s!=null&&(o=t?t(s):s))return o;for(let r=0;r<this.directPlugins.length;r++){let l=this.directPlugins[r].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let l=i[r].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){if(de){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ep(this.dom),He(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ip(this,e)}coordsAtPos(e,t=1){return fa(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,s=-1){let o=this.docView.posFromDOM(e,t,s);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return dp(this,t||this.state,e)}pasteHTML(e,t){return Ln(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ln(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Hp(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ff())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Fp(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?ie&&this.root.nodeType===11&&jf(this.dom.ownerDocument)==this.dom&&cm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function uc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let s in t)s=="class"?e.class+=" "+t[s]:s=="style"?e.style=(e.style?e.style+";":"")+t[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(t[s]))}),e.translate||(e.translate="no"),[ue.node(0,n.state.doc.content.size,e)]}function hc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ue.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function fc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function vm(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function pc(n){let e=Object.create(null);function t(s){for(let o in s)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=s[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function wm(n,e){let t=0,s=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)s++;return t!=s}function mc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var wi,Si;if(typeof WeakMap<"u"){let n=new WeakMap;wi=e=>n.get(e),Si=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;wi=s=>{for(let o=0;o<n.length;o+=2)if(n[o]==s)return n[o+1]},Si=(s,o)=>(t==10&&(t=0),n[t++]=s,n[t++]=o)}var q=class{constructor(n,e,t,s){this.width=n,this.height=e,this.map=t,this.problems=s}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const s=e%this.width,o=e/this.width|0;let i=s+1,r=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;r<this.height&&this.map[e+this.width*l]==t;l++)r++;return{left:s,top:o,right:i,bottom:r}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:s,right:o,top:i,bottom:r}=this.findCell(n);return e=="horiz"?(t<0?s==0:o==this.width)?null:this.map[i*this.width+(t<0?s-1:o)]:(t<0?i==0:r==this.height)?null:this.map[s+this.width*(t<0?i-1:r)]}rectBetween(n,e){const{left:t,right:s,top:o,bottom:i}=this.findCell(n),{left:r,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,r),top:Math.min(o,a),right:Math.max(s,l),bottom:Math.max(i,c)}}cellsInRect(n){const e=[],t={};for(let s=n.top;s<n.bottom;s++)for(let o=n.left;o<n.right;o++){const i=s*this.width+o,r=this.map[i];t[r]||(t[r]=!0,!(o==n.left&&o&&this.map[i-1]==r||s==n.top&&s&&this.map[i-this.width]==r)&&e.push(r))}return e}positionAt(n,e,t){for(let s=0,o=0;;s++){const i=o+t.child(s).nodeSize;if(s==n){let r=e+n*this.width;const l=(n+1)*this.width;for(;r<l&&this.map[r]<o;)r++;return r==l?i-1:this.map[r]}o=i}}static get(n){return wi(n)||Si(n,Sm(n))}};function Sm(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Cm(n),t=n.childCount,s=[];let o=0,i=null;const r=[];for(let c=0,d=e*t;c<d;c++)s[c]=0;for(let c=0,d=0;c<t;c++){const u=n.child(c);d++;for(let p=0;;p++){for(;o<s.length&&s[o]!=0;)o++;if(p==u.childCount)break;const m=u.child(p),{colspan:g,rowspan:b,colwidth:C}=m.attrs;for(let y=0;y<b;y++){if(y+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-y});break}const v=o+y*e;for(let w=0;w<g;w++){s[v+w]==0?s[v+w]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:g-w});const S=C&&C[w];if(S){const k=(v+w)%e*2,E=r[k];E==null||E!=S&&r[k+1]==1?(r[k]=S,r[k+1]=1):E==S&&r[k+1]++}}}o+=g,d+=m.nodeSize}const h=(c+1)*e;let f=0;for(;o<h;)s[o++]==0&&f++;f&&(i||(i=[])).push({type:"missing",row:c,n:f}),d++}const l=new q(e,t,s,i);let a=!1;for(let c=0;!a&&c<r.length;c+=2)r[c]!=null&&r[c+1]<t&&(a=!0);return a&&xm(l,r,n),l}function Cm(n){let e=-1,t=!1;for(let s=0;s<n.childCount;s++){const o=n.child(s);let i=0;if(t)for(let r=0;r<s;r++){const l=n.child(r);for(let a=0;a<l.childCount;a++){const c=l.child(a);r+c.attrs.rowspan>s&&(i+=c.attrs.colspan)}}for(let r=0;r<o.childCount;r++){const l=o.child(r);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function xm(n,e,t){n.problems||(n.problems=[]);const s={};for(let o=0;o<n.map.length;o++){const i=n.map[o];if(s[i])continue;s[i]=!0;const r=t.nodeAt(i);if(!r)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=r.attrs;for(let c=0;c<a.colspan;c++){const d=(o+c)%n.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=km(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function km(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function gc(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),s=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(r=>Number(r)):null,o=Number(n.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:s&&s.length==o?s:null};for(const r in e){const l=e[r].getFromDOM,a=l&&l(n);a!=null&&(i[r]=a)}return i}function yc(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const s in e){const o=e[s].setDOMAttr;o&&o(n.attrs[s],t)}return t}function Tm(n){const e=n.cellAttributes||{},t={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const s in e)t[s]={default:e[s].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:s=>gc(s,e)}],toDOM(s){return["td",yc(s,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:s=>gc(s,e)}],toDOM(s){return["th",yc(s,e),0]}}}}function Ie(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const s=n.nodes[t],o=s.spec.tableRole;o&&(e[o]=s)}}return e}var it=new An("selectingCells");function Hn(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Fs(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ci(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Hn(e.$head)||Mm(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Mm(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function xi(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Am(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ki(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function bc(n,e,t){const s=n.node(-1),o=q.get(s),i=n.start(-1),r=o.nextCell(n.pos-i,e,t);return r==null?null:n.node(0).resolve(i+r)}function dn(n,e,t=1){const s={...n,colspan:n.colspan-t};return s.colwidth&&(s.colwidth=s.colwidth.slice(),s.colwidth.splice(e,t),s.colwidth.some(o=>o>0)||(s.colwidth=null)),s}var K=class _e extends I{constructor(e,t=e){const s=e.node(-1),o=q.get(s),i=e.start(-1),r=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(r).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const c=a.map(d=>{const u=s.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const h=i+d+1;return new Nl(l.resolve(h),l.resolve(h+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const s=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(xi(s)&&xi(o)&&ki(s,o)){const i=this.$anchorCell.node(-1)!=s.node(-1);return i&&this.isRowSelection()?_e.rowSelection(s,o):i&&this.isColSelection()?_e.colSelection(s,o):new _e(s,o)}return R.between(s,o)}content(){const e=this.$anchorCell.node(-1),t=q.get(e),s=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s),i={},r=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let d=a*t.width+o.left,u=o.left;u<o.right;u++,d++){const h=t.map[d];if(i[h])continue;i[h]=!0;const f=t.findCell(h);let p=e.nodeAt(h);if(!p)throw RangeError(`No cell with offset ${h} found`);const m=o.left-f.left,g=f.right-o.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=dn(b,0,m)),g>0&&(b=dn(b,b.colspan-g,g)),f.left<o.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<o.top||f.bottom>o.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,o.bottom)-Math.max(f.top,o.top)};f.top<o.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}r.push(e.child(a).copy(x.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:r;return new M(x.from(l),1,1)}replace(e,t=M.empty){const s=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){const{$from:l,$to:a}=o[r],c=e.mapping.slice(s);e.replace(c.map(l.pos),c.map(a.pos),r?M.empty:t)}const i=I.findFrom(e.doc.resolve(e.mapping.slice(s).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new M(x.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),s=q.get(t),o=this.$anchorCell.start(-1),i=s.cellsInRect(s.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let r=0;r<i.length;r++)e(t.nodeAt(i[r]),o+i[r])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const s=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(s,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const s=e.node(-1),o=q.get(s),i=e.start(-1),r=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return r.top<=l.top?(r.top>0&&(e=a.resolve(i+o.map[r.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),r.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+r.right-1]))),new _e(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=q.get(e),s=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-s),i=t.colCount(this.$headCell.pos-s);if(Math.min(o,i)>0)return!1;const r=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(r,l)==t.width}eq(e){return e instanceof _e&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const s=e.node(-1),o=q.get(s),i=e.start(-1),r=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return r.left<=l.left?(r.left>0&&(e=a.resolve(i+o.map[r.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),r.right<o.width&&(e=a.resolve(i+o.map[o.width*(r.top+1)-1]))),new _e(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new _e(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,s=t){return new _e(e.resolve(t),e.resolve(s))}getBookmark(){return new Em(this.$anchorCell.pos,this.$headCell.pos)}};K.prototype.visible=!1,I.jsonID("cell",K);var Em=class Jc{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Jc(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),s=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&s.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&s.index()<s.parent.childCount&&ki(t,s)?new K(t,s):I.near(s,1)}};function Om(n){if(!(n.selection instanceof K))return null;const e=[];return n.selection.forEachCell((t,s)=>{e.push(ue.node(s,s+t.nodeSize,{class:"selectedCell"}))}),$.create(n.doc,e)}function Nm({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,s=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,s--);return t==s&&/row|table/.test(n.node(o).type.spec.tableRole)}function Pm({$from:n,$to:e}){let t,s;for(let o=n.depth;o>0;o--){const i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){s=i;break}}return t!==s&&e.parentOffset===0}function Im(n,e,t){const s=(e||n).selection,o=(e||n).doc;let i,r;if(s instanceof N&&(r=s.node.type.spec.tableRole)){if(r=="cell"||r=="header_cell")i=K.create(o,s.from);else if(r=="row"){const l=o.resolve(s.from+1);i=K.rowSelection(l,l)}else if(!t){const l=q.get(s.node),a=s.from+1,c=a+l.map[l.width*l.height-1];i=K.create(o,a+1,c)}}else s instanceof R&&Nm(s)?i=R.create(o,s.from):s instanceof R&&Pm(s)&&(i=R.create(o,s.$from.start(),s.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var Rm=new An("fix-tables");function vc(n,e,t,s){const o=n.childCount,i=e.childCount;e:for(let r=0,l=0;r<i;r++){const a=e.child(r);for(let c=l,d=Math.min(o,r+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}s(a,t),l<o&&n.child(l).sameMarkup(a)?vc(n.child(l),a,t+1,s):a.nodesBetween(0,a.content.size,s,t+1),t+=a.nodeSize}}function Dm(n,e){let t;const s=(o,i)=>{o.type.spec.tableRole=="table"&&(t=zm(n,o,i,t))};return e?e.doc!=n.doc&&vc(e.doc,n.doc,0,s):n.doc.descendants(s),t}function zm(n,e,t,s){const o=q.get(e);if(!o.problems)return s;s||(s=n.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let h=0;h<u.rowspan;h++)i[c.row+h]+=c.n;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,dn(u,u.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}}let r,l;for(let a=0;a<i.length;a++)i[a]&&(r==null&&(r=a),l=a);for(let a=0,c=t+1;a<o.height;a++){const d=e.child(a),u=c+d.nodeSize,h=i[a];if(h>0){let f="cell";d.firstChild&&(f=d.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Ie(n.schema)[f].createAndFill();b&&p.push(b)}const m=(a==0||r==a-1)&&l==a?c+1:u-1;s.insert(s.mapping.map(m),p)}c=u}return s.setMeta(Rm,{fixTables:!0})}function wc(n){const e=n.selection,t=Ci(n),s=t.node(-1),o=t.start(-1),i=q.get(s);return{...e instanceof K?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:s}}function Vm(n){return function(e,t){if(!Fs(e))return!1;if(t){const s=Ie(e.schema),o=wc(e),i=e.tr,r=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=r.map(a=>o.table.nodeAt(a));for(let a=0;a<r.length;a++)l[a].type==s.header_cell&&i.setNodeMarkup(o.tableStart+r[a],s.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<r.length;a++)i.setNodeMarkup(o.tableStart+r[a],s.header_cell,l[a].attrs);t(i)}return!0}}function Sc(n,e,t){const s=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<s.length;o++){const i=e.table.nodeAt(s[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function Ti(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Vm(n):function(t,s){if(!Fs(t))return!1;if(s){const o=Ie(t.schema),i=wc(t),r=t.tr,l=Sc("row",i,o),a=Sc("column",i,o),d=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:i.map.height}:n=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,h=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{const p=f+i.tableStart,m=r.doc.nodeAt(p);m&&r.setNodeMarkup(p,h,m.attrs)}),s(r)}return!0}}Ti("row",{useDeprecatedLogic:!0}),Ti("column",{useDeprecatedLogic:!0}),Ti("cell",{useDeprecatedLogic:!0});function Lm(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let s=n.index(-1)-1,o=n.before();s>=0;s--){const i=n.node(-1).child(s),r=i.lastChild;if(r)return o-1-r.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let s=n.indexAfter(-1),o=n.after();s<t.childCount;s++){const i=t.child(s);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function Cc(n){return function(e,t){if(!Fs(e))return!1;const s=Lm(Ci(e),n);if(s==null)return!1;if(t){const o=e.doc.resolve(s);t(e.tr.setSelection(R.between(o,Am(o))).scrollIntoView())}return!0}}function Ws(n,e){const t=n.selection;if(!(t instanceof K))return!1;if(e){const s=n.tr,o=Ie(n.schema).cell.createAndFill().content;t.forEachCell((i,r)=>{i.content.eq(o)||s.replace(s.mapping.map(r+1),s.mapping.map(r+i.nodeSize-1),new M(o,0,0))}),s.docChanged&&e(s)}return!0}function Bm(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:s}=n;for(;e.childCount==1&&(t>0&&s>0||e.child(0).type.spec.tableRole=="table");)t--,s--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,r=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,t-1),u=a<e.childCount-1?0:Math.max(0,s-1);(d||u)&&(c=Mi(Ie(r).row,new M(c,d,u)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||s?Mi(Ie(r).row,new M(e,t,s)).content:e);else return null;return Hm(r,l)}function Hm(n,e){const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(let r=i.childCount-1;r>=0;r--){const{rowspan:l,colspan:a}=i.child(r).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let s=0;for(let o=0;o<t.length;o++)s=Math.max(s,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(x.empty),t[o]<s){const i=Ie(n).cell.createAndFill(),r=[];for(let l=t[o];l<s;l++)r.push(i);e[o]=e[o].append(x.from(r))}return{height:e.length,width:s,rows:e}}function Mi(n,e){const t=n.createAndFill();return new Ol(t).replace(0,t.content.size,e).doc}function $m({width:n,height:e,rows:t},s,o){if(n!=s){const i=[],r=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=i[l]||0,u=0;d<s;u++){let h=a.child(u%a.childCount);d+h.attrs.colspan>s&&(h=h.type.createChecked(dn(h.attrs,h.attrs.colspan,d+h.attrs.colspan-s),h.content)),c.push(h),d+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)i[l+f]=(i[l+f]||0)+h.attrs.colspan}r.push(x.from(c))}t=r,n=s}if(e!=o){const i=[];for(let r=0,l=0;r<o;r++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);r+u.attrs.rowspan>o&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,o-u.attrs.rowspan)},u.content)),a.push(u)}i.push(x.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function Fm(n,e,t,s,o,i,r){const l=n.doc.type.schema,a=Ie(l);let c,d;if(o>e.width)for(let u=0,h=0;u<e.height;u++){const f=t.child(u);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=e.width;g<o;g++)p.push(m);n.insert(n.mapping.slice(r).map(h-1+s),p)}if(i>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,x.from(u)),f=[];for(let p=e.height;p<i;p++)f.push(h);n.insert(n.mapping.slice(r).map(s+t.nodeSize-2),f)}return!!(c||d)}function xc(n,e,t,s,o,i,r,l){if(r==0||r==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const d=r*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){a=!0;const h=t.nodeAt(u),{top:f,left:p}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+s),null,{...h.attrs,rowspan:r-f}),n.insert(n.mapping.slice(l).map(e.positionAt(r,p,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-r})),c+=h.attrs.colspan-1}}return a}function kc(n,e,t,s,o,i,r,l){if(r==0||r==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const d=c*e.width+r,u=e.map[d];if(e.map[d-1]==u){a=!0;const h=t.nodeAt(u),f=e.colCount(u),p=n.mapping.slice(l).map(u+s);n.setNodeMarkup(p,null,dn(h.attrs,r-f,h.attrs.colspan-(r-f))),n.insert(p+h.nodeSize,h.type.createAndFill(dn(h.attrs,0,r-f))),c+=h.attrs.rowspan-1}}return a}function Tc(n,e,t,s,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let r=q.get(i);const{top:l,left:a}=s,c=a+o.width,d=l+o.height,u=n.tr;let h=0;function f(){if(i=t?u.doc.nodeAt(t-1):u.doc,!i)throw new Error("No table found");r=q.get(i),h=u.mapping.maps.length}Fm(u,r,i,t,c,d,h)&&f(),xc(u,r,i,t,a,c,l,h)&&f(),xc(u,r,i,t,a,c,d,h)&&f(),kc(u,r,i,t,l,d,a,h)&&f(),kc(u,r,i,t,l,d,c,h)&&f();for(let p=l;p<d;p++){const m=r.positionAt(p,a,i),g=r.positionAt(p,c,i);u.replace(u.mapping.slice(h).map(m+t),u.mapping.slice(h).map(g+t),new M(o.rows[p-l],0,0))}f(),u.setSelection(new K(u.doc.resolve(t+r.positionAt(l,a,i)),u.doc.resolve(t+r.positionAt(d-1,c-1,i)))),e(u)}var Wm=ta({ArrowLeft:qs("horiz",-1),ArrowRight:qs("horiz",1),ArrowUp:qs("vert",-1),ArrowDown:qs("vert",1),"Shift-ArrowLeft":Gs("horiz",-1),"Shift-ArrowRight":Gs("horiz",1),"Shift-ArrowUp":Gs("vert",-1),"Shift-ArrowDown":Gs("vert",1),Backspace:Ws,"Mod-Backspace":Ws,Delete:Ws,"Mod-Delete":Ws});function _s(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function qs(n,e){return(t,s,o)=>{if(!o)return!1;const i=t.selection;if(i instanceof K)return _s(t,s,I.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const r=Mc(o,n,e);if(r==null)return!1;if(n=="horiz")return _s(t,s,I.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(r),a=bc(l,n,e);let c;return a?c=I.near(a,1):e<0?c=I.near(t.doc.resolve(l.before(-1)),-1):c=I.near(t.doc.resolve(l.after(-1)),1),_s(t,s,c)}}}function Gs(n,e){return(t,s,o)=>{if(!o)return!1;const i=t.selection;let r;if(i instanceof K)r=i;else{const a=Mc(o,n,e);if(a==null)return!1;r=new K(t.doc.resolve(a))}const l=bc(r.$headCell,n,e);return l?_s(t,s,new K(r.$anchorCell,l)):!1}}function _m(n,e){const t=n.state.doc,s=Hn(t.resolve(e));return s?(n.dispatch(n.state.tr.setSelection(new K(s))),!0):!1}function qm(n,e,t){if(!Fs(n.state))return!1;let s=Bm(t);const o=n.state.selection;if(o instanceof K){s||(s={width:1,height:1,rows:[x.from(Mi(Ie(n.state.schema).cell,t))]});const i=o.$anchorCell.node(-1),r=o.$anchorCell.start(-1),l=q.get(i).rectBetween(o.$anchorCell.pos-r,o.$headCell.pos-r);return s=$m(s,l.right-l.left,l.bottom-l.top),Tc(n.state,n.dispatch,r,l,s),!0}else if(s){const i=Ci(n.state),r=i.start(-1);return Tc(n.state,n.dispatch,r,q.get(i.node(-1)).findCell(i.pos-r),s),!0}else return!1}function Gm(n,e){var t;if(e.ctrlKey||e.metaKey)return;const s=Ac(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof K)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&s&&(o=Hn(n.state.selection.$anchor))!=null&&((t=Ai(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!s)return;function i(a,c){let d=Ai(n,c);const u=it.getState(n.state)==null;if(!d||!ki(a,d))if(u)d=a;else return;const h=new K(a,d);if(u||!n.state.selection.eq(h)){const f=n.state.tr.setSelection(h);u&&f.setMeta(it,a.pos),n.dispatch(f)}}function r(){n.root.removeEventListener("mouseup",r),n.root.removeEventListener("dragstart",r),n.root.removeEventListener("mousemove",l),it.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(it,-1))}function l(a){const c=a,d=it.getState(n.state);let u;if(d!=null)u=n.state.doc.resolve(d);else if(Ac(n,c.target)!=s&&(u=Ai(n,e),!u))return r();u&&i(u,c)}n.root.addEventListener("mouseup",r),n.root.addEventListener("dragstart",r),n.root.addEventListener("mousemove",l)}function Mc(n,e,t){if(!(n.state.selection instanceof R))return null;const{$head:s}=n.state.selection;for(let o=s.depth-1;o>=0;o--){const i=s.node(o);if((t<0?s.index(o):s.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=s.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Ac(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ai(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Hn(n.state.doc.resolve(t.pos)):null}var jm=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ei(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ei(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ei(n,e,t,s,o,i){var r;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let u=0,h=0;u<d.childCount;u++){const{colspan:f,colwidth:p}=d.child(u).attrs;for(let m=0;m<f;m++,h++){const g=o==h?i:p&&p[m],b=g?g+"px":"";if(l+=g||s,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=b,e.appendChild(C)}}}for(;c;){const u=c.nextSibling;(r=c.parentNode)==null||r.removeChild(c),c=u}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var pe=new An("tableColumnResizing");function Km({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:s=jm,lastColumnResizable:o=!0}={}){const i=new Mn({key:pe,state:{init(r,l){var a,c;const d=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,u=Ie(l.schema).table.name;return s&&d&&(d[u]=(h,f)=>new s(h,t,f)),new Jm(-1,!1)},apply(r,l){return l.apply(r)}},props:{attributes:r=>{const l=pe.getState(r);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(r,l)=>{Um(r,l,n,o)},mouseleave:r=>{Zm(r)},mousedown:(r,l)=>{Ym(r,l,e,t)}},decorations:r=>{const l=pe.getState(r);if(l&&l.activeHandle>-1)return ng(r,l.activeHandle)},nodeViews:{}}});return i}var Jm=class Zs{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,s=e.getMeta(pe);if(s&&s.setHandle!=null)return new Zs(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Zs(t.activeHandle,s.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return xi(e.doc.resolve(o))||(o=-1),new Zs(o,t.dragging)}return t}};function Um(n,e,t,s){const o=pe.getState(n.state);if(o&&!o.dragging){const i=Qm(e.target);let r=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?r=Ec(n,e,"left",t):a-e.clientX<=t&&(r=Ec(n,e,"right",t))}if(r!=o.activeHandle){if(!s&&r!==-1){const l=n.state.doc.resolve(r),a=l.node(-1),c=q.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Nc(n,r)}}}function Zm(n){const e=pe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Nc(n,-1)}function Ym(n,e,t,s){var o;const i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,r=pe.getState(n.state);if(!r||r.activeHandle==-1||r.dragging)return!1;const l=n.state.doc.nodeAt(r.activeHandle),a=Xm(n,r.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(pe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const h=pe.getState(n.state);h!=null&&h.dragging&&(eg(n,h.activeHandle,Oc(h.dragging,u,t)),n.dispatch(n.state.tr.setMeta(pe,{setDragging:null})))}function d(u){if(!u.which)return c(u);const h=pe.getState(n.state);if(h&&h.dragging){const f=Oc(h.dragging,u,t);Pc(n,h.activeHandle,f,s)}}return Pc(n,r.activeHandle,a,s),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function Xm(n,e,{colspan:t,colwidth:s}){const o=s&&s[s.length-1];if(o)return o;const i=n.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=t;if(s)for(let c=0;c<t;c++)s[c]&&(l-=s[c],a--);return l/a}function Qm(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ec(n,e,t,s){const o=t=="right"?-s:s,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:r}=i,l=Hn(n.state.doc.resolve(r));if(!l)return-1;if(t=="right")return l.pos;const a=q.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function Oc(n,e,t){const s=e.clientX-n.startX;return Math.max(t,n.startWidth+s)}function Nc(n,e){n.dispatch(n.state.tr.setMeta(pe,{setHandle:e}))}function eg(n,e,t){const s=n.state.doc.resolve(e),o=s.node(-1),i=q.get(o),r=s.start(-1),l=i.colCount(s.pos-r)+s.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){const d=c*i.width+l;if(c&&i.map[d]==i.map[d-i.width])continue;const u=i.map[d],h=o.nodeAt(u).attrs,f=h.colspan==1?0:l-i.colCount(u);if(h.colwidth&&h.colwidth[f]==t)continue;const p=h.colwidth?h.colwidth.slice():tg(h.colspan);p[f]=t,a.setNodeMarkup(r+u,null,{...h,colwidth:p})}a.docChanged&&n.dispatch(a)}function Pc(n,e,t,s){const o=n.state.doc.resolve(e),i=o.node(-1),r=o.start(-1),l=q.get(i).colCount(o.pos-r)+o.nodeAfter.attrs.colspan-1;let a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ei(i,a.firstChild,a,s,l,t)}function tg(n){return Array(n).fill(0)}function ng(n,e){var t;const s=[],o=n.doc.resolve(e),i=o.node(-1);if(!i)return $.empty;const r=q.get(i),l=o.start(-1),a=r.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<r.height;c++){const d=a+c*r.width;if((a==r.width-1||r.map[d]!=r.map[d+1])&&(c==0||r.map[d]!=r.map[d-r.width])){const u=r.map[d],h=l+u+i.nodeAt(u).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=pe.getState(n))!=null&&t.dragging&&s.push(ue.node(l+u,l+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),s.push(ue.widget(h,f))}}return $.create(n.doc,s)}function sg({allowTableNodeSelection:n=!1}={}){return new Mn({key:it,state:{init(){return null},apply(e,t){const s=e.getMeta(it);if(s!=null)return s==-1?null:s;if(t==null||!e.docChanged)return t;const{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:Om,handleDOMEvents:{mousedown:Gm},createSelectionBetween(e){return it.getState(e.state)!=null?e.state.selection:null},handleTripleClick:_m,handleKeyDown:Wm,handlePaste:qm},appendTransaction(e,t,s){return Im(s,Dm(s,t),n)}})}const $n=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},Ic="data-gs-mrk-fs",Rc="data-gs-ib",js="data-gs-ifrg",$e="attrs",Dc={[$e]:{default:"{}"}},Fe={[$e]:{default:{}}},zc=n=>({[$e]:JSON.stringify($n(n))}),We=n=>({attrs:$n(n)}),Fn=n=>e=>[n,e.attrs.attrs,0],rt=n=>n.attrs[$e]?JSON.parse(n.attrs[$e]):{},og={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${js}]`,getAttrs:We}],toDOM:()=>["span",{[js]:""},0]},div:{group:"block",content:"inline*",attrs:Fe,parseDOM:[{tag:"div",getAttrs:We}],toDOM:Fn("div")},paragraph:{group:"block",content:"inline*",attrs:Fe,parseDOM:[{tag:"p",getAttrs:We}],toDOM:Fn("p")},orderedList:{group:"block",content:"listItem+",attrs:Fe,parseDOM:[{tag:"ol",getAttrs:We}],toDOM:Fn("ol")},bulletList:{group:"block",content:"listItem+",attrs:Fe,parseDOM:[{tag:"ul",getAttrs:We}],toDOM:Fn("ul")},listItem:{content:"block*",group:"block",attrs:Fe,parseDOM:[{tag:"li",getAttrs:We}],toDOM:Fn("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Fe,parseDOM:[{tag:"pre",getAttrs:We}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Fe,parseDOM:[{tag:"img[src]",getAttrs:We}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${Rc}]`}],toDOM(){return["br",{[Rc]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:Fe,parseDOM:[{tag:"br",getAttrs:We}],toDOM:n=>["br",{...n.attrs.attrs}]},heading:{group:"block",content:"inline*",attrs:{level:{default:1},attrs:{default:{}}},defining:!0,parseDOM:Array.from({length:6},(n,e)=>({tag:`h${e+1}`,getAttrs:t=>({level:e+1,attrs:$n(t)})})),toDOM({attrs:n}){const{level:e}=n;return[e?`h${e}`:"div",n.attrs,0]}},...Tm({tableGroup:"block",cellContent:"block+",cellAttributes:{[$e]:{default:Fe[$e].default,getFromDOM:$n,setDOMAttr:(n,e)=>{n&&Object.assign(e,n)}},background:{default:null,getFromDOM(n){return n.style.backgroundColor||null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`background-color: ${n};`)}}}}),nonTextNode:{group:"block",content:"block*",attrs:{tagName:{default:"span"},attrs:{default:{}}},parseDOM:[{tag:"*:not(tbody)",getAttrs:n=>({tagName:n.tagName.toLowerCase(),attrs:$n(n)}),priority:0}],toDOM(n){const{tagName:e,attrs:t}=n.attrs;return[e,t,0]}}},Wn=(n,e)=>({attrs:Dc,parseDOM:n.map(t=>({tag:t,getAttrs:zc})),toDOM:e}),ig={strong:Wn(["strong","b"],n=>["b",rt(n)]),link:Wn(["a"],n=>["a",rt(n),0]),em:Wn(["em","i"],n=>["em",rt(n)]),underline:Wn(["u"],n=>["u",rt(n),0]),strikethrough:Wn(["s"],n=>["s",rt(n),0]),font_size:{attrs:{...Dc,size:{default:null}},parseDOM:[{tag:`span[${Ic}]`,getAttrs:n=>({...zc(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...rt(n),[Ic]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}}},Vc=new kh({nodes:og,marks:ig}),Ks=new WeakMap,Oi=new WeakMap,rg=(n,e)=>{Ks.set(n,e),Oi.set(e,n)},lg=(n,e)=>{Ks.delete(n),Oi.delete(e)},Ni=n=>Ks.get(n),ag=n=>Oi.get(n),Lc=n=>{var t;const e=ag(n);return(t=e==null?void 0:e.__gjsv)==null?void 0:t.model},cg=n=>n.dispatchEvent(new CustomEvent("input"));function dg(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(js)){if(t.getAttribute("style")){t.removeAttribute(js);return}const s=t.parentElement;if(s){for(;t.firstChild;)s.insertBefore(t.firstChild,t);s.removeChild(t)}}else Array.from(t.children).forEach(s=>e(s))};e(n)}function ug(n,e={}){if(!e.enableOnClick)return()=>{};const t=n.Components.events,s=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),i=d=>d.isChildOf("text"),r=d=>n.getEditing()===d,l=(d,u={})=>{d.trigger("focus",u.event)},a=(d,u)=>{s(d)&&o(d)&&!r(d)&&l(d,u)},c=(d,u)=>{if(s(d)&&!o(d)&&i(d)){const h=d.parents().find(f=>f.isInstanceOf("text"));h&&(l(h,u),setTimeout(()=>n.select(h),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const hg=(n,e)=>{const t=fg(n);return t&&Cg(t)?pg(n,e):t?ql(()=>({type:n.schema.nodes.div}))(n,e):!1};function fg(n){const e=n.selection.$from;if(e.node(e.depth).type===n.schema.nodes.inlineFragment){const t=e.depth-1;return e.node(t)}return e.node(e.depth)}function pg(n,e){const{selection:t,schema:s,tr:o}=n;o.split(t.from,1);const i=t.from+1,r=o.doc.nodeAt(i),l={...r.attrs.attrs,id:void 0},a=r.textContent.length>0,c=r.textContent.length||0,d=r.textContent||" ",u=s.text(d),h=s.nodes.div.create(l,a?u:[],[]);return o.replaceRangeWith(i,i+c+2,h),o.setSelection(R.create(o.doc,i+1)),e==null||e(o.scrollIntoView()),!0}function mg(n,e,t){const{state:s,dispatch:o}=n,{selection:i,tr:r}=s,l=(a,c,d)=>{const u={};return a.split(";").forEach(h=>{const[f,p]=h.split(":").map(m=>m.trim());f&&(u[f]=p)}),u[c]=d,Object.entries(u).map(([h,f])=>`${h}: ${f}`).join("; ")};if(!i.empty||t)r.doc.nodesBetween(i.from,i.to,(a,c)=>{var d,u;if(a.type===s.schema.nodes.image){const h=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);r.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:h}})}else if(a.type.isBlock){const h=l(((u=a.attrs.attrs)==null?void 0:u.style)||"","text-align",e);Bc(a)?r.setBlockType(i.from,void 0,s.schema.nodes.div,{attrs:{style:h}}):r.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:h}})}});else{const a=s.doc.resolve(i.from),c=a.start(a.depth),d=s.doc.nodeAt(c);if(d!=null&&d.type.isBlock){const u=l(d.attrs.style||"","text-align",e);r.setNodeMarkup(c,void 0,{...d.attrs,style:u})}}r.docChanged&&o(r.scrollIntoView())}const _n=(n,e)=>{const{from:t,to:s}=n.selection;let o=!1;return n.doc.nodesBetween(t,s,i=>{if(o)return!1;i.marks.some(r=>r.type===e)&&(o=!0)}),o};function gg(n,e,t="_blank"){const{state:s,dispatch:o}=n,{schema:i,selection:r,tr:l}=s,a=i.marks.link;try{const c=a.create({[$e]:JSON.stringify({href:e,target:t})});l.addMark(r.from,r.to,c),o(l.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function yg(n,e){const{state:t,dispatch:s}=n,{selection:o,tr:i}=t;if(o.empty)return;const r=t.schema.marks.font_size;if(!r){console.error("Font size mark is not defined in the schema.");return}i.addMark(o.from,o.to,r.create({size:e})),s(i.scrollIntoView())}const It=(n,e)=>{const{doc:t,selection:s}=n.state,o=t.resolve(s.from);for(let i=o.depth;i>0;i--){const r=o.node(i);if(e(r))return{pos:i>0?o.before(i):0,start:o.start(i),depth:i,node:r}}},bg=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,s])=>(t=t.replace(/-./g,o=>o.toUpperCase()[1]).trim(),e[t]=`${s}`.trim(),e),{});function vg(...n){return(e,t)=>{const s=r=>{e=e.apply(r),t==null||t(r)},o=n.pop();return n.reduce((r,l)=>r||l(e,s),!1)&&o!==void 0&&o(e,t)}}const wg=(n,e)=>{const{state:t,dispatch:s}=n;if(e!=null&&e.event){const{event:o}=e,i=n.posAtCoords({left:o.clientX,top:o.clientY});i!=null&&i.pos&&s(t.tr.setSelection(R.create(t.doc,i.pos)))}else Gl(t,s);setTimeout(()=>setTimeout(()=>n.focus()))},Pi=n=>n.isBlock,Bc=n=>n.type.name==="inlineFragment",Sg=n=>Pi(n)&&!Bc(n),Hc=n=>n.type.name==="bulletList",$c=n=>n.type.name==="orderedList",Cg=n=>n.type.name==="heading",xg=n=>Hc(n)||$c(n),Fc=(n,e)=>{var i,r;const t=(i=It(n,l=>l.type===e))==null?void 0:i.node,s=n.state.schema.nodes.listItem;let o;return t?o=Zo(s):(r=It(n,xg))!=null&&r.node?o=vg(Zo(s),na(e)):o=na(e),o(n.state,n.dispatch)},Wc=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(s=>s.type.name===e)},kg=n=>{var r;const{view:e,prop:t,editor:s,propCSS:o}=n,i=(r=It(e,Sg))==null?void 0:r.node;if(i){const l=i.attrs.attrs||{},a=bg(l.style);if(t in a)return a[t]||"";if(l.id){const c=s.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[o]||""}}return""},Tg=n=>{const{view:e,prop:t,markName:s,editor:o,propCSS:i}=n,r=Wc(e,s);if(r){const l=r.attrs;if(l[t])return l[t];if(l[$e]){const a=rt(r).id;if(a){const c=o.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[i]||""}}}return""},_c=(n,e)=>{const{dispatch:t}=n,{nodes:s,marks:o}=n.state.schema;return{text:{selected:()=>{const{selection:i,doc:r}=n.state;return r.textBetween(i.from,i.to," ")},replace:(i,r={})=>{const{state:l}=n,{from:a}=l.selection;let c=l.tr.replaceSelectionWith(l.schema.text(i));r.select&&(c=c.setSelection(R.create(c.doc,a,a+i.length))),t==null||t(c)}},bold:{toggle:()=>xt(o.strong)(n.state,t),isActive:()=>_n(n.state,o.strong)},italic:{toggle:()=>xt(o.em)(n.state,t),isActive:()=>_n(n.state,o.em)},underline:{toggle:()=>xt(o.underline)(n.state,t),isActive:()=>_n(n.state,o.underline)},strikethrough:{toggle:()=>xt(o.strikethrough)(n.state,t),isActive:()=>_n(n.state,o.strikethrough)},link:{get:()=>{const i=Lc(n);if(i!=null&&i.is("link"))return i.getAttributes();{const r=Wc(n,"link");return r?rt(r):{}}},toggle:()=>xt(o.link)(n.state,t),isActive:()=>_n(n.state,o.link),create:i=>{const r=Lc(n);r!=null&&r.is("link")?(r.addAttributes({href:i.url,target:i.target}),n.focus()):gg(n,i.url,i.target)}},alignText:{get:()=>kg({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:i=>mg(n,i.value,!0)},fontSize:{get:()=>Tg({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:i=>yg(n,i.value)},image:{open(){const i="assetLayout",{state:r,dispatch:l}=n,{selection:a,doc:c}=r,d=c.textBetween(a.from,a.to," "),u={id:i,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:h=>{const f={alt:d,src:h.asset.getSrc()};l(r.tr.replaceSelectionWith(s.image.createAndFill({attrs:f})))}}};e.runCommand(G.layoutToggle,u)}},heading:{get:()=>{var r;const i=(r=It(n,Pi))==null?void 0:r.node;return`${(i==null?void 0:i.attrs.level)||""}`},set:({value:i})=>{var a;const{state:r}=n,l=(a=It(n,Pi))==null?void 0:a.node;bf(r.schema.nodes.heading,{attrs:l==null?void 0:l.attrs.attrs,level:i?parseInt(i,10):0})(r,t)}},listBullet:{isActive:()=>{var i;return!!((i=It(n,Hc))!=null&&i.node)},toggle:()=>Fc(n,s.bulletList)},listOrdered:{isActive:()=>{var i;return!!((i=It(n,$c))!=null&&i.node)},toggle:()=>Fc(n,s.orderedList)}}},xe="rte:selectionchange",be={bold:'<svg viewBox="0 0 24 24"><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',italic:'<svg viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',underline:'<svg viewBox="0 0 24 24"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z" /></svg>',strikethrough:'<svg viewBox="0 0 24 24"><path d="M7.2 9.8c-1.2-2.3.5-5 2.9-5.5 3.1-1 7.6.4 7.5 4.2h-3l-.1-.8c-.2-.6-.6-.9-1.2-1.1-.8-.3-2.1-.2-2.8.3C9 8.2 10.4 9.5 12 10H7.4l-.2-.2M21 13v-2H3v2h9.6l.6.2c.6.3 1.1.5 1.3 1.1.1.4.2.9 0 1.3-.2.5-.6.7-1.1.9-1.8.5-4-.2-3.9-2.4h-3c-.1 2.6 2.1 4.4 4.5 4.7 3.8.8 8.3-1.6 6.3-5.9l3.7.1Z"/></svg>',link:'<svg viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',image:'<svg viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z"></path></svg>',listBullet:'<svg viewBox="0 0 24 24"><path d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6 1.5 1.5 0 0 1 4 7.5 1.5 1.5 0 0 1 2.5 6 1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12 1.5 1.5 0 0 1 4 13.5 1.5 1.5 0 0 1 2.5 12 1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18 1.5 1.5 0 0 1 4 19.5 1.5 1.5 0 0 1 2.5 18 1.5 1.5 0 0 1 4 16.5Z"/></svg>',listOrdered:'<svg viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.3-7a.8.8 0 0 1 .7.8c0 .1 0 .3-.2.5L3 13h2v1H2v-1l2-2H2v-1h2.3Z"/></svg>',alignTextLeft:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H15V9H3V7M3,11H21V13H3V11M3,15H15V17H3V15M3,19H21V21H3V19Z" /></svg>',alignTextCenter:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M7,7H17V9H7V7M3,11H21V13H3V11M7,15H17V17H7V15M3,19H21V21H3V19Z" /></svg>',alignTextRight:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M9,7H21V9H9V7M3,11H21V13H3V11M9,15H21V17H9V15M3,19H21V21H3V19Z" /></svg>',alignTextJustify:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H21V9H3V7M3,11H21V13H3V11M3,15H21V17H3V15M3,19H21V21H3V19Z" /></svg>'},Mg=(n,e)=>{var a;const{editor:t,el:s}=n,o=Ks.get(s),i=_c(o,t),r={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:be.bold,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.bold.isActive()})}},onClick:({setState:c})=>{i.bold.toggle(),c({active:i.bold.isActive()})}},italic:{id:"italic",icon:be.italic,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.italic.isActive()})}},onClick:({setState:c})=>{i.italic.toggle(),c({active:i.italic.isActive()})}},underline:{id:"underline",icon:be.underline,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.underline.isActive()})}},onClick:({setState:c})=>{i.underline.toggle(),c({active:i.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:be.strikethrough,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.strikethrough.isActive()})}},onClick:({setState:c})=>{i.strikethrough.toggle(),c({active:i.strikethrough.isActive()})}},image:{id:"image",icon:be.image,size:"s",type:"button",onClick:()=>i.image.open()},link:{id:"link",icon:be.link,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.link.isActive(),disabled:o.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,{x:u,y:h,width:f,height:p}=d.getBoundingClientRect(),m="linkLayout",g=()=>t.runCommand(G.layoutRemove,{id:m}),b=i.link.get(),C={id:m,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:u,y:h,w:f,h:p},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);i.link.create({url:v.get("url"),target:v.get("target")}),g()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(b==null?void 0:b.href)||"",onChange:({value:y,setState:v})=>v({value:y})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(b==null?void 0:b.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:y,setState:v})=>v({value:y})},{type:"row",style:{gap:10,justifyContent:"end"},children:[i.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{i.link.toggle(),g()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(G.layoutToggle,C)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:be.alignTextLeft},{id:"center",icon:be.alignTextCenter},{id:"right",icon:be.alignTextRight},{id:"justify",icon:be.alignTextJustify}],editorEvents:{[xe]:({setState:c})=>{c({value:i.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:be.listBullet,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.listBullet.isActive()})}},onClick:({setState:c})=>{i.listBullet.toggle(),c({active:i.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:be.listOrdered,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.listOrdered.isActive()})}},onClick:({setState:c})=>{i.listOrdered.toggle(),c({active:i.listOrdered.isActive()})}},heading:{id:"heading",type:"selectField",size:"s",value:"",emptyState:"Heading",options:[{id:"",label:"Normal"},{id:"1",label:"Heading 1"},{id:"2",label:"Heading 2"},{id:"3",label:"Heading 3"},{id:"4",label:"Heading 4"},{id:"5",label:"Heading 5"},{id:"6",label:"Heading 6"}],editorEvents:{[xe]:({setState:c})=>{c({value:i.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.heading.set({value:c}),o.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"Font size",options:[{id:"8pt",label:"8pt"},{id:"10pt",label:"10pt"},{id:"12pt",label:"12pt"},{id:"14pt",label:"14pt"},{id:"18pt",label:"18pt"},{id:"24pt",label:"24pt"},{id:"36pt",label:"36pt"}],editorEvents:{[xe]:({setState:c})=>{c({value:i.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.fontSize.set({value:c}),o.focus()}}},l=[r.bold,r.italic,r.underline,r.strikethrough,r.image,r.link,r.listBullet,r.listOrdered,r.alignText,r.heading,r.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:i,layouts:r,proseMirror:{view:o},items:l}))||l};class Ag{constructor(e,t,s){this.editor=s,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(o=>{this.dom.setAttribute(o,e.attrs.attrs[o])}),this.dom.addEventListener("dblclick",o=>this.handleDoubleClick(o))}handleDoubleClick(e){const{editor:t,view:s}=this;_c(s,t).image.open(),e.preventDefault()}update(e){return e.type!==this.node.type?!1:(this.node=e,Object.keys(e.attrs.attrs).forEach(t=>{this.dom.setAttribute(t,e.attrs.attrs[t])}),!0)}selectNode(){this.dom.style.outline="2px solid #ffca6f"}deselectNode(){this.dom.style.outline=""}}class lt{constructor(e,t,s={}){this.match=e,this.match=e,this.handler=typeof t=="string"?Eg(t):t,this.undoable=s.undoable!==!1,this.inCode=s.inCode||!1}}function Eg(n){return function(e,t,s,o){let i=n;if(t[1]){let r=t[0].lastIndexOf(t[1]);i+=t[0].slice(r+t[1].length),s+=r;let l=s-o;l>0&&(i=t[0].slice(r-l,r)+i,s=o)}return e.tr.insertText(i,s,o)}}const Og=500;function Ng({rules:n}){let e=new Mn({state:{init(){return null},apply(t,s){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:s)}},props:{handleTextInput(t,s,o,i){return qc(t,s,o,i,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:s}=t.state.selection;s&&qc(t,s.pos,s.pos,"",n,e)})}}},isInputRules:!0});return e}function qc(n,e,t,s,o,i){if(n.composing)return!1;let r=n.state,l=r.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-Og),l.parentOffset,null,"")+s;for(let c=0;c<o.length;c++){let d=o[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let u=d.match.exec(a),h=u&&d.handler(r,u,e-(u[0].length-s.length),t);if(h)return d.undoable&&h.setMeta(i,{transform:h,from:e,to:t,text:s}),n.dispatch(h),!0}return!1}const Pg=new lt(/--$/,"—"),Ig=new lt(/\.\.\.$/,"…"),Rg=new lt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Dg=new lt(/"$/,"”"),zg=new lt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Vg=new lt(/'$/,"’"),Lg=[Rg,Dg,zg,Vg];function Ii(n,e,t=null,s){return new lt(n,(o,i,r,l)=>{let a=t instanceof Function?t(i):t,c=o.tr.delete(r,l),d=c.doc.resolve(r),u=d.blockRange(),h=u&&Sl(u,e,a);if(!h)return null;c.wrap(u,h);let f=c.doc.resolve(r-1).nodeBefore;return f&&f.type==e&&As(c.doc,r-1)&&(!s||s(i,f))&&c.join(r-1),c})}function Gc(n,e,t=null){return new lt(n,(s,o,i,r)=>{let l=s.doc.resolve(i),a=t instanceof Function?t(o):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?s.tr.delete(i,r).setBlockType(i,i,e,a):null})}function Bg(n){return Ii(/^\s*>\s$/,n)}function Hg(n){return Ii(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function $g(n){return Ii(/^\s*([-+*])\s$/,n)}function Fg(n){return Gc(/^```$/,n)}function Wg(n,e){return Gc(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function _g(n){const e=Lg.concat(Ig,Pg);let t;return(t=n.nodes.blockquote)&&e.push(Bg(t)),(t=n.nodes.orderedList)&&e.push(Hg(t)),(t=n.nodes.bulletList)&&e.push($g(t)),(t=n.nodes.codeBlock)&&e.push(Fg(t)),(t=n.nodes.heading)&&e.push(Wg(t,6)),Ng({rules:e})}const qg="rteProseMirror",Gg=ne(function(n,e={}){const t={plugins:r=>r.plugins,...e},s=(r,l)=>{var p,m;const a=((p=t.schema)==null?void 0:p.call(t,{editor:n,schema:Vc}))||Vc,{nodes:c,marks:d}=a,u=Ut.fromSchema(a).parse(r),h=nn.create({doc:u,schema:a,plugins:(m=t.plugins)==null?void 0:m.call(t,{editor:n,plugins:[Km(),sg(),_g(a),Of(),Uo({Tab:Cc(1),"Shift-Tab":Cc(-1)}),Uo({Enter:En(_l,Lf(c.listItem),hg),"Shift-Enter":En(Wl,(g,b)=>(b&&b(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":ea,"Mod-y":jo,"Mod-Shift-z":jo,"Mod-b":xt(d.strong),"Mod-i":xt(d.em),"Shift-Tab":Zo(c.listItem),Tab:$f(c.listItem)}),Uo(wf)]})}),f=new bm({mount:r},{state:h,dispatchTransaction(g){var w;const{state:b}=f,C=b.apply(g),y=!b.doc.eq(C.doc);f.updateState(C);const v=!b.selection.eq(C.selection);y&&(cg(((w=l==null?void 0:l.view)==null?void 0:w.el)||r),f.focus()),(v||y)&&n.trigger(xe)}});return r.__rteView=f,f.setProps({nodeViews:{image(g){return new Ag(g,f,n)}}}),f},o=r=>Mg(r,t);n.setCustomRte({toolbar:o,parseContent:!0,async enable(r,l,a){const c=Ni(r);if(c)return c;const d=s(r,a);return rg(r,d),wg(d,a),d},disable(r){const l=Ni(r);if(l)return lg(r,l),l.destroy(),{forceSync:!0}},getContent(r){const l=Ni(r);if(l){const{schema:a,doc:c}=l.state,d=document.createElement("div"),u=Ct.fromSchema(a).serializeFragment(c.content);return u.childNodes.forEach(h=>{h.nodeType===Node.ELEMENT_NODE&&h.innerHTML===""&&(h.innerHTML="<br/>")}),d.appendChild(u),dg(d),r.classList.remove("ProseMirror-focused"),d.innerHTML}return r.innerHTML}});const i=ug(n,t);se({editor:n,licenseKey:t.licenseKey,plan:W.free,pluginName:qg,cleanup:()=>{n.RichTextEditor.customRte=void 0,i()}})}),jg="canvasEmptyState",Kg=ne(function(n,e={}){const t=new WeakMap,s=new WeakMap,o=new WeakMap,i=new Set,r=new WeakMap,l={emptyStates:[],...e},a=(y,v)=>{let w=!1;const{isValid:S}=v;return Array.isArray(S)?w=S.some(k=>y.is(k)):Jn(S)?w=S({component:y,editor:n}):w=y.is(S),w},c=y=>{const v=t.get(y);t.delete(y),v==null||v()},d=y=>{y.views.forEach(v=>c(v)),o.delete(y)},u=y=>{if(!(!y||i.has(y)))try{i.add(y);const v=y.components().length>0,w=o.get(y);if(v&&w)d(y);else if(!v&&!w){const S=r.has(y)?r.get(y):l.emptyStates.find(k=>a(y,k));if(r.set(y,S),!S)return;y.views.forEach(k=>{const E=S.render({editor:n,component:y,componentView:k,mount:T=>{s.set(k,T),o.set(y,!0);const A=k.getChildrenContainer();A==null||A.appendChild(T)},unmount:()=>c(k)});t.set(k,()=>{E==null||E();const T=s.get(k);T==null||T.remove()})})}}finally{i.delete(y)}},h=y=>{o.has(y)&&d(y)},f=({model:y})=>{u(y.getComponent())},p=n.Components.events,m=`${p.update}:components`,g="component:mount",b=n.Canvas.events.frameLoadBody,C=p.removed;n.on(m,u),n.on(g,u),n.on(C,h),n.on(b,f),se({editor:n,licenseKey:l.licenseKey,plan:W.startup,pluginName:jg,cleanup:()=>{n.off(m,u),n.off(g,u),n.off(C,h),n.off(b,f)}})}),jc="canvasFullSize",Jg=ne(function(n,e={}){const{Canvas:t,Commands:s,Devices:o}=n,i={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...e},{canvasOffsetY:r,canvasOffsetX:l,canvasTransition:a,deviceMaxWidth:c,deviceMinHeigth:d,frameBorderRadius:u,frameTransition:h}=i,f=`${d}px`,p=t.events,m=`${s.events.stopCommand}core:preview`,g=t.getConfig(),b=`${jc}:disable`,C=o.getAll().map(v=>({...v.attributes}));g.scrollableCanvas=!0,o.getAll().map(v=>{!v.get("width")&&v.set("width",`${c}px`),!v.get("height")&&v.set("height","auto"),!v.get("minHeight")&&v.set("minHeight",f)});const y=v=>{const w="data-gs-plg-full-size",S=document.querySelector(`style[${w}]`);if(v&&S)return S.remove();const k=S||document.createElement("style"),E=t.getZoomMultiplier();k.setAttribute(w,"true"),k.innerHTML=`
198
+ `);return{dom:a,text:h,slice:e}}function ja(n,e,t,s,o){let i=o.parent.type.spec.code,r,l;if(!t&&!e)return null;let a=e&&(s||i||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,i||s,n)}),i)return e?new M(x.from(n.state.schema.text(e.replace(/\r\n?/g,`
199
+ `))),0,0):M.empty;let u=n.someProp("clipboardTextParser",h=>h(e,o,s,n));if(u)l=u;else{let h=o.marks(),{schema:f}=n.state,p=xt.fromSchema(f);r=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=r.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),r=qp(t),In&&Gp(r);let c=r&&r.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=r.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;r=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Zt.fromSchema(n.state.schema)).parseSlice(r,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Fp.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=jp(Za(l,+d[1],+d[2]),d[4]);else if(l=M.maxOpen(Wp(l.content,o),!0),l.openStart||l.openEnd){let u=0,h=0;for(let f=l.content.firstChild;u<l.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=l.content.lastChild;h<l.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);l=Za(l,u,h)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const Fp=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Wp(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,r=[];if(n.forEach(l=>{if(!r)return;let a=o.findWrapping(l.type),c;if(!a)return r=null;if(c=r.length&&i.length&&Ja(a,i,l,r[r.length-1],0))r[r.length-1]=c;else{r.length&&(r[r.length-1]=Ua(r[r.length-1],i.length));let d=Ka(l,a);r.push(d),o=o.matchType(d.type),i=a}}),r)return x.from(r)}return n}function Ka(n,e,t=0){for(let s=e.length-1;s>=t;s--)n=e[s].create(null,x.from(n));return n}function Ja(n,e,t,s,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=Ja(n,e,t,s.lastChild,o+1);if(i)return s.copy(s.content.replaceChild(s.childCount-1,i));if(s.contentMatchAt(s.childCount).matchType(o==n.length-1?t.type:n[o+1]))return s.copy(s.content.append(x.from(Ka(t,n,o+1))))}}function Ua(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ua(n.lastChild,e-1)),s=n.contentMatchAt(n.childCount).fillBefore(x.empty,!0);return n.copy(t.append(s))}function hi(n,e,t,s,o,i){let r=e<0?n.firstChild:n.lastChild,l=r.content;return n.childCount>1&&(i=0),o<s-1&&(l=hi(l,e,t,s,o+1,i)),o>=t&&(l=e<0?r.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(r.contentMatchAt(r.childCount).fillBefore(x.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,r.copy(l))}function Za(n,e,t){return e<n.openStart&&(n=new M(hi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(hi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ya={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xa=null;function Qa(){return Xa||(Xa=document.implementation.createHTMLDocument("title"))}let fi=null;function _p(n){let e=window.trustedTypes;return e?(fi||(fi=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),fi.createHTML(n)):n}function qp(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Qa().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(n),o;if((o=s&&Ya[s[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=_p(n),o)for(let i=0;i<o.length;i++)t=t.querySelector(o[i])||t;return t}function Gp(n){let e=n.querySelectorAll(ne?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let s=e[t];s.childNodes.length==1&&s.textContent==" "&&s.parentNode&&s.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),s)}}function jp(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,s;try{s=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:r}=n;for(let l=s.length-2;l>=0;l-=2){let a=t.nodes[s[l]];if(!a||a.hasRequiredAttrs())break;o=x.from(a.create(s[l+1],o)),i++,r++}return new M(o,i,r)}const re={},le={},Kp={touchstart:!0,touchmove:!0};class Jp{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Up(n){for(let e in re){let t=re[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=s=>{Yp(n,s)&&!mi(n,s)&&(n.editable||!(s.type in le))&&t(n,s)},Kp[e]?{passive:!0}:void 0)}ie&&n.dom.addEventListener("input",()=>null),pi(n)}function nt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Zp(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function pi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=s=>mi(n,s))})}function mi(n,e){return n.someProp("handleDOMEvents",t=>{let s=t[e.type];return s?s(n,e)||e.defaultPrevented:!1})}function Yp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Xp(n,e){!mi(n,e)&&re[e.type]&&(n.editable||!(e.type in le))&&re[e.type](n,e)}le.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!tc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ce&&ne&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),rn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let s=Date.now();n.input.lastIOSEnter=s,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==s&&(n.someProp("handleKeyDown",o=>o(n,At(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",s=>s(n,t))||$p(n,t)?t.preventDefault():nt(n,"key")},le.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},le.keypress=(n,e)=>{let t=e;if(tc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ge&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let s=n.state.selection;if(!(s instanceof R)||!s.$from.sameParent(s.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,s.$from.pos,s.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function Bs(n){return{left:n.clientX,top:n.clientY}}function Qp(n,e){let t=e.x-n.clientX,s=e.y-n.clientY;return t*t+s*s<100}function gi(n,e,t,s,o){if(s==-1)return!1;let i=n.state.doc.resolve(s);for(let r=i.depth+1;r>0;r--)if(n.someProp(e,l=>r>i.depth?l(n,t,i.nodeAfter,i.before(r),o,!0):l(n,t,i.node(r),i.before(r),o,!1)))return!0;return!1}function cn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let s=n.state.tr.setSelection(e);s.setMeta("pointer",!0),n.dispatch(s)}function em(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),s=t.nodeAfter;return s&&s.isAtom&&N.isSelectable(s)?(cn(n,new N(t)),!0):!1}function tm(n,e){if(e==-1)return!1;let t=n.state.selection,s,o;t instanceof N&&(s=t.node);let i=n.state.doc.resolve(e);for(let r=i.depth+1;r>0;r--){let l=r>i.depth?i.nodeAfter:i.node(r);if(N.isSelectable(l)){s&&t.$from.depth>0&&r>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(r);break}}return o!=null?(cn(n,N.create(n.state.doc,o)),!0):!1}function nm(n,e,t,s,o){return gi(n,"handleClickOn",e,t,s)||n.someProp("handleClick",i=>i(n,e,s))||(o?tm(n,t):em(n,t))}function sm(n,e,t,s){return gi(n,"handleDoubleClickOn",e,t,s)||n.someProp("handleDoubleClick",o=>o(n,e,s))}function om(n,e,t,s){return gi(n,"handleTripleClickOn",e,t,s)||n.someProp("handleTripleClick",o=>o(n,e,s))||im(n,t,s)}function im(n,e,t){if(t.button!=0)return!1;let s=n.state.doc;if(e==-1)return s.inlineContent?(cn(n,R.create(s,0,s.content.size)),!0):!1;let o=s.resolve(e);for(let i=o.depth+1;i>0;i--){let r=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(r.inlineContent)cn(n,R.create(s,l+1,l+1+r.content.size));else if(N.isSelectable(r))cn(n,N.create(s,l));else continue;return!0}}function yi(n){return Hs(n)}const ec=ge?"metaKey":"ctrlKey";re.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let s=yi(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&Qp(t,n.input.lastClick)&&!t[ec]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let r=n.posAtCoords(Bs(t));r&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new rm(n,r,t,!!s)):(i=="doubleClick"?sm:om)(n,r.pos,r.inside,t)?t.preventDefault():nt(n,"pointer"))};class rm{constructor(e,t,s,o){this.view=e,this.pos=t,this.event=s,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[ec],this.allowDefault=s.shiftKey;let i,r;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),r=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,r=d.depth?d.before():0}const l=o?null:s.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(s.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof N&&c.from<=r&&c.to>r)&&(this.mightDrag={node:i,pos:r,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&we&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),nt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>He(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Bs(e))),this.updateAllowDefault(e),this.allowDefault||!t?nt(this.view,"pointer"):nm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ie&&this.mightDrag&&!this.mightDrag.node.isAtom||ne&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(cn(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):nt(this.view,"pointer")}move(e){this.updateAllowDefault(e),nt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}re.touchstart=n=>{n.input.lastTouch=Date.now(),yi(n),nt(n,"pointer")},re.touchmove=n=>{n.input.lastTouch=Date.now(),nt(n,"pointer")},re.contextmenu=n=>yi(n);function tc(n,e){return n.composing?!0:ie&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const lm=Ce?5e3:-1;le.compositionstart=le.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof R&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Hs(n,!0),n.markCursor=null;else if(Hs(n,!e.selection.empty),we&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let s=n.domSelectionRange();for(let o=s.focusNode,i=s.focusOffset;o&&o.nodeType==1&&i!=0;){let r=i<0?o.lastChild:o.childNodes[i-1];if(!r)break;if(r.nodeType==3){let l=n.domSelection();l&&l.collapse(r,r.nodeValue.length);break}else o=r,i=-1}}n.input.composing=!0}nc(n,lm)},le.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,nc(n,20))};function nc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Hs(n),e))}function sc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=cm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function am(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=ep(e.focusNode,e.focusOffset),s=tp(e.focusNode,e.focusOffset);if(t&&s&&t!=s){let o=s.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||s==i)return i;if(!o||!o.isText(s.nodeValue))return s;if(n.input.compositionNode==s){let r=t.pmViewDesc;if(!(!r||!r.isText(t.nodeValue)))return s}}return t||s}function cm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Hs(n,e=!1){if(!(Ce&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),sc(n),e||n.docView&&n.docView.dirty){let t=li(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function dm(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),s.removeAllRanges(),s.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Vn=de&&Xe<15||rn&&rp<604;re.copy=le.cut=(n,e)=>{let t=e,s=n.state.selection,o=t.type=="cut";if(s.empty)return;let i=Vn?null:t.clipboardData,r=s.content(),{dom:l,text:a}=Ga(n,r);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):dm(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function um(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function hm(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,s=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),s.parentNode&&s.parentNode.removeChild(s),t?Bn(n,s.value,null,o,e):Bn(n,s.textContent,s.innerHTML,o,e)},50)}function Bn(n,e,t,s,o){let i=ja(n,e,t,s,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||M.empty)))return!0;if(!i)return!1;let r=um(i),l=r?n.state.tr.replaceSelectionWith(r,s):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function oc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}le.paste=(n,e)=>{let t=e;if(n.composing&&!Ce)return;let s=Vn?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;s&&Bn(n,oc(s),s.getData("text/html"),o,t)?t.preventDefault():hm(n,t)};class ic{constructor(e,t,s){this.slice=e,this.move=t,this.node=s}}const rc=ge?"altKey":"ctrlKey";re.dragstart=(n,e)=>{let t=e,s=n.input.mouseDown;if(s&&s.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Bs(t)),r;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof N?o.to-1:o.to))){if(s&&s.mightDrag)r=N.create(n.state.doc,s.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(r=N.create(n.state.doc,u.posBefore))}}let l=(r||n.state.selection).content(),{dom:a,text:c,slice:d}=Ga(n,l);(!t.dataTransfer.files.length||!ne||ua>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Vn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Vn||t.dataTransfer.setData("text/plain",c),n.dragging=new ic(d,!t[rc],r)},re.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},le.dragover=le.dragenter=(n,e)=>e.preventDefault(),le.drop=(n,e)=>{let t=e,s=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(Bs(t));if(!o)return;let i=n.state.doc.resolve(o.pos),r=s&&s.slice;r?n.someProp("transformPasted",p=>{r=p(r,n)}):r=ja(n,oc(t.dataTransfer),Vn?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(s&&!t[rc]);if(n.someProp("handleDrop",p=>p(n,t,r||M.empty,l))){t.preventDefault();return}if(!r)return;t.preventDefault();let a=r?lf(n.state.doc,i.pos,r):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=s;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,r.content.firstChild):c.replaceRange(d,d,r),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&N.isSelectable(r.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(r.content.firstChild))c.setSelection(new N(f));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,C)=>p=C),c.setSelection(ci(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},re.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&He(n)},20))},re.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},re.beforeinput=(n,e)=>{if(ne&&Ce&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:s}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=s||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,At(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in le)re[n]=le[n];function Hn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class $s{constructor(e,t){this.toDOM=e,this.spec=t||Pt,this.side=this.spec.side||0}map(e,t,s,o){let{pos:i,deleted:r}=e.mapResult(t.from+o,this.side<0?-1:1);return r?null:new ue(i-s,i-s,this)}valid(){return!0}eq(e){return this==e||e instanceof $s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Hn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class st{constructor(e,t){this.attrs=e,this.spec=t||Pt}map(e,t,s,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-s,r=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-s;return i>=r?null:new ue(i,r,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof st&&Hn(this.attrs,e.attrs)&&Hn(this.spec,e.spec)}static is(e){return e.type instanceof st}destroy(){}}class bi{constructor(e,t){this.attrs=e,this.spec=t||Pt}map(e,t,s,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let r=e.mapResult(t.to+o,-1);return r.deleted||r.pos<=i.pos?null:new ue(i.pos-s,r.pos-s,this)}valid(e,t){let{index:s,offset:o}=e.content.findIndex(t.from),i;return o==t.from&&!(i=e.child(s)).isText&&o+i.nodeSize==t.to}eq(e){return this==e||e instanceof bi&&Hn(this.attrs,e.attrs)&&Hn(this.spec,e.spec)}destroy(){}}class ue{constructor(e,t,s){this.from=e,this.to=t,this.type=s}copy(e,t){return new ue(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,s){return this.type.map(e,this,t,s)}static widget(e,t,s){return new ue(e,e,new $s(t,s))}static inline(e,t,s,o){return new ue(e,t,new st(s,o))}static node(e,t,s,o){return new ue(e,t,new bi(s,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof st}get widget(){return this.type instanceof $s}}const dn=[],Pt={};class _{constructor(e,t){this.local=e.length?e:dn,this.children=t.length?t:dn}static create(e,t){return t.length?Fs(t,e,0,Pt):se}find(e,t,s){let o=[];return this.findInner(e??0,t??1e9,o,0,s),o}findInner(e,t,s,o,i){for(let r=0;r<this.local.length;r++){let l=this.local[r];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&s.push(l.copy(l.from+o,l.to+o))}for(let r=0;r<this.children.length;r+=3)if(this.children[r]<t&&this.children[r+1]>e){let l=this.children[r]+1;this.children[r+2].findInner(e-l,t-l,s,o+l,i)}}map(e,t,s){return this==se||e.maps.length==0?this:this.mapInner(e,t,0,0,s||Pt)}mapInner(e,t,s,o,i){let r;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,s,o);a&&a.type.valid(t,a)?(r||(r=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?fm(this.children,r||[],e,t,s,o,i):r?new _(r.sort(It),dn):se}add(e,t){return t.length?this==se?_.create(e,t):this.addInner(e,t,0):this}addInner(e,t,s){let o,i=0;e.forEach((l,a)=>{let c=a+s,d;if(d=ac(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,d,c+1):o.splice(i,0,a,a+l.nodeSize,Fs(d,l,c+1,Pt)),i+=3}});let r=lc(i?cc(t):t,-s);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||r.splice(l--,1);return new _(r.length?this.local.concat(r).sort(It):this.local,o||this.children)}remove(e){return e.length==0||this==se?this:this.removeInner(e,0)}removeInner(e,t){let s=this.children,o=this.local;for(let i=0;i<s.length;i+=3){let r,l=s[i]+t,a=s[i+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(r||(r=[])).push(u));if(!r)continue;s==this.children&&(s=this.children.slice());let c=s[i+2].removeInner(r,l+1);c!=se?s[i+2]=c:(s.splice(i,3),i-=3)}if(o.length){for(let i=0,r;i<e.length;i++)if(r=e[i])for(let l=0;l<o.length;l++)o[l].eq(r,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return s==this.children&&o==this.local?this:o.length||s.length?new _(o,s):se}forChild(e,t){if(this==se)return this;if(t.isLeaf)return _.empty;let s,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(s=this.children[l+2]);break}let i=e+1,r=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<r&&a.to>i&&a.type instanceof st){let c=Math.max(i,a.from)-i,d=Math.min(r,a.to)-i;c<d&&(o||(o=[])).push(a.copy(c,d))}}if(o){let l=new _(o.sort(It),dn);return s?new ot([l,s]):l}return s||se}eq(e){if(this==e)return!0;if(!(e instanceof _)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return vi(this.localsInner(e))}localsInner(e){if(this==se)return dn;if(e.inlineContent||!this.local.some(st.is))return this.local;let t=[];for(let s=0;s<this.local.length;s++)this.local[s].type instanceof st||t.push(this.local[s]);return t}forEachSet(e){e(this)}}_.empty=new _([],[]),_.removeOverlap=vi;const se=_.empty;class ot{constructor(e){this.members=e}map(e,t){const s=this.members.map(o=>o.map(e,t,Pt));return ot.from(s)}forChild(e,t){if(t.isLeaf)return _.empty;let s=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=se&&(i instanceof ot?s=s.concat(i.members):s.push(i))}return ot.from(s)}eq(e){if(!(e instanceof ot)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,s=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{s&&(t=t.slice(),s=!1);for(let r=0;r<i.length;r++)t.push(i[r])}}return t?vi(s?t:t.sort(It)):dn}static from(e){switch(e.length){case 0:return se;case 1:return e[0];default:return new ot(e.every(t=>t instanceof _)?e:e.reduce((t,s)=>t.concat(s instanceof _?s:s.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function fm(n,e,t,s,o,i,r){let l=n.slice();for(let c=0,d=i;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||h>C+d-u)continue;let y=l[b]+d-u;f>=y?l[b+1]=h<=y?-2:-1:h>=d&&g&&(l[b]+=g,l[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=t.map(n[c]+i),u=d-o;if(u<0||u>=s.content.size){a=!0;continue}let h=t.map(n[c+1]+i,-1),f=h-o,{index:p,offset:m}=s.content.findIndex(u),g=s.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=l[c+2].mapInner(t,g,d+1,n[c]+i+1,r);b!=se?(l[c]=u,l[c+1]=f,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=pm(l,n,e,t,o,i,r),d=Fs(c,s,0,r);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<l.length&&l[h]<f;)h+=3;l.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new _(e.sort(It),l)}function lc(n,e){if(!e||!n.length)return n;let t=[];for(let s=0;s<n.length;s++){let o=n[s];t.push(new ue(o.from+e,o.to+e,o.type))}return t}function pm(n,e,t,s,o,i,r){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(s,o,c);u?t.push(u):r.onRemove&&r.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function ac(n,e,t){if(e.isLeaf)return null;let s=t+e.nodeSize,o=null;for(let i=0,r;i<n.length;i++)(r=n[i])&&r.from>t&&r.to<s&&((o||(o=[])).push(r),n[i]=null);return o}function cc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Fs(n,e,t,s){let o=[],i=!1;e.forEach((l,a)=>{let c=ac(n,l,a+t);if(c){i=!0;let d=Fs(c,l,t+a+1,s);d!=se&&o.push(a,a+l.nodeSize,d)}});let r=lc(i?cc(n):n,-t).sort(It);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||(s.onRemove&&s.onRemove(r[l].spec),r.splice(l--,1));return r.length||o.length?new _(r,o):se}function It(n,e){return n.from-e.from||n.to-e.to}function vi(n){let e=n;for(let t=0;t<e.length-1;t++){let s=e[t];if(s.from!=s.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==s.from){i.to!=s.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,s.to),dc(e,o+1,i.copy(s.to,i.to)));continue}else{i.from<s.to&&(e==n&&(e=n.slice()),e[t]=s.copy(s.from,i.from),dc(e,o,s.copy(i.from,s.to)));break}}}return e}function dc(n,e,t){for(;e<n.length&&It(t,n[e])>0;)e++;n.splice(e,0,t)}function Si(n){let e=[];return n.someProp("decorations",t=>{let s=t(n.state);s&&s!=se&&e.push(s)}),n.cursorWrapper&&e.push(_.create(n.state.doc,[n.cursorWrapper.deco])),ot.from(e)}const mm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gm=de&&Xe<=11;class ym{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class bm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ym,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let o=0;o<s.length;o++)this.queue.push(s[o]);de&&Xe<=11&&s.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),gm&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,mm)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Va(this.view)){if(this.suppressingSelectionUpdates)return He(this.view);if(de&&Xe<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Mt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,s;for(let i=e.focusNode;i;i=Nn(i))t.add(i);for(let i=e.anchorNode;i;i=Nn(i))if(t.has(i)){s=i;break}let o=s&&this.view.docView.nearestDesc(s);if(o&&o.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let s=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&Va(e)&&!this.ignoreSelectionChange(s),i=-1,r=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],a);u&&(i=i<0?u.from:Math.min(u.from,i),r=r<0?u.to:Math.max(u.to,r),u.typeOver&&(l=!0))}if(we&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||wm(e,u)!=f)&&h.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ds(s)&&(c=li(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,He(e),this.currentSelection.set(s),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,r),vm(e)),this.handleDOMChange(i,r,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||He(e),this.currentSelection.set(s))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return{from:s.posBefore,to:s.posAfter};let o=e.previousSibling,i=e.nextSibling;if(de&&Xe<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(o=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let r=o&&o.parentNode==e.target?Y(o)+1:0,l=s.localPosFromDOM(e.target,r,-1),a=i&&i.parentNode==e.target?Y(i):e.target.childNodes.length,c=s.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}:(this.lastChangedTextNode=e.target,{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let uc=new WeakMap,hc=!1;function vm(n){if(!uc.has(n)&&(uc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=we,hc)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),hc=!0}}function fc(n,e){let t=e.startContainer,s=e.startOffset,o=e.endContainer,i=e.endOffset,r=n.domAtPos(n.state.selection.anchor);return Mt(r.node,r.offset,o,i)&&([t,s,o,i]=[o,i,t,s]),{anchorNode:t,anchorOffset:s,focusNode:o,focusOffset:i}}function Sm(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return fc(n,o)}let t;function s(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",s,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",s,!0),t?fc(n,t):null}function wm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let s=n.docView.nearestDesc(t,!0);if(s&&s.node.isBlock)return t}return null}function Cm(n,e,t){let{node:s,fromOffset:o,toOffset:i,from:r,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Ds(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ne&&n.input.lastKeyCode===8)for(let g=i;g>o;g--){let b=s.childNodes[g-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=g;break}if(!C||C.size)break}let u=n.state.doc,h=n.someProp("domParser")||Zt.fromSchema(n.state.schema),f=u.resolve(r),p=null,m=h.parse(s,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:xm,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+r,head:b+r}}return{doc:m,sel:p,from:r,to:l}}function xm(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ie&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ie&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const km=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Tm(n,e,t,s,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=li(n,T);if(A&&!n.state.selection.eq(A)){if(ne&&Ce&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,At(13,"Enter"))))return;let P=n.state.tr.setSelection(A);T=="pointer"?P.setMeta("pointer",!0):T=="key"&&P.scrollIntoView(),i&&P.setMeta("composition",i),n.dispatch(P)}return}let r=n.state.doc.resolve(e),l=r.sharedDepth(t);e=r.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=Cm(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=Em(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(rn&&n.input.lastIOSEnter>Date.now()-225||Ce)&&o.some(T=>T.nodeType==1&&!km.test(T.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",T=>T(n,At(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(s&&a instanceof R&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=pc(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let A=n.state.tr.setSelection(T);i&&A.setMeta("composition",i),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof R&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),de&&Xe<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,y;if((rn&&n.input.lastIOSEnter>Date.now()-225&&(!C||o.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(y=I.findFrom(c.doc.resolve(m.pos+1),1,!0))&&y.head==g.pos)&&n.someProp("handleKeyDown",T=>T(n,At(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Am(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,At(8,"Backspace")))){Ce&&ne&&n.domObserver.suppressSelectionUpdates();return}ne&&Ce&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),Ce&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,At(13,"Enter"))})},20));let v=p.start,S=p.endA,w,k,E;if(C){if(m.pos==g.pos)de&&Xe<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>He(n),20)),w=n.state.tr.delete(v,S),k=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(E=Mm(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))w=n.state.tr,E.type=="add"?w.addMark(v,S,E.mark):w.removeMark(v,S,E.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",A=>A(n,v,S,T)))return;w=n.state.tr.insertText(T,v,S)}}if(w||(w=n.state.tr.replace(v,S,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let T=pc(n,w.doc,c.sel);T&&!(ne&&Ce&&n.composing&&T.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==v||T.head==w.mapping.map(S)-1)||de&&T.empty&&T.head==v)&&w.setSelection(T)}k&&w.ensureMarks(k),i&&w.setMeta("composition",i),n.dispatch(w.scrollIntoView())}function pc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ci(n,e.resolve(t.anchor),e.resolve(t.head))}function Mm(n,e){let t=n.firstChild.marks,s=e.firstChild.marks,o=t,i=s,r,l,a;for(let d=0;d<s.length;d++)o=s[d].removeFromSet(o);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],r="add",a=d=>d.mark(l.addToSet(d.marks));else if(o.length==0&&i.length==1)l=i[0],r="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(x.from(c).eq(n))return{mark:l,type:r}}function Am(n,e,t,s,o){if(t-e<=o.pos-s.pos||wi(s,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!s.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let r=n.resolve(wi(i,!0,!0));return!r.parent.isTextblock||r.pos>t||wi(r,!0,!1)<t?!1:s.parent.content.cut(s.parentOffset).eq(r.parent.content)}function wi(n,e,t){let s=n.depth,o=e?n.end():n.pos;for(;s>0&&(e||n.indexAfter(s)==n.node(s).childCount);)s--,o++,e=!1;if(t){let i=n.node(s).maybeChild(n.indexAfter(s));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Em(n,e,t,s,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:r,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(r,l));s-=r+a-i}if(r<i&&n.size<e.size){let a=s<=i&&s>=r?i-s:0;i-=a,i&&i<e.size&&mc(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-r),r=i}else if(l<i){let a=s<=i&&s>=l?i-s:0;i-=a,i&&i<n.size&&mc(n.textBetween(i-1,i+1))&&(i+=a?1:-1),r=i+(r-l),l=i}return{start:i,endA:r,endB:l}}function mc(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Om{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Jp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Sc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=bc(this),yc(this),this.nodeViews=vc(this),this.docView=Ta(this.state.doc,gc(this),Si(this),this.dom,this),this.domObserver=new bm(this,(s,o,i,r)=>Tm(this,s,o,i,r)),this.domObserver.start(),Up(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&pi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let s in this._props)t[s]=this._props[s];t.state=this.state;for(let s in e)t[s]=e[s];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var s;let o=this.state,i=!1,r=!1;e.storedMarks&&this.composing&&(sc(this),r=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=vc(this);Pm(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&pi(this),this.editable=bc(this),yc(this);let a=Si(this),c=gc(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(r=!0);let h=d=="preserve"&&r&&this.dom.style.overflowAnchor==null&&cp(this);if(r){this.domObserver.stop();let f=u&&(de||ne)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Nm(o.selection,e.selection);if(u){let p=ne?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=am(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ta(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Rp(this))?He(this,f):(za(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((s=this.dragging)===null||s===void 0)&&s.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&dp(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof N){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ha(this,t.getBoundingClientRect(),e)}else ha(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let s=this.directPlugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let s=this.state.plugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let s=this.pluginViews[t];s.update&&s.update(this,e)}}updateDraggedNode(e,t){let s=e.node,o=-1;if(this.state.doc.nodeAt(s.from)==s.node)o=s.from;else{let i=s.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==s.node&&(o=i)}this.dragging=new ic(e.slice,e.move,o<0?void 0:N.create(this.state.doc,o))}someProp(e,t){let s=this._props&&this._props[e],o;if(s!=null&&(o=t?t(s):s))return o;for(let r=0;r<this.directPlugins.length;r++){let l=this.directPlugins[r].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let l=i[r].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){if(de){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&up(this.dom),He(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return gp(this,e)}coordsAtPos(e,t=1){return ba(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,s=-1){let o=this.docView.posFromDOM(e,t,s);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return wp(this,t||this.state,e)}pasteHTML(e,t){return Bn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Bn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Zp(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Si(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Xf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Xp(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?ie&&this.root.nodeType===11&&sp(this.dom.ownerDocument)==this.dom&&Sm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function gc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let s in t)s=="class"?e.class+=" "+t[s]:s=="style"?e.style=(e.style?e.style+";":"")+t[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(t[s]))}),e.translate||(e.translate="no"),[ue.node(0,n.state.doc.content.size,e)]}function yc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ue.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function bc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Nm(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function vc(n){let e=Object.create(null);function t(s){for(let o in s)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=s[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Pm(n,e){let t=0,s=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)s++;return t!=s}function Sc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ci,xi;if(typeof WeakMap<"u"){let n=new WeakMap;Ci=e=>n.get(e),xi=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Ci=s=>{for(let o=0;o<n.length;o+=2)if(n[o]==s)return n[o+1]},xi=(s,o)=>(t==10&&(t=0),n[t++]=s,n[t++]=o)}var G=class{constructor(n,e,t,s){this.width=n,this.height=e,this.map=t,this.problems=s}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const s=e%this.width,o=e/this.width|0;let i=s+1,r=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;r<this.height&&this.map[e+this.width*l]==t;l++)r++;return{left:s,top:o,right:i,bottom:r}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:s,right:o,top:i,bottom:r}=this.findCell(n);return e=="horiz"?(t<0?s==0:o==this.width)?null:this.map[i*this.width+(t<0?s-1:o)]:(t<0?i==0:r==this.height)?null:this.map[s+this.width*(t<0?i-1:r)]}rectBetween(n,e){const{left:t,right:s,top:o,bottom:i}=this.findCell(n),{left:r,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,r),top:Math.min(o,a),right:Math.max(s,l),bottom:Math.max(i,c)}}cellsInRect(n){const e=[],t={};for(let s=n.top;s<n.bottom;s++)for(let o=n.left;o<n.right;o++){const i=s*this.width+o,r=this.map[i];t[r]||(t[r]=!0,!(o==n.left&&o&&this.map[i-1]==r||s==n.top&&s&&this.map[i-this.width]==r)&&e.push(r))}return e}positionAt(n,e,t){for(let s=0,o=0;;s++){const i=o+t.child(s).nodeSize;if(s==n){let r=e+n*this.width;const l=(n+1)*this.width;for(;r<l&&this.map[r]<o;)r++;return r==l?i-1:this.map[r]}o=i}}static get(n){return Ci(n)||xi(n,Im(n))}};function Im(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Rm(n),t=n.childCount,s=[];let o=0,i=null;const r=[];for(let c=0,d=e*t;c<d;c++)s[c]=0;for(let c=0,d=0;c<t;c++){const u=n.child(c);d++;for(let p=0;;p++){for(;o<s.length&&s[o]!=0;)o++;if(p==u.childCount)break;const m=u.child(p),{colspan:g,rowspan:b,colwidth:C}=m.attrs;for(let y=0;y<b;y++){if(y+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-y});break}const v=o+y*e;for(let S=0;S<g;S++){s[v+S]==0?s[v+S]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:g-S});const w=C&&C[S];if(w){const k=(v+S)%e*2,E=r[k];E==null||E!=w&&r[k+1]==1?(r[k]=w,r[k+1]=1):E==w&&r[k+1]++}}}o+=g,d+=m.nodeSize}const h=(c+1)*e;let f=0;for(;o<h;)s[o++]==0&&f++;f&&(i||(i=[])).push({type:"missing",row:c,n:f}),d++}const l=new G(e,t,s,i);let a=!1;for(let c=0;!a&&c<r.length;c+=2)r[c]!=null&&r[c+1]<t&&(a=!0);return a&&Dm(l,r,n),l}function Rm(n){let e=-1,t=!1;for(let s=0;s<n.childCount;s++){const o=n.child(s);let i=0;if(t)for(let r=0;r<s;r++){const l=n.child(r);for(let a=0;a<l.childCount;a++){const c=l.child(a);r+c.attrs.rowspan>s&&(i+=c.attrs.colspan)}}for(let r=0;r<o.childCount;r++){const l=o.child(r);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Dm(n,e,t){n.problems||(n.problems=[]);const s={};for(let o=0;o<n.map.length;o++){const i=n.map[o];if(s[i])continue;s[i]=!0;const r=t.nodeAt(i);if(!r)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=r.attrs;for(let c=0;c<a.colspan;c++){const d=(o+c)%n.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=zm(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function zm(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function wc(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),s=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(r=>Number(r)):null,o=Number(n.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:s&&s.length==o?s:null};for(const r in e){const l=e[r].getFromDOM,a=l&&l(n);a!=null&&(i[r]=a)}return i}function Cc(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const s in e){const o=e[s].setDOMAttr;o&&o(n.attrs[s],t)}return t}function Lm(n){const e=n.cellAttributes||{},t={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const s in e)t[s]={default:e[s].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:s=>wc(s,e)}],toDOM(s){return["td",Cc(s,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:s=>wc(s,e)}],toDOM(s){return["th",Cc(s,e),0]}}}}function Ie(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const s=n.nodes[t],o=s.spec.tableRole;o&&(e[o]=s)}}return e}var it=new En("selectingCells");function $n(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Ws(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function ki(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=$n(e.$head)||Vm(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Vm(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const s=e.type.spec.tableRole;if(s=="cell"||s=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Ti(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Bm(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Mi(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function xc(n,e,t){const s=n.node(-1),o=G.get(s),i=n.start(-1),r=o.nextCell(n.pos-i,e,t);return r==null?null:n.node(0).resolve(i+r)}function un(n,e,t=1){const s={...n,colspan:n.colspan-t};return s.colwidth&&(s.colwidth=s.colwidth.slice(),s.colwidth.splice(e,t),s.colwidth.some(o=>o>0)||(s.colwidth=null)),s}var K=class _e extends I{constructor(e,t=e){const s=e.node(-1),o=G.get(s),i=e.start(-1),r=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(r).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const c=a.map(d=>{const u=s.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const h=i+d+1;return new zl(l.resolve(h),l.resolve(h+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const s=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Ti(s)&&Ti(o)&&Mi(s,o)){const i=this.$anchorCell.node(-1)!=s.node(-1);return i&&this.isRowSelection()?_e.rowSelection(s,o):i&&this.isColSelection()?_e.colSelection(s,o):new _e(s,o)}return R.between(s,o)}content(){const e=this.$anchorCell.node(-1),t=G.get(e),s=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s),i={},r=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let d=a*t.width+o.left,u=o.left;u<o.right;u++,d++){const h=t.map[d];if(i[h])continue;i[h]=!0;const f=t.findCell(h);let p=e.nodeAt(h);if(!p)throw RangeError(`No cell with offset ${h} found`);const m=o.left-f.left,g=f.right-o.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=un(b,0,m)),g>0&&(b=un(b,b.colspan-g,g)),f.left<o.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<o.top||f.bottom>o.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,o.bottom)-Math.max(f.top,o.top)};f.top<o.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}r.push(e.child(a).copy(x.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:r;return new M(x.from(l),1,1)}replace(e,t=M.empty){const s=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){const{$from:l,$to:a}=o[r],c=e.mapping.slice(s);e.replace(c.map(l.pos),c.map(a.pos),r?M.empty:t)}const i=I.findFrom(e.doc.resolve(e.mapping.slice(s).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new M(x.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),s=G.get(t),o=this.$anchorCell.start(-1),i=s.cellsInRect(s.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let r=0;r<i.length;r++)e(t.nodeAt(i[r]),o+i[r])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const s=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(s,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const s=e.node(-1),o=G.get(s),i=e.start(-1),r=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return r.top<=l.top?(r.top>0&&(e=a.resolve(i+o.map[r.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),r.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+r.right-1]))),new _e(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=G.get(e),s=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-s),i=t.colCount(this.$headCell.pos-s);if(Math.min(o,i)>0)return!1;const r=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(r,l)==t.width}eq(e){return e instanceof _e&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const s=e.node(-1),o=G.get(s),i=e.start(-1),r=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return r.left<=l.left?(r.left>0&&(e=a.resolve(i+o.map[r.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),r.right<o.width&&(e=a.resolve(i+o.map[o.width*(r.top+1)-1]))),new _e(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new _e(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,s=t){return new _e(e.resolve(t),e.resolve(s))}getBookmark(){return new Hm(this.$anchorCell.pos,this.$headCell.pos)}};K.prototype.visible=!1,I.jsonID("cell",K);var Hm=class id{constructor(e,t){this.anchor=e,this.head=t}map(e){return new id(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),s=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&s.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&s.index()<s.parent.childCount&&Mi(t,s)?new K(t,s):I.near(s,1)}};function $m(n){if(!(n.selection instanceof K))return null;const e=[];return n.selection.forEachCell((t,s)=>{e.push(ue.node(s,s+t.nodeSize,{class:"selectedCell"}))}),_.create(n.doc,e)}function Fm({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,s=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,s--);return t==s&&/row|table/.test(n.node(o).type.spec.tableRole)}function Wm({$from:n,$to:e}){let t,s;for(let o=n.depth;o>0;o--){const i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){s=i;break}}return t!==s&&e.parentOffset===0}function _m(n,e,t){const s=(e||n).selection,o=(e||n).doc;let i,r;if(s instanceof N&&(r=s.node.type.spec.tableRole)){if(r=="cell"||r=="header_cell")i=K.create(o,s.from);else if(r=="row"){const l=o.resolve(s.from+1);i=K.rowSelection(l,l)}else if(!t){const l=G.get(s.node),a=s.from+1,c=a+l.map[l.width*l.height-1];i=K.create(o,a+1,c)}}else s instanceof R&&Fm(s)?i=R.create(o,s.from):s instanceof R&&Wm(s)&&(i=R.create(o,s.$from.start(),s.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var qm=new En("fix-tables");function kc(n,e,t,s){const o=n.childCount,i=e.childCount;e:for(let r=0,l=0;r<i;r++){const a=e.child(r);for(let c=l,d=Math.min(o,r+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}s(a,t),l<o&&n.child(l).sameMarkup(a)?kc(n.child(l),a,t+1,s):a.nodesBetween(0,a.content.size,s,t+1),t+=a.nodeSize}}function Gm(n,e){let t;const s=(o,i)=>{o.type.spec.tableRole=="table"&&(t=jm(n,o,i,t))};return e?e.doc!=n.doc&&kc(e.doc,n.doc,0,s):n.doc.descendants(s),t}function jm(n,e,t,s){const o=G.get(e);if(!o.problems)return s;s||(s=n.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let h=0;h<u.rowspan;h++)i[c.row+h]+=c.n;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,un(u,u.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;s.setNodeMarkup(s.mapping.map(t+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}}let r,l;for(let a=0;a<i.length;a++)i[a]&&(r==null&&(r=a),l=a);for(let a=0,c=t+1;a<o.height;a++){const d=e.child(a),u=c+d.nodeSize,h=i[a];if(h>0){let f="cell";d.firstChild&&(f=d.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Ie(n.schema)[f].createAndFill();b&&p.push(b)}const m=(a==0||r==a-1)&&l==a?c+1:u-1;s.insert(s.mapping.map(m),p)}c=u}return s.setMeta(qm,{fixTables:!0})}function Tc(n){const e=n.selection,t=ki(n),s=t.node(-1),o=t.start(-1),i=G.get(s);return{...e instanceof K?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:s}}function Km(n){return function(e,t){if(!Ws(e))return!1;if(t){const s=Ie(e.schema),o=Tc(e),i=e.tr,r=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=r.map(a=>o.table.nodeAt(a));for(let a=0;a<r.length;a++)l[a].type==s.header_cell&&i.setNodeMarkup(o.tableStart+r[a],s.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<r.length;a++)i.setNodeMarkup(o.tableStart+r[a],s.header_cell,l[a].attrs);t(i)}return!0}}function Mc(n,e,t){const s=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<s.length;o++){const i=e.table.nodeAt(s[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function Ai(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Km(n):function(t,s){if(!Ws(t))return!1;if(s){const o=Ie(t.schema),i=Tc(t),r=t.tr,l=Mc("row",i,o),a=Mc("column",i,o),d=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:i.map.height}:n=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,h=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{const p=f+i.tableStart,m=r.doc.nodeAt(p);m&&r.setNodeMarkup(p,h,m.attrs)}),s(r)}return!0}}Ai("row",{useDeprecatedLogic:!0}),Ai("column",{useDeprecatedLogic:!0}),Ai("cell",{useDeprecatedLogic:!0});function Jm(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let s=n.index(-1)-1,o=n.before();s>=0;s--){const i=n.node(-1).child(s),r=i.lastChild;if(r)return o-1-r.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let s=n.indexAfter(-1),o=n.after();s<t.childCount;s++){const i=t.child(s);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function Ac(n){return function(e,t){if(!Ws(e))return!1;const s=Jm(ki(e),n);if(s==null)return!1;if(t){const o=e.doc.resolve(s);t(e.tr.setSelection(R.between(o,Bm(o))).scrollIntoView())}return!0}}function _s(n,e){const t=n.selection;if(!(t instanceof K))return!1;if(e){const s=n.tr,o=Ie(n.schema).cell.createAndFill().content;t.forEachCell((i,r)=>{i.content.eq(o)||s.replace(s.mapping.map(r+1),s.mapping.map(r+i.nodeSize-1),new M(o,0,0))}),s.docChanged&&e(s)}return!0}function Um(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:s}=n;for(;e.childCount==1&&(t>0&&s>0||e.child(0).type.spec.tableRole=="table");)t--,s--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,r=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,t-1),u=a<e.childCount-1?0:Math.max(0,s-1);(d||u)&&(c=Ei(Ie(r).row,new M(c,d,u)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||s?Ei(Ie(r).row,new M(e,t,s)).content:e);else return null;return Zm(r,l)}function Zm(n,e){const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(let r=i.childCount-1;r>=0;r--){const{rowspan:l,colspan:a}=i.child(r).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let s=0;for(let o=0;o<t.length;o++)s=Math.max(s,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(x.empty),t[o]<s){const i=Ie(n).cell.createAndFill(),r=[];for(let l=t[o];l<s;l++)r.push(i);e[o]=e[o].append(x.from(r))}return{height:e.length,width:s,rows:e}}function Ei(n,e){const t=n.createAndFill();return new Dl(t).replace(0,t.content.size,e).doc}function Ym({width:n,height:e,rows:t},s,o){if(n!=s){const i=[],r=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=i[l]||0,u=0;d<s;u++){let h=a.child(u%a.childCount);d+h.attrs.colspan>s&&(h=h.type.createChecked(un(h.attrs,h.attrs.colspan,d+h.attrs.colspan-s),h.content)),c.push(h),d+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)i[l+f]=(i[l+f]||0)+h.attrs.colspan}r.push(x.from(c))}t=r,n=s}if(e!=o){const i=[];for(let r=0,l=0;r<o;r++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);r+u.attrs.rowspan>o&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,o-u.attrs.rowspan)},u.content)),a.push(u)}i.push(x.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function Xm(n,e,t,s,o,i,r){const l=n.doc.type.schema,a=Ie(l);let c,d;if(o>e.width)for(let u=0,h=0;u<e.height;u++){const f=t.child(u);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=e.width;g<o;g++)p.push(m);n.insert(n.mapping.slice(r).map(h-1+s),p)}if(i>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,x.from(u)),f=[];for(let p=e.height;p<i;p++)f.push(h);n.insert(n.mapping.slice(r).map(s+t.nodeSize-2),f)}return!!(c||d)}function Ec(n,e,t,s,o,i,r,l){if(r==0||r==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const d=r*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){a=!0;const h=t.nodeAt(u),{top:f,left:p}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+s),null,{...h.attrs,rowspan:r-f}),n.insert(n.mapping.slice(l).map(e.positionAt(r,p,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-r})),c+=h.attrs.colspan-1}}return a}function Oc(n,e,t,s,o,i,r,l){if(r==0||r==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const d=c*e.width+r,u=e.map[d];if(e.map[d-1]==u){a=!0;const h=t.nodeAt(u),f=e.colCount(u),p=n.mapping.slice(l).map(u+s);n.setNodeMarkup(p,null,un(h.attrs,r-f,h.attrs.colspan-(r-f))),n.insert(p+h.nodeSize,h.type.createAndFill(un(h.attrs,0,r-f))),c+=h.attrs.rowspan-1}}return a}function Nc(n,e,t,s,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let r=G.get(i);const{top:l,left:a}=s,c=a+o.width,d=l+o.height,u=n.tr;let h=0;function f(){if(i=t?u.doc.nodeAt(t-1):u.doc,!i)throw new Error("No table found");r=G.get(i),h=u.mapping.maps.length}Xm(u,r,i,t,c,d,h)&&f(),Ec(u,r,i,t,a,c,l,h)&&f(),Ec(u,r,i,t,a,c,d,h)&&f(),Oc(u,r,i,t,l,d,a,h)&&f(),Oc(u,r,i,t,l,d,c,h)&&f();for(let p=l;p<d;p++){const m=r.positionAt(p,a,i),g=r.positionAt(p,c,i);u.replace(u.mapping.slice(h).map(m+t),u.mapping.slice(h).map(g+t),new M(o.rows[p-l],0,0))}f(),u.setSelection(new K(u.doc.resolve(t+r.positionAt(l,a,i)),u.doc.resolve(t+r.positionAt(d-1,c-1,i)))),e(u)}var Qm=ra({ArrowLeft:Gs("horiz",-1),ArrowRight:Gs("horiz",1),ArrowUp:Gs("vert",-1),ArrowDown:Gs("vert",1),"Shift-ArrowLeft":js("horiz",-1),"Shift-ArrowRight":js("horiz",1),"Shift-ArrowUp":js("vert",-1),"Shift-ArrowDown":js("vert",1),Backspace:_s,"Mod-Backspace":_s,Delete:_s,"Mod-Delete":_s});function qs(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Gs(n,e){return(t,s,o)=>{if(!o)return!1;const i=t.selection;if(i instanceof K)return qs(t,s,I.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const r=Pc(o,n,e);if(r==null)return!1;if(n=="horiz")return qs(t,s,I.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(r),a=xc(l,n,e);let c;return a?c=I.near(a,1):e<0?c=I.near(t.doc.resolve(l.before(-1)),-1):c=I.near(t.doc.resolve(l.after(-1)),1),qs(t,s,c)}}}function js(n,e){return(t,s,o)=>{if(!o)return!1;const i=t.selection;let r;if(i instanceof K)r=i;else{const a=Pc(o,n,e);if(a==null)return!1;r=new K(t.doc.resolve(a))}const l=xc(r.$headCell,n,e);return l?qs(t,s,new K(r.$anchorCell,l)):!1}}function eg(n,e){const t=n.state.doc,s=$n(t.resolve(e));return s?(n.dispatch(n.state.tr.setSelection(new K(s))),!0):!1}function tg(n,e,t){if(!Ws(n.state))return!1;let s=Um(t);const o=n.state.selection;if(o instanceof K){s||(s={width:1,height:1,rows:[x.from(Ei(Ie(n.state.schema).cell,t))]});const i=o.$anchorCell.node(-1),r=o.$anchorCell.start(-1),l=G.get(i).rectBetween(o.$anchorCell.pos-r,o.$headCell.pos-r);return s=Ym(s,l.right-l.left,l.bottom-l.top),Nc(n.state,n.dispatch,r,l,s),!0}else if(s){const i=ki(n.state),r=i.start(-1);return Nc(n.state,n.dispatch,r,G.get(i.node(-1)).findCell(i.pos-r),s),!0}else return!1}function ng(n,e){var t;if(e.ctrlKey||e.metaKey)return;const s=Ic(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof K)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&s&&(o=$n(n.state.selection.$anchor))!=null&&((t=Oi(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!s)return;function i(a,c){let d=Oi(n,c);const u=it.getState(n.state)==null;if(!d||!Mi(a,d))if(u)d=a;else return;const h=new K(a,d);if(u||!n.state.selection.eq(h)){const f=n.state.tr.setSelection(h);u&&f.setMeta(it,a.pos),n.dispatch(f)}}function r(){n.root.removeEventListener("mouseup",r),n.root.removeEventListener("dragstart",r),n.root.removeEventListener("mousemove",l),it.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(it,-1))}function l(a){const c=a,d=it.getState(n.state);let u;if(d!=null)u=n.state.doc.resolve(d);else if(Ic(n,c.target)!=s&&(u=Oi(n,e),!u))return r();u&&i(u,c)}n.root.addEventListener("mouseup",r),n.root.addEventListener("dragstart",r),n.root.addEventListener("mousemove",l)}function Pc(n,e,t){if(!(n.state.selection instanceof R))return null;const{$head:s}=n.state.selection;for(let o=s.depth-1;o>=0;o--){const i=s.node(o);if((t<0?s.index(o):s.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=s.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Ic(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Oi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?$n(n.state.doc.resolve(t.pos)):null}var sg=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ni(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ni(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ni(n,e,t,s,o,i){var r;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let u=0,h=0;u<d.childCount;u++){const{colspan:f,colwidth:p}=d.child(u).attrs;for(let m=0;m<f;m++,h++){const g=o==h?i:p&&p[m],b=g?g+"px":"";if(l+=g||s,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=b,e.appendChild(C)}}}for(;c;){const u=c.nextSibling;(r=c.parentNode)==null||r.removeChild(c),c=u}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var pe=new En("tableColumnResizing");function og({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:s=sg,lastColumnResizable:o=!0}={}){const i=new An({key:pe,state:{init(r,l){var a,c;const d=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,u=Ie(l.schema).table.name;return s&&d&&(d[u]=(h,f)=>new s(h,t,f)),new ig(-1,!1)},apply(r,l){return l.apply(r)}},props:{attributes:r=>{const l=pe.getState(r);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(r,l)=>{rg(r,l,n,o)},mouseleave:r=>{lg(r)},mousedown:(r,l)=>{ag(r,l,e,t)}},decorations:r=>{const l=pe.getState(r);if(l&&l.activeHandle>-1)return fg(r,l.activeHandle)},nodeViews:{}}});return i}var ig=class Xs{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,s=e.getMeta(pe);if(s&&s.setHandle!=null)return new Xs(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Xs(t.activeHandle,s.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Ti(e.doc.resolve(o))||(o=-1),new Xs(o,t.dragging)}return t}};function rg(n,e,t,s){const o=pe.getState(n.state);if(o&&!o.dragging){const i=dg(e.target);let r=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?r=Rc(n,e,"left",t):a-e.clientX<=t&&(r=Rc(n,e,"right",t))}if(r!=o.activeHandle){if(!s&&r!==-1){const l=n.state.doc.resolve(r),a=l.node(-1),c=G.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}zc(n,r)}}}function lg(n){const e=pe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&zc(n,-1)}function ag(n,e,t,s){var o;const i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,r=pe.getState(n.state);if(!r||r.activeHandle==-1||r.dragging)return!1;const l=n.state.doc.nodeAt(r.activeHandle),a=cg(n,r.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(pe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const h=pe.getState(n.state);h!=null&&h.dragging&&(ug(n,h.activeHandle,Dc(h.dragging,u,t)),n.dispatch(n.state.tr.setMeta(pe,{setDragging:null})))}function d(u){if(!u.which)return c(u);const h=pe.getState(n.state);if(h&&h.dragging){const f=Dc(h.dragging,u,t);Lc(n,h.activeHandle,f,s)}}return Lc(n,r.activeHandle,a,s),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function cg(n,e,{colspan:t,colwidth:s}){const o=s&&s[s.length-1];if(o)return o;const i=n.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=t;if(s)for(let c=0;c<t;c++)s[c]&&(l-=s[c],a--);return l/a}function dg(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Rc(n,e,t,s){const o=t=="right"?-s:s,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:r}=i,l=$n(n.state.doc.resolve(r));if(!l)return-1;if(t=="right")return l.pos;const a=G.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function Dc(n,e,t){const s=e.clientX-n.startX;return Math.max(t,n.startWidth+s)}function zc(n,e){n.dispatch(n.state.tr.setMeta(pe,{setHandle:e}))}function ug(n,e,t){const s=n.state.doc.resolve(e),o=s.node(-1),i=G.get(o),r=s.start(-1),l=i.colCount(s.pos-r)+s.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){const d=c*i.width+l;if(c&&i.map[d]==i.map[d-i.width])continue;const u=i.map[d],h=o.nodeAt(u).attrs,f=h.colspan==1?0:l-i.colCount(u);if(h.colwidth&&h.colwidth[f]==t)continue;const p=h.colwidth?h.colwidth.slice():hg(h.colspan);p[f]=t,a.setNodeMarkup(r+u,null,{...h,colwidth:p})}a.docChanged&&n.dispatch(a)}function Lc(n,e,t,s){const o=n.state.doc.resolve(e),i=o.node(-1),r=o.start(-1),l=G.get(i).colCount(o.pos-r)+o.nodeAfter.attrs.colspan-1;let a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ni(i,a.firstChild,a,s,l,t)}function hg(n){return Array(n).fill(0)}function fg(n,e){var t;const s=[],o=n.doc.resolve(e),i=o.node(-1);if(!i)return _.empty;const r=G.get(i),l=o.start(-1),a=r.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<r.height;c++){const d=a+c*r.width;if((a==r.width-1||r.map[d]!=r.map[d+1])&&(c==0||r.map[d]!=r.map[d-r.width])){const u=r.map[d],h=l+u+i.nodeAt(u).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=pe.getState(n))!=null&&t.dragging&&s.push(ue.node(l+u,l+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),s.push(ue.widget(h,f))}}return _.create(n.doc,s)}function pg({allowTableNodeSelection:n=!1}={}){return new An({key:it,state:{init(){return null},apply(e,t){const s=e.getMeta(it);if(s!=null)return s==-1?null:s;if(t==null||!e.docChanged)return t;const{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:$m,handleDOMEvents:{mousedown:ng},createSelectionBetween(e){return it.getState(e.state)!=null?e.state.selection:null},handleTripleClick:eg,handleKeyDown:Qm,handlePaste:tg},appendTransaction(e,t,s){return _m(s,Gm(s,t),n)}})}const Fn=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},Vc="data-gs-mrk-fs",Bc="data-gs-ib",Ks="data-gs-ifrg",$e="attrs",Hc={[$e]:{default:"{}"}},Fe={[$e]:{default:{}}},$c=n=>({[$e]:JSON.stringify(Fn(n))}),We=n=>({attrs:Fn(n)}),Wn=n=>e=>[n,e.attrs.attrs,0],rt=n=>n.attrs[$e]?JSON.parse(n.attrs[$e]):{},mg={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${Ks}]`,getAttrs:We}],toDOM:()=>["span",{[Ks]:""},0]},div:{group:"block",content:"inline*",attrs:Fe,parseDOM:[{tag:"div",getAttrs:We}],toDOM:Wn("div")},paragraph:{group:"block",content:"inline*",attrs:Fe,parseDOM:[{tag:"p",getAttrs:We}],toDOM:Wn("p")},orderedList:{group:"block",content:"listItem+",attrs:Fe,parseDOM:[{tag:"ol",getAttrs:We}],toDOM:Wn("ol")},bulletList:{group:"block",content:"listItem+",attrs:Fe,parseDOM:[{tag:"ul",getAttrs:We}],toDOM:Wn("ul")},listItem:{content:"block*",group:"block",attrs:Fe,parseDOM:[{tag:"li",getAttrs:We}],toDOM:Wn("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Fe,parseDOM:[{tag:"pre",getAttrs:We}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Fe,parseDOM:[{tag:"img[src]",getAttrs:We}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${Bc}]`}],toDOM(){return["br",{[Bc]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:Fe,parseDOM:[{tag:"br",getAttrs:We}],toDOM:n=>["br",{...n.attrs.attrs}]},heading:{group:"block",content:"inline*",attrs:{level:{default:1},attrs:{default:{}}},defining:!0,parseDOM:Array.from({length:6},(n,e)=>({tag:`h${e+1}`,getAttrs:t=>({level:e+1,attrs:Fn(t)})})),toDOM({attrs:n}){const{level:e}=n;return[e?`h${e}`:"div",n.attrs,0]}},...Lm({tableGroup:"block",cellContent:"block+",cellAttributes:{[$e]:{default:Fe[$e].default,getFromDOM:Fn,setDOMAttr:(n,e)=>{n&&Object.assign(e,n)}},background:{default:null,getFromDOM(n){return n.style.backgroundColor||null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`background-color: ${n};`)}}}}),nonTextNode:{group:"block",content:"block*",attrs:{tagName:{default:"span"},attrs:{default:{}}},parseDOM:[{tag:"*:not(tbody)",getAttrs:n=>({tagName:n.tagName.toLowerCase(),attrs:Fn(n)}),priority:0}],toDOM(n){const{tagName:e,attrs:t}=n.attrs;return[e,t,0]}}},_n=(n,e)=>({attrs:Hc,parseDOM:n.map(t=>({tag:t,getAttrs:$c})),toDOM:e}),gg={strong:_n(["strong","b"],n=>["b",rt(n)]),link:_n(["a"],n=>["a",rt(n),0]),em:_n(["em","i"],n=>["em",rt(n)]),underline:_n(["u"],n=>["u",rt(n),0]),strikethrough:_n(["s"],n=>["s",rt(n),0]),font_size:{attrs:{...Hc,size:{default:null}},parseDOM:[{tag:`span[${Vc}]`,getAttrs:n=>({...$c(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...rt(n),[Vc]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}}},Fc=new zh({nodes:mg,marks:gg}),Js=new WeakMap,Pi=new WeakMap,yg=(n,e)=>{Js.set(n,e),Pi.set(e,n)},bg=(n,e)=>{Js.delete(n),Pi.delete(e)},Ii=n=>Js.get(n),vg=n=>Pi.get(n),Wc=n=>{var t;const e=vg(n);return(t=e==null?void 0:e.__gjsv)==null?void 0:t.model},Sg=n=>n.dispatchEvent(new CustomEvent("input"));function wg(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(Ks)){if(t.getAttribute("style")){t.removeAttribute(Ks);return}const s=t.parentElement;if(s){for(;t.firstChild;)s.insertBefore(t.firstChild,t);s.removeChild(t)}}else Array.from(t.children).forEach(s=>e(s))};e(n)}function Cg(n,e={}){if(!e.enableOnClick)return()=>{};const t=n.Components.events,s=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),i=d=>d.isChildOf("text"),r=d=>n.getEditing()===d,l=(d,u={})=>{d.trigger("focus",u.event)},a=(d,u)=>{s(d)&&o(d)&&!r(d)&&l(d,u)},c=(d,u)=>{if(s(d)&&!o(d)&&i(d)){const h=d.parents().find(f=>f.isInstanceOf("text"));h&&(l(h,u),setTimeout(()=>n.select(h),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const xg=(n,e)=>{const t=kg(n);return t&&Rg(t)?Tg(n,e):t?Ul(()=>({type:n.schema.nodes.div}))(n,e):!1};function kg(n){const e=n.selection.$from;if(e.node(e.depth).type===n.schema.nodes.inlineFragment){const t=e.depth-1;return e.node(t)}return e.node(e.depth)}function Tg(n,e){const{selection:t,schema:s,tr:o}=n;o.split(t.from,1);const i=t.from+1,r=o.doc.nodeAt(i),l={...r.attrs.attrs,id:void 0},a=r.textContent.length>0,c=r.textContent.length||0,d=r.textContent||" ",u=s.text(d),h=s.nodes.div.create(l,a?u:[],[]);return o.replaceRangeWith(i,i+c+2,h),o.setSelection(R.create(o.doc,i+1)),e==null||e(o.scrollIntoView()),!0}function Mg(n,e,t){const{state:s,dispatch:o}=n,{selection:i,tr:r}=s,l=(a,c,d)=>{const u={};return a.split(";").forEach(h=>{const[f,p]=h.split(":").map(m=>m.trim());f&&(u[f]=p)}),u[c]=d,Object.entries(u).map(([h,f])=>`${h}: ${f}`).join("; ")};if(!i.empty||t)r.doc.nodesBetween(i.from,i.to,(a,c)=>{var d,u;if(a.type===s.schema.nodes.image){const h=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);r.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:h}})}else if(a.type.isBlock){const h=l(((u=a.attrs.attrs)==null?void 0:u.style)||"","text-align",e);_c(a)?r.setBlockType(i.from,void 0,s.schema.nodes.div,{attrs:{style:h}}):r.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:h}})}});else{const a=s.doc.resolve(i.from),c=a.start(a.depth),d=s.doc.nodeAt(c);if(d!=null&&d.type.isBlock){const u=l(d.attrs.style||"","text-align",e);r.setNodeMarkup(c,void 0,{...d.attrs,style:u})}}r.docChanged&&o(r.scrollIntoView())}const qn=(n,e)=>{const{from:t,to:s}=n.selection;let o=!1;return n.doc.nodesBetween(t,s,i=>{if(o)return!1;i.marks.some(r=>r.type===e)&&(o=!0)}),o};function Ag(n,e,t="_blank"){const{state:s,dispatch:o}=n,{schema:i,selection:r,tr:l}=s,a=i.marks.link;try{const c=a.create({[$e]:JSON.stringify({href:e,target:t})});l.addMark(r.from,r.to,c),o(l.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function Eg(n,e){const{state:t,dispatch:s}=n,{selection:o,tr:i}=t;if(o.empty)return;const r=t.schema.marks.font_size;if(!r){console.error("Font size mark is not defined in the schema.");return}i.addMark(o.from,o.to,r.create({size:e})),s(i.scrollIntoView())}const Rt=(n,e)=>{const{doc:t,selection:s}=n.state,o=t.resolve(s.from);for(let i=o.depth;i>0;i--){const r=o.node(i);if(e(r))return{pos:i>0?o.before(i):0,start:o.start(i),depth:i,node:r}}},Og=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,s])=>(t=t.replace(/-./g,o=>o.toUpperCase()[1]).trim(),e[t]=`${s}`.trim(),e),{});function Ng(...n){return(e,t)=>{const s=r=>{e=e.apply(r),t==null||t(r)},o=n.pop();return n.reduce((r,l)=>r||l(e,s),!1)&&o!==void 0&&o(e,t)}}const Pg=(n,e)=>{const{state:t,dispatch:s}=n;if(e!=null&&e.event){const{event:o}=e,i=n.posAtCoords({left:o.clientX,top:o.clientY});i!=null&&i.pos&&s(t.tr.setSelection(R.create(t.doc,i.pos)))}else Zl(t,s);setTimeout(()=>setTimeout(()=>n.focus()))},Ri=n=>n.isBlock,_c=n=>n.type.name==="inlineFragment",Ig=n=>Ri(n)&&!_c(n),qc=n=>n.type.name==="bulletList",Gc=n=>n.type.name==="orderedList",Rg=n=>n.type.name==="heading",Dg=n=>qc(n)||Gc(n),jc=(n,e)=>{var i,r;const t=(i=Rt(n,l=>l.type===e))==null?void 0:i.node,s=n.state.schema.nodes.listItem;let o;return t?o=Xo(s):(r=Rt(n,Dg))!=null&&r.node?o=Ng(Xo(s),la(e)):o=la(e),o(n.state,n.dispatch)},Kc=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(s=>s.type.name===e)},zg=n=>{var r;const{view:e,prop:t,editor:s,propCSS:o}=n,i=(r=Rt(e,Ig))==null?void 0:r.node;if(i){const l=i.attrs.attrs||{},a=Og(l.style);if(t in a)return a[t]||"";if(l.id){const c=s.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[o]||""}}return""},Lg=n=>{const{view:e,prop:t,markName:s,editor:o,propCSS:i}=n,r=Kc(e,s);if(r){const l=r.attrs;if(l[t])return l[t];if(l[$e]){const a=rt(r).id;if(a){const c=o.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[i]||""}}}return""},Jc=(n,e)=>{const{dispatch:t}=n,{nodes:s,marks:o}=n.state.schema;return{text:{selected:()=>{const{selection:i,doc:r}=n.state;return r.textBetween(i.from,i.to," ")},replace:(i,r={})=>{const{state:l}=n,{from:a}=l.selection;let c=l.tr.replaceSelectionWith(l.schema.text(i));r.select&&(c=c.setSelection(R.create(c.doc,a,a+i.length))),t==null||t(c)}},bold:{toggle:()=>kt(o.strong)(n.state,t),isActive:()=>qn(n.state,o.strong)},italic:{toggle:()=>kt(o.em)(n.state,t),isActive:()=>qn(n.state,o.em)},underline:{toggle:()=>kt(o.underline)(n.state,t),isActive:()=>qn(n.state,o.underline)},strikethrough:{toggle:()=>kt(o.strikethrough)(n.state,t),isActive:()=>qn(n.state,o.strikethrough)},link:{get:()=>{const i=Wc(n);if(i!=null&&i.is("link"))return i.getAttributes();{const r=Kc(n,"link");return r?rt(r):{}}},toggle:()=>kt(o.link)(n.state,t),isActive:()=>qn(n.state,o.link),create:i=>{const r=Wc(n);r!=null&&r.is("link")?(r.addAttributes({href:i.url,target:i.target}),n.focus()):Ag(n,i.url,i.target)}},alignText:{get:()=>zg({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:i=>Mg(n,i.value,!0)},fontSize:{get:()=>Lg({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:i=>Eg(n,i.value)},image:{open(){const i="assetLayout",{state:r,dispatch:l}=n,{selection:a,doc:c}=r,d=c.textBetween(a.from,a.to," "),u={id:i,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:h=>{const f={alt:d,src:h.asset.getSrc()};l(r.tr.replaceSelectionWith(s.image.createAndFill({attrs:f})))}}};e.runCommand(B.layoutToggle,u)}},heading:{get:()=>{var r;const i=(r=Rt(n,Ri))==null?void 0:r.node;return`${(i==null?void 0:i.attrs.level)||""}`},set:({value:i})=>{var a;const{state:r}=n,l=(a=Rt(n,Ri))==null?void 0:a.node;Of(r.schema.nodes.heading,{attrs:l==null?void 0:l.attrs.attrs,level:i?parseInt(i,10):0})(r,t)}},listBullet:{isActive:()=>{var i;return!!((i=Rt(n,qc))!=null&&i.node)},toggle:()=>jc(n,s.bulletList)},listOrdered:{isActive:()=>{var i;return!!((i=Rt(n,Gc))!=null&&i.node)},toggle:()=>jc(n,s.orderedList)}}},xe="rte:selectionchange",be={bold:'<svg viewBox="0 0 24 24"><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',italic:'<svg viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',underline:'<svg viewBox="0 0 24 24"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z" /></svg>',strikethrough:'<svg viewBox="0 0 24 24"><path d="M7.2 9.8c-1.2-2.3.5-5 2.9-5.5 3.1-1 7.6.4 7.5 4.2h-3l-.1-.8c-.2-.6-.6-.9-1.2-1.1-.8-.3-2.1-.2-2.8.3C9 8.2 10.4 9.5 12 10H7.4l-.2-.2M21 13v-2H3v2h9.6l.6.2c.6.3 1.1.5 1.3 1.1.1.4.2.9 0 1.3-.2.5-.6.7-1.1.9-1.8.5-4-.2-3.9-2.4h-3c-.1 2.6 2.1 4.4 4.5 4.7 3.8.8 8.3-1.6 6.3-5.9l3.7.1Z"/></svg>',link:'<svg viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',image:'<svg viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z"></path></svg>',listBullet:'<svg viewBox="0 0 24 24"><path d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6 1.5 1.5 0 0 1 4 7.5 1.5 1.5 0 0 1 2.5 6 1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12 1.5 1.5 0 0 1 4 13.5 1.5 1.5 0 0 1 2.5 12 1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18 1.5 1.5 0 0 1 4 19.5 1.5 1.5 0 0 1 2.5 18 1.5 1.5 0 0 1 4 16.5Z"/></svg>',listOrdered:'<svg viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.3-7a.8.8 0 0 1 .7.8c0 .1 0 .3-.2.5L3 13h2v1H2v-1l2-2H2v-1h2.3Z"/></svg>',alignTextLeft:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H15V9H3V7M3,11H21V13H3V11M3,15H15V17H3V15M3,19H21V21H3V19Z" /></svg>',alignTextCenter:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M7,7H17V9H7V7M3,11H21V13H3V11M7,15H17V17H7V15M3,19H21V21H3V19Z" /></svg>',alignTextRight:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M9,7H21V9H9V7M3,11H21V13H3V11M9,15H21V17H9V15M3,19H21V21H3V19Z" /></svg>',alignTextJustify:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H21V9H3V7M3,11H21V13H3V11M3,15H21V17H3V15M3,19H21V21H3V19Z" /></svg>'},Vg=(n,e)=>{var a;const{editor:t,el:s}=n,o=Js.get(s),i=Jc(o,t),r={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:be.bold,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.bold.isActive()})}},onClick:({setState:c})=>{i.bold.toggle(),c({active:i.bold.isActive()})}},italic:{id:"italic",icon:be.italic,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.italic.isActive()})}},onClick:({setState:c})=>{i.italic.toggle(),c({active:i.italic.isActive()})}},underline:{id:"underline",icon:be.underline,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.underline.isActive()})}},onClick:({setState:c})=>{i.underline.toggle(),c({active:i.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:be.strikethrough,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.strikethrough.isActive()})}},onClick:({setState:c})=>{i.strikethrough.toggle(),c({active:i.strikethrough.isActive()})}},image:{id:"image",icon:be.image,size:"s",type:"button",onClick:()=>i.image.open()},link:{id:"link",icon:be.link,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.link.isActive(),disabled:o.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,{x:u,y:h,width:f,height:p}=d.getBoundingClientRect(),m="linkLayout",g=()=>t.runCommand(B.layoutRemove,{id:m}),b=i.link.get(),C={id:m,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:u,y:h,w:f,h:p},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);i.link.create({url:v.get("url"),target:v.get("target")}),g()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(b==null?void 0:b.href)||"",onChange:({value:y,setState:v})=>v({value:y})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(b==null?void 0:b.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:y,setState:v})=>v({value:y})},{type:"row",style:{gap:10,justifyContent:"end"},children:[i.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{i.link.toggle(),g()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(B.layoutToggle,C)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:be.alignTextLeft},{id:"center",icon:be.alignTextCenter},{id:"right",icon:be.alignTextRight},{id:"justify",icon:be.alignTextJustify}],editorEvents:{[xe]:({setState:c})=>{c({value:i.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:be.listBullet,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.listBullet.isActive()})}},onClick:({setState:c})=>{i.listBullet.toggle(),c({active:i.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:be.listOrdered,size:"s",type:"button",editorEvents:{[xe]:({setState:c})=>{c({active:i.listOrdered.isActive()})}},onClick:({setState:c})=>{i.listOrdered.toggle(),c({active:i.listOrdered.isActive()})}},heading:{id:"heading",type:"selectField",size:"s",value:"",emptyState:"Heading",options:[{id:"",label:"Normal"},{id:"1",label:"Heading 1"},{id:"2",label:"Heading 2"},{id:"3",label:"Heading 3"},{id:"4",label:"Heading 4"},{id:"5",label:"Heading 5"},{id:"6",label:"Heading 6"}],editorEvents:{[xe]:({setState:c})=>{c({value:i.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.heading.set({value:c}),o.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"Font size",options:[{id:"8pt",label:"8pt"},{id:"10pt",label:"10pt"},{id:"12pt",label:"12pt"},{id:"14pt",label:"14pt"},{id:"18pt",label:"18pt"},{id:"24pt",label:"24pt"},{id:"36pt",label:"36pt"}],editorEvents:{[xe]:({setState:c})=>{c({value:i.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),i.fontSize.set({value:c}),o.focus()}}},l=[r.bold,r.italic,r.underline,r.strikethrough,r.image,r.link,r.listBullet,r.listOrdered,r.alignText,r.heading,r.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:i,layouts:r,proseMirror:{view:o},items:l}))||l};class Bg{constructor(e,t,s){this.editor=s,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(o=>{this.dom.setAttribute(o,e.attrs.attrs[o])}),this.dom.addEventListener("dblclick",o=>this.handleDoubleClick(o))}handleDoubleClick(e){const{editor:t,view:s}=this;Jc(s,t).image.open(),e.preventDefault()}update(e){return e.type!==this.node.type?!1:(this.node=e,Object.keys(e.attrs.attrs).forEach(t=>{this.dom.setAttribute(t,e.attrs.attrs[t])}),!0)}selectNode(){this.dom.style.outline="2px solid #ffca6f"}deselectNode(){this.dom.style.outline=""}}class lt{constructor(e,t,s={}){this.match=e,this.match=e,this.handler=typeof t=="string"?Hg(t):t,this.undoable=s.undoable!==!1,this.inCode=s.inCode||!1}}function Hg(n){return function(e,t,s,o){let i=n;if(t[1]){let r=t[0].lastIndexOf(t[1]);i+=t[0].slice(r+t[1].length),s+=r;let l=s-o;l>0&&(i=t[0].slice(r-l,r)+i,s=o)}return e.tr.insertText(i,s,o)}}const $g=500;function Fg({rules:n}){let e=new An({state:{init(){return null},apply(t,s){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:s)}},props:{handleTextInput(t,s,o,i){return Uc(t,s,o,i,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:s}=t.state.selection;s&&Uc(t,s.pos,s.pos,"",n,e)})}}},isInputRules:!0});return e}function Uc(n,e,t,s,o,i){if(n.composing)return!1;let r=n.state,l=r.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-$g),l.parentOffset,null,"")+s;for(let c=0;c<o.length;c++){let d=o[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let u=d.match.exec(a),h=u&&d.handler(r,u,e-(u[0].length-s.length),t);if(h)return d.undoable&&h.setMeta(i,{transform:h,from:e,to:t,text:s}),n.dispatch(h),!0}return!1}const Wg=new lt(/--$/,"—"),_g=new lt(/\.\.\.$/,"…"),qg=new lt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Gg=new lt(/"$/,"”"),jg=new lt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Kg=new lt(/'$/,"’"),Jg=[qg,Gg,jg,Kg];function Di(n,e,t=null,s){return new lt(n,(o,i,r,l)=>{let a=t instanceof Function?t(i):t,c=o.tr.delete(r,l),d=c.doc.resolve(r),u=d.blockRange(),h=u&&Ml(u,e,a);if(!h)return null;c.wrap(u,h);let f=c.doc.resolve(r-1).nodeBefore;return f&&f.type==e&&Es(c.doc,r-1)&&(!s||s(i,f))&&c.join(r-1),c})}function Zc(n,e,t=null){return new lt(n,(s,o,i,r)=>{let l=s.doc.resolve(i),a=t instanceof Function?t(o):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?s.tr.delete(i,r).setBlockType(i,i,e,a):null})}function Ug(n){return Di(/^\s*>\s$/,n)}function Zg(n){return Di(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function Yg(n){return Di(/^\s*([-+*])\s$/,n)}function Xg(n){return Zc(/^```$/,n)}function Qg(n,e){return Zc(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function e1(n){const e=Jg.concat(_g,Wg);let t;return(t=n.nodes.blockquote)&&e.push(Ug(t)),(t=n.nodes.orderedList)&&e.push(Zg(t)),(t=n.nodes.bulletList)&&e.push(Yg(t)),(t=n.nodes.codeBlock)&&e.push(Xg(t)),(t=n.nodes.heading)&&e.push(Qg(t,6)),Fg({rules:e})}const t1="rteProseMirror",n1=X(function(n,e={}){const t={plugins:r=>r.plugins,...e},s=(r,l)=>{var p,m;const a=((p=t.schema)==null?void 0:p.call(t,{editor:n,schema:Fc}))||Fc,{nodes:c,marks:d}=a,u=Zt.fromSchema(a).parse(r),h=sn.create({doc:u,schema:a,plugins:(m=t.plugins)==null?void 0:m.call(t,{editor:n,plugins:[og(),pg(),e1(a),$f(),Yo({Tab:Ac(1),"Shift-Tab":Ac(-1)}),Yo({Enter:On(Jl,Jf(c.listItem),xg),"Shift-Enter":On(Kl,(g,b)=>(b&&b(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":ia,"Mod-y":Jo,"Mod-Shift-z":Jo,"Mod-b":kt(d.strong),"Mod-i":kt(d.em),"Shift-Tab":Xo(c.listItem),Tab:Yf(c.listItem)}),Yo(Pf)]})}),f=new Om({mount:r},{state:h,dispatchTransaction(g){var S;const{state:b}=f,C=b.apply(g),y=!b.doc.eq(C.doc);f.updateState(C);const v=!b.selection.eq(C.selection);y&&(Sg(((S=l==null?void 0:l.view)==null?void 0:S.el)||r),f.focus()),(v||y)&&n.trigger(xe)}});return r.__rteView=f,f.setProps({nodeViews:{image(g){return new Bg(g,f,n)}}}),f},o=r=>Vg(r,t);n.setCustomRte({toolbar:o,parseContent:!0,async enable(r,l,a){const c=Ii(r);if(c)return c;const d=s(r,a);return yg(r,d),Pg(d,a),d},disable(r){const l=Ii(r);if(l)return bg(r,l),l.destroy(),{forceSync:!0}},getContent(r){const l=Ii(r);if(l){const{schema:a,doc:c}=l.state,d=document.createElement("div"),u=xt.fromSchema(a).serializeFragment(c.content);return u.childNodes.forEach(h=>{h.nodeType===Node.ELEMENT_NODE&&h.innerHTML===""&&(h.innerHTML="<br/>")}),d.appendChild(u),wg(d),r.classList.remove("ProseMirror-focused"),d.innerHTML}return r.innerHTML}});const i=Cg(n,t);Q({editor:n,licenseKey:t.licenseKey,plan:F.free,pluginName:t1,cleanup:()=>{n.RichTextEditor.customRte=void 0,i()}})}),s1="canvasEmptyState",o1=X(function(n,e={}){const t=new WeakMap,s=new WeakMap,o=new WeakMap,i=new Set,r=new WeakMap,l={emptyStates:[],...e},a=(y,v)=>{let S=!1;const{isValid:w}=v;return Array.isArray(w)?S=w.some(k=>y.is(k)):Un(w)?S=w({component:y,editor:n}):S=y.is(w),S},c=y=>{const v=t.get(y);t.delete(y),v==null||v()},d=y=>{y.views.forEach(v=>c(v)),o.delete(y)},u=y=>{if(!(!y||i.has(y)))try{i.add(y);const v=y.components().length>0,S=o.get(y);if(v&&S)d(y);else if(!v&&!S){const w=r.has(y)?r.get(y):l.emptyStates.find(k=>a(y,k));if(r.set(y,w),!w)return;y.views.forEach(k=>{const E=w.render({editor:n,component:y,componentView:k,mount:T=>{s.set(k,T),o.set(y,!0);const A=k.getChildrenContainer();A==null||A.appendChild(T)},unmount:()=>c(k)});t.set(k,()=>{E==null||E();const T=s.get(k);T==null||T.remove()})})}}finally{i.delete(y)}},h=y=>{o.has(y)&&d(y)},f=({model:y})=>{u(y.getComponent())},p=n.Components.events,m=`${p.update}:components`,g="component:mount",b=n.Canvas.events.frameLoadBody,C=p.removed;n.on(m,u),n.on(g,u),n.on(C,h),n.on(b,f),Q({editor:n,licenseKey:l.licenseKey,plan:F.startup,pluginName:s1,cleanup:()=>{n.off(m,u),n.off(g,u),n.off(C,h),n.off(b,f)}})}),Yc="canvasFullSize",i1=X(function(n,e={}){const{Canvas:t,Commands:s,Devices:o}=n,i={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...e},{canvasOffsetY:r,canvasOffsetX:l,canvasTransition:a,deviceMaxWidth:c,deviceMinHeigth:d,frameBorderRadius:u,frameTransition:h}=i,f=`${d}px`,p=t.events,m=`${s.events.stopCommand}core:preview`,g=t.getConfig(),b=`${Yc}:disable`,C=o.getAll().map(v=>({...v.attributes}));g.scrollableCanvas=!0,o.getAll().map(v=>{!v.get("width")&&v.set("width",`${c}px`),!v.get("height")&&v.set("height","auto"),!v.get("minHeight")&&v.set("minHeight",f)});const y=v=>{const S="data-gs-plg-full-size",w=document.querySelector(`style[${S}]`);if(v&&w)return w.remove();const k=w||document.createElement("style"),E=t.getZoomMultiplier();k.setAttribute(S,"true"),k.innerHTML=`
200
200
  .gjs-frame-wrapper { transition: width ${h}s !important; }
201
201
  .gjs-frame-wrapper__bottom { height: ${r*E}px }
202
202
  .gjs-frame { border-radius: ${u}px }
203
- `,!S&&document.body.appendChild(k)};n.on(p.frameLoadHead,v=>{if(!g.scrollableCanvas)return;const{window:w}=v,S=w.document,k=S.head,E="data-gs-plg-wrapper-style",T=k.querySelector(`style[${E}]`)||S.createElement("style");T.setAttribute(E,"true"),T.innerHTML=`[data-gjs-type="wrapper"] { min-height: ${f}; }`,!k.contains(T)&&k.appendChild(T)}),n.onReady(()=>{const v=t.getSpotsEl(),w=t.getElement(),S=t.getFramesEl(),k=a*1e3,E=w.style;E.overflowX="hidden",S.style.transition=`transform ${a}s`;const T={x:l,y:r};y();const A=()=>v.style.display="none",P=()=>v.style.display="",D=no(()=>{t.fitViewport({zoom:Me=>Me>100?100:Me,ignoreHeight:!0,gap:T}),y(),setTimeout(()=>{var Me,Re;n.em.destroyed||((Re=(Me=n.getSelected())==null?void 0:Me.getEl())==null||Re.scrollIntoView({block:"nearest"}),n.refresh({tools:!0}),P())},k)},100),L=new ResizeObserver(()=>{A(),D()});L.observe(w.parentElement);const B=()=>{A(),D()},ke=(Me={})=>{Me.options&&Me.options.from!=="fitViewport"&&t.fitViewport({zoom:t.getZoom(),ignoreHeight:!0,gap:T})},Te=()=>{E.overflowX="hidden",E.overflowY="auto"},Rt=()=>{L.disconnect(),D.clear()};n.on(o.events.select,B),n.on(p.zoom,ke),n.on(m,Te),n.on(n.events.destroy,Rt),D(),s.add(b,()=>{o.devices.reset(C),g.scrollableCanvas=!1,t.getModel().updateDevice(),t.setZoom(100),t.setCoords(0,0),E.overflowY="hidden",y(!0),n.off(o.events.select,B),n.off(p.zoom,ke),n.off(m,Te),Rt(),s.run("studio:canvasReload")})}),se({editor:n,licenseKey:i.licenseKey,plan:W.startup,pluginName:jc,cleanup:()=>{n.runCommand(b)}})}),Ug=n=>{const e={};for(const t of Object.keys(n)){let s=n[t];s&&(Array.isArray(s)?s=s.map(o=>o.toString()).join(","):s=s.toString(),e[t]=s)}return new URLSearchParams(e)},Zg=n=>{const{apiKey:e,searchParams:t,thumbnailQuality:s="high"}=n,o=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",d=Ug(l);return`${c}?${d}`},i=l=>{var a,c,d;return((a=l[s])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((d=l.medium)==null?void 0:d.url)||l.default.url},r=l=>{const a=i(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:["youtube-video"],label:({editor:l})=>l.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:l,pageCustomData:a}){var m;const c={maxResults:25,q:l,pageToken:a==null?void 0:a.token,type:["video"],key:e},d=t==null?void 0:t({searchValue:l}),u={...c,...d};u.part?u.part.includes("snippet")||u.part.push("snippet"):u.part=["snippet"];const f=await(await fetch(o(u))).json();return(m=f.items)!=null&&m.length?{items:f.items.map(r),nextPageCustomData:{token:f.nextPageToken},isLastPage:!f.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:l,onSelect:a})=>({type:"column",onClick:()=>a(l),htmlAttrs:{title:l.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=l.customData)==null?void 0:c.thumbnailUrl}" alt="${l.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:l.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},Yg={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},Xg="youtubeAssetProvider",Qg=ne(function(n,e){var c;const{skipVideoComponent:t,i18n:s={}}=e,o=Zg(e);n.runCommand(G.assetProviderAdd,{provider:o});const i="search-on-youtube",r="video",l=(c=n.Components.getType(r))==null?void 0:c.model.prototype,a=d=>{n.Assets.open({modalTitle:n.I18n.t("youtubeAssetProvider.modalTitle"),providerId:o.id,providers:[],types:[],select:u=>{n.Assets.close(),d.set({videoId:u.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!t&&l&&n.Components.addType(r,{model:{getYoutubeTraits(){const[d,...u]=l.getYoutubeTraits.apply(this);return[d,{id:i,type:"button",label:n.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>a(this)},...u]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:d}=this,u=d.get("provider")||"";u!=null&&u.startsWith("yt")&&a(d)}}}),n.I18n.addMessages({en:Yg,...s}),se({editor:n,licenseKey:e.licenseKey,plan:W.startup,pluginName:Xg,cleanup:()=>{n.runCommand(G.assetProviderRemove,{id:o.id}),!t&&l&&n.Components.addType(r,{model:{getYoutubeTraits(){return l.getYoutubeTraits.apply(this).filter(d=>d.id!==i)}}})}})}),e1=n=>{const{family:e,menu:t,axes:s}=n,o=!!s,i=Object.assign({},...n.variants.map(r=>{var d,u;let l,a;if(o){const h=s.find(f=>f.tag==="wght");if(h){const{start:f,end:p}=h;l=`${f} ${p}`}}return l||(l=((d=r.match(/\d+/))==null?void 0:d[0])??"400"),a=((u=r.match(/[a-zA-Z]+/))==null?void 0:u[0])==="italic"?"italic":void 0,{[r]:{family:e,source:n.files[r],variant:r,options:{style:a,weight:l}}}}));return{family:e,menuVariant:{family:`assetManagerMenu-${e}`,source:t,variant:"menu"},variants:i}},t1=n=>({id:`${n.family}/${n.version}`,type:"font",src:n.menu,name:n.family,customData:{font:e1(n),needsLoading:!0}}),n1=n=>{if(n.customData.needsLoading){n.customData.needsLoading=!1;const{font:e}=n.customData,{family:t,source:s,options:o}=e.menuVariant,i=new FontFace(t,`url("${s}")`,o);document.fonts.add(i),i.load().catch(()=>{})}};let qn;const s1=n=>{const e=[];for(const t of Object.keys(n)){let s=n[t];s&&(Array.isArray(s)?e.push(...s.map(o=>[t,o.toString()])):(s=s.toString(),e.push([t,s])))}return new URLSearchParams(e)},o1=n=>{const{apiKey:e,searchParams:t}=n,s=(o={})=>{const i="https://www.googleapis.com/webfonts/v1/webfonts",r=s1(o);return`${i}?${r}`};return{id:"google-fonts",types:["font"],label:({editor:o})=>o.I18n.t("googleFontsAssetProvider.providerLabel"),search:{reloadOnInput:!1},async onLoad(){var c;if(qn)return qn;const o={key:e,sort:"alpha",subset:"latin",capability:["WOFF2","VF"]},i=t==null?void 0:t(),r={...o,...i},a=await(await fetch(s(r))).json();return(c=a.items)!=null&&c.length?(qn=a.items.map(t1),qn):[]},itemLayout:o=>{const i=qn.find(r=>r.id===o.assetProps.id);return n1(i),{type:"column",onClick:()=>o.onSelect(i),htmlAttrs:{title:i.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"text",content:i.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:i.customData.font.menuVariant.family,fontSize:"24px",paddingLeft:"8px",paddingRight:"8px"}}]}}}},i1={googleFontsAssetProvider:{searchBtn:"Search on Google Fonts",modalTitle:"Select Font",providerLabel:"Google Fonts"}},r1="googleFontsAssetProvider",l1=ne(function(n,e){const{i18n:t={}}=e,s=o1(e);n.runCommand(G.assetProviderAdd,{provider:s}),n.I18n.addMessages({en:i1,...t}),se({editor:n,licenseKey:e.licenseKey,plan:W.startup,pluginName:r1,cleanup:()=>{n.runCommand(G.assetProviderRemove,{id:s.id})}})});F.accordionComponent=Ru,F.canvasEmptyState=Kg,F.canvasFullSize=Jg,F.dialogComponent=cd,F.flexComponent=Qu,F.fsLightboxComponent=nu,F.googleFontsAssetProvider=l1,F.iconifyComponent=xd,F.lightGalleryComponent=uu,F.listPagesComponent=Qd,F.rteProseMirror=Gg,F.rteTinyMce=lh,F.swiperComponent=Tu,F.tableComponent=Kd,F.youtubeAssetProvider=Qg,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
203
+ `,!w&&document.body.appendChild(k)};n.on(p.frameLoadHead,v=>{if(!g.scrollableCanvas)return;const{window:S}=v,w=S.document,k=w.head,E="data-gs-plg-wrapper-style",T=k.querySelector(`style[${E}]`)||w.createElement("style");T.setAttribute(E,"true"),T.innerHTML=`[data-gjs-type="wrapper"] { min-height: ${f}; }`,!k.contains(T)&&k.appendChild(T)}),n.onReady(()=>{const v=t.getSpotsEl(),S=t.getElement(),w=t.getFramesEl(),k=a*1e3,E=S.style;E.overflowX="hidden",w.style.transition=`transform ${a}s`;const T={x:l,y:r};y();const A=()=>v.style.display="none",P=()=>v.style.display="",D=oo(()=>{t.fitViewport({zoom:Me=>Me>100?100:Me,ignoreHeight:!0,gap:T}),y(),setTimeout(()=>{var Me,Re;n.em.destroyed||((Re=(Me=n.getSelected())==null?void 0:Me.getEl())==null||Re.scrollIntoView({block:"nearest"}),n.refresh({tools:!0}),P())},k)},100),V=new ResizeObserver(()=>{A(),D()});V.observe(S.parentElement);const H=()=>{A(),D()},ke=(Me={})=>{Me.options&&Me.options.from!=="fitViewport"&&t.fitViewport({zoom:t.getZoom(),ignoreHeight:!0,gap:T})},Te=()=>{E.overflowX="hidden",E.overflowY="auto"},Dt=()=>{V.disconnect(),D.clear()};n.on(o.events.select,H),n.on(p.zoom,ke),n.on(m,Te),n.on(n.events.destroy,Dt),D(),s.add(b,()=>{o.devices.reset(C),g.scrollableCanvas=!1,t.getModel().updateDevice(),t.setZoom(100),t.setCoords(0,0),E.overflowY="hidden",y(!0),n.off(o.events.select,H),n.off(p.zoom,ke),n.off(m,Te),Dt(),s.run("studio:canvasReload")})}),Q({editor:n,licenseKey:i.licenseKey,plan:F.startup,pluginName:Yc,cleanup:()=>{n.runCommand(b)}})});var at=(n=>(n.panelBlocks="panelBlocks",n.panelPagesLayers="panelPagesLayers",n.panelGlobalStyles="panelGlobalStyles",n.panelSidebarTabs="panelSidebarTabs",n.panelAssets="panelAssets",n))(at||{});const Xc="sidebarButtonsTarget",Us=n=>{const{id:e,icon:t,label:s,tooltip:o,className:i,skipSelfClose:r,removeLayouts:l,layoutComponent:a,layoutCommand:c}=n,d=e;return{id:Qc(e),type:"button",icon:t,tooltip:s||o,className:i,editorEvents:{[`${Fi.layoutToggleId}${d}`]:({fromEvent:u,setState:h,editor:f})=>{h({active:u.isOpen}),setTimeout(()=>f.refresh({tools:!0}),20)}},onClick:({editor:u,state:h})=>{if(h.active&&r)return;const f=(c==null?void 0:c.placer)||{type:"static",layoutId:Xc},p={...f,skipCleanup:f.type==="static"},m=l||Object.keys(at).filter(b=>b!==d);ed(u,{removeLayouts:m,layout:{placer:p}});const g={id:d,placer:f,header:(c==null?void 0:c.header)??{label:s,close:!r},layout:a,style:{width:250,height:"100%",borderRightWidth:1,...c==null?void 0:c.style}};u.runCommand(B.layoutToggle,g)}}},Qc=n=>`button__${n}`,ed=(n,e={})=>{(e.removeLayouts||Object.keys(at)).forEach(s=>n.runCommand(B.layoutRemove,{id:s,layout:e.layout}))},zi=(n,e,t)=>{const s=n.map(o=>{const i=Us(o);return t!=null&&t.sidebarButton?t.sidebarButton({id:o.id,breakpoint:e,buttonProps:i,sidebarButtonProps:o,createSidebarButton:r=>Us({...o,...r})}):i}).filter(Boolean);return t!=null&&t.sidebarButtons?t==null?void 0:t.sidebarButtons({breakpoint:e,sidebarButtons:s,createSidebarButton:o=>Us({...o})}):s},Li=(n,e,t,s)=>{var o;return((o=s==null?void 0:s.rootLayout)==null?void 0:o.call(s,{breakpoint:t,sidebarButtons:e,rootLayout:n,createSidebarButton:i=>Us({...i})}))??n},td=n=>{const e=(n==null?void 0:n.breakpointTablet)??1024,t=(n==null?void 0:n.breakpointMobile)??768,s={},o=[{id:at.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:at.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:at.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:at.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:d,editor:u})=>{var p;const h=u.getSelected(),f={type:"image",src:d.src};if(h!=null&&h.is("image"))return h.set("src",d.src);if(h&&u.Components.canMove(h,f)){const m=h.append(f)[0];m&&u.select(m)}else if(!h){const m=(p=u.getWrapper())==null?void 0:p.append(f)[0];m&&u.select(m)}}}}],i=[...o,{id:at.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],r={id:Xc,type:"column",style:{overflow:"hidden"}},l={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},a={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}};if(e){const d=zi(i,e,n);s[e]=Li({type:"row",style:{height:"100%"},children:[{...l,children:d},r,a]},d,e,n)}if(t){const d=i.map(h=>({...h,layoutCommand:{placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}}})),u=zi(d,t,n);s[t]=Li({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas"},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:u}]},u,t,n)}const c=zi(o,0,n);return{default:Li({type:"row",style:{height:"100%"},children:[{...l,children:c},r,a,{type:"sidebarRight"}]},c,0,n),responsive:s}},nd="layoutSidebarButtons",sd=X(function(n,e={}){const{Commands:t}=n,s=t.events,o={...e};(()=>{if(n.runCommand(B.layoutConfigGet)||o.skipLayoutConfig===!0)return;const l=td(o);n.runCommand(B.layoutConfigSet,{...l})})(),t.add(`${nd}:toggleButton`,(r,l,a={})=>{const c=document.getElementById(Qc(a.id));c==null||c.click()}),n.on(`${s.runCommand}core:preview`,()=>{ed(n)}),Q({editor:n,licenseKey:o.licenseKey,plan:F.startup,pluginName:nd,cleanup:()=>{n.runCommand(B.layoutConfigSet)}})});sd.createLayoutConfig=n=>td(n);const r1=n=>{const e={};for(const t of Object.keys(n)){let s=n[t];s&&(Array.isArray(s)?s=s.map(o=>o.toString()).join(","):s=s.toString(),e[t]=s)}return new URLSearchParams(e)},l1=n=>{const{apiKey:e,searchParams:t,thumbnailQuality:s="high"}=n,o=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",d=r1(l);return`${c}?${d}`},i=l=>{var a,c,d;return((a=l[s])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((d=l.medium)==null?void 0:d.url)||l.default.url},r=l=>{const a=i(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:["youtube-video"],label:({editor:l})=>l.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:l,pageCustomData:a}){var m;const c={maxResults:25,q:l,pageToken:a==null?void 0:a.token,type:["video"],key:e},d=t==null?void 0:t({searchValue:l}),u={...c,...d};u.part?u.part.includes("snippet")||u.part.push("snippet"):u.part=["snippet"];const f=await(await fetch(o(u))).json();return(m=f.items)!=null&&m.length?{items:f.items.map(r),nextPageCustomData:{token:f.nextPageToken},isLastPage:!f.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:l,onSelect:a})=>({type:"column",onClick:()=>a(l),htmlAttrs:{title:l.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=l.customData)==null?void 0:c.thumbnailUrl}" alt="${l.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:l.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},a1={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},c1="youtubeAssetProvider",d1=X(function(n,e){var c;const{skipVideoComponent:t,i18n:s={}}=e,o=l1(e);n.runCommand(B.assetProviderAdd,{provider:o});const i="search-on-youtube",r="video",l=(c=n.Components.getType(r))==null?void 0:c.model.prototype,a=d=>{n.Assets.open({modalTitle:n.I18n.t("youtubeAssetProvider.modalTitle"),providerId:o.id,providers:[],types:[],select:u=>{n.Assets.close(),d.set({videoId:u.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!t&&l&&n.Components.addType(r,{model:{getYoutubeTraits(){const[d,...u]=l.getYoutubeTraits.apply(this);return[d,{id:i,type:"button",label:n.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>a(this)},...u]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:d}=this,u=d.get("provider")||"";u!=null&&u.startsWith("yt")&&a(d)}}}),n.I18n.addMessages({en:a1,...s}),Q({editor:n,licenseKey:e.licenseKey,plan:F.startup,pluginName:c1,cleanup:()=>{n.runCommand(B.assetProviderRemove,{id:o.id}),!t&&l&&n.Components.addType(r,{model:{getYoutubeTraits(){return l.getYoutubeTraits.apply(this).filter(d=>d.id!==i)}}})}})}),u1=n=>{const{family:e,menu:t,axes:s}=n,o=!!s,i=Object.assign({},...n.variants.map(r=>{var d,u;let l,a;if(o){const h=s.find(f=>f.tag==="wght");if(h){const{start:f,end:p}=h;l=`${f} ${p}`}}return l||(l=((d=r.match(/\d+/))==null?void 0:d[0])??"400"),a=((u=r.match(/[a-zA-Z]+/))==null?void 0:u[0])==="italic"?"italic":void 0,{[r]:{family:e,source:n.files[r],variant:r,options:{style:a,weight:l}}}}));return{family:e,menuVariant:{family:`assetManagerMenu-${e}`,source:t,variant:"menu"},variants:i}},h1=n=>({id:`${n.family}/${n.version}`,type:"font",src:n.menu,name:n.family,customData:{font:u1(n),needsLoading:!0}}),f1=n=>{if(n.customData.needsLoading){n.customData.needsLoading=!1;const{font:e}=n.customData,{family:t,source:s,options:o}=e.menuVariant,i=new FontFace(t,`url("${s}")`,o);document.fonts.add(i),i.load().catch(()=>{})}};let Gn;const p1=n=>{const e=[];for(const t of Object.keys(n)){let s=n[t];s&&(Array.isArray(s)?e.push(...s.map(o=>[t,o.toString()])):(s=s.toString(),e.push([t,s])))}return new URLSearchParams(e)},m1=n=>{const{apiKey:e,searchParams:t}=n,s=(o={})=>{const i="https://www.googleapis.com/webfonts/v1/webfonts",r=p1(o);return`${i}?${r}`};return{id:"google-fonts",types:["font"],label:({editor:o})=>o.I18n.t("googleFontsAssetProvider.providerLabel"),search:{reloadOnInput:!1},async onLoad(){var c;if(Gn)return Gn;const o={key:e,sort:"alpha",subset:"latin",capability:["WOFF2","VF"]},i=t==null?void 0:t(),r={...o,...i},a=await(await fetch(s(r))).json();return(c=a.items)!=null&&c.length?(Gn=a.items.map(h1),Gn):[]},itemLayout:o=>{const i=Gn.find(r=>r.id===o.assetProps.id);return f1(i),{type:"column",onClick:()=>o.onSelect(i),htmlAttrs:{title:i.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"text",content:i.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:i.customData.font.menuVariant.family,fontSize:"24px",paddingLeft:"8px",paddingRight:"8px"}}]}}}},g1={googleFontsAssetProvider:{searchBtn:"Search on Google Fonts",modalTitle:"Select Font",providerLabel:"Google Fonts"}},y1="googleFontsAssetProvider",b1=X(function(n,e){const{i18n:t={}}=e,s=m1(e);n.runCommand(B.assetProviderAdd,{provider:s}),n.I18n.addMessages({en:g1,...t}),Q({editor:n,licenseKey:e.licenseKey,plan:F.startup,pluginName:y1,cleanup:()=>{n.runCommand(B.assetProviderRemove,{id:s.id})}})});$.accordionComponent=qu,$.canvasEmptyState=o1,$.canvasFullSize=i1,$.dialogComponent=Sd,$.flexComponent=dh,$.fsLightboxComponent=fu,$.googleFontsAssetProvider=b1,$.iconifyComponent=Dd,$.layoutSidebarButtons=sd,$.lightGalleryComponent=Cu,$.listPagesComponent=du,$.rteProseMirror=n1,$.rteTinyMce=bh,$.swiperComponent=Lu,$.tableComponent=ou,$.youtubeAssetProvider=d1,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});