@grapesjs/studio-sdk-plugins 1.0.38 → 1.0.39-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +5 -5
- package/dist/accordionComponent/index.es.js +70 -67
- package/dist/accordionComponent/index.js +39 -0
- package/dist/accordionComponent/index.umd.js +4 -4
- package/dist/aiChat/components/AiChatHeader.d.ts +4 -5
- package/dist/aiChat/components/AiChatInput/index.d.ts +4 -5
- package/dist/aiChat/components/AiChatMessage.d.ts +7 -8
- package/dist/aiChat/components/index.d.ts +1 -1
- package/dist/aiChat/components/utils.d.ts +1 -1
- package/dist/aiChat/index.cjs.js +10 -376
- package/dist/aiChat/index.es.js +4569 -28851
- package/dist/aiChat/index.js +10 -376
- package/dist/aiChat/index.umd.js +11 -377
- package/dist/aiChat/server/index.cjs.d.ts +0 -1
- package/dist/aiChat/server/index.cjs.js +45 -45
- package/dist/aiChat/server/index.d.ts +0 -1
- package/dist/aiChat/server/index.es.d.ts +0 -1
- package/dist/aiChat/server/index.es.js +371 -427
- package/dist/aiChat/server/index.js +45 -45
- package/dist/aiChat/server/index.umd.js +41 -41
- package/dist/aiChat/server/stream.test.d.ts +1 -0
- package/dist/aiChat/types.d.ts +18 -4
- package/dist/aiChat/typesSchema.d.ts +13 -0
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +49 -46
- package/dist/animationComponent/index.js +519 -0
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +115 -112
- package/dist/canvasAbsoluteMode/index.js +1 -0
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +71 -68
- package/dist/canvasEmptyState/index.js +1 -0
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +3 -3
- package/dist/canvasFullSize/index.es.js +69 -66
- package/dist/canvasFullSize/index.js +10 -0
- package/dist/canvasFullSize/index.umd.js +4 -4
- package/dist/canvasGridMode/index.cjs.js +7 -7
- package/dist/canvasGridMode/index.es.js +142 -139
- package/dist/canvasGridMode/index.js +26 -0
- package/dist/canvasGridMode/index.umd.js +7 -7
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +78 -75
- package/dist/canvasScreenshot/index.js +1 -0
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/EjsExporter.d.ts +1 -1
- package/dist/dataSourceEjs/index.cjs.js +3 -3
- package/dist/dataSourceEjs/index.es.js +40 -37
- package/dist/dataSourceEjs/index.js +21 -0
- package/dist/dataSourceEjs/index.umd.js +3 -3
- package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +2 -2
- package/dist/dataSourceHandlebars/constants.d.ts +1 -1
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +58 -55
- package/dist/dataSourceHandlebars/index.js +10 -0
- package/dist/dataSourceHandlebars/index.umd.js +2 -2
- package/dist/dialogComponent/index.cjs.js +11 -11
- package/dist/dialogComponent/index.es.js +72 -69
- package/dist/dialogComponent/index.js +59 -0
- package/dist/dialogComponent/index.umd.js +11 -11
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +151 -142
- package/dist/flexComponent/index.js +33 -0
- package/dist/flexComponent/index.umd.js +8 -8
- package/dist/flexComponent/typesSchema.d.ts +1 -1
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +93 -90
- package/dist/fsLightboxComponent/index.js +6 -0
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +112 -109
- package/dist/googleFontsAssetProvider/index.js +1 -0
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +80 -77
- package/dist/iconifyComponent/index.js +3 -0
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +970 -82
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +7422 -6145
- package/dist/index.umd.js +975 -87
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +95 -92
- package/dist/layoutSidebarButtons/index.js +1 -0
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +164 -161
- package/dist/lightGalleryComponent/index.js +1 -0
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/lightGalleryComponent/utils.d.ts +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +60 -57
- package/dist/linkImageComponent/index.js +12 -0
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +4 -4
- package/dist/listPagesComponent/index.es.js +57 -54
- package/dist/listPagesComponent/index.js +11 -0
- package/dist/listPagesComponent/index.umd.js +4 -4
- package/dist/listPagesComponent/utils.d.ts +1 -1
- package/dist/presetBlockLibrary/blocks.d.ts +6 -0
- package/dist/presetBlockLibrary/blocks.test.d.ts +2 -0
- package/dist/presetBlockLibrary/emailBlocks.d.ts +53 -0
- package/dist/presetBlockLibrary/index.cjs.d.ts +3 -0
- package/dist/presetBlockLibrary/index.cjs.js +889 -0
- package/dist/presetBlockLibrary/index.d.ts +3 -0
- package/dist/presetBlockLibrary/index.es.d.ts +3 -0
- package/dist/presetBlockLibrary/index.es.js +1408 -0
- package/dist/presetBlockLibrary/index.js +889 -0
- package/dist/presetBlockLibrary/index.test.d.ts +1 -0
- package/dist/presetBlockLibrary/index.umd.js +889 -0
- package/dist/presetBlockLibrary/shared.d.ts +3 -0
- package/dist/presetBlockLibrary/types.d.ts +24 -0
- package/dist/presetBlockLibrary/typesSchema.d.ts +47 -0
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +133 -130
- package/dist/presetPrintable/index.js +32 -0
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +8 -8
- package/dist/prosemirror/index.es.js +552 -549
- package/dist/prosemirror/index.js +10 -0
- package/dist/prosemirror/index.umd.js +9 -9
- package/dist/prosemirror/toolbar.d.ts +2 -2
- package/dist/prosemirror/types.d.ts +5 -5
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +137 -134
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +74 -71
- package/dist/rteTinyMce/index.js +104 -0
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +91 -88
- package/dist/shapeDividerComponent/index.js +97 -0
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +7 -7
- package/dist/swiperComponent/index.es.js +95 -92
- package/dist/swiperComponent/index.js +45 -0
- package/dist/swiperComponent/index.umd.js +5 -5
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +181 -178
- package/dist/tableComponent/index.js +1 -0
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/tableComponent/types.d.ts +3 -3
- package/dist/types.d.ts +14 -14
- package/dist/utils.d.ts +3 -2
- package/dist/utilsDataSources.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +90 -87
- package/dist/youtubeAssetProvider/index.js +1 -0
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +182 -34
- package/dist/aiChat/server/models.d.ts +0 -15
package/dist/index.cjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fu=require("handlebars/dist/cjs/handlebars.js"),Ya="app.grapesjs.com",Za="app-stage.grapesjs.com",hu="app2.grapesjs.com",mu="app-stage2.grapesjs.com",Is=[Ya,hu,Za,mu,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],gu="license:check:end",bu=()=>typeof window<"u",dr=(n,e={})=>{const t=Eu(n)?{id:n,src:n}:n;return new Promise((o,i)=>{var u,f;const{loadedScripts:r}=e,{id:s,src:l}=t,a=document.querySelector(`script[src="${l}"]`);if(a){if((u=e.onScript)==null||u.call(e,a),r&&!r.get(l)){a.addEventListener("load",()=>o(s)),a.addEventListener("error",()=>i(s));return}return o(s)}const c=window.define;window.define=void 0;const d=()=>{r==null||r.set(l,!0),window.define=c},p=document.createElement("script");p.src=l,p.onload=()=>{o(s),d()},p.onerror=()=>{i(s),d()},document.head.appendChild(p),(f=e.onScript)==null||f.call(e,p)})},yu=(n,e={})=>{const t=n.map(o=>dr(o,e));return Promise.allSettled(t)},xu=async(n,e={})=>{const t=window.define;window.define=void 0;const o=await yu(n,e);return window.define=t,o},vu=({isDev:n,isStage:e,isPlatform:t})=>`${n?"":`https://${e?Za:Ya}`}/${t?"platform-api":"api"}`,wu=(n={})=>{const{width:e=300,height:t,text:o="IMAGE",bg:i="777",fg:r="white"}=n,s=t?`x${t}`:"";return`https://placehold.co/${e}${s}/${i}/${r}.png?text=${o}`},Su=()=>{if(!bu())return"";const{hostname:n}=window.location;if(n)return n;try{return window.parent.location.hostname||""}catch{return""}},Cu=()=>{const n=Su();return!!n&&(Is.includes(n)||Is.some(e=>n.endsWith(e)))},ku=n=>n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase()),Tu=n=>typeof n<"u",Eu=n=>typeof n=="string";function We(n){return typeof n=="function"}const Xa=n=>!!n.Components.getType("mjml");async function Mu({path:n,baseApiUrl:e,method:t="GET",headers:o={},params:i,body:r}){const l=`${e||vu({isDev:!1,isStage:!1})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...o}};r&&(a.body=JSON.stringify(r));const c=i?new URLSearchParams(i).toString():"",d=c?`?${c}`:"",p=await fetch(`${l}${d}`,a);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var F=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(F||{}),Qa=(n=>(n.Info="info",n.Error="error",n.Success="success",n.Warning="warning",n))(Qa||{}),G=(n=>(n.toastAdd="studio:toastAdd",n.toastRemove="studio:toastRemove",n.dialogOpen="studio:dialogOpen",n.dialogClose="studio:dialogClose",n.dialogExportCode="studio:dialogExportCode",n.dialogImportCode="studio:dialogImportCode",n.openEditCode="studio:openEditCode",n.openBlocks="studio:openBlocks",n.appendComponent="studio:appendComponent",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.clearPage="studio:clearPage",n.projectFiles="studio:projectFiles",n.validateCode="studio:validateCode",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.layoutComponentAdd="studio:layoutComponentAdd",n.layoutComponentGet="studio:layoutComponentGet",n.layoutComponentRemove="studio:layoutComponentRemove",n.layoutComponentRender="studio:layoutComponentRender",n.getStateTheme="studio:getStateTheme",n.setStateTheme="studio:setStateTheme",n.settings="studio:settings",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.fontManagerOpen="studio:fontManagerOpen",n.menuFontLoad="studio:menuFontLoad",n.toggleStateDataSource="studio:toggleStateDataSource",n.getStateDataSource="studio:getStateDataSource",n.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",n.dataSourceSetImporter="studio:dataSourceSetImporter",n.dataSourceSetExporter="studio:dataSourceSetExporter",n.setDragAbsolute="studio:setDragAbsolute",n))(G||{}),ec=(n=>(n.layoutToggleId="studio:layoutToggle:",n.toggleBlocksPanel="studio:toggleBlocksPanel",n.pageSettingsUpdate="studio:pageSettingsUpdate",n.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",n))(ec||{}),tc=(n=>(n.dark="dark",n.light="light",n.auto="auto",n))(tc||{}),nc=(n=>(n.web="web",n.email="email",n.document="document",n.react="react",n))(nc||{});const Ds={[F.free]:0,[F.startup]:10,[F.business]:20,[F.enterprise]:30};function Au(n,e){const t=n;return t.init=o=>{const i=r=>n(r,o);return e&&(i.__gjsPluginId=e),i},t}const W=(n,e)=>Au(n,e);async function q({editor:n,plan:e,pluginName:t,licenseKey:o,onLicenseCheckResponse:i,cleanup:r}){let s="",l;const a=p=>{console.warn("Cleanup plugin:",t,"Reason:",p),r(n,t)},c=(p={})=>{var b;const{error:u,sdkLicense:f}=p,h=(b=p.plan)==null?void 0:b.category;if(!(f||p.license)||u)a(u||"Invalid license");else if(h){const x=Ds[e],C=Ds[h];x>C&&a({pluginRequiredPlan:e,licensePlan:h})}};n.Commands.has(G.settings)&&(l=n.runCommand(G.settings),s=(l==null?void 0:l.baseUrl)||"");const d=p=>{i==null||i(p),p&&c(p)};if(!l){n.onReady(async()=>{if(!Cu())if(o){const p=await $u({licenseKey:o,pluginName:t,baseApiUrl:s});d(p)}else a("The `licenseKey` option not provided")});return}if(l.licensePlan||l.licenseError){const p=ju(l);d(p);return}n.on(gu,p=>d(p))}const ju=n=>({sdkLicense:n.license,license:n.license,error:n.licenseError,plan:n.licensePlan});async function $u(n){const{licenseKey:e,pluginName:t,baseApiUrl:o}=n;try{return(await Mu({baseApiUrl:o,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const Oo=(n,e)=>{var t;return!!((t=n==null?void 0:n.hasAttribute)!=null&&t.call(n,e))},xt=(n,e)=>{var t;return!!((t=n==null?void 0:n.classList)!=null&&t.contains(e))},Ue=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,De))===n},fi=(...n)=>e=>n.some(t=>e.is(t)),ss=(...n)=>(e,t)=>n.some(o=>t.is(o)),Pu=(n,e)=>n.onReady(()=>n.Plugins.remove(e)),Nu=(n,e={})=>{var r;const t={},o=[],i=[];for(const s in n){const{value:l,...a}=n[s];o.push({id:s,name:s,changeProp:!0,category:e.category,...a}),t[s]=l,!Tu(l)&&i.push(s);const{subTraits:c={}}=a;for(const d in a.subTraits)(r=c[d])==null||r.forEach(p=>{const u=p.id||p.name;t[u]=p.value})}return{propKeys:Object.keys(t),propsNoValues:i,props:t,traits:o}},Ou=(n,e)=>{e.forEach(t=>{if(t.subTraits){const o=`${t.id||t.name}`,i=t.changeProp?`change:${o}`:`change:attributes:${o}`;n.on(i,()=>zs(n,o)),zs(n,o)}})},zs=(n,e)=>{const t=n.getTrait(e),o=t.get("category"),i=t.get("subTraits")||{},s=(Object.values(i).flat()||[]).map(c=>c.id||c.name);n.removeTrait(s);const l=i[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:o,...c})),{at:a})},ls=(n,e,t)=>{const{doc:o=document}=t,i=t.target||o.head,r=i.querySelector(`style[${n}]`)||o.createElement("style");r.setAttribute(n,"true"),r.innerHTML=e,!i.contains(r)&&i.appendChild(r)},Iu=(n,e)=>{e.forEach(t=>{const o=ku(t);o!==t&&n.has(o)&&n.set({[t]:n.get(o),[o]:void 0})})},je="gjs-plg-",_o="data-gs-plg-",De="data-type-role",Rs=(...n)=>n.map(e=>`[data-gjs-type="${e}"]`).join(","),oc="dialogComponent",Du=function(n,e={}){const{Blocks:t,Components:o}=n,{licenseKey:i}=e,r="gjs-plg-dialog",s="gjs-plg-dialog-overlay",l="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",d="gjs-plg-dialog-body",p="gjs-plg-dialog-description",u="gjs-plg-dialog-placeholder";t.add(r,{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:r},activate:!0,...e.block}),o.addType(r,{model:{defaults:{tagName:"div",attributes:{class:r,"data-type-role":r},components:[{type:
|
|
5
|
+
`,category:"Extra",content:{type:r},activate:!0,...e.block}),o.addType(r,{model:{defaults:{tagName:"div",attributes:{class:r,"data-type-role":r},components:[{type:s},{type:u}],draggable:Rs("wrapper"),droppable:Rs(r),styles:`
|
|
6
6
|
.${r} {
|
|
7
7
|
position: relative;
|
|
8
8
|
z-index: 1;
|
|
9
9
|
}
|
|
10
|
-
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(
|
|
11
|
-
.${
|
|
10
|
+
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(h){var g;(g=h.getSelected())==null||g.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(h){const g=this;function b(v){const k=g.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),w=g.querySelector('[data-type-role="gjs-plg-dialog-close"]');function S(){k.style.display="none"}v?(g._onCloseWhenPressingX=S,w.addEventListener("click",g._onCloseWhenPressingX)):(w.removeEventListener("click",g._onCloseWhenPressingX),g._onCloseWhenPressingX=null)}function x(v){const k=g.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(S){S.key==="Escape"&&(k.style.display="none")}v?(g._onCloseWhenPressingEsc=w,g.addEventListener("keydown",g._onCloseWhenPressingEsc)):(g.removeEventListener("keydown",g._onCloseWhenPressingEsc),g._onCloseWhenPressingEsc=null)}function C(v){const k=g.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(){k.style.display="flex"}v?(g._onOpenWhenLeavingWindow=w,document.addEventListener("mouseleave",g._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",g._onOpenWhenLeavingWindow),g._onOpenWhenLeavingWindow=null)}function y(v){const k=g.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function w(){const S=document.documentElement.scrollTop;v&&S>=Number(v)&&(k.style.display="flex")}v?(g._onOpenWhenScrollingToLevel=w,document.addEventListener("scroll",g._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",g._onOpenWhenScrollingToLevel),g._onOpenWhenScrollingToLevel=null)}b(h.closeWhenPressingX),x(h.closeWhenPressingEsc),C(h.openWhenLeavingWindow),y(h.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const g=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');g.style.display="flex"})}},view:{onActive(){const h=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');h.style.display="flex"}}}),o.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:{type:l},droppable:!1,draggable:!1,styles:`
|
|
11
|
+
.${s} {
|
|
12
12
|
position: fixed;
|
|
13
13
|
top: 0;
|
|
14
14
|
left: 0;
|
|
@@ -56,24 +56,24 @@
|
|
|
56
56
|
.${p} {
|
|
57
57
|
margin: 0;
|
|
58
58
|
}
|
|
59
|
-
`}}}),o.addType(u,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:u,"data-type-role":u},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:
|
|
59
|
+
`}}}),o.addType(u,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:u,"data-type-role":u},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:h,el:g}=this,b="core:preview",x=h.Commands.events;this.listenTo(h,`${x.runCommand}${b}`,()=>{g.style.display="none"}),this.listenTo(h,`${x.stopCommand}${b}`,()=>{g.style.display=""})}}}),q({editor:n,licenseKey:i,plan:F.startup,pluginName:oc,cleanup:()=>{t.remove(r),o.removeType(r)}})},zu=W(Du,oc),ic="iconifyComponent",Ru=F.startup,Lu={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},Ai=`<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>`,Ba="layout-icon-picker",Yp="icons-layout-",Ha="icons-list-layout",Fa="gs-iconify-picker",Xr="__iconify_collection",Xp="https://api.iconify.design",Es=new Map;let fo;const Qp=({collectionId:n})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${n}@latest/icons.json`;async function _a({collectionId:n,editor:e}){try{if(Es.has(n))return Es.get(n);const t=await fetch(Qp({collectionId:n}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const o=await t.json();return Es.set(n,o),o}catch(t){console.error("Error fetching collection",t),e.runCommand(_.toastAdd,ru());return}}async function eu({collectionIds:n,editor:e}){try{if(fo)return fo;const t=n?`?prefixes=${n.join(",")}`:"",o=await fetch(`${Xp}/collections${t}`);if(!o.ok)throw new Error(`Failed to fetch collections: ${o.statusText}`);return fo=await o.json(),fo}catch(t){console.error("Error fetching collections",t),e.runCommand(_.toastAdd,Wa());return}}function Ai(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(n){var e;(e=n.getSelected())==null||e.trigger("active")}}}async function tu({collectionIds:n,editor:e,component:t}){const o=await eu({collectionIds:n,editor:e});if(!o)return;const s=({icon:a,collectionId:c,iconId:d})=>{t.components(a),t.set({collectionId:c,iconId:d})},r=Object.entries(o).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),i=t.get("collectionId")??r[0].id;e.runCommand(_.layoutToggle,{id:Ba,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[ou({collectionsList:r,collectionId:i,editor:e,handleClick:s}),{id:Ha,type:"column",grow:!0}]}});const l=await _a({collectionId:i,editor:e});l&&(Ga({editor:e,collection:l}),or({editor:e,collection:l,handleClick:s,collectionId:i}))}function Ga({editor:n,collection:e}){n.em.set(Xr,e)}function nu(n){return n.em.get(Xr)}function or(n){const{editor:e}=n;e.runCommand(_.layoutUpdate,{id:Yp,layout:su(n),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:Ha}})}function ou(n){const{collectionsList:e,collectionId:t,editor:o,handleClick:s}=n,r=e.map(({id:i,name:l,total:a})=>({id:i,label:`${l} (${a})`})).sort((i,l)=>i.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${Fa}__header`,children:[{type:"selectField",value:t,options:r,emptyState:"Select an icon collection",onChange:async({setState:i,value:l})=>{const a=await _a({collectionId:l,editor:o});a&&(i({value:l}),Ga({editor:o,collection:a}),or({editor:o,collection:a,handleClick:s,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${Xr}`]:({setState:i})=>i({value:""})},onInput:({setState:i,value:l,editor:a})=>{const c=nu(a);if(!c)return;const d=Object.fromEntries(Object.entries(c.icons).filter(([p])=>p.includes(l)));i({value:l}),or({editor:a,collection:c,handleClick:s,collectionId:t,collectionFiltered:{...c,icons:d}})}}]}}function su({collection:n,collectionFiltered:e,handleClick:t}){const{height:o=24,width:s=24,icons:r,prefix:i}=e||n,l=Object.entries(r).map(([a,c])=>({name:a,...c}),{});return{type:"column",className:`${Fa}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>({type:"custom",render:c=>{const{editor:d,addEl:p,removeEl:u}=c,h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.innerHTML=a.body;const f=a.width||s,m=a.height||o;h.setAttribute("viewBox",`0 0 ${f} ${m}`),h.style.cssText="width: 48px; height: 48px; cursor: pointer; border-radius: 4px; transition: padding 0.1s ease-in-out;";const g=[["click",()=>{const b=h.cloneNode(!0);b.removeAttribute("style");const w=b.outerHTML;t({icon:w,collectionId:i,iconId:a.name}),d==null||d.runCommand(_.layoutRemove,{id:Ba})}],["pointerover",()=>{h.style.border="2px solid currentColor",h.style.padding="4px"}],["pointerout",()=>{h.style.border="",h.style.padding=""}]];return g.forEach(([b,w])=>h.addEventListener(b,w)),p(h),()=>{g.forEach(([b,w])=>h.removeEventListener(b,w)),u(h)}}})}}}function Wa(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:La.Error}}function ru(){return{...Wa(),id:"toast-error-getCollection",content:"Error fetching collection"}}const iu=function(n,e={}){var h;const{Components:t,Blocks:o}=n,{collections:s,extendIconComponent:r=!0,licenseKey:i,block:l={}}=e,a="icon",c="iconify",d="Iconify",p="data-type-iconify",u={events:()=>({dblclick:"onActive"}),onActive(){tu({collectionIds:s,editor:n,component:this.model})}};if(t.addType(c,{block:l&&{label:d,media:ks,content:{type:c},category:"Extra",activate:!0,...l},isComponent:f=>Po(f,p),model:{defaults:{name:d,icon:ks,droppable:!1,attributes:{[p]:!0},resizable:Zp,components:ks,style:{width:"50px",height:"50px"},traits:[Ai()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(f=>f.set({layerable:!1,locked:!0}))}},view:u}),r){const f=(h=t.getType(a))==null?void 0:h.model,[m,g,...b]=f.getDefaults().traits;t.addType(a,{model:{defaults:{traits:[m,g,Ai(),...b]}},view:u})}W({editor:n,licenseKey:i,plan:Jp,pluginName:Kp,cleanup:()=>{o.remove(c),t.removeType(c)}})},lu=G(iu);function jn(n,e,t){let o,s,r,i,l;const a=e===void 0?100:e;function c(){const p=Date.now()-i;p<a&&p>=0?o=setTimeout(c,a-p):(o=null,l=n.apply(r,s),r=s=null)}const d=function(){return r=this,s=arguments,i=Date.now(),o||(o=setTimeout(c,a)),l};return d.clear=function(){o&&(clearTimeout(o),o=null)},d.flush=function(){o&&(l=n.apply(r,s),r=s=null,clearTimeout(o),o=null)},d}const au="tableComponent",cu=H.startup;var I=(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))(I||{});const V={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>'},Ge="table",ja="thead",qa="tfoot",sr="tbody",be="row",q="cell",Qr="clipboardTable",du=[Ge,ja,qa,sr,be,q],ds=n=>n.em.get(Qr)||[],pu=n=>n.every(e=>e.is(q)),ei=(n,e)=>{const{editor:t,event:o,opts:s}=n,r=o.currentTarget||o.target,{x:i,y:l,width:a,height:c}=r.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:i,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};_t(s.openSettings)?s.openSettings({...n,layoutProps:d}):t.runCommand(_.layoutToggle,d)},uu=(n,{rows:e=1,cells:t=5,text:o}={})=>({type:n,components:Array.from(Array(e).keys()).map(s=>({type:be,components:Array.from(Array(t).keys()).map(r=>({type:q,components:o?{type:"text",content:_t(o)?o({y:s,x:r}):o}:void 0}))}))}),Ua="Table settings",Ka=n=>{const{component:e}=n;return e.is(Ge)?e:e.closestType(Ge)},hu=n=>{var e;(e=Ka(n))==null||e.remove(n.opts)},fu=n=>{const e=Ka(n);e&&(n.editor.select(e),ei(n,{id:"tableSettings",header:{label:Ua}}))},Ja=n=>[{id:I.table,icon:V[I.table],label:"Table",items:[{id:I.tableSettings,label:Ua,icon:V[I.tableSettings],onClick:({event:t})=>fu({...n,event:t})},{id:I.tableDelete,label:"Delete table",icon:V[I.tableDelete],onClick:()=>hu(n)}]}],Za=({editor:n})=>{const e=ds(n);return e.length&&pu(e)},Pi=({component:n,editor:e,after:t})=>{if(!n.is(q))return;const o=n.closestType(Ge),s=n.closestType(be),r=n.index()+(t?1:0);o==null||o.findType(be).forEach(l=>l.append({type:q},{at:r}));const i=s==null?void 0:s.components().at(r);i&&e.select(i)},Ya=({component:n,opts:e})=>{if(!n.is(q))return;const t=n.closestType(Ge),o=n.index();t==null||t.findType(be).forEach(s=>{var r;return(r=s.components().at(o))==null?void 0:r.remove(e)})},Xa=({component:n,editor:e})=>{if(!n.is(q))return;const t=n.closestType(Ge),o=n.index(),s=(t==null?void 0:t.findType(be).map(r=>r.components().at(o)))||[];s.length&&e.em.set(Qr,s)},Ni=n=>{const{component:e,editor:t,after:o}=n;if(!e.is(q)||!Za(n))return;const s=ds(t),r=e.closestType(Ge),i=e.index()+(o?1:0);r==null||r.findType(be).forEach((l,a)=>{const c=s[a],d=(c==null?void 0:c.clone())||{type:q};l.append(d,{at:i})})},mu=n=>{const{component:e}=n;e.is(q)&&(Xa(n),Ya({...n,opts:{temporary:!0}}))},gu=n=>{const e=Za(n);return[{id:I.tableColumnItems,icon:V[I.tableColumn],label:"Column",items:[{id:I.tableColumnInsertBefore,label:"Insert column before",icon:V[I.tableColumnInsertBefore],onClick:()=>Pi(n)},{id:I.tableColumnInsertAfter,label:"Insert column after",icon:V[I.tableColumnInsertAfter],onClick:()=>Pi({...n,after:!0})},{id:I.tableColumnDelete,label:"Delete column",icon:V[I.tableColumnDelete],onClick:()=>Ya(n)},{id:I.tableColumnCut,label:"Cut column",icon:V[I.tableColumnCut],onClick:()=>mu(n)},{id:I.tableColumnCopy,label:"Copy column",icon:V[I.tableColumnCopy],onClick:()=>Xa(n)},{id:I.tableColumnPasteBefore,label:"Paste column before",icon:V[I.tableColumnPasteBefore],disabled:!e,onClick:()=>Ni(n)},{id:I.tableColumnPasteAfter,label:"Paste column after",icon:V[I.tableColumnPasteAfter],disabled:!e,onClick:()=>Ni({...n,after:!0})}]}]},Qa="Row settings",yu=n=>n.every(e=>e.is(be)),Sn=n=>{const{component:e}=n,t=e.is(q),o=e.is(be);if(!(!t&&!o))return o?e:e.closestType(be)},Oi=n=>{const{component:e,editor:t,after:o}=n,s=Sn(n);if(!s)return;const r=s.index()+(o?1:0),i=s.components().length,l=Array.from(Array(i).keys()).map(()=>({type:q})),a=s.parent();if(a){const c=a.append({type:be,components:l},{at:r})[0];if(e.is(q)&&c){const d=e.index(),p=c.components().at(d);p&&t.select(p)}}},ec=n=>{var e;(e=Sn(n))==null||e.remove(n.opts)},tc=n=>{const e=Sn(n);e&&n.editor.em.set(Qr,[e])},Ii=n=>{var l;const{editor:e,after:t}=n,o=Sn(n);if(!o||!nc(n))return;const r=ds(e)[0],i=o.index()+(t?1:0);r&&((l=o.parent())==null||l.append(r.clone(),{at:i}))},bu=n=>{Sn(n)&&(tc(n),ec({...n,opts:{temporary:!0}}))},nc=({editor:n})=>{const e=ds(n);return e.length&&yu(e)},vu=n=>{const e=Sn(n);e&&(n.editor.select(e),ei(n,{id:"tableRowSettings",header:{label:Qa}}))},oc=n=>{const e=nc(n);return[{id:I.tableRowItems,icon:V[I.tableRowProperties],label:"Row",items:[{id:I.tableRowInsertBefore,label:"Insert row before",icon:V[I.tableRowInsertBefore],onClick:()=>Oi(n)},{id:I.tableRowInsertAfter,label:"Insert row after",icon:V[I.tableRowInsertAfter],onClick:()=>Oi({...n,after:!0})},{id:I.tableRowDelete,label:"Delete row",icon:V[I.tableRowDelete],onClick:()=>ec(n)},{id:I.tableRowProperties,label:Qa,icon:V[I.tableRowProperties],onClick:({event:o})=>vu({...n,event:o})},{id:I.tableRowCut,label:"Cut row",icon:V[I.tableRowCut],onClick:()=>bu(n)},{id:I.tableRowCopy,label:"Copy row",icon:V[I.tableRowCopy],onClick:()=>tc(n)},{id:I.tableRowPasteBefore,label:"Paste row before",icon:V[I.tableRowPasteBefore],disabled:!e,onClick:()=>Ii(n)},{id:I.tableRowPasteAfter,label:"Paste row after",icon:V[I.tableRowPasteAfter],disabled:!e,onClick:()=>Ii({...n,after:!0})}]},...Ja(n)]},ti=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),o=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:o}};function sc(n){const e=[];return n.components().forEach((t,o)=>{t.components().each((s,r)=>{const{rowspan:i,colspan:l}=ti(s);if(e[o])for(;e[o][r];)r++;for(let a=o;a<o+i;a++){e[a]||(e[a]=[]);for(let c=r;c<r+l;c++)e[a][c]={real:a===o&&c===r,cell:s,rowspan:i,colspan:l}}})}),e}function en(n,e,t){var o;return(o=n[t])==null?void 0:o[e]}const rr=n=>n.closestType(be);function Su(n,{x:e,y:t,rows:o,cols:s}){var l;let r=rr(n[t][e].cell),i;for(let a=1;a<=o;a++)if(r=(l=r==null?void 0:r.parent())==null?void 0:l.components().at(r.index()+1),r){for(i=e;i>=0;i--){const{cell:c}=n[t+a][i],d=rr(c);if(d===r){for(let p=1;p<=s;p++){const u=c.index();d.append({type:q},{at:u+1})}break}}if(i===-1){const d=r.components().at(0).index();for(let p=1;p<=s;p++)r.append({type:q},{at:d})}}}function rc(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const s=n[e][t].cell;if(s.em.selected.hasComponent(s)){const{rowspan:r,colspan:i}=ti(s);if(i>1||r>1){s.addAttributes({colspan:1,rowspan:1});for(let l=0;l<i-1;l++){const a=s.index();rr(s).append({type:q},{at:a+1})}Su(n,{x:t,y:e,rows:r-1,cols:i})}}}}function xu(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const ps=(n,e={})=>{var i;const t=sc(n),{em:o}=n;let s,r;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((i=e.selected)!=null&&i.includes(c.cell)||o.selected.hasComponent(c.cell)){const d={x:a,y:l};s||(s=d),r=d}}return{grid:t,startPos:s,endPos:r}};function wu(n,e={}){const t=ps(n),{startPos:o,endPos:s}=t;let{grid:r}=t;const{em:i}=n;if(!o||!s)return;const l=o.x,a=o.y,c=s.x,d=s.y,p=en(r,l,a),u=en(r,c,d);if(p&&u){rc(r),r=sc(n);const h=[],f=en(r,l,a).cell;f.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=en(r,g,m);if(!b)continue;const{cell:w}=b;w!==f&&h.push(w)}h.forEach(m=>{e.mergeContent&&f.append(m.components().models),m.remove()}),i.setSelected(f),xu(n)}}const ic="Cell settings",Cu="Merge cells",ku="Split cell",Eu=n=>n.closestType(be),hn=n=>{var e;return(e=Eu(n))==null?void 0:e.parent()},Tu=n=>{const e=n.editor.getSelectedAll(),t=hn(e[0]),o=e[0];if(!t||!(o!=null&&o.is(q))||e.length>1)return!1;const{rowspan:s,colspan:r}=ti(o);return!(r<2&&s<2)},Mu=n=>{const t=n.editor.getSelectedAll()[0],o=hn(t),{grid:s}=ps(o);rc(s)},lc=n=>{const e=n.editor.getSelectedAll(),t=hn(e[0]);if(!t||e.length<2||e.some(l=>!l.is(q)||hn(l)!==t))return!1;const{grid:o,startPos:s,endPos:r}=ps(t),{em:i}=t;if(!s||!r)return!1;for(let l=s.y;l<=r.y;l++)for(let a=s.x;a<=r.x;a++){const c=en(o,a,l);if(!c||!i.selected.hasComponent(c.cell))return!1}return!0},Au=n=>{const{editor:e}=n;if(!lc(n))return;const t=e.getSelectedAll(),o=hn(t[0]);wu(o,{mergeContent:!0})},Pu=n=>{ei(n,{id:"tableCellSettings",header:{label:ic}})},Nu=n=>[{id:I.tableCellItems,icon:V[I.tableCellProperties],label:"Cell",items:[{id:I.tableCellProperties,label:ic,icon:V[I.tableCellProperties],onClick:({event:t})=>Pu({...n,event:t})},{id:I.tableCellMerge,label:Cu,icon:V[I.tableCellMerge],onClick:()=>Au(n),disabled:!lc(n)},{id:I.tableCellSplit,label:ku,icon:V[I.tableCellSplit],onClick:()=>Mu(n),disabled:!Tu(n)}]},...gu(n),...oc(n)],Ou=n=>{const e=n[0]&&hn(n[0]);if(!e)return;const{grid:t,startPos:o,endPos:s}=ps(e,{selected:n});if(!o||!s)return;const r=[];for(let i=o.y;i<=s.y;i++)for(let l=o.x;l<=s.x;l++){const a=en(t,l,i);a&&r.push(a.cell)}r.length&&e.em.setSelected(r,{fromCell:!0})},Iu=function(n,e={}){const t={block:{},...e},{Components:o}=n,s={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"]};o.addType(Ge,{block:t.block&&{label:"Table",media:V.table,category:"Extra",content:{type:Ge,style:{width:"100%"}},select:!0,...t.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:V.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:i,value:l,emitUpdate:a}){const c=i.find("caption")[0];l?!c&&i.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(i){return!!i.component.find("caption")[0]}}],components:uu(sr,{rows:5}),contextMenu:({items:i,editor:l,component:a})=>[...Ja({editor:l,component:a,opts:t}),...i]}}}),o.addType(ja,{model:{defaults:{icon:V.tableHead,...s}}}),o.addType(qa,{model:{defaults:{icon:V.tableFoot,...s}}}),o.addType(sr,{model:{defaults:{icon:V.tableRowProperties,...s}}}),o.addType(be,{model:{defaults:{icon:V.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:i,editor:l,component:a})=>[...oc({editor:l,component:a,opts:t}),...i]}}}),o.addType(q,{model:{defaults:{icon:V.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:i,editor:l,component:a})=>[...Nu({editor:l,component:a,opts:t}),...i]}}});const r=jn((i,l)=>{var p;const a=n.getSelectedAll(),c=!!((p=l==null?void 0:l.event)!=null&&p.shiftKey);if(a.length<2||!c||l.fromCell)return;const d=a.map(u=>u.is(q)?u:u.closestType(q)).filter(Boolean);d.length===a.length&&Ou(d)},0);n.on("component:select",r),W({editor:n,plan:cu,pluginName:au,licenseKey:t.licenseKey,cleanup:()=>{n.off("component:select",r),n.Blocks.remove(Ge),du.forEach(i=>o.removeType(i))}})},Ru=G(Iu),Du="listPagesComponent",Lu=H.startup,Ri="page://",St="list-pages",jt="list-pages-item",xt="list-pages-link",$u=n=>n.components().reduce((e,t)=>{var i;const o=t.findFirstType(xt),s=(i=o==null?void 0:o.attributes.attributes)==null?void 0:i.href,r=s!=null&&s.startsWith(Ri)?s.replace(Ri,""):"";if(r&&o){const l=e[r];l?l.push(o):e[r]=[o]}return e},{}),No="data-type-role",zu="page_root",Vu=n=>e=>e.is(n),Bu=n=>(e,t)=>t.is(n),Ts=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,No))===n},Hu=function(n,e={}){const{Blocks:t,Components:o,Pages:s}=n,{licenseKey:r,block:i={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${Me}${St}`,p=`${Me}${xt}`,u='<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>',h='<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>';o.addType(St,{block:i&&{label:l,media:u,category:"Extra",select:!0,...e.block},isComponent:Ts(St),model:{defaults:{tagName:"ul",name:l,[zu]:"",classes:d,attributes:{[No]:St,role:"navigation"},droppable:Vu(jt),styles:`
|
|
61
|
+
</svg>`,rc="layout-icon-picker",Bu="icons-layout-",sc="icons-list-layout",lc="gs-iconify-picker",as="__iconify_collection",Vu="https://api.iconify.design",ji=new Map;let yo;const Hu=({collectionId:n})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${n}@latest/icons.json`;async function ac({collectionId:n,editor:e}){try{if(ji.has(n))return ji.get(n);const t=await fetch(Hu({collectionId:n}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const o=await t.json();return ji.set(n,o),o}catch(t){console.error("Error fetching collection",t),e.runCommand(G.toastAdd,Uu());return}}async function Fu({collectionIds:n,editor:e}){try{if(yo)return yo;const t=n?`?prefixes=${n.join(",")}`:"",o=await fetch(`${Vu}/collections${t}`);if(!o.ok)throw new Error(`Failed to fetch collections: ${o.statusText}`);return yo=await o.json(),yo}catch(t){console.error("Error fetching collections",t),e.runCommand(G.toastAdd,dc());return}}function Ls(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(n){var e;(e=n.getSelected())==null||e.trigger("active")}}}async function _u({collectionIds:n,editor:e,component:t}){const o=await Fu({collectionIds:n,editor:e});if(!o)return;const i=({icon:a,collectionId:c,iconId:d})=>{t.components(a),t.set({collectionId:c,iconId:d})},r=Object.entries(o).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),s=t.get("collectionId")??r[0].id;e.runCommand(G.layoutToggle,{id:rc,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[Wu({collectionsList:r,collectionId:s,editor:e,handleClick:i}),{id:sc,type:"column",grow:!0}]}});const l=await ac({collectionId:s,editor:e});l&&(cc({editor:e,collection:l}),pr({editor:e,collection:l,handleClick:i,collectionId:s}))}function cc({editor:n,collection:e}){n.em.set(as,e)}function Gu(n){return n.em.get(as)}function pr(n){const{editor:e}=n;e.runCommand(G.layoutUpdate,{id:Bu,layout:qu(n),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:sc}})}function Wu(n){const{collectionsList:e,collectionId:t,editor:o,handleClick:i}=n,r=e.map(({id:s,name:l,total:a})=>({id:s,label:`${l} (${a})`})).sort((s,l)=>s.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${lc}__header`,children:[{type:"selectField",value:t,options:r,emptyState:"Select an icon collection",onChange:async({setState:s,value:l})=>{const a=await ac({collectionId:l,editor:o});a&&(s({value:l}),cc({editor:o,collection:a}),pr({editor:o,collection:a,handleClick:i,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${as}`]:({setState:s})=>s({value:""})},onInput:({setState:s,value:l,editor:a})=>{const c=Gu(a);if(!c)return;const d=Object.fromEntries(Object.entries(c.icons).filter(([p])=>p.includes(l)));s({value:l}),pr({editor:a,collection:c,handleClick:i,collectionId:t,collectionFiltered:{...c,icons:d}})}}]}}function qu({collection:n,collectionFiltered:e,handleClick:t}){const{height:o=24,width:i=24,icons:r,prefix:s}=e||n,l=Object.entries(r).map(([a,c])=>({name:a,...c}),{});return{type:"column",className:`${lc}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>({type:"custom",render:c=>{const{editor:d,addEl:p,removeEl:u}=c,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.innerHTML=a.body;const h=a.width||i,g=a.height||o;f.setAttribute("viewBox",`0 0 ${h} ${g}`),f.style.cssText="width: 48px; height: 48px; cursor: pointer; border-radius: 4px; transition: padding 0.1s ease-in-out;";const b=[["click",()=>{const x=f.cloneNode(!0);x.removeAttribute("style");const C=x.outerHTML;t({icon:C,collectionId:s,iconId:a.name}),d==null||d.runCommand(G.layoutRemove,{id:rc})}],["pointerover",()=>{f.style.border="2px solid currentColor",f.style.padding="4px"}],["pointerout",()=>{f.style.border="",f.style.padding=""}]];return b.forEach(([x,C])=>f.addEventListener(x,C)),p(f),()=>{b.forEach(([x,C])=>f.removeEventListener(x,C)),u(f)}}})}}}function dc(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:Qa.Error}}function Uu(){return{...dc(),id:"toast-error-getCollection",content:"Error fetching collection"}}const Ku=function(n,e={}){var f;const{Components:t,Blocks:o}=n,{collections:i,extendIconComponent:r=!0,licenseKey:s,block:l={}}=e,a="icon",c="iconify",d="Iconify",p="data-type-iconify",u={events:()=>({dblclick:"onActive"}),onActive(){_u({collectionIds:i,editor:n,component:this.model})}};if(t.addType(c,{block:l&&{label:d,media:Ai,content:{type:c},category:"Extra",activate:!0,...l},isComponent:h=>Oo(h,p),model:{defaults:{name:d,icon:Ai,droppable:!1,attributes:{[p]:!0},resizable:Lu,components:Ai,style:{width:"50px",height:"50px"},traits:[Ls()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(h=>h.set({layerable:!1,locked:!0}))}},view:u}),r){const h=(f=t.getType(a))==null?void 0:f.model,[g,b,...x]=h.getDefaults().traits;t.addType(a,{model:{defaults:{traits:[g,b,Ls(),...x]}},view:u})}q({editor:n,licenseKey:s,plan:Ru,pluginName:ic,cleanup:()=>{o.remove(c),t.removeType(c)}})},Ju=W(Ku,ic);function Jn(n,e,t){let o,i,r,s,l;const a=e===void 0?100:e;function c(){const p=Date.now()-s;p<a&&p>=0?o=setTimeout(c,a-p):(o=null,l=n.apply(r,i),r=i=null)}const d=function(){return r=this,i=arguments,s=Date.now(),o||(o=setTimeout(c,a)),l};return d.clear=function(){o&&(clearTimeout(o),o=null)},d.flush=function(){o&&(l=n.apply(r,i),r=i=null,clearTimeout(o),o=null)},d}const pc="tableComponent",Yu=F.startup;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 V={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>'},qe="table",uc="thead",fc="tfoot",ur="tbody",ve="row",K="cell",cs="clipboardTable",Zu=[qe,uc,fc,ur,ve,K],hi=n=>n.em.get(cs)||[],Xu=n=>n.every(e=>e.is(K)),ds=(n,e)=>{const{editor:t,event:o,opts:i}=n,r=o.currentTarget||o.target,{x:s,y:l,width:a,height:c}=r.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:s,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};We(i.openSettings)?i.openSettings({...n,layoutProps:d}):t.runCommand(G.layoutToggle,d)},Qu=(n,{rows:e=1,cells:t=5,text:o}={})=>({type:n,components:Array.from(Array(e).keys()).map(i=>({type:ve,components:Array.from(Array(t).keys()).map(r=>({type:K,components:o?{type:"text",content:We(o)?o({y:i,x:r}):o}:void 0}))}))}),hc="Table settings",mc=n=>{const{component:e}=n;return e.is(qe)?e:e.closestType(qe)},ef=n=>{var e;(e=mc(n))==null||e.remove(n.opts)},tf=n=>{const e=mc(n);e&&(n.editor.select(e),ds(n,{id:"tableSettings",header:{label:hc}}))},gc=n=>[{id:O.table,icon:V[O.table],label:"Table",items:[{id:O.tableSettings,label:hc,icon:V[O.tableSettings],onClick:({event:t})=>tf({...n,event:t})},{id:O.tableDelete,label:"Delete table",icon:V[O.tableDelete],onClick:()=>ef(n)}]}],bc=({editor:n})=>{const e=hi(n);return e.length&&Xu(e)},Bs=({component:n,editor:e,after:t})=>{if(!n.is(K))return;const o=n.closestType(qe),i=n.closestType(ve),r=n.index()+(t?1:0);o==null||o.findType(ve).forEach(l=>l.append({type:K},{at:r}));const s=i==null?void 0:i.components().at(r);s&&e.select(s)},yc=({component:n,opts:e})=>{if(!n.is(K))return;const t=n.closestType(qe),o=n.index();t==null||t.findType(ve).forEach(i=>{var r;return(r=i.components().at(o))==null?void 0:r.remove(e)})},xc=({component:n,editor:e})=>{if(!n.is(K))return;const t=n.closestType(qe),o=n.index(),i=(t==null?void 0:t.findType(ve).map(r=>r.components().at(o)))||[];i.length&&e.em.set(cs,i)},Vs=n=>{const{component:e,editor:t,after:o}=n;if(!e.is(K)||!bc(n))return;const i=hi(t),r=e.closestType(qe),s=e.index()+(o?1:0);r==null||r.findType(ve).forEach((l,a)=>{const c=i[a],d=(c==null?void 0:c.clone())||{type:K};l.append(d,{at:s})})},nf=n=>{const{component:e}=n;e.is(K)&&(xc(n),yc({...n,opts:{temporary:!0}}))},of=n=>{const e=bc(n);return[{id:O.tableColumnItems,icon:V[O.tableColumn],label:"Column",items:[{id:O.tableColumnInsertBefore,label:"Insert column before",icon:V[O.tableColumnInsertBefore],onClick:()=>Bs(n)},{id:O.tableColumnInsertAfter,label:"Insert column after",icon:V[O.tableColumnInsertAfter],onClick:()=>Bs({...n,after:!0})},{id:O.tableColumnDelete,label:"Delete column",icon:V[O.tableColumnDelete],onClick:()=>yc(n)},{id:O.tableColumnCut,label:"Cut column",icon:V[O.tableColumnCut],onClick:()=>nf(n)},{id:O.tableColumnCopy,label:"Copy column",icon:V[O.tableColumnCopy],onClick:()=>xc(n)},{id:O.tableColumnPasteBefore,label:"Paste column before",icon:V[O.tableColumnPasteBefore],disabled:!e,onClick:()=>Vs(n)},{id:O.tableColumnPasteAfter,label:"Paste column after",icon:V[O.tableColumnPasteAfter],disabled:!e,onClick:()=>Vs({...n,after:!0})}]}]},vc="Row settings",rf=n=>n.every(e=>e.is(ve)),Cn=n=>{const{component:e}=n,t=e.is(K),o=e.is(ve);if(!(!t&&!o))return o?e:e.closestType(ve)},Hs=n=>{const{component:e,editor:t,after:o}=n,i=Cn(n);if(!i)return;const r=i.index()+(o?1:0),s=i.components().length,l=Array.from(Array(s).keys()).map(()=>({type:K})),a=i.parent();if(a){const c=a.append({type:ve,components:l},{at:r})[0];if(e.is(K)&&c){const d=e.index(),p=c.components().at(d);p&&t.select(p)}}},wc=n=>{var e;(e=Cn(n))==null||e.remove(n.opts)},Sc=n=>{const e=Cn(n);e&&n.editor.em.set(cs,[e])},Fs=n=>{var l;const{editor:e,after:t}=n,o=Cn(n);if(!o||!Cc(n))return;const r=hi(e)[0],s=o.index()+(t?1:0);r&&((l=o.parent())==null||l.append(r.clone(),{at:s}))},sf=n=>{Cn(n)&&(Sc(n),wc({...n,opts:{temporary:!0}}))},Cc=({editor:n})=>{const e=hi(n);return e.length&&rf(e)},lf=n=>{const e=Cn(n);e&&(n.editor.select(e),ds(n,{id:"tableRowSettings",header:{label:vc}}))},kc=n=>{const e=Cc(n);return[{id:O.tableRowItems,icon:V[O.tableRowProperties],label:"Row",items:[{id:O.tableRowInsertBefore,label:"Insert row before",icon:V[O.tableRowInsertBefore],onClick:()=>Hs(n)},{id:O.tableRowInsertAfter,label:"Insert row after",icon:V[O.tableRowInsertAfter],onClick:()=>Hs({...n,after:!0})},{id:O.tableRowDelete,label:"Delete row",icon:V[O.tableRowDelete],onClick:()=>wc(n)},{id:O.tableRowProperties,label:vc,icon:V[O.tableRowProperties],onClick:({event:o})=>lf({...n,event:o})},{id:O.tableRowCut,label:"Cut row",icon:V[O.tableRowCut],onClick:()=>sf(n)},{id:O.tableRowCopy,label:"Copy row",icon:V[O.tableRowCopy],onClick:()=>Sc(n)},{id:O.tableRowPasteBefore,label:"Paste row before",icon:V[O.tableRowPasteBefore],disabled:!e,onClick:()=>Fs(n)},{id:O.tableRowPasteAfter,label:"Paste row after",icon:V[O.tableRowPasteAfter],disabled:!e,onClick:()=>Fs({...n,after:!0})}]},...gc(n)]},ps=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),o=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:o}};function Tc(n){const e=[];return n.components().forEach((t,o)=>{t.components().each((i,r)=>{const{rowspan:s,colspan:l}=ps(i);if(e[o])for(;e[o][r];)r++;for(let a=o;a<o+s;a++){e[a]||(e[a]=[]);for(let c=r;c<r+l;c++)e[a][c]={real:a===o&&c===r,cell:i,rowspan:s,colspan:l}}})}),e}function on(n,e,t){var o;return(o=n[t])==null?void 0:o[e]}const fr=n=>n.closestType(ve);function af(n,{x:e,y:t,rows:o,cols:i}){var l;let r=fr(n[t][e].cell),s;for(let a=1;a<=o;a++)if(r=(l=r==null?void 0:r.parent())==null?void 0:l.components().at(r.index()+1),r){for(s=e;s>=0;s--){const{cell:c}=n[t+a][s],d=fr(c);if(d===r){for(let p=1;p<=i;p++){const u=c.index();d.append({type:K},{at:u+1})}break}}if(s===-1){const d=r.components().at(0).index();for(let p=1;p<=i;p++)r.append({type:K},{at:d})}}}function Ec(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const i=n[e][t].cell;if(i.em.selected.hasComponent(i)){const{rowspan:r,colspan:s}=ps(i);if(s>1||r>1){i.addAttributes({colspan:1,rowspan:1});for(let l=0;l<s-1;l++){const a=i.index();fr(i).append({type:K},{at:a+1})}af(n,{x:t,y:e,rows:r-1,cols:s})}}}}function cf(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const mi=(n,e={})=>{var s;const t=Tc(n),{em:o}=n;let i,r;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((s=e.selected)!=null&&s.includes(c.cell)||o.selected.hasComponent(c.cell)){const d={x:a,y:l};i||(i=d),r=d}}return{grid:t,startPos:i,endPos:r}};function df(n,e={}){const t=mi(n),{startPos:o,endPos:i}=t;let{grid:r}=t;const{em:s}=n;if(!o||!i)return;const l=o.x,a=o.y,c=i.x,d=i.y,p=on(r,l,a),u=on(r,c,d);if(p&&u){Ec(r),r=Tc(n);const f=[],h=on(r,l,a).cell;h.addAttributes({colspan:c-l+1,rowspan:d-a+1});for(let g=a;g<=d;g++)for(let b=l;b<=c;b++){const x=on(r,b,g);if(!x)continue;const{cell:C}=x;C!==h&&f.push(C)}f.forEach(g=>{e.mergeContent&&h.append(g.components().models),g.remove()}),s.setSelected(h),cf(n)}}const Mc="Cell settings",pf="Merge cells",uf="Split cell",ff=n=>n.closestType(ve),gn=n=>{var e;return(e=ff(n))==null?void 0:e.parent()},hf=n=>{const e=n.editor.getSelectedAll(),t=gn(e[0]),o=e[0];if(!t||!(o!=null&&o.is(K))||e.length>1)return!1;const{rowspan:i,colspan:r}=ps(o);return!(r<2&&i<2)},mf=n=>{const t=n.editor.getSelectedAll()[0],o=gn(t),{grid:i}=mi(o);Ec(i)},Ac=n=>{const e=n.editor.getSelectedAll(),t=gn(e[0]);if(!t||e.length<2||e.some(l=>!l.is(K)||gn(l)!==t))return!1;const{grid:o,startPos:i,endPos:r}=mi(t),{em:s}=t;if(!i||!r)return!1;for(let l=i.y;l<=r.y;l++)for(let a=i.x;a<=r.x;a++){const c=on(o,a,l);if(!c||!s.selected.hasComponent(c.cell))return!1}return!0},gf=n=>{const{editor:e}=n;if(!Ac(n))return;const t=e.getSelectedAll(),o=gn(t[0]);df(o,{mergeContent:!0})},bf=n=>{ds(n,{id:"tableCellSettings",header:{label:Mc}})},yf=n=>[{id:O.tableCellItems,icon:V[O.tableCellProperties],label:"Cell",items:[{id:O.tableCellProperties,label:Mc,icon:V[O.tableCellProperties],onClick:({event:t})=>bf({...n,event:t})},{id:O.tableCellMerge,label:pf,icon:V[O.tableCellMerge],onClick:()=>gf(n),disabled:!Ac(n)},{id:O.tableCellSplit,label:uf,icon:V[O.tableCellSplit],onClick:()=>mf(n),disabled:!hf(n)}]},...of(n),...kc(n)],xf=n=>{const e=n[0]&&gn(n[0]);if(!e)return;const{grid:t,startPos:o,endPos:i}=mi(e,{selected:n});if(!o||!i)return;const r=[];for(let s=o.y;s<=i.y;s++)for(let l=o.x;l<=i.x;l++){const a=on(t,l,s);a&&r.push(a.cell)}r.length&&e.em.setSelected(r,{fromCell:!0})},vf=function(n,e={}){const t={block:{},...e},{Components:o}=n,i={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"]};o.addType(qe,{block:t.block&&{label:"Table",media:V.table,category:"Extra",content:{type:qe,style:{width:"100%"}},select:!0,...t.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:V.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:s,value:l,emitUpdate:a}){const c=s.find("caption")[0];l?!c&&s.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(s){return!!s.component.find("caption")[0]}}],components:Qu(ur,{rows:5}),contextMenu:({items:s,editor:l,component:a})=>[...gc({editor:l,component:a,opts:t}),...s]}}}),o.addType(uc,{model:{defaults:{icon:V.tableHead,...i}}}),o.addType(fc,{model:{defaults:{icon:V.tableFoot,...i}}}),o.addType(ur,{model:{defaults:{icon:V.tableRowProperties,...i}}}),o.addType(ve,{model:{defaults:{icon:V.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:s,editor:l,component:a})=>[...kc({editor:l,component:a,opts:t}),...s]}}}),o.addType(K,{model:{defaults:{icon:V.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:s,editor:l,component:a})=>[...yf({editor:l,component:a,opts:t}),...s]}}});const r=Jn((s,l)=>{var p;const a=n.getSelectedAll(),c=!!((p=l==null?void 0:l.event)!=null&&p.shiftKey);if(a.length<2||!c||l.fromCell)return;const d=a.map(u=>u.is(K)?u:u.closestType(K)).filter(Boolean);d.length===a.length&&xf(d)},0);n.on("component:select",r),q({editor:n,plan:Yu,pluginName:pc,licenseKey:t.licenseKey,cleanup:()=>{n.off("component:select",r),n.Blocks.remove(qe),Zu.forEach(s=>o.removeType(s))}})},wf=W(vf,pc),jc="listPagesComponent",Sf=F.startup,_s="page://",Ct="list-pages",Kt="list-pages-item",Tt="list-pages-link",Cf=n=>n.components().reduce((e,t)=>{var s;const o=t.findFirstType(Tt),i=(s=o==null?void 0:o.attributes.attributes)==null?void 0:s.href,r=i!=null&&i.startsWith(_s)?i.replace(_s,""):"";if(r&&o){const l=e[r];l?l.push(o):e[r]=[o]}return e},{}),Io="data-type-role",kf="page_root",Tf=n=>e=>e.is(n),Ef=n=>(e,t)=>t.is(n),$i=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,Io))===n},Mf=function(n,e={}){const{Blocks:t,Components:o,Pages:i}=n,{licenseKey:r,block:s={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${je}${Ct}`,p=`${je}${Tt}`,u='<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>';o.addType(Ct,{block:s&&{label:l,media:u,category:"Extra",select:!0,...e.block},isComponent:$i(Ct),model:{defaults:{tagName:"ul",name:l,[kf]:"",classes:d,attributes:{[Io]:Ct,role:"navigation"},droppable:Tf(Kt),styles:`
|
|
62
62
|
.${d} {
|
|
63
63
|
list-style: none;
|
|
64
64
|
margin: 0;
|
|
65
65
|
padding: 0;
|
|
66
66
|
}
|
|
67
|
-
`},init(){this.syncPageItems=
|
|
67
|
+
`},init(){this.syncPageItems=Jn(this.syncPageItems.bind(this),0),this.listenTo(this.em,i.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(n.Components.getSymbolInfo(this).isInstance)return;const h=this.em.Pages.getAll(),g=this.components(),b=Cf(this);h.forEach((x,C)=>{const y=x.id,v=x.getName(),k=b[y];k?k==null||k.forEach(w=>{w.getInnerHTML()!==v&&w.components(v)}):g.add({type:Kt,components:[{type:Tt,attributes:{href:`page://${y}`},components:{type:"textnode",content:v}}]},{at:C})})}}}),o.addType(Kt,{isComponent:$i(Kt),model:{defaults:{name:a,tagName:"li",icon:f,attributes:{[Io]:Kt},components:{type:Tt},draggable:Ef(Ct)}}}),o.addType(Tt,{extend:"link",isComponent:$i(Tt),model:{defaults:{removable:!1,copyable:!1,delegate:{move:h=>h.closestType(Kt)},name:c,classes:p,attributes:{[Io]:Tt},components:{type:"textnode",content:"Item"},styles:`
|
|
68
68
|
.${p} {
|
|
69
69
|
text-decoration: none;
|
|
70
70
|
}
|
|
71
|
-
`}}}),
|
|
71
|
+
`}}}),q({editor:n,licenseKey:r,plan:Sf,pluginName:jc,cleanup:()=>{t.remove(Ct),o.removeType(Ct)}})},Af=W(Mf,jc),$c="fsLightboxComponent",jf=F.startup,xo="data-fslightbox",vo="data-type",$f="fslightbox-open",Jt="fslightbox",Yt={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>'},Pf=function(n,e={}){const{Blocks:t,Components:o}=n,i="Lightbox",r=`${je}${Jt}`,s={toolbarIconOpen:Yt.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}=s,d=function(C){const y=this,v="data-fslightbox",k=window,w=()=>{var A;const S=k.refreshFsLightbox;S==null||S();const E=y.getAttribute(v);if((A=k.fsLightboxInstances)==null||A[E],!k._isEditor)return;Array.from(document.querySelectorAll(`[${v}]`)).forEach($=>{const P=$.onclick;$.onclick=function(N){N.preventDefault();const I=$;!I.__skipLb&&(P==null||P(N)),I.__skipLb=!0}})};if(k.refreshFsLightbox)w();else{const S=document.createElement("script");S.src=C.cdnScript,S.onload=w,document.head.appendChild(S)}},p=C=>({id:`${Jt}-open-lb`,label:a,command:()=>{const y=C.getView();y==null||y.toggleLightbox()}}),u="source-type",f={type:"radio",name:u,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:Yt.image},{id:"video",label:"Video",icon:Yt.video},{id:"el",label:"Custom Element",icon:Yt.external}],labelToTitle:!0},h={id:"href-image",name:"href",type:"file",label:"Source Image"},g={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},b={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},x={image:[h],video:[g],el:[b]};o.addType(Jt,{block:l&&{label:i,media:Yt.imageLightbox,category:"Extra",select:!0,...s.block},isComponent:C=>{var y;return(y=C.hasAttribute)==null?void 0:y.call(C,xo)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:i,icon:Yt.imageLightbox,classes:r,draggable:(C,y)=>!y.is(Jt),attributes:{[xo]:"lightbox",[vo]:"image",href:c},components:{type:"image",src:c},script:d,cdnScript:s.cdnScript,"script-props":["attributes","cdnScript"],[u]:"image",traits:[f,{name:xo,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(C,y){var k;const v=(k=y.target)==null?void 0:k.getView();v==null||v.toggleLightbox()}}],styles:`
|
|
72
72
|
.${r} {
|
|
73
73
|
display: inline-block;
|
|
74
74
|
padding: 10px;
|
|
75
75
|
}
|
|
76
|
-
`},init(){const w=[u].map(y=>`change:${y}`).join(" ");this.on(w,this.updateTraits),this.on(`change:${u}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(w,y,v){if(v.adjust)return;const S=this.get(u)==="video"?"video":"image";this.addAttributes({[go]:S,href:""})},adjustSourceType(){const w=this.get(u),y=this.getAttributes().href||"",v={adjust:!0};if(w==="video"){const C=y.includes("youtube.com")?"youtube":"video";this.addAttributes({[go]:C},v)}else w!=="el"&&y.startsWith("#")?this.set(u,"el",v):w==="image"&&this.addAttributes({[go]:"image"},v)},updateTraits(w={}){const{changed:y}=this,{init:v}=w;if(y[h.name]||v){this.removeTrait([f.name,m.name,g.name]);const C=this.get(u)||"image",S=this.getTraitIndex(u)+1;this.addTrait(b[C],{at:S})}},initToolbar(){if(!a)return;const{toolbar:w}=this,y=p(this);!w.find(C=>C.id===y.id)&&(w==null||w.unshift(y))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var P;const{em:w,el:y,model:v}=this,{Canvas:C}=w,S=v.getAttributes()[mo],{defaultView:x,documentElement:E}=y.ownerDocument,k=(P=x.fsLightboxInstances)==null?void 0:P[S];if(E.classList.contains(Wu))k.close();else{y.__skipLb=!1;let N;k.props.onOpen=()=>{N=C.getSpots(),setTimeout(()=>C.removeSpots())},k.props.onClose=()=>{N.forEach(O=>C.addSpot(O.attributes))},y.click()}}}}),W({editor:n,plan:Gu,licenseKey:i.licenseKey,pluginName:_u,cleanup:()=>{t.remove(qt),o.removeType(qt)}})},qu=G(ju),Uu="lightGalleryComponent",Ku=H.startup;var Yt=(n=>(n.image="image",n.video="video",n.external="external",n))(Yt||{});const Ct="lightGallery",Di=`${Ct}-item`,Oo="data-lightgallery",Li=`${Oo}-item`,Ho="toggle",Tt={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>'},Ms={propKeys:[],props:{},traits:[]},Cn=(n,e={})=>{var s;const t={},o=[];for(const r in n){const{value:i,...l}=n[r];o.push({id:r,name:r,changeProp:!0,category:e.category,...l}),t[r]=i;const{subTraits:a={}}=l;for(const c in l.subTraits)(s=a[c])==null||s.forEach(d=>{const p=d.id||d.name;t[p]=d.value})}return{propKeys:Object.keys(t),props:t,traits:o}},ir=(n,e)=>{const t=n.getTrait(e),o=t.get("category"),s=t.get("subTraits")||{},i=(Object.values(s).flat()||[]).map(c=>c.id||c.name);n.removeTrait(i);const l=s[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:o,...c})),{at:a})},As=(n,e)=>{e.forEach(t=>{const o=n.getTrait(t);if(!o||!o.get("subTraits"))return;const s=o.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(s,()=>ir(n,t)),ir(n,t)})},Ju=(n,e,t)=>{const s=n.getTrait(e).get("subTraits")||{},i=(Object.values(s).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(i));l.length&&n.on(l.join(" "),t)},Zu={[Ho]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var t,o;return(o=(t=e.target)==null?void 0:t.getView())==null?void 0:o.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}},Yu={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"}]}}},Xu={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}]}}},Qu={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}]}}},nt="sourceType",yo="data-iframe",lr={name:"href",type:"file",label:"Image Source"},Fo={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},ar={name:"data-poster",label:"Video Poster",type:"file"},$i={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ac={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},eh={[Ho]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var s,r;const t=e.target,o=(s=t==null?void 0:t.closestType(Ct))==null?void 0:s.getView();if(o&&t){const i=((r=o.getLightGallery())==null?void 0:r.items)||[],l=Array.from(i).indexOf(t.getEl());l>=0&&o.toggleGallery(l)}}},[nt]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[lr],video:[Fo,ar],external:[$i]},options:[{id:"image",label:lr.label||"",icon:Tt.image},{id:"video",label:Fo.label||"",icon:Tt.video},{id:"external",label:$i.label||"",icon:Tt.external}]},subHtml:ac},zi="lgThumbnail",th="lgVideo",Vi="lgAutoplay",Bi="lgZoom",Kt="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",nh=function(n,e={}){const{Blocks:t,Components:o}=n,s="LightGallery",r="LightGallery Item",i={toolbarIconOpen:Tt.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[zi,th,Vi,Bi],cdnScript:[`${Kt}/lightgallery.min.js`,`${Kt}/plugins/thumbnail/lg-thumbnail.min.js`,`${Kt}/plugins/video/lg-video.min.js`,`${Kt}/plugins/autoplay/lg-autoplay.min.js`,`${Kt}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Kt}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=i,d=function(y){const v=this,C=window,{plugins:S,cdnScript:x,cdnStyle:E,inline:k,lgLicenseKey:M,...P}=y||{},N=R=>isNaN(R)?void 0:parseInt(R,10),O=()=>{var ie;const R={...P,licenseKey:M,speed:N(P.speed),startAnimationDuration:N(P.startAnimationDuration),thumbMargin:N(P.thumbMargin),thumbWidth:N(P.thumbWidth),slideShowInterval:N(P.slideShowInterval),scale:N(P.scale),enableZoomAfter:N(P.enableZoomAfter),plugins:(S||[]).map(le=>C[le])};k&&(R.container=v,R.closable=!1);const F=(ie=C.lightGallery)==null?void 0:ie.call(C,v,R);k&&F.openGallery()};if(C.lightGallery)O();else{const{head:R}=document,F=Array.isArray(x)?[...x]:[x],ie=Array.isArray(E)?[...E]:[E],le=ve=>{if(ve.length){const Ce=document.createElement("link");Ce.href=ve.shift(),Ce.rel="stylesheet",R.appendChild(Ce),le(ve)}},Ke=ve=>{if(ve.length){const Ce=document.createElement("script");Ce.src=ve.shift(),Ce.onerror=Ce.onload=Ke.bind(null,ve),R.appendChild(Ce)}else O()};le(ie),Ke(F)}},p=y=>{const v=y.getTrait(Ho);if(!a||!v)return;const{toolbar:C}=y,S={id:Ho,label:a,command:()=>setTimeout(()=>v.runCommand(),100)};!C.find(E=>E.id===S.id)&&(C==null||C.unshift(S))};let u=[];const h=i.plugins||[],f=Cn(Zu),m=h.includes(zi)?Cn(Yu):Ms,g=h.includes(Vi)?Cn(Xu):Ms,b=h.includes(Bi)?Cn(Qu):Ms;o.addType(Ct,{block:l&&{label:s,media:Tt.gallery,category:"Extra",select:!0,...i.block},isComponent:y=>Po(y,Oo),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:Tt.gallery,draggable:(y,v)=>!v.is(Ct),attributes:{[Oo]:!0},components:{type:Di},script:d,selector:"",exThumbImage:"",cdnScript:i.cdnScript,cdnStyle:i.cdnStyle,plugins:i.plugins,lgLicenseKey:i.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...f.propKeys,...m.propKeys,...g.propKeys,...b.propKeys],...f.props,...m.props,...g.props,...b.props,traits:[...f.traits,...m.traits,...g.traits,...b.traits]},init(){As(this,["thumbnail"]),As(this,["autoplay"]),As(this,["zoom"])},initToolbar(){p(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,o.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,C=this.getLightGallery();u=v.getSpots(),setTimeout(()=>v.removeSpots()),C.__lgOpened=!0},onLgClose(){const y=this.getLightGallery();u.forEach(v=>this.em.Canvas.addSpot(v.attributes)),u=[],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 w=Cn(eh);o.addType(Di,{isComponent:y=>Po(y,Li)||y.tagName==="A"&&Po(y.parentElement,Oo),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:r,icon:Tt.galleryItem,attributes:{[Li]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...w.props,traits:[...w.traits]},init(){const y=[nt].map(v=>`change:${v}`).join(" ");this.initSourceType(),this.on(y,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ju(this,nt,this.triggerGalleryUpdate)},initToolbar(){p(this)},initScriptUpdate(){const y=[ac.name].map(v=>`change:attributes:${v}`).join(" ");this.on(y,this.triggerGalleryUpdate)},triggerGalleryUpdate(...y){var v;(v=this.closestType(Ct))==null||v.__scriptPropsChange(...y)},updateTraits(y={}){const{changed:v}=this,{init:C}=y;if(v[nt]||C){ir(this,nt);const S=this.getTrait(nt).getValue();if(S===Yt.image){this.removeAttributes([Fo.name,ar.name,yo]);const x=this.getTrait(lr.name);x.setValue(x.getValue()||c)}else S===Yt.video?this.removeAttributes([yo]):S===Yt.external&&this.addAttributes({[yo]:!0})}},initSourceType(){const y=this.getAttributes({noClass:!0,noStyle:!0});y[yo]?this.set(nt,Yt.external):(y[Fo.name]||y[ar.name])&&this.set(nt,Yt.video)}}}),W({editor:n,plan:Ku,licenseKey:i.licenseKey,pluginName:Uu,cleanup:()=>{t.remove(Ct),o.removeType(Ct)}})},oh=G(nh),Ie="swiper",qn=`${Ie}-slide`,sn=`${Ie}-wrapper`,rn=`${Ie}-nav-prev`,_o=`${Ie}-nav-next`,ln=`${Ie}-pagination`,Dn=`${Ie}-scrollbar`,ce={slider:`<svg viewBox="0 0 24 24">
|
|
76
|
+
`},init(){const C=[u].map(y=>`change:${y}`).join(" ");this.on(C,this.updateTraits),this.on(`change:${u}`,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(u)==="video"?"video":"image";this.addAttributes({[vo]:w,href:""})},adjustSourceType(){const C=this.get(u),y=this.getAttributes().href||"",v={adjust:!0};if(C==="video"){const k=y.includes("youtube.com")?"youtube":"video";this.addAttributes({[vo]:k},v)}else C!=="el"&&y.startsWith("#")?this.set(u,"el",v):C==="image"&&this.addAttributes({[vo]:"image"},v)},updateTraits(C={}){const{changed:y}=this,{init:v}=C;if(y[f.name]||v){this.removeTrait([h.name,g.name,b.name]);const k=this.get(u)||"image",w=this.getTraitIndex(u)+1;this.addTrait(x[k],{at:w})}},initToolbar(){if(!a)return;const{toolbar:C}=this,y=p(this);!C.find(k=>k.id===y.id)&&(C==null||C.unshift(y))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var $;const{em:C,el:y,model:v}=this,{Canvas:k}=C,w=v.getAttributes()[xo],{defaultView:S,documentElement:E}=y.ownerDocument,T=($=S.fsLightboxInstances)==null?void 0:$[w];if(E.classList.contains($f))T.close();else{y.__skipLb=!1;let P;T.props.onOpen=()=>{P=k.getSpots(),setTimeout(()=>k.removeSpots())},T.props.onClose=()=>{P.forEach(N=>k.addSpot(N.attributes))},y.click()}}}}),q({editor:n,plan:jf,licenseKey:s.licenseKey,pluginName:$c,cleanup:()=>{t.remove(Jt),o.removeType(Jt)}})},Nf=W(Pf,$c),Pc="lightGalleryComponent",Of=F.startup;var en=(n=>(n.image="image",n.video="video",n.external="external",n))(en||{});const Mt="lightGallery",Gs=`${Mt}-item`,Do="data-lightgallery",Ws=`${Do}-item`,Go="toggle",$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>',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>'},Pi={propKeys:[],props:{},traits:[]},En=(n,e={})=>{var i;const t={},o=[];for(const r in n){const{value:s,...l}=n[r];o.push({id:r,name:r,changeProp:!0,category:e.category,...l}),t[r]=s;const{subTraits:a={}}=l;for(const c in l.subTraits)(i=a[c])==null||i.forEach(d=>{const p=d.id||d.name;t[p]=d.value})}return{propKeys:Object.keys(t),props:t,traits:o}},hr=(n,e)=>{const t=n.getTrait(e),o=t.get("category"),i=t.get("subTraits")||{},s=(Object.values(i).flat()||[]).map(c=>c.id||c.name);n.removeTrait(s);const l=i[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:o,...c})),{at:a})},Ni=(n,e)=>{e.forEach(t=>{const o=n.getTrait(t);if(!o||!o.get("subTraits"))return;const i=o.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(i,()=>hr(n,t)),hr(n,t)})},If=(n,e,t)=>{const i=n.getTrait(e).get("subTraits")||{},s=(Object.values(i).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(s));l.length&&n.on(l.join(" "),t)},Df={[Go]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var t,o;return(o=(t=e.target)==null?void 0:t.getView())==null?void 0:o.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}},zf={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"}]}}},Rf={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}]}}},Lf={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}]}}},rt="sourceType",wo="data-iframe",mr={name:"href",type:"file",label:"Image Source"},Wo={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},gr={name:"data-poster",label:"Video Poster",type:"file"},qs={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},Nc={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Bf={[Go]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var i,r;const t=e.target,o=(i=t==null?void 0:t.closestType(Mt))==null?void 0:i.getView();if(o&&t){const s=((r=o.getLightGallery())==null?void 0:r.items)||[],l=Array.from(s).indexOf(t.getEl());l>=0&&o.toggleGallery(l)}}},[rt]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[mr],video:[Wo,gr],external:[qs]},options:[{id:"image",label:mr.label||"",icon:$t.image},{id:"video",label:Wo.label||"",icon:$t.video},{id:"external",label:qs.label||"",icon:$t.external}]},subHtml:Nc},Us="lgThumbnail",Vf="lgVideo",Ks="lgAutoplay",Js="lgZoom",Zt="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Hf=function(n,e={}){const{Blocks:t,Components:o}=n,i="LightGallery",r="LightGallery Item",s={toolbarIconOpen:$t.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[Us,Vf,Ks,Js],cdnScript:[`${Zt}/lightgallery.min.js`,`${Zt}/plugins/thumbnail/lg-thumbnail.min.js`,`${Zt}/plugins/video/lg-video.min.js`,`${Zt}/plugins/autoplay/lg-autoplay.min.js`,`${Zt}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Zt}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=s,d=function(y){const v=this,k=window,{plugins:w,cdnScript:S,cdnStyle:E,inline:T,lgLicenseKey:A,...$}=y||{},P=I=>isNaN(I)?void 0:parseInt(I,10),N=()=>{var ae;const I={...$,licenseKey:A,speed:P($.speed),startAnimationDuration:P($.startAnimationDuration),thumbMargin:P($.thumbMargin),thumbWidth:P($.thumbWidth),slideShowInterval:P($.slideShowInterval),scale:P($.scale),enableZoomAfter:P($.enableZoomAfter),plugins:(w||[]).map(ce=>k[ce])};T&&(I.container=v,I.closable=!1);const _=(ae=k.lightGallery)==null?void 0:ae.call(k,v,I);T&&_.openGallery()};if(k.lightGallery)N();else{const{head:I}=document,_=Array.isArray(S)?[...S]:[S],ae=Array.isArray(E)?[...E]:[E],ce=we=>{if(we.length){const Te=document.createElement("link");Te.href=we.shift(),Te.rel="stylesheet",I.appendChild(Te),ce(we)}},Ze=we=>{if(we.length){const Te=document.createElement("script");Te.src=we.shift(),Te.onerror=Te.onload=Ze.bind(null,we),I.appendChild(Te)}else N()};ce(ae),Ze(_)}},p=y=>{const v=y.getTrait(Go);if(!a||!v)return;const{toolbar:k}=y,w={id:Go,label:a,command:()=>setTimeout(()=>v.runCommand(),100)};!k.find(E=>E.id===w.id)&&(k==null||k.unshift(w))};let u=[];const f=s.plugins||[],h=En(Df),g=f.includes(Us)?En(zf):Pi,b=f.includes(Ks)?En(Rf):Pi,x=f.includes(Js)?En(Lf):Pi;o.addType(Mt,{block:l&&{label:i,media:$t.gallery,category:"Extra",select:!0,...s.block},isComponent:y=>Oo(y,Do),extendFn:["init","initToolbar"],model:{defaults:{name:i,icon:$t.gallery,draggable:(y,v)=>!v.is(Mt),attributes:{[Do]:!0},components:{type:Gs},script:d,selector:"",exThumbImage:"",cdnScript:s.cdnScript,cdnStyle:s.cdnStyle,plugins:s.plugins,lgLicenseKey:s.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...h.propKeys,...g.propKeys,...b.propKeys,...x.propKeys],...h.props,...g.props,...b.props,...x.props,traits:[...h.traits,...g.traits,...b.traits,...x.traits]},init(){Ni(this,["thumbnail"]),Ni(this,["autoplay"]),Ni(this,["zoom"])},initToolbar(){p(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,o.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,k=this.getLightGallery();u=v.getSpots(),setTimeout(()=>v.removeSpots()),k.__lgOpened=!0},onLgClose(){const y=this.getLightGallery();u.forEach(v=>this.em.Canvas.addSpot(v.attributes)),u=[],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=En(Bf);o.addType(Gs,{isComponent:y=>Oo(y,Ws)||y.tagName==="A"&&Oo(y.parentElement,Do),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:r,icon:$t.galleryItem,attributes:{[Ws]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...C.props,traits:[...C.traits]},init(){const y=[rt].map(v=>`change:${v}`).join(" ");this.initSourceType(),this.on(y,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),If(this,rt,this.triggerGalleryUpdate)},initToolbar(){p(this)},initScriptUpdate(){const y=[Nc.name].map(v=>`change:attributes:${v}`).join(" ");this.on(y,this.triggerGalleryUpdate)},triggerGalleryUpdate(...y){var v;(v=this.closestType(Mt))==null||v.__scriptPropsChange(...y)},updateTraits(y={}){const{changed:v}=this,{init:k}=y;if(v[rt]||k){hr(this,rt);const w=this.getTrait(rt).getValue();if(w===en.image){this.removeAttributes([Wo.name,gr.name,wo]);const S=this.getTrait(mr.name);S.setValue(S.getValue()||c)}else w===en.video?this.removeAttributes([wo]):w===en.external&&this.addAttributes({[wo]:!0})}},initSourceType(){const y=this.getAttributes({noClass:!0,noStyle:!0});y[wo]?this.set(rt,en.external):(y[Wo.name]||y[gr.name])&&this.set(rt,en.video)}}}),q({editor:n,plan:Of,licenseKey:s.licenseKey,pluginName:Pc,cleanup:()=>{t.remove(Mt),o.removeType(Mt)}})},Ff=W(Hf,Pc),Ie="swiper",Yn=`${Ie}-slide`,an=`${Ie}-wrapper`,cn=`${Ie}-nav-prev`,qo=`${Ie}-nav-next`,dn=`${Ie}-pagination`,Ln=`${Ie}-scrollbar`,pe={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,29 +96,29 @@
|
|
|
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>`},Hi={id:"swiper-responsive",label:"Responsive",icon:ce.responsive},Fi={id:"swiper-extra",label:"Extra",icon:ce.extra},sh={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:ce.reload},{id:"p",label:"Previous slide",icon:ce.prev},{id:"n",label:"Next slide",icon:ce.next},{id:"a",label:"Add new slide",icon:ce.add}],setValue:({component:n,value:e})=>{var o;const t=(o=n.getView())==null?void 0:o.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(rn),setValue:({component:n,value:e})=>{var t,o;e?n.append([{type:rn},{type:_o}]):((t=n.findFirstType(rn))==null||t.remove(),(o=n.findFirstType(_o))==null||o.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:ce.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:ce.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"checkbox",name:"autoplayEditor",label:"Autoplay in editor",tip:"Allow autoplay to run while editing in the canvas. Note: this may make selecting and editing slides difficult as they will automatically change.",changeProp:!0,value:!1},{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:ce.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(ln)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(ln);t==null||t.remove(),e!=="none"&&n.append({type:ln}),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:ce.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(Dn),setValue:({component:n,value:e})=>{const t=n.findFirstType(Dn);t==null||t.remove(),e&&n.append({type:Dn}),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:ce.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Hi,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:Hi,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:Fi,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Fi,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},_i="Slider",cr="swiper",xn=`${cr}-`,rh=(n,e)=>{const{Components:t,Blocks:o,Commands:s}=n,{block:r}=e,i=_p(sh),l="core:preview",a=s.events,c=function(u){const h=this,f=window,m=h.__onLoad,g=h.__activeSlide,b=h.__inPreview,w=f._isEditor&&!b?u.autoplayEditor:!0,{cdnScript:y,cdnStyle:v,slidesPerView:C}=u||{},S=E=>isNaN(E)?void 0:parseFloat(E),x=()=>{const E=h.parentElement;E&&(E.style.minWidth="0");const k={loop:u.loop,speed:u.speed,initialSlide:u.initialSlide,direction:u.vertical?"vertical":"horizontal",effect:u.effect,freeMode:u.freeMode,parallax:u.parallax,autoHeight:u.autoHeight,allowTouchMove:u.allowTouchMove,grabCursor:u.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(C)?C:S(C),slidesPerGroup:S(u.slidesPerGroup),spaceBetween:S(u.spaceBetween),slidesOffsetBefore:S(u.slidesOffsetBefore),slidesOffsetAfter:S(u.slidesOffsetAfter),centeredSlides:u.centeredSlides,fadeEffect:{crossFade:u.crossFade},cubeEffect:{shadow:u.cubeEffectShadow,slideShadows:u.cubeEffectSlideShadows,shadowOffset:S(u.cubeEffectShadowOffset),shadowScale:S(u.cubeEffectShadowScale)},coverflowEffect:{depth:S(u.coverflowEffectDepth),modifier:S(u.coverflowEffectModifier),rotate:S(u.coverflowEffectRotate),scale:S(u.coverflowEffectScale),stretch:S(u.coverflowEffectStretch),slideShadows:u.coverflowEffectSlideShadows},flipEffect:{limitRotation:u.flipEffectLimitRotation,slideShadows:u.flipEffectSlideShadows},cardsEffect:{perSlideOffset:S(u.cardsEffectPerSlideOffset),perSlideRotate:S(u.cardsEffectPerSlideRotate),rotate:u.cardsEffectRotate,slideShadows:u.cardsEffectSlideShadows},navigation:{nextEl:h.querySelector(".swiper-button-next"),prevEl:h.querySelector(".swiper-button-prev")},pagination:{type:u.pagination||"bullets",dynamicBullets:u.dynamicBullets,clickable:u.clickableBullets,progressbarOpposite:u.progressbarOpposite,el:h.querySelector(".swiper-pagination")},scrollbar:{el:h.querySelector(".swiper-scrollbar"),draggable:u.scrollbarDraggable,hide:u.scrollbarHide},autoplay:u.autoplay&&w&&{delay:u.autoplayDelay,disableOnInteraction:u.autoplayDisableOnInteraction,pauseOnMouseEnter:u.autoplayPauseOnMouseEnter,reverseDirection:u.autoplayReverseDirection,stopOnLastSlide:u.autoplayStopOnLastSlide,waitForTransition:u.autoplayWaitForTransition}};if(u.tablet){const{tabletBreakpoint:P,tabletSlidesPerView:N}=u,O=S(P);k.breakpoints[O]={slidesPerView:isNaN(N)?N:S(N),slidesPerGroup:S(u.tabletSlidesPerGroup),spaceBetween:S(u.tabletSpaceBetween)}}if(u.mobile){const{mobileBreakpoint:P,mobileSlidesPerView:N}=u,O=S(P);k.breakpoints[O]={slidesPerView:isNaN(N)?N:S(N),slidesPerGroup:S(u.mobileSlidesPerGroup),spaceBetween:S(u.mobileSpaceBetween)}}m&&!b&&(k.simulateTouch=!1),g&&(k.initialSlide=g);const M=new f.Swiper(h,k);m==null||m(M)};if(f.Swiper)x();else{const{head:E}=document,k=Array.isArray(y)?[...y]:[y],M=Array.isArray(v)?[...v]:[v],P=O=>{if(O.length){const R=document.createElement("link");R.href=O.shift(),R.rel="stylesheet",E.prepend(R),P(O)}},N=O=>{if(O.length){const R=document.createElement("script");R.src=O.shift(),R.onerror=R.onload=N.bind(null,O),E.appendChild(R)}else x()};P(M),N(k)}},d=(u=0)=>({type:qn,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${u}`}}}),p=t.getType("default").model;return t.addType(Ie,{block:r&&{label:_i,media:ce.slider,category:"Extra",select:!0,...e.block},isComponent:u=>gt(u,cr),model:{defaults:()=>({name:_i,icon:ce.slider,classes:cr,draggable:(u,h)=>!h.is(Ie),components:[{type:sn,components:[d(1),d(2),d(3)]},{type:ln}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...i.propKeys],...i.props,traits:[...i.traits]}),init(){const{em:u}=this;Gp(this,i.traits),Wp(this,i.propKeys),this.listenTo(u,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(u,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const u=this.findFirstType(sn);u==null||u.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var h;const u=((h=this.findFirstType(sn))==null?void 0:h.components().length)||0;return{type:qn,components:{type:"text",components:{type:"textnode",content:`Slide ${u+1}`}}}},toJSON(...u){const h=p.prototype.toJSON.apply(this,u);return i.propsNoValues.forEach(f=>delete h[f]),delete h["script-props"],h}},view:{init(){this.listenTo(this.model,t.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var u;(u=this.getSwiper())==null||u.destroy()},onRender(){const u=this.el;u.__onLoad=h=>h.on("slideChange",()=>this.__activeSlide=h.activeIndex),u.__activeSlide=this.__activeSlide,u.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(Ie),o.remove(Ie)}},ih="Nav Prev",lh="Nav Next",bo=`${xn}button-prev`,vo=`${xn}button-next`,ah=n=>{const{Components:e}=n,t=o=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:o,fill:"currentColor"}}});return e.addType(rn,{isComponent:o=>gt(o,bo),model:{defaults:{name:ih,classes:bo,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
|
-
.${
|
|
99
|
+
</svg>`},Ys={id:"swiper-responsive",label:"Responsive",icon:pe.responsive},Zs={id:"swiper-extra",label:"Extra",icon:pe.extra},_f={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:pe.reload},{id:"p",label:"Previous slide",icon:pe.prev},{id:"n",label:"Next slide",icon:pe.next},{id:"a",label:"Add new slide",icon:pe.add}],setValue:({component:n,value:e})=>{var o;const t=(o=n.getView())==null?void 0:o.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(cn),setValue:({component:n,value:e})=>{var t,o;e?n.append([{type:cn},{type:qo}]):((t=n.findFirstType(cn))==null||t.remove(),(o=n.findFirstType(qo))==null||o.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:pe.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:pe.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"checkbox",name:"autoplayEditor",label:"Autoplay in editor",tip:"Allow autoplay to run while editing in the canvas. Note: this may make selecting and editing slides difficult as they will automatically change.",changeProp:!0,value:!1},{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:pe.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(dn)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(dn);t==null||t.remove(),e!=="none"&&n.append({type:dn}),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:pe.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(Ln),setValue:({component:n,value:e})=>{const t=n.findFirstType(Ln);t==null||t.remove(),e&&n.append({type:Ln}),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:pe.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Ys,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:Ys,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:Zs,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Zs,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Xs="Slider",br="swiper",kn=`${br}-`,Gf=(n,e)=>{const{Components:t,Blocks:o,Commands:i}=n,{block:r}=e,s=Nu(_f),l="core:preview",a=i.events,c=function(u){const f=this,h=window,g=f.__onLoad,b=f.__activeSlide,x=f.__inPreview,C=h._isEditor&&!x?u.autoplayEditor:!0,{cdnScript:y,cdnStyle:v,slidesPerView:k}=u||{},w=E=>isNaN(E)?void 0:parseFloat(E),S=()=>{const E=f.parentElement;E&&(E.style.minWidth="0");const T={loop:u.loop,speed:u.speed,initialSlide:u.initialSlide,direction:u.vertical?"vertical":"horizontal",effect:u.effect,freeMode:u.freeMode,parallax:u.parallax,autoHeight:u.autoHeight,allowTouchMove:u.allowTouchMove,grabCursor:u.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(k)?k:w(k),slidesPerGroup:w(u.slidesPerGroup),spaceBetween:w(u.spaceBetween),slidesOffsetBefore:w(u.slidesOffsetBefore),slidesOffsetAfter:w(u.slidesOffsetAfter),centeredSlides:u.centeredSlides,fadeEffect:{crossFade:u.crossFade},cubeEffect:{shadow:u.cubeEffectShadow,slideShadows:u.cubeEffectSlideShadows,shadowOffset:w(u.cubeEffectShadowOffset),shadowScale:w(u.cubeEffectShadowScale)},coverflowEffect:{depth:w(u.coverflowEffectDepth),modifier:w(u.coverflowEffectModifier),rotate:w(u.coverflowEffectRotate),scale:w(u.coverflowEffectScale),stretch:w(u.coverflowEffectStretch),slideShadows:u.coverflowEffectSlideShadows},flipEffect:{limitRotation:u.flipEffectLimitRotation,slideShadows:u.flipEffectSlideShadows},cardsEffect:{perSlideOffset:w(u.cardsEffectPerSlideOffset),perSlideRotate:w(u.cardsEffectPerSlideRotate),rotate:u.cardsEffectRotate,slideShadows:u.cardsEffectSlideShadows},navigation:{nextEl:f.querySelector(".swiper-button-next"),prevEl:f.querySelector(".swiper-button-prev")},pagination:{type:u.pagination||"bullets",dynamicBullets:u.dynamicBullets,clickable:u.clickableBullets,progressbarOpposite:u.progressbarOpposite,el:f.querySelector(".swiper-pagination")},scrollbar:{el:f.querySelector(".swiper-scrollbar"),draggable:u.scrollbarDraggable,hide:u.scrollbarHide},autoplay:u.autoplay&&C&&{delay:u.autoplayDelay,disableOnInteraction:u.autoplayDisableOnInteraction,pauseOnMouseEnter:u.autoplayPauseOnMouseEnter,reverseDirection:u.autoplayReverseDirection,stopOnLastSlide:u.autoplayStopOnLastSlide,waitForTransition:u.autoplayWaitForTransition}};if(u.tablet){const{tabletBreakpoint:$,tabletSlidesPerView:P}=u,N=w($);T.breakpoints[N]={slidesPerView:isNaN(P)?P:w(P),slidesPerGroup:w(u.tabletSlidesPerGroup),spaceBetween:w(u.tabletSpaceBetween)}}if(u.mobile){const{mobileBreakpoint:$,mobileSlidesPerView:P}=u,N=w($);T.breakpoints[N]={slidesPerView:isNaN(P)?P:w(P),slidesPerGroup:w(u.mobileSlidesPerGroup),spaceBetween:w(u.mobileSpaceBetween)}}g&&!x&&(T.simulateTouch=!1),b&&(T.initialSlide=b);const A=new h.Swiper(f,T);g==null||g(A)};if(h.Swiper)S();else{const{head:E}=document,T=Array.isArray(y)?[...y]:[y],A=Array.isArray(v)?[...v]:[v],$=N=>{if(N.length){const I=document.createElement("link");I.href=N.shift(),I.rel="stylesheet",E.prepend(I),$(N)}},P=N=>{if(N.length){const I=document.createElement("script");I.src=N.shift(),I.onerror=I.onload=P.bind(null,N),E.appendChild(I)}else S()};$(A),P(T)}},d=(u=0)=>({type:Yn,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${u}`}}}),p=t.getType("default").model;return t.addType(Ie,{block:r&&{label:Xs,media:pe.slider,category:"Extra",select:!0,...e.block},isComponent:u=>xt(u,br),model:{defaults:()=>({name:Xs,icon:pe.slider,classes:br,draggable:(u,f)=>!f.is(Ie),components:[{type:an,components:[d(1),d(2),d(3)]},{type:dn}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...s.propKeys],...s.props,traits:[...s.traits]}),init(){const{em:u}=this;Ou(this,s.traits),Iu(this,s.propKeys),this.listenTo(u,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(u,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const u=this.findFirstType(an);u==null||u.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var f;const u=((f=this.findFirstType(an))==null?void 0:f.components().length)||0;return{type:Yn,components:{type:"text",components:{type:"textnode",content:`Slide ${u+1}`}}}},toJSON(...u){const f=p.prototype.toJSON.apply(this,u);return s.propsNoValues.forEach(h=>delete f[h]),delete f["script-props"],f}},view:{init(){this.listenTo(this.model,t.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var u;(u=this.getSwiper())==null||u.destroy()},onRender(){const u=this.el;u.__onLoad=f=>f.on("slideChange",()=>this.__activeSlide=f.activeIndex),u.__activeSlide=this.__activeSlide,u.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(Ie),o.remove(Ie)}},Wf="Nav Prev",qf="Nav Next",So=`${kn}button-prev`,Co=`${kn}button-next`,Uf=n=>{const{Components:e}=n,t=o=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:o,fill:"currentColor"}}});return e.addType(cn,{isComponent:o=>xt(o,So),model:{defaults:{name:Wf,classes:So,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
|
+
.${So} {
|
|
101
101
|
color: inherit;
|
|
102
102
|
}
|
|
103
|
-
.${
|
|
103
|
+
.${So}:after {
|
|
104
104
|
content: none;
|
|
105
105
|
}
|
|
106
|
-
`}}}),e.addType(
|
|
107
|
-
.${
|
|
106
|
+
`}}}),e.addType(qo,{extend:cn,isComponent:o=>xt(o,Co),model:{defaults:{name:qf,classes:Co,components:t("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
|
|
107
|
+
.${Co} {
|
|
108
108
|
color: inherit;
|
|
109
109
|
}
|
|
110
|
-
.${
|
|
110
|
+
.${Co}:after {
|
|
111
111
|
content: none;
|
|
112
112
|
}
|
|
113
|
-
`}}}),()=>{e.removeType(
|
|
113
|
+
`}}}),()=>{e.removeType(cn),e.removeType(qo)}},Kf=n=>{const{Components:e}=n,t=`${kn}pagination`;return e.addType(dn,{isComponent:o=>xt(o,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(
|
|
121
|
-
.${
|
|
120
|
+
`}}}),()=>{e.removeType(dn)}},Jf="Scrollbar",Qs=`${kn}scrollbar`,Yf=n=>{const{Components:e}=n;return e.addType(Ln,{isComponent:t=>xt(t,Qs),model:{defaults:{name:Jf,classes:Qs,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(Ln)}},Zf="Slide",el=`${kn}slide`,Xf=n=>{const{Components:e}=n;return e.addType(Yn,{isComponent:t=>xt(t,el),model:{defaults:{name:Zf,classes:el,icon:pe.slider,draggable:(t,o)=>o.is(an)}}}),()=>{e.removeType(Yn)}},Qf="Wrapper",tl=`${kn}wrapper`,eh=n=>{const{Components:e}=n,{events:t}=e;return e.addType(an,{isComponent:o=>xt(o,tl),model:{defaults:{name:Qf,icon:pe.slider,classes:tl,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:o=>o.is(Yn)},init(){const o=this.components();this.listenTo(o,"add remove",this.updateSlider)},updateSlider(o){const i=this.closestType(Ie);if(i){const r=i.getView();i.reloadSlider(),this.em.once(t.scriptMount,()=>{setTimeout(()=>{var s;return(s=r.getSwiper())==null?void 0:s.slideTo(o.index())},100)})}}}}),()=>{e.removeType(an)}},Oc="swiperComponent",th=F.startup,nh=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},o=[Gf(n,t),Uf(n),eh(n),Xf(n),Kf(n),Yf(n)];q({editor:n,plan:th,licenseKey:t.licenseKey,pluginName:Oc,cleanup:()=>{o.forEach(i=>i())}})},oh=W(nh,Oc),be="accordion",Mn=`${be}-group`,nt=`${be}-header`,pt=`${be}-content`,Pt=`${be}-marker`,nl=`${je}${nt}`,yr=`${je}${Pt}`,ih=`${je}${pt}`,Ic=`${yr}-open`,Ht={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>'},Dc=(n,e)=>{const{toolbarIconOpen:t=Ht.eye}=e,o=n.is(be)?n:n.closestType(be);if(!t||!o)return;const{toolbar:i}=n,r={id:"accordion-toggle-open",label:t,command:()=>o.toggleOpen()};!i.find(l=>l.id===r.id)&&(i==null||i.unshift(r))},rh=(n,e)=>{const{Components:t,Blocks:o}=n,{block:i={}}=e,r="Accordion",s=`${je}${be}`,l=function(a={}){const c=this,d=()=>{const{clsMarkerOpen:p}=a,u=c.querySelector('[data-type-role="accordion-marker"]');!u||!p||(c.open?u.classList.add(p):u.classList.remove(p))};c.addEventListener("toggle",()=>{d(),c.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),d()};return t.addType(be,{block:i&&{label:r,media:Ht.accordion,category:"Extra",select:!0,...i},isComponent:Ue(be),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:r,classes:s,emptyState:!0,clsMarkerOpen:Ic,attributes:{[De]:be},droppable:fi(nt,pt),components:[{type:nt},{type:pt}],"script-props":["clsMarkerOpen"],script:l,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
|
|
121
|
+
.${s}::details-content {
|
|
122
122
|
opacity: 0;
|
|
123
123
|
block-size: 0;
|
|
124
124
|
overflow: hidden;
|
|
@@ -129,55 +129,55 @@
|
|
|
129
129
|
transition-duration: 0.2s;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.${
|
|
132
|
+
.${s}[open]::details-content {
|
|
133
133
|
opacity: 1;
|
|
134
134
|
transform: translateY(0);
|
|
135
135
|
block-size: auto;
|
|
136
136
|
}
|
|
137
|
-
`},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){
|
|
137
|
+
`},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){Dc(this,e)}}}),()=>{o.remove(be),t.removeType(be)}},sh=n=>{const{Components:e}=n;return e.addType(pt,{isComponent:Ue(pt),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:ih,icon:Ht.accordionContent,attributes:{[De]:pt},components:"<div>Accordion content</div>"}}}),()=>{e.removeType(pt)}},lh=(n,e)=>{const{Components:t,Blocks:o}=n,{blockGroup:i={}}=e,r="Accordion Group",s=function(a={}){if(!a.single)return;const c=this;c.addEventListener("details-toggle",d=>{const p=d.target;if(!a.single||!p||!p.open)return;c.querySelectorAll('[data-type-role="accordion"]').forEach(f=>{p!==f&&f.open&&(f.open=!1)})})},l=(a={})=>({type:be,attributes:{open:a.open},components:[{type:nt,components:[`<div>${a.header}</div>`,{type:Pt}]},{type:pt,components:`<div>${a.content}</div>`}]});return t.addType(Mn,{block:i&&{label:r,media:Ht.accordionGroup,category:"Extra",select:!0,...i},isComponent:Ue(Mn),model:{defaults:{name:r,attributes:{[De]:Mn},droppable:fi(be),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:s}}}),()=>{o.remove(Mn),t.removeType(Mn)}},ah=(n,e)=>{const{Components:t}=n;return t.addType(nt,{isComponent:Ue(nt),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:Ht.accordionHeader,classes:nl,attributes:{[De]:nt},components:["<div>Accordion header</div>",{type:Pt}],styles:`
|
|
138
138
|
summary {
|
|
139
139
|
list-style: none;
|
|
140
140
|
}
|
|
141
|
-
.${
|
|
141
|
+
.${nl} {
|
|
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(){
|
|
149
|
-
.${
|
|
148
|
+
`},initToolbar(){Dc(this,e)}}}),()=>{t.removeType(nt)}},ch=n=>{const{Components:e}=n;return e.addType(Pt,{extend:"icon",isComponent:Ue(Pt),model:{defaults:{name:"Accordion Marker",icon:Ht.accordionMarker,classes:yr,attributes:{[De]:Pt},components:Ht.caret,droppable:!1,draggable:ss(nt),styles:`
|
|
149
|
+
.${yr} {
|
|
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
|
-
.${
|
|
155
|
+
.${Ic} {
|
|
156
156
|
transform: rotateZ(180deg);
|
|
157
157
|
}
|
|
158
|
-
`}}}),()=>{e.removeType(
|
|
158
|
+
`}}}),()=>{e.removeType(Pt)}},zc="accordionComponent",dh=F.startup,ph=function(n,e={}){const t=[rh(n,e),lh(n,e),ah(n,e),ch(n),sh(n)];q({editor:n,licenseKey:e.licenseKey,plan:dh,pluginName:zc,cleanup:()=>{t.forEach(o=>o())}})},uh=W(ph,zc),qn=class qn{constructor(e){this.config=e}getSize(e){var t;return(t=this.config)!=null&&t.getSize?this.config.getSize(e):us(e.componentColumn,qn.CSS_FLEX_BASIS)}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:o,sizeValue:i,partial:r}=e;o.addStyle({[qn.CSS_FLEX_BASIS]:i},{partial:r})}}};qn.CSS_FLEX_BASIS="flex-basis";let xr=qn;const Un=class Un{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var t;return(t=this.config)!=null&&t.getGap?this.config.getGap(e):us(e.componentRow,Un.CSS_GAP)}setGap(e){var t;if((t=this.config)!=null&&t.setGap)this.config.setGap(e);else{const{componentRow:o,gapValue:i,partial:r}=e;o.addStyle({[Un.CSS_GAP]:i},{partial:r})}}};Un.CSS_GAP="gap";let vr=Un;const pi=class pi{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:o}=e,i=t.getEl();return i?o?i.clientHeight:i.clientWidth:0}isLayoutVertical(e){var o;if((o=this.config)!=null&&o.isParentVertical)return this.config.isParentVertical(e);const t=us(e.componentRow,pi.CSS_FLEX_DIRECTION,!0);return t==="column"||t==="column-reverse"}};pi.CSS_FLEX_DIRECTION="flex-direction";let wr=pi;const Kn=class Kn{constructor(e){this.config=e}getSize(e){var o;if((o=this.config)!=null&&o.getSize)return this.config.getSize(e);const t=e.componentColumn;if(t.is(Kn.MJML_COLUMN_TYPE)){const r=t.getAttributes().width;if(r&&(r.includes("%")||!isNaN(parseFloat(r))))return parseFloat(r);const s=t.parent();return 100/(s?s.components().length:1)}return 0}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:o,sizeValue:i,partial:r}=e;o.is(Kn.MJML_COLUMN_TYPE)&&o.addAttributes({width:`${parseFloat(i)}%`},{partial:r})}}};Kn.MJML_COLUMN_TYPE="mj-column";let Sr=Kn;const ui=class ui{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var o;if((o=this.config)!=null&&o.getGap)return this.config.getGap(e);const{componentRow:t}=e;if(t.is(ui.MJML_SECTION_TYPE)){const i=t.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(e){var t,o;(o=(t=this.config)==null?void 0:t.setGap)==null||o.call(t,e)}};ui.MJML_SECTION_TYPE="mj-section";let Cr=ui;class fh{constructor(e){this.config=e}getParentSize(e){var s;if((s=this.config)!=null&&s.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:o}=e,i=t.getEl();if(!i)return 0;let r=i;if(i.tagName!=="TABLE"){const l=i.querySelectorAll("table");l.length&&(r=l[0])}return o?r.clientHeight:r.clientWidth}isLayoutVertical(e){var t;return(t=this.config)!=null&&t.isParentVertical?this.config.isParentVertical(e):!1}}class rn{constructor(){this.handlerCache=new Map}static getInstance(){return rn.instance||(rn.instance=new rn),rn.instance}getHandlers(e){const t=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(t)||(bn(e)?this.handlerCache.set(t,{sizeHandler:new Sr(e),gapHandler:new Cr(e),parentSizeHandler:new fh(e)}):this.handlerCache.set(t,{sizeHandler:new xr(e),gapHandler:new vr(e),parentSizeHandler:new wr(e)})),this.handlerCache.get(t)}}function qt(n){return rn.getInstance().getHandlers(n)}const ol=n=>{n.style.display="none"},il=n=>{n.style.display="block"},Bn=n=>+parseFloat(`${n}`).toFixed(2),bn=n=>n.projectType===nc.email,hh=n=>n?["top","bottom"]:["left","right"],mh=n=>{const e=n.parent();return e?e.components().models.indexOf(n)===0:!1},gh=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.indexOf(n)===t.length-1},bh=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.length>1&&n.index()===t.length-1},yh=(n,e,t,o)=>{const r=n+(t?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return r>=0&&r<o?r:-1},Uo=n=>n==="top"||n==="bottom",xh=(n,e)=>!!(mh(n)&&(e==="left"||e==="top")||gh(n)&&(e==="right"||e==="bottom")),vh=n=>{const e=n.parent();return e?e.components().models.length>1:!1},rl=(n,e)=>n==="right"||n==="bottom"?e>0:e<0,us=(n,e,t=!1)=>{const o=!t,i=o?0:"",r=n.getEl();let s;try{s=r?window.getComputedStyle(r):void 0}catch{s=void 0}if(!s)return i;const l=s[e]||"";if(o){let a;return typeof l=="string"?(a=parseFloat(l.replace(/[^-\d.]/g,"")),isNaN(a)&&(a=0)):a=Number(l)||0,a}return l},sl=(n,e,t)=>{const o=kr({componentRow:n,isVertical:e},t),i=n.components().models;return o*(i.length-1)},Zn=(n,e)=>qt(e).parentSizeHandler.isLayoutVertical({componentRow:n}),Xn=(n,e)=>qt(e).sizeHandler.getSize(n),kr=(n,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:t,parentSizeHandler:o}=qt(e);if(!t.isGapSupported())return 0;const i=t.getGap(n),r=o.getParentSize(n);return i/100*r},Tr=(n,e)=>qt(e).parentSizeHandler.getParentSize(n),Vn=(n,e)=>{qt(e).sizeHandler.setSize(n)},Rc=(n,e)=>{const t=Xn(n,e);Vn({...n,sizeValue:`${t}%`,partial:!1},e)},Lc=(n,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:t}=qt(e);t.isGapSupported()&&t.setGap(n)},wh=(n,e)=>{const t=n.getStyle().gap;if(!t)return;const o=n.components().models,i={componentRow:n,isVertical:Zn(n,e)};o.map(r=>Rc({...i,componentColumn:r},e)),Lc({...i,gapValue:String(t),partial:!1},e)};function Sh(n,e){const{Blocks:t}=n,{typeColumn:o,typeRow:i,blocks:r}=e;if(r===!1||bn(e))return;const s=p=>({type:i,components:p.map(u=>({type:o,style:{"flex-basis":`${u}%`}}))}),l=p=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
|
|
159
159
|
${p.map(u=>`<div style="flex-basis: ${u}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
|
|
160
|
-
</div>`,a=(p,u)=>({id:`flex-row-${u.join("-")}`,label:p,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(u),content:
|
|
161
|
-
.${
|
|
160
|
+
</div>`,a=(p,u)=>({id:`flex-row-${u.join("-")}`,label:p,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(u),content:s(u)}),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=We(r)?r({blocks:c}):c;return d.forEach(p=>t.add(p.id,p)),()=>{d.forEach(p=>t.remove(p.id))}}const Ch=(n,e)=>{const{Components:t}=n,{typeRow:o,typeColumn:i,extendTypeColumn:r}=e,s=`${je}${i}`,a=!!i&&!!t.getType(i)&&!r;if(!(!i||a||bn(e)))return t.addType(i,{isComponent:Ue(i),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:s,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:ss(o),attributes:{[De]:i},styles:`
|
|
161
|
+
.${s} {
|
|
162
162
|
flex-grow: 1;
|
|
163
163
|
}
|
|
164
|
-
`}}}),()=>{t.removeType(
|
|
165
|
-
.${
|
|
164
|
+
`}}}),()=>{t.removeType(i)}},kh=(n,e)=>{const{Components:t}=n,{typeRow:o,typeColumn:i,extendTypeRow:r}=e,s=`${je}${o}`,a=!!o&&!!t.getType(o)&&!r;if(!(!o||a||bn(e)))return t.addType(o,{isComponent:Ue(o),model:{defaults:{name:"Row",classes:s,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:{[De]:o},droppable:fi(i),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
|
+
.${s} {
|
|
166
166
|
display: flex;
|
|
167
167
|
align-items: stretch;
|
|
168
168
|
flex-wrap: nowrap;
|
|
169
169
|
}
|
|
170
|
-
`}}}),()=>{t.removeType(o)}},
|
|
170
|
+
`}}}),()=>{t.removeType(o)}},Bc="flexComponent",Th=F.startup;class Eh{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 o=e.get("type"),i=t.get("type");return this.typeRelationships.has(o)?this.typeRelationships.get(o).has(i):!1}}class Mh{constructor(e,t,o){this.editor=e,this.registry=t,this.opts=o,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,o){const{opts:i}=this,r=this.getState(e);r.direction=t,r.startX=o.clientX,r.startY=o.clientY,r.resizing=!0,r.lastSnappedPercent=void 0;const s=e.parent();if(!s||!this.registry.isValidRelationship(s,e))return;r.snapEnabled=s.get("snap")??i.snapEnabled,r.snapDivisions=s.get("snap-divisions")??i.snapDivisions??12;const l=s.components().models,a=l.findIndex(u=>u.cid===e.cid),c=Zn(s,i),d=yh(a,t,c,l.length);d!==-1&&(r.adjacentIdx=d);const p={componentColumn:e,componentRow:s,isVertical:c};if(r.startPercent=Xn(p,i),typeof r.adjacentIdx<"u"){const u=l[r.adjacentIdx];r.neighborStartPercent=Xn({...p,componentColumn:u},i)}}updateResizeByDelta(e,t,o){const i=this.getState(e),r=e.parent();!i.resizing||!r||(i.snapEnabled?this.updateSnapResize(e,t,o):this.updateContinuesResize(e,t,o))}finishResize(e){const t=e.parent(),o=t==null?void 0:t.components().models,i={componentRow:t,isVertical:!!t&&Zn(t,this.opts)};o==null||o.forEach(r=>Rc({...i,componentColumn:r},this.opts)),this.clearState(e)}updateContinuesResize(e,t,o){const i=this.getState(e),r=e.parent(),{opts:s}=this;if(!r)return;const l=s.minItemPercent??0,a=Uo(t),c=Tr({componentRow:r,isVertical:a},s),d=sl(r,a,this.opts),u=100-d/c*100,f=o/(c-d)*u,{startPercent:h=0,neighborStartPercent:g=0}=i,b={componentRow:r,isVertical:a,componentColumn:e,partial:!0},x=rl(t,o)?h+Math.abs(f):h-Math.abs(f);if(typeof i.adjacentIdx<"u"){const C=r.components().models[i.adjacentIdx],y=h+g,v=y-l,w=Math.min(v,Math.max(l,x)),S=y-w;Vn({...b,sizeValue:`${Bn(w)}%`},s),Vn({...b,componentColumn:C,sizeValue:`${Bn(S)}%`},s)}else{const C=Math.max(l,Math.min(u,x));Vn({...b,sizeValue:`${Bn(C)}%`},s)}}updateSnapResize(e,t,o){const i=this.getState(e),r=e.parent(),s=Uo(t),l=Tr({componentRow:r,isVertical:s},this.opts),a=sl(r,s,this.opts),c=l-a,d=o/c*100,p=rl(t,o),{startPercent:u=0,snapDivisions:f=12}=i,h=p?u+Math.abs(d):u-Math.abs(d),g=100/f,b=Math.floor(h/g)*g,x=Math.ceil(h/g)*g,C=Math.abs(x-h),y=Math.abs(h-b),v=g*.2,k=C<y?x:b;if(k>0&&k<100&&(C<v||y<v)&&i.lastSnappedPercent!==k){i.lastSnappedPercent=k;let E=Math.abs(k-u)/100*c;(p&&(t==="left"||t==="top")||!p&&(t==="right"||t==="bottom"))&&(E=-E),this.updateContinuesResize(e,t,E)}else C>=v&&y>=v&&(i.lastSnappedPercent=void 0)}}class Ah{constructor(e,t,o){this.editor=e,this.registry=t,this.opts=o}updateGapByDelta(e,t,o,i){if(!this.registry.isGapAdjustableParent(e))return;const{opts:r}=this,s=Math.max(0,o+t),l=Tr({componentRow:e,isVertical:i},r),a=s/l*100,c=e.components().models,d=c.length-1,p={componentRow:e,isVertical:i},u=c.reduce((v,k)=>v+Xn({...p,componentColumn:k},r),0),h=100-a*d,g=r.minItemPercent||5;if(h<g*c.length)return;const x=100-d*a,C=u-x,y={componentRow:e,isVertical:i,partial:!0};c.map(v=>{const k=Xn({...p,componentColumn:v},r),w=k-k/u*C;Vn({...y,componentColumn:v,sizeValue:`${Bn(w)}%`},r)}),Lc({...y,gapValue:`${Bn(a)}%`},r)}finishGapAdjust(e){wh(e,this.opts)}}class jh{constructor(e,t,o){this.editor=e,this.registry=t,this.opts=o,this.resizeHandler=new Mh(e,t,o),this.gapHandler=new Ah(e,t,o)}startResize(e,t,o){this.resizeHandler.startResize(e,t,o)}updateResizeByDelta(e,t,o){this.resizeHandler.updateResizeByDelta(e,t,o)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,t,o,i){this.gapHandler.updateGapByDelta(e,t,o,i)}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 Ko="gs-flex-spots",ll=`${Ko}__handle-size`,$h=`${Ko}__handle-gap`;function Ph(n,e){const{Canvas:t}=n,o="flex-resize-spot";let i,r,s,l,a=null,c=null;const d=new Eh,p=new jh(n,d,e),u=()=>{var w;i=document.createElement("div"),i.className=Ko,i.style.display="none",r=document.createElement("div"),r.className=`${Ko}__handles`,r.style.position="absolute",r.style.pointerEvents="none",r.style.zIndex="21",s={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(s).forEach(([S,E])=>{const T=S,A=Uo(T);E.className=`${ll} ${ll}-${T} gjs-resizer-h gjs-cv-unscale`,E.style.cssText=`
|
|
171
171
|
pointer-events: all;
|
|
172
172
|
position: absolute;
|
|
173
173
|
z-index: 1;
|
|
174
|
-
cursor: ${
|
|
175
|
-
${
|
|
176
|
-
${
|
|
177
|
-
${
|
|
178
|
-
${
|
|
179
|
-
${
|
|
180
|
-
`,E.addEventListener("pointerdown",
|
|
174
|
+
cursor: ${A?"ns-resize":"ew-resize"};
|
|
175
|
+
${A?"left: 50%;":"top: 50%;"}
|
|
176
|
+
${T==="left"?"left: 0px;":""}
|
|
177
|
+
${T==="right"?"right: 0px;":""}
|
|
178
|
+
${T==="top"?"top: 0px;":""}
|
|
179
|
+
${T==="bottom"?"bottom: 0px;":""}
|
|
180
|
+
`,E.addEventListener("pointerdown",f(T)),r.appendChild(E)}),!e.disableGapHandler&&!bn(e)&&(l=document.createElement("div"),l.className=$h,l.style.cssText=`
|
|
181
181
|
position: absolute;
|
|
182
182
|
background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
|
|
183
183
|
border-width: 2px;
|
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
pointer-events: all;
|
|
188
188
|
max-width: 3rem;
|
|
189
189
|
max-height: 3rem;
|
|
190
|
-
`,l.addEventListener("pointerdown",
|
|
191
|
-
`)},init(){const{em:p}=this;this.addStyle({[Ne.name]:"fadeIn",[Ne.duration]:"1s",[Ne.fillMode]:"both",...e.animationStyle,...this.getStyle()}),this.listenTo(p,l.mount,u=>{var
|
|
190
|
+
`,l.addEventListener("pointerdown",h()),r.appendChild(l)),i.append(r),(w=t.getSpotsEl())==null||w.appendChild(i)},f=w=>S=>{if(!a)return;S.stopPropagation(),S.preventDefault(),p.startResize(a,w,S);const E=S.clientX,T=S.clientY;S.target.setPointerCapture(S.pointerId);const A=P=>{const N=n.Canvas.getZoomMultiplier(),I=(P.clientX-E)*N,_=(P.clientY-T)*N,ae=Uo(w)?_:I;p.updateResizeByDelta(a,w,ae)},$=()=>{p.finishResize(a),S.target.releasePointerCapture(S.pointerId),document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",$)};document.addEventListener("pointermove",A),document.addEventListener("pointerup",$)},h=()=>w=>{if(!c)return;const S=c;w.stopPropagation(),w.preventDefault();const E=Zn(S,e),T=kr({componentRow:S,isVertical:E},e),A=w.clientX,$=w.clientY;w.target.setPointerCapture(w.pointerId);const P=I=>{const _=n.Canvas.getZoomMultiplier(),ae=E?(I.clientY-$)*_:(I.clientX-A)*_;p.updateGapByDelta(S,ae,T,E)},N=()=>{p.finishGapAdjust(S),w.target.releasePointerCapture(w.pointerId),document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",N)};document.addEventListener("pointermove",P),document.addEventListener("pointerup",N)},g=w=>{const S=w.component;if(!S||!i||(a=S,c=S.parent(),!c))return;const E=c;il(i);const T=w.getStyle();r&&Object.assign(r.style,T);const A=Zn(E,e),$=hh(A);if(Object.values(s).forEach(ol),$.forEach(N=>{if(xh(S,N))return;const I=s[N];il(I)}),qt(e).gapHandler.isGapSupported()&&l&&vh(S)){const N=kr({componentRow:E,isVertical:A},e);b(N,A,bh(S))}},b=(w,S,E=!1)=>{const T=e.gapHandleSize,A=l.style;if(S){A.height=`${T}px`;const $=l.offsetHeight;E?(A.top=`-${(w+$)/2}px`,A.bottom=""):(A.bottom=`-${(w+$)/2}px`,A.top=""),A.width="50%",A.left="50%",A.transform="translateX(-50%)",A.cursor="row-resize"}else{A.width=`${T}px`;const $=l.offsetWidth;E?(A.left=`-${(w+$)/2}px`,A.right=""):(A.right=`-${(w+$)/2}px`,A.left=""),A.height="50%",A.top="50%",A.transform="translateY(-50%)",A.cursor="col-resize"}},x=()=>{i&&(ol(i),a=null,c=null)},C=()=>{t.removeSpots({type:o});const w=n.getSelected(),S=w==null?void 0:w.parent();w&&S&&d.isValidRelationship(S,w)?t.addSpot({type:o,component:w}):x()},y=()=>{const w=t.getSpots().filter(S=>S.type===o)[0];w&&g(w)},v=(w,S)=>{d.registerTypeRelationship(w,S)};n.onReady(()=>{u(),bn(e)?v("mj-section","mj-column"):v(e.typeRow,e.typeColumn)});const k="component:toggled";return n.on(t.events.spot,y),n.on(k,C),()=>{n.off(t.events.spot,y),n.off(k,C)}}const Nh=function(n,e={}){const t={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},o=[kh(n,t),Ch(n,t)],i=Ph(n,t),r=Sh(n,t);q({editor:n,licenseKey:t.licenseKey,plan:Th,pluginName:Bc,cleanup:()=>{o.forEach(s=>s==null?void 0:s()),i(),r==null||r()}})},Oh=W(Nh,Bc);var Ne=(n=>(n.name="animation-name",n.duration="animation-duration",n.delay="animation-delay",n.iterationCount="animation-iteration-count",n.timingFunction="animation-timing-function",n.fillMode="animation-fill-mode",n))(Ne||{}),pn=(n=>(n.onScroll="--animation-on-scroll",n.threshold="--animation-threshold",n.repeat="--animation-repeat",n))(pn||{});const _e="animation",sn="animation-group",al="animation:update",Er="animation-group:update",Vc={category:{id:"animations",label:"Animations"},select:!0},gi=n=>(n==null?void 0:n.getType())===_e,bi=n=>(n==null?void 0:n.getType())===sn,Hc=n=>gi(n)||bi(n),An={isVisible:({component:n})=>gi(n)},Ih={isVisible:({component:n})=>bi(n)},Dh={isVisible:({component:n})=>gi(n)&&bi(n==null?void 0:n.parent())?!1:Hc(n)},cl={isVisible:({component:n,sector:e})=>{var t;return gi(n)&&bi(n==null?void 0:n.parent())?!1:Hc(n)&&((t=e.getProperty(pn.onScroll))==null?void 0:t.getValue())==="true"}},Fc={animation:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M16.5 14a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13"/><path fill="currentColor" d="M17.14 15.98a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/><path fill="currentColor" d="M12.64 20.48a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/></svg>',animationGroup:'<svg viewBox="0 0 24 24"><path d="M4 2a2 2 0 0 0-2 2v10h2V4h10V2H4m4 4a2 2 0 0 0-2 2v10h2V8h10V6H8m4 4a2 2 0 0 0-2 2v8c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-8Z"/></svg>'},zh=function(n){const e=this;let t=null;const o=()=>{t==null||t.disconnect(),t=null},i=()=>{o();const r=e.style;r.animationName="",requestAnimationFrame(()=>{const s=getComputedStyle(e),l=s.getPropertyValue("animation-name").trim(),a=s.getPropertyValue("--animation-on-scroll").trim()!=="false",c=parseFloat(s.getPropertyValue("--animation-threshold").trim())||.2,d=s.getPropertyValue("--animation-repeat").trim()==="true",p=()=>{r.animationName="none",e.offsetWidth,r.animationName=l,r.animationPlayState="running"};if(!l||l==="none"){r.animationName="none",r.animationPlayState="paused";return}if(!a){p();return}r.animationPlayState="paused",t=new IntersectionObserver(u=>{u.forEach(f=>{f.isIntersecting&&(p(),!d&&o())})},{threshold:c}),t.observe(e)})};e.addEventListener(n.animationUpdateEvent,i),i()},Rh=(n,e)=>{const{Components:t,Blocks:o,Canvas:i}=n,{block:r={},animationList:s=[]}=e,l=n.Components.events,a="Animation",c=Object.values(pn),d=Object.values(Ne);return t.addType(_e,{block:r?{label:a,media:Fc.animation,content:{type:_e},...Vc,...r}:void 0,model:{defaults:{emptyState:!0,name:a,traits:[],script:zh,animationUpdateEvent:al,"script-props":["animationUpdateEvent"],styles:s.map(p=>p.css).join(`
|
|
191
|
+
`)},init(){const{em:p}=this;this.addStyle({[Ne.name]:"fadeIn",[Ne.duration]:"1s",[Ne.fillMode]:"both",...e.animationStyle,...this.getStyle()}),this.listenTo(p,l.mount,u=>{var h;if(u!==this)return;((h=this.parent())==null?void 0:h.get("type"))!==sn||c.forEach(g=>this.removeStyle(g))})}},view:{events:()=>({animationstart:"onAnimationStart",animationend:"onAnimationEnd"}),init(){const{model:p}=this;this.listenTo(p,l.styleUpdate,this.handleStyleChange)},onAnimationStart(){var u;if((u=this.cmpSpots)!=null&&u.length)return;const p=i.getSpots({component:this.model});this.cmpSpots=p,i.removeSpots(p),this.el.ownerDocument.body.style.overflowX="hidden"},onAnimationEnd(){const p=this.cmpSpots||[];i.spots.add(p),this.cmpSpots=[],this.el.ownerDocument.body.style.overflowX=""},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(al))},handleStyleChange(p,u){Object.keys((u==null?void 0:u.style)||{}).some(g=>d.includes(g)||c.includes(g))&&this.triggerAnimation()},onRender(){this.triggerAnimation()}}}),()=>{o.remove(_e),t.removeType(_e)}},Lh=function(n){const e=this,t="--animation-on-scroll",o="--animation-threshold",i="--animation-repeat";let r=null;const s=()=>{r==null||r.disconnect(),r=null},l=()=>{s();const a=getComputedStyle(e),c=a.getPropertyValue(t).trim()!=="false",d=parseFloat(a.getPropertyValue(o).trim())||.2,p=a.getPropertyValue(i).trim()==="true",u=()=>{Array.from(e.children).forEach(f=>{f instanceof HTMLElement&&typeof f.dispatchEvent=="function"&&f.dispatchEvent(new CustomEvent(Er,{bubbles:!1}))})};if(!c){u();return}r=new IntersectionObserver(f=>{f.forEach(h=>{h.isIntersecting?(u(),!p&&s()):p&&Array.from(e.children).forEach(g=>{g instanceof HTMLElement&&getComputedStyle(g).getPropertyValue(t).trim()!=="false"&&(g.style.opacity="0",g.style.animationPlayState="paused")})})},{threshold:d}),r.observe(e)};e.addEventListener(n.animationGroupUpdateEvent,l),l()},Bh=(n,e)=>{const{Components:t,Blocks:o}=n,{blockGroup:i={}}=e,r="Animation Group";return t.addType(sn,{block:i?{label:r,media:Fc.animationGroup,content:{type:sn,components:[{type:_e},{type:_e},{type:_e}]},...Vc,...i}:void 0,model:{defaults:{name:r,emptyState:!0,traits:[],script:Lh,animationGroupUpdateEvent:Er,"script-props":["animationGroupUpdateEvent"],droppable:fi(_e)},init(){this.addStyle({...e.animationGroupStyle,...this.getStyle()});const s=this.components();this.listenTo(s,"add remove",this.updateChildrenStaggerStyles),this.updateChildrenStaggerStyles()},updateChildrenStaggerStyles(){this.components().forEach((s,l)=>{s.is(_e)&&s.addStyle({"--stagger-index":l.toString(),[Ne.delay]:"calc(var(--stagger-index, 0) * var(--stagger-delay, 0.3s))"},{partial:!0})})}},view:{init(){const{model:s}=this;this.listenTo(s,"component:styleUpdate",this.handleStyleChange)},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(Er))},handleStyleChange(){this.triggerAnimation(),this.model.updateChildrenStaggerStyles()},onRender(){this.triggerAnimation()}}}),()=>{o.remove(sn),t.removeType(sn)}},_c="animationComponent",Vh=F.startup,dl=[{id:"flash",name:"Flash",css:`@keyframes flash {
|
|
192
192
|
0%, 50%, to {
|
|
193
193
|
opacity:1
|
|
194
194
|
}
|
|
@@ -705,7 +705,7 @@
|
|
|
705
705
|
transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
|
|
706
706
|
animation-timing-function:cubic-bezier(.175, .885, .32, 1)
|
|
707
707
|
}
|
|
708
|
-
}`}],
|
|
708
|
+
}`}],Hh=function(n,e={}){var i;const t=((i=e.animations)==null?void 0:i.call(e,{items:dl}))||dl,o=[Rh(n,{...e,animationList:t}),Bh(n,e)];n.Styles.addSector("animation",{name:"Animation",properties:[{...An,name:"Type",property:Ne.name,type:"select",full:!0,default:"fadeIn",options:t},{...An,name:"Duration",property:Ne.duration,type:"number",units:["s"],min:.1,max:10,step:.1,default:"1s"},{...An,name:"Delay",property:Ne.delay,type:"number",units:["s"],min:0,max:10,step:.1,default:"1s"},{...An,name:"Iteration Count",property:Ne.iterationCount,type:"select",default:"1",options:[{id:"1",name:"One time"},{id:"infinite",name:"Infinite"}]},{...An,name:"Timing",property:Ne.timingFunction,type:"select",default:"ease",options:[{id:"ease",name:"Ease"},{id:"ease-in",name:"Ease in"},{id:"ease-out",name:"Ease out"},{id:"ease-in-out",name:"Ease in out"},{id:"linear",name:"Linear"}]},{...Ih,name:"Stagger Delay",property:"--stagger-delay",type:"slider",units:["s"],min:.1,max:5,step:.1,default:"0.3s"},{...Dh,name:"Animate on Scroll",property:pn.onScroll,type:"radio",default:"true",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]},{...cl,name:"Scroll Threshold",property:pn.threshold,type:"number",full:!0,min:.1,max:1,step:.01,default:"0.2"},{...cl,name:"Repeat on Scroll",property:pn.repeat,type:"radio",default:"false",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]}]}),q({editor:n,licenseKey:e.licenseKey,plan:Vh,pluginName:_c,cleanup:()=>{o.forEach(r=>r())}})},Fh=W(Hh,_c),Gc="shapeDividerComponent",_h=F.startup,Gh=function(n,e={}){const{Components:t,Blocks:o,Selectors:i}=n,r="shape-divider",s=`${r}-cnt`,l=`${je}${r}`,a=`${je}${s}`,c=[{id:"tilt",label:"Tilt",value:`<svg preserveAspectRatio="none" viewBox="0 0 240 24">
|
|
709
709
|
<path d="M240 24V0L0 24h240z"/>
|
|
710
710
|
</svg>`},{id:"tilt-split",label:"Tilt split",value:`<svg preserveAspectRatio="none" viewBox="0 0 240 24">
|
|
711
711
|
<path fill-opacity=".3" d="M240 24V0L0 24h240z"/>
|
|
@@ -765,9 +765,9 @@
|
|
|
765
765
|
<path fill-opacity=".3" d="M0 0v18C21.5 7 49.6 2.2 64.8 6.4 82 11.2 75.4 25.2 91.7 23.9c14.2-1.1 25.8-12.3 40-12.3 10.4 0 7.8 6 18.8 6.9 11.5.8 21.6-5 37.2-9 19.9-5 42.1-5.3 52.3 0V0H0z"/>
|
|
766
766
|
</svg>`},{id:"zigzag",label:"Zigzag",value:`<svg class="${a}-inv" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" viewBox="0 0 1000 38">
|
|
767
767
|
<path d="M75 38l25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25 25 25 25-25V.0H0V13l25 25 25-25z"/>
|
|
768
|
-
</svg>`}],d={tl:!1,tc:!1,tr:!1,cl:!1,cr:!1,bl:!1,bc:!1,br:!1},p={...d,bc:!0},u={...d,tc:!0},
|
|
768
|
+
</svg>`}],d={tl:!1,tc:!1,tr:!1,cl:!1,cr:!1,bl:!1,bc:!1,br:!1},p={...d,bc:!0},u={...d,tc:!0},f="shape",h="flip-y",g="flip-x",b="Shape Divider",x=`<svg viewBox="0 0 22 22">
|
|
769
769
|
<path fill="currentColor" d="M2 2v18h18V2H2zm0-2h18a2 2 0 012 2v18a2 2 0 01-2 2H2a2 2 0 01-2-2V2C0 .9.9 0 2 0zM1 13L2 0h18l1 9-20 4z"/>
|
|
770
|
-
</svg>`,{block:
|
|
770
|
+
</svg>`,{block:C={}}=e;n.on(i.events.add,y=>{y.getFullName().startsWith(`.${l}`)&&y.set({private:!0})}),t.addType(r,{isComponent:y=>Ue(r)(y)||xt(y,l),block:C&&{label:b,media:x,category:"Extra",select:!0,...C},model:{defaults:{droppable:!1,highlightable:!1,classes:l,attributes:{[De]:r},components:{type:s},styles:`.${l} { position: relative; }`,delegate:{select:y=>y.findFirstType(s),layer:y=>y.findFirstType(s)}}},view:{onRender(){this.el.style.height="1px"}}}),t.addType(s,{isComponent:Ue(s),model:{defaults:{droppable:!1,highlightable:!1,classes:a,emptyState:!0,icon:x,name:b,delegate:{remove:y=>y.parent(),move:y=>y.parent(),copy:y=>y.parent()},attributes:{[De]:s},[f]:c[0].id,resizable:p,stylable:["height","width","color"],styles:`
|
|
771
771
|
.${a} {
|
|
772
772
|
position: absolute;
|
|
773
773
|
width: 100%;
|
|
@@ -801,7 +801,7 @@
|
|
|
801
801
|
.${a}-inv > path {
|
|
802
802
|
transform: scale(-1, -1) translate(-100%, -100%);
|
|
803
803
|
}
|
|
804
|
-
`,traits:[{type:"select",name:
|
|
804
|
+
`,traits:[{type:"select",name:f,label:"Shape",changeProp:!0,options:c.map(({id:y,label:v,value:k})=>({id:y,label:v,icon:{icon:k.replace("<svg ",'<svg style="width: 35px; height: 7px; fill: currentColor;"')}}))},{type:"checkbox",name:h,label:"Flip vertically",changeProp:!0},{type:"checkbox",name:g,label:"flip horizontally",changeProp:!0}]},init(){this.on(`change:${f}`,this.onShapeChange),this.on(`change:${g} change:${h}`,this.onFlip),this.onShapeChange()},onShapeChange(){const y=this.get(f),v=c.find(w=>w.id===y),k=(v==null?void 0:v.value)||this.getInnerHTML().trim();this.components(""),k&&this.set("content",k)},onFlip(){const y=this.get(h),v=this.get(g),k=["fl-v","fl-h","fl-v-h"].map(S=>`${a}--${S}`);let w;y&&v?w=k[2]:v?w=k[1]:y&&(w=k[0]),this.removeClass(k),w&&this.addClass(w),this.set("resizable",y?u:p)}}}),q({editor:n,licenseKey:e.licenseKey,plan:_h,pluginName:Gc,cleanup:()=>{t.removeType(r),o.remove(r)}})},Wh=W(Gh,Gc),qh=n=>n.dispatchEvent(new CustomEvent("input")),Uh=(n,e)=>{if(!e)return()=>{};const t="keydown",o=r=>{var s;r.key==="Escape"&&((s=n.getEditing())==null||s.trigger("disable"))},i=()=>document.removeEventListener(t,o);return n.onReady(()=>{document.addEventListener(t,o),n.on(n.events.destroy,i)}),i};function Wc(n,e){if(!e)return()=>{};const t=n.Components.events,o=d=>n.getSelectedAll().includes(d),i=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),r=d=>d.isChildOf("text"),s=d=>n.getEditing()===d,l=(d,p={})=>{d.trigger("focus",p.event)},a=(d,p)=>{o(d)&&i(d)&&!s(d)&&l(d,p)},c=(d,p)=>{if(o(d)&&!i(d)&&r(d)){const u=d.parents().find(f=>f.isInstanceOf("text"));u&&(l(u,p),setTimeout(()=>n.select(u),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const qc="rteTinyMce",Kh=F.startup,Jh=`
|
|
805
805
|
.tox .tox-toolbar,
|
|
806
806
|
.tox .tox-toolbar__overflow,
|
|
807
807
|
.tox .tox-toolbar__primary,
|
|
@@ -904,26 +904,26 @@
|
|
|
904
904
|
background-color: var(--gs-theme-cl-prm-bg1);
|
|
905
905
|
border-color: var(--gs-theme-cl-prm-bg3);
|
|
906
906
|
opacity: 0.75;
|
|
907
|
-
}`,oi=new WeakMap,bf=(n,e)=>{oi.set(n,e)},vf=n=>{oi.delete(n)},Ps=n=>oi.get(n),So=n=>{const e=n.target,t=e.closest(".tox"),o=e.matches(".ephox-snooker-resizer-bar");(t||o)&&n.stopPropagation()},tl=n=>{n.stopPropagation(),n.preventDefault()},Sf=(n,e)=>{const t=n.getDoc(),o=n.getWin();if(e!=null&&e.event){const{event:s}=e,{clientX:r,clientY:i}=s;let l;if(t.caretRangeFromPoint)l=t.caretRangeFromPoint(r,i);else if(t.caretPositionFromPoint){const a=t.caretPositionFromPoint(r,i);l=t.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=o.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),n.selection.setRng(l)}}else n.execCommand("SelectAll")},xf=n=>{var c,d;const{el:e,editor:t,componentView:o}=n,s=t.runCommand(_.getStateTheme),r=o.model,i={target:e,inline:!0,skin:(s==null?void 0:s.theme)===za.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:i,editor:t,componentView:o,component:r}))||{};return{...i,...l}},nl=(n,e=document)=>new Promise((t,o)=>{const s=Array.isArray(n)?[...n]:[n],{head:r}=e,i=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=i.bind(null,l),a.onerror=o,r.appendChild(a)}else t()};i(s)}),wf=function(n,e={}){const t={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:o}=t,s=n.Canvas.events,r=!t.skipCustomTheme,i="gs-plg-tinymce-studio-theme",l=async(d,p)=>{const u=d.ownerDocument,h=u.defaultView,f=p==null?void 0:p.view;if(!h||!f){console.warn("Missing required data",{win:h,componentView:f});return}const m=xf({el:d,editor:n,componentView:f,pluginOpts:t}),b=(await h.tinymce.init(m))[0];if(!b)return;const y=(await window.tinymce.init({...m,target:document.createElement("div")}))[0];return b.ui.show(),u.body.addEventListener("mousedown",So),document.body.addEventListener("mousedown",So),b.on("Change",()=>hf(d)),b.on("blur",()=>b.ui.show()),b.on("OpenWindow",function(){var S;const v=(S=u.querySelector(".tox-dialog"))==null?void 0:S.closest(".tox");v&&(v==null?void 0:v.ownerDocument)!==document&&(document.body.appendChild(v),b.once("CloseWindow",()=>{v&&v.ownerDocument===document&&u.body.appendChild(v)}))}),d.addEventListener("dragstart",tl,{capture:!0}),n.runCommand(_.setStateContextMenu,{enabled:!1}),Sf(b,p),{rteEditor:b,rteEditorShallow:y}},a=(d,p)=>{d.ownerDocument.body.removeEventListener("mousedown",So),document.body.removeEventListener("mousedown",So),d.removeEventListener("dragstart",tl,{capture:!0}),n.runCommand(_.setStateContextMenu,{enabled:!0}),p.rteEditor.destroy(),p.rteEditorShallow.destroy()};n.on(s.frameLoad,async({window:d})=>{const p=d.document;nl(o,p)}),n.onReady(()=>{nl(o,document),r&&Yr(i,yf,{target:document.body})}),n.setCustomRte({parseContent:!0,async enable(d,p,u){const h=Ps(d);if(h)return h.rteEditor;const f=await l(d,u);return f&&bf(d,f),f==null?void 0:f.rteEditor},disable(d){const p=Ps(d);p&&(vf(d),a(d,p))},getContent(d,p,u){var m;const h=Ps(d),f=h==null?void 0:h.rteEditor;return f&&!f.isDirty()?u.view.lastContent:f?(m=f.getContent)==null?void 0:m.call(f):d.innerHTML}});const c=gc(n,t.enableOnClick);W({editor:n,licenseKey:t.licenseKey,plan:gf,pluginName:mf,cleanup:()=>{n.RichTextEditor.customRte=void 0,c()}})},Cf=G(wf);function X(n){this.content=n}X.prototype={constructor:X,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 o=t&&t!=n?this.remove(t):this,s=o.find(n),r=o.content.slice();return s==-1?r.push(t||n,e):(r[s+1]=e,t&&(r[s]=t)),new X(r)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new X(t)},addToStart:function(n,e){return new X([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new X(t)},addBefore:function(n,e,t){var o=this.remove(e),s=o.content.slice(),r=o.find(n);return s.splice(r==-1?s.length:r,0,e,t),new X(s)},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=X.from(n),n.size?new X(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=X.from(n),n.size?new X(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=X.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}};X.from=function(n){if(n instanceof X)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new X(e)};function yc(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(o),r=e.child(o);if(s==r){t+=s.nodeSize;continue}if(!s.sameMarkup(r))return t;if(s.isText&&s.text!=r.text){for(let i=0;s.text[i]==r.text[i];i++)t++;return t}if(s.content.size||r.content.size){let i=yc(s.content,r.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function bc(n,e,t,o){for(let s=n.childCount,r=e.childCount;;){if(s==0||r==0)return s==r?null:{a:t,b:o};let i=n.child(--s),l=e.child(--r),a=i.nodeSize;if(i==l){t-=a,o-=a;continue}if(!i.sameMarkup(l))return{a:t,b:o};if(i.isText&&i.text!=l.text){let c=0,d=Math.min(i.text.length,l.text.length);for(;c<d&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,o--;return{a:t,b:o}}if(i.content.size||l.content.size){let c=bc(i.content,l.content,t-1,o-1);if(c)return c}t-=a,o-=a}}class T{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,s=0,r){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&o(a,s+l,r||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,s){let r="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&o&&(i?i=!1:r+=o),r+=c},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,s=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(o)&&(s[s.length-1]=t.withText(t.text+o.text),r=1);r<e.content.length;r++)s.push(e.content[r]);return new T(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],s=0;if(t>e)for(let r=0,i=0;i<t;r++){let l=this.content[r],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),o.push(l),s+=l.nodeSize),i=a}return new T(o,s)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let s=this.content.slice(),r=this.size+t.nodeSize-o.nodeSize;return s[e]=t,new T(s,r)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(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,o=0;t<this.content.length;t++){let s=this.content[t];e(s,o,t),o+=s.nodeSize}}findDiffStart(e,t=0){return yc(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return bc(this,e,t,o)}findIndex(e,t=-1){if(e==0)return xo(0,e);if(e==this.size)return xo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,s=0;;o++){let r=this.child(o),i=s+r.nodeSize;if(i>=e)return i==e||t>0?xo(o+1,i):xo(o,s);s=i}}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 T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,o=0;for(let s=0;s<e.length;s++){let r=e[s];o+=r.nodeSize,s&&r.isText&&e[s-1].sameMarkup(r)?(t||(t=e.slice(0,s)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new T(t||e,o)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Ns={index:0,offset:0};function xo(n,e){return Ns.index=n,Ns.offset=e,Ns}function jo(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 o=0;o<n.length;o++)if(!jo(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!jo(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class B{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let s=0;s<e.length;s++){let r=e[s];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,s));else{if(r.type.excludes(this.type))return e;!o&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),o=!0),t&&t.push(r)}}return t||(t=e.slice()),o||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&&jo(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 o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=o.create(t.attrs);return o.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return B.none;if(e instanceof B)return[e];let t=e.slice();return t.sort((o,s)=>o.type.rank-s.type.rank),t}}B.none=[];class qo extends Error{}class A{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=Sc(this.content,e+this.openStart,t);return o&&new A(o,this.openStart,this.openEnd)}removeBetween(e,t){return new A(vc(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 A.empty;let o=t.openStart||0,s=t.openEnd||0;if(typeof o!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new A(T.fromJSON(e,t.content),o,s)}static maxOpen(e,t=!0){let o=0,s=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)o++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)s++;return new A(e,o,s)}}A.empty=new A(T.empty,0,0);function vc(n,e,t){let{index:o,offset:s}=n.findIndex(e),r=n.maybeChild(o),{index:i,offset:l}=n.findIndex(t);if(s==e||r.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(o,r.copy(vc(r.content,e-s-1,t-s-1)))}function Sc(n,e,t,o){let{index:s,offset:r}=n.findIndex(e),i=n.maybeChild(s);if(r==e||i.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Sc(i.content,e-r-1,t);return l&&n.replaceChild(s,i.copy(l))}function kf(n,e,t){if(t.openStart>n.depth)throw new qo("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qo("Inconsistent open depths");return xc(n,e,t,0)}function xc(n,e,t,o){let s=n.index(o),r=n.node(o);if(s==e.index(o)&&o<n.depth-t.openStart){let i=xc(n,e,t,o+1);return r.copy(r.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let i=n.parent,l=i.content;return It(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Ef(t,n);return It(r,Cc(n,i,l,e,o))}else return It(r,Uo(n,e,o))}function wc(n,e){if(!e.type.compatibleContent(n.type))throw new qo("Cannot join "+e.type.name+" onto "+n.type.name)}function vr(n,e,t){let o=n.node(t);return wc(o,e.node(t)),o}function Ot(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 zn(n,e,t,o){let s=(e||n).node(t),r=0,i=e?e.index(t):s.childCount;n&&(r=n.index(t),n.depth>t?r++:n.textOffset&&(Ot(n.nodeAfter,o),r++));for(let l=r;l<i;l++)Ot(s.child(l),o);e&&e.depth==t&&e.textOffset&&Ot(e.nodeBefore,o)}function It(n,e){return n.type.checkContent(e),n.copy(e)}function Cc(n,e,t,o,s){let r=n.depth>s&&vr(n,e,s+1),i=o.depth>s&&vr(t,o,s+1),l=[];return zn(null,n,s,l),r&&i&&e.index(s)==t.index(s)?(wc(r,i),Ot(It(r,Cc(n,e,t,o,s+1)),l)):(r&&Ot(It(r,Uo(n,e,s+1)),l),zn(e,t,s,l),i&&Ot(It(i,Uo(t,o,s+1)),l)),zn(o,null,s,l),new T(l)}function Uo(n,e,t){let o=[];if(zn(null,n,t,o),n.depth>t){let s=vr(n,e,t+1);Ot(It(s,Uo(n,e,t+1)),o)}return zn(e,null,t,o),new T(o)}function Ef(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)s=e.node(r).copy(T.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Jn{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,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 o=this.pos-this.path[this.path.length-1],s=e.child(t);return o?e.child(t).cut(o):s}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 o=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)s+=o.child(r).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),s=e.maybeChild(t);if(!o){let l=o;o=s,s=l}let r=o.marks;for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,s=e.parent.maybeChild(e.index());for(var r=0;r<o.length;r++)o[r].type.spec.inclusive===!1&&(!s||!o[r].isInSet(s.marks))&&(o=o[r--].removeFromSet(o));return o}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 o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Ko(this,e,o);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 o=[],s=0,r=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(r),c=r-a;if(o.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;r=c-1,s+=a+1}return new Jn(t,o,r)}static resolveCached(e,t){let o=ol.get(e);if(o)for(let r=0;r<o.elts.length;r++){let i=o.elts[r];if(i.pos==t)return i}else ol.set(e,o=new Tf);let s=o.elts[o.i]=Jn.resolve(e,t);return o.i=(o.i+1)%Mf,s}}class Tf{constructor(){this.elts=[],this.i=0}}const Mf=12,ol=new WeakMap;class Ko{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}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 Af=Object.create(null);let Rt=class Sr{constructor(e,t,o,s=B.none){this.type=e,this.attrs=t,this.marks=s,this.content=o||T.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,o,s=0){this.content.nodesBetween(e,t,o,s,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,o,s){return this.content.textBetween(e,t,o,s)}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,o){return this.type==e&&jo(this.attrs,t||e.defaultAttrs||Af)&&B.sameSet(this.marks,o||B.none)}copy(e=null){return e==this.content?this:new Sr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Sr(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,o=!1){if(e==t)return A.empty;let s=this.resolve(e),r=this.resolve(t),i=o?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,r.pos-l);return new A(c,s.depth-i,r.depth-i)}replace(e,t,o){return kf(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let s=this.content.child(t-1);return{node:s,index:t-1,offset:o-s.nodeSize}}resolve(e){return Jn.resolveCached(this,e)}resolveNoCache(e){return Jn.resolve(this,e)}rangeHasMark(e,t,o){let s=!1;return t>e&&this.nodesBetween(e,t,r=>(o.isInSet(r.marks)&&(s=!0),!s)),s}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()+")"),kc(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,o=T.empty,s=0,r=o.childCount){let i=this.contentMatchAt(e).matchFragment(o,s,r),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<r;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,s){if(s&&!this.type.allowsMarks(s))return!1;let r=this.contentMatchAt(e).matchType(o),i=r&&r.matchFragment(this.content,t);return i?i.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=B.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!B.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 o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=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,o)}let s=T.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,s,o);return r.type.checkAttrs(r.attrs),r}};Rt.prototype.text=void 0;class Jo extends Rt{constructor(e,t,o,s){if(super(e,t,null,s),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kc(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 Jo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jo(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 kc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Vt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new Pf(e,t);if(o.next==null)return Vt.empty;let s=Ec(o);o.next&&o.err("Unexpected trailing text");let r=$f(Lf(s));return zf(r,o),r}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,o=e.childCount){let s=this;for(let r=t;s&&r<o;r++)s=s.matchType(e.child(r).type);return s}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 o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let s=[this];function r(i,l){let a=i.matchFragment(e,o);if(a&&(!t||a.validEnd))return T.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:p}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(p)==-1){s.push(p);let u=r(p,l.concat(d));if(u)return u}}return null}return r(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let s=o.shift(),r=s.match;if(r.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<r.next.length;i++){let{type:l,next:a}=r.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:s}),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(o){e.push(o);for(let s=0;s<o.next.length;s++)e.indexOf(o.next[s].next)==-1&&t(o.next[s].next)}return t(this),e.map((o,s)=>{let r=s+(o.validEnd?"*":" ")+" ";for(let i=0;i<o.next.length;i++)r+=(i?", ":"")+o.next[i].type.name+"->"+e.indexOf(o.next[i].next);return r}).join(`
|
|
908
|
-
`)}}Vt.empty=new Vt(!0);class Pf{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 Ec(n){let e=[];do e.push(Nf(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Nf(n){let e=[];do e.push(Of(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Of(n){let e=Df(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=If(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 If(n,e){let t=sl(n),o=t;return n.eat(",")&&(n.next!="}"?o=sl(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function Rf(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let s=[];for(let r in t){let i=t[r];i.isInGroup(e)&&s.push(i)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Df(n){if(n.eat("(")){let e=Ec(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=Rf(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 Lf(n){let e=[[]];return s(r(n,0),t()),e;function t(){return e.push([])-1}function o(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function r(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(r(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=r(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=t())}else if(i.type=="star"){let a=t();return o(l,a),s(r(i.expr,a),a),[o(a)]}else if(i.type=="plus"){let a=t();return s(r(i.expr,l),a),s(r(i.expr,a),a),[o(a)]}else{if(i.type=="opt")return[o(l)].concat(r(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let d=t();s(r(i.expr,a),d),a=d}if(i.max==-1)s(r(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let d=t();o(a,d),s(r(i.expr,a),d),a=d}return[o(a)]}else{if(i.type=="name")return[o(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Tc(n,e){return e-n}function rl(n,e){let t=[];return o(e),t.sort(Tc);function o(s){let r=n[s];if(r.length==1&&!r[0].term)return o(r[0].to);t.push(s);for(let i=0;i<r.length;i++){let{term:l,to:a}=r[i];!l&&t.indexOf(a)==-1&&o(a)}}}function $f(n){let e=Object.create(null);return t(rl(n,0));function t(o){let s=[];o.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<s.length;d++)s[d][0]==l&&(c=s[d][1]);rl(n,a).forEach(d=>{c||s.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let r=e[o.join(",")]=new Vt(o.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Tc);r.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return r}}function zf(n,e){for(let t=0,o=[n];t<o.length;t++){let s=o[t],r=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),r&&!(a.isText||a.hasRequiredAttrs())&&(r=!1),o.indexOf(c)==-1&&o.push(c)}r&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Mc(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function Ac(n,e){let t=Object.create(null);for(let o in n){let s=e&&e[o];if(s===void 0){let r=n[o];if(r.hasDefault)s=r.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=s}return t}function Pc(n,e,t,o){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let r=n[s];r.validate&&r.validate(e[s])}}function Nc(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new Bf(n,o,e[o]);return t}let il=class Oc{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Nc(e,o.attrs),this.defaultAttrs=Mc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Vt.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:Ac(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Rt(this,this.computeAttrs(e),T.from(t),B.setFrom(o))}createChecked(e=null,t,o){return t=T.from(t),this.checkContent(t),new Rt(this,this.computeAttrs(e),t,B.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=T.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let s=this.contentMatch.matchFragment(t),r=s&&s.fillBefore(T.empty,!0);return r?new Rt(this,e,t.append(r),B.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){Pc(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 o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:B.none:e}static compile(e,t){let o=Object.create(null);e.forEach((r,i)=>o[r]=new Oc(r,t,i));let s=t.spec.topNode||"doc";if(!o[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let r in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Vf(n,e,t){let o=t.split("|");return s=>{let r=s===null?"null":typeof s;if(o.indexOf(r)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${r}`)}}class Bf{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Vf(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class fs{constructor(e,t,o,s){this.name=e,this.rank=t,this.schema=o,this.spec=s,this.attrs=Nc(e,s.attrs),this.excluded=null;let r=Mc(this.attrs);this.instance=r?new B(this,r):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Ac(this.attrs,e))}static compile(e,t){let o=Object.create(null),s=0;return e.forEach((r,i)=>o[r]=new fs(r,s++,t,i)),o}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){Pc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Hf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=X.from(e.nodes),t.marks=X.from(e.marks||{}),this.nodes=il.compile(this.spec.nodes,this),this.marks=fs.compile(this.spec.marks,this);let o=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let r=this.nodes[s],i=r.spec.content||"",l=r.spec.marks;if(r.contentMatch=o[i]||(o[i]=Vt.parse(i,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=l=="_"?null:l?ll(this,l.split(" ")):l==""||!r.inlineContent?[]:null}for(let s in this.marks){let r=this.marks[s],i=r.spec.excludes;r.excluded=i==null?[r]:i==""?[]:ll(this,i.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,o,s){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,o,s)}text(e,t){let o=this.nodes.text;return new Jo(o,o.defaultAttrs,e,B.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Rt.fromJSON(this,e)}markFromJSON(e){return B.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ll(n,e){let t=[];for(let o=0;o<e.length;o++){let s=e[o],r=n.marks[s],i=r;if(r)t.push(r);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function Ff(n){return n.tag!=null}function _f(n){return n.style!=null}class Bt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(s=>{if(Ff(s))this.tags.push(s);else if(_f(s)){let r=/[^=]*/.exec(s.style)[0];o.indexOf(r)<0&&o.push(r),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let r=e.nodes[s.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let o=new cl(this,t,!1);return o.addAll(e,B.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new cl(this,t,!0);return o.addAll(e,B.none,t.from,t.to),A.maxOpen(o.finish())}matchTag(e,t,o){for(let s=o?this.tags.indexOf(o)+1:0;s<this.tags.length;s++){let r=this.tags[s];if(jf(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let i=r.getAttrs(e);if(i===!1)continue;r.attrs=i||void 0}return r}}}matchStyle(e,t,o,s){for(let r=s?this.styles.indexOf(s)+1:0;r<this.styles.length;r++){let i=this.styles[r],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!o.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function o(s){let r=s.priority==null?50:s.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<r)break}t.splice(i,0,s)}for(let s in e.marks){let r=e.marks[s].spec.parseDOM;r&&r.forEach(i=>{o(i=dl(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let r=e.nodes[s].spec.parseDOM;r&&r.forEach(i=>{o(i=dl(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Bt(e,Bt.schemaRules(e)))}}const Ic={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},Gf={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Rc={ol:!0,ul:!0},Zo=1,Yo=2,Vn=4;function al(n,e,t){return e!=null?(e?Zo:0)|(e==="full"?Yo:0):n&&n.whitespace=="pre"?Zo|Yo:t&~Vn}class wo{constructor(e,t,o,s,r,i){this.type=e,this.attrs=t,this.marks=o,this.solid=s,this.options=i,this.content=[],this.activeMarks=B.none,this.match=r||(i&Vn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,s;return(s=o.findWrapping(e.type))?(this.match=o,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Zo)){let o=this.content[this.content.length-1],s;if(o&&o.isText&&(s=/[ \t\r\n\u000c]+$/.exec(o.text))){let r=o;o.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-s[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.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&&!Ic.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class cl{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0;let s=t.topNode,r,i=al(null,t.preserveWhitespace,0)|(o?Vn:0);s?r=new wo(s.type,s.attrs,B.none,!0,t.topMatch||s.type.contentMatch,i):o?r=new wo(null,null,B.none,!0,null,i):r=new wo(e.schema.topNodeType,null,B.none,!0,null,i),this.nodes=[r],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 o=e.nodeValue,s=this.top;if(s.options&Yo||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(s.options&Zo)s.options&Yo?o=o.replace(/\r\n?/g,`
|
|
909
|
-
`):o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let r=
|
|
910
|
-
`),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 o=e.style;if(o&&o.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let r=this.parser.matchedStyles[s],i=o.getPropertyValue(r);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(r,i,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,o,s){let r,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),o)||this.leafFallback(e,o);else{let a=this.enter(i,t.attrs||null,o,t.preserveWhitespace);a&&(r=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,o,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o));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,o),this.findAround(e,a,!1)}r&&this.sync(l)&&this.open--}addAll(e,t,o,s){let r=o||0;for(let i=o?e.childNodes[o]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i,t);this.findAtPoint(e,r)}findPlace(e,t){let o,s;for(let r=this.open;r>=0;r--){let i=this.nodes[r],l=i.findWrapping(e);if(l&&(!o||o.length>l.length)&&(o=l,s=i,!l.length)||i.solid)break}if(!o)return null;this.sync(s);for(let r=0;r<o.length;r++)t=this.enterInner(o[r],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let o=this.findPlace(e,t);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let r=B.none;for(let i of o.concat(e.marks))(s.type?s.type.allowsMarkType(i.type):pl(i.type,e.type))&&(r=i.addToSet(r));return s.content.push(e.mark(r)),!0}return!1}enter(e,t,o,s){let r=this.findPlace(e.create(t),o);return r&&(r=this.enterInner(e,t,o,!0,s)),r}enterInner(e,t,o,s=!1,r){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=al(e,r,i.options);i.options&Vn&&i.content.length==0&&(l|=Vn);let a=B.none;return o=o.filter(c=>(i.type?i.type.allowsMarkType(c.type):pl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new wo(e,t,a,s,null,l)),this.open++,o}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 o=this.nodes[t].content;for(let s=o.length-1;s>=0;s--)e+=o[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].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,o){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(o?2:4)&&(this.find[s].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("/"),o=this.options.context,s=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),r=-(o?o.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=r;a--)if(i(l-1,a))return!0;return!1}else{let d=a>0||a==0&&s?this.nodes[a].type:o&&a>=r?o.node(a-r).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function Wf(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Rc.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function jf(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function dl(n){let e={};for(let t in n)e[t]=n[t];return e}function pl(n,e){let t=e.schema.nodes;for(let o in t){let s=t[o];if(!s.allowsMarkType(n))continue;let r=[],i=l=>{r.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||r.indexOf(d)<0&&i(d))return!0}};if(i(s.contentMatch))return!0}}class Wt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Os(t).createDocumentFragment());let s=o,r=[];return e.forEach(i=>{if(r.length||i.marks.length){let l=0,a=0;for(;l<r.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(r[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<r.length;)s=r.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],d=this.serializeMark(c,i.isInline,t);d&&(r.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(i,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:s}=Io(Os(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let r=this.serializeMark(e.marks[s],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(o),o=r.dom)}return o}serializeMark(e,t,o={}){let s=this.marks[e.type.name];return s&&Io(Os(o),s(e,t),null,e.attrs)}static renderSpec(e,t,o=null,s){return Io(e,t,o,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ul(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return ul(e.marks)}}function ul(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Os(n){return n.document||window.document}const hl=new WeakMap;function qf(n){let e=hl.get(n);return e===void 0&&hl.set(n,e=Uf(n)),e}function Uf(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let s=0;s<o.length;s++)t(o[s]);else for(let s in o)t(o[s])}return t(n),e}function Io(n,e,t,o){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 s=e[0],r;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(r=qf(o))&&r.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 i=s.indexOf(" ");i>0&&(t=s.slice(0,i),s=s.slice(i+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let p in c)if(c[p]!=null){let u=p.indexOf(" ");u>0?a.setAttributeNS(p.slice(0,u),p.slice(u+1),c[p]):a.setAttribute(p,c[p])}}for(let p=d;p<e.length;p++){let u=e[p];if(u===0){if(p<e.length-1||p>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:f}=Io(n,u,t,o);if(a.appendChild(h),f){if(l)throw new RangeError("Multiple content holes");l=f}}}return{dom:a,contentDOM:l}}const Dc=65535,Lc=Math.pow(2,16);function Kf(n,e){return n+e*Lc}function fl(n){return n&Dc}function Jf(n){return(n-(n&Dc))/Lc}const $c=1,zc=2,Ro=4,Vc=8;class xr{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Vc)>0}get deletedBefore(){return(this.delInfo&($c|Ro))>0}get deletedAfter(){return(this.delInfo&(zc|Ro))>0}get deletedAcross(){return(this.delInfo&Ro)>0}}class Se{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Se.empty)return Se.empty}recover(e){let t=0,o=fl(e);if(!this.inverted)for(let s=0;s<o;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[o*3]+t+Jf(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let s=0,r=this.inverted?2:1,i=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+r],d=this.ranges[l+i],p=a+c;if(e<=p){let u=c?e==a?-1:e==p?1:t:t,h=a+s+(u<0?0:d);if(o)return h;let f=e==(t<0?a:p)?null:Kf(l/3,e-a),m=e==a?zc:e==p?$c:Ro;return(t<0?e!=a:e!=p)&&(m|=Vc),new xr(h,m,f)}s+=d-c}return o?e+s:new xr(e+s,0,null)}touches(e,t){let o=0,s=fl(t),r=this.inverted?2:1,i=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+r],d=a+c;if(e<=d&&l==s*3)return!0;o+=this.ranges[l+i]-c}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let s=0,r=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?r:0),a=i+(this.inverted?0:r),c=this.ranges[s+t],d=this.ranges[s+o];e(l,l+c,a,a+d),r+=d-c}}invert(){return new Se(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Se.empty:new Se(e<0?[0,-e,0]:[0,0,e])}}Se.empty=new Se([]);class cn{constructor(e=[],t,o=0,s=e.length){this.maps=e,this.mirror=t,this.from=o,this.to=s}slice(e=0,t=this.maps.length){return new cn(this.maps,this.mirror,e,t)}copy(){return new cn(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,o=this.maps.length;t<e.maps.length;t++){let s=e.getMirror(t);this.appendMap(e.maps[t],s!=null&&s<t?o+s: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,o=this.maps.length+e.maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e.maps[t].invert(),s!=null&&s>t?o-s-1:void 0)}}invert(){let e=new cn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this.maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let s=0;for(let r=this.from;r<this.to;r++){let i=this.maps[r],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(r);if(a!=null&&a>r&&a<this.to){r=a,e=this.maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return o?e:new xr(e,s,null)}}const Is=Object.create(null);class re{getMap(){return Se.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Is[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Is)throw new RangeError("Duplicate use of step JSON ID "+e);return Is[e]=t,t.prototype.jsonID=e,t}}class K{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new K(e,null)}static fail(e){return new K(null,e)}static fromReplace(e,t,o,s){try{return K.ok(e.replace(t,o,s))}catch(r){if(r instanceof qo)return K.fail(r.message);throw r}}}function si(n,e,t){let o=[];for(let s=0;s<n.childCount;s++){let r=n.child(s);r.content.size&&(r=r.copy(si(r.content,e,r))),r.isInline&&(r=e(r,t,s)),o.push(r)}return T.fromArray(o)}class ct extends re{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),s=o.node(o.sharedDepth(this.to)),r=new A(si(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),t.openStart,t.openEnd);return K.fromReplace(e,this.from,this.to,r)}invert(){return new _e(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new ct(t.pos,o.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(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 ct(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("addMark",ct);class _e extends re{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new A(si(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return K.fromReplace(e,this.from,this.to,o)}invert(){return new ct(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new _e(t.pos,o.pos,this.mark)}merge(e){return e instanceof _e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _e(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 _e(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("removeMark",_e);class dt extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return K.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return K.fromReplace(e,this.pos,this.pos+1,new A(T.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(o))return new dt(this.pos,t.marks[s]);return new dt(this.pos,this.mark)}}return new mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new dt(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 dt(t.pos,e.markFromJSON(t.mark))}}re.jsonID("addNodeMark",dt);class mn extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return K.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return K.fromReplace(e,this.pos,this.pos+1,new A(T.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new dt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mn(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 mn(t.pos,e.markFromJSON(t.mark))}}re.jsonID("removeNodeMark",mn);class oe extends re{constructor(e,t,o,s=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=s}apply(e){return this.structure&&wr(e,this.from,this.to)?K.fail("Structure replace would overwrite content"):K.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Se([this.from,this.to-this.from,this.slice.size])}invert(e){return new oe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new oe(t.pos,Math.max(t.pos,o.pos),this.slice)}merge(e){if(!(e instanceof oe)||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?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new oe(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?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new oe(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 oe(t.from,t.to,A.fromJSON(e,t.slice),!!t.structure)}}re.jsonID("replace",oe);class te extends re{constructor(e,t,o,s,r,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=s,this.slice=r,this.insert=i,this.structure=l}apply(e){if(this.structure&&(wr(e,this.from,this.gapFrom)||wr(e,this.gapTo,this.to)))return K.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return K.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?K.fromReplace(e,this.from,this.to,o):K.fail("Content does not fit in gap")}getMap(){return new Se([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 te(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),o=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||s<t.pos||r>o.pos?null:new te(t.pos,o.pos,s,r,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 te(t.from,t.to,t.gapFrom,t.gapTo,A.fromJSON(e,t.slice),t.insert,!!t.structure)}}re.jsonID("replaceAround",te);function wr(n,e,t){let o=n.resolve(e),s=t-e,r=o.depth;for(;s>0&&r>0&&o.indexAfter(r)==o.node(r).childCount;)r--,s--;if(s>0){let i=o.node(r).maybeChild(o.indexAfter(r));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function Zf(n,e,t,o){let s=[],r=[],i,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let p=a.marks;if(!o.isInSet(p)&&d.type.allowsMarkType(o.type)){let u=Math.max(c,e),h=Math.min(c+a.nodeSize,t),f=o.addToSet(p);for(let m=0;m<p.length;m++)p[m].isInSet(f)||(i&&i.to==u&&i.mark.eq(p[m])?i.to=h:s.push(i=new _e(u,h,p[m])));l&&l.to==u?l.to=h:r.push(l=new ct(u,h,o))}}),s.forEach(a=>n.step(a)),r.forEach(a=>n.step(a))}function Yf(n,e,t,o){let s=[],r=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;r++;let a=null;if(o instanceof fs){let c=i.marks,d;for(;d=o.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else o?o.isInSet(i.marks)&&(a=[o]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,t);for(let d=0;d<a.length;d++){let p=a[d],u;for(let h=0;h<s.length;h++){let f=s[h];f.step==r-1&&p.eq(s[h].style)&&(u=f)}u?(u.to=c,u.step=r):s.push({style:p,from:Math.max(l,e),to:c,step:r})}}}),s.forEach(i=>n.step(new _e(i.from,i.to,i.style)))}function ri(n,e,t,o=t.contentMatch,s=!0){let r=n.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<r.childCount;a++){let c=r.child(a),d=l+c.nodeSize,p=o.matchType(c.type);if(!p)i.push(new oe(l,d,A.empty));else{o=p;for(let u=0;u<c.marks.length;u++)t.allowsMarkType(c.marks[u].type)||n.step(new _e(l,d,c.marks[u]));if(s&&c.isText&&t.whitespace!="pre"){let u,h=/\r?\n|\r/g,f;for(;u=h.exec(c.text);)f||(f=new A(T.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new oe(l+u.index,l+u.index+u[0].length,f))}}l=d}if(!o.validEnd){let a=o.fillBefore(T.empty,!0);n.replace(l,l,new A(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function Xf(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 o=n.depth;;--o){let s=n.$from.node(o),r=n.$from.index(o),i=n.$to.indexAfter(o);if(o<n.depth&&s.canReplace(r,i,t))return o;if(o==0||s.type.spec.isolating||!Xf(s,r,i))break}return null}function Qf(n,e,t){let{$from:o,$to:s,depth:r}=e,i=o.before(r+1),l=s.after(r+1),a=i,c=l,d=T.empty,p=0;for(let f=r,m=!1;f>t;f--)m||o.index(f)>0?(m=!0,d=T.from(o.node(f).copy(d)),p++):a--;let u=T.empty,h=0;for(let f=r,m=!1;f>t;f--)m||s.after(f+1)<s.end(f)?(m=!0,u=T.from(s.node(f).copy(u)),h++):c++;n.step(new te(a,c,i,l,new A(d.append(u),p,h),d.size-p,!0))}function Bc(n,e,t=null,o=n){let s=em(n,e),r=s&&tm(o,e);return r?s.map(ml).concat({type:e,attrs:t}).concat(r.map(ml)):null}function ml(n){return{type:n,attrs:null}}function em(n,e){let{parent:t,startIndex:o,endIndex:s}=n,r=t.contentMatchAt(o).findWrapping(e);if(!r)return null;let i=r.length?r[0]:e;return t.canReplaceWith(o,s,i)?r:null}function tm(n,e){let{parent:t,startIndex:o,endIndex:s}=n,r=t.child(o),i=e.contentMatch.findWrapping(r.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=o;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:i}function nm(n,e,t){let o=T.empty;for(let i=t.length-1;i>=0;i--){if(o.size){let l=t[i].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=T.from(t[i].type.create(t[i].attrs,o))}let s=e.start,r=e.end;n.step(new te(s,r,s,r,new A(o,0,0),t.length,!0))}function om(n,e,t,o,s){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(o,a)&&sm(n.doc,n.mapping.slice(r).map(l),o)){let c=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",f=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!f?c=!1:!h&&f&&(c=!0)}c===!1&&Fc(n,i,l,r),ri(n,n.mapping.slice(r).map(l,1),o,void 0,c===null);let d=n.mapping.slice(r),p=d.map(l,1),u=d.map(l+i.nodeSize,1);return n.step(new te(p,u,p+1,u-1,new A(T.from(o.create(a,null,i.marks)),0,0),1,!0)),c===!0&&Hc(n,i,l,r),!1}})}function Hc(n,e,t,o){e.forEach((s,r)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=n.mapping.slice(o).map(t+1+r+i.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Fc(n,e,t,o){e.forEach((s,r)=>{if(s.type==s.type.schema.linebreakReplacement){let i=n.mapping.slice(o).map(t+1+r);n.replaceWith(i,i+1,e.type.schema.text(`
|
|
911
|
-
`))}})}function sm(n,e,t){let o=n.resolve(e),s=o.index();return o.parent.canReplaceWith(s,s+1,t)}function rm(n,e,t,o,s){let r=n.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let i=t.create(o,null,s||r.marks);if(r.isLeaf)return n.replaceWith(e,e+r.nodeSize,i);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new te(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new A(T.from(i),0,0),1,!0))}function dn(n,e,t=1,o){let s=n.resolve(e),r=s.depth-t,i=o&&o[o.length-1]||s.parent;if(r<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!i.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,d=t-2;c>r;c--,d--){let p=s.node(c),u=s.index(c);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(u,p.childCount),f=o&&o[d+1];f&&(h=h.replaceChild(0,f.type.create(f.attrs)));let m=o&&o[d]||p;if(!p.canReplace(u+1,p.childCount)||!m.type.validContent(h))return!1}let l=s.indexAfter(r),a=o&&o[0];return s.node(r).canReplaceWith(l,l,a?a.type:s.node(r+1).type)}function im(n,e,t=1,o){let s=n.doc.resolve(e),r=T.empty,i=T.empty;for(let l=s.depth,a=s.depth-t,c=t-1;l>a;l--,c--){r=T.from(s.node(l).copy(r));let d=o&&o[c];i=T.from(d?d.type.create(d.attrs,i):s.node(l).copy(i))}n.step(new oe(e,e,new A(r.append(i),t,t),!0))}function gs(n,e){let t=n.resolve(e),o=t.index();return am(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function lm(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let s=0;s<e.childCount;s++){let r=e.child(s),i=r.type==o?n.type.schema.nodes.text:r.type;if(t=t.matchType(i),!t||!n.type.allowsMarks(r.marks))return!1}return t.validEnd}function am(n,e){return!!(n&&e&&!n.isLeaf&&lm(n,e))}function cm(n,e,t){let o=null,{linebreakReplacement:s}=n.doc.type.schema,r=n.doc.resolve(e-t),i=r.node().type;if(s&&i.inlineContent){let d=i.whitespace=="pre",p=!!i.contentMatch.matchType(s);d&&!p?o=!1:!d&&p&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);Fc(n,d.node(),d.before(),l)}i.inlineContent&&ri(n,e+t-1,i,r.node().contentMatchAt(r.index()),o==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new oe(c,a.map(e+t,-1),A.empty,!0)),o===!0){let d=n.doc.resolve(c);Hc(n,d.node(),d.before(),n.steps.length)}return n}function dm(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let s=o.depth-1;s>=0;s--){let r=o.index(s);if(o.node(s).canReplaceWith(r,r,t))return o.before(s+1);if(r>0)return null}if(o.parentOffset==o.parent.content.size)for(let s=o.depth-1;s>=0;s--){let r=o.indexAfter(s);if(o.node(s).canReplaceWith(r,r,t))return o.after(s+1);if(r<o.node(s).childCount)return null}return null}function pm(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let r=0;r<t.openStart;r++)s=s.firstChild.content;for(let r=1;r<=(t.openStart==0&&t.size?2:1);r++)for(let i=o.depth;i>=0;i--){let l=i==o.depth?0:o.pos<=(o.start(i+1)+o.end(i+1))/2?-1:1,a=o.index(i)+(l>0?1:0),c=o.node(i),d=!1;if(r==1)d=c.canReplace(a,a,s);else{let p=c.contentMatchAt(a).findWrapping(s.firstChild.type);d=p&&c.canReplaceWith(a,a,p[0])}if(d)return l==0?o.pos:l<0?o.before(i+1):o.after(i+1)}return null}function ii(n,e,t=e,o=A.empty){if(e==t&&!o.size)return null;let s=n.resolve(e),r=n.resolve(t);return _c(s,r,o)?new oe(e,t,o):new um(s,r,o).fit()}function _c(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class um{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=T.empty;for(let s=0;s<=e.depth;s++){let r=e.node(s);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=T.from(e.node(s).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,o=this.$from,s=this.close(e<0?this.$to:o.doc.resolve(e));if(!s)return null;let r=this.placed,i=o.depth,l=s.depth;for(;i&&l&&r.childCount==1;)r=r.firstChild.content,i--,l--;let a=new A(r,i,l);return e>-1?new te(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new oe(o.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,s=this.unplaced.openEnd;o<e;o++){let r=t.firstChild;if(t.childCount>1&&(s=0),r.type.spec.isolating&&s<=o){e=o;break}t=r.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let s,r=null;o?(r=Rs(this.unplaced.content,o-1).firstChild,s=r.content):s=this.unplaced.content;let i=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,p=null;if(t==1&&(i?c.matchType(i.type)||(p=c.fillBefore(T.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:o,frontierDepth:l,parent:r,inject:p};if(t==2&&i&&(d=c.findWrapping(i.type)))return{sliceDepth:o,frontierDepth:l,parent:r,wrap:d};if(r&&c.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,s=Rs(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new A(e,t+1,Math.max(o,s.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,s=Rs(e,t);if(s.childCount<=1&&t>0){let r=e.size-t<=t+s.size;this.unplaced=new A(On(e,t-1,1),t-1,r?t-1:o)}else this.unplaced=new A(On(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:s,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let m=0;m<r.length;m++)this.openFrontierNode(r[m]);let i=this.unplaced,l=o?o.content:i.content,a=i.openStart-e,c=0,d=[],{match:p,type:u}=this.frontier[t];if(s){for(let m=0;m<s.childCount;m++)d.push(s.child(m));p=p.matchFragment(s)}let h=l.size+e-(i.content.size-i.openEnd);for(;c<l.childCount;){let m=l.child(c),g=p.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(p=g,d.push(Gc(m.mark(u.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let f=c==l.childCount;f||(h=-1),this.placed=In(this.placed,t,T.from(d)),this.frontier[t].match=p,f&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=f?e==0?A.empty:new A(On(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new A(On(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ds(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:o}=this.$to,s=this.$to.after(o);for(;o>1&&s==this.$to.end(--o);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:s}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Ds(e,t,s,o,r);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Ds(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:i,move:r?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=In(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let s=e.node(o),r=s.type.contentMatch.fillBefore(s.content,!0,e.index(o));this.openFrontierNode(s.type,s.attrs,r)}return e}openFrontierNode(e,t=null,o){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=In(this.placed,this.depth,T.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=In(this.placed,this.frontier.length,t))}}function On(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(On(n.firstChild.content,e-1,t)))}function In(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(In(n.lastChild.content,e-1,t)))}function Rs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Gc(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Gc(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(T.empty,!0)))),n.copy(o)}function Ds(n,e,t,o,s){let r=n.node(e),i=s?n.indexAfter(e):n.index(e);if(i==r.childCount&&!t.compatibleContent(r.type))return null;let l=o.fillBefore(r.content,!0,i);return l&&!hm(t,r.content,i)?l:null}function hm(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function fm(n){return n.spec.defining||n.spec.definingForContent}function mm(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),r=n.doc.resolve(t);if(_c(s,r,o))return n.step(new oe(e,t,o));let i=jc(s,n.doc.resolve(t));i[i.length-1]==0&&i.pop();let l=-(s.depth+1);i.unshift(l);for(let u=s.depth,h=s.pos-1;u>0;u--,h--){let f=s.node(u).type.spec;if(f.defining||f.definingAsContext||f.isolating)break;i.indexOf(u)>-1?l=u:s.before(u)==h&&i.splice(1,0,-u)}let a=i.indexOf(l),c=[],d=o.openStart;for(let u=o.content,h=0;;h++){let f=u.firstChild;if(c.push(f),h==o.openStart)break;u=f.content}for(let u=d-1;u>=0;u--){let h=c[u],f=fm(h.type);if(f&&!h.sameMarkup(s.node(Math.abs(l)-1)))d=u;else if(f||!h.type.isTextblock)break}for(let u=o.openStart;u>=0;u--){let h=(u+d+1)%(o.openStart+1),f=c[h];if(f)for(let m=0;m<i.length;m++){let g=i[(m+a)%i.length],b=!0;g<0&&(b=!1,g=-g);let w=s.node(g-1),y=s.index(g-1);if(w.canReplaceWith(y,y,f.type,f.marks))return n.replace(s.before(g),b?r.after(g):t,new A(Wc(o.content,0,o.openStart,h),h,o.openEnd))}}let p=n.steps.length;for(let u=i.length-1;u>=0&&(n.replace(e,t,o),!(n.steps.length>p));u--){let h=i[u];h<0||(e=s.before(h),t=r.after(h))}}function Wc(n,e,t,o,s){if(e<t){let r=n.firstChild;n=n.replaceChild(0,r.copy(Wc(r.content,e+1,t,o,r)))}if(e>o){let r=s.contentMatchAt(0),i=r.fillBefore(n).append(n);n=i.append(r.matchFragment(i).fillBefore(T.empty,!0))}return n}function gm(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=dm(n.doc,e,o.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new A(T.from(o),0,0))}function ym(n,e,t){let o=n.doc.resolve(e),s=n.doc.resolve(t),r=jc(o,s);for(let i=0;i<r.length;i++){let l=r[i],a=i==r.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),s.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),s.indexAfter(l-1))))return n.delete(o.before(l),s.after(l))}for(let i=1;i<=o.depth&&i<=s.depth;i++)if(e-o.start(i)==o.depth-i&&t>o.end(i)&&s.end(i)-t!=s.depth-i&&o.start(i-1)==s.start(i-1)&&o.node(i-1).canReplace(o.index(i-1),s.index(i-1)))return n.delete(o.before(i),t);n.delete(e,t)}function jc(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let s=o;s>=0;s--){let r=n.start(s);if(r<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(r==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==r-1)&&t.push(s)}return t}class pn extends re{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return K.fail("No node at attribute step's position");let o=Object.create(null);for(let r in t.attrs)o[r]=t.attrs[r];o[this.attr]=this.value;let s=t.type.create(o,null,t.marks);return K.fromReplace(e,this.pos,this.pos+1,new A(T.from(s),0,t.isLeaf?0:1))}getMap(){return Se.empty}invert(e){return new pn(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 pn(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 pn(t.pos,t.attr,t.value)}}re.jsonID("attr",pn);class Zn extends re{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return K.ok(o)}getMap(){return Se.empty}invert(e){return new Zn(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 Zn(t.attr,t.value)}}re.jsonID("docAttr",Zn);let gn=class extends Error{};gn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};gn.prototype=Object.create(Error.prototype);gn.prototype.constructor=gn;gn.prototype.name="TransformError";class qc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new cn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new gn(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,o=A.empty){let s=ii(this.doc,e,t,o);return s&&this.step(s),this}replaceWith(e,t,o){return this.replace(e,t,new A(T.from(o),0,0))}delete(e,t){return this.replace(e,t,A.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return mm(this,e,t,o),this}replaceRangeWith(e,t,o){return gm(this,e,t,o),this}deleteRange(e,t){return ym(this,e,t),this}lift(e,t){return Qf(this,e,t),this}join(e,t=1){return cm(this,e,t),this}wrap(e,t){return nm(this,e,t),this}setBlockType(e,t=e,o,s=null){return om(this,e,t,o,s),this}setNodeMarkup(e,t,o=null,s){return rm(this,e,t,o,s),this}setNodeAttribute(e,t,o){return this.step(new pn(e,t,o)),this}setDocAttribute(e,t){return this.step(new Zn(e,t)),this}addNodeMark(e,t){return this.step(new dt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof B)){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t=t.isInSet(o.marks),!t)return this}return this.step(new mn(e,t)),this}split(e,t=1,o){return im(this,e,t,o),this}addMark(e,t,o){return Zf(this,e,t,o),this}removeMark(e,t,o){return Yf(this,e,t,o),this}clearIncompatible(e,t,o){return ri(this,e,t,o),this}}const Ls=Object.create(null);class L{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Uc(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=A.empty){let o=t.content.lastChild,s=null;for(let l=0;l<t.openEnd;l++)s=o,o=o.lastChild;let r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],d=e.mapping.slice(r);e.replaceRange(d.map(a.pos),d.map(c.pos),l?A.empty:t),l==0&&bl(e,r,(o?o.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,s=this.ranges;for(let r=0;r<s.length;r++){let{$from:i,$to:l}=s[r],a=e.mapping.slice(o),c=a.map(i.pos),d=a.map(l.pos);r?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),bl(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let s=e.parent.inlineContent?new $(e):Xt(e.node(0),e.parent,e.pos,e.index(),t,o);if(s)return s;for(let r=e.depth-1;r>=0;r--){let i=t<0?Xt(e.node(0),e.node(r),e.before(r+1),e.index(r),t,o):Xt(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,o);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new we(e.node(0))}static atStart(e){return Xt(e,e,0,0,1)||new we(e)}static atEnd(e){return Xt(e,e,e.content.size,e.childCount,-1)||new we(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Ls[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Ls)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ls[e]=t,t.prototype.jsonID=e,t}getBookmark(){return $.between(this.$anchor,this.$head).getBookmark()}}L.prototype.visible=!0;class Uc{constructor(e,t){this.$from=e,this.$to=t}}let gl=!1;function yl(n){!gl&&!n.parent.inlineContent&&(gl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class $ extends L{constructor(e,t=e){yl(e),yl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return L.near(o);let s=e.resolve(t.map(this.anchor));return new $(s.parent.inlineContent?s:o,o)}replace(e,t=A.empty){if(super.replace(e,t),t==A.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof $&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ys(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 $(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let s=e.resolve(t);return new this(s,o==t?s:e.resolve(o))}static between(e,t,o){let s=e.pos-t.pos;if((!o||s)&&(o=s>=0?1:-1),!t.parent.inlineContent){let r=L.findFrom(t,o,!0)||L.findFrom(t,-o,!0);if(r)t=r.$head;else return L.near(t,o)}return e.parent.inlineContent||(s==0?e=t:(e=(L.findFrom(e,-o,!0)||L.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new $(e,t)}}L.jsonID("text",$);class ys{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ys(e.map(this.anchor),e.map(this.head))}resolve(e){return $.between(e.resolve(this.anchor),e.resolve(this.head))}}class D extends L{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:s}=t.mapResult(this.anchor),r=e.resolve(s);return o?L.near(r):new D(r)}content(){return new A(T.from(this.node),0,0)}eq(e){return e instanceof D&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new li(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new D(e.resolve(t.anchor))}static create(e,t){return new D(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}D.prototype.visible=!1;L.jsonID("node",D);class li{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new ys(o,o):new li(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&D.isSelectable(o)?new D(t):L.near(t)}}class we extends L{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=A.empty){if(t==A.empty){e.delete(0,e.doc.content.size);let o=L.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new we(e)}map(e){return new we(e)}eq(e){return e instanceof we}getBookmark(){return bm}}L.jsonID("all",we);const bm={map(){return this},resolve(n){return new we(n)}};function Xt(n,e,t,o,s,r=!1){if(e.inlineContent)return $.create(n,t);for(let i=o-(s>0?0:1);s>0?i<e.childCount:i>=0;i+=s){let l=e.child(i);if(l.isAtom){if(!r&&D.isSelectable(l))return D.create(n,t-(s<0?l.nodeSize:0))}else{let a=Xt(n,l,t+s,s<0?l.childCount:0,s,r);if(a)return a}t+=l.nodeSize*s}return null}function bl(n,e,t){let o=n.steps.length-1;if(o<e)return;let s=n.steps[o];if(!(s instanceof oe||s instanceof te))return;let r=n.mapping.maps[o],i;r.forEach((l,a,c,d)=>{i==null&&(i=d)}),n.setSelection(L.near(n.doc.resolve(i),t))}const vl=1,Co=2,Sl=4;class vm extends qc{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|vl)&~Co,this.storedMarks=null,this}get selectionSet(){return(this.updated&vl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Co,this}ensureMarks(e){return B.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&Co)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Co,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||B.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),o=o??t,!e)return this.deleteRange(t,o);let r=this.storedMarks;if(!r){let i=this.doc.resolve(t);r=o==t?i.marks():i.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,s.text(e,r)),this.selection.empty||this.setSelection(L.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|=Sl,this}get scrolledIntoView(){return(this.updated&Sl)>0}}function xl(n,e){return!e||!n?n:n.bind(e)}class Rn{constructor(e,t,o){this.name=e,this.init=xl(t.init,o),this.apply=xl(t.apply,o)}}const Sm=[new Rn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Rn("selection",{init(n,e){return n.selection||L.atStart(e.doc)},apply(n){return n.selection}}),new Rn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Rn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class $s{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Sm.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Rn(o.key,o.spec.state,o))})}}class on{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 o=0;o<this.config.plugins.length;o++)if(o!=t){let s=this.config.plugins[o];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),s=null;for(;;){let r=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=s?s[i].n:0,c=s?s[i].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,o);if(d&&o.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let p=0;p<this.config.plugins.length;p++)s.push(p<i?{state:o,n:t.length}:{state:this,n:0})}t.push(d),o=o.applyInner(d),r=!0}s&&(s[i]={state:o,n:t.length})}}if(!r)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new on(this.config),o=this.config.fields;for(let s=0;s<o.length;s++){let r=o[s];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new vm(this)}static create(e){let t=new $s(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new on(t);for(let s=0;s<t.fields.length;s++)o[t.fields[s].name]=t.fields[s].init(e,o);return o}reconfigure(e){let t=new $s(this.schema,e.plugins),o=t.fields,s=new on(t);for(let r=0;r<o.length;r++){let i=o[r].name;s[i]=this.hasOwnProperty(i)?this[i]:o[r].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[o],r=s.spec.state;r&&r.toJSON&&(t[o]=r.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new $s(e.schema,e.plugins),r=new on(s);return s.fields.forEach(i=>{if(i.name=="doc")r.doc=Rt.fromJSON(e.schema,t.doc);else if(i.name=="selection")r.selection=L.fromJSON(r.doc,t.selection);else if(i.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],c=a.spec.state;if(a.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){r[i.name]=c.fromJSON.call(a,e,t[l],r);return}}r[i.name]=i.init(e,r)}}),r}}function Kc(n,e,t){for(let o in n){let s=n[o];s instanceof Function?s=s.bind(e):o=="handleDOMEvents"&&(s=Kc(s,e,{})),t[o]=s}return t}class wn{constructor(e){this.spec=e,this.props={},e.props&&Kc(e.props,this,this.props),this.key=e.key?e.key.key:Jc("plugin")}getState(e){return e[this.key]}}const zs=Object.create(null);function Jc(n){return n in zs?n+"$"+ ++zs[n]:(zs[n]=0,n+"$")}class so{constructor(e="key"){this.key=Jc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Zc=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function xm(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const wm=(n,e,t)=>{let o=xm(n,t);if(!o)return!1;let s=Yc(o);if(!s){let i=o.blockRange(),l=i&&ms(i);return l==null?!1:(e&&e(n.tr.lift(i,l).scrollIntoView()),!0)}let r=s.nodeBefore;if(od(n,s,e,-1))return!0;if(o.parent.content.size==0&&(yn(r,"end")||D.isSelectable(r)))for(let i=o.depth;;i--){let l=ii(n.doc,o.before(i),o.after(i),A.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(yn(r,"end")?L.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):D.create(a.doc,s.pos-r.nodeSize)),e(a.scrollIntoView())}return!0}if(i==1||o.node(i-1).childCount>1)break}return r.isAtom&&s.depth==o.depth-1?(e&&e(n.tr.delete(s.pos-r.nodeSize,s.pos).scrollIntoView()),!0):!1};function yn(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const Cm=(n,e,t)=>{let{$head:o,empty:s}=n.selection,r=o;if(!s)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;r=Yc(o)}let i=r&&r.nodeBefore;return!i||!D.isSelectable(i)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,r.pos-i.nodeSize)).scrollIntoView()),!0)};function Yc(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 km(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Em=(n,e,t)=>{let o=km(n,t);if(!o)return!1;let s=Xc(o);if(!s)return!1;let r=s.nodeAfter;if(od(n,s,e,1))return!0;if(o.parent.content.size==0&&(yn(r,"start")||D.isSelectable(r))){let i=ii(n.doc,o.before(),o.after(),A.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=n.tr.step(i);l.setSelection(yn(r,"start")?L.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):D.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return r.isAtom&&s.depth==o.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+r.nodeSize).scrollIntoView()),!0):!1},Tm=(n,e,t)=>{let{$head:o,empty:s}=n.selection,r=o;if(!s)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;r=Xc(o)}let i=r&&r.nodeAfter;return!i||!D.isSelectable(i)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,r.pos)).scrollIntoView()),!0)};function Xc(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 Mm=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
912
|
-
`).scrollIntoView()),!0)};function ai(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 Qc=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let s=t.node(-1),r=t.indexAfter(-1),i=ai(s.contentMatchAt(r));if(!i||!s.canReplaceWith(r,r,i))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,i.createAndFill());a.setSelection(L.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Am=(n,e)=>{let t=n.selection,{$from:o,$to:s}=t;if(t instanceof we||o.parent.inlineContent||s.parent.inlineContent)return!1;let r=ai(s.parent.contentMatchAt(s.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let i=(!o.parentOffset&&s.index()<s.parent.childCount?o:s).pos,l=n.tr.insert(i,r.createAndFill());l.setSelection($.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},ed=(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 r=t.before();if(dn(n.doc,r))return e&&e(n.tr.split(r).scrollIntoView()),!0}let o=t.blockRange(),s=o&&ms(o);return s==null?!1:(e&&e(n.tr.lift(o,s).scrollIntoView()),!0)};function td(n){return(e,t)=>{let{$from:o,$to:s}=e.selection;if(e.selection instanceof D&&e.selection.node.isBlock)return!o.parentOffset||!dn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let r=[],i,l,a=!1,c=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),c=o.start(h)==o.pos-(o.depth-h),l=ai(o.node(h-1).contentMatchAt(o.indexAfter(h-1)));let m=n&&n(s.parent,a,o);r.unshift(m||(a&&l?{type:l}:null)),i=h;break}else{if(h==1)return!1;r.unshift(null)}let d=e.tr;(e.selection instanceof $||e.selection instanceof we)&&d.deleteSelection();let p=d.mapping.map(o.pos),u=dn(d.doc,p,r.length,r);if(u||(r[0]=l?{type:l}:null,u=dn(d.doc,p,r.length,r)),d.split(p,r.length,r),!a&&c&&o.node(i).type!=l){let h=d.mapping.map(o.before(i)),f=d.doc.resolve(h);l&&o.node(i-1).canReplaceWith(f.index(),f.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(i)),l)}return t&&t(d.scrollIntoView()),!0}}const Pm=td(),nd=(n,e)=>(e&&e(n.tr.setSelection(new we(n.doc))),!0);function Nm(n,e,t){let o=e.nodeBefore,s=e.nodeAfter,r=e.index();return!o||!s||!o.type.compatibleContent(s.type)?!1:!o.content.size&&e.parent.canReplace(r-1,r)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(s.isTextblock||gs(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function od(n,e,t,o){let s=e.nodeBefore,r=e.nodeAfter,i,l,a=s.type.spec.isolating||r.type.spec.isolating;if(!a&&Nm(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(l=s.contentMatchAt(s.childCount)).findWrapping(r.type))&&l.matchType(i[0]||r.type).validEnd){if(t){let h=e.pos+r.nodeSize,f=T.empty;for(let b=i.length-1;b>=0;b--)f=T.from(i[b].create(null,f));f=T.from(s.copy(f));let m=n.tr.step(new te(e.pos-1,h,e.pos,h,new A(f,1,0),i.length,!0)),g=m.doc.resolve(h+2*i.length);g.nodeAfter&&g.nodeAfter.type==s.type&&gs(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=r.type.spec.isolating||o>0&&a?null:L.findFrom(e,1),p=d&&d.$from.blockRange(d.$to),u=p&&ms(p);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(p,u).scrollIntoView()),!0;if(c&&yn(r,"start",!0)&&yn(s,"end")){let h=s,f=[];for(;f.push(h),!h.isTextblock;)h=h.lastChild;let m=r,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let b=T.empty;for(let y=f.length-1;y>=0;y--)b=T.from(f[y].copy(b));let w=n.tr.step(new te(e.pos-f.length,e.pos+r.nodeSize,e.pos+g,e.pos+r.nodeSize-g,new A(b,f.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function sd(n){return function(e,t){let o=e.selection,s=n<0?o.$from:o.$to,r=s.depth;for(;s.node(r).isInline;){if(!r)return!1;r--}return s.node(r).isTextblock?(t&&t(e.tr.setSelection($.create(e.doc,n<0?s.start(r):s.end(r)))),!0):!1}}const Om=sd(-1),Im=sd(1);function Rm(n,e=null){return function(t,o){let s=!1;for(let r=0;r<t.selection.ranges.length&&!s;r++){let{$from:{pos:i},$to:{pos:l}}=t.selection.ranges[r];t.doc.nodesBetween(i,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)s=!0;else{let d=t.doc.resolve(c),p=d.index();s=d.parent.canReplaceWith(p,p+1,n)}})}if(!s)return!1;if(o){let r=t.tr;for(let i=0;i<t.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[i];r.setBlockType(l,a,n,e)}o(r.scrollIntoView())}return!0}}function Dm(n,e,t,o){for(let s=0;s<e.length;s++){let{$from:r,$to:i}=e[s],l=r.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(r.pos,i.pos,(a,c)=>{if(l||!o)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function kt(n,e=null,t){let o=t!==!1;return function(s,r){let{empty:i,$cursor:l,ranges:a}=s.selection;if(i&&!l||!Dm(s.doc,a,n,o))return!1;if(r)if(l)n.isInSet(s.storedMarks||l.marks())?r(s.tr.removeStoredMark(n)):r(s.tr.addStoredMark(n.create(e)));else{let c,d=s.tr;c=!a.some(p=>s.doc.rangeHasMark(p.$from.pos,p.$to.pos,n));for(let p=0;p<a.length;p++){let{$from:u,$to:h}=a[p];if(!c)d.removeMark(u.pos,h.pos,n);else{let f=u.pos,m=h.pos,g=u.nodeAfter,b=h.nodeBefore,w=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,y=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;f+w<m&&(f+=w,m-=y),d.addMark(f,m,n.create(e))}}r(d.scrollIntoView())}return!0}}function Yn(...n){return function(e,t,o){for(let s=0;s<n.length;s++)if(n[s](e,t,o))return!0;return!1}}let Vs=Yn(Zc,wm,Cm),wl=Yn(Zc,Em,Tm);const Xe={Enter:Yn(Mm,Am,ed,Pm),"Mod-Enter":Qc,Backspace:Vs,"Mod-Backspace":Vs,"Shift-Backspace":Vs,Delete:wl,"Mod-Delete":wl,"Mod-a":nd},rd={"Ctrl-h":Xe.Backspace,"Alt-Backspace":Xe["Mod-Backspace"],"Ctrl-d":Xe.Delete,"Ctrl-Alt-Backspace":Xe["Mod-Delete"],"Alt-Delete":Xe["Mod-Delete"],"Alt-d":Xe["Mod-Delete"],"Ctrl-a":Om,"Ctrl-e":Im};for(let n in Xe)rd[n]=Xe[n];const Lm=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,$m=Lm?rd:Xe;var Xo=200,Z=function(){};Z.prototype.append=function(e){return e.length?(e=Z.from(e),!this.length&&e||e.length<Xo&&this.leafAppend(e)||this.length<Xo&&e.leafPrepend(this)||this.appendInner(e)):this};Z.prototype.prepend=function(e){return e.length?Z.from(e).append(this):this};Z.prototype.appendInner=function(e){return new zm(this,e)};Z.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Z.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Z.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Z.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};Z.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var s=[];return this.forEach(function(r,i){return s.push(e(r,i))},t,o),s};Z.from=function(e){return e instanceof Z?e:e&&e.length?new id(e):Z.empty};var id=function(n){function e(o){n.call(this),this.values=o}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(s,r){return s==0&&r==this.length?this:new e(this.values.slice(s,r))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,r,i,l){for(var a=r;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,r,i,l){for(var a=r-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Xo)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Xo)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Z);Z.empty=new id([]);var zm=function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.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(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,s,r,i){var l=this.left.length;if(s<l&&this.left.forEachInner(o,s,Math.min(r,l),i)===!1||r>l&&this.right.forEachInner(o,Math.max(s-l,0),Math.min(this.length,r)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,r,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(o,s-l,Math.max(r,l)-l,i+l)===!1||r<l&&this.left.forEachInvertedInner(o,Math.min(s,l),r,i)===!1)return!1},e.prototype.sliceInner=function(o,s){if(o==0&&s==this.length)return this;var r=this.left.length;return s<=r?this.left.slice(o,s):o>=r?this.right.slice(o-r,s-r):this.left.slice(o,r).append(this.right.slice(0,s-r))},e.prototype.leafAppend=function(o){var s=this.right.leafAppend(o);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(o){var s=this.left.leafPrepend(o);if(s)return new e(s,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e}(Z);const Vm=500;class Oe{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let s,r;t&&(s=this.remapping(o,this.items.length),r=s.maps.length);let i=e.tr,l,a,c=[],d=[];return this.items.forEach((p,u)=>{if(!p.step){s||(s=this.remapping(o,u+1),r=s.maps.length),r--,d.push(p);return}if(s){d.push(new Ve(p.map));let h=p.step.map(s.slice(r)),f;h&&i.maybeStep(h).doc&&(f=i.mapping.maps[i.mapping.maps.length-1],c.push(new Ve(f,void 0,void 0,c.length+d.length))),r--,f&&s.appendMap(f,r)}else i.maybeStep(p.step);if(p.selection)return l=s?p.selection.map(s.slice(r)):p.selection,a=new Oe(this.items.slice(0,o).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,o,s){let r=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let p=e.steps[d].invert(e.docs[d]),u=new Ve(e.mapping.maps[d],p,t),h;(h=a&&a.merge(u))&&(u=h,d?r.pop():l=l.slice(0,l.length-1)),r.push(u),t&&(i++,t=void 0),s||(a=u)}let c=i-o.depth;return c>Hm&&(l=Bm(l,c),i-=c),new Oe(l.append(r),i)}remapping(e,t){let o=new cn;return this.items.forEach((s,r)=>{let i=s.mirrorOffset!=null&&r-s.mirrorOffset>=e?o.maps.length-s.mirrorOffset:void 0;o.appendMap(s.map,i)},e,t),o}addMaps(e){return this.eventCount==0?this:new Oe(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],s=Math.max(0,this.items.length-t),r=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(u=>{u.selection&&l--},s);let a=t;this.items.forEach(u=>{let h=r.getMirror(--a);if(h==null)return;i=Math.min(i,h);let f=r.maps[h];if(u.step){let m=e.steps[h].invert(e.docs[h]),g=u.selection&&u.selection.map(r.slice(a+1,h));g&&l++,o.push(new Ve(f,m,g))}else o.push(new Ve(f))},s);let c=[];for(let u=t;u<i;u++)c.push(new Ve(r.maps[u]));let d=this.items.slice(0,s).append(c).append(o),p=new Oe(d,l);return p.emptyItemCount()>Vm&&(p=p.compress(this.items.length-o.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,s=[],r=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&r++;else if(i.step){let a=i.step.map(t.slice(o)),c=a&&a.getMap();if(o--,c&&t.appendMap(c,o),a){let d=i.selection&&i.selection.map(t.slice(o));d&&r++;let p=new Ve(c.invert(),a,d),u,h=s.length-1;(u=s.length&&s[h].merge(p))?s[h]=u:s.push(p)}}else i.map&&o--},this.items.length,0),new Oe(Z.from(s.reverse()),r)}}Oe.empty=new Oe(Z.empty,0);function Bm(n,e){let t;return n.forEach((o,s)=>{if(o.selection&&e--==0)return t=s,!1}),n.slice(t)}class Ve{constructor(e,t,o,s){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class st{constructor(e,t,o,s,r){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=s,this.prevComposition=r}}const Hm=20;function Fm(n,e,t,o){let s=t.getMeta(Dt),r;if(s)return s.historyState;t.getMeta(Wm)&&(n=new st(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(Dt))return i.getMeta(Dt).redo?new st(n.done.addTransform(t,void 0,o,Do(e)),n.undone,Cl(t.mapping.maps),n.prevTime,n.prevComposition):new st(n.done,n.undone.addTransform(t,void 0,o,Do(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!_m(t,n.prevRanges)),c=i?Bs(n.prevRanges,t.mapping):Cl(t.mapping.maps);return new st(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,Do(e)),Oe.empty,c,t.time,l??n.prevComposition)}else return(r=t.getMeta("rebased"))?new st(n.done.rebased(t,r),n.undone.rebased(t,r),Bs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new st(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Bs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function _m(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,s)=>{for(let r=0;r<e.length;r+=2)o<=e[r+1]&&s>=e[r]&&(t=!0)}),t}function Cl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,s,r,i)=>e.push(r,i));return e}function Bs(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let s=e.map(n[o],1),r=e.map(n[o+1],-1);s<=r&&t.push(s,r)}return t}function Gm(n,e,t){let o=Do(e),s=Dt.get(e).spec.config,r=(t?n.undone:n.done).popEvent(e,o);if(!r)return null;let i=r.selection.resolve(r.transform.doc),l=(t?n.done:n.undone).addTransform(r.transform,e.selection.getBookmark(),s,o),a=new st(t?l:r.remaining,t?r.remaining:l,null,0,-1);return r.transform.setSelection(i).setMeta(Dt,{redo:t,historyState:a})}let Hs=!1,kl=null;function Do(n){let e=n.plugins;if(kl!=e){Hs=!1,kl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Hs=!0;break}}return Hs}const Dt=new so("history"),Wm=new so("closeHistory");function jm(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new wn({key:Dt,state:{init(){return new st(Oe.empty,Oe.empty,null,0,-1)},apply(e,t,o){return Fm(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,s=o=="historyUndo"?ad:o=="historyRedo"?Cr:null;return s?(t.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function ld(n,e){return(t,o)=>{let s=Dt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(o){let r=Gm(s,t,n);r&&o(e?r.scrollIntoView():r)}return!0}}const ad=ld(!1,!0),Cr=ld(!0,!0);var yt={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:"'"},Qo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qm=typeof navigator<"u"&&/Mac/.test(navigator.platform),Um=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Q=0;Q<10;Q++)yt[48+Q]=yt[96+Q]=String(Q);for(var Q=1;Q<=24;Q++)yt[Q+111]="F"+Q;for(var Q=65;Q<=90;Q++)yt[Q]=String.fromCharCode(Q+32),Qo[Q]=String.fromCharCode(Q);for(var Fs in yt)Qo.hasOwnProperty(Fs)||(Qo[Fs]=yt[Fs]);function Km(n){var e=qm&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Um&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Qo:yt)[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 Jm=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Zm(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,s,r,i;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))Jm?i=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),s&&(t="Ctrl-"+t),i&&(t="Meta-"+t),r&&(t="Shift-"+t),t}function Ym(n){let e=Object.create(null);for(let t in n)e[Zm(t)]=n[t];return e}function _s(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 Gs(n){return new wn({props:{handleKeyDown:cd(n)}})}function cd(n){let e=Ym(n);return function(t,o){let s=Km(o),r,i=e[_s(s,o)];if(i&&i(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(o.shiftKey){let l=e[_s(s,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.shiftKey||o.altKey||o.metaKey||s.charCodeAt(0)>127)&&(r=yt[o.keyCode])&&r!=s){let l=e[_s(r,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function El(n,e=null){return function(t,o){let{$from:s,$to:r}=t.selection,i=s.blockRange(r),l=!1,a=i;if(!i)return!1;if(i.depth>=2&&s.node(i.depth-1).type.compatibleContent(n)&&i.startIndex==0){if(s.index(i.depth-1)==0)return!1;let d=t.doc.resolve(i.start-2);a=new Ko(d,d,i.depth),i.endIndex<i.parent.childCount&&(i=new Ko(s,t.doc.resolve(r.end(i.depth)),i.depth)),l=!0}let c=Bc(a,n,e,i);return c?(o&&o(Xm(t.tr,i,c,l,n).scrollIntoView()),!0):!1}}function Xm(n,e,t,o,s){let r=T.empty;for(let d=t.length-1;d>=0;d--)r=T.from(t[d].type.create(t[d].attrs,r));n.step(new te(e.start-(o?2:0),e.end,e.start,e.end,new A(r,0,0),t.length,!0));let i=0;for(let d=0;d<t.length;d++)t[d].type==s&&(i=d+1);let l=t.length-i,a=e.start+t.length-(o?2:0),c=e.parent;for(let d=e.startIndex,p=e.endIndex,u=!0;d<p;d++,u=!1)!u&&dn(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Qm(n,e){return function(t,o){let{$from:s,$to:r,node:i}=t.selection;if(i&&i.isBlock||s.depth<2||!s.sameParent(r))return!1;let l=s.node(-1);if(l.type!=n)return!1;if(s.parent.content.size==0&&s.node(-1).childCount==s.indexAfter(-1)){if(s.depth==3||s.node(-3).type!=n||s.index(-2)!=s.node(-2).childCount-1)return!1;if(o){let p=T.empty,u=s.index(-1)?1:s.index(-2)?2:3;for(let b=s.depth-u;b>=s.depth-3;b--)p=T.from(s.node(b).copy(p));let h=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;p=p.append(T.from(n.createAndFill()));let f=s.before(s.depth-(u-1)),m=t.tr.replace(f,s.after(-h),new A(p,4-u,0)),g=-1;m.doc.nodesBetween(f,m.doc.content.size,(b,w)=>{if(g>-1)return!1;b.isTextblock&&b.content.size==0&&(g=w+1)}),g>-1&&m.setSelection(L.near(m.doc.resolve(g))),o(m.scrollIntoView())}return!0}let a=r.pos==s.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(s.pos,r.pos),d=a?[null,{type:a}]:void 0;return dn(c.doc,s.pos,2,d)?(o&&o(c.split(s.pos,2,d).scrollIntoView()),!0):!1}}function kr(n){return function(e,t){let{$from:o,$to:s}=e.selection,r=o.blockRange(s,i=>i.childCount>0&&i.firstChild.type==n);return r?t?o.node(r.depth-1).type==n?eg(e,t,n,r):tg(e,t,r):!0:!1}}function eg(n,e,t,o){let s=n.tr,r=o.end,i=o.$to.end(o.depth);r<i&&(s.step(new te(r-1,i,r,i,new A(T.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Ko(s.doc.resolve(o.$from.pos),s.doc.resolve(i),o.depth));const l=ms(o);if(l==null)return!1;s.lift(o,l);let a=s.mapping.map(r,-1)-1;return gs(s.doc,a)&&s.join(a),e(s.scrollIntoView()),!0}function tg(n,e,t){let o=n.tr,s=t.parent;for(let h=t.end,f=t.endIndex-1,m=t.startIndex;f>m;f--)h-=s.child(f).nodeSize,o.delete(h-1,h+1);let r=o.doc.resolve(t.start),i=r.nodeAfter;if(o.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==s.childCount,c=r.node(-1),d=r.index(-1);if(!c.canReplace(d+(l?0:1),d+1,i.content.append(a?T.empty:T.from(s))))return!1;let p=r.pos,u=p+i.nodeSize;return o.step(new te(p-(l?1:0),u+(a?1:0),p+1,u-1,new A((l?T.empty:T.from(s.copy(T.empty))).append(a?T.empty:T.from(s.copy(T.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function ng(n){return function(e,t){let{$from:o,$to:s}=e.selection,r=o.blockRange(s,c=>c.childCount>0&&c.firstChild.type==n);if(!r)return!1;let i=r.startIndex;if(i==0)return!1;let l=r.parent,a=l.child(i-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=T.from(c?n.create():null),p=new A(T.from(n.create(null,T.from(l.type.create(null,d)))),c?3:1,0),u=r.start,h=r.end;t(e.tr.step(new te(u-(c?3:1),h,u,h,p,1,!0)).scrollIntoView())}return!0}}const ee=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Xn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Er=null;const Ye=function(n,e,t){let o=Er||(Er=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},og=function(){Er=null},Ht=function(n,e,t,o){return t&&(Tl(n,e,t,o,-1)||Tl(n,e,t,o,1))},sg=/^(img|br|input|textarea|hr)$/i;function Tl(n,e,t,o,s){for(;;){if(n==t&&e==o)return!0;if(e==(s<0?0:Ee(n))){let r=n.parentNode;if(!r||r.nodeType!=1||ro(n)||sg.test(n.nodeName)||n.contentEditable=="false")return!1;e=ee(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.contentEditable=="false")return!1;e=s<0?Ee(n):0}else return!1}}function Ee(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function rg(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=Ee(n)}else if(n.parentNode&&!ro(n))e=ee(n),n=n.parentNode;else return null}}function ig(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&&!ro(n))e=ee(n)+1,n=n.parentNode;else return null}}function lg(n,e,t){for(let o=e==0,s=e==Ee(n);o||s;){if(n==t)return!0;let r=ee(n);if(n=n.parentNode,!n)return!1;o=o&&r==0,s=s&&r==Ee(n)}}function ro(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 bs=function(n){return n.focusNode&&Ht(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Et(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function ag(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function cg(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Ee(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Ee(o.startContainer),o.startOffset)}}}const je=typeof navigator<"u"?navigator:null,Ml=typeof document<"u"?document:null,bt=je&&je.userAgent||"",Tr=/Edge\/(\d+)/.exec(bt),dd=/MSIE \d/.exec(bt),Mr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bt),ye=!!(dd||Mr||Tr),ht=dd?document.documentMode:Mr?+Mr[1]:Tr?+Tr[1]:0,De=!ye&&/gecko\/(\d+)/i.test(bt);De&&+(/Firefox\/(\d+)/.exec(bt)||[0,0])[1];const Ar=!ye&&/Chrome\/(\d+)/.exec(bt),se=!!Ar,pd=Ar?+Ar[1]:0,de=!ye&&!!je&&/Apple Computer/.test(je.vendor),bn=de&&(/Mobile\/\w+/.test(bt)||!!je&&je.maxTouchPoints>2),ke=bn||(je?/Mac/.test(je.platform):!1),dg=je?/Win/.test(je.platform):!1,Pe=/Android \d/.test(bt),io=!!Ml&&"webkitFontSmoothing"in Ml.documentElement.style,pg=io?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ug(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 Je(n,e){return typeof n=="number"?n:n[e]}function hg(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function Al(n,e,t){let o=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,r=n.dom.ownerDocument;for(let i=t||n.dom;i;i=Xn(i)){if(i.nodeType!=1)continue;let l=i,a=l==r.body,c=a?ug(r):hg(l),d=0,p=0;if(e.top<c.top+Je(o,"top")?p=-(c.top-e.top+Je(s,"top")):e.bottom>c.bottom-Je(o,"bottom")&&(p=e.bottom-e.top>c.bottom-c.top?e.top+Je(s,"top")-c.top:e.bottom-c.bottom+Je(s,"bottom")),e.left<c.left+Je(o,"left")?d=-(c.left-e.left+Je(s,"left")):e.right>c.right-Je(o,"right")&&(d=e.right-c.right+Je(s,"right")),d||p)if(a)r.defaultView.scrollBy(d,p);else{let u=l.scrollLeft,h=l.scrollTop;p&&(l.scrollTop+=p),d&&(l.scrollLeft+=d);let f=l.scrollLeft-u,m=l.scrollTop-h;e={left:e.left-f,top:e.top-m,right:e.right-f,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(i).position))break}}function fg(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,s;for(let r=(e.left+e.right)/2,i=t+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=n.root.elementFromPoint(r,i);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){o=l,s=a.top;break}}return{refDOM:o,refTop:s,stack:ud(n.dom)}}function ud(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Xn(o));return e}function mg({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;hd(t,o==0?0:o-e)}function hd(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:s,left:r}=n[t];o.scrollTop!=s+e&&(o.scrollTop=s+e),o.scrollLeft!=r&&(o.scrollLeft=r)}}let Jt=null;function gg(n){if(n.setActive)return n.setActive();if(Jt)return n.focus(Jt);let e=ud(n);n.focus(Jt==null?{get preventScroll(){return Jt={preventScroll:!0},!0}}:void 0),Jt||(Jt=!1,hd(e,0))}function fd(n,e){let t,o=2e8,s,r=0,i=e.top,l=e.top,a,c;for(let d=n.firstChild,p=0;d;d=d.nextSibling,p++){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=Ye(d).getClientRects();else continue;for(let h=0;h<u.length;h++){let f=u[h];if(f.top<=i&&f.bottom>=l){i=Math.max(f.bottom,i),l=Math.min(f.top,l);let m=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(m<o){t=d,o=m,s=m&&t.nodeType==3?{left:f.right<e.left?f.right:f.left,top:e.top}:e,d.nodeType==1&&m&&(r=p+(e.left>=(f.left+f.right)/2?1:0));continue}}else f.top>e.top&&!a&&f.left<=e.left&&f.right>=e.left&&(a=d,c={left:Math.max(f.left,Math.min(f.right,e.left)),top:f.top});!t&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(r=p+1)}}return!t&&a&&(t=a,s=c,o=0),t&&t.nodeType==3?yg(t,s):!t||o&&t.nodeType==1?{node:n,offset:r}:fd(t,s)}function yg(n,e){let t=n.nodeValue.length,o=document.createRange();for(let s=0;s<t;s++){o.setEnd(n,s+1),o.setStart(n,s);let r=ot(o,1);if(r.top!=r.bottom&&ci(e,r))return{node:n,offset:s+(e.left>=(r.left+r.right)/2?1:0)}}return{node:n,offset:0}}function ci(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function bg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function vg(n,e,t){let{node:o,offset:s}=fd(e,t),r=-1;if(o.nodeType==1&&!o.firstChild){let i=o.getBoundingClientRect();r=i.left!=i.right&&t.left>(i.left+i.right)/2?1:-1}return n.docView.posFromDOM(o,s,r)}function Sg(n,e,t,o){let s=-1;for(let r=e,i=!1;r!=n.dom;){let l=n.docView.nearestDesc(r,!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&&(!i&&a.left>o.left||a.top>o.top?s=l.posBefore:(!i&&a.right<o.left||a.bottom<o.top)&&(s=l.posAfter),i=!0),!l.contentDOM&&s<0&&!l.node.isText)return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}r=l.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function md(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let s=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),r=s;;){let i=n.childNodes[r];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(ci(e,c))return md(i,e,c)}}if((r=(r+1)%o)==s)break}return n}function xg(n,e){let t=n.dom.ownerDocument,o,s=0,r=cg(t,e.left,e.top);r&&({node:o,offset:s}=r);let i=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!i||!n.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=n.dom.getBoundingClientRect();if(!ci(e,c)||(i=md(n.dom,e,c),!i))return null}if(de)for(let c=i;o&&c;c=Xn(c))c.draggable&&(o=void 0);if(i=bg(i,e),o){if(De&&o.nodeType==1&&(s=Math.min(s,o.childNodes.length),s<o.childNodes.length)){let d=o.childNodes[s],p;d.nodeName=="IMG"&&(p=d.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&s++}let c;io&&s&&o.nodeType==1&&(c=o.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,o==n.dom&&s==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(s==0||o.nodeType!=1||o.childNodes[s-1].nodeName!="BR")&&(l=Sg(n,o,s,e))}l==null&&(l=vg(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Pl(n){return n.top<n.bottom||n.left<n.right}function ot(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Pl(o))return o}return Array.prototype.find.call(t,Pl)||n.getBoundingClientRect()}const wg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gd(n,e,t){let{node:o,offset:s,atom:r}=n.docView.domFromPos(e,t<0?-1:1),i=io||De;if(o.nodeType==3)if(i&&(wg.test(o.nodeValue)||(t<0?!s:s==o.nodeValue.length))){let a=ot(Ye(o,s,s),t);if(De&&s&&/\s/.test(o.nodeValue[s-1])&&s<o.nodeValue.length){let c=ot(Ye(o,s-1,s-1),-1);if(c.top==a.top){let d=ot(Ye(o,s,s+1),-1);if(d.top!=a.top)return Tn(d,d.left<c.left)}}return a}else{let a=s,c=s,d=t<0?1:-1;return t<0&&!s?(c++,d=-1):t>=0&&s==o.nodeValue.length?(a--,d=1):t<0?a--:c++,Tn(ot(Ye(o,a,c),d),d<0)}if(!n.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&s&&(t<0||s==Ee(o))){let a=o.childNodes[s-1];if(a.nodeType==1)return Ws(a.getBoundingClientRect(),!1)}if(r==null&&s<Ee(o)){let a=o.childNodes[s];if(a.nodeType==1)return Ws(a.getBoundingClientRect(),!0)}return Ws(o.getBoundingClientRect(),t>=0)}if(r==null&&s&&(t<0||s==Ee(o))){let a=o.childNodes[s-1],c=a.nodeType==3?Ye(a,Ee(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Tn(ot(c,1),!1)}if(r==null&&s<Ee(o)){let a=o.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Ye(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return Tn(ot(c,-1),!0)}return Tn(ot(o.nodeType==3?Ye(o):o,-t),t>=0)}function Tn(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 Ws(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 yd(n,e,t){let o=n.state,s=n.root.activeElement;o!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),s!=n.dom&&s&&s.focus()}}function Cg(n,e,t){let o=e.selection,s=t=="up"?o.$from:o.$to;return yd(n,e,()=>{let{node:r}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(r,!0);if(!l)break;if(l.node.isBlock){r=l.contentDOM||l.dom;break}r=l.dom.parentNode}let i=gd(n,s.pos,1);for(let l=r.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ye(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"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const kg=/[\u0590-\u08ac]/;function Eg(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let s=o.parentOffset,r=!s,i=s==o.parent.content.size,l=n.domSelection();return l?!kg.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?r:i:yd(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:p}=n.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:f,focusOffset:m}=n.domSelectionRange(),g=f&&!h.contains(f.nodeType==1?f:f.parentNode)||a==f&&c==m;try{l.collapse(d,p),a&&(a!=d||c!=p)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),g}):o.pos==o.start()||o.pos==o.end()}let Nl=null,Ol=null,Il=!1;function Tg(n,e,t){return Nl==e&&Ol==t?Il:(Nl=e,Ol=t,Il=t=="up"||t=="down"?Cg(n,e,t):Eg(n,e,t))}const Te=0,Rl=1,At=2,qe=3;class lo{constructor(e,t,o,s){this.parent=e,this.children=t,this.dom=o,this.contentDOM=s,this.dirty=Te,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){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,o=this.posAtStart;;t++){let s=this.children[t];if(s==e)return o;o+=s.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,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((i=r.pmViewDesc)&&i.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}else{let r,i;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((i=r.pmViewDesc)&&i.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(i):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>ee(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){s=!1;break}if(r.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){s=!0;break}if(r.nextSibling)break}}return s??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,s=e;s;s=s.parentNode){let r=this.getDesc(s),i;if(r&&(!t||r.node))if(o&&(i=r.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))o=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let s=e;s;s=s.parentNode){let r=this.getDesc(s);if(r)return r.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let s=this.children[t],r=o+s.size;if(o==e&&r!=o){for(;!s.border&&s.children.length;)s=s.children[0];return s}if(e<r)return s.descAt(e-o-s.border);o=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,s=0;for(let r=0;o<this.children.length;o++){let i=this.children[o],l=r+i.size;if(l>e||i instanceof vd){s=e-r;break}r=l}if(s)return this.children[o].domFromPos(s-this.children[o].border,t);for(let r;o&&!(r=this.children[o-1]).size&&r instanceof bd&&r.side>=0;o--);if(t<=0){let r,i=!0;for(;r=o?this.children[o-1]:null,!(!r||r.dom.parentNode==this.contentDOM);o--,i=!1);return r&&t&&i&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?ee(r.dom)+1:0}}else{let r,i=!0;for(;r=o<this.children.length?this.children[o]:null,!(!r||r.dom.parentNode==this.contentDOM);o++,i=!1);return r&&i&&!r.border&&!r.domAtom?r.domFromPos(0,t):{node:this.contentDOM,offset:r?ee(r.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,r=-1;for(let i=o,l=0;;l++){let a=this.children[l],c=i+a.size;if(s==-1&&e<=c){let d=i+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=i;for(let p=l;p>0;p--){let u=this.children[p-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){s=ee(u.dom)+1;break}e-=u.size}s==-1&&(s=0)}if(s>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let p=this.children[d];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){r=ee(p.dom);break}t+=p.size}r==-1&&(r=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:r}}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:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,s=!1){let r=Math.min(e,t),i=Math.max(e,t);for(let h=0,f=0;h<this.children.length;h++){let m=this.children[h],g=f+m.size;if(r>f&&i<g)return m.setSelection(e-f-m.border,t-f-m.border,o,s);f=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=o.root.getSelection(),d=o.domSelectionRange(),p=!1;if((De||de)&&e==t){let{node:h,offset:f}=l;if(h.nodeType==3){if(p=!!(f&&h.nodeValue[f-1]==`
|
|
913
|
-
`),p&&f==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:ee(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[f-1];p=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(De&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||p&&de)&&Ht(l.node,l.offset,d.anchorNode,d.anchorOffset)&&Ht(a.node,a.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==t)&&!p){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let f=l;l=a,a=f}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}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 o=0,s=0;s<this.children.length;s++){let r=this.children[s],i=o+r.size;if(o==i?e<=i&&t>=o:e<i&&t>o){let l=o+r.border,a=i-r.border;if(e>=l&&t<=a){this.dirty=e==o||t==i?At:Rl,e==l&&t==a&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=qe:r.markDirty(e-l,t-l);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?At:qe}o=i}this.dirty=At}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?At:Rl;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class bd extends lo{constructor(e,t,o,s){let r,i=t.type.toDOM;if(typeof i=="function"&&(i=i(o,()=>{if(!r)return s;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==Te&&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 Mg extends lo{constructor(e,t,o,s){super(e,[],t,null),this.textDOM=o,this.text=s}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 Ft extends lo{constructor(e,t,o,s,r){super(e,[],o,s),this.mark=t,this.spec=r}static create(e,t,o,s){let r=s.nodeViews[t.type.name],i=r&&r(t,s,o);return(!i||!i.dom)&&(i=Wt.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new Ft(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&qe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Te){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Te}}slice(e,t,o){let s=Ft.create(this.parent,this.mark,!0,o),r=this.children,i=this.size;t<i&&(r=Nr(r,t,i,o)),e>0&&(r=Nr(r,0,e,o));for(let l=0;l<r.length;l++)r[l].parent=s;return s.children=r,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ft extends lo{constructor(e,t,o,s,r,i,l,a,c){super(e,[],r,i),this.node=t,this.outerDeco=o,this.innerDeco=s,this.nodeDOM=l}static create(e,t,o,s,r,i){let l=r.nodeViews[t.type.name],a,c=l&&l(t,r,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},o,s),d=c&&c.dom,p=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:p}=Wt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let u=d;return d=wd(d,o,t),c?a=new Ag(e,t,o,s,d,p||null,u,c,r,i+1):t.isText?new vs(e,t,o,s,d,u,r):new ft(e,t,o,s,d,p||null,u,r,i+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 o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,o){return this.dirty==Te&&e.eq(this.node)&&es(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,s=t,r=e.composing?this.localCompositionInfo(e,t):null,i=r&&r.pos>-1?r:null,l=r&&r.pos<0,a=new Ng(this,i&&i.node,e);Rg(this.node,this.innerDeco,(c,d,p)=>{c.spec.marks?a.syncToMarks(c.spec.marks,o,e):c.type.side>=0&&!p&&a.syncToMarks(d==this.node.childCount?B.none:this.node.child(d).marks,o,e),a.placeWidget(c,e,s)},(c,d,p,u)=>{a.syncToMarks(c.marks,o,e);let h;a.findNodeMatch(c,d,p,u)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=a.findIndexWithChild(r.node))>-1&&a.updateNodeAt(c,d,p,h,e)||a.updateNextNode(c,d,p,e,u,s)||a.addNode(c,d,p,e,s),s+=c.nodeSize}),a.syncToMarks([],o,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==At)&&(i&&this.protectLocalComposition(e,i),Sd(this.contentDOM,this.children,e),bn&&Dg(this.dom))}localCompositionInfo(e,t){let{from:o,to:s}=e.state.selection;if(!(e.state.selection instanceof $)||o<t||s>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let i=r.nodeValue,l=Lg(this.node.content,i,o-t,s-t);return l<0?null:{node:r,pos:l,text:i}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:s}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let i=new Mg(this,r,t,s);e.input.compositionNodes.push(i),this.children=Nr(this.children,o,o+s.length,e,i)}update(e,t,o,s){return this.dirty==qe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,s),!0)}updateInner(e,t,o,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Te}updateOuterDeco(e){if(es(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=xd(this.dom,this.nodeDOM,Pr(this.outerDeco,this.node,t),Pr(e,this.node,t)),this.dom!=o&&(o.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 Dl(n,e,t,o,s){wd(o,e,n);let r=new ft(void 0,n,e,t,o,o,o,s,0);return r.contentDOM&&r.updateChildren(s,0),r}class vs extends ft{constructor(e,t,o,s,r,i,l){super(e,t,o,s,r,null,i,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,o,s){return this.dirty==qe||this.dirty!=Te&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Te||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Te,!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,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let s=this.node.cut(e,t),r=document.createTextNode(s.text);return new vs(this.parent,s,this.outerDeco,this.innerDeco,r,r,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=qe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class vd extends lo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Te&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Ag extends ft{constructor(e,t,o,s,r,i,l,a,c,d){super(e,t,o,s,r,i,l,c,d),this.spec=a}update(e,t,o,s){if(this.dirty==qe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,o);return r&&this.updateInner(e,t,o,s),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,s){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,s)}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 Sd(n,e,t){let o=n.firstChild,s=!1;for(let r=0;r<e.length;r++){let i=e[r],l=i.dom;if(l.parentNode==n){for(;l!=o;)o=Ll(o),s=!0;o=o.nextSibling}else s=!0,n.insertBefore(l,o);if(i instanceof Ft){let a=o?o.previousSibling:n.lastChild;Sd(i.contentDOM,i.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=Ll(o),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Bn=function(n){n&&(this.nodeName=n)};Bn.prototype=Object.create(null);const Pt=[new Bn];function Pr(n,e,t){if(n.length==0)return Pt;let o=t?Pt[0]:new Bn,s=[o];for(let r=0;r<n.length;r++){let i=n[r].type.attrs;if(i){i.nodeName&&s.push(o=new Bn(i.nodeName));for(let l in i){let a=i[l];a!=null&&(t&&s.length==1&&s.push(o=new Bn(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return s}function xd(n,e,t,o){if(t==Pt&&o==Pt)return e;let s=e;for(let r=0;r<o.length;r++){let i=o[r],l=t[r];if(r){let a;l&&l.nodeName==i.nodeName&&s!=n&&(a=s.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=Pt[0]),s=a}Pg(s,l||Pt[0],i)}return s}function Pg(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let r=0;r<o.length;r++)s.indexOf(o[r])==-1&&n.classList.remove(o[r]);for(let r=0;r<s.length;r++)o.indexOf(s[r])==-1&&n.classList.add(s[r]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=o.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function wd(n,e,t){return xd(n,n,Pt,Pr(e,t,n.nodeType!=1))}function es(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 Ll(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Ng{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Og(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o){let s=0,r=this.stack.length>>1,i=Math.min(r,e.length);for(;s<i&&(s==r-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<r;)this.destroyRest(),this.top.dirty=Te,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<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[r])&&!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=Ft.create(this.top,e[r],t,o);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,r++}}findNodeMatch(e,t,o,s){let r=-1,i;if(s>=this.preMatch.index&&(i=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,o))r=this.top.children.indexOf(i,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,o)&&!this.preMatch.matched.has(c)){r=l;break}}return r<0?!1:(this.destroyBetween(this.index,r),this.index++,!0)}updateNodeAt(e,t,o,s,r){let i=this.top.children[s];return i.dirty==qe&&i.dom==i.contentDOM&&(i.dirty=At),i.update(e,t,o,r)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==o)return s}return-1}e=t}}updateNextNode(e,t,o,s,r,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof ft){let c=this.preMatch.matched.get(a);if(c!=null&&c!=r)return!1;let d=a.dom,p,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=qe&&es(t,a.outerDeco));if(!u&&a.update(e,t,o,s))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(p=this.recreateWrapper(a,e,t,o,s,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=At,p.updateChildren(s,i+1),p.dirty=Te),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,s,r,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!es(o,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=ft.create(this.top,t,o,s,r,i);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,o,s,r){let i=ft.create(this.top,e,t,o,s,r);i.contentDOM&&i.updateChildren(s,r+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,o){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let r=new bd(this.top,e,t,o);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ft;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof vs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((de||se)&&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 o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let s=new vd(this.top,[],o,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Og(n,e){let t=e,o=t.children.length,s=n.childCount,r=new Map,i=[];e:for(;s>0;){let l;for(;;)if(o){let c=t.children[o-1];if(c instanceof Ft)t=c,o=c.children.length;else{l=c,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(s-1))break;--s,r.set(l,s),i.push(l)}}return{index:s,matched:r,matches:i.reverse()}}function Ig(n,e){return n.type.side-e.type.side}function Rg(n,e,t,o){let s=e.locals(n),r=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);o(d,s,e.forChild(r,d),c),r+=d.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let d,p;for(;i<s.length&&s[i].to==r;){let g=s[i++];g.widget&&(d?(p||(p=[d])).push(g):d=g)}if(d)if(p){p.sort(Ig);for(let g=0;g<p.length;g++)t(p[g],c,!!a)}else t(d,c,!!a);let u,h;if(a)h=-1,u=a,a=null;else if(c<n.childCount)h=c,u=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=r&&l.splice(g--,1);for(;i<s.length&&s[i].from<=r&&s[i].to>r;)l.push(s[i++]);let f=r+u.nodeSize;if(u.isText){let g=f;i<s.length&&s[i].from<g&&(g=s[i].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<f&&(a=u.cut(g-r),u=u.cut(0,g-r),f=g,h=-1)}else for(;i<s.length&&s[i].to<f;)i++;let m=u.isInline&&!u.isLeaf?l.filter(g=>!g.inline):l.slice();o(u,m,e.forChild(r,u),h),r=f}}function Dg(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 Lg(n,e,t,o){for(let s=0,r=0;s<n.childCount&&r<=o;){let i=n.child(s++),l=r;if(r+=i.nodeSize,!i.isText)continue;let a=i.text;for(;s<n.childCount;){let c=n.child(s++);if(r+=c.nodeSize,!c.isText)break;a+=c.text}if(r>=t){if(r>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let c=l<o?a.lastIndexOf(e,o-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Nr(n,e,t,o,s){let r=[];for(let i=0,l=0;i<n.length;i++){let a=n[i],c=l,d=l+=a.size;c>=t||d<=e?r.push(a):(c<e&&r.push(a.slice(0,e-c,o)),s&&(r.push(s),s=void 0),d>t&&r.push(a.slice(t-c,a.size,o)))}return r}function di(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),r=s&&s.size==0,i=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(i<0)return null;let l=o.resolve(i),a,c;if(bs(t)){for(a=i;s&&!s.node;)s=s.parent;let p=s.node;if(s&&p.isAtom&&D.isSelectable(p)&&s.parent&&!(p.isInline&&lg(t.focusNode,t.focusOffset,s.dom))){let u=s.posBefore;c=new D(i==u?l:o.resolve(u))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=i,u=i;for(let h=0;h<t.rangeCount;h++){let f=t.getRangeAt(h);p=Math.min(p,n.docView.posFromDOM(f.startContainer,f.startOffset,1)),u=Math.max(u,n.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(p<0)return null;[a,i]=u==n.state.selection.anchor?[u,p]:[p,u],l=o.resolve(i)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!c){let p=e=="pointer"||n.state.selection.head<l.pos&&!r?1:-1;c=pi(n,d,l,p)}return c}function Cd(n){return n.editable?n.hasFocus():Ed(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function et(n,e=!1){let t=n.state.selection;if(kd(n,t),!!Cd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&se){let o=n.domSelectionRange(),s=n.domObserver.currentSelection;if(o.anchorNode&&s.anchorNode&&Ht(o.anchorNode,o.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)zg(n);else{let{anchor:o,head:s}=t,r,i;$l&&!(t instanceof $)&&(t.$from.parent.inlineContent||(r=zl(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(i=zl(n,t.to))),n.docView.setSelection(o,s,n,e),$l&&(r&&Vl(r),i&&Vl(i)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$g(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $l=de||se&&pd<63;function zl(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),s=o<t.childNodes.length?t.childNodes[o]:null,r=o?t.childNodes[o-1]:null;if(de&&s&&s.contentEditable=="false")return js(s);if((!s||s.contentEditable=="false")&&(!r||r.contentEditable=="false")){if(s)return js(s);if(r)return js(r)}}function js(n){return n.contentEditable="true",de&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Vl(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function $g(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Cd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function zg(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let o=n.cursorWrapper.dom,s=o.nodeName=="IMG";s?t.setStart(o.parentNode,ee(o)+1):t.setStart(o,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!s&&!n.state.selection.visible&&ye&&ht<=11&&(o.disabled=!0,o.disabled=!1)}function kd(n,e){if(e instanceof D){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Bl(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Bl(n)}function Bl(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function pi(n,e,t,o){return n.someProp("createSelectionBetween",s=>s(n,e,t))||$.between(e,t,o)}function Hl(n){return n.editable&&!n.hasFocus()?!1:Ed(n)}function Ed(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 Vg(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Ht(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Or(n,e){let{$anchor:t,$head:o}=n.selection,s=e>0?t.max(o):t.min(o),r=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return r&&L.findFrom(r,e)}function rt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Fl(n,e,t){let o=n.state.selection;if(o instanceof $)if(t.indexOf("s")>-1){let{$head:s}=o,r=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let i=n.state.doc.resolve(s.pos+r.nodeSize*(e<0?-1:1));return rt(n,new $(o.$anchor,i))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Or(n.state,e);return s&&s instanceof D?rt(n,s):!1}else if(!(ke&&t.indexOf("m")>-1)){let s=o.$head,r=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!r||r.isText)return!1;let l=e<0?s.pos-r.nodeSize:s.pos;return r.isAtom||(i=n.docView.descAt(l))&&!i.contentDOM?D.isSelectable(r)?rt(n,new D(e<0?n.state.doc.resolve(s.pos-r.nodeSize):s)):io?rt(n,new $(n.state.doc.resolve(e<0?l:l+r.nodeSize))):!1:!1}}else return!1;else{if(o instanceof D&&o.node.isInline)return rt(n,new $(e>0?o.$to:o.$from));{let s=Or(n.state,e);return s?rt(n,s):!1}}}function ts(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Hn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Zt(n,e){return e<0?Bg(n):Hg(n)}function Bg(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let s,r,i=!1;for(De&&t.nodeType==1&&o<ts(t)&&Hn(t.childNodes[o],-1)&&(i=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Hn(l,-1))s=t,r=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(Td(t))break;{let l=t.previousSibling;for(;l&&Hn(l,-1);)s=t.parentNode,r=ee(l),l=l.previousSibling;if(l)t=l,o=ts(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}i?Ir(n,t,o):s&&Ir(n,s,r)}function Hg(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let s=ts(t),r,i;for(;;)if(o<s){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Hn(l,1))r=t,i=++o;else break}else{if(Td(t))break;{let l=t.nextSibling;for(;l&&Hn(l,1);)r=l.parentNode,i=ee(l)+1,l=l.nextSibling;if(l)t=l,o=0,s=ts(t);else{if(t=t.parentNode,t==n.dom)break;o=s=0}}}r&&Ir(n,r,i)}function Td(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Fg(n,e){for(;n&&e==n.childNodes.length&&!ro(n);)e=ee(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 _g(n,e){for(;n&&!e&&!ro(n);)e=ee(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 Ir(n,e,t){if(e.nodeType!=3){let r,i;(i=Fg(e,t))?(e=i,t=0):(r=_g(e,t))&&(e=r,t=r.nodeValue.length)}let o=n.domSelection();if(!o)return;if(bs(o)){let r=document.createRange();r.setEnd(e,t),r.setStart(e,t),o.removeAllRanges(),o.addRange(r)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&et(n)},50)}function _l(n,e){let t=n.state.doc.resolve(e);if(!(se||dg)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),i=(r.top+r.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(r.left-s.left)>1)return r.left<s.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),i=(r.top+r.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(r.left-s.left)>1)return r.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Gl(n,e,t){let o=n.state.selection;if(o instanceof $&&!o.empty||t.indexOf("s")>-1||ke&&t.indexOf("m")>-1)return!1;let{$from:s,$to:r}=o;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let i=Or(n.state,e);if(i&&i instanceof D)return rt(n,i)}if(!s.parent.inlineContent){let i=e<0?s:r,l=o instanceof we?L.near(i,e):L.findFrom(i,e);return l?rt(n,l):!1}return!1}function Wl(n,e){if(!(n.state.selection instanceof $))return!0;let{$head:t,$anchor:o,empty:s}=n.state.selection;if(!t.sameParent(o))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let i=n.state.tr;return e<0?i.delete(t.pos-r.nodeSize,t.pos):i.delete(t.pos,t.pos+r.nodeSize),n.dispatch(i),!0}return!1}function jl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Gg(n){if(!de||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 o=e.firstChild;jl(n,o,"true"),setTimeout(()=>jl(n,o,"false"),20)}return!1}function Wg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function jg(n,e){let t=e.keyCode,o=Wg(e);if(t==8||ke&&t==72&&o=="c")return Wl(n,-1)||Zt(n,-1);if(t==46&&!e.shiftKey||ke&&t==68&&o=="c")return Wl(n,1)||Zt(n,1);if(t==13||t==27)return!0;if(t==37||ke&&t==66&&o=="c"){let s=t==37?_l(n,n.state.selection.from)=="ltr"?-1:1:-1;return Fl(n,s,o)||Zt(n,s)}else if(t==39||ke&&t==70&&o=="c"){let s=t==39?_l(n,n.state.selection.from)=="ltr"?1:-1:1;return Fl(n,s,o)||Zt(n,s)}else{if(t==38||ke&&t==80&&o=="c")return Gl(n,-1,o)||Zt(n,-1);if(t==40||ke&&t==78&&o=="c")return Gg(n)||Gl(n,1,o)||Zt(n,1);if(o==(ke?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Md(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:s,openEnd:r}=e;for(;s>1&&r>1&&o.childCount==1&&o.firstChild.childCount==1;){s--,r--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let i=n.someProp("clipboardSerializer")||Wt.fromSchema(n.state.schema),l=Rd(),a=l.createElement("div");a.appendChild(i.serializeFragment(o,{document:l}));let c=a.firstChild,d,p=0;for(;c&&c.nodeType==1&&(d=Id[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let f=l.createElement(d[h]);for(;a.firstChild;)f.appendChild(a.firstChild);a.appendChild(f),p++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${r}${p?` -${p}`:""} ${JSON.stringify(t)}`);let u=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
914
|
-
|
|
915
|
-
`);return{dom:a,text:u,slice:e}}function
|
|
916
|
-
`))),0,0):A.empty;let p=n.someProp("clipboardTextParser",u=>u(e,s,o,n));if(p)l=p;else{let u=s.marks(),{schema:h}=n.state,f=Wt.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=i.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(h.text(m,u)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),i=Jg(t),io&&Zg(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let p=+d[3];p>0;p--){let u=i.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;i=u}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Bt.fromSchema(n.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||d),context:s,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!qg.test(u.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Yg(ql(l,+d[1],+d[2]),d[4]);else if(l=A.maxOpen(Ug(l.content,s),!0),l.openStart||l.openEnd){let p=0,u=0;for(let h=l.content.firstChild;p<l.openStart&&!h.type.spec.isolating;p++,h=h.firstChild);for(let h=l.content.lastChild;u<l.openEnd&&!h.type.spec.isolating;u++,h=h.lastChild);l=ql(l,p,u)}return n.someProp("transformPasted",p=>{l=p(l,n)}),l}const qg=/^(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 Ug(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),r,i=[];if(n.forEach(l=>{if(!i)return;let a=s.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&r.length&&Nd(a,r,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Od(i[i.length-1],r.length));let d=Pd(l,a);i.push(d),s=s.matchType(d.type),r=a}}),i)return T.from(i)}return n}function Pd(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,T.from(n));return n}function Nd(n,e,t,o,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let r=Nd(n,e,t,o.lastChild,s+1);if(r)return o.copy(o.content.replaceChild(o.childCount-1,r));if(o.contentMatchAt(o.childCount).matchType(s==n.length-1?t.type:n[s+1]))return o.copy(o.content.append(T.from(Pd(t,n,s+1))))}}function Od(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Od(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(o))}function Rr(n,e,t,o,s,r){let i=e<0?n.firstChild:n.lastChild,l=i.content;return n.childCount>1&&(r=0),s<o-1&&(l=Rr(l,e,t,o,s+1,r)),s>=t&&(l=e<0?i.contentMatchAt(0).fillBefore(l,r<=s).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(T.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,i.copy(l))}function ql(n,e,t){return e<n.openStart&&(n=new A(Rr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new A(Rr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Id={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 Ul=null;function Rd(){return Ul||(Ul=document.implementation.createHTMLDocument("title"))}let qs=null;function Kg(n){let e=window.trustedTypes;return e?(qs||(qs=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),qs.createHTML(n)):n}function Jg(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Rd().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),s;if((s=o&&Id[o[1].toLowerCase()])&&(n=s.map(r=>"<"+r+">").join("")+n+s.map(r=>"</"+r+">").reverse().join("")),t.innerHTML=Kg(n),s)for(let r=0;r<s.length;r++)t=t.querySelector(s[r])||t;return t}function Zg(n){let e=n.querySelectorAll(se?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function Yg(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:s,openStart:r,openEnd:i}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;s=T.from(a.create(o[l+1],s)),r++,i++}return new A(s,r,i)}const pe={},ue={},Xg={touchstart:!0,touchmove:!0};class Qg{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 e1(n){for(let e in pe){let t=pe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{n1(n,o)&&!ui(n,o)&&(n.editable||!(o.type in ue))&&t(n,o)},Xg[e]?{passive:!0}:void 0)}de&&n.dom.addEventListener("input",()=>null),Dr(n)}function pt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function t1(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 Dr(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>ui(n,o))})}function ui(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function n1(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 o1(n,e){!ui(n,e)&&pe[e.type]&&(n.editable||!(e.type in ue))&&pe[e.type](n,e)}ue.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ld(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Pe&&se&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),bn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",s=>s(n,Et(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||jg(n,t)?t.preventDefault():pt(n,"key")};ue.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ue.keypress=(n,e)=>{let t=e;if(Ld(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ke&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof $)||!o.$from.sameParent(o.$to)){let s=String.fromCharCode(t.charCode);!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",r=>r(n,o.$from.pos,o.$to.pos,s))&&n.dispatch(n.state.tr.insertText(s).scrollIntoView()),t.preventDefault()}};function Ss(n){return{left:n.clientX,top:n.clientY}}function s1(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function hi(n,e,t,o,s){if(o==-1)return!1;let r=n.state.doc.resolve(o);for(let i=r.depth+1;i>0;i--)if(n.someProp(e,l=>i>r.depth?l(n,t,r.nodeAfter,r.before(i),s,!0):l(n,t,r.node(i),r.before(i),s,!1)))return!0;return!1}function un(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function r1(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&D.isSelectable(o)?(un(n,new D(t)),!0):!1}function i1(n,e){if(e==-1)return!1;let t=n.state.selection,o,s;t instanceof D&&(o=t.node);let r=n.state.doc.resolve(e);for(let i=r.depth+1;i>0;i--){let l=i>r.depth?r.nodeAfter:r.node(i);if(D.isSelectable(l)){o&&t.$from.depth>0&&i>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?s=r.before(t.$from.depth):s=r.before(i);break}}return s!=null?(un(n,D.create(n.state.doc,s)),!0):!1}function l1(n,e,t,o,s){return hi(n,"handleClickOn",e,t,o)||n.someProp("handleClick",r=>r(n,e,o))||(s?i1(n,t):r1(n,t))}function a1(n,e,t,o){return hi(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",s=>s(n,e,o))}function c1(n,e,t,o){return hi(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",s=>s(n,e,o))||d1(n,t,o)}function d1(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(un(n,$.create(o,0,o.content.size)),!0):!1;let s=o.resolve(e);for(let r=s.depth+1;r>0;r--){let i=r>s.depth?s.nodeAfter:s.node(r),l=s.before(r);if(i.inlineContent)un(n,$.create(o,l+1,l+1+i.content.size));else if(D.isSelectable(i))un(n,D.create(o,l));else continue;return!0}}function fi(n){return ns(n)}const Dd=ke?"metaKey":"ctrlKey";pe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=fi(n),s=Date.now(),r="singleClick";s-n.input.lastClick.time<500&&s1(t,n.input.lastClick)&&!t[Dd]&&(n.input.lastClick.type=="singleClick"?r="doubleClick":n.input.lastClick.type=="doubleClick"&&(r="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:r};let i=n.posAtCoords(Ss(t));i&&(r=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new p1(n,i,t,!!o)):(r=="doubleClick"?a1:c1)(n,i.pos,i.inside,t)?t.preventDefault():pt(n,"pointer"))};class p1{constructor(e,t,o,s){this.view=e,this.pos=t,this.event=o,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Dd],this.allowDefault=o.shiftKey;let r,i;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),i=t.inside;else{let d=e.state.doc.resolve(t.pos);r=d.parent,i=d.depth?d.before():0}const l=s?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(o.button==0&&r.type.spec.draggable&&r.type.spec.selectable!==!1||c instanceof D&&c.from<=i&&c.to>i)&&(this.mightDrag={node:r,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&De&&!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)),pt(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(()=>et(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(Ss(e))),this.updateAllowDefault(e),this.allowDefault||!t?pt(this.view,"pointer"):l1(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||de&&this.mightDrag&&!this.mightDrag.node.isAtom||se&&!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)?(un(this.view,L.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):pt(this.view,"pointer")}move(e){this.updateAllowDefault(e),pt(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)}}pe.touchstart=n=>{n.input.lastTouch=Date.now(),fi(n),pt(n,"pointer")};pe.touchmove=n=>{n.input.lastTouch=Date.now(),pt(n,"pointer")};pe.contextmenu=n=>fi(n);function Ld(n,e){return n.composing?!0:de&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const u1=Pe?5e3:-1;ue.compositionstart=ue.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof $&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ns(n,!0),n.markCursor=null;else if(ns(n,!e.selection.empty),De&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let s=o.focusNode,r=o.focusOffset;s&&s.nodeType==1&&r!=0;){let i=r<0?s.lastChild:s.childNodes[r-1];if(!i)break;if(i.nodeType==3){let l=n.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else s=i,r=-1}}n.input.composing=!0}$d(n,u1)};ue.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++,$d(n,20))};function $d(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ns(n),e))}function zd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=f1());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function h1(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=rg(e.focusNode,e.focusOffset),o=ig(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let s=o.pmViewDesc,r=n.domObserver.lastChangedTextNode;if(t==r||o==r)return r;if(!s||!s.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let i=t.pmViewDesc;if(!(!i||!i.isText(t.nodeValue)))return o}}return t||o}function f1(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ns(n,e=!1){if(!(Pe&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),zd(n),e||n.docView&&n.docView.dirty){let t=di(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 m1(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 o=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Qn=ye&&ht<15||bn&&pg<604;pe.copy=ue.cut=(n,e)=>{let t=e,o=n.state.selection,s=t.type=="cut";if(o.empty)return;let r=Qn?null:t.clipboardData,i=o.content(),{dom:l,text:a}=Md(n,i);r?(t.preventDefault(),r.clearData(),r.setData("text/html",l.innerHTML),r.setData("text/plain",a)):m1(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function g1(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function y1(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?eo(n,o.value,null,s,e):eo(n,o.textContent,o.innerHTML,s,e)},50)}function eo(n,e,t,o,s){let r=Ad(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,r||A.empty)))return!0;if(!r)return!1;let i=g1(r),l=i?n.state.tr.replaceSelectionWith(i,o):n.state.tr.replaceSelection(r);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Vd(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," "):""}ue.paste=(n,e)=>{let t=e;if(n.composing&&!Pe)return;let o=Qn?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&eo(n,Vd(o),o.getData("text/html"),s,t)?t.preventDefault():y1(n,t)};class Bd{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const Hd=ke?"altKey":"ctrlKey";pe.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let s=n.state.selection,r=s.empty?null:n.posAtCoords(Ss(t)),i;if(!(r&&r.pos>=s.from&&r.pos<=(s instanceof D?s.to-1:s.to))){if(o&&o.mightDrag)i=D.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(i=D.create(n.state.doc,p.posBefore))}}let l=(i||n.state.selection).content(),{dom:a,text:c,slice:d}=Md(n,l);(!t.dataTransfer.files.length||!se||pd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Qn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Qn||t.dataTransfer.setData("text/plain",c),n.dragging=new Bd(d,!t[Hd],i)};pe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ue.dragover=ue.dragenter=(n,e)=>e.preventDefault();ue.drop=(n,e)=>{let t=e,o=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let s=n.posAtCoords(Ss(t));if(!s)return;let r=n.state.doc.resolve(s.pos),i=o&&o.slice;i?n.someProp("transformPasted",f=>{i=f(i,n)}):i=Ad(n,Vd(t.dataTransfer),Qn?null:t.dataTransfer.getData("text/html"),!1,r);let l=!!(o&&!t[Hd]);if(n.someProp("handleDrop",f=>f(n,t,i||A.empty,l))){t.preventDefault();return}if(!i)return;t.preventDefault();let a=i?pm(n.state.doc,r.pos,i):r.pos;a==null&&(a=r.pos);let c=n.state.tr;if(l){let{node:f}=o;f?f.replace(c):c.deleteSelection()}let d=c.mapping.map(a),p=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=c.doc;if(p?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(u))return;let h=c.doc.resolve(d);if(p&&D.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new D(h));else{let f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,w)=>f=w),c.setSelection(pi(n,h,c.doc.resolve(f)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};pe.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())&&et(n)},20))};pe.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)};pe.beforeinput=(n,e)=>{if(se&&Pe&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,Et(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in ue)pe[n]=ue[n];function to(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 ss{constructor(e,t){this.toDOM=e,this.spec=t||Lt,this.side=this.spec.side||0}map(e,t,o,s){let{pos:r,deleted:i}=e.mapResult(t.from+s,this.side<0?-1:1);return i?null:new ge(r-o,r-o,this)}valid(){return!0}eq(e){return this==e||e instanceof ss&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&to(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class mt{constructor(e,t){this.attrs=e,this.spec=t||Lt}map(e,t,o,s){let r=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-o,i=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-o;return r>=i?null:new ge(r,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof mt&&to(this.attrs,e.attrs)&&to(this.spec,e.spec)}static is(e){return e.type instanceof mt}destroy(){}}class mi{constructor(e,t){this.attrs=e,this.spec=t||Lt}map(e,t,o,s){let r=e.mapResult(t.from+s,1);if(r.deleted)return null;let i=e.mapResult(t.to+s,-1);return i.deleted||i.pos<=r.pos?null:new ge(r.pos-o,i.pos-o,this)}valid(e,t){let{index:o,offset:s}=e.content.findIndex(t.from),r;return s==t.from&&!(r=e.child(o)).isText&&s+r.nodeSize==t.to}eq(e){return this==e||e instanceof mi&&to(this.attrs,e.attrs)&&to(this.spec,e.spec)}destroy(){}}class ge{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new ge(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,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new ge(e,e,new ss(t,o))}static inline(e,t,o,s){return new ge(e,t,new mt(o,s))}static node(e,t,o,s){return new ge(e,t,new mi(o,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof mt}get widget(){return this.type instanceof ss}}const Qt=[],Lt={};class j{constructor(e,t){this.local=e.length?e:Qt,this.children=t.length?t:Qt}static create(e,t){return t.length?rs(t,e,0,Lt):ne}find(e,t,o){let s=[];return this.findInner(e??0,t??1e9,s,0,o),s}findInner(e,t,o,s,r){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=t&&l.to>=e&&(!r||r(l.spec))&&o.push(l.copy(l.from+s,l.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let l=this.children[i]+1;this.children[i+2].findInner(e-l,t-l,o,s+l,r)}}map(e,t,o){return this==ne||e.maps.length==0?this:this.mapInner(e,t,0,0,o||Lt)}mapInner(e,t,o,s,r){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,s);a&&a.type.valid(t,a)?(i||(i=[])).push(a):r.onRemove&&r.onRemove(this.local[l].spec)}return this.children.length?b1(this.children,i||[],e,t,o,s,r):i?new j(i.sort($t),Qt):ne}add(e,t){return t.length?this==ne?j.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let s,r=0;e.forEach((l,a)=>{let c=a+o,d;if(d=_d(t,l,c)){for(s||(s=this.children.slice());r<s.length&&s[r]<a;)r+=3;s[r]==a?s[r+2]=s[r+2].addInner(l,d,c+1):s.splice(r,0,a,a+l.nodeSize,rs(d,l,c+1,Lt)),r+=3}});let i=Fd(r?Gd(t):t,-o);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new j(i.length?this.local.concat(i).sort($t):this.local,s||this.children)}remove(e){return e.length==0||this==ne?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,s=this.local;for(let r=0;r<o.length;r+=3){let i,l=o[r]+t,a=o[r+1]+t;for(let d=0,p;d<e.length;d++)(p=e[d])&&p.from>l&&p.to<a&&(e[d]=null,(i||(i=[])).push(p));if(!i)continue;o==this.children&&(o=this.children.slice());let c=o[r+2].removeInner(i,l+1);c!=ne?o[r+2]=c:(o.splice(r,3),r-=3)}if(s.length){for(let r=0,i;r<e.length;r++)if(i=e[r])for(let l=0;l<s.length;l++)s[l].eq(i,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return o==this.children&&s==this.local?this:s.length||o.length?new j(s,o):ne}forChild(e,t){if(this==ne)return this;if(t.isLeaf)return j.empty;let o,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let r=e+1,i=r+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>r&&a.type instanceof mt){let c=Math.max(r,a.from)-r,d=Math.min(i,a.to)-r;c<d&&(s||(s=[])).push(a.copy(c,d))}}if(s){let l=new j(s.sort($t),Qt);return o?new it([l,o]):l}return o||ne}eq(e){if(this==e)return!0;if(!(e instanceof j)||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 gi(this.localsInner(e))}localsInner(e){if(this==ne)return Qt;if(e.inlineContent||!this.local.some(mt.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof mt||t.push(this.local[o]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=gi;const ne=j.empty;class it{constructor(e){this.members=e}map(e,t){const o=this.members.map(s=>s.map(e,t,Lt));return it.from(o)}forChild(e,t){if(t.isLeaf)return j.empty;let o=[];for(let s=0;s<this.members.length;s++){let r=this.members[s].forChild(e,t);r!=ne&&(r instanceof it?o=o.concat(r.members):o.push(r))}return it.from(o)}eq(e){if(!(e instanceof it)||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,o=!0;for(let s=0;s<this.members.length;s++){let r=this.members[s].localsInner(e);if(r.length)if(!t)t=r;else{o&&(t=t.slice(),o=!1);for(let i=0;i<r.length;i++)t.push(r[i])}}return t?gi(o?t:t.sort($t)):Qt}static from(e){switch(e.length){case 0:return ne;case 1:return e[0];default:return new it(e.every(t=>t instanceof j)?e:e.reduce((t,o)=>t.concat(o instanceof j?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function b1(n,e,t,o,s,r,i){let l=n.slice();for(let c=0,d=r;c<t.maps.length;c++){let p=0;t.maps[c].forEach((u,h,f,m)=>{let g=m-f-(h-u);for(let b=0;b<l.length;b+=3){let w=l[b+1];if(w<0||u>w+d-p)continue;let y=l[b]+d-p;h>=y?l[b+1]=u<=y?-2:-1:u>=d&&g&&(l[b]+=g,l[b+1]+=g)}p+=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]+r),p=d-s;if(p<0||p>=o.content.size){a=!0;continue}let u=t.map(n[c+1]+r,-1),h=u-s,{index:f,offset:m}=o.content.findIndex(p),g=o.maybeChild(f);if(g&&m==p&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,d+1,n[c]+r+1,i);b!=ne?(l[c]=p,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=v1(l,n,e,t,s,r,i),d=rs(c,o,0,i);e=d.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,u=0;p<d.children.length;p+=3){let h=d.children[p];for(;u<l.length&&l[u]<h;)u+=3;l.splice(u,0,d.children[p],d.children[p+1],d.children[p+2])}}return new j(e.sort($t),l)}function Fd(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let s=n[o];t.push(new ge(s.from+e,s.to+e,s.type))}return t}function v1(n,e,t,o,s,r,i){function l(a,c){for(let d=0;d<a.local.length;d++){let p=a.local[d].map(o,s,c);p?t.push(p):i.onRemove&&i.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]+r+1);return t}function _d(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,s=null;for(let r=0,i;r<n.length;r++)(i=n[r])&&i.from>t&&i.to<o&&((s||(s=[])).push(i),n[r]=null);return s}function Gd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function rs(n,e,t,o){let s=[],r=!1;e.forEach((l,a)=>{let c=_d(n,l,a+t);if(c){r=!0;let d=rs(c,l,t+a+1,o);d!=ne&&s.push(a,a+l.nodeSize,d)}});let i=Fd(r?Gd(n):n,-t).sort($t);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||(o.onRemove&&o.onRemove(i[l].spec),i.splice(l--,1));return i.length||s.length?new j(i,s):ne}function $t(n,e){return n.from-e.from||n.to-e.to}function gi(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let s=t+1;s<e.length;s++){let r=e[s];if(r.from==o.from){r.to!=o.to&&(e==n&&(e=n.slice()),e[s]=r.copy(r.from,o.to),Kl(e,s+1,r.copy(o.to,r.to)));continue}else{r.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,r.from),Kl(e,s,o.copy(r.from,o.to)));break}}}return e}function Kl(n,e,t){for(;e<n.length&&$t(t,n[e])>0;)e++;n.splice(e,0,t)}function Us(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=ne&&e.push(o)}),n.cursorWrapper&&e.push(j.create(n.state.doc,[n.cursorWrapper.deco])),it.from(e)}const S1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},x1=ye&&ht<=11;class w1{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 C1{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new w1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let s=0;s<o.length;s++)this.queue.push(o[s]);ye&&ht<=11&&o.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),x1&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,S1)),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(Hl(this.view)){if(this.suppressingSelectionUpdates)return et(this.view);if(ye&&ht<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ht(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,o;for(let r=e.focusNode;r;r=Xn(r))t.add(r);for(let r=e.anchorNode;r;r=Xn(r))if(t.has(r)){o=r;break}let s=o&&this.view.docView.nearestDesc(o);if(s&&s.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 o=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Hl(e)&&!this.ignoreSelectionChange(o),r=-1,i=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let p=this.registerMutation(t[d],a);p&&(r=r<0?p.from:Math.min(p.from,r),i=i<0?p.to:Math.max(p.to,i),p.typeOver&&(l=!0))}if(De&&a.length){let d=a.filter(p=>p.nodeName=="BR");if(d.length==2){let[p,u]=d;p.parentNode&&p.parentNode.parentNode==u.parentNode?u.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let u of d){let h=u.parentNode;h&&h.nodeName=="LI"&&(!p||T1(e,p)!=h)&&u.remove()}}}let c=null;r<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&bs(o)&&(c=di(e))&&c.eq(L.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,et(e),this.currentSelection.set(o),e.scrollToSelection()):(r>-1||s)&&(r>-1&&(e.docView.markDirty(r,i),k1(e)),this.handleDOMChange(r,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||et(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let p=e.addedNodes[d];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let s=e.previousSibling,r=e.nextSibling;if(ye&&ht<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:p,nextSibling:u}=e.addedNodes[d];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(r=u)}let i=s&&s.parentNode==e.target?ee(s)+1:0,l=o.localPosFromDOM(e.target,i,-1),a=r&&r.parentNode==e.target?ee(r):e.target.childNodes.length,c=o.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Jl=new WeakMap,Zl=!1;function k1(n){if(!Jl.has(n)&&(Jl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=De,Zl)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."),Zl=!0}}function Yl(n,e){let t=e.startContainer,o=e.startOffset,s=e.endContainer,r=e.endOffset,i=n.domAtPos(n.state.selection.anchor);return Ht(i.node,i.offset,s,r)&&([t,o,s,r]=[s,r,t,o]),{anchorNode:t,anchorOffset:o,focusNode:s,focusOffset:r}}function E1(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Yl(n,s)}let t;function o(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?Yl(n,t):null}function T1(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function M1(n,e,t){let{node:o,fromOffset:s,toOffset:r,from:i,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}],bs(a)||c.push({node:a.focusNode,offset:a.focusOffset})),se&&n.input.lastKeyCode===8)for(let g=r;g>s;g--){let b=o.childNodes[g-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){r=g;break}if(!w||w.size)break}let p=n.state.doc,u=n.someProp("domParser")||Bt.fromSchema(n.state.schema),h=p.resolve(i),f=null,m=u.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:r,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:A1,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),f={anchor:g+i,head:b+i}}return{doc:m,sel:f,from:i,to:l}}function A1(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(de&&/^(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||de&&/^(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 P1=/^(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 N1(n,e,t,o,s){let r=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let k=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,M=di(n,k);if(M&&!n.state.selection.eq(M)){if(se&&Pe&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",N=>N(n,Et(13,"Enter"))))return;let P=n.state.tr.setSelection(M);k=="pointer"?P.setMeta("pointer",!0):k=="key"&&P.scrollIntoView(),r&&P.setMeta("composition",r),n.dispatch(P)}return}let i=n.state.doc.resolve(e),l=i.sharedDepth(t);e=i.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=M1(n,e,t),d=n.state.doc,p=d.slice(c.from,c.to),u,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(u=n.state.selection.to,h="end"):(u=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let f=R1(p.content,c.doc.content,c.from,u,h);if(f&&n.input.domChangeCount++,(bn&&n.input.lastIOSEnter>Date.now()-225||Pe)&&s.some(k=>k.nodeType==1&&!P1.test(k.nodeName))&&(!f||f.endA>=f.endB)&&n.someProp("handleKeyDown",k=>k(n,Et(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!f)if(o&&a instanceof $&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))f={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let k=Xl(n,n.state.doc,c.sel);if(k&&!k.eq(n.state.selection)){let M=n.state.tr.setSelection(k);r&&M.setMeta("composition",r),n.dispatch(M)}}return}n.state.selection.from<n.state.selection.to&&f.start==f.endB&&n.state.selection instanceof $&&(f.start>n.state.selection.from&&f.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?f.start=n.state.selection.from:f.endA<n.state.selection.to&&f.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(f.endB+=n.state.selection.to-f.endA,f.endA=n.state.selection.to)),ye&&ht<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>c.from&&c.doc.textBetween(f.start-c.from-1,f.start-c.from+1)==" "&&(f.start--,f.endA--,f.endB--);let m=c.doc.resolveNoCache(f.start-c.from),g=c.doc.resolveNoCache(f.endB-c.from),b=d.resolve(f.start),w=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=f.endA,y;if((bn&&n.input.lastIOSEnter>Date.now()-225&&(!w||s.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(y=L.findFrom(c.doc.resolve(m.pos+1),1,!0))&&y.head==g.pos)&&n.someProp("handleKeyDown",k=>k(n,Et(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>f.start&&I1(d,f.start,f.endA,m,g)&&n.someProp("handleKeyDown",k=>k(n,Et(8,"Backspace")))){Pe&&se&&n.domObserver.suppressSelectionUpdates();return}se&&Pe&&f.endB==f.start&&(n.input.lastAndroidDelete=Date.now()),Pe&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==f.endA&&(f.endB-=2,g=c.doc.resolveNoCache(f.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(k){return k(n,Et(13,"Enter"))})},20));let v=f.start,C=f.endA,S,x,E;if(w){if(m.pos==g.pos)ye&&ht<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>et(n),20)),S=n.state.tr.delete(v,C),x=d.resolve(f.start).marksAcross(d.resolve(f.endA));else if(f.endA==f.endB&&(E=O1(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,f.endA-b.start()))))S=n.state.tr,E.type=="add"?S.addMark(v,C,E.mark):S.removeMark(v,C,E.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let k=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",M=>M(n,v,C,k)))return;S=n.state.tr.insertText(k,v,C)}}if(S||(S=n.state.tr.replace(v,C,c.doc.slice(f.start-c.from,f.endB-c.from))),c.sel){let k=Xl(n,S.doc,c.sel);k&&!(se&&Pe&&n.composing&&k.empty&&(f.start!=f.endB||n.input.lastAndroidDelete<Date.now()-100)&&(k.head==v||k.head==S.mapping.map(C)-1)||ye&&k.empty&&k.head==v)&&S.setSelection(k)}x&&S.ensureMarks(x),r&&S.setMeta("composition",r),n.dispatch(S.scrollIntoView())}function Xl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:pi(n,e.resolve(t.anchor),e.resolve(t.head))}function O1(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,s=t,r=o,i,l,a;for(let d=0;d<o.length;d++)s=o[d].removeFromSet(s);for(let d=0;d<t.length;d++)r=t[d].removeFromSet(r);if(s.length==1&&r.length==0)l=s[0],i="add",a=d=>d.mark(l.addToSet(d.marks));else if(s.length==0&&r.length==1)l=r[0],i="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(T.from(c).eq(n))return{mark:l,type:i}}function I1(n,e,t,o,s){if(t-e<=s.pos-o.pos||Ks(o,!0,!1)<s.pos)return!1;let r=n.resolve(e);if(!o.parent.isTextblock){let l=r.nodeAfter;return l!=null&&t==e+l.nodeSize}if(r.parentOffset<r.parent.content.size||!r.parent.isTextblock)return!1;let i=n.resolve(Ks(r,!0,!0));return!i.parent.isTextblock||i.pos>t||Ks(i,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(i.parent.content)}function Ks(n,e,t){let o=n.depth,s=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,s++,e=!1;if(t){let r=n.node(o).maybeChild(n.indexAfter(o));for(;r&&!r.isLeaf;)r=r.firstChild,s++}return s}function R1(n,e,t,o,s){let r=n.findDiffStart(e,t);if(r==null)return null;let{a:i,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let a=Math.max(0,r-Math.min(i,l));o-=i+a-r}if(i<r&&n.size<e.size){let a=o<=r&&o>=i?r-o:0;r-=a,r&&r<e.size&&Ql(e.textBetween(r-1,r+1))&&(r+=a?1:-1),l=r+(l-i),i=r}else if(l<r){let a=o<=r&&o>=l?r-o:0;r-=a,r&&r<n.size&&Ql(n.textBetween(r-1,r+1))&&(r+=a?1:-1),i=r+(i-l),l=r}return{start:r,endA:i,endB:l}}function Ql(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 D1{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 Qg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(sa),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=na(this),ta(this),this.nodeViews=oa(this),this.docView=Dl(this.state.doc,ea(this),Us(this),this.dom,this),this.domObserver=new C1(this,(o,s,r,i)=>N1(this,o,s,r,i)),this.domObserver.start(),e1(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&&Dr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(sa),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let s=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(zd(this),i=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=oa(this);$1(h,this.nodeViews)&&(this.nodeViews=h,r=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Dr(this),this.editable=na(this),ta(this);let a=Us(this),c=ea(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",p=r||!this.docView.matchesNode(e.doc,c,a);(p||!e.selection.eq(s.selection))&&(i=!0);let u=d=="preserve"&&i&&this.dom.style.overflowAnchor==null&&fg(this);if(i){this.domObserver.stop();let h=p&&(ye||se)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&L1(s.selection,e.selection);if(p){let f=se?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=h1(this)),(r||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Dl(e.doc,c,a,this.dom,this)),f&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Vg(this))?et(this,h):(kd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((o=this.dragging)===null||o===void 0)&&o.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():u&&mg(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof D){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Al(this,t.getBoundingClientRect(),e)}else Al(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 o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,s=-1;if(this.state.doc.nodeAt(o.from)==o.node)s=o.from;else{let r=o.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==o.node&&(s=r)}this.dragging=new Bd(e.slice,e.move,s<0?void 0:D.create(this.state.doc,s))}someProp(e,t){let o=this._props&&this._props[e],s;if(o!=null&&(s=t?t(o):o))return s;for(let i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[e];if(l!=null&&(s=t?t(l):l))return s}let r=this.state.plugins;if(r)for(let i=0;i<r.length;i++){let l=r[i].props[e];if(l!=null&&(s=t?t(l):l))return s}}hasFocus(){if(ye){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&&gg(this.dom),et(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 xg(this,e)}coordsAtPos(e,t=1){return gd(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,o=-1){let s=this.docView.posFromDOM(e,t,o);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return Tg(this,t||this.state,e)}pasteHTML(e,t){return eo(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return eo(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(t1(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Us(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,og())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return o1(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?de&&this.root.nodeType===11&&ag(this.dom.ownerDocument)==this.dom&&E1(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ea(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 o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[ge.node(0,n.state.doc.content.size,e)]}function ta(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:ge.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function na(n){return!n.someProp("editable",e=>e(n.state)===!1)}function L1(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 oa(n){let e=Object.create(null);function t(o){for(let s in o)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=o[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function $1(n,e){let t=0,o=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)o++;return t!=o}function sa(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 Lr,$r;if(typeof WeakMap<"u"){let n=new WeakMap;Lr=e=>n.get(e),$r=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Lr=o=>{for(let s=0;s<n.length;s+=2)if(n[s]==o)return n[s+1]},$r=(o,s)=>(t==10&&(t=0),n[t++]=o,n[t++]=s)}var U=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,s=e/this.width|0;let r=o+1,i=s+1;for(let l=1;r<this.width&&this.map[e+l]==t;l++)r++;for(let l=1;i<this.height&&this.map[e+this.width*l]==t;l++)i++;return{left:o,top:s,right:r,bottom:i}}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:o,right:s,top:r,bottom:i}=this.findCell(n);return e=="horiz"?(t<0?o==0:s==this.width)?null:this.map[r*this.width+(t<0?o-1:s)]:(t<0?r==0:i==this.height)?null:this.map[o+this.width*(t<0?r-1:i)]}rectBetween(n,e){const{left:t,right:o,top:s,bottom:r}=this.findCell(n),{left:i,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,i),top:Math.min(s,a),right:Math.max(o,l),bottom:Math.max(r,c)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let s=n.left;s<n.right;s++){const r=o*this.width+s,i=this.map[r];t[i]||(t[i]=!0,!(s==n.left&&s&&this.map[r-1]==i||o==n.top&&o&&this.map[r-this.width]==i)&&e.push(i))}return e}positionAt(n,e,t){for(let o=0,s=0;;o++){const r=s+t.child(o).nodeSize;if(o==n){let i=e+n*this.width;const l=(n+1)*this.width;for(;i<l&&this.map[i]<s;)i++;return i==l?r-1:this.map[i]}s=r}}static get(n){return Lr(n)||$r(n,z1(n))}};function z1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=V1(n),t=n.childCount,o=[];let s=0,r=null;const i=[];for(let c=0,d=e*t;c<d;c++)o[c]=0;for(let c=0,d=0;c<t;c++){const p=n.child(c);d++;for(let f=0;;f++){for(;s<o.length&&o[s]!=0;)s++;if(f==p.childCount)break;const m=p.child(f),{colspan:g,rowspan:b,colwidth:w}=m.attrs;for(let y=0;y<b;y++){if(y+c>=t){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:b-y});break}const v=s+y*e;for(let C=0;C<g;C++){o[v+C]==0?o[v+C]=d:(r||(r=[])).push({type:"collision",row:c,pos:d,n:g-C});const S=w&&w[C];if(S){const x=(v+C)%e*2,E=i[x];E==null||E!=S&&i[x+1]==1?(i[x]=S,i[x+1]=1):E==S&&i[x+1]++}}}s+=g,d+=m.nodeSize}const u=(c+1)*e;let h=0;for(;s<u;)o[s++]==0&&h++;h&&(r||(r=[])).push({type:"missing",row:c,n:h}),d++}const l=new U(e,t,o,r);let a=!1;for(let c=0;!a&&c<i.length;c+=2)i[c]!=null&&i[c+1]<t&&(a=!0);return a&&B1(l,i,n),l}function V1(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const s=n.child(o);let r=0;if(t)for(let i=0;i<o;i++){const l=n.child(i);for(let a=0;a<l.childCount;a++){const c=l.child(a);i+c.attrs.rowspan>o&&(r+=c.attrs.colspan)}}for(let i=0;i<s.childCount;i++){const l=s.child(i);r+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function B1(n,e,t){n.problems||(n.problems=[]);const o={};for(let s=0;s<n.map.length;s++){const r=n.map[s];if(o[r])continue;o[r]=!0;const i=t.nodeAt(r);if(!i)throw new RangeError(`No cell with offset ${r} found`);let l=null;const a=i.attrs;for(let c=0;c<a.colspan;c++){const d=(s+c)%n.width,p=e[d*2];p!=null&&(!a.colwidth||a.colwidth[c]!=p)&&((l||(l=H1(a)))[c]=p)}l&&n.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:l})}}function H1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ra(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),o=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(i=>Number(i)):null,s=Number(n.getAttribute("colspan")||1),r={colspan:s,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:o&&o.length==s?o:null};for(const i in e){const l=e[i].getFromDOM,a=l&&l(n);a!=null&&(r[i]=a)}return r}function ia(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 o in e){const s=e[o].setDOMAttr;s&&s(n.attrs[o],t)}return t}function F1(n){const e=n.cellAttributes||{},t={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const o in e)t[o]={default:e[o].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:o=>ra(o,e)}],toDOM(o){return["td",ia(o,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:o=>ra(o,e)}],toDOM(o){return["th",ia(o,e),0]}}}}function Ue(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],s=o.spec.tableRole;s&&(e[s]=o)}}return e}var lt=new so("selectingCells");function ao(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 xs(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 yi(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=ao(e.$head)||_1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function _1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function zr(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function G1(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function bi(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Wd(n,e,t){const o=n.node(-1),s=U.get(o),r=n.start(-1),i=s.nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function vn(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(s=>s>0)||(o.colwidth=null)),o}var Y=class Ze extends L{constructor(e,t=e){const o=e.node(-1),s=U.get(o),r=e.start(-1),i=s.rectBetween(e.pos-r,t.pos-r),l=e.node(0),a=s.cellsInRect(i).filter(d=>d!=t.pos-r);a.unshift(t.pos-r);const c=a.map(d=>{const p=o.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const u=r+d+1;return new Uc(l.resolve(u),l.resolve(u+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(zr(o)&&zr(s)&&bi(o,s)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?Ze.rowSelection(o,s):r&&this.isColSelection()?Ze.colSelection(o,s):new Ze(o,s)}return $.between(o,s)}content(){const e=this.$anchorCell.node(-1),t=U.get(e),o=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},i=[];for(let a=s.top;a<s.bottom;a++){const c=[];for(let d=a*t.width+s.left,p=s.left;p<s.right;p++,d++){const u=t.map[d];if(r[u])continue;r[u]=!0;const h=t.findCell(u);let f=e.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const m=s.left-h.left,g=h.right-s.right;if(m>0||g>0){let b=f.attrs;if(m>0&&(b=vn(b,0,m)),g>0&&(b=vn(b,b.colspan-g,g)),h.left<s.left){if(f=f.type.createAndFill(b),!f)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else f=f.type.create(b,f.content)}if(h.top<s.top||h.bottom>s.bottom){const b={...f.attrs,rowspan:Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top)};h.top<s.top?f=f.type.createAndFill(b):f=f.type.create(b,f.content)}c.push(f)}i.push(e.child(a).copy(T.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:i;return new A(T.from(l),1,1)}replace(e,t=A.empty){const o=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){const{$from:l,$to:a}=s[i],c=e.mapping.slice(o);e.replace(c.map(l.pos),c.map(a.pos),i?A.empty:t)}const r=L.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,t){this.replace(e,new A(T.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=U.get(t),s=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let i=0;i<r.length;i++)e(t.nodeAt(r[i]),s+r[i])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),s=U.get(o),r=e.start(-1),i=s.findCell(e.pos-r),l=s.findCell(t.pos-r),a=e.node(0);return i.top<=l.top?(i.top>0&&(e=a.resolve(r+s.map[i.left])),l.bottom<s.height&&(t=a.resolve(r+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(r+s.map[l.left])),i.bottom<s.height&&(e=a.resolve(r+s.map[s.width*(s.height-1)+i.right-1]))),new Ze(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=U.get(e),o=this.$anchorCell.start(-1),s=t.colCount(this.$anchorCell.pos-o),r=t.colCount(this.$headCell.pos-o);if(Math.min(s,r)>0)return!1;const i=s+this.$anchorCell.nodeAfter.attrs.colspan,l=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==t.width}eq(e){return e instanceof Ze&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),s=U.get(o),r=e.start(-1),i=s.findCell(e.pos-r),l=s.findCell(t.pos-r),a=e.node(0);return i.left<=l.left?(i.left>0&&(e=a.resolve(r+s.map[i.top*s.width])),l.right<s.width&&(t=a.resolve(r+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(r+s.map[l.top*s.width])),i.right<s.width&&(e=a.resolve(r+s.map[s.width*(i.top+1)-1]))),new Ze(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Ze(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Ze(e.resolve(t),e.resolve(o))}getBookmark(){return new W1(this.$anchorCell.pos,this.$headCell.pos)}};Y.prototype.visible=!1;L.jsonID("cell",Y);var W1=class jd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new jd(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&bi(t,o)?new Y(t,o):L.near(o,1)}};function j1(n){if(!(n.selection instanceof Y))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(ge.node(o,o+t.nodeSize,{class:"selectedCell"}))}),j.create(n.doc,e)}function q1({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return t==o&&/row|table/.test(n.node(s).type.spec.tableRole)}function U1({$from:n,$to:e}){let t,o;for(let s=n.depth;s>0;s--){const r=n.node(s);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){t=r;break}}for(let s=e.depth;s>0;s--){const r=e.node(s);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return t!==o&&e.parentOffset===0}function K1(n,e,t){const o=(e||n).selection,s=(e||n).doc;let r,i;if(o instanceof D&&(i=o.node.type.spec.tableRole)){if(i=="cell"||i=="header_cell")r=Y.create(s,o.from);else if(i=="row"){const l=s.resolve(o.from+1);r=Y.rowSelection(l,l)}else if(!t){const l=U.get(o.node),a=o.from+1,c=a+l.map[l.width*l.height-1];r=Y.create(s,a+1,c)}}else o instanceof $&&q1(o)?r=$.create(s,o.from):o instanceof $&&U1(o)&&(r=$.create(s,o.$from.start(),o.$from.end()));return r&&(e||(e=n.tr)).setSelection(r),e}var J1=new so("fix-tables");function qd(n,e,t,o){const s=n.childCount,r=e.childCount;e:for(let i=0,l=0;i<r;i++){const a=e.child(i);for(let c=l,d=Math.min(s,i+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}o(a,t),l<s&&n.child(l).sameMarkup(a)?qd(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function Z1(n,e){let t;const o=(s,r)=>{s.type.spec.tableRole=="table"&&(t=Y1(n,s,r,t))};return e?e.doc!=n.doc&&qd(e.doc,n.doc,0,o):n.doc.descendants(o),t}function Y1(n,e,t,o){const s=U.get(e);if(!s.problems)return o;o||(o=n.tr);const r=[];for(let a=0;a<s.height;a++)r.push(0);for(let a=0;a<s.problems.length;a++){const c=s.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const p=d.attrs;for(let u=0;u<p.rowspan;u++)r[c.row+u]+=c.n;o.setNodeMarkup(o.mapping.map(t+1+c.pos),null,vn(p,p.colspan-c.n,c.n))}else if(c.type=="missing")r[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;o.setNodeMarkup(o.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;o.setNodeMarkup(o.mapping.map(t+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}}let i,l;for(let a=0;a<r.length;a++)r[a]&&(i==null&&(i=a),l=a);for(let a=0,c=t+1;a<s.height;a++){const d=e.child(a),p=c+d.nodeSize,u=r[a];if(u>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const f=[];for(let g=0;g<u;g++){const b=Ue(n.schema)[h].createAndFill();b&&f.push(b)}const m=(a==0||i==a-1)&&l==a?c+1:p-1;o.insert(o.mapping.map(m),f)}c=p}return o.setMeta(J1,{fixTables:!0})}function Ud(n){const e=n.selection,t=yi(n),o=t.node(-1),s=t.start(-1),r=U.get(o);return{...e instanceof Y?r.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):r.findCell(t.pos-s),tableStart:s,map:r,table:o}}function X1(n){return function(e,t){if(!xs(e))return!1;if(t){const o=Ue(e.schema),s=Ud(e),r=e.tr,i=s.map.cellsInRect(n=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:n=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=i.map(a=>s.table.nodeAt(a));for(let a=0;a<i.length;a++)l[a].type==o.header_cell&&r.setNodeMarkup(s.tableStart+i[a],o.cell,l[a].attrs);if(r.steps.length==0)for(let a=0;a<i.length;a++)r.setNodeMarkup(s.tableStart+i[a],o.header_cell,l[a].attrs);t(r)}return!0}}function la(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<o.length;s++){const r=e.table.nodeAt(o[s]);if(r&&r.type!==t.header_cell)return!1}return!0}function vi(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?X1(n):function(t,o){if(!xs(t))return!1;if(o){const s=Ue(t.schema),r=Ud(t),i=t.tr,l=la("row",r,s),a=la("column",r,s),d=(n==="column"?l:n==="row"?a:!1)?1:0,p=n=="column"?{left:0,top:d,right:1,bottom:r.map.height}:n=="row"?{left:d,top:0,right:r.map.width,bottom:1}:r,u=n=="column"?a?s.cell:s.header_cell:n=="row"?l?s.cell:s.header_cell:s.cell;r.map.cellsInRect(p).forEach(h=>{const f=h+r.tableStart,m=i.doc.nodeAt(f);m&&i.setNodeMarkup(f,u,m.attrs)}),o(i)}return!0}}vi("row",{useDeprecatedLogic:!0});vi("column",{useDeprecatedLogic:!0});vi("cell",{useDeprecatedLogic:!0});function Q1(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,s=n.before();o>=0;o--){const r=n.node(-1).child(o),i=r.lastChild;if(i)return s-1-i.nodeSize;s-=r.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),s=n.after();o<t.childCount;o++){const r=t.child(o);if(r.childCount)return s+1;s+=r.nodeSize}}return null}function aa(n){return function(e,t){if(!xs(e))return!1;const o=Q1(yi(e),n);if(o==null)return!1;if(t){const s=e.doc.resolve(o);t(e.tr.setSelection($.between(s,G1(s))).scrollIntoView())}return!0}}function ko(n,e){const t=n.selection;if(!(t instanceof Y))return!1;if(e){const o=n.tr,s=Ue(n.schema).cell.createAndFill().content;t.forEachCell((r,i)=>{r.content.eq(s)||o.replace(o.mapping.map(i+1),o.mapping.map(i+r.nodeSize-1),new A(s,0,0))}),o.docChanged&&e(o)}return!0}function e0(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const s=e.child(0),r=s.type.spec.tableRole,i=s.type.schema,l=[];if(r=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,t-1),p=a<e.childCount-1?0:Math.max(0,o-1);(d||p)&&(c=Vr(Ue(i).row,new A(c,d,p)).content),l.push(c)}else if(r=="cell"||r=="header_cell")l.push(t||o?Vr(Ue(i).row,new A(e,t,o)).content:e);else return null;return t0(i,l)}function t0(n,e){const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(let i=r.childCount-1;i>=0;i--){const{rowspan:l,colspan:a}=r.child(i).attrs;for(let c=s;c<s+l;c++)t[c]=(t[c]||0)+a}}let o=0;for(let s=0;s<t.length;s++)o=Math.max(o,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(T.empty),t[s]<o){const r=Ue(n).cell.createAndFill(),i=[];for(let l=t[s];l<o;l++)i.push(r);e[s]=e[s].append(T.from(i))}return{height:e.length,width:o,rows:e}}function Vr(n,e){const t=n.createAndFill();return new qc(t).replace(0,t.content.size,e).doc}function n0({width:n,height:e,rows:t},o,s){if(n!=o){const r=[],i=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=r[l]||0,p=0;d<o;p++){let u=a.child(p%a.childCount);d+u.attrs.colspan>o&&(u=u.type.createChecked(vn(u.attrs,u.attrs.colspan,d+u.attrs.colspan-o),u.content)),c.push(u),d+=u.attrs.colspan;for(let h=1;h<u.attrs.rowspan;h++)r[l+h]=(r[l+h]||0)+u.attrs.colspan}i.push(T.from(c))}t=i,n=o}if(e!=s){const r=[];for(let i=0,l=0;i<s;i++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let p=c.child(d);i+p.attrs.rowspan>s&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,s-p.attrs.rowspan)},p.content)),a.push(p)}r.push(T.from(a))}t=r,e=s}return{width:n,height:e,rows:t}}function o0(n,e,t,o,s,r,i){const l=n.doc.type.schema,a=Ue(l);let c,d;if(s>e.width)for(let p=0,u=0;p<e.height;p++){const h=t.child(p);u+=h.nodeSize;const f=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=e.width;g<s;g++)f.push(m);n.insert(n.mapping.slice(i).map(u-1+o),f)}if(r>e.height){const p=[];for(let f=0,m=(e.height-1)*e.width;f<Math.max(e.width,s);f++){const g=f>=e.width?!1:t.nodeAt(e.map[m+f]).type==a.header_cell;p.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const u=a.row.create(null,T.from(p)),h=[];for(let f=e.height;f<r;f++)h.push(u);n.insert(n.mapping.slice(i).map(o+t.nodeSize-2),h)}return!!(c||d)}function ca(n,e,t,o,s,r,i,l){if(i==0||i==e.height)return!1;let a=!1;for(let c=s;c<r;c++){const d=i*e.width+c,p=e.map[d];if(e.map[d-e.width]==p){a=!0;const u=t.nodeAt(p),{top:h,left:f}=e.findCell(p);n.setNodeMarkup(n.mapping.slice(l).map(p+o),null,{...u.attrs,rowspan:i-h}),n.insert(n.mapping.slice(l).map(e.positionAt(i,f,t)),u.type.createAndFill({...u.attrs,rowspan:h+u.attrs.rowspan-i})),c+=u.attrs.colspan-1}}return a}function da(n,e,t,o,s,r,i,l){if(i==0||i==e.width)return!1;let a=!1;for(let c=s;c<r;c++){const d=c*e.width+i,p=e.map[d];if(e.map[d-1]==p){a=!0;const u=t.nodeAt(p),h=e.colCount(p),f=n.mapping.slice(l).map(p+o);n.setNodeMarkup(f,null,vn(u.attrs,i-h,u.attrs.colspan-(i-h))),n.insert(f+u.nodeSize,u.type.createAndFill(vn(u.attrs,0,i-h))),c+=u.attrs.rowspan-1}}return a}function pa(n,e,t,o,s){let r=t?n.doc.nodeAt(t-1):n.doc;if(!r)throw new Error("No table found");let i=U.get(r);const{top:l,left:a}=o,c=a+s.width,d=l+s.height,p=n.tr;let u=0;function h(){if(r=t?p.doc.nodeAt(t-1):p.doc,!r)throw new Error("No table found");i=U.get(r),u=p.mapping.maps.length}o0(p,i,r,t,c,d,u)&&h(),ca(p,i,r,t,a,c,l,u)&&h(),ca(p,i,r,t,a,c,d,u)&&h(),da(p,i,r,t,l,d,a,u)&&h(),da(p,i,r,t,l,d,c,u)&&h();for(let f=l;f<d;f++){const m=i.positionAt(f,a,r),g=i.positionAt(f,c,r);p.replace(p.mapping.slice(u).map(m+t),p.mapping.slice(u).map(g+t),new A(s.rows[f-l],0,0))}h(),p.setSelection(new Y(p.doc.resolve(t+i.positionAt(l,a,r)),p.doc.resolve(t+i.positionAt(d-1,c-1,r)))),e(p)}var s0=cd({ArrowLeft:Eo("horiz",-1),ArrowRight:Eo("horiz",1),ArrowUp:Eo("vert",-1),ArrowDown:Eo("vert",1),"Shift-ArrowLeft":To("horiz",-1),"Shift-ArrowRight":To("horiz",1),"Shift-ArrowUp":To("vert",-1),"Shift-ArrowDown":To("vert",1),Backspace:ko,"Mod-Backspace":ko,Delete:ko,"Mod-Delete":ko});function Lo(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Eo(n,e){return(t,o,s)=>{if(!s)return!1;const r=t.selection;if(r instanceof Y)return Lo(t,o,L.near(r.$headCell,e));if(n!="horiz"&&!r.empty)return!1;const i=Kd(s,n,e);if(i==null)return!1;if(n=="horiz")return Lo(t,o,L.near(t.doc.resolve(r.head+e),e));{const l=t.doc.resolve(i),a=Wd(l,n,e);let c;return a?c=L.near(a,1):e<0?c=L.near(t.doc.resolve(l.before(-1)),-1):c=L.near(t.doc.resolve(l.after(-1)),1),Lo(t,o,c)}}}function To(n,e){return(t,o,s)=>{if(!s)return!1;const r=t.selection;let i;if(r instanceof Y)i=r;else{const a=Kd(s,n,e);if(a==null)return!1;i=new Y(t.doc.resolve(a))}const l=Wd(i.$headCell,n,e);return l?Lo(t,o,new Y(i.$anchorCell,l)):!1}}function r0(n,e){const t=n.state.doc,o=ao(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Y(o))),!0):!1}function i0(n,e,t){if(!xs(n.state))return!1;let o=e0(t);const s=n.state.selection;if(s instanceof Y){o||(o={width:1,height:1,rows:[T.from(Vr(Ue(n.state.schema).cell,t))]});const r=s.$anchorCell.node(-1),i=s.$anchorCell.start(-1),l=U.get(r).rectBetween(s.$anchorCell.pos-i,s.$headCell.pos-i);return o=n0(o,l.right-l.left,l.bottom-l.top),pa(n.state,n.dispatch,i,l,o),!0}else if(o){const r=yi(n.state),i=r.start(-1);return pa(n.state,n.dispatch,i,U.get(r.node(-1)).findCell(r.pos-i),o),!0}else return!1}function l0(n,e){var t;if(e.ctrlKey||e.metaKey)return;const o=ua(n,e.target);let s;if(e.shiftKey&&n.state.selection instanceof Y)r(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(s=ao(n.state.selection.$anchor))!=null&&((t=Js(n,e))==null?void 0:t.pos)!=s.pos)r(s,e),e.preventDefault();else if(!o)return;function r(a,c){let d=Js(n,c);const p=lt.getState(n.state)==null;if(!d||!bi(a,d))if(p)d=a;else return;const u=new Y(a,d);if(p||!n.state.selection.eq(u)){const h=n.state.tr.setSelection(u);p&&h.setMeta(lt,a.pos),n.dispatch(h)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",l),lt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(lt,-1))}function l(a){const c=a,d=lt.getState(n.state);let p;if(d!=null)p=n.state.doc.resolve(d);else if(ua(n,c.target)!=o&&(p=Js(n,e),!p))return i();p&&r(p,c)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",l)}function Kd(n,e,t){if(!(n.state.selection instanceof $))return null;const{$head:o}=n.state.selection;for(let s=o.depth-1;s>=0;s--){const r=o.node(s);if((t<0?o.index(s):o.indexAfter(s))!=(t<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const l=o.before(s),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function ua(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Js(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?ao(n.state.doc.resolve(t.pos)):null}var a0=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")),Br(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,Br(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Br(n,e,t,o,s,r){var i;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let p=0,u=0;p<d.childCount;p++){const{colspan:h,colwidth:f}=d.child(p).attrs;for(let m=0;m<h;m++,u++){const g=s==u?r:f&&f[m],b=g?g+"px":"";if(l+=g||o,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=b,e.appendChild(w)}}}for(;c;){const p=c.nextSibling;(i=c.parentNode)==null||i.removeChild(c),c=p}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var xe=new so("tableColumnResizing");function c0({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=a0,lastColumnResizable:s=!0}={}){const r=new wn({key:xe,state:{init(i,l){var a,c;const d=(c=(a=r.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,p=Ue(l.schema).table.name;return o&&d&&(d[p]=(u,h)=>new o(u,t,h)),new d0(-1,!1)},apply(i,l){return l.apply(i)}},props:{attributes:i=>{const l=xe.getState(i);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(i,l)=>{p0(i,l,n,s)},mouseleave:i=>{u0(i)},mousedown:(i,l)=>{h0(i,l,e,t)}},decorations:i=>{const l=xe.getState(i);if(l&&l.activeHandle>-1)return b0(i,l.activeHandle)},nodeViews:{}}});return r}var d0=class $o{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(xe);if(o&&o.setHandle!=null)return new $o(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new $o(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);return zr(e.doc.resolve(s))||(s=-1),new $o(s,t.dragging)}return t}};function p0(n,e,t,o){const s=xe.getState(n.state);if(s&&!s.dragging){const r=m0(e.target);let i=-1;if(r){const{left:l,right:a}=r.getBoundingClientRect();e.clientX-l<=t?i=ha(n,e,"left",t):a-e.clientX<=t&&(i=ha(n,e,"right",t))}if(i!=s.activeHandle){if(!o&&i!==-1){const l=n.state.doc.resolve(i),a=l.node(-1),c=U.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Jd(n,i)}}}function u0(n){const e=xe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Jd(n,-1)}function h0(n,e,t,o){var s;const r=(s=n.dom.ownerDocument.defaultView)!=null?s:window,i=xe.getState(n.state);if(!i||i.activeHandle==-1||i.dragging)return!1;const l=n.state.doc.nodeAt(i.activeHandle),a=f0(n,i.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(xe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(p){r.removeEventListener("mouseup",c),r.removeEventListener("mousemove",d);const u=xe.getState(n.state);u!=null&&u.dragging&&(g0(n,u.activeHandle,fa(u.dragging,p,t)),n.dispatch(n.state.tr.setMeta(xe,{setDragging:null})))}function d(p){if(!p.which)return c(p);const u=xe.getState(n.state);if(u&&u.dragging){const h=fa(u.dragging,p,t);ma(n,u.activeHandle,h,o)}}return ma(n,i.activeHandle,a,o),r.addEventListener("mouseup",c),r.addEventListener("mousemove",d),e.preventDefault(),!0}function f0(n,e,{colspan:t,colwidth:o}){const s=o&&o[o.length-1];if(s)return s;const r=n.domAtPos(e);let l=r.node.childNodes[r.offset].offsetWidth,a=t;if(o)for(let c=0;c<t;c++)o[c]&&(l-=o[c],a--);return l/a}function m0(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ha(n,e,t,o){const s=t=="right"?-o:o,r=n.posAtCoords({left:e.clientX+s,top:e.clientY});if(!r)return-1;const{pos:i}=r,l=ao(n.state.doc.resolve(i));if(!l)return-1;if(t=="right")return l.pos;const a=U.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 fa(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function Jd(n,e){n.dispatch(n.state.tr.setMeta(xe,{setHandle:e}))}function g0(n,e,t){const o=n.state.doc.resolve(e),s=o.node(-1),r=U.get(s),i=o.start(-1),l=r.colCount(o.pos-i)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<r.height;c++){const d=c*r.width+l;if(c&&r.map[d]==r.map[d-r.width])continue;const p=r.map[d],u=s.nodeAt(p).attrs,h=u.colspan==1?0:l-r.colCount(p);if(u.colwidth&&u.colwidth[h]==t)continue;const f=u.colwidth?u.colwidth.slice():y0(u.colspan);f[h]=t,a.setNodeMarkup(i+p,null,{...u,colwidth:f})}a.docChanged&&n.dispatch(a)}function ma(n,e,t,o){const s=n.state.doc.resolve(e),r=s.node(-1),i=s.start(-1),l=U.get(r).colCount(s.pos-i)+s.nodeAfter.attrs.colspan-1;let a=n.domAtPos(s.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Br(r,a.firstChild,a,o,l,t)}function y0(n){return Array(n).fill(0)}function b0(n,e){var t;const o=[],s=n.doc.resolve(e),r=s.node(-1);if(!r)return j.empty;const i=U.get(r),l=s.start(-1),a=i.colCount(s.pos-l)+s.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const d=a+c*i.width;if((a==i.width-1||i.map[d]!=i.map[d+1])&&(c==0||i.map[d]!=i.map[d-i.width])){const p=i.map[d],u=l+p+r.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=xe.getState(n))!=null&&t.dragging&&o.push(ge.node(l+p,l+p+r.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(ge.widget(u,h))}}return j.create(n.doc,o)}function v0({allowTableNodeSelection:n=!1}={}){return new wn({key:lt,state:{init(){return null},apply(e,t){const o=e.getMeta(lt);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:s,pos:r}=e.mapping.mapResult(t);return s?null:r}},props:{decorations:j1,handleDOMEvents:{mousedown:l0},createSelectionBetween(e){return lt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:r0,handleKeyDown:s0,handlePaste:i0},appendTransaction(e,t,o){return K1(o,Z1(o,t),n)}})}const Fn=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},Hr=n=>{const{key:e,cssProperty:t,tagName:o="span"}=n,s="value";return{attrs:{...ws,[s]:{default:null}},parseDOM:[{tag:`${o}[${e}]`,getAttrs:r=>({...Cs(r),[s]:r.style.getPropertyValue(t)||null})}],toDOM(r){const{[s]:i}=r.attrs,l={...He(r),[e]:""};return i&&(l.style=`${t}: ${i}`),[o,l,0]}}},ga="data-gs-mrk-fs",S0="data-gs-mrk-color",x0="data-gs-mrk-bgcolor",Zd="data-gs-mrk-wrap",is="data-gs-ifrg",tt="attrs",ws={[tt]:{default:"{}"}},$e={[tt]:{default:{}}},Cs=n=>({[tt]:JSON.stringify(Fn(n))}),ze=n=>({attrs:Fn(n)}),Mn=n=>e=>[n,e.attrs.attrs,0],He=n=>n.attrs[tt]?JSON.parse(n.attrs[tt]):{},w0={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${is}]`,getAttrs:ze}],toDOM:()=>["span",{[is]:""},0]},div:{group:"block",content:"inline*",attrs:$e,parseDOM:[{tag:"div",getAttrs:ze}],toDOM:Mn("div")},paragraph:{group:"block",content:"inline*",attrs:$e,parseDOM:[{tag:"p",getAttrs:ze}],toDOM:Mn("p")},orderedList:{group:"block",content:"listItem+",attrs:$e,parseDOM:[{tag:"ol",getAttrs:ze}],toDOM:Mn("ol")},bulletList:{group:"block",content:"listItem+",attrs:$e,parseDOM:[{tag:"ul",getAttrs:ze}],toDOM:Mn("ul")},listItem:{content:"block*",group:"block",attrs:$e,parseDOM:[{tag:"li",getAttrs:ze}],toDOM:Mn("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:$e,parseDOM:[{tag:"pre",getAttrs:ze}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:$e,parseDOM:[{tag:"img[src]",getAttrs:ze}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,attrs:$e,parseDOM:[{tag:"br",getAttrs:ze}],toDOM:n=>["br",{...n.attrs.attrs}]},hardBreak:{inline:!0,group:"inline",selectable:!1,attrs:$e,parseDOM:[{tag:"br",getAttrs:ze}],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]}},...F1({tableGroup:"block",cellContent:"block+",cellAttributes:{[tt]:{default:$e[tt].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]}}},An=(n,e)=>({attrs:ws,parseDOM:n.map(t=>({tag:t,getAttrs:Cs})),toDOM:e}),C0=n=>({attrs:{...ws},parseDOM:[{tag:`span[${n}]`,getAttrs:e=>({...Cs(e)})}],toDOM(e){return["span",{...He(e),[n]:!0},0]}}),k0={strong:An(["strong","b"],n=>["b",He(n)]),link:An(["a"],n=>["a",He(n),0]),em:An(["em","i"],n=>["em",He(n)]),underline:An(["u"],n=>["u",He(n),0]),strikethrough:An(["s"],n=>["s",He(n),0]),wrapStyle:C0(Zd),font_size:{attrs:{...ws,size:{default:null}},parseDOM:[{tag:`span[${ga}]`,getAttrs:n=>({...Cs(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...He(n),[ga]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}},color:Hr({key:S0,cssProperty:"color"}),bgColor:Hr({key:x0,cssProperty:"background-color"})},ya=new Hf({nodes:w0,marks:k0}),co=new WeakMap,Si=new WeakMap,E0=(n,e,t)=>{co.set(n,{view:e,gjsView:t,initialDoc:e.state.doc}),Si.set(e,{el:n,gjsView:t})},T0=(n,e)=>{co.delete(n),Si.delete(e)},zo=n=>co.get(n),Yd=n=>Si.get(n),ba=n=>{const e=zo(n),t=e==null?void 0:e.view,o=e==null?void 0:e.initialDoc;return!(t&&o&&o.eq(t.state.doc))},Zs=n=>{var e,t;return(t=(e=Yd(n))==null?void 0:e.gjsView)==null?void 0:t.model},M0=n=>n.dispatchEvent(new CustomEvent("input"));function A0(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(is)){if(t.getAttribute("style")){t.removeAttribute(is);return}const o=t.parentElement;if(o){for(;t.firstChild;)o.insertBefore(t.firstChild,t);o.removeChild(t)}}else Array.from(t.children).forEach(o=>e(o))};e(n)}const Xd=n=>{n.childNodes.forEach(e=>{if(e.nodeName==="BR"){const{nextSibling:t}=e,o=n.lastChild===e,s=(t==null?void 0:t.nodeType)===Node.ELEMENT_NODE&&(t==null?void 0:t.nodeName)!=="BR";(o||s)&&e.remove()}else Xd(e)})},P0=(n,e)=>{const t=Qd(n);return t&&F0(t)?O0(n,e):t?td(()=>({type:n.schema.nodes.div}))(n,e):!1},N0=(n,e)=>(t,o)=>{var l;const s=Qd(t),r=co.get(n.el).view,i=(l=e.onEnter)==null?void 0:l.call(e,{...n,node:s,commands:xi(r,n.editor,e),proseMirror:{view:r,dispatch:o}});return i!==void 0?i:P0(t,o)};function Qd(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 O0(n,e){const{selection:t,schema:o,tr:s}=n;s.split(t.from,1);const r=t.from+1,i=s.doc.nodeAt(r),l={...i.attrs.attrs,id:void 0},a=i.textContent.length>0,c=i.textContent.length||0,d=i.textContent||" ",p=o.text(d),u=o.nodes.div.create(l,a?p:[],[]);return s.replaceRangeWith(r,r+c+2,u),s.setSelection($.create(s.doc,r+1)),e==null||e(s.scrollIntoView()),!0}function I0(n,e,t){const{state:o,dispatch:s}=n,{selection:r,tr:i}=o,l=(a,c,d)=>{const p={};return a.split(";").forEach(u=>{const[h,f]=u.split(":").map(m=>m.trim());h&&(p[h]=f)}),p[c]=d,Object.entries(p).map(([u,h])=>`${u}: ${h}`).join("; ")};if(!r.empty||t)i.doc.nodesBetween(r.from,r.to,(a,c)=>{var d,p;if(a.type===o.schema.nodes.image){const u=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);i.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}else if(a.type.isBlock){const u=l(((p=a.attrs.attrs)==null?void 0:p.style)||"","text-align",e);ep(a)?i.setBlockType(r.from,void 0,o.schema.nodes.div,{attrs:{style:u}}):i.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}});else{const a=o.doc.resolve(r.from),c=a.start(a.depth),d=o.doc.nodeAt(c);if(d!=null&&d.type.isBlock){const p=l(d.attrs.style||"","text-align",e);i.setNodeMarkup(c,void 0,{...d.attrs,style:p})}}i.docChanged&&s(i.scrollIntoView())}const Pn=(n,e)=>{const{from:t,to:o}=n.selection;let s=!1;return n.doc.nodesBetween(t,o,r=>{if(s)return!1;r.marks.some(i=>i.type===e)&&(s=!0)}),s};function R0(n){var p,u;const{view:e,href:t,options:o,target:s="_blank"}=n,{state:r,dispatch:i}=e,{schema:l,selection:a,tr:c}=r,d=l.marks.link;try{const h={href:t,target:s},f=((u=(p=o.commandAttrs)==null?void 0:p.link)==null?void 0:u.call(p,h))||h,m=d.create({[tt]:JSON.stringify(f)});c.addMark(a.from,a.to,m),i(c.scrollIntoView())}catch(h){console.error("Error applying link mark:",h)}}function D0(n,e){const{state:t,dispatch:o}=n,{selection:s,tr:r}=t;if(s.empty)return;const i=t.schema.marks.font_size;if(!i){console.error("Font size mark is not defined in the schema.");return}r.addMark(s.from,s.to,i.create({size:e})),o(r.scrollIntoView())}function L0(n,e){const{state:t,dispatch:o}=n,{selection:s,tr:r}=t;if(s.empty)return;const i=t.schema.marks.color;if(!i){console.error("Color mark is not defined in the schema.");return}r.addMark(s.from,s.to,i.create({value:e})),o(r.scrollIntoView())}function $0(n,e){const{state:t,dispatch:o}=n,{selection:s,tr:r}=t;if(s.empty)return;const i=t.schema.marks.bgColor;if(!i){console.error("Background color mark is not defined in the schema.");return}r.addMark(s.from,s.to,i.create({value:e})),o(r.scrollIntoView())}const Nt=(n,e)=>{const{doc:t,selection:o}=n.state,s=t.resolve(o.from);for(let r=s.depth;r>0;r--){const i=s.node(r);if(e(i))return{pos:r>0?s.before(r):0,start:s.start(r),depth:r,node:i}}},z0=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,o])=>(t=t.replace(/-./g,s=>s.toUpperCase()[1]).trim(),e[t]=`${o}`.trim(),e),{});function V0(...n){return(e,t)=>{const o=i=>{e=e.apply(i),t==null||t(i)},s=n.pop();return n.reduce((i,l)=>i||l(e,o),!1)&&s!==void 0&&s(e,t)}}const B0=(n,e)=>{const{state:t,dispatch:o}=n;if(e!=null&&e.event){const{event:s}=e,r=n.posAtCoords({left:s.clientX,top:s.clientY});r!=null&&r.pos&&o(t.tr.setSelection($.create(t.doc,r.pos)))}else nd(t,o);setTimeout(()=>setTimeout(()=>n.focus()))},Fr=n=>n.isBlock,ep=n=>n.type.name==="inlineFragment",H0=n=>Fr(n)&&!ep(n),tp=n=>n.type.name==="bulletList",np=n=>n.type.name==="orderedList",F0=n=>n.type.name==="heading",_0=n=>tp(n)||np(n),va=(n,e)=>{var r,i;const t=(r=Nt(n,l=>l.type===e))==null?void 0:r.node,o=n.state.schema.nodes.listItem;let s;return t?s=kr(o):(i=Nt(n,_0))!=null&&i.node?s=V0(kr(o),El(e)):s=El(e),s(n.state,n.dispatch)},op=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(o=>o.type.name===e)},G0=n=>{var i;const{view:e,prop:t,editor:o,propCSS:s}=n,r=(i=Nt(e,H0))==null?void 0:i.node;if(r){const l=r.attrs.attrs||{},a=z0(l.style);if(t in a)return a[t]||"";if(l.id){const c=o.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[s]||""}}return""},Ys=n=>{const{view:e,prop:t,markName:o,editor:s,propCSS:r}=n,i=op(e,o);if(i){const l=i.attrs;if(l[t])return l[t];if(l[tt]){const a=He(i).id;if(a){const c=s.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[r]||""}}}return""},xi=(n,e,t)=>{const{dispatch:o}=n,{nodes:s,marks:r}=n.state.schema,i={text:{selected:()=>{const{selection:l,doc:a}=n.state;return a.textBetween(l.from,l.to," ")},replace:(l,a={})=>{const{state:c}=n,{from:d}=c.selection;let p=c.tr.replaceSelectionWith(c.schema.text(l));a.select&&(p=p.setSelection($.create(p.doc,d,d+l.length))),o==null||o(p)},replaceHtml:l=>{const{schema:a,selection:c,tr:d}=n.state,p=document.createElement("div");p.innerHTML=l;const u=Bt.fromSchema(a).parse(p),{from:h,to:f}=c;return o==null?void 0:o(d.replaceRangeWith(h,f,u).scrollIntoView())},wrapStyle:()=>{const l=Zs(n),a=i.text.selected(),c=`i${e.Components._createId().slice(0,4)}`;i.text.replaceHtml(`<span id="${c}" ${Zd}>${a}</span>`),l==null||l.trigger("disable"),setTimeout(()=>{const d=l==null?void 0:l.find(`#${c}`)[0];d&&e.select(d)})},createBreak:()=>{const{state:l}=n,a=l.tr.replaceSelectionWith(s.inlineBreak.create()).scrollIntoView();return o==null?void 0:o(a)}},bold:{toggle:()=>kt(r.strong)(n.state,o),isActive:()=>Pn(n.state,r.strong)},italic:{toggle:()=>kt(r.em)(n.state,o),isActive:()=>Pn(n.state,r.em)},underline:{toggle:()=>kt(r.underline)(n.state,o),isActive:()=>Pn(n.state,r.underline)},strikethrough:{toggle:()=>kt(r.strikethrough)(n.state,o),isActive:()=>Pn(n.state,r.strikethrough)},link:{get:()=>{const l=Zs(n),a=l==null?void 0:l.getTrait("href");if(l!=null&&l.is("link"))return l.getAttributes();if(a)return{href:a.getValue()};{const c=op(n,"link");return c?He(c):{}}},toggle:()=>kt(r.link)(n.state,o),isActive:()=>Pn(n.state,r.link),create:l=>{const a=Zs(n),c=a==null?void 0:a.getTrait("href"),{url:d,target:p}=l,u=()=>{var f,m;const h=(m=(f=Yd(n))==null?void 0:f.gjsView)==null?void 0:m.el;h&&h.contentEditable!=="true"&&(h.contentEditable="true"),n.focus()};a!=null&&a.is("link")?(a.addAttributes({href:d,target:p}),u()):c?(a==null||a.addAttributes({[c.getName()]:d}),u()):R0({view:n,href:d,target:p,options:t})}},alignText:{get:()=>G0({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:l=>I0(n,l.value,!0)},fontSize:{get:()=>Ys({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:l=>D0(n,l.value)},color:{get:()=>Ys({view:n,editor:e,markName:"color",prop:"value",propCSS:"color"}),set:l=>L0(n,l.value)},bgColor:{get:()=>Ys({view:n,editor:e,markName:"bgColor",prop:"value",propCSS:"background-color"}),set:l=>$0(n,l.value)},image:{open(){const l="assetLayout",{state:a,dispatch:c}=n,{selection:d,doc:p}=a,u=p.textBetween(d.from,d.to," "),h={id:l,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:f=>{const m={alt:u,src:f.asset.getSrc()};c(a.tr.replaceSelectionWith(s.image.createAndFill({attrs:m})))}}};e.runCommand(_.layoutToggle,h)}},heading:{get:()=>{var a;const l=(a=Nt(n,Fr))==null?void 0:a.node;return`${(l==null?void 0:l.attrs.level)||""}`},set:({value:l})=>{var d;const{state:a}=n,c=(d=Nt(n,Fr))==null?void 0:d.node;Rm(a.schema.nodes.heading,{attrs:c==null?void 0:c.attrs.attrs,level:l?parseInt(l,10):0})(a,o)}},listBullet:{isActive:()=>{var l;return!!((l=Nt(n,tp))!=null&&l.node)},toggle:()=>va(n,s.bulletList)},listOrdered:{isActive:()=>{var l;return!!((l=Nt(n,np))!=null&&l.node)},toggle:()=>va(n,s.orderedList)}};return i};class vt{constructor(e,t,o={}){this.match=e,this.match=e,this.handler=typeof t=="string"?W0(t):t,this.undoable=o.undoable!==!1,this.inCode=o.inCode||!1}}function W0(n){return function(e,t,o,s){let r=n;if(t[1]){let i=t[0].lastIndexOf(t[1]);r+=t[0].slice(i+t[1].length),o+=i;let l=o-s;l>0&&(r=t[0].slice(i-l,i)+r,o=s)}return e.tr.insertText(r,o,s)}}const j0=500;function q0({rules:n}){let e=new wn({state:{init(){return null},apply(t,o){let s=t.getMeta(this);return s||(t.selectionSet||t.docChanged?null:o)}},props:{handleTextInput(t,o,s,r){return Sa(t,o,s,r,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:o}=t.state.selection;o&&Sa(t,o.pos,o.pos,"",n,e)})}}},isInputRules:!0});return e}function Sa(n,e,t,o,s,r){if(n.composing)return!1;let i=n.state,l=i.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-j0),l.parentOffset,null,"")+o;for(let c=0;c<s.length;c++){let d=s[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let p=d.match.exec(a),u=p&&d.handler(i,p,e-(p[0].length-o.length),t);if(u)return d.undoable&&u.setMeta(r,{transform:u,from:e,to:t,text:o}),n.dispatch(u),!0}return!1}const U0=new vt(/--$/,"—"),K0=new vt(/\.\.\.$/,"…"),J0=new vt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Z0=new vt(/"$/,"”"),Y0=new vt(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),X0=new vt(/'$/,"’"),Q0=[J0,Z0,Y0,X0];function wi(n,e,t=null,o){return new vt(n,(s,r,i,l)=>{let a=t instanceof Function?t(r):t,c=s.tr.delete(i,l),d=c.doc.resolve(i),p=d.blockRange(),u=p&&Bc(p,e,a);if(!u)return null;c.wrap(p,u);let h=c.doc.resolve(i-1).nodeBefore;return h&&h.type==e&&gs(c.doc,i-1)&&(!o||o(r,h))&&c.join(i-1),c})}function sp(n,e,t=null){return new vt(n,(o,s,r,i)=>{let l=o.doc.resolve(r),a=t instanceof Function?t(s):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?o.tr.delete(r,i).setBlockType(r,r,e,a):null})}function ey(n){return wi(/^\s*>\s$/,n)}function ty(n){return wi(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function ny(n){return wi(/^\s*([-+*])\s$/,n)}function oy(n){return sp(/^```$/,n)}function sy(n,e){return sp(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function ry(n){const e=Q0.concat(K0,U0);let t;return(t=n.nodes.blockquote)&&e.push(ey(t)),(t=n.nodes.orderedList)&&e.push(ty(t)),(t=n.nodes.bulletList)&&e.push(ny(t)),(t=n.nodes.codeBlock)&&e.push(oy(t)),(t=n.nodes.heading)&&e.push(sy(t,6)),q0({rules:e})}const iy="rteProseMirror",ly=H.free,ae="rte:selectionchange",J={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>',color:'<svg viewBox="0 0 24 24"><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /></svg>',bgColor:'<svg viewBox="0 0 24 24"><path d="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z" /></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>'},xa=n=>({state:e})=>({type:"column",style:{alignItems:"center",background:"none"},children:[{type:"icon",icon:n,size:16},{type:"row",style:{width:16,height:2,backgroundColor:e.value||"currentColor",borderRadius:1}}]}),ay=(n,e)=>{var a;const{editor:t,el:o}=n,s=co.get(o).view,r=xi(s,t,e),i={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},wrapStyle:{id:"wrapper",type:"button",icon:"tag",tooltip:"Wrap for styling",editorEvents:{[ae]:({setState:c})=>{c({disabled:s.state.selection.empty})}},onClick:()=>r.text.wrapStyle()},bold:{id:"bold",icon:J.bold,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.bold.isActive()})}},onClick:({setState:c})=>{r.bold.toggle(),c({active:r.bold.isActive()})}},italic:{id:"italic",icon:J.italic,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.italic.isActive()})}},onClick:({setState:c})=>{r.italic.toggle(),c({active:r.italic.isActive()})}},underline:{id:"underline",icon:J.underline,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.underline.isActive()})}},onClick:({setState:c})=>{r.underline.toggle(),c({active:r.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:J.strikethrough,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.strikethrough.isActive()})}},onClick:({setState:c})=>{r.strikethrough.toggle(),c({active:r.strikethrough.isActive()})}},image:{id:"image",icon:J.image,size:"s",type:"button",onClick:()=>r.image.open()},link:{id:"link",icon:J.link,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.link.isActive(),disabled:s.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,p="linkLayout",u=()=>t.runCommand(_.layoutRemove,{id:p}),h=r.link.get(),f={id:p,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,target:d},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:m=>{m.preventDefault();const g=new FormData(m.currentTarget);r.link.create({url:g.get("url"),target:g.get("target")}),u()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(h==null?void 0:h.href)||"",onChange:({value:m,setState:g})=>g({value:m})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(h==null?void 0:h.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:m,setState:g})=>g({value:m})},{type:"row",style:{gap:10,justifyContent:"end"},children:[r.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{r.link.toggle(),u()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(_.layoutToggle,f)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:J.alignTextLeft},{id:"center",icon:J.alignTextCenter},{id:"right",icon:J.alignTextRight},{id:"justify",icon:J.alignTextJustify}],editorEvents:{[ae]:({setState:c})=>{c({value:r.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.alignText.set({value:c})}},alignTextMenu:{id:"alignTextMenu",type:"buttonMenu",size:"s",value:"",options:[{id:"left",icon:J.alignTextLeft},{id:"center",icon:J.alignTextCenter},{id:"right",icon:J.alignTextRight},{id:"justify",icon:J.alignTextJustify}],editorEvents:{[ae]:({setState:c})=>{c({value:r.alignText.get()})}},onOptionSelect:({option:c,state:d,setState:p})=>{const u=c.id===d.value?"":c.id;p({value:u}),r.alignText.set({value:u})},onClick:({state:c})=>{c.value&&r.alignText.set({value:c.value})}},listBullet:{id:"listBullet",icon:J.listBullet,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.listBullet.isActive()})}},onClick:({setState:c})=>{r.listBullet.toggle(),c({active:r.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:J.listOrdered,size:"s",type:"button",editorEvents:{[ae]:({setState:c})=>{c({active:r.listOrdered.isActive()})}},onClick:({setState:c})=>{r.listOrdered.toggle(),c({active:r.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:{[ae]:({setState:c})=>{c({value:r.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.heading.set({value:c}),s.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"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:{[ae]:({setState:c})=>{c({value:r.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.fontSize.set({value:c}),s.focus()}},color:{id:"color",type:"buttonMenu",size:"s",value:"",label:xa(J.color),editorEvents:{[ae]:({setState:c})=>{c({disabled:s.state.selection.empty})}},children:({state:c,setState:d})=>({type:"colorPicker",value:c.value||"",onChange:p=>{const{value:u}=p;d({value:u}),p.setState({value:u}),r.color.set({value:u}),s.focus()}}),onClick:({state:c})=>{c.value&&(r.color.set({value:c.value}),s.focus())}},bgColor:{id:"bgColor",type:"buttonMenu",size:"s",value:"",label:xa(J.bgColor),editorEvents:{[ae]:({setState:c})=>{c({disabled:s.state.selection.empty})}},children:({state:c,setState:d})=>({type:"colorPicker",value:c.value||"",onChange:p=>{const{value:u}=p;d({value:u}),p.setState({value:u}),r.bgColor.set({value:u}),s.focus()}}),onClick:({state:c})=>{c.value&&(r.bgColor.set({value:c.value}),s.focus())}}},l=[i.bold,i.italic,i.underline,i.strikethrough,i.image,i.link,i.listBullet,i.listOrdered,i.color,i.bgColor,i.alignTextMenu,i.heading,i.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:r,layouts:i,proseMirror:{view:s},items:l}))||l};class cy{constructor(e,t,o){this.editor=o,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(s=>{this.dom.setAttribute(s,e.attrs.attrs[s])}),this.dom.addEventListener("dblclick",s=>this.handleDoubleClick(s))}handleDoubleClick(e){const{editor:t,view:o}=this;xi(o,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=""}}const dy=function(n,e={}){const t={plugins:l=>l.plugins,...e},o=(l,a)=>{var g,b;const c=((g=t.schema)==null?void 0:g.call(t,{editor:n,schema:ya,createCustomMark:Hr}))||ya,{nodes:d,marks:p}=c,u={...a,component:a.view.model,editor:n,el:l};Xd(l);const h=Bt.fromSchema(c).parse(l),f=on.create({doc:h,schema:c,plugins:(b=t.plugins)==null?void 0:b.call(t,{editor:n,Plugin:wn,plugins:[c0(),v0(),ry(c),jm(),Gs({Tab:aa(1),"Shift-Tab":aa(-1)}),Gs({Enter:Yn(ed,Qm(d.listItem),N0(u,t)),"Shift-Enter":Yn(Qc,(w,y)=>(y&&y(w.tr.replaceSelectionWith(d.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":ad,"Mod-y":Cr,"Mod-Shift-z":Cr,"Mod-b":kt(p.strong),"Mod-i":kt(p.em),"Shift-Tab":kr(d.listItem),Tab:ng(d.listItem)}),Gs($m)]})}),m=new D1({mount:l},{state:f,dispatchTransaction(w){var x;const{state:y}=m,v=y.apply(w),C=!y.doc.eq(v.doc);m.updateState(v);const S=!y.selection.eq(v.selection);C&&(M0(((x=a==null?void 0:a.view)==null?void 0:x.el)||l),m.focus()),(S||C)&&n.trigger(ae)}});return l.__rteView=m,m.setProps({nodeViews:{image(w){return new cy(w,m,n)}}}),m},s=l=>ay(l,t);n.setCustomRte({toolbar:s,parseContent:!0,async enable(l,a,c){const d=zo(l);if(d)return d;const p=o(l,c);return E0(l,p,c.view),B0(p,c),p},disable(l){const a=zo(l),c=a==null?void 0:a.view;if(c){const d=ba(l);return T0(l,c),d||n.once(n.RichTextEditor.events.disable,()=>{a.gjsView.model.trigger("rerender")}),c.destroy(),{forceSync:d}}},getContent(l,a,c){var p;const d=(p=zo(l))==null?void 0:p.view;if(d){const{schema:u,doc:h}=d.state;if(!ba(l))return c.view.lastContent;const f=document.createElement("div"),m=Wt.fromSchema(u).serializeFragment(h.content);return m.childNodes.forEach(g=>{var b;g.nodeType===Node.ELEMENT_NODE&&(g.innerHTML===""?g.innerHTML="<br/>":((b=g.lastChild)==null?void 0:b.nodeName)==="BR"&&g.appendChild(document.createElement("br")))}),f.appendChild(m),A0(f),l.classList.remove("ProseMirror-focused"),f.innerHTML}return l.innerHTML}});const r=gc(n,t.enableOnClick),i=ff(n,t.disableOnEsc);W({editor:n,licenseKey:t.licenseKey,plan:ly,pluginName:iy,cleanup:()=>{n.RichTextEditor.customRte=void 0,r(),i()}})},py=G(dy),uy="canvasEmptyState",hy=H.startup,fy=function(n,e={}){const t=new WeakMap,o=new WeakMap,s=new WeakMap,r=new Set,i=new WeakMap,l={emptyStates:[],...e},a=(y,v)=>{let C=!1;const{isValid:S}=v;return Array.isArray(S)?C=S.some(x=>y.is(x)):_t(S)?C=S({component:y,editor:n}):C=y.is(S),C},c=y=>{const v=t.get(y);t.delete(y),v==null||v()},d=y=>{y.views.forEach(v=>c(v)),s.delete(y)},p=y=>{if(!(!y||r.has(y)))try{r.add(y);const v=y.components().length>0,C=s.get(y);if(v&&C)d(y);else if(!v&&!C){const S=i.has(y)?i.get(y):l.emptyStates.find(x=>a(y,x));if(i.set(y,S),!S)return;y.views.forEach(x=>{const E=S.render({editor:n,component:y,componentView:x,mount:k=>{o.set(x,k),s.set(y,!0);const M=x.getChildrenContainer();M==null||M.appendChild(k)},unmount:()=>c(x)});t.set(x,()=>{E==null||E();const k=o.get(x);k==null||k.remove()})})}}finally{r.delete(y)}},u=y=>{s.has(y)&&d(y)},h=({model:y})=>{p(y.getComponent())},f=n.Components.events,m=`${f.update}:components`,g="component:mount",b=n.Canvas.events.frameLoadBody,w=f.removed;n.on(m,p),n.on(g,p),n.on(w,u),n.on(b,h),W({editor:n,licenseKey:l.licenseKey,plan:hy,pluginName:uy,cleanup:()=>{n.off(m,p),n.off(g,p),n.off(w,u),n.off(b,h)}})},my=G(fy),wa="canvasFullSize",gy=H.startup,yy=(n,e)=>{const{rule:t,ruleView:o}=e,{style:s}=t.attributes;if(s&&s[n]){const r=s[n],i=/([0-9.]+)(vh|dvh|lvh|svh)/g,l=i.test(r),a=o.frameView.model;if(l&&a.hasAutoHeight()){const c=r.replace(i,(p,u)=>`${window.innerHeight*(parseFloat(u)/100)}px`),d=t.toCSS({style:{...s,[n]:c}});e.css=d}}},by=n=>{["height","min-height","max-height"].forEach(e=>yy(e,n))},vy=function(n,e={}){const{Canvas:t,Commands:o,Devices:s,Css:r}=n,i={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...e},{canvasOffsetY:l,canvasOffsetX:a,canvasTransition:c,deviceMaxWidth:d,deviceMinHeigth:p,deviceFixedHeight:u,frameBorderRadius:h,frameTransition:f}=i,m=`${p}px`,g=t.events,b="core:preview",w=`${o.events.stopCommand}${b}`,y=t.getConfig(),v=`${wa}:disable`,C=s.getAll().map(z=>({...z.attributes})),S=c*1e3,x={x:a,y:l};let E={},k,M;y.scrollableCanvas=!u,s.getAll().map(z=>{!z.get("width")&&z.set("width",`${d}px`),!z.get("height")&&z.set("height",u?"100vh":"auto"),!z.get("minHeight")&&z.set("minHeight",m)});const P=z=>{const he=`${Bo}canvas-full-size`,fe=document.querySelector(`style[${he}]`);if(z&&fe)return fe.remove();const Le=fe||document.createElement("style"),uo=t.getZoomMultiplier();Le.setAttribute(he,"true"),Le.innerHTML=`
|
|
917
|
-
.gjs-frame-wrapper { transition: width ${
|
|
918
|
-
.gjs-frame-wrapper__bottom { height: ${l*
|
|
919
|
-
.gjs-frame { border-radius: ${
|
|
920
|
-
`,!
|
|
907
|
+
}`,fs=new WeakMap,Yh=(n,e)=>{fs.set(n,e)},Zh=n=>{fs.delete(n)},Oi=n=>fs.get(n),ko=n=>{const e=n.target,t=e.closest(".tox"),o=e.matches(".ephox-snooker-resizer-bar");(t||o)&&n.stopPropagation()},pl=n=>{n.stopPropagation(),n.preventDefault()},Xh=(n,e)=>{const t=n.getDoc(),o=n.getWin();if(e!=null&&e.event){const{event:i}=e,{clientX:r,clientY:s}=i;let l;if(t.caretRangeFromPoint)l=t.caretRangeFromPoint(r,s);else if(t.caretPositionFromPoint){const a=t.caretPositionFromPoint(r,s);l=t.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=o.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),n.selection.setRng(l)}}else n.execCommand("SelectAll")},Qh=n=>{var c,d;const{el:e,editor:t,componentView:o}=n,i=t.runCommand(G.getStateTheme),r=o.model,s={target:e,inline:!0,skin:(i==null?void 0:i.theme)===tc.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:s,editor:t,componentView:o,component:r}))||{};return{...s,...l}},ul=(n,e=document)=>new Promise((t,o)=>{const i=Array.isArray(n)?[...n]:[n],{head:r}=e,s=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=s.bind(null,l),a.onerror=o,r.appendChild(a)}else t()};s(i)}),em=function(n,e={}){const t={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:o}=t,i=n.Canvas.events,r=!t.skipCustomTheme,s="gs-plg-tinymce-studio-theme",l=async(d,p)=>{const u=d.ownerDocument,f=u.defaultView,h=p==null?void 0:p.view;if(!f||!h){console.warn("Missing required data",{win:f,componentView:h});return}const g=Qh({el:d,editor:n,componentView:h,pluginOpts:t}),x=(await f.tinymce.init(g))[0];if(!x)return;const y=(await window.tinymce.init({...g,target:document.createElement("div")}))[0];return x.ui.show(),u.body.addEventListener("mousedown",ko),document.body.addEventListener("mousedown",ko),x.on("Change",()=>qh(d)),x.on("blur",()=>x.ui.show()),x.on("OpenWindow",function(){var w;const v=(w=u.querySelector(".tox-dialog"))==null?void 0:w.closest(".tox");v&&(v==null?void 0:v.ownerDocument)!==document&&(document.body.appendChild(v),x.once("CloseWindow",()=>{v&&v.ownerDocument===document&&u.body.appendChild(v)}))}),d.addEventListener("dragstart",pl,{capture:!0}),n.runCommand(G.setStateContextMenu,{enabled:!1}),Xh(x,p),{rteEditor:x,rteEditorShallow:y}},a=(d,p)=>{d.ownerDocument.body.removeEventListener("mousedown",ko),document.body.removeEventListener("mousedown",ko),d.removeEventListener("dragstart",pl,{capture:!0}),n.runCommand(G.setStateContextMenu,{enabled:!0}),p.rteEditor.destroy(),p.rteEditorShallow.destroy()};n.on(i.frameLoad,async({window:d})=>{const p=d.document;ul(o,p)}),n.onReady(()=>{ul(o,document),r&&ls(s,Jh,{target:document.body})}),n.setCustomRte({parseContent:!0,async enable(d,p,u){const f=Oi(d);if(f)return f.rteEditor;const h=await l(d,u);return h&&Yh(d,h),h==null?void 0:h.rteEditor},disable(d){const p=Oi(d);p&&(Zh(d),a(d,p))},getContent(d,p,u){var g;const f=Oi(d),h=f==null?void 0:f.rteEditor;return h&&!h.isDirty()?u.view.lastContent:h?(g=h.getContent)==null?void 0:g.call(h):d.innerHTML}});const c=Wc(n,t.enableOnClick);q({editor:n,licenseKey:t.licenseKey,plan:Kh,pluginName:qc,cleanup:()=>{n.RichTextEditor.customRte=void 0,c()}})},tm=W(em,qc);function ee(n){this.content=n}ee.prototype={constructor:ee,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 o=t&&t!=n?this.remove(t):this,i=o.find(n),r=o.content.slice();return i==-1?r.push(t||n,e):(r[i+1]=e,t&&(r[i]=t)),new ee(r)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ee(t)},addToStart:function(n,e){return new ee([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ee(t)},addBefore:function(n,e,t){var o=this.remove(e),i=o.content.slice(),r=o.find(n);return i.splice(r==-1?i.length:r,0,e,t),new ee(i)},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=ee.from(n),n.size?new ee(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ee.from(n),n.size?new ee(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ee.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}};ee.from=function(n){if(n instanceof ee)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ee(e)};function Uc(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(o),r=e.child(o);if(i==r){t+=i.nodeSize;continue}if(!i.sameMarkup(r))return t;if(i.isText&&i.text!=r.text){for(let s=0;i.text[s]==r.text[s];s++)t++;return t}if(i.content.size||r.content.size){let s=Uc(i.content,r.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Kc(n,e,t,o){for(let i=n.childCount,r=e.childCount;;){if(i==0||r==0)return i==r?null:{a:t,b:o};let s=n.child(--i),l=e.child(--r),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;c<d&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let c=Kc(s.content,l.content,t-1,o-1);if(c)return c}t-=a,o-=a}}class M{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,i=0,r){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&o(a,i+l,r||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,i){let r="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&o&&(s?s=!1:r+=o),r+=c},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,i=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(o)&&(i[i.length-1]=t.withText(t.text+o.text),r=1);r<e.content.length;r++)i.push(e.content[r]);return new M(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],i=0;if(t>e)for(let r=0,s=0;s<t;r++){let l=this.content[r],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),i+=l.nodeSize),s=a}return new M(o,i)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let i=this.content.slice(),r=this.size+t.nodeSize-o.nodeSize;return i[e]=t,new M(i,r)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(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,o=0;t<this.content.length;t++){let i=this.content[t];e(i,o,t),o+=i.nodeSize}}findDiffStart(e,t=0){return Uc(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return Kc(this,e,t,o)}findIndex(e,t=-1){if(e==0)return To(0,e);if(e==this.size)return To(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,i=0;;o++){let r=this.child(o),s=i+r.nodeSize;if(s>=e)return s==e||t>0?To(o+1,s):To(o,i);i=s}}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 M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,o=0;for(let i=0;i<e.length;i++){let r=e[i];o+=r.nodeSize,i&&r.isText&&e[i-1].sameMarkup(r)?(t||(t=e.slice(0,i)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new M(t||e,o)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Ii={index:0,offset:0};function To(n,e){return Ii.index=n,Ii.offset=e,Ii}function Jo(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 o=0;o<n.length;o++)if(!Jo(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Jo(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class H{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let i=0;i<e.length;i++){let r=e[i];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,i));else{if(r.type.excludes(this.type))return e;!o&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),o=!0),t&&t.push(r)}}return t||(t=e.slice()),o||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&&Jo(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 o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=o.create(t.attrs);return o.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return H.none;if(e instanceof H)return[e];let t=e.slice();return t.sort((o,i)=>o.type.rank-i.type.rank),t}}H.none=[];class Yo extends Error{}class j{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=Yc(this.content,e+this.openStart,t);return o&&new j(o,this.openStart,this.openEnd)}removeBetween(e,t){return new j(Jc(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 j.empty;let o=t.openStart||0,i=t.openEnd||0;if(typeof o!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new j(M.fromJSON(e,t.content),o,i)}static maxOpen(e,t=!0){let o=0,i=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)o++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)i++;return new j(e,o,i)}}j.empty=new j(M.empty,0,0);function Jc(n,e,t){let{index:o,offset:i}=n.findIndex(e),r=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(i==e||r.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,r.copy(Jc(r.content,e-i-1,t-i-1)))}function Yc(n,e,t,o){let{index:i,offset:r}=n.findIndex(e),s=n.maybeChild(i);if(r==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Yc(s.content,e-r-1,t);return l&&n.replaceChild(i,s.copy(l))}function nm(n,e,t){if(t.openStart>n.depth)throw new Yo("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Yo("Inconsistent open depths");return Zc(n,e,t,0)}function Zc(n,e,t,o){let i=n.index(o),r=n.node(o);if(i==e.index(o)&&o<n.depth-t.openStart){let s=Zc(n,e,t,o+1);return r.copy(r.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return zt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=om(t,n);return zt(r,Qc(n,s,l,e,o))}else return zt(r,Zo(n,e,o))}function Xc(n,e){if(!e.type.compatibleContent(n.type))throw new Yo("Cannot join "+e.type.name+" onto "+n.type.name)}function Mr(n,e,t){let o=n.node(t);return Xc(o,e.node(t)),o}function Dt(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 Hn(n,e,t,o){let i=(e||n).node(t),r=0,s=e?e.index(t):i.childCount;n&&(r=n.index(t),n.depth>t?r++:n.textOffset&&(Dt(n.nodeAfter,o),r++));for(let l=r;l<s;l++)Dt(i.child(l),o);e&&e.depth==t&&e.textOffset&&Dt(e.nodeBefore,o)}function zt(n,e){return n.type.checkContent(e),n.copy(e)}function Qc(n,e,t,o,i){let r=n.depth>i&&Mr(n,e,i+1),s=o.depth>i&&Mr(t,o,i+1),l=[];return Hn(null,n,i,l),r&&s&&e.index(i)==t.index(i)?(Xc(r,s),Dt(zt(r,Qc(n,e,t,o,i+1)),l)):(r&&Dt(zt(r,Zo(n,e,i+1)),l),Hn(e,t,i,l),s&&Dt(zt(s,Zo(t,o,i+1)),l)),Hn(o,null,i,l),new M(l)}function Zo(n,e,t){let o=[];if(Hn(null,n,t,o),n.depth>t){let i=Mr(n,e,t+1);Dt(zt(i,Zo(n,e,t+1)),o)}return Hn(e,null,t,o),new M(o)}function om(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)i=e.node(r).copy(M.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Qn{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,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 o=this.pos-this.path[this.path.length-1],i=e.child(t);return o?e.child(t).cut(o):i}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 o=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)i+=o.child(r).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return H.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),i=e.maybeChild(t);if(!o){let l=o;o=i,i=l}let r=o.marks;for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,i=e.parent.maybeChild(e.index());for(var r=0;r<o.length;r++)o[r].type.spec.inclusive===!1&&(!i||!o[r].isInSet(i.marks))&&(o=o[r--].removeFromSet(o));return o}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 o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Xo(this,e,o);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 o=[],i=0,r=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(r),c=r-a;if(o.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;r=c-1,i+=a+1}return new Qn(t,o,r)}static resolveCached(e,t){let o=fl.get(e);if(o)for(let r=0;r<o.elts.length;r++){let s=o.elts[r];if(s.pos==t)return s}else fl.set(e,o=new im);let i=o.elts[o.i]=Qn.resolve(e,t);return o.i=(o.i+1)%rm,i}}class im{constructor(){this.elts=[],this.i=0}}const rm=12,fl=new WeakMap;class Xo{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}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 sm=Object.create(null);let Rt=class Ar{constructor(e,t,o,i=H.none){this.type=e,this.attrs=t,this.marks=i,this.content=o||M.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,o,i=0){this.content.nodesBetween(e,t,o,i,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,o,i){return this.content.textBetween(e,t,o,i)}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,o){return this.type==e&&Jo(this.attrs,t||e.defaultAttrs||sm)&&H.sameSet(this.marks,o||H.none)}copy(e=null){return e==this.content?this:new Ar(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ar(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,o=!1){if(e==t)return j.empty;let i=this.resolve(e),r=this.resolve(t),s=o?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,r.pos-l);return new j(c,i.depth-s,r.depth-s)}replace(e,t,o){return nm(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let i=this.content.child(t-1);return{node:i,index:t-1,offset:o-i.nodeSize}}resolve(e){return Qn.resolveCached(this,e)}resolveNoCache(e){return Qn.resolve(this,e)}rangeHasMark(e,t,o){let i=!1;return t>e&&this.nodesBetween(e,t,r=>(o.isInSet(r.marks)&&(i=!0),!i)),i}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()+")"),ed(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,o=M.empty,i=0,r=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,i,r),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<r;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,i){if(i&&!this.type.allowsMarks(i))return!1;let r=this.contentMatchAt(e).matchType(o),s=r&&r.matchFragment(this.content,t);return s?s.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=H.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!H.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 o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=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,o)}let i=M.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,i,o);return r.type.checkAttrs(r.attrs),r}};Rt.prototype.text=void 0;class Qo extends Rt{constructor(e,t,o,i){if(super(e,t,null,i),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ed(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 Qo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Qo(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 ed(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ft{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new lm(e,t);if(o.next==null)return Ft.empty;let i=td(o);o.next&&o.err("Unexpected trailing text");let r=hm(fm(i));return mm(r,o),r}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,o=e.childCount){let i=this;for(let r=t;i&&r<o;r++)i=i.matchType(e.child(r).type);return i}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 o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let i=[this];function r(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:p}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let u=r(p,l.concat(d));if(u)return u}}return null}return r(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let i=o.shift(),r=i.match;if(r.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<r.next.length;s++){let{type:l,next:a}=r.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:i}),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(o){e.push(o);for(let i=0;i<o.next.length;i++)e.indexOf(o.next[i].next)==-1&&t(o.next[i].next)}return t(this),e.map((o,i)=>{let r=i+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)r+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return r}).join(`
|
|
908
|
+
`)}}Ft.empty=new Ft(!0);class lm{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 td(n){let e=[];do e.push(am(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function am(n){let e=[];do e.push(cm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cm(n){let e=um(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=dm(n,e);else break;return e}function hl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function dm(n,e){let t=hl(n),o=t;return n.eat(",")&&(n.next!="}"?o=hl(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function pm(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let i=[];for(let r in t){let s=t[r];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function um(n){if(n.eat("(")){let e=td(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=pm(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 fm(n){let e=[[]];return i(r(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function r(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(r(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=r(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return o(l,a),i(r(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return i(r(s.expr,l),a),i(r(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(r(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=t();i(r(s.expr,a),d),a=d}if(s.max==-1)i(r(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=t();o(a,d),i(r(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function nd(n,e){return e-n}function ml(n,e){let t=[];return o(e),t.sort(nd);function o(i){let r=n[i];if(r.length==1&&!r[0].term)return o(r[0].to);t.push(i);for(let s=0;s<r.length;s++){let{term:l,to:a}=r[s];!l&&t.indexOf(a)==-1&&o(a)}}}function hm(n){let e=Object.create(null);return t(ml(n,0));function t(o){let i=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);ml(n,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let r=e[o.join(",")]=new Ft(o.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(nd);r.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return r}}function mm(n,e){for(let t=0,o=[n];t<o.length;t++){let i=o[t],r=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),r&&!(a.isText||a.hasRequiredAttrs())&&(r=!1),o.indexOf(c)==-1&&o.push(c)}r&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function od(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function id(n,e){let t=Object.create(null);for(let o in n){let i=e&&e[o];if(i===void 0){let r=n[o];if(r.hasDefault)i=r.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=i}return t}function rd(n,e,t,o){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let r=n[i];r.validate&&r.validate(e[i])}}function sd(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new bm(n,o,e[o]);return t}let gl=class ld{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=sd(e,o.attrs),this.defaultAttrs=od(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ft.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:id(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Rt(this,this.computeAttrs(e),M.from(t),H.setFrom(o))}createChecked(e=null,t,o){return t=M.from(t),this.checkContent(t),new Rt(this,this.computeAttrs(e),t,H.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=M.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),r=i&&i.fillBefore(M.empty,!0);return r?new Rt(this,e,t.append(r),H.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){rd(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 o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:H.none:e}static compile(e,t){let o=Object.create(null);e.forEach((r,s)=>o[r]=new ld(r,t,s));let i=t.spec.topNode||"doc";if(!o[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let r in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function gm(n,e,t){let o=t.split("|");return i=>{let r=i===null?"null":typeof i;if(o.indexOf(r)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${r}`)}}class bm{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?gm(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class yi{constructor(e,t,o,i){this.name=e,this.rank=t,this.schema=o,this.spec=i,this.attrs=sd(e,i.attrs),this.excluded=null;let r=od(this.attrs);this.instance=r?new H(this,r):null}create(e=null){return!e&&this.instance?this.instance:new H(this,id(this.attrs,e))}static compile(e,t){let o=Object.create(null),i=0;return e.forEach((r,s)=>o[r]=new yi(r,i++,t,s)),o}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){rd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ym{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=ee.from(e.nodes),t.marks=ee.from(e.marks||{}),this.nodes=gl.compile(this.spec.nodes,this),this.marks=yi.compile(this.spec.marks,this);let o=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let r=this.nodes[i],s=r.spec.content||"",l=r.spec.marks;if(r.contentMatch=o[s]||(o[s]=Ft.parse(s,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=l=="_"?null:l?bl(this,l.split(" ")):l==""||!r.inlineContent?[]:null}for(let i in this.marks){let r=this.marks[i],s=r.spec.excludes;r.excluded=s==null?[r]:s==""?[]:bl(this,s.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,o,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof gl){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,o,i)}text(e,t){let o=this.nodes.text;return new Qo(o,o.defaultAttrs,e,H.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Rt.fromJSON(this,e)}markFromJSON(e){return H.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function bl(n,e){let t=[];for(let o=0;o<e.length;o++){let i=e[o],r=n.marks[i],s=r;if(r)t.push(r);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function xm(n){return n.tag!=null}function vm(n){return n.style!=null}class _t{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(i=>{if(xm(i))this.tags.push(i);else if(vm(i)){let r=/[^=]*/.exec(i.style)[0];o.indexOf(r)<0&&o.push(r),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let r=e.nodes[i.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let o=new xl(this,t,!1);return o.addAll(e,H.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new xl(this,t,!0);return o.addAll(e,H.none,t.from,t.to),j.maxOpen(o.finish())}matchTag(e,t,o){for(let i=o?this.tags.indexOf(o)+1:0;i<this.tags.length;i++){let r=this.tags[i];if(Cm(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let s=r.getAttrs(e);if(s===!1)continue;r.attrs=s||void 0}return r}}}matchStyle(e,t,o,i){for(let r=i?this.styles.indexOf(i)+1:0;r<this.styles.length;r++){let s=this.styles[r],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(i){let r=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<r)break}t.splice(s,0,i)}for(let i in e.marks){let r=e.marks[i].spec.parseDOM;r&&r.forEach(s=>{o(s=vl(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let r=e.nodes[i].spec.parseDOM;r&&r.forEach(s=>{o(s=vl(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _t(e,_t.schemaRules(e)))}}const ad={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},wm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cd={ol:!0,ul:!0},ei=1,ti=2,Fn=4;function yl(n,e,t){return e!=null?(e?ei:0)|(e==="full"?ti:0):n&&n.whitespace=="pre"?ei|ti:t&~Fn}class Eo{constructor(e,t,o,i,r,s){this.type=e,this.attrs=t,this.marks=o,this.solid=i,this.options=s,this.content=[],this.activeMarks=H.none,this.match=r||(s&Fn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,i;return(i=o.findWrapping(e.type))?(this.match=o,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ei)){let o=this.content[this.content.length-1],i;if(o&&o.isText&&(i=/[ \t\r\n\u000c]+$/.exec(o.text))){let r=o;o.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-i[0].length))}}let t=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.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&&!ad.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class xl{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0;let i=t.topNode,r,s=yl(null,t.preserveWhitespace,0)|(o?Fn:0);i?r=new Eo(i.type,i.attrs,H.none,!0,t.topMatch||i.type.contentMatch,s):o?r=new Eo(null,null,H.none,!0,null,s):r=new Eo(e.schema.topNodeType,null,H.none,!0,null,s),this.nodes=[r],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 o=e.nodeValue,i=this.top;if(i.options&ti||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i.options&ei)i.options&ti?o=o.replace(/\r\n?/g,`
|
|
909
|
+
`):o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let r=i.content[i.content.length-1],s=e.previousSibling;(!r||s&&s.nodeName=="BR"||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let i=e.nodeName.toLowerCase(),r;cd.hasOwnProperty(i)&&this.parser.normalizeLists&&Sm(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,o));if(s?s.ignore:wm.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(ad.hasOwnProperty(i))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=s&&s.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,s,l,s.consuming===!1?r:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
910
|
+
`),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 o=e.style;if(o&&o.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let r=this.parser.matchedStyles[i],s=o.getPropertyValue(r);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(r,s,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,o,i){let r,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o)||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(r=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,o,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o));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,o),this.findAround(e,a,!1)}r&&this.sync(l)&&this.open--}addAll(e,t,o,i){let r=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(s,t);this.findAtPoint(e,r)}findPlace(e,t){let o,i;for(let r=this.open;r>=0;r--){let s=this.nodes[r],l=s.findWrapping(e);if(l&&(!o||o.length>l.length)&&(o=l,i=s,!l.length)||s.solid)break}if(!o)return null;this.sync(i);for(let r=0;r<o.length;r++)t=this.enterInner(o[r],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let o=this.findPlace(e,t);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let r=H.none;for(let s of o.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):wl(s.type,e.type))&&(r=s.addToSet(r));return i.content.push(e.mark(r)),!0}return!1}enter(e,t,o,i){let r=this.findPlace(e.create(t),o);return r&&(r=this.enterInner(e,t,o,!0,i)),r}enterInner(e,t,o,i=!1,r){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=yl(e,r,s.options);s.options&Fn&&s.content.length==0&&(l|=Fn);let a=H.none;return o=o.filter(c=>(s.type?s.type.allowsMarkType(c.type):wl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Eo(e,t,a,i,null,l)),this.open++,o}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 o=this.nodes[t].content;for(let i=o.length-1;i>=0;i--)e+=o[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].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,o){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(o?2:4)&&(this.find[i].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("/"),o=this.options.context,i=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),r=-(o?o.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=r;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:o&&a>=r?o.node(a-r).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function Sm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&cd.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function Cm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function vl(n){let e={};for(let t in n)e[t]=n[t];return e}function wl(n,e){let t=e.schema.nodes;for(let o in t){let i=t[o];if(!i.allowsMarkType(n))continue;let r=[],s=l=>{r.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||r.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}class Ut{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Di(t).createDocumentFragment());let i=o,r=[];return e.forEach(s=>{if(r.length||s.marks.length){let l=0,a=0;for(;l<r.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(r[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<r.length;)i=r.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],d=this.serializeMark(c,s.isInline,t);d&&(r.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:i}=zo(Di(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let r=this.serializeMark(e.marks[i],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(o),o=r.dom)}return o}serializeMark(e,t,o={}){let i=this.marks[e.type.name];return i&&zo(Di(o),i(e,t),null,e.attrs)}static renderSpec(e,t,o=null,i){return zo(e,t,o,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ut(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Sl(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Sl(e.marks)}}function Sl(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Di(n){return n.document||window.document}const Cl=new WeakMap;function km(n){let e=Cl.get(n);return e===void 0&&Cl.set(n,e=Tm(n)),e}function Tm(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let i=0;i<o.length;i++)t(o[i]);else for(let i in o)t(o[i])}return t(n),e}function zo(n,e,t,o){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 i=e[0],r;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(r=km(o))&&r.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 s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let p in c)if(c[p]!=null){let u=p.indexOf(" ");u>0?a.setAttributeNS(p.slice(0,u),p.slice(u+1),c[p]):a.setAttribute(p,c[p])}}for(let p=d;p<e.length;p++){let u=e[p];if(u===0){if(p<e.length-1||p>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:h}=zo(n,u,t,o);if(a.appendChild(f),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}const dd=65535,pd=Math.pow(2,16);function Em(n,e){return n+e*pd}function kl(n){return n&dd}function Mm(n){return(n-(n&dd))/pd}const ud=1,fd=2,Ro=4,hd=8;class jr{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&hd)>0}get deletedBefore(){return(this.delInfo&(ud|Ro))>0}get deletedAfter(){return(this.delInfo&(fd|Ro))>0}get deletedAcross(){return(this.delInfo&Ro)>0}}class Se{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Se.empty)return Se.empty}recover(e){let t=0,o=kl(e);if(!this.inverted)for(let i=0;i<o;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[o*3]+t+Mm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let i=0,r=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+r],d=this.ranges[l+s],p=a+c;if(e<=p){let u=c?e==a?-1:e==p?1:t:t,f=a+i+(u<0?0:d);if(o)return f;let h=e==(t<0?a:p)?null:Em(l/3,e-a),g=e==a?fd:e==p?ud:Ro;return(t<0?e!=a:e!=p)&&(g|=hd),new jr(f,g,h)}i+=d-c}return o?e+i:new jr(e+i,0,null)}touches(e,t){let o=0,i=kl(t),r=this.inverted?2:1,s=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+r],d=a+c;if(e<=d&&l==i*3)return!0;o+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let i=0,r=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?r:0),a=s+(this.inverted?0:r),c=this.ranges[i+t],d=this.ranges[i+o];e(l,l+c,a,a+d),r+=d-c}}invert(){return new Se(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Se.empty:new Se(e<0?[0,-e,0]:[0,0,e])}}Se.empty=new Se([]);class un{constructor(e=[],t,o=0,i=e.length){this.maps=e,this.mirror=t,this.from=o,this.to=i}slice(e=0,t=this.maps.length){return new un(this.maps,this.mirror,e,t)}copy(){return new un(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,o=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?o+i: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,o=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?o-i-1:void 0)}}invert(){let e=new un;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this.maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let i=0;for(let r=this.from;r<this.to;r++){let s=this.maps[r],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(r);if(a!=null&&a>r&&a<this.to){r=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return o?e:new jr(e,i,null)}}const zi=Object.create(null);class le{getMap(){return Se.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=zi[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in zi)throw new RangeError("Duplicate use of step JSON ID "+e);return zi[e]=t,t.prototype.jsonID=e,t}}class Y{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Y(e,null)}static fail(e){return new Y(null,e)}static fromReplace(e,t,o,i){try{return Y.ok(e.replace(t,o,i))}catch(r){if(r instanceof Yo)return Y.fail(r.message);throw r}}}function hs(n,e,t){let o=[];for(let i=0;i<n.childCount;i++){let r=n.child(i);r.content.size&&(r=r.copy(hs(r.content,e,r))),r.isInline&&(r=e(r,t,i)),o.push(r)}return M.fromArray(o)}class ut extends le{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),i=o.node(o.sharedDepth(this.to)),r=new j(hs(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return Y.fromReplace(e,this.from,this.to,r)}invert(){return new Ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new ut(t.pos,o.pos,this.mark)}merge(e){return e instanceof ut&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ut(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 ut(t.from,t.to,e.markFromJSON(t.mark))}}le.jsonID("addMark",ut);class Ge extends le{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new j(hs(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Y.fromReplace(e,this.from,this.to,o)}invert(){return new ut(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Ge(t.pos,o.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(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 Ge(t.from,t.to,e.markFromJSON(t.mark))}}le.jsonID("removeMark",Ge);class ft extends le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Y.fromReplace(e,this.pos,this.pos+1,new j(M.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(o))return new ft(this.pos,t.marks[i]);return new ft(this.pos,this.mark)}}return new yn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ft(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 ft(t.pos,e.markFromJSON(t.mark))}}le.jsonID("addNodeMark",ft);class yn extends le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Y.fromReplace(e,this.pos,this.pos+1,new j(M.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ft(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yn(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 yn(t.pos,e.markFromJSON(t.mark))}}le.jsonID("removeNodeMark",yn);class re extends le{constructor(e,t,o,i=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=i}apply(e){return this.structure&&$r(e,this.from,this.to)?Y.fail("Structure replace would overwrite content"):Y.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Se([this.from,this.to-this.from,this.slice.size])}invert(e){return new re(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new re(t.pos,Math.max(t.pos,o.pos),this.slice)}merge(e){if(!(e instanceof re)||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?j.empty:new j(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new re(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?j.empty:new j(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new re(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 re(t.from,t.to,j.fromJSON(e,t.slice),!!t.structure)}}le.jsonID("replace",re);class oe extends le{constructor(e,t,o,i,r,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=i,this.slice=r,this.insert=s,this.structure=l}apply(e){if(this.structure&&($r(e,this.from,this.gapFrom)||$r(e,this.gapTo,this.to)))return Y.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Y.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?Y.fromReplace(e,this.from,this.to,o):Y.fail("Content does not fit in gap")}getMap(){return new Se([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 oe(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),o=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||i<t.pos||r>o.pos?null:new oe(t.pos,o.pos,i,r,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 oe(t.from,t.to,t.gapFrom,t.gapTo,j.fromJSON(e,t.slice),t.insert,!!t.structure)}}le.jsonID("replaceAround",oe);function $r(n,e,t){let o=n.resolve(e),i=t-e,r=o.depth;for(;i>0&&r>0&&o.indexAfter(r)==o.node(r).childCount;)r--,i--;if(i>0){let s=o.node(r).maybeChild(o.indexAfter(r));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Am(n,e,t,o){let i=[],r=[],s,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let p=a.marks;if(!o.isInSet(p)&&d.type.allowsMarkType(o.type)){let u=Math.max(c,e),f=Math.min(c+a.nodeSize,t),h=o.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(h)||(s&&s.to==u&&s.mark.eq(p[g])?s.to=f:i.push(s=new Ge(u,f,p[g])));l&&l.to==u?l.to=f:r.push(l=new ut(u,f,o))}}),i.forEach(a=>n.step(a)),r.forEach(a=>n.step(a))}function jm(n,e,t,o){let i=[],r=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;r++;let a=null;if(o instanceof yi){let c=s.marks,d;for(;d=o.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let p=a[d],u;for(let f=0;f<i.length;f++){let h=i[f];h.step==r-1&&p.eq(i[f].style)&&(u=h)}u?(u.to=c,u.step=r):i.push({style:p,from:Math.max(l,e),to:c,step:r})}}}),i.forEach(s=>n.step(new Ge(s.from,s.to,s.style)))}function ms(n,e,t,o=t.contentMatch,i=!0){let r=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<r.childCount;a++){let c=r.child(a),d=l+c.nodeSize,p=o.matchType(c.type);if(!p)s.push(new re(l,d,j.empty));else{o=p;for(let u=0;u<c.marks.length;u++)t.allowsMarkType(c.marks[u].type)||n.step(new Ge(l,d,c.marks[u]));if(i&&c.isText&&t.whitespace!="pre"){let u,f=/\r?\n|\r/g,h;for(;u=f.exec(c.text);)h||(h=new j(M.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new re(l+u.index,l+u.index+u[0].length,h))}}l=d}if(!o.validEnd){let a=o.fillBefore(M.empty,!0);n.replace(l,l,new j(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function $m(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function xi(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth;;--o){let i=n.$from.node(o),r=n.$from.index(o),s=n.$to.indexAfter(o);if(o<n.depth&&i.canReplace(r,s,t))return o;if(o==0||i.type.spec.isolating||!$m(i,r,s))break}return null}function Pm(n,e,t){let{$from:o,$to:i,depth:r}=e,s=o.before(r+1),l=i.after(r+1),a=s,c=l,d=M.empty,p=0;for(let h=r,g=!1;h>t;h--)g||o.index(h)>0?(g=!0,d=M.from(o.node(h).copy(d)),p++):a--;let u=M.empty,f=0;for(let h=r,g=!1;h>t;h--)g||i.after(h+1)<i.end(h)?(g=!0,u=M.from(i.node(h).copy(u)),f++):c++;n.step(new oe(a,c,s,l,new j(d.append(u),p,f),d.size-p,!0))}function md(n,e,t=null,o=n){let i=Nm(n,e),r=i&&Om(o,e);return r?i.map(Tl).concat({type:e,attrs:t}).concat(r.map(Tl)):null}function Tl(n){return{type:n,attrs:null}}function Nm(n,e){let{parent:t,startIndex:o,endIndex:i}=n,r=t.contentMatchAt(o).findWrapping(e);if(!r)return null;let s=r.length?r[0]:e;return t.canReplaceWith(o,i,s)?r:null}function Om(n,e){let{parent:t,startIndex:o,endIndex:i}=n,r=t.child(o),s=e.contentMatch.findWrapping(r.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=o;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Im(n,e,t){let o=M.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=M.from(t[s].type.create(t[s].attrs,o))}let i=e.start,r=e.end;n.step(new oe(i,r,i,r,new j(o,0,0),t.length,!0))}function Dm(n,e,t,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(o,a)&&zm(n.doc,n.mapping.slice(r).map(l),o)){let c=null;if(o.schema.linebreakReplacement){let f=o.whitespace=="pre",h=!!o.contentMatch.matchType(o.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&bd(n,s,l,r),ms(n,n.mapping.slice(r).map(l,1),o,void 0,c===null);let d=n.mapping.slice(r),p=d.map(l,1),u=d.map(l+s.nodeSize,1);return n.step(new oe(p,u,p+1,u-1,new j(M.from(o.create(a,null,s.marks)),0,0),1,!0)),c===!0&&gd(n,s,l,r),!1}})}function gd(n,e,t,o){e.forEach((i,r)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(o).map(t+1+r+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function bd(n,e,t,o){e.forEach((i,r)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+r);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
911
|
+
`))}})}function zm(n,e,t){let o=n.resolve(e),i=o.index();return o.parent.canReplaceWith(i,i+1,t)}function Rm(n,e,t,o,i){let r=n.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let s=t.create(o,null,i||r.marks);if(r.isLeaf)return n.replaceWith(e,e+r.nodeSize,s);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new oe(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new j(M.from(s),0,0),1,!0))}function fn(n,e,t=1,o){let i=n.resolve(e),r=i.depth-t,s=o&&o[o.length-1]||i.parent;if(r<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>r;c--,d--){let p=i.node(c),u=i.index(c);if(p.type.spec.isolating)return!1;let f=p.content.cutByIndex(u,p.childCount),h=o&&o[d+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let g=o&&o[d]||p;if(!p.canReplace(u+1,p.childCount)||!g.type.validContent(f))return!1}let l=i.indexAfter(r),a=o&&o[0];return i.node(r).canReplaceWith(l,l,a?a.type:i.node(r+1).type)}function Lm(n,e,t=1,o){let i=n.doc.resolve(e),r=M.empty,s=M.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){r=M.from(i.node(l).copy(r));let d=o&&o[c];s=M.from(d?d.type.create(d.attrs,s):i.node(l).copy(s))}n.step(new re(e,e,new j(r.append(s),t,t),!0))}function vi(n,e){let t=n.resolve(e),o=t.index();return Vm(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function Bm(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let i=0;i<e.childCount;i++){let r=e.child(i),s=r.type==o?n.type.schema.nodes.text:r.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(r.marks))return!1}return t.validEnd}function Vm(n,e){return!!(n&&e&&!n.isLeaf&&Bm(n,e))}function Hm(n,e,t){let o=null,{linebreakReplacement:i}=n.doc.type.schema,r=n.doc.resolve(e-t),s=r.node().type;if(i&&s.inlineContent){let d=s.whitespace=="pre",p=!!s.contentMatch.matchType(i);d&&!p?o=!1:!d&&p&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);bd(n,d.node(),d.before(),l)}s.inlineContent&&ms(n,e+t-1,s,r.node().contentMatchAt(r.index()),o==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new re(c,a.map(e+t,-1),j.empty,!0)),o===!0){let d=n.doc.resolve(c);gd(n,d.node(),d.before(),n.steps.length)}return n}function Fm(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let i=o.depth-1;i>=0;i--){let r=o.index(i);if(o.node(i).canReplaceWith(r,r,t))return o.before(i+1);if(r>0)return null}if(o.parentOffset==o.parent.content.size)for(let i=o.depth-1;i>=0;i--){let r=o.indexAfter(i);if(o.node(i).canReplaceWith(r,r,t))return o.after(i+1);if(r<o.node(i).childCount)return null}return null}function _m(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let r=0;r<t.openStart;r++)i=i.firstChild.content;for(let r=1;r<=(t.openStart==0&&t.size?2:1);r++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),c=o.node(s),d=!1;if(r==1)d=c.canReplace(a,a,i);else{let p=c.contentMatchAt(a).findWrapping(i.firstChild.type);d=p&&c.canReplaceWith(a,a,p[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function gs(n,e,t=e,o=j.empty){if(e==t&&!o.size)return null;let i=n.resolve(e),r=n.resolve(t);return yd(i,r,o)?new re(e,t,o):new Gm(i,r,o).fit()}function yd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Gm{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=M.empty;for(let i=0;i<=e.depth;i++){let r=e.node(i);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=M.from(e.node(i).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,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;let r=this.placed,s=o.depth,l=i.depth;for(;s&&l&&r.childCount==1;)r=r.firstChild.content,s--,l--;let a=new j(r,s,l);return e>-1?new oe(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new re(o.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,i=this.unplaced.openEnd;o<e;o++){let r=t.firstChild;if(t.childCount>1&&(i=0),r.type.spec.isolating&&i<=o){e=o;break}t=r.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let i,r=null;o?(r=Ri(this.unplaced.content,o-1).firstChild,i=r.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,p=null;if(t==1&&(s?c.matchType(s.type)||(p=c.fillBefore(M.from(s),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:o,frontierDepth:l,parent:r,inject:p};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:r,wrap:d};if(r&&c.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,i=Ri(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new j(e,t+1,Math.max(o,i.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,i=Ri(e,t);if(i.childCount<=1&&t>0){let r=e.size-t<=t+i.size;this.unplaced=new j(Dn(e,t-1,1),t-1,r?t-1:o)}else this.unplaced=new j(Dn(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:i,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let g=0;g<r.length;g++)this.openFrontierNode(r[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,c=0,d=[],{match:p,type:u}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));p=p.matchFragment(i)}let f=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),b=p.matchType(g.type);if(!b)break;c++,(c>1||a==0||g.content.size)&&(p=b,d.push(xd(g.mark(u.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?f:-1)))}let h=c==l.childCount;h||(f=-1),this.placed=zn(this.placed,t,M.from(d)),this.frontier[t].match=p,h&&f<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=l;g<f;g++){let x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=h?e==0?j.empty:new j(Dn(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new j(Dn(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Li(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:o}=this.$to,i=this.$to.after(o);for(;o>1&&i==this.$to.end(--o);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:i}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Li(e,t,i,o,r);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Li(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:r?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=zn(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let i=e.node(o),r=i.type.contentMatch.fillBefore(i.content,!0,e.index(o));this.openFrontierNode(i.type,i.attrs,r)}return e}openFrontierNode(e,t=null,o){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=zn(this.placed,this.depth,M.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(M.empty,!0);t.childCount&&(this.placed=zn(this.placed,this.frontier.length,t))}}function Dn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Dn(n.firstChild.content,e-1,t)))}function zn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(zn(n.lastChild.content,e-1,t)))}function Ri(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function xd(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,xd(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(M.empty,!0)))),n.copy(o)}function Li(n,e,t,o,i){let r=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==r.childCount&&!t.compatibleContent(r.type))return null;let l=o.fillBefore(r.content,!0,s);return l&&!Wm(t,r.content,s)?l:null}function Wm(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function qm(n){return n.spec.defining||n.spec.definingForContent}function Um(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),r=n.doc.resolve(t);if(yd(i,r,o))return n.step(new re(e,t,o));let s=wd(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let u=i.depth,f=i.pos-1;u>0;u--,f--){let h=i.node(u).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(u)>-1?l=u:i.before(u)==f&&s.splice(1,0,-u)}let a=s.indexOf(l),c=[],d=o.openStart;for(let u=o.content,f=0;;f++){let h=u.firstChild;if(c.push(h),f==o.openStart)break;u=h.content}for(let u=d-1;u>=0;u--){let f=c[u],h=qm(f.type);if(h&&!f.sameMarkup(i.node(Math.abs(l)-1)))d=u;else if(h||!f.type.isTextblock)break}for(let u=o.openStart;u>=0;u--){let f=(u+d+1)%(o.openStart+1),h=c[f];if(h)for(let g=0;g<s.length;g++){let b=s[(g+a)%s.length],x=!0;b<0&&(x=!1,b=-b);let C=i.node(b-1),y=i.index(b-1);if(C.canReplaceWith(y,y,h.type,h.marks))return n.replace(i.before(b),x?r.after(b):t,new j(vd(o.content,0,o.openStart,f),f,o.openEnd))}}let p=n.steps.length;for(let u=s.length-1;u>=0&&(n.replace(e,t,o),!(n.steps.length>p));u--){let f=s[u];f<0||(e=i.before(f),t=r.after(f))}}function vd(n,e,t,o,i){if(e<t){let r=n.firstChild;n=n.replaceChild(0,r.copy(vd(r.content,e+1,t,o,r)))}if(e>o){let r=i.contentMatchAt(0),s=r.fillBefore(n).append(n);n=s.append(r.matchFragment(s).fillBefore(M.empty,!0))}return n}function Km(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Fm(n.doc,e,o.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new j(M.from(o),0,0))}function Jm(n,e,t){let o=n.doc.resolve(e),i=n.doc.resolve(t),r=wd(o,i);for(let s=0;s<r.length;s++){let l=r[s],a=s==r.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),i.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),i.indexAfter(l-1))))return n.delete(o.before(l),i.after(l))}for(let s=1;s<=o.depth&&s<=i.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&i.end(s)-t!=i.depth-s&&o.start(s-1)==i.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),i.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function wd(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let i=o;i>=0;i--){let r=n.start(i);if(r<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(r==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==r-1)&&t.push(i)}return t}class hn extends le{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y.fail("No node at attribute step's position");let o=Object.create(null);for(let r in t.attrs)o[r]=t.attrs[r];o[this.attr]=this.value;let i=t.type.create(o,null,t.marks);return Y.fromReplace(e,this.pos,this.pos+1,new j(M.from(i),0,t.isLeaf?0:1))}getMap(){return Se.empty}invert(e){return new hn(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 hn(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 hn(t.pos,t.attr,t.value)}}le.jsonID("attr",hn);class eo extends le{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return Y.ok(o)}getMap(){return Se.empty}invert(e){return new eo(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 eo(t.attr,t.value)}}le.jsonID("docAttr",eo);let xn=class extends Error{};xn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};xn.prototype=Object.create(Error.prototype);xn.prototype.constructor=xn;xn.prototype.name="TransformError";class Sd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new un}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new xn(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,o=j.empty){let i=gs(this.doc,e,t,o);return i&&this.step(i),this}replaceWith(e,t,o){return this.replace(e,t,new j(M.from(o),0,0))}delete(e,t){return this.replace(e,t,j.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return Um(this,e,t,o),this}replaceRangeWith(e,t,o){return Km(this,e,t,o),this}deleteRange(e,t){return Jm(this,e,t),this}lift(e,t){return Pm(this,e,t),this}join(e,t=1){return Hm(this,e,t),this}wrap(e,t){return Im(this,e,t),this}setBlockType(e,t=e,o,i=null){return Dm(this,e,t,o,i),this}setNodeMarkup(e,t,o=null,i){return Rm(this,e,t,o,i),this}setNodeAttribute(e,t,o){return this.step(new hn(e,t,o)),this}setDocAttribute(e,t){return this.step(new eo(e,t)),this}addNodeMark(e,t){return this.step(new ft(e,t)),this}removeNodeMark(e,t){if(!(t instanceof H)){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t=t.isInSet(o.marks),!t)return this}return this.step(new yn(e,t)),this}split(e,t=1,o){return Lm(this,e,t,o),this}addMark(e,t,o){return Am(this,e,t,o),this}removeMark(e,t,o){return jm(this,e,t,o),this}clearIncompatible(e,t,o){return ms(this,e,t,o),this}}const Bi=Object.create(null);class z{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Cd(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=j.empty){let o=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=o,o=o.lastChild;let r=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=e.mapping.slice(r);e.replaceRange(d.map(a.pos),d.map(c.pos),l?j.empty:t),l==0&&Al(e,r,(o?o.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,i=this.ranges;for(let r=0;r<i.length;r++){let{$from:s,$to:l}=i[r],a=e.mapping.slice(o),c=a.map(s.pos),d=a.map(l.pos);r?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Al(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let i=e.parent.inlineContent?new R(e):tn(e.node(0),e.parent,e.pos,e.index(),t,o);if(i)return i;for(let r=e.depth-1;r>=0;r--){let s=t<0?tn(e.node(0),e.node(r),e.before(r+1),e.index(r),t,o):tn(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ke(e.node(0))}static atStart(e){return tn(e,e,0,0,1)||new ke(e)}static atEnd(e){return tn(e,e,e.content.size,e.childCount,-1)||new ke(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Bi[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Bi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class Cd{constructor(e,t){this.$from=e,this.$to=t}}let El=!1;function Ml(n){!El&&!n.parent.inlineContent&&(El=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class R extends z{constructor(e,t=e){Ml(e),Ml(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return z.near(o);let i=e.resolve(t.map(this.anchor));return new R(i.parent.inlineContent?i:o,o)}replace(e,t=j.empty){if(super.replace(e,t),t==j.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wi(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,o=t){let i=e.resolve(t);return new this(i,o==t?i:e.resolve(o))}static between(e,t,o){let i=e.pos-t.pos;if((!o||i)&&(o=i>=0?1:-1),!t.parent.inlineContent){let r=z.findFrom(t,o,!0)||z.findFrom(t,-o,!0);if(r)t=r.$head;else return z.near(t,o)}return e.parent.inlineContent||(i==0?e=t:(e=(z.findFrom(e,-o,!0)||z.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new R(e,t)}}z.jsonID("text",R);class wi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new wi(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class D extends z{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:i}=t.mapResult(this.anchor),r=e.resolve(i);return o?z.near(r):new D(r)}content(){return new j(M.from(this.node),0,0)}eq(e){return e instanceof D&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bs(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new D(e.resolve(t.anchor))}static create(e,t){return new D(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}D.prototype.visible=!1;z.jsonID("node",D);class bs{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new wi(o,o):new bs(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&D.isSelectable(o)?new D(t):z.near(t)}}class ke extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=j.empty){if(t==j.empty){e.delete(0,e.doc.content.size);let o=z.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ke(e)}map(e){return new ke(e)}eq(e){return e instanceof ke}getBookmark(){return Ym}}z.jsonID("all",ke);const Ym={map(){return this},resolve(n){return new ke(n)}};function tn(n,e,t,o,i,r=!1){if(e.inlineContent)return R.create(n,t);for(let s=o-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!r&&D.isSelectable(l))return D.create(n,t-(i<0?l.nodeSize:0))}else{let a=tn(n,l,t+i,i<0?l.childCount:0,i,r);if(a)return a}t+=l.nodeSize*i}return null}function Al(n,e,t){let o=n.steps.length-1;if(o<e)return;let i=n.steps[o];if(!(i instanceof re||i instanceof oe))return;let r=n.mapping.maps[o],s;r.forEach((l,a,c,d)=>{s==null&&(s=d)}),n.setSelection(z.near(n.doc.resolve(s),t))}const jl=1,Mo=2,$l=4;class Zm extends Sd{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|jl)&~Mo,this.storedMarks=null,this}get selectionSet(){return(this.updated&jl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Mo,this}ensureMarks(e){return H.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&Mo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Mo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||H.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),o=o??t,!e)return this.deleteRange(t,o);let r=this.storedMarks;if(!r){let s=this.doc.resolve(t);r=o==t?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,i.text(e,r)),this.selection.empty||this.setSelection(z.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 Pl(n,e){return!e||!n?n:n.bind(e)}class Rn{constructor(e,t,o){this.name=e,this.init=Pl(t.init,o),this.apply=Pl(t.apply,o)}}const Xm=[new Rn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Rn("selection",{init(n,e){return n.selection||z.atStart(e.doc)},apply(n){return n.selection}}),new Rn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Rn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Vi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Xm.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Rn(o.key,o.spec.state,o))})}}class ln{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 o=0;o<this.config.plugins.length;o++)if(o!=t){let i=this.config.plugins[o];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),i=null;for(;;){let r=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,o);if(d&&o.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let p=0;p<this.config.plugins.length;p++)i.push(p<s?{state:o,n:t.length}:{state:this,n:0})}t.push(d),o=o.applyInner(d),r=!0}i&&(i[s]={state:o,n:t.length})}}if(!r)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ln(this.config),o=this.config.fields;for(let i=0;i<o.length;i++){let r=o[i];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new Zm(this)}static create(e){let t=new Vi(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new ln(t);for(let i=0;i<t.fields.length;i++)o[t.fields[i].name]=t.fields[i].init(e,o);return o}reconfigure(e){let t=new Vi(this.schema,e.plugins),o=t.fields,i=new ln(t);for(let r=0;r<o.length;r++){let s=o[r].name;i[s]=this.hasOwnProperty(s)?this[s]:o[r].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[o],r=i.spec.state;r&&r.toJSON&&(t[o]=r.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Vi(e.schema,e.plugins),r=new ln(i);return i.fields.forEach(s=>{if(s.name=="doc")r.doc=Rt.fromJSON(e.schema,t.doc);else if(s.name=="selection")r.selection=z.fromJSON(r.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){r[s.name]=c.fromJSON.call(a,e,t[l],r);return}}r[s.name]=s.init(e,r)}}),r}}function kd(n,e,t){for(let o in n){let i=n[o];i instanceof Function?i=i.bind(e):o=="handleDOMEvents"&&(i=kd(i,e,{})),t[o]=i}return t}class Tn{constructor(e){this.spec=e,this.props={},e.props&&kd(e.props,this,this.props),this.key=e.key?e.key.key:Td("plugin")}getState(e){return e[this.key]}}const Hi=Object.create(null);function Td(n){return n in Hi?n+"$"+ ++Hi[n]:(Hi[n]=0,n+"$")}class ao{constructor(e="key"){this.key=Td(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ed=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Qm(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const eg=(n,e,t)=>{let o=Qm(n,t);if(!o)return!1;let i=Md(o);if(!i){let s=o.blockRange(),l=s&&xi(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let r=i.nodeBefore;if(Od(n,i,e,-1))return!0;if(o.parent.content.size==0&&(vn(r,"end")||D.isSelectable(r)))for(let s=o.depth;;s--){let l=gs(n.doc,o.before(s),o.after(s),j.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(vn(r,"end")?z.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):D.create(a.doc,i.pos-r.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return r.isAtom&&i.depth==o.depth-1?(e&&e(n.tr.delete(i.pos-r.nodeSize,i.pos).scrollIntoView()),!0):!1};function vn(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const tg=(n,e,t)=>{let{$head:o,empty:i}=n.selection,r=o;if(!i)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;r=Md(o)}let s=r&&r.nodeBefore;return!s||!D.isSelectable(s)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,r.pos-s.nodeSize)).scrollIntoView()),!0)};function Md(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 ng(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const og=(n,e,t)=>{let o=ng(n,t);if(!o)return!1;let i=Ad(o);if(!i)return!1;let r=i.nodeAfter;if(Od(n,i,e,1))return!0;if(o.parent.content.size==0&&(vn(r,"start")||D.isSelectable(r))){let s=gs(n.doc,o.before(),o.after(),j.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(vn(r,"start")?z.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):D.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return r.isAtom&&i.depth==o.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+r.nodeSize).scrollIntoView()),!0):!1},ig=(n,e,t)=>{let{$head:o,empty:i}=n.selection,r=o;if(!i)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;r=Ad(o)}let s=r&&r.nodeAfter;return!s||!D.isSelectable(s)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,r.pos)).scrollIntoView()),!0)};function Ad(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 rg=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
912
|
+
`).scrollIntoView()),!0)};function ys(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 jd=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let i=t.node(-1),r=t.indexAfter(-1),s=ys(i.contentMatchAt(r));if(!s||!i.canReplaceWith(r,r,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(z.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},sg=(n,e)=>{let t=n.selection,{$from:o,$to:i}=t;if(t instanceof ke||o.parent.inlineContent||i.parent.inlineContent)return!1;let r=ys(i.parent.contentMatchAt(i.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let s=(!o.parentOffset&&i.index()<i.parent.childCount?o:i).pos,l=n.tr.insert(s,r.createAndFill());l.setSelection(R.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},$d=(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 r=t.before();if(fn(n.doc,r))return e&&e(n.tr.split(r).scrollIntoView()),!0}let o=t.blockRange(),i=o&&xi(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)};function Pd(n){return(e,t)=>{let{$from:o,$to:i}=e.selection;if(e.selection instanceof D&&e.selection.node.isBlock)return!o.parentOffset||!fn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let r=[],s,l,a=!1,c=!1;for(let f=o.depth;;f--)if(o.node(f).isBlock){a=o.end(f)==o.pos+(o.depth-f),c=o.start(f)==o.pos-(o.depth-f),l=ys(o.node(f-1).contentMatchAt(o.indexAfter(f-1)));let g=n&&n(i.parent,a,o);r.unshift(g||(a&&l?{type:l}:null)),s=f;break}else{if(f==1)return!1;r.unshift(null)}let d=e.tr;(e.selection instanceof R||e.selection instanceof ke)&&d.deleteSelection();let p=d.mapping.map(o.pos),u=fn(d.doc,p,r.length,r);if(u||(r[0]=l?{type:l}:null,u=fn(d.doc,p,r.length,r)),d.split(p,r.length,r),!a&&c&&o.node(s).type!=l){let f=d.mapping.map(o.before(s)),h=d.doc.resolve(f);l&&o.node(s-1).canReplaceWith(h.index(),h.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const lg=Pd(),Nd=(n,e)=>(e&&e(n.tr.setSelection(new ke(n.doc))),!0);function ag(n,e,t){let o=e.nodeBefore,i=e.nodeAfter,r=e.index();return!o||!i||!o.type.compatibleContent(i.type)?!1:!o.content.size&&e.parent.canReplace(r-1,r)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(i.isTextblock||vi(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Od(n,e,t,o){let i=e.nodeBefore,r=e.nodeAfter,s,l,a=i.type.spec.isolating||r.type.spec.isolating;if(!a&&ag(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(r.type))&&l.matchType(s[0]||r.type).validEnd){if(t){let f=e.pos+r.nodeSize,h=M.empty;for(let x=s.length-1;x>=0;x--)h=M.from(s[x].create(null,h));h=M.from(i.copy(h));let g=n.tr.step(new oe(e.pos-1,f,e.pos,f,new j(h,1,0),s.length,!0)),b=g.doc.resolve(f+2*s.length);b.nodeAfter&&b.nodeAfter.type==i.type&&vi(g.doc,b.pos)&&g.join(b.pos),t(g.scrollIntoView())}return!0}let d=r.type.spec.isolating||o>0&&a?null:z.findFrom(e,1),p=d&&d.$from.blockRange(d.$to),u=p&&xi(p);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(p,u).scrollIntoView()),!0;if(c&&vn(r,"start",!0)&&vn(i,"end")){let f=i,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let g=r,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(t){let x=M.empty;for(let y=h.length-1;y>=0;y--)x=M.from(h[y].copy(x));let C=n.tr.step(new oe(e.pos-h.length,e.pos+r.nodeSize,e.pos+b,e.pos+r.nodeSize-b,new j(x,h.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function Id(n){return function(e,t){let o=e.selection,i=n<0?o.$from:o.$to,r=i.depth;for(;i.node(r).isInline;){if(!r)return!1;r--}return i.node(r).isTextblock?(t&&t(e.tr.setSelection(R.create(e.doc,n<0?i.start(r):i.end(r)))),!0):!1}}const cg=Id(-1),dg=Id(1);function pg(n,e=null){return function(t,o){let i=!1;for(let r=0;r<t.selection.ranges.length&&!i;r++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[r];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let d=t.doc.resolve(c),p=d.index();i=d.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(o){let r=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];r.setBlockType(l,a,n,e)}o(r.scrollIntoView())}return!0}}function ug(n,e,t,o){for(let i=0;i<e.length;i++){let{$from:r,$to:s}=e[i],l=r.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(r.pos,s.pos,(a,c)=>{if(l||!o)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function At(n,e=null,t){let o=t!==!1;return function(i,r){let{empty:s,$cursor:l,ranges:a}=i.selection;if(s&&!l||!ug(i.doc,a,n,o))return!1;if(r)if(l)n.isInSet(i.storedMarks||l.marks())?r(i.tr.removeStoredMark(n)):r(i.tr.addStoredMark(n.create(e)));else{let c,d=i.tr;c=!a.some(p=>i.doc.rangeHasMark(p.$from.pos,p.$to.pos,n));for(let p=0;p<a.length;p++){let{$from:u,$to:f}=a[p];if(!c)d.removeMark(u.pos,f.pos,n);else{let h=u.pos,g=f.pos,b=u.nodeAfter,x=f.nodeBefore,C=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,y=x&&x.isText?/\s*$/.exec(x.text)[0].length:0;h+C<g&&(h+=C,g-=y),d.addMark(h,g,n.create(e))}}r(d.scrollIntoView())}return!0}}function to(...n){return function(e,t,o){for(let i=0;i<n.length;i++)if(n[i](e,t,o))return!0;return!1}}let Fi=to(Ed,eg,tg),Nl=to(Ed,og,ig);const tt={Enter:to(rg,sg,$d,lg),"Mod-Enter":jd,Backspace:Fi,"Mod-Backspace":Fi,"Shift-Backspace":Fi,Delete:Nl,"Mod-Delete":Nl,"Mod-a":Nd},Dd={"Ctrl-h":tt.Backspace,"Alt-Backspace":tt["Mod-Backspace"],"Ctrl-d":tt.Delete,"Ctrl-Alt-Backspace":tt["Mod-Delete"],"Alt-Delete":tt["Mod-Delete"],"Alt-d":tt["Mod-Delete"],"Ctrl-a":cg,"Ctrl-e":dg};for(let n in tt)Dd[n]=tt[n];const fg=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,hg=fg?Dd:tt;var ni=200,X=function(){};X.prototype.append=function(e){return e.length?(e=X.from(e),!this.length&&e||e.length<ni&&this.leafAppend(e)||this.length<ni&&e.leafPrepend(this)||this.appendInner(e)):this};X.prototype.prepend=function(e){return e.length?X.from(e).append(this):this};X.prototype.appendInner=function(e){return new mg(this,e)};X.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?X.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};X.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};X.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};X.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var i=[];return this.forEach(function(r,s){return i.push(e(r,s))},t,o),i};X.from=function(e){return e instanceof X?e:e&&e.length?new zd(e):X.empty};var zd=function(n){function e(o){n.call(this),this.values=o}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(i,r){return i==0&&r==this.length?this:new e(this.values.slice(i,r))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,r,s,l){for(var a=r;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,s,l){for(var a=r-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ni)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ni)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(X);X.empty=new zd([]);var mg=function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.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(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,i,r,s){var l=this.left.length;if(i<l&&this.left.forEachInner(o,i,Math.min(r,l),s)===!1||r>l&&this.right.forEachInner(o,Math.max(i-l,0),Math.min(this.length,r)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,r,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(o,i-l,Math.max(r,l)-l,s+l)===!1||r<l&&this.left.forEachInvertedInner(o,Math.min(i,l),r,s)===!1)return!1},e.prototype.sliceInner=function(o,i){if(o==0&&i==this.length)return this;var r=this.left.length;return i<=r?this.left.slice(o,i):o>=r?this.right.slice(o-r,i-r):this.left.slice(o,r).append(this.right.slice(0,i-r))},e.prototype.leafAppend=function(o){var i=this.right.leafAppend(o);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(o){var i=this.left.leafPrepend(o);if(i)return new e(i,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e}(X);const gg=500;class Oe{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let i,r;t&&(i=this.remapping(o,this.items.length),r=i.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((p,u)=>{if(!p.step){i||(i=this.remapping(o,u+1),r=i.maps.length),r--,d.push(p);return}if(i){d.push(new Ve(p.map));let f=p.step.map(i.slice(r)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ve(h,void 0,void 0,c.length+d.length))),r--,h&&i.appendMap(h,r)}else s.maybeStep(p.step);if(p.selection)return l=i?p.selection.map(i.slice(r)):p.selection,a=new Oe(this.items.slice(0,o).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,o,i){let r=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let p=e.steps[d].invert(e.docs[d]),u=new Ve(e.mapping.maps[d],p,t),f;(f=a&&a.merge(u))&&(u=f,d?r.pop():l=l.slice(0,l.length-1)),r.push(u),t&&(s++,t=void 0),i||(a=u)}let c=s-o.depth;return c>yg&&(l=bg(l,c),s-=c),new Oe(l.append(r),s)}remapping(e,t){let o=new un;return this.items.forEach((i,r)=>{let s=i.mirrorOffset!=null&&r-i.mirrorOffset>=e?o.maps.length-i.mirrorOffset:void 0;o.appendMap(i.map,s)},e,t),o}addMaps(e){return this.eventCount==0?this:new Oe(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],i=Math.max(0,this.items.length-t),r=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(u=>{u.selection&&l--},i);let a=t;this.items.forEach(u=>{let f=r.getMirror(--a);if(f==null)return;s=Math.min(s,f);let h=r.maps[f];if(u.step){let g=e.steps[f].invert(e.docs[f]),b=u.selection&&u.selection.map(r.slice(a+1,f));b&&l++,o.push(new Ve(h,g,b))}else o.push(new Ve(h))},i);let c=[];for(let u=t;u<s;u++)c.push(new Ve(r.maps[u]));let d=this.items.slice(0,i).append(c).append(o),p=new Oe(d,l);return p.emptyItemCount()>gg&&(p=p.compress(this.items.length-o.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,i=[],r=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&r++;else if(s.step){let a=s.step.map(t.slice(o)),c=a&&a.getMap();if(o--,c&&t.appendMap(c,o),a){let d=s.selection&&s.selection.map(t.slice(o));d&&r++;let p=new Ve(c.invert(),a,d),u,f=i.length-1;(u=i.length&&i[f].merge(p))?i[f]=u:i.push(p)}}else s.map&&o--},this.items.length,0),new Oe(X.from(i.reverse()),r)}}Oe.empty=new Oe(X.empty,0);function bg(n,e){let t;return n.forEach((o,i)=>{if(o.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ve{constructor(e,t,o,i){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class lt{constructor(e,t,o,i,r){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=i,this.prevComposition=r}}const yg=20;function xg(n,e,t,o){let i=t.getMeta(Lt),r;if(i)return i.historyState;t.getMeta(Sg)&&(n=new lt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Lt))return s.getMeta(Lt).redo?new lt(n.done.addTransform(t,void 0,o,Lo(e)),n.undone,Ol(t.mapping.maps),n.prevTime,n.prevComposition):new lt(n.done,n.undone.addTransform(t,void 0,o,Lo(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!vg(t,n.prevRanges)),c=s?_i(n.prevRanges,t.mapping):Ol(t.mapping.maps);return new lt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,Lo(e)),Oe.empty,c,t.time,l??n.prevComposition)}else return(r=t.getMeta("rebased"))?new lt(n.done.rebased(t,r),n.undone.rebased(t,r),_i(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new lt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),_i(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function vg(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,i)=>{for(let r=0;r<e.length;r+=2)o<=e[r+1]&&i>=e[r]&&(t=!0)}),t}function Ol(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,i,r,s)=>e.push(r,s));return e}function _i(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let i=e.map(n[o],1),r=e.map(n[o+1],-1);i<=r&&t.push(i,r)}return t}function wg(n,e,t){let o=Lo(e),i=Lt.get(e).spec.config,r=(t?n.undone:n.done).popEvent(e,o);if(!r)return null;let s=r.selection.resolve(r.transform.doc),l=(t?n.done:n.undone).addTransform(r.transform,e.selection.getBookmark(),i,o),a=new lt(t?l:r.remaining,t?r.remaining:l,null,0,-1);return r.transform.setSelection(s).setMeta(Lt,{redo:t,historyState:a})}let Gi=!1,Il=null;function Lo(n){let e=n.plugins;if(Il!=e){Gi=!1,Il=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Gi=!0;break}}return Gi}const Lt=new ao("history"),Sg=new ao("closeHistory");function Cg(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Tn({key:Lt,state:{init(){return new lt(Oe.empty,Oe.empty,null,0,-1)},apply(e,t,o){return xg(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,i=o=="historyUndo"?Ld:o=="historyRedo"?Pr:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Rd(n,e){return(t,o)=>{let i=Lt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(o){let r=wg(i,t,n);r&&o(e?r.scrollIntoView():r)}return!0}}const Ld=Rd(!1,!0),Pr=Rd(!0,!0);var vt={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:"'"},oi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kg=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var te=0;te<10;te++)vt[48+te]=vt[96+te]=String(te);for(var te=1;te<=24;te++)vt[te+111]="F"+te;for(var te=65;te<=90;te++)vt[te]=String.fromCharCode(te+32),oi[te]=String.fromCharCode(te);for(var Wi in vt)oi.hasOwnProperty(Wi)||(oi[Wi]=vt[Wi]);function Eg(n){var e=kg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Tg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?oi:vt)[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 Mg=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Ag(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,i,r,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))Mg?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),r&&(t="Shift-"+t),t}function jg(n){let e=Object.create(null);for(let t in n)e[Ag(t)]=n[t];return e}function qi(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 Ui(n){return new Tn({props:{handleKeyDown:Bd(n)}})}function Bd(n){let e=jg(n);return function(t,o){let i=Eg(o),r,s=e[qi(i,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(o.shiftKey){let l=e[qi(i,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.shiftKey||o.altKey||o.metaKey||i.charCodeAt(0)>127)&&(r=vt[o.keyCode])&&r!=i){let l=e[qi(r,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function Dl(n,e=null){return function(t,o){let{$from:i,$to:r}=t.selection,s=i.blockRange(r),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let d=t.doc.resolve(s.start-2);a=new Xo(d,d,s.depth),s.endIndex<s.parent.childCount&&(s=new Xo(i,t.doc.resolve(r.end(s.depth)),s.depth)),l=!0}let c=md(a,n,e,s);return c?(o&&o($g(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function $g(n,e,t,o,i){let r=M.empty;for(let d=t.length-1;d>=0;d--)r=M.from(t[d].type.create(t[d].attrs,r));n.step(new oe(e.start-(o?2:0),e.end,e.start,e.end,new j(r,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==i&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),c=e.parent;for(let d=e.startIndex,p=e.endIndex,u=!0;d<p;d++,u=!1)!u&&fn(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Pg(n,e){return function(t,o){let{$from:i,$to:r,node:s}=t.selection;if(s&&s.isBlock||i.depth<2||!i.sameParent(r))return!1;let l=i.node(-1);if(l.type!=n)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=n||i.index(-2)!=i.node(-2).childCount-1)return!1;if(o){let p=M.empty,u=i.index(-1)?1:i.index(-2)?2:3;for(let x=i.depth-u;x>=i.depth-3;x--)p=M.from(i.node(x).copy(p));let f=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;p=p.append(M.from(n.createAndFill()));let h=i.before(i.depth-(u-1)),g=t.tr.replace(h,i.after(-f),new j(p,4-u,0)),b=-1;g.doc.nodesBetween(h,g.doc.content.size,(x,C)=>{if(b>-1)return!1;x.isTextblock&&x.content.size==0&&(b=C+1)}),b>-1&&g.setSelection(z.near(g.doc.resolve(b))),o(g.scrollIntoView())}return!0}let a=r.pos==i.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(i.pos,r.pos),d=a?[null,{type:a}]:void 0;return fn(c.doc,i.pos,2,d)?(o&&o(c.split(i.pos,2,d).scrollIntoView()),!0):!1}}function Nr(n){return function(e,t){let{$from:o,$to:i}=e.selection,r=o.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return r?t?o.node(r.depth-1).type==n?Ng(e,t,n,r):Og(e,t,r):!0:!1}}function Ng(n,e,t,o){let i=n.tr,r=o.end,s=o.$to.end(o.depth);r<s&&(i.step(new oe(r-1,s,r,s,new j(M.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Xo(i.doc.resolve(o.$from.pos),i.doc.resolve(s),o.depth));const l=xi(o);if(l==null)return!1;i.lift(o,l);let a=i.mapping.map(r,-1)-1;return vi(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function Og(n,e,t){let o=n.tr,i=t.parent;for(let f=t.end,h=t.endIndex-1,g=t.startIndex;h>g;h--)f-=i.child(h).nodeSize,o.delete(f-1,f+1);let r=o.doc.resolve(t.start),s=r.nodeAfter;if(o.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=r.node(-1),d=r.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?M.empty:M.from(i))))return!1;let p=r.pos,u=p+s.nodeSize;return o.step(new oe(p-(l?1:0),u+(a?1:0),p+1,u-1,new j((l?M.empty:M.from(i.copy(M.empty))).append(a?M.empty:M.from(i.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function Ig(n){return function(e,t){let{$from:o,$to:i}=e.selection,r=o.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!r)return!1;let s=r.startIndex;if(s==0)return!1;let l=r.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=M.from(c?n.create():null),p=new j(M.from(n.create(null,M.from(l.type.create(null,d)))),c?3:1,0),u=r.start,f=r.end;t(e.tr.step(new oe(u-(c?3:1),f,u,f,p,1,!0)).scrollIntoView())}return!0}}const ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},no=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Or=null;const et=function(n,e,t){let o=Or||(Or=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},Dg=function(){Or=null},Gt=function(n,e,t,o){return t&&(zl(n,e,t,o,-1)||zl(n,e,t,o,1))},zg=/^(img|br|input|textarea|hr)$/i;function zl(n,e,t,o,i){for(;;){if(n==t&&e==o)return!0;if(e==(i<0?0:Me(n))){let r=n.parentNode;if(!r||r.nodeType!=1||co(n)||zg.test(n.nodeName)||n.contentEditable=="false")return!1;e=ne(n)+(i<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Me(n):0}else return!1}}function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Rg(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&&!co(n))e=ne(n),n=n.parentNode;else return null}}function Lg(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&&!co(n))e=ne(n)+1,n=n.parentNode;else return null}}function Bg(n,e,t){for(let o=e==0,i=e==Me(n);o||i;){if(n==t)return!0;let r=ne(n);if(n=n.parentNode,!n)return!1;o=o&&r==0,i=i&&r==Me(n)}}function co(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 Si=function(n){return n.focusNode&&Gt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function jt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Vg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hg(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Me(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Me(o.startContainer),o.startOffset)}}}const Ke=typeof navigator<"u"?navigator:null,Rl=typeof document<"u"?document:null,wt=Ke&&Ke.userAgent||"",Ir=/Edge\/(\d+)/.exec(wt),Vd=/MSIE \d/.exec(wt),Dr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wt),xe=!!(Vd||Dr||Ir),gt=Vd?document.documentMode:Dr?+Dr[1]:Ir?+Ir[1]:0,ze=!xe&&/gecko\/(\d+)/i.test(wt);ze&&+(/Firefox\/(\d+)/.exec(wt)||[0,0])[1];const zr=!xe&&/Chrome\/(\d+)/.exec(wt),se=!!zr,Hd=zr?+zr[1]:0,ue=!xe&&!!Ke&&/Apple Computer/.test(Ke.vendor),wn=ue&&(/Mobile\/\w+/.test(wt)||!!Ke&&Ke.maxTouchPoints>2),Ee=wn||(Ke?/Mac/.test(Ke.platform):!1),Fg=Ke?/Win/.test(Ke.platform):!1,Pe=/Android \d/.test(wt),po=!!Rl&&"webkitFontSmoothing"in Rl.documentElement.style,_g=po?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gg(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 Xe(n,e){return typeof n=="number"?n:n[e]}function Wg(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function Ll(n,e,t){let o=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,r=n.dom.ownerDocument;for(let s=t||n.dom;s;s=no(s)){if(s.nodeType!=1)continue;let l=s,a=l==r.body,c=a?Gg(r):Wg(l),d=0,p=0;if(e.top<c.top+Xe(o,"top")?p=-(c.top-e.top+Xe(i,"top")):e.bottom>c.bottom-Xe(o,"bottom")&&(p=e.bottom-e.top>c.bottom-c.top?e.top+Xe(i,"top")-c.top:e.bottom-c.bottom+Xe(i,"bottom")),e.left<c.left+Xe(o,"left")?d=-(c.left-e.left+Xe(i,"left")):e.right>c.right-Xe(o,"right")&&(d=e.right-c.right+Xe(i,"right")),d||p)if(a)r.defaultView.scrollBy(d,p);else{let u=l.scrollLeft,f=l.scrollTop;p&&(l.scrollTop+=p),d&&(l.scrollLeft+=d);let h=l.scrollLeft-u,g=l.scrollTop-f;e={left:e.left-h,top:e.top-g,right:e.right-h,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function qg(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,i;for(let r=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(r,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){o=l,i=a.top;break}}return{refDOM:o,refTop:i,stack:Fd(n.dom)}}function Fd(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=no(o));return e}function Ug({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;_d(t,o==0?0:o-e)}function _d(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:i,left:r}=n[t];o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=r&&(o.scrollLeft=r)}}let Xt=null;function Kg(n){if(n.setActive)return n.setActive();if(Xt)return n.focus(Xt);let e=Fd(n);n.focus(Xt==null?{get preventScroll(){return Xt={preventScroll:!0},!0}}:void 0),Xt||(Xt=!1,_d(e,0))}function Gd(n,e){let t,o=2e8,i,r=0,s=e.top,l=e.top,a,c;for(let d=n.firstChild,p=0;d;d=d.nextSibling,p++){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=et(d).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let g=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(g<o){t=d,o=g,i=g&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,d.nodeType==1&&g&&(r=p+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(r=p+1)}}return!t&&a&&(t=a,i=c,o=0),t&&t.nodeType==3?Jg(t,i):!t||o&&t.nodeType==1?{node:n,offset:r}:Gd(t,i)}function Jg(n,e){let t=n.nodeValue.length,o=document.createRange();for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let r=st(o,1);if(r.top!=r.bottom&&xs(e,r))return{node:n,offset:i+(e.left>=(r.left+r.right)/2?1:0)}}return{node:n,offset:0}}function xs(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Yg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Zg(n,e,t){let{node:o,offset:i}=Gd(e,t),r=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();r=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,i,r)}function Xg(n,e,t,o){let i=-1;for(let r=e,s=!1;r!=n.dom;){let l=n.docView.nearestDesc(r,!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&&(!s&&a.left>o.left||a.top>o.top?i=l.posBefore:(!s&&a.right<o.left||a.bottom<o.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText)return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}r=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Wd(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let i=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),r=i;;){let s=n.childNodes[r];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(xs(e,c))return Wd(s,e,c)}}if((r=(r+1)%o)==i)break}return n}function Qg(n,e){let t=n.dom.ownerDocument,o,i=0,r=Hg(t,e.left,e.top);r&&({node:o,offset:i}=r);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!xs(e,c)||(s=Wd(n.dom,e,c),!s))return null}if(ue)for(let c=s;o&&c;c=no(c))c.draggable&&(o=void 0);if(s=Yg(s,e),o){if(ze&&o.nodeType==1&&(i=Math.min(i,o.childNodes.length),i<o.childNodes.length)){let d=o.childNodes[i],p;d.nodeName=="IMG"&&(p=d.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&i++}let c;po&&i&&o.nodeType==1&&(c=o.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,o==n.dom&&i==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||o.nodeType!=1||o.childNodes[i-1].nodeName!="BR")&&(l=Xg(n,o,i,e))}l==null&&(l=Zg(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Bl(n){return n.top<n.bottom||n.left<n.right}function st(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Bl(o))return o}return Array.prototype.find.call(t,Bl)||n.getBoundingClientRect()}const e0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qd(n,e,t){let{node:o,offset:i,atom:r}=n.docView.domFromPos(e,t<0?-1:1),s=po||ze;if(o.nodeType==3)if(s&&(e0.test(o.nodeValue)||(t<0?!i:i==o.nodeValue.length))){let a=st(et(o,i,i),t);if(ze&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){let c=st(et(o,i-1,i-1),-1);if(c.top==a.top){let d=st(et(o,i,i+1),-1);if(d.top!=a.top)return jn(d,d.left<c.left)}}return a}else{let a=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==o.nodeValue.length?(a--,d=1):t<0?a--:c++,jn(st(et(o,a,c),d),d<0)}if(!n.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&i&&(t<0||i==Me(o))){let a=o.childNodes[i-1];if(a.nodeType==1)return Ki(a.getBoundingClientRect(),!1)}if(r==null&&i<Me(o)){let a=o.childNodes[i];if(a.nodeType==1)return Ki(a.getBoundingClientRect(),!0)}return Ki(o.getBoundingClientRect(),t>=0)}if(r==null&&i&&(t<0||i==Me(o))){let a=o.childNodes[i-1],c=a.nodeType==3?et(a,Me(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return jn(st(c,1),!1)}if(r==null&&i<Me(o)){let a=o.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?et(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return jn(st(c,-1),!0)}return jn(st(o.nodeType==3?et(o):o,-t),t>=0)}function jn(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 Ki(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 Ud(n,e,t){let o=n.state,i=n.root.activeElement;o!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),i!=n.dom&&i&&i.focus()}}function t0(n,e,t){let o=e.selection,i=t=="up"?o.$from:o.$to;return Ud(n,e,()=>{let{node:r}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(r,!0);if(!l)break;if(l.node.isBlock){r=l.contentDOM||l.dom;break}r=l.dom.parentNode}let s=qd(n,i.pos,1);for(let l=r.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=et(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"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const n0=/[\u0590-\u08ac]/;function o0(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,r=!i,s=i==o.parent.content.size,l=n.domSelection();return l?!n0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?r:s:Ud(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:p}=n.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let f=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:h,focusOffset:g}=n.domSelectionRange(),b=h&&!f.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==g;try{l.collapse(d,p),a&&(a!=d||c!=p)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),b}):o.pos==o.start()||o.pos==o.end()}let Vl=null,Hl=null,Fl=!1;function i0(n,e,t){return Vl==e&&Hl==t?Fl:(Vl=e,Hl=t,Fl=t=="up"||t=="down"?t0(n,e,t):o0(n,e,t))}const Ae=0,_l=1,Nt=2,Je=3;class uo{constructor(e,t,o,i){this.parent=e,this.children=t,this.dom=o,this.contentDOM=i,this.dirty=Ae,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){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,o=this.posAtStart;;t++){let i=this.children[t];if(i==e)return o;o+=i.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,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let r,s;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((s=r.pmViewDesc)&&s.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(s)+s.size:this.posAtStart}else{let r,s;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((s=r.pmViewDesc)&&s.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>ne(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!1;break}if(r.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!0;break}if(r.nextSibling)break}}return i??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,i=e;i;i=i.parentNode){let r=this.getDesc(i),s;if(r&&(!t||r.node))if(o&&(s=r.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let i=e;i;i=i.parentNode){let r=this.getDesc(i);if(r)return r.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let i=this.children[t],r=o+i.size;if(o==e&&r!=o){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<r)return i.descAt(e-o-i.border);o=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,i=0;for(let r=0;o<this.children.length;o++){let s=this.children[o],l=r+s.size;if(l>e||s instanceof Jd){i=e-r;break}r=l}if(i)return this.children[o].domFromPos(i-this.children[o].border,t);for(let r;o&&!(r=this.children[o-1]).size&&r instanceof Kd&&r.side>=0;o--);if(t<=0){let r,s=!0;for(;r=o?this.children[o-1]:null,!(!r||r.dom.parentNode==this.contentDOM);o--,s=!1);return r&&t&&s&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?ne(r.dom)+1:0}}else{let r,s=!0;for(;r=o<this.children.length?this.children[o]:null,!(!r||r.dom.parentNode==this.contentDOM);o++,s=!1);return r&&s&&!r.border&&!r.domAtom?r.domFromPos(0,t):{node:this.contentDOM,offset:r?ne(r.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,r=-1;for(let s=o,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let d=s+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=s;for(let p=l;p>0;p--){let u=this.children[p-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=ne(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let p=this.children[d];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){r=ne(p.dom);break}t+=p.size}r==-1&&(r=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:r}}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:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,i=!1){let r=Math.min(e,t),s=Math.max(e,t);for(let f=0,h=0;f<this.children.length;f++){let g=this.children[f],b=h+g.size;if(r>h&&s<b)return g.setSelection(e-h-g.border,t-h-g.border,o,i);h=b}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=o.root.getSelection(),d=o.domSelectionRange(),p=!1;if((ze||ue)&&e==t){let{node:f,offset:h}=l;if(f.nodeType==3){if(p=!!(h&&f.nodeValue[h-1]==`
|
|
913
|
+
`),p&&h==f.nodeValue.length)for(let g=f,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(l=a={node:b.parentNode,offset:ne(b)+1});break}let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=f.childNodes[h-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(ze&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||p&&ue)&&Gt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&Gt(a.node,a.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==t)&&!p){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let h=l;l=a,a=h}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 o=0,i=0;i<this.children.length;i++){let r=this.children[i],s=o+r.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let l=o+r.border,a=s-r.border;if(e>=l&&t<=a){this.dirty=e==o||t==s?Nt:_l,e==l&&t==a&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=Je:r.markDirty(e-l,t-l);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?Nt:Je}o=s}this.dirty=Nt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?Nt:_l;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Kd extends uo{constructor(e,t,o,i){let r,s=t.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!r)return i;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==Ae&&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 r0 extends uo{constructor(e,t,o,i){super(e,[],t,null),this.textDOM=o,this.text=i}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 Wt extends uo{constructor(e,t,o,i,r){super(e,[],o,i),this.mark=t,this.spec=r}static create(e,t,o,i){let r=i.nodeViews[t.type.name],s=r&&r(t,i,o);return(!s||!s.dom)&&(s=Ut.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new Wt(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Je||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Je&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ae){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Ae}}slice(e,t,o){let i=Wt.create(this.parent,this.mark,!0,o),r=this.children,s=this.size;t<s&&(r=Lr(r,t,s,o)),e>0&&(r=Lr(r,0,e,o));for(let l=0;l<r.length;l++)r[l].parent=i;return i.children=r,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class bt extends uo{constructor(e,t,o,i,r,s,l,a,c){super(e,[],r,s),this.node=t,this.outerDeco=o,this.innerDeco=i,this.nodeDOM=l}static create(e,t,o,i,r,s){let l=r.nodeViews[t.type.name],a,c=l&&l(t,r,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,i),d=c&&c.dom,p=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:p}=Ut.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let u=d;return d=Xd(d,o,t),c?a=new s0(e,t,o,i,d,p||null,u,c,r,s+1):t.isText?new Ci(e,t,o,i,d,u,r):new bt(e,t,o,i,d,p||null,u,r,s+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 o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,t,o){return this.dirty==Ae&&e.eq(this.node)&&ii(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,i=t,r=e.composing?this.localCompositionInfo(e,t):null,s=r&&r.pos>-1?r:null,l=r&&r.pos<0,a=new a0(this,s&&s.node,e);p0(this.node,this.innerDeco,(c,d,p)=>{c.spec.marks?a.syncToMarks(c.spec.marks,o,e):c.type.side>=0&&!p&&a.syncToMarks(d==this.node.childCount?H.none:this.node.child(d).marks,o,e),a.placeWidget(c,e,i)},(c,d,p,u)=>{a.syncToMarks(c.marks,o,e);let f;a.findNodeMatch(c,d,p,u)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=a.findIndexWithChild(r.node))>-1&&a.updateNodeAt(c,d,p,f,e)||a.updateNextNode(c,d,p,e,u,i)||a.addNode(c,d,p,e,i),i+=c.nodeSize}),a.syncToMarks([],o,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Nt)&&(s&&this.protectLocalComposition(e,s),Yd(this.contentDOM,this.children,e),wn&&u0(this.dom))}localCompositionInfo(e,t){let{from:o,to:i}=e.state.selection;if(!(e.state.selection instanceof R)||o<t||i>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let s=r.nodeValue,l=f0(this.node.content,s,o-t,i-t);return l<0?null:{node:r,pos:l,text:s}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:i}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let s=new r0(this,r,t,i);e.input.compositionNodes.push(s),this.children=Lr(this.children,o,o+i.length,e,s)}update(e,t,o,i){return this.dirty==Je||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,i),!0)}updateInner(e,t,o,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ae}updateOuterDeco(e){if(ii(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Zd(this.dom,this.nodeDOM,Rr(this.outerDeco,this.node,t),Rr(e,this.node,t)),this.dom!=o&&(o.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 Gl(n,e,t,o,i){Xd(o,e,n);let r=new bt(void 0,n,e,t,o,o,o,i,0);return r.contentDOM&&r.updateChildren(i,0),r}class Ci extends bt{constructor(e,t,o,i,r,s,l){super(e,t,o,i,r,null,s,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,o,i){return this.dirty==Je||this.dirty!=Ae&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ae||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ae,!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,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let i=this.node.cut(e,t),r=document.createTextNode(i.text);return new Ci(this.parent,i,this.outerDeco,this.innerDeco,r,r,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Je)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jd extends uo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ae&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class s0 extends bt{constructor(e,t,o,i,r,s,l,a,c,d){super(e,t,o,i,r,s,l,c,d),this.spec=a}update(e,t,o,i){if(this.dirty==Je)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,o);return r&&this.updateInner(e,t,o,i),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,i){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,i)}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 Yd(n,e,t){let o=n.firstChild,i=!1;for(let r=0;r<e.length;r++){let s=e[r],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=Wl(o),i=!0;o=o.nextSibling}else i=!0,n.insertBefore(l,o);if(s instanceof Wt){let a=o?o.previousSibling:n.lastChild;Yd(s.contentDOM,s.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=Wl(o),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const _n=function(n){n&&(this.nodeName=n)};_n.prototype=Object.create(null);const Ot=[new _n];function Rr(n,e,t){if(n.length==0)return Ot;let o=t?Ot[0]:new _n,i=[o];for(let r=0;r<n.length;r++){let s=n[r].type.attrs;if(s){s.nodeName&&i.push(o=new _n(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(o=new _n(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return i}function Zd(n,e,t,o){if(t==Ot&&o==Ot)return e;let i=e;for(let r=0;r<o.length;r++){let s=o[r],l=t[r];if(r){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Ot[0]),i=a}l0(i,l||Ot[0],s)}return i}function l0(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let r=0;r<o.length;r++)i.indexOf(o[r])==-1&&n.classList.remove(o[r]);for(let r=0;r<i.length;r++)o.indexOf(i[r])==-1&&n.classList.add(i[r]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=o.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Xd(n,e,t){return Zd(n,n,Ot,Rr(e,t,n.nodeType!=1))}function ii(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 Wl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class a0{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=c0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o){let i=0,r=this.stack.length>>1,s=Math.min(r,e.length);for(;i<s&&(i==r-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<r;)this.destroyRest(),this.top.dirty=Ae,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<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[r])&&!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=Wt.create(this.top,e[r],t,o);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,r++}}findNodeMatch(e,t,o,i){let r=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))r=this.top.children.indexOf(s,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,o)&&!this.preMatch.matched.has(c)){r=l;break}}return r<0?!1:(this.destroyBetween(this.index,r),this.index++,!0)}updateNodeAt(e,t,o,i,r){let s=this.top.children[i];return s.dirty==Je&&s.dom==s.contentDOM&&(s.dirty=Nt),s.update(e,t,o,r)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==o)return i}return-1}e=t}}updateNextNode(e,t,o,i,r,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof bt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=r)return!1;let d=a.dom,p,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Je&&ii(t,a.outerDeco));if(!u&&a.update(e,t,o,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(p=this.recreateWrapper(a,e,t,o,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Nt,p.updateChildren(i,s+1),p.dirty=Ae),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,i,r,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ii(o,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=bt.create(this.top,t,o,i,r,s);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,o,i,r){let s=bt.create(this.top,e,t,o,i,r);s.contentDOM&&s.updateChildren(i,r+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let r=new Kd(this.top,e,t,o);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Wt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ci)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ue||se)&&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 o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let i=new Jd(this.top,[],o,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function c0(n,e){let t=e,o=t.children.length,i=n.childCount,r=new Map,s=[];e:for(;i>0;){let l;for(;;)if(o){let c=t.children[o-1];if(c instanceof Wt)t=c,o=c.children.length;else{l=c,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,r.set(l,i),s.push(l)}}return{index:i,matched:r,matches:s.reverse()}}function d0(n,e){return n.type.side-e.type.side}function p0(n,e,t,o){let i=e.locals(n),r=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);o(d,i,e.forChild(r,d),c),r+=d.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,p;for(;s<i.length&&i[s].to==r;){let b=i[s++];b.widget&&(d?(p||(p=[d])).push(b):d=b)}if(d)if(p){p.sort(d0);for(let b=0;b<p.length;b++)t(p[b],c,!!a)}else t(d,c,!!a);let u,f;if(a)f=-1,u=a,a=null;else if(c<n.childCount)f=c,u=n.child(c++);else break;for(let b=0;b<l.length;b++)l[b].to<=r&&l.splice(b--,1);for(;s<i.length&&i[s].from<=r&&i[s].to>r;)l.push(i[s++]);let h=r+u.nodeSize;if(u.isText){let b=h;s<i.length&&i[s].from<b&&(b=i[s].from);for(let x=0;x<l.length;x++)l[x].to<b&&(b=l[x].to);b<h&&(a=u.cut(b-r),u=u.cut(0,b-r),h=b,f=-1)}else for(;s<i.length&&i[s].to<h;)s++;let g=u.isInline&&!u.isLeaf?l.filter(b=>!b.inline):l.slice();o(u,g,e.forChild(r,u),f),r=h}}function u0(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 f0(n,e,t,o){for(let i=0,r=0;i<n.childCount&&r<=o;){let s=n.child(i++),l=r;if(r+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(r+=c.nodeSize,!c.isText)break;a+=c.text}if(r>=t){if(r>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let c=l<o?a.lastIndexOf(e,o-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Lr(n,e,t,o,i){let r=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,d=l+=a.size;c>=t||d<=e?r.push(a):(c<e&&r.push(a.slice(0,e-c,o)),i&&(r.push(i),i=void 0),d>t&&r.push(a.slice(t-c,a.size,o)))}return r}function vs(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),r=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,c;if(Si(t)){for(a=s;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&D.isSelectable(p)&&i.parent&&!(p.isInline&&Bg(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new D(s==u?l:o.resolve(u))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=s,u=s;for(let f=0;f<t.rangeCount;f++){let h=t.getRangeAt(f);p=Math.min(p,n.docView.posFromDOM(h.startContainer,h.startOffset,1)),u=Math.max(u,n.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(p<0)return null;[a,s]=u==n.state.selection.anchor?[u,p]:[p,u],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!c){let p=e=="pointer"||n.state.selection.head<l.pos&&!r?1:-1;c=ws(n,d,l,p)}return c}function Qd(n){return n.editable?n.hasFocus():tp(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ot(n,e=!1){let t=n.state.selection;if(ep(n,t),!!Qd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&se){let o=n.domSelectionRange(),i=n.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&Gt(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)m0(n);else{let{anchor:o,head:i}=t,r,s;ql&&!(t instanceof R)&&(t.$from.parent.inlineContent||(r=Ul(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Ul(n,t.to))),n.docView.setSelection(o,i,n,e),ql&&(r&&Kl(r),s&&Kl(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&h0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ql=ue||se&&Hd<63;function Ul(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),i=o<t.childNodes.length?t.childNodes[o]:null,r=o?t.childNodes[o-1]:null;if(ue&&i&&i.contentEditable=="false")return Ji(i);if((!i||i.contentEditable=="false")&&(!r||r.contentEditable=="false")){if(i)return Ji(i);if(r)return Ji(r)}}function Ji(n){return n.contentEditable="true",ue&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Kl(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function h0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Qd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function m0(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let o=n.cursorWrapper.dom,i=o.nodeName=="IMG";i?t.setStart(o.parentNode,ne(o)+1):t.setStart(o,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xe&><=11&&(o.disabled=!0,o.disabled=!1)}function ep(n,e){if(e instanceof D){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Jl(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Jl(n)}function Jl(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ws(n,e,t,o){return n.someProp("createSelectionBetween",i=>i(n,e,t))||R.between(e,t,o)}function Yl(n){return n.editable&&!n.hasFocus()?!1:tp(n)}function tp(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 g0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Gt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Br(n,e){let{$anchor:t,$head:o}=n.selection,i=e>0?t.max(o):t.min(o),r=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return r&&z.findFrom(r,e)}function at(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Zl(n,e,t){let o=n.state.selection;if(o instanceof R)if(t.indexOf("s")>-1){let{$head:i}=o,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+r.nodeSize*(e<0?-1:1));return at(n,new R(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Br(n.state,e);return i&&i instanceof D?at(n,i):!1}else if(!(Ee&&t.indexOf("m")>-1)){let i=o.$head,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!r||r.isText)return!1;let l=e<0?i.pos-r.nodeSize:i.pos;return r.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?D.isSelectable(r)?at(n,new D(e<0?n.state.doc.resolve(i.pos-r.nodeSize):i)):po?at(n,new R(n.state.doc.resolve(e<0?l:l+r.nodeSize))):!1:!1}}else return!1;else{if(o instanceof D&&o.node.isInline)return at(n,new R(e>0?o.$to:o.$from));{let i=Br(n.state,e);return i?at(n,i):!1}}}function ri(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Qt(n,e){return e<0?b0(n):y0(n)}function b0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let i,r,s=!1;for(ze&&t.nodeType==1&&o<ri(t)&&Gn(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Gn(l,-1))i=t,r=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(np(t))break;{let l=t.previousSibling;for(;l&&Gn(l,-1);)i=t.parentNode,r=ne(l),l=l.previousSibling;if(l)t=l,o=ri(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?Vr(n,t,o):i&&Vr(n,i,r)}function y0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let i=ri(t),r,s;for(;;)if(o<i){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Gn(l,1))r=t,s=++o;else break}else{if(np(t))break;{let l=t.nextSibling;for(;l&&Gn(l,1);)r=l.parentNode,s=ne(l)+1,l=l.nextSibling;if(l)t=l,o=0,i=ri(t);else{if(t=t.parentNode,t==n.dom)break;o=i=0}}}r&&Vr(n,r,s)}function np(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function x0(n,e){for(;n&&e==n.childNodes.length&&!co(n);)e=ne(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 v0(n,e){for(;n&&!e&&!co(n);)e=ne(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 Vr(n,e,t){if(e.nodeType!=3){let r,s;(s=x0(e,t))?(e=s,t=0):(r=v0(e,t))&&(e=r,t=r.nodeValue.length)}let o=n.domSelection();if(!o)return;if(Si(o)){let r=document.createRange();r.setEnd(e,t),r.setStart(e,t),o.removeAllRanges(),o.addRange(r)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&ot(n)},50)}function Xl(n,e){let t=n.state.doc.resolve(e);if(!(se||Fg)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),s=(r.top+r.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(r.left-i.left)>1)return r.left<i.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),s=(r.top+r.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(r.left-i.left)>1)return r.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Ql(n,e,t){let o=n.state.selection;if(o instanceof R&&!o.empty||t.indexOf("s")>-1||Ee&&t.indexOf("m")>-1)return!1;let{$from:i,$to:r}=o;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Br(n.state,e);if(s&&s instanceof D)return at(n,s)}if(!i.parent.inlineContent){let s=e<0?i:r,l=o instanceof ke?z.near(s,e):z.findFrom(s,e);return l?at(n,l):!1}return!1}function ea(n,e){if(!(n.state.selection instanceof R))return!0;let{$head:t,$anchor:o,empty:i}=n.state.selection;if(!t.sameParent(o))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let s=n.state.tr;return e<0?s.delete(t.pos-r.nodeSize,t.pos):s.delete(t.pos,t.pos+r.nodeSize),n.dispatch(s),!0}return!1}function ta(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function w0(n){if(!ue||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 o=e.firstChild;ta(n,o,"true"),setTimeout(()=>ta(n,o,"false"),20)}return!1}function S0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function C0(n,e){let t=e.keyCode,o=S0(e);if(t==8||Ee&&t==72&&o=="c")return ea(n,-1)||Qt(n,-1);if(t==46&&!e.shiftKey||Ee&&t==68&&o=="c")return ea(n,1)||Qt(n,1);if(t==13||t==27)return!0;if(t==37||Ee&&t==66&&o=="c"){let i=t==37?Xl(n,n.state.selection.from)=="ltr"?-1:1:-1;return Zl(n,i,o)||Qt(n,i)}else if(t==39||Ee&&t==70&&o=="c"){let i=t==39?Xl(n,n.state.selection.from)=="ltr"?1:-1:1;return Zl(n,i,o)||Qt(n,i)}else{if(t==38||Ee&&t==80&&o=="c")return Ql(n,-1,o)||Qt(n,-1);if(t==40||Ee&&t==78&&o=="c")return w0(n)||Ql(n,1,o)||Qt(n,1);if(o==(Ee?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function op(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:o,openStart:i,openEnd:r}=e;for(;i>1&&r>1&&o.childCount==1&&o.firstChild.childCount==1;){i--,r--;let f=o.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),o=f.content}let s=n.someProp("clipboardSerializer")||Ut.fromSchema(n.state.schema),l=cp(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let c=a.firstChild,d,p=0;for(;c&&c.nodeType==1&&(d=ap[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let h=l.createElement(d[f]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),p++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${r}${p?` -${p}`:""} ${JSON.stringify(t)}`);let u=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
914
|
+
|
|
915
|
+
`);return{dom:a,text:u,slice:e}}function ip(n,e,t,o,i){let r=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(o||r||!t);if(a){if(n.someProp("transformPastedText",u=>{e=u(e,r||o,n)}),r)return e?new j(M.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
916
|
+
`))),0,0):j.empty;let p=n.someProp("clipboardTextParser",u=>u(e,i,o,n));if(p)l=p;else{let u=i.marks(),{schema:f}=n.state,h=Ut.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(h.serializeNode(f.text(g,u)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),s=M0(t),po&&A0(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let p=+d[3];p>0;p--){let u=s.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;s=u}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||_t.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!k0.test(u.parentNode.nodeName)?{ignore:!0}:null}})),d)l=j0(na(l,+d[1],+d[2]),d[4]);else if(l=j.maxOpen(T0(l.content,i),!0),l.openStart||l.openEnd){let p=0,u=0;for(let f=l.content.firstChild;p<l.openStart&&!f.type.spec.isolating;p++,f=f.firstChild);for(let f=l.content.lastChild;u<l.openEnd&&!f.type.spec.isolating;u++,f=f.lastChild);l=na(l,p,u)}return n.someProp("transformPasted",p=>{l=p(l,n)}),l}const k0=/^(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 T0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),r,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&r.length&&sp(a,r,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=lp(s[s.length-1],r.length));let d=rp(l,a);s.push(d),i=i.matchType(d.type),r=a}}),s)return M.from(s)}return n}function rp(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,M.from(n));return n}function sp(n,e,t,o,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let r=sp(n,e,t,o.lastChild,i+1);if(r)return o.copy(o.content.replaceChild(o.childCount-1,r));if(o.contentMatchAt(o.childCount).matchType(i==n.length-1?t.type:n[i+1]))return o.copy(o.content.append(M.from(rp(t,n,i+1))))}}function lp(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,lp(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(M.empty,!0);return n.copy(t.append(o))}function Hr(n,e,t,o,i,r){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(r=0),i<o-1&&(l=Hr(l,e,t,o,i+1,r)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,r<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(M.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function na(n,e,t){return e<n.openStart&&(n=new j(Hr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new j(Hr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ap={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 oa=null;function cp(){return oa||(oa=document.implementation.createHTMLDocument("title"))}let Yi=null;function E0(n){let e=window.trustedTypes;return e?(Yi||(Yi=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Yi.createHTML(n)):n}function M0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=cp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),i;if((i=o&&ap[o[1].toLowerCase()])&&(n=i.map(r=>"<"+r+">").join("")+n+i.map(r=>"</"+r+">").reverse().join("")),t.innerHTML=E0(n),i)for(let r=0;r<i.length;r++)t=t.querySelector(i[r])||t;return t}function A0(n){let e=n.querySelectorAll(se?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function j0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:i,openStart:r,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;i=M.from(a.create(o[l+1],i)),r++,s++}return new j(i,r,s)}const fe={},he={},$0={touchstart:!0,touchmove:!0};class P0{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 N0(n){for(let e in fe){let t=fe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{I0(n,o)&&!Ss(n,o)&&(n.editable||!(o.type in he))&&t(n,o)},$0[e]?{passive:!0}:void 0)}ue&&n.dom.addEventListener("input",()=>null),Fr(n)}function ht(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function O0(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 Fr(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>Ss(n,o))})}function Ss(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function I0(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 D0(n,e){!Ss(n,e)&&fe[e.type]&&(n.editable||!(e.type in he))&&fe[e.type](n,e)}he.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!pp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Pe&&se&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),wn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",i=>i(n,jt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||C0(n,t)?t.preventDefault():ht(n,"key")};he.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};he.keypress=(n,e)=>{let t=e;if(pp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ee&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof R)||!o.$from.sameParent(o.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",r=>r(n,o.$from.pos,o.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function ki(n){return{left:n.clientX,top:n.clientY}}function z0(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function Cs(n,e,t,o,i){if(o==-1)return!1;let r=n.state.doc.resolve(o);for(let s=r.depth+1;s>0;s--)if(n.someProp(e,l=>s>r.depth?l(n,t,r.nodeAfter,r.before(s),i,!0):l(n,t,r.node(s),r.before(s),i,!1)))return!0;return!1}function mn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function R0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&D.isSelectable(o)?(mn(n,new D(t)),!0):!1}function L0(n,e){if(e==-1)return!1;let t=n.state.selection,o,i;t instanceof D&&(o=t.node);let r=n.state.doc.resolve(e);for(let s=r.depth+1;s>0;s--){let l=s>r.depth?r.nodeAfter:r.node(s);if(D.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?i=r.before(t.$from.depth):i=r.before(s);break}}return i!=null?(mn(n,D.create(n.state.doc,i)),!0):!1}function B0(n,e,t,o,i){return Cs(n,"handleClickOn",e,t,o)||n.someProp("handleClick",r=>r(n,e,o))||(i?L0(n,t):R0(n,t))}function V0(n,e,t,o){return Cs(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",i=>i(n,e,o))}function H0(n,e,t,o){return Cs(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",i=>i(n,e,o))||F0(n,t,o)}function F0(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(mn(n,R.create(o,0,o.content.size)),!0):!1;let i=o.resolve(e);for(let r=i.depth+1;r>0;r--){let s=r>i.depth?i.nodeAfter:i.node(r),l=i.before(r);if(s.inlineContent)mn(n,R.create(o,l+1,l+1+s.content.size));else if(D.isSelectable(s))mn(n,D.create(o,l));else continue;return!0}}function ks(n){return si(n)}const dp=Ee?"metaKey":"ctrlKey";fe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=ks(n),i=Date.now(),r="singleClick";i-n.input.lastClick.time<500&&z0(t,n.input.lastClick)&&!t[dp]&&(n.input.lastClick.type=="singleClick"?r="doubleClick":n.input.lastClick.type=="doubleClick"&&(r="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:r};let s=n.posAtCoords(ki(t));s&&(r=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new _0(n,s,t,!!o)):(r=="doubleClick"?V0:H0)(n,s.pos,s.inside,t)?t.preventDefault():ht(n,"pointer"))};class _0{constructor(e,t,o,i){this.view=e,this.pos=t,this.event=o,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[dp],this.allowDefault=o.shiftKey;let r,s;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);r=d.parent,s=d.depth?d.before():0}const l=i?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(o.button==0&&r.type.spec.draggable&&r.type.spec.selectable!==!1||c instanceof D&&c.from<=s&&c.to>s)&&(this.mightDrag={node:r,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ze&&!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)),ht(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(()=>ot(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(ki(e))),this.updateAllowDefault(e),this.allowDefault||!t?ht(this.view,"pointer"):B0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ue&&this.mightDrag&&!this.mightDrag.node.isAtom||se&&!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)?(mn(this.view,z.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ht(this.view,"pointer")}move(e){this.updateAllowDefault(e),ht(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)}}fe.touchstart=n=>{n.input.lastTouch=Date.now(),ks(n),ht(n,"pointer")};fe.touchmove=n=>{n.input.lastTouch=Date.now(),ht(n,"pointer")};fe.contextmenu=n=>ks(n);function pp(n,e){return n.composing?!0:ue&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const G0=Pe?5e3:-1;he.compositionstart=he.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(o=>o.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),si(n,!0),n.markCursor=null;else if(si(n,!e.selection.empty),ze&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let i=o.focusNode,r=o.focusOffset;i&&i.nodeType==1&&r!=0;){let s=r<0?i.lastChild:i.childNodes[r-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,r=-1}}n.input.composing=!0}up(n,G0)};he.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++,up(n,20))};function up(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>si(n),e))}function fp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=q0());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function W0(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Rg(e.focusNode,e.focusOffset),o=Lg(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let i=o.pmViewDesc,r=n.domObserver.lastChangedTextNode;if(t==r||o==r)return r;if(!i||!i.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return o}}return t||o}function q0(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function si(n,e=!1){if(!(Pe&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),fp(n),e||n.docView&&n.docView.dirty){let t=vs(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 U0(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 o=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const oo=xe&><15||wn&&_g<604;fe.copy=he.cut=(n,e)=>{let t=e,o=n.state.selection,i=t.type=="cut";if(o.empty)return;let r=oo?null:t.clipboardData,s=o.content(),{dom:l,text:a}=op(n,s);r?(t.preventDefault(),r.clearData(),r.setData("text/html",l.innerHTML),r.setData("text/plain",a)):U0(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function K0(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function J0(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?io(n,o.value,null,i,e):io(n,o.textContent,o.innerHTML,i,e)},50)}function io(n,e,t,o,i){let r=ip(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,r||j.empty)))return!0;if(!r)return!1;let s=K0(r),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(r);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function hp(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," "):""}he.paste=(n,e)=>{let t=e;if(n.composing&&!Pe)return;let o=oo?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&io(n,hp(o),o.getData("text/html"),i,t)?t.preventDefault():J0(n,t)};class mp{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const gp=Ee?"altKey":"ctrlKey";fe.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let i=n.state.selection,r=i.empty?null:n.posAtCoords(ki(t)),s;if(!(r&&r.pos>=i.from&&r.pos<=(i instanceof D?i.to-1:i.to))){if(o&&o.mightDrag)s=D.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(s=D.create(n.state.doc,p.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=op(n,l);(!t.dataTransfer.files.length||!se||Hd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(oo?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",oo||t.dataTransfer.setData("text/plain",c),n.dragging=new mp(d,!t[gp],s)};fe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};he.dragover=he.dragenter=(n,e)=>e.preventDefault();he.drop=(n,e)=>{let t=e,o=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(ki(t));if(!i)return;let r=n.state.doc.resolve(i.pos),s=o&&o.slice;s?n.someProp("transformPasted",h=>{s=h(s,n)}):s=ip(n,hp(t.dataTransfer),oo?null:t.dataTransfer.getData("text/html"),!1,r);let l=!!(o&&!t[gp]);if(n.someProp("handleDrop",h=>h(n,t,s||j.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?_m(n.state.doc,r.pos,s):r.pos;a==null&&(a=r.pos);let c=n.state.tr;if(l){let{node:h}=o;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(a),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,u=c.doc;if(p?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(u))return;let f=c.doc.resolve(d);if(p&&D.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new D(f));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,b,x,C)=>h=C),c.setSelection(ws(n,f,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};fe.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())&&ot(n)},20))};fe.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)};fe.beforeinput=(n,e)=>{if(se&&Pe&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,jt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in he)fe[n]=he[n];function ro(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 li{constructor(e,t){this.toDOM=e,this.spec=t||Bt,this.side=this.spec.side||0}map(e,t,o,i){let{pos:r,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new ye(r-o,r-o,this)}valid(){return!0}eq(e){return this==e||e instanceof li&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ro(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yt{constructor(e,t){this.attrs=e,this.spec=t||Bt}map(e,t,o,i){let r=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-o;return r>=s?null:new ye(r,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof yt&&ro(this.attrs,e.attrs)&&ro(this.spec,e.spec)}static is(e){return e.type instanceof yt}destroy(){}}class Ts{constructor(e,t){this.attrs=e,this.spec=t||Bt}map(e,t,o,i){let r=e.mapResult(t.from+i,1);if(r.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=r.pos?null:new ye(r.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:i}=e.content.findIndex(t.from),r;return i==t.from&&!(r=e.child(o)).isText&&i+r.nodeSize==t.to}eq(e){return this==e||e instanceof Ts&&ro(this.attrs,e.attrs)&&ro(this.spec,e.spec)}destroy(){}}class ye{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new ye(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,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new ye(e,e,new li(t,o))}static inline(e,t,o,i){return new ye(e,t,new yt(o,i))}static node(e,t,o,i){return new ye(e,t,new Ts(o,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yt}get widget(){return this.type instanceof li}}const nn=[],Bt={};class U{constructor(e,t){this.local=e.length?e:nn,this.children=t.length?t:nn}static create(e,t){return t.length?ai(t,e,0,Bt):ie}find(e,t,o){let i=[];return this.findInner(e??0,t??1e9,i,0,o),i}findInner(e,t,o,i,r){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!r||r(l.spec))&&o.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,i+l,r)}}map(e,t,o){return this==ie||e.maps.length==0?this:this.mapInner(e,t,0,0,o||Bt)}mapInner(e,t,o,i,r){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):r.onRemove&&r.onRemove(this.local[l].spec)}return this.children.length?Y0(this.children,s||[],e,t,o,i,r):s?new U(s.sort(Vt),nn):ie}add(e,t){return t.length?this==ie?U.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let i,r=0;e.forEach((l,a)=>{let c=a+o,d;if(d=yp(t,l,c)){for(i||(i=this.children.slice());r<i.length&&i[r]<a;)r+=3;i[r]==a?i[r+2]=i[r+2].addInner(l,d,c+1):i.splice(r,0,a,a+l.nodeSize,ai(d,l,c+1,Bt)),r+=3}});let s=bp(r?xp(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new U(s.length?this.local.concat(s).sort(Vt):this.local,i||this.children)}remove(e){return e.length==0||this==ie?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,i=this.local;for(let r=0;r<o.length;r+=3){let s,l=o[r]+t,a=o[r+1]+t;for(let d=0,p;d<e.length;d++)(p=e[d])&&p.from>l&&p.to<a&&(e[d]=null,(s||(s=[])).push(p));if(!s)continue;o==this.children&&(o=this.children.slice());let c=o[r+2].removeInner(s,l+1);c!=ie?o[r+2]=c:(o.splice(r,3),r-=3)}if(i.length){for(let r=0,s;r<e.length;r++)if(s=e[r])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return o==this.children&&i==this.local?this:i.length||o.length?new U(i,o):ie}forChild(e,t){if(this==ie)return this;if(t.isLeaf)return U.empty;let o,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let r=e+1,s=r+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>r&&a.type instanceof yt){let c=Math.max(r,a.from)-r,d=Math.min(s,a.to)-r;c<d&&(i||(i=[])).push(a.copy(c,d))}}if(i){let l=new U(i.sort(Vt),nn);return o?new ct([l,o]):l}return o||ie}eq(e){if(this==e)return!0;if(!(e instanceof U)||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 Es(this.localsInner(e))}localsInner(e){if(this==ie)return nn;if(e.inlineContent||!this.local.some(yt.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof yt||t.push(this.local[o]);return t}forEachSet(e){e(this)}}U.empty=new U([],[]);U.removeOverlap=Es;const ie=U.empty;class ct{constructor(e){this.members=e}map(e,t){const o=this.members.map(i=>i.map(e,t,Bt));return ct.from(o)}forChild(e,t){if(t.isLeaf)return U.empty;let o=[];for(let i=0;i<this.members.length;i++){let r=this.members[i].forChild(e,t);r!=ie&&(r instanceof ct?o=o.concat(r.members):o.push(r))}return ct.from(o)}eq(e){if(!(e instanceof ct)||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,o=!0;for(let i=0;i<this.members.length;i++){let r=this.members[i].localsInner(e);if(r.length)if(!t)t=r;else{o&&(t=t.slice(),o=!1);for(let s=0;s<r.length;s++)t.push(r[s])}}return t?Es(o?t:t.sort(Vt)):nn}static from(e){switch(e.length){case 0:return ie;case 1:return e[0];default:return new ct(e.every(t=>t instanceof U)?e:e.reduce((t,o)=>t.concat(o instanceof U?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Y0(n,e,t,o,i,r,s){let l=n.slice();for(let c=0,d=r;c<t.maps.length;c++){let p=0;t.maps[c].forEach((u,f,h,g)=>{let b=g-h-(f-u);for(let x=0;x<l.length;x+=3){let C=l[x+1];if(C<0||u>C+d-p)continue;let y=l[x]+d-p;f>=y?l[x+1]=u<=y?-2:-1:u>=d&&b&&(l[x]+=b,l[x+1]+=b)}p+=b}),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]+r),p=d-i;if(p<0||p>=o.content.size){a=!0;continue}let u=t.map(n[c+1]+r,-1),f=u-i,{index:h,offset:g}=o.content.findIndex(p),b=o.maybeChild(h);if(b&&g==p&&g+b.nodeSize==f){let x=l[c+2].mapInner(t,b,d+1,n[c]+r+1,s);x!=ie?(l[c]=p,l[c+1]=f,l[c+2]=x):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Z0(l,n,e,t,i,r,s),d=ai(c,o,0,s);e=d.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,u=0;p<d.children.length;p+=3){let f=d.children[p];for(;u<l.length&&l[u]<f;)u+=3;l.splice(u,0,d.children[p],d.children[p+1],d.children[p+2])}}return new U(e.sort(Vt),l)}function bp(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let i=n[o];t.push(new ye(i.from+e,i.to+e,i.type))}return t}function Z0(n,e,t,o,i,r,s){function l(a,c){for(let d=0;d<a.local.length;d++){let p=a.local[d].map(o,i,c);p?t.push(p):s.onRemove&&s.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]+r+1);return t}function yp(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,i=null;for(let r=0,s;r<n.length;r++)(s=n[r])&&s.from>t&&s.to<o&&((i||(i=[])).push(s),n[r]=null);return i}function xp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ai(n,e,t,o){let i=[],r=!1;e.forEach((l,a)=>{let c=yp(n,l,a+t);if(c){r=!0;let d=ai(c,l,t+a+1,o);d!=ie&&i.push(a,a+l.nodeSize,d)}});let s=bp(r?xp(n):n,-t).sort(Vt);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new U(s,i):ie}function Vt(n,e){return n.from-e.from||n.to-e.to}function Es(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let i=t+1;i<e.length;i++){let r=e[i];if(r.from==o.from){r.to!=o.to&&(e==n&&(e=n.slice()),e[i]=r.copy(r.from,o.to),ia(e,i+1,r.copy(o.to,r.to)));continue}else{r.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,r.from),ia(e,i,o.copy(r.from,o.to)));break}}}return e}function ia(n,e,t){for(;e<n.length&&Vt(t,n[e])>0;)e++;n.splice(e,0,t)}function Zi(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=ie&&e.push(o)}),n.cursorWrapper&&e.push(U.create(n.state.doc,[n.cursorWrapper.deco])),ct.from(e)}const X0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Q0=xe&><=11;class e1{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 t1{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new e1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let i=0;i<o.length;i++)this.queue.push(o[i]);xe&><=11&&o.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Q0&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,X0)),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(Yl(this.view)){if(this.suppressingSelectionUpdates)return ot(this.view);if(xe&><=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gt(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,o;for(let r=e.focusNode;r;r=no(r))t.add(r);for(let r=e.anchorNode;r;r=no(r))if(t.has(r)){o=r;break}let i=o&&this.view.docView.nearestDesc(o);if(i&&i.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 o=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Yl(e)&&!this.ignoreSelectionChange(o),r=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let p=this.registerMutation(t[d],a);p&&(r=r<0?p.from:Math.min(p.from,r),s=s<0?p.to:Math.max(p.to,s),p.typeOver&&(l=!0))}if(ze&&a.length){let d=a.filter(p=>p.nodeName=="BR");if(d.length==2){let[p,u]=d;p.parentNode&&p.parentNode.parentNode==u.parentNode?u.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let u of d){let f=u.parentNode;f&&f.nodeName=="LI"&&(!p||i1(e,p)!=f)&&u.remove()}}}let c=null;r<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Si(o)&&(c=vs(e))&&c.eq(z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ot(e),this.currentSelection.set(o),e.scrollToSelection()):(r>-1||i)&&(r>-1&&(e.docView.markDirty(r,s),n1(e)),this.handleDOMChange(r,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||ot(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let p=e.addedNodes[d];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,r=e.nextSibling;if(xe&><=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:p,nextSibling:u}=e.addedNodes[d];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(r=u)}let s=i&&i.parentNode==e.target?ne(i)+1:0,l=o.localPosFromDOM(e.target,s,-1),a=r&&r.parentNode==e.target?ne(r):e.target.childNodes.length,c=o.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ra=new WeakMap,sa=!1;function n1(n){if(!ra.has(n)&&(ra.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ze,sa)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."),sa=!0}}function la(n,e){let t=e.startContainer,o=e.startOffset,i=e.endContainer,r=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Gt(s.node,s.offset,i,r)&&([t,o,i,r]=[i,r,t,o]),{anchorNode:t,anchorOffset:o,focusNode:i,focusOffset:r}}function o1(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return la(n,i)}let t;function o(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?la(n,t):null}function i1(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function r1(n,e,t){let{node:o,fromOffset:i,toOffset:r,from:s,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}],Si(a)||c.push({node:a.focusNode,offset:a.focusOffset})),se&&n.input.lastKeyCode===8)for(let b=r;b>i;b--){let x=o.childNodes[b-1],C=x.pmViewDesc;if(x.nodeName=="BR"&&!C){r=b;break}if(!C||C.size)break}let p=n.state.doc,u=n.someProp("domParser")||_t.fromSchema(n.state.schema),f=p.resolve(s),h=null,g=u.parse(o,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:r,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:s1,context:f});if(c&&c[0].pos!=null){let b=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=b),h={anchor:b+s,head:x+s}}return{doc:g,sel:h,from:s,to:l}}function s1(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ue&&/^(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||ue&&/^(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 l1=/^(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 a1(n,e,t,o,i){let r=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=vs(n,T);if(A&&!n.state.selection.eq(A)){if(se&&Pe&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",P=>P(n,jt(13,"Enter"))))return;let $=n.state.tr.setSelection(A);T=="pointer"?$.setMeta("pointer",!0):T=="key"&&$.scrollIntoView(),r&&$.setMeta("composition",r),n.dispatch($)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=r1(n,e,t),d=n.state.doc,p=d.slice(c.from,c.to),u,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(u=n.state.selection.to,f="end"):(u=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let h=p1(p.content,c.doc.content,c.from,u,f);if(h&&n.input.domChangeCount++,(wn&&n.input.lastIOSEnter>Date.now()-225||Pe)&&i.some(T=>T.nodeType==1&&!l1.test(T.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",T=>T(n,jt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(o&&a instanceof R&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=aa(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let A=n.state.tr.setSelection(T);r&&A.setMeta("composition",r),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&h.start==h.endB&&n.state.selection instanceof R&&(h.start>n.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA<n.state.selection.to&&h.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),xe&><=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),b=c.doc.resolveNoCache(h.endB-c.from),x=d.resolve(h.start),C=g.sameParent(b)&&g.parent.inlineContent&&x.end()>=h.endA,y;if((wn&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&g.pos<c.doc.content.size&&!g.sameParent(b)&&(y=z.findFrom(c.doc.resolve(g.pos+1),1,!0))&&y.head==b.pos)&&n.someProp("handleKeyDown",T=>T(n,jt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&d1(d,h.start,h.endA,g,b)&&n.someProp("handleKeyDown",T=>T(n,jt(8,"Backspace")))){Pe&&se&&n.domObserver.suppressSelectionUpdates();return}se&&Pe&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),Pe&&!C&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,b=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,jt(13,"Enter"))})},20));let v=h.start,k=h.endA,w,S,E;if(C){if(g.pos==b.pos)xe&><=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ot(n),20)),w=n.state.tr.delete(v,k),S=d.resolve(h.start).marksAcross(d.resolve(h.endA));else if(h.endA==h.endB&&(E=c1(g.parent.content.cut(g.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,h.endA-x.start()))))w=n.state.tr,E.type=="add"?w.addMark(v,k,E.mark):w.removeMark(v,k,E.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let T=g.parent.textBetween(g.parentOffset,b.parentOffset);if(n.someProp("handleTextInput",A=>A(n,v,k,T)))return;w=n.state.tr.insertText(T,v,k)}}if(w||(w=n.state.tr.replace(v,k,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let T=aa(n,w.doc,c.sel);T&&!(se&&Pe&&n.composing&&T.empty&&(h.start!=h.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==v||T.head==w.mapping.map(k)-1)||xe&&T.empty&&T.head==v)&&w.setSelection(T)}S&&w.ensureMarks(S),r&&w.setMeta("composition",r),n.dispatch(w.scrollIntoView())}function aa(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ws(n,e.resolve(t.anchor),e.resolve(t.head))}function c1(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,i=t,r=o,s,l,a;for(let d=0;d<o.length;d++)i=o[d].removeFromSet(i);for(let d=0;d<t.length;d++)r=t[d].removeFromSet(r);if(i.length==1&&r.length==0)l=i[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&r.length==1)l=r[0],s="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(M.from(c).eq(n))return{mark:l,type:s}}function d1(n,e,t,o,i){if(t-e<=i.pos-o.pos||Xi(o,!0,!1)<i.pos)return!1;let r=n.resolve(e);if(!o.parent.isTextblock){let l=r.nodeAfter;return l!=null&&t==e+l.nodeSize}if(r.parentOffset<r.parent.content.size||!r.parent.isTextblock)return!1;let s=n.resolve(Xi(r,!0,!0));return!s.parent.isTextblock||s.pos>t||Xi(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Xi(n,e,t){let o=n.depth,i=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,i++,e=!1;if(t){let r=n.node(o).maybeChild(n.indexAfter(o));for(;r&&!r.isLeaf;)r=r.firstChild,i++}return i}function p1(n,e,t,o,i){let r=n.findDiffStart(e,t);if(r==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,r-Math.min(s,l));o-=s+a-r}if(s<r&&n.size<e.size){let a=o<=r&&o>=s?r-o:0;r-=a,r&&r<e.size&&ca(e.textBetween(r-1,r+1))&&(r+=a?1:-1),l=r+(l-s),s=r}else if(l<r){let a=o<=r&&o>=l?r-o:0;r-=a,r&&r<n.size&&ca(n.textBetween(r-1,r+1))&&(r+=a?1:-1),s=r+(s-l),l=r}return{start:r,endA:s,endB:l}}function ca(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 u1{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 P0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ha),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=ua(this),pa(this),this.nodeViews=fa(this),this.docView=Gl(this.state.doc,da(this),Zi(this),this.dom,this),this.domObserver=new t1(this,(o,i,r,s)=>a1(this,o,i,r,s)),this.domObserver.start(),N0(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&&Fr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ha),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let i=this.state,r=!1,s=!1;e.storedMarks&&this.composing&&(fp(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=fa(this);h1(f,this.nodeViews)&&(this.nodeViews=f,r=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Fr(this),this.editable=ua(this),pa(this);let a=Zi(this),c=da(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",p=r||!this.docView.matchesNode(e.doc,c,a);(p||!e.selection.eq(i.selection))&&(s=!0);let u=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&qg(this);if(s){this.domObserver.stop();let f=p&&(xe||se)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&f1(i.selection,e.selection);if(p){let h=se?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=W0(this)),(r||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Gl(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&g0(this))?ot(this,f):(ep(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((o=this.dragging)===null||o===void 0)&&o.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():u&&Ug(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof D){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ll(this,t.getBoundingClientRect(),e)}else Ll(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 o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,i=-1;if(this.state.doc.nodeAt(o.from)==o.node)i=o.from;else{let r=o.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==o.node&&(i=r)}this.dragging=new mp(e.slice,e.move,i<0?void 0:D.create(this.state.doc,i))}someProp(e,t){let o=this._props&&this._props[e],i;if(o!=null&&(i=t?t(o):o))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let r=this.state.plugins;if(r)for(let s=0;s<r.length;s++){let l=r[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(xe){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&&Kg(this.dom),ot(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 Qg(this,e)}coordsAtPos(e,t=1){return qd(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,o=-1){let i=this.docView.posFromDOM(e,t,o);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return i0(this,t||this.state,e)}pasteHTML(e,t){return io(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return io(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(O0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Dg())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return D0(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?ue&&this.root.nodeType===11&&Vg(this.dom.ownerDocument)==this.dom&&o1(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function da(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 o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[ye.node(0,n.state.doc.content.size,e)]}function pa(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:ye.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ua(n){return!n.someProp("editable",e=>e(n.state)===!1)}function f1(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 fa(n){let e=Object.create(null);function t(o){for(let i in o)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=o[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function h1(n,e){let t=0,o=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)o++;return t!=o}function ha(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 _r,Gr;if(typeof WeakMap<"u"){let n=new WeakMap;_r=e=>n.get(e),Gr=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;_r=o=>{for(let i=0;i<n.length;i+=2)if(n[i]==o)return n[i+1]},Gr=(o,i)=>(t==10&&(t=0),n[t++]=o,n[t++]=i)}var J=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,i=e/this.width|0;let r=o+1,s=i+1;for(let l=1;r<this.width&&this.map[e+l]==t;l++)r++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:i,right:r,bottom:s}}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:o,right:i,top:r,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:i==this.width)?null:this.map[r*this.width+(t<0?o-1:i)]:(t<0?r==0:s==this.height)?null:this.map[o+this.width*(t<0?r-1:s)]}rectBetween(n,e){const{left:t,right:o,top:i,bottom:r}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(o,l),bottom:Math.max(r,c)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let i=n.left;i<n.right;i++){const r=o*this.width+i,s=this.map[r];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[r-1]==s||o==n.top&&o&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,i=0;;o++){const r=i+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?r-1:this.map[s]}i=r}}static get(n){return _r(n)||Gr(n,m1(n))}};function m1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=g1(n),t=n.childCount,o=[];let i=0,r=null;const s=[];for(let c=0,d=e*t;c<d;c++)o[c]=0;for(let c=0,d=0;c<t;c++){const p=n.child(c);d++;for(let h=0;;h++){for(;i<o.length&&o[i]!=0;)i++;if(h==p.childCount)break;const g=p.child(h),{colspan:b,rowspan:x,colwidth:C}=g.attrs;for(let y=0;y<x;y++){if(y+c>=t){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:x-y});break}const v=i+y*e;for(let k=0;k<b;k++){o[v+k]==0?o[v+k]=d:(r||(r=[])).push({type:"collision",row:c,pos:d,n:b-k});const w=C&&C[k];if(w){const S=(v+k)%e*2,E=s[S];E==null||E!=w&&s[S+1]==1?(s[S]=w,s[S+1]=1):E==w&&s[S+1]++}}}i+=b,d+=g.nodeSize}const u=(c+1)*e;let f=0;for(;i<u;)o[i++]==0&&f++;f&&(r||(r=[])).push({type:"missing",row:c,n:f}),d++}const l=new J(e,t,o,r);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&b1(l,s,n),l}function g1(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const i=n.child(o);let r=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>o&&(r+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);r+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function b1(n,e,t){n.problems||(n.problems=[]);const o={};for(let i=0;i<n.map.length;i++){const r=n.map[i];if(o[r])continue;o[r]=!0;const s=t.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const d=(i+c)%n.width,p=e[d*2];p!=null&&(!a.colwidth||a.colwidth[c]!=p)&&((l||(l=y1(a)))[c]=p)}l&&n.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:l})}}function y1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ma(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),o=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(s=>Number(s)):null,i=Number(n.getAttribute("colspan")||1),r={colspan:i,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:o&&o.length==i?o:null};for(const s in e){const l=e[s].getFromDOM,a=l&&l(n);a!=null&&(r[s]=a)}return r}function ga(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 o in e){const i=e[o].setDOMAttr;i&&i(n.attrs[o],t)}return t}function x1(n){const e=n.cellAttributes||{},t={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const o in e)t[o]={default:e[o].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:o=>ma(o,e)}],toDOM(o){return["td",ga(o,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:o=>ma(o,e)}],toDOM(o){return["th",ga(o,e),0]}}}}function Ye(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],i=o.spec.tableRole;i&&(e[i]=o)}}return e}var dt=new ao("selectingCells");function fo(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 Ti(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 Ms(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=fo(e.$head)||v1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function v1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Wr(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function w1(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function As(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function vp(n,e,t){const o=n.node(-1),i=J.get(o),r=n.start(-1),s=i.nextCell(n.pos-r,e,t);return s==null?null:n.node(0).resolve(r+s)}function Sn(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}var Q=class Qe extends z{constructor(e,t=e){const o=e.node(-1),i=J.get(o),r=e.start(-1),s=i.rectBetween(e.pos-r,t.pos-r),l=e.node(0),a=i.cellsInRect(s).filter(d=>d!=t.pos-r);a.unshift(t.pos-r);const c=a.map(d=>{const p=o.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const u=r+d+1;return new Cd(l.resolve(u),l.resolve(u+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Wr(o)&&Wr(i)&&As(o,i)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?Qe.rowSelection(o,i):r&&this.isColSelection()?Qe.colSelection(o,i):new Qe(o,i)}return R.between(o,i)}content(){const e=this.$anchorCell.node(-1),t=J.get(e),o=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let d=a*t.width+i.left,p=i.left;p<i.right;p++,d++){const u=t.map[d];if(r[u])continue;r[u]=!0;const f=t.findCell(u);let h=e.nodeAt(u);if(!h)throw RangeError(`No cell with offset ${u} found`);const g=i.left-f.left,b=f.right-i.right;if(g>0||b>0){let x=h.attrs;if(g>0&&(x=Sn(x,0,g)),b>0&&(x=Sn(x,x.colspan-b,b)),f.left<i.left){if(h=h.type.createAndFill(x),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else h=h.type.create(x,h.content)}if(f.top<i.top||f.bottom>i.bottom){const x={...h.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?h=h.type.createAndFill(x):h=h.type.create(x,h.content)}c.push(h)}s.push(e.child(a).copy(M.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new j(M.from(l),1,1)}replace(e,t=j.empty){const o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(o);e.replace(c.map(l.pos),c.map(a.pos),s?j.empty:t)}const r=z.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,t){this.replace(e,new j(M.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=J.get(t),i=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<r.length;s++)e(t.nodeAt(r[s]),i+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),i=J.get(o),r=e.start(-1),s=i.findCell(e.pos-r),l=i.findCell(t.pos-r),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(r+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(r+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(r+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(r+i.map[i.width*(i.height-1)+s.right-1]))),new Qe(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=J.get(e),o=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-o),r=t.colCount(this.$headCell.pos-o);if(Math.min(i,r)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Qe&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),i=J.get(o),r=e.start(-1),s=i.findCell(e.pos-r),l=i.findCell(t.pos-r),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(r+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(r+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(r+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(r+i.map[i.width*(s.top+1)-1]))),new Qe(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Qe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Qe(e.resolve(t),e.resolve(o))}getBookmark(){return new S1(this.$anchorCell.pos,this.$headCell.pos)}};Q.prototype.visible=!1;z.jsonID("cell",Q);var S1=class wp{constructor(e,t){this.anchor=e,this.head=t}map(e){return new wp(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&As(t,o)?new Q(t,o):z.near(o,1)}};function C1(n){if(!(n.selection instanceof Q))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(ye.node(o,o+t.nodeSize,{class:"selectedCell"}))}),U.create(n.doc,e)}function k1({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return t==o&&/row|table/.test(n.node(i).type.spec.tableRole)}function T1({$from:n,$to:e}){let t,o;for(let i=n.depth;i>0;i--){const r=n.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){t=r;break}}for(let i=e.depth;i>0;i--){const r=e.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return t!==o&&e.parentOffset===0}function E1(n,e,t){const o=(e||n).selection,i=(e||n).doc;let r,s;if(o instanceof D&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=Q.create(i,o.from);else if(s=="row"){const l=i.resolve(o.from+1);r=Q.rowSelection(l,l)}else if(!t){const l=J.get(o.node),a=o.from+1,c=a+l.map[l.width*l.height-1];r=Q.create(i,a+1,c)}}else o instanceof R&&k1(o)?r=R.create(i,o.from):o instanceof R&&T1(o)&&(r=R.create(i,o.$from.start(),o.$from.end()));return r&&(e||(e=n.tr)).setSelection(r),e}var M1=new ao("fix-tables");function Sp(n,e,t,o){const i=n.childCount,r=e.childCount;e:for(let s=0,l=0;s<r;s++){const a=e.child(s);for(let c=l,d=Math.min(i,s+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}o(a,t),l<i&&n.child(l).sameMarkup(a)?Sp(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function A1(n,e){let t;const o=(i,r)=>{i.type.spec.tableRole=="table"&&(t=j1(n,i,r,t))};return e?e.doc!=n.doc&&Sp(e.doc,n.doc,0,o):n.doc.descendants(o),t}function j1(n,e,t,o){const i=J.get(e);if(!i.problems)return o;o||(o=n.tr);const r=[];for(let a=0;a<i.height;a++)r.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const p=d.attrs;for(let u=0;u<p.rowspan;u++)r[c.row+u]+=c.n;o.setNodeMarkup(o.mapping.map(t+1+c.pos),null,Sn(p,p.colspan-c.n,c.n))}else if(c.type=="missing")r[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;o.setNodeMarkup(o.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;o.setNodeMarkup(o.mapping.map(t+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<r.length;a++)r[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const d=e.child(a),p=c+d.nodeSize,u=r[a];if(u>0){let f="cell";d.firstChild&&(f=d.firstChild.type.spec.tableRole);const h=[];for(let b=0;b<u;b++){const x=Ye(n.schema)[f].createAndFill();x&&h.push(x)}const g=(a==0||s==a-1)&&l==a?c+1:p-1;o.insert(o.mapping.map(g),h)}c=p}return o.setMeta(M1,{fixTables:!0})}function Cp(n){const e=n.selection,t=Ms(n),o=t.node(-1),i=t.start(-1),r=J.get(o);return{...e instanceof Q?r.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):r.findCell(t.pos-i),tableStart:i,map:r,table:o}}function $1(n){return function(e,t){if(!Ti(e))return!1;if(t){const o=Ye(e.schema),i=Cp(e),r=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&r.setNodeMarkup(i.tableStart+s[a],o.cell,l[a].attrs);if(r.steps.length==0)for(let a=0;a<s.length;a++)r.setNodeMarkup(i.tableStart+s[a],o.header_cell,l[a].attrs);t(r)}return!0}}function ba(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<o.length;i++){const r=e.table.nodeAt(o[i]);if(r&&r.type!==t.header_cell)return!1}return!0}function js(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?$1(n):function(t,o){if(!Ti(t))return!1;if(o){const i=Ye(t.schema),r=Cp(t),s=t.tr,l=ba("row",r,i),a=ba("column",r,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,p=n=="column"?{left:0,top:d,right:1,bottom:r.map.height}:n=="row"?{left:d,top:0,right:r.map.width,bottom:1}:r,u=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;r.map.cellsInRect(p).forEach(f=>{const h=f+r.tableStart,g=s.doc.nodeAt(h);g&&s.setNodeMarkup(h,u,g.attrs)}),o(s)}return!0}}js("row",{useDeprecatedLogic:!0});js("column",{useDeprecatedLogic:!0});js("cell",{useDeprecatedLogic:!0});function P1(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,i=n.before();o>=0;o--){const r=n.node(-1).child(o),s=r.lastChild;if(s)return i-1-s.nodeSize;i-=r.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),i=n.after();o<t.childCount;o++){const r=t.child(o);if(r.childCount)return i+1;i+=r.nodeSize}}return null}function ya(n){return function(e,t){if(!Ti(e))return!1;const o=P1(Ms(e),n);if(o==null)return!1;if(t){const i=e.doc.resolve(o);t(e.tr.setSelection(R.between(i,w1(i))).scrollIntoView())}return!0}}function Ao(n,e){const t=n.selection;if(!(t instanceof Q))return!1;if(e){const o=n.tr,i=Ye(n.schema).cell.createAndFill().content;t.forEachCell((r,s)=>{r.content.eq(i)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new j(i,0,0))}),o.docChanged&&e(o)}return!0}function N1(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const i=e.child(0),r=i.type.spec.tableRole,s=i.type.schema,l=[];if(r=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,t-1),p=a<e.childCount-1?0:Math.max(0,o-1);(d||p)&&(c=qr(Ye(s).row,new j(c,d,p)).content),l.push(c)}else if(r=="cell"||r=="header_cell")l.push(t||o?qr(Ye(s).row,new j(e,t,o)).content:e);else return null;return O1(s,l)}function O1(n,e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];for(let s=r.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=r.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let o=0;for(let i=0;i<t.length;i++)o=Math.max(o,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(M.empty),t[i]<o){const r=Ye(n).cell.createAndFill(),s=[];for(let l=t[i];l<o;l++)s.push(r);e[i]=e[i].append(M.from(s))}return{height:e.length,width:o,rows:e}}function qr(n,e){const t=n.createAndFill();return new Sd(t).replace(0,t.content.size,e).doc}function I1({width:n,height:e,rows:t},o,i){if(n!=o){const r=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=r[l]||0,p=0;d<o;p++){let u=a.child(p%a.childCount);d+u.attrs.colspan>o&&(u=u.type.createChecked(Sn(u.attrs,u.attrs.colspan,d+u.attrs.colspan-o),u.content)),c.push(u),d+=u.attrs.colspan;for(let f=1;f<u.attrs.rowspan;f++)r[l+f]=(r[l+f]||0)+u.attrs.colspan}s.push(M.from(c))}t=s,n=o}if(e!=i){const r=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let p=c.child(d);s+p.attrs.rowspan>i&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,i-p.attrs.rowspan)},p.content)),a.push(p)}r.push(M.from(a))}t=r,e=i}return{width:n,height:e,rows:t}}function D1(n,e,t,o,i,r,s){const l=n.doc.type.schema,a=Ye(l);let c,d;if(i>e.width)for(let p=0,u=0;p<e.height;p++){const f=t.child(p);u+=f.nodeSize;const h=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let b=e.width;b<i;b++)h.push(g);n.insert(n.mapping.slice(s).map(u-1+o),h)}if(r>e.height){const p=[];for(let h=0,g=(e.height-1)*e.width;h<Math.max(e.width,i);h++){const b=h>=e.width?!1:t.nodeAt(e.map[g+h]).type==a.header_cell;p.push(b?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const u=a.row.create(null,M.from(p)),f=[];for(let h=e.height;h<r;h++)f.push(u);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),f)}return!!(c||d)}function xa(n,e,t,o,i,r,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<r;c++){const d=s*e.width+c,p=e.map[d];if(e.map[d-e.width]==p){a=!0;const u=t.nodeAt(p),{top:f,left:h}=e.findCell(p);n.setNodeMarkup(n.mapping.slice(l).map(p+o),null,{...u.attrs,rowspan:s-f}),n.insert(n.mapping.slice(l).map(e.positionAt(s,h,t)),u.type.createAndFill({...u.attrs,rowspan:f+u.attrs.rowspan-s})),c+=u.attrs.colspan-1}}return a}function va(n,e,t,o,i,r,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<r;c++){const d=c*e.width+s,p=e.map[d];if(e.map[d-1]==p){a=!0;const u=t.nodeAt(p),f=e.colCount(p),h=n.mapping.slice(l).map(p+o);n.setNodeMarkup(h,null,Sn(u.attrs,s-f,u.attrs.colspan-(s-f))),n.insert(h+u.nodeSize,u.type.createAndFill(Sn(u.attrs,0,s-f))),c+=u.attrs.rowspan-1}}return a}function wa(n,e,t,o,i){let r=t?n.doc.nodeAt(t-1):n.doc;if(!r)throw new Error("No table found");let s=J.get(r);const{top:l,left:a}=o,c=a+i.width,d=l+i.height,p=n.tr;let u=0;function f(){if(r=t?p.doc.nodeAt(t-1):p.doc,!r)throw new Error("No table found");s=J.get(r),u=p.mapping.maps.length}D1(p,s,r,t,c,d,u)&&f(),xa(p,s,r,t,a,c,l,u)&&f(),xa(p,s,r,t,a,c,d,u)&&f(),va(p,s,r,t,l,d,a,u)&&f(),va(p,s,r,t,l,d,c,u)&&f();for(let h=l;h<d;h++){const g=s.positionAt(h,a,r),b=s.positionAt(h,c,r);p.replace(p.mapping.slice(u).map(g+t),p.mapping.slice(u).map(b+t),new j(i.rows[h-l],0,0))}f(),p.setSelection(new Q(p.doc.resolve(t+s.positionAt(l,a,r)),p.doc.resolve(t+s.positionAt(d-1,c-1,r)))),e(p)}var z1=Bd({ArrowLeft:jo("horiz",-1),ArrowRight:jo("horiz",1),ArrowUp:jo("vert",-1),ArrowDown:jo("vert",1),"Shift-ArrowLeft":$o("horiz",-1),"Shift-ArrowRight":$o("horiz",1),"Shift-ArrowUp":$o("vert",-1),"Shift-ArrowDown":$o("vert",1),Backspace:Ao,"Mod-Backspace":Ao,Delete:Ao,"Mod-Delete":Ao});function Bo(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function jo(n,e){return(t,o,i)=>{if(!i)return!1;const r=t.selection;if(r instanceof Q)return Bo(t,o,z.near(r.$headCell,e));if(n!="horiz"&&!r.empty)return!1;const s=kp(i,n,e);if(s==null)return!1;if(n=="horiz")return Bo(t,o,z.near(t.doc.resolve(r.head+e),e));{const l=t.doc.resolve(s),a=vp(l,n,e);let c;return a?c=z.near(a,1):e<0?c=z.near(t.doc.resolve(l.before(-1)),-1):c=z.near(t.doc.resolve(l.after(-1)),1),Bo(t,o,c)}}}function $o(n,e){return(t,o,i)=>{if(!i)return!1;const r=t.selection;let s;if(r instanceof Q)s=r;else{const a=kp(i,n,e);if(a==null)return!1;s=new Q(t.doc.resolve(a))}const l=vp(s.$headCell,n,e);return l?Bo(t,o,new Q(s.$anchorCell,l)):!1}}function R1(n,e){const t=n.state.doc,o=fo(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Q(o))),!0):!1}function L1(n,e,t){if(!Ti(n.state))return!1;let o=N1(t);const i=n.state.selection;if(i instanceof Q){o||(o={width:1,height:1,rows:[M.from(qr(Ye(n.state.schema).cell,t))]});const r=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=J.get(r).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return o=I1(o,l.right-l.left,l.bottom-l.top),wa(n.state,n.dispatch,s,l,o),!0}else if(o){const r=Ms(n.state),s=r.start(-1);return wa(n.state,n.dispatch,s,J.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function B1(n,e){var t;if(e.ctrlKey||e.metaKey)return;const o=Sa(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof Q)r(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(i=fo(n.state.selection.$anchor))!=null&&((t=Qi(n,e))==null?void 0:t.pos)!=i.pos)r(i,e),e.preventDefault();else if(!o)return;function r(a,c){let d=Qi(n,c);const p=dt.getState(n.state)==null;if(!d||!As(a,d))if(p)d=a;else return;const u=new Q(a,d);if(p||!n.state.selection.eq(u)){const f=n.state.tr.setSelection(u);p&&f.setMeta(dt,a.pos),n.dispatch(f)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),dt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(dt,-1))}function l(a){const c=a,d=dt.getState(n.state);let p;if(d!=null)p=n.state.doc.resolve(d);else if(Sa(n,c.target)!=o&&(p=Qi(n,e),!p))return s();p&&r(p,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function kp(n,e,t){if(!(n.state.selection instanceof R))return null;const{$head:o}=n.state.selection;for(let i=o.depth-1;i>=0;i--){const r=o.node(i);if((t<0?o.index(i):o.indexAfter(i))!=(t<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const l=o.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Sa(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Qi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?fo(n.state.doc.resolve(t.pos)):null}var V1=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")),Ur(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,Ur(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ur(n,e,t,o,i,r){var s;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let p=0,u=0;p<d.childCount;p++){const{colspan:f,colwidth:h}=d.child(p).attrs;for(let g=0;g<f;g++,u++){const b=i==u?r:h&&h[g],x=b?b+"px":"";if(l+=b||o,b||(a=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=x,e.appendChild(C)}}}for(;c;){const p=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=p}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ce=new ao("tableColumnResizing");function H1({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=V1,lastColumnResizable:i=!0}={}){const r=new Tn({key:Ce,state:{init(s,l){var a,c;const d=(c=(a=r.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,p=Ye(l.schema).table.name;return o&&d&&(d[p]=(u,f)=>new o(u,t,f)),new F1(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ce.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{_1(s,l,n,i)},mouseleave:s=>{G1(s)},mousedown:(s,l)=>{W1(s,l,e,t)}},decorations:s=>{const l=Ce.getState(s);if(l&&l.activeHandle>-1)return Y1(s,l.activeHandle)},nodeViews:{}}});return r}var F1=class Vo{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(Ce);if(o&&o.setHandle!=null)return new Vo(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Vo(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Wr(e.doc.resolve(i))||(i=-1),new Vo(i,t.dragging)}return t}};function _1(n,e,t,o){const i=Ce.getState(n.state);if(i&&!i.dragging){const r=U1(e.target);let s=-1;if(r){const{left:l,right:a}=r.getBoundingClientRect();e.clientX-l<=t?s=Ca(n,e,"left",t):a-e.clientX<=t&&(s=Ca(n,e,"right",t))}if(s!=i.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=J.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Tp(n,s)}}}function G1(n){const e=Ce.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Tp(n,-1)}function W1(n,e,t,o){var i;const r=(i=n.dom.ownerDocument.defaultView)!=null?i:window,s=Ce.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=q1(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Ce,{setDragging:{startX:e.clientX,startWidth:a}}));function c(p){r.removeEventListener("mouseup",c),r.removeEventListener("mousemove",d);const u=Ce.getState(n.state);u!=null&&u.dragging&&(K1(n,u.activeHandle,ka(u.dragging,p,t)),n.dispatch(n.state.tr.setMeta(Ce,{setDragging:null})))}function d(p){if(!p.which)return c(p);const u=Ce.getState(n.state);if(u&&u.dragging){const f=ka(u.dragging,p,t);Ta(n,u.activeHandle,f,o)}}return Ta(n,s.activeHandle,a,o),r.addEventListener("mouseup",c),r.addEventListener("mousemove",d),e.preventDefault(),!0}function q1(n,e,{colspan:t,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const r=n.domAtPos(e);let l=r.node.childNodes[r.offset].offsetWidth,a=t;if(o)for(let c=0;c<t;c++)o[c]&&(l-=o[c],a--);return l/a}function U1(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ca(n,e,t,o){const i=t=="right"?-o:o,r=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!r)return-1;const{pos:s}=r,l=fo(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=J.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 ka(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function Tp(n,e){n.dispatch(n.state.tr.setMeta(Ce,{setHandle:e}))}function K1(n,e,t){const o=n.state.doc.resolve(e),i=o.node(-1),r=J.get(i),s=o.start(-1),l=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<r.height;c++){const d=c*r.width+l;if(c&&r.map[d]==r.map[d-r.width])continue;const p=r.map[d],u=i.nodeAt(p).attrs,f=u.colspan==1?0:l-r.colCount(p);if(u.colwidth&&u.colwidth[f]==t)continue;const h=u.colwidth?u.colwidth.slice():J1(u.colspan);h[f]=t,a.setNodeMarkup(s+p,null,{...u,colwidth:h})}a.docChanged&&n.dispatch(a)}function Ta(n,e,t,o){const i=n.state.doc.resolve(e),r=i.node(-1),s=i.start(-1),l=J.get(r).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ur(r,a.firstChild,a,o,l,t)}function J1(n){return Array(n).fill(0)}function Y1(n,e){var t;const o=[],i=n.doc.resolve(e),r=i.node(-1);if(!r)return U.empty;const s=J.get(r),l=i.start(-1),a=s.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const d=a+c*s.width;if((a==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){const p=s.map[d],u=l+p+r.nodeAt(p).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=Ce.getState(n))!=null&&t.dragging&&o.push(ye.node(l+p,l+p+r.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(ye.widget(u,f))}}return U.create(n.doc,o)}function Z1({allowTableNodeSelection:n=!1}={}){return new Tn({key:dt,state:{init(){return null},apply(e,t){const o=e.getMeta(dt);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:i,pos:r}=e.mapping.mapResult(t);return i?null:r}},props:{decorations:C1,handleDOMEvents:{mousedown:B1},createSelectionBetween(e){return dt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:R1,handleKeyDown:z1,handlePaste:L1},appendTransaction(e,t,o){return E1(o,A1(o,t),n)}})}const Wn=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},Kr=n=>{const{key:e,cssProperty:t,tagName:o="span"}=n,i="value";return{attrs:{...Ei,[i]:{default:null}},parseDOM:[{tag:`${o}[${e}]`,getAttrs:r=>({...Mi(r),[i]:r.style.getPropertyValue(t)||null})}],toDOM(r){const{[i]:s}=r.attrs,l={...Fe(r),[e]:""};return s&&(l.style=`${t}: ${s}`),[o,l,0]}}},Ea="data-gs-mrk-fs",X1="data-gs-mrk-color",Q1="data-gs-mrk-bgcolor",Ep="data-gs-mrk-wrap",ci="data-gs-ifrg",it="attrs",Ei={[it]:{default:"{}"}},Le={[it]:{default:{}}},Mi=n=>({[it]:JSON.stringify(Wn(n))}),Be=n=>({attrs:Wn(n)}),$n=n=>e=>[n,e.attrs.attrs,0],Fe=n=>n.attrs[it]?JSON.parse(n.attrs[it]):{},eb={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${ci}]`,getAttrs:Be}],toDOM:()=>["span",{[ci]:""},0]},div:{group:"block",content:"inline*",attrs:Le,parseDOM:[{tag:"div",getAttrs:Be}],toDOM:$n("div")},paragraph:{group:"block",content:"inline*",attrs:Le,parseDOM:[{tag:"p",getAttrs:Be}],toDOM:$n("p")},orderedList:{group:"block",content:"listItem+",attrs:Le,parseDOM:[{tag:"ol",getAttrs:Be}],toDOM:$n("ol")},bulletList:{group:"block",content:"listItem+",attrs:Le,parseDOM:[{tag:"ul",getAttrs:Be}],toDOM:$n("ul")},listItem:{content:"block*",group:"block",attrs:Le,parseDOM:[{tag:"li",getAttrs:Be}],toDOM:$n("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Le,parseDOM:[{tag:"pre",getAttrs:Be}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Le,parseDOM:[{tag:"img[src]",getAttrs:Be}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,attrs:Le,parseDOM:[{tag:"br",getAttrs:Be}],toDOM:n=>["br",{...n.attrs.attrs}]},hardBreak:{inline:!0,group:"inline",selectable:!1,attrs:Le,parseDOM:[{tag:"br",getAttrs:Be}],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:Wn(t)})})),toDOM({attrs:n}){const{level:e}=n;return[e?`h${e}`:"div",n.attrs,0]}},...x1({tableGroup:"block",cellContent:"block+",cellAttributes:{[it]:{default:Le[it].default,getFromDOM:Wn,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:Wn(n)}),priority:0}],toDOM(n){const{tagName:e,attrs:t}=n.attrs;return[e,t,0]}}},Pn=(n,e)=>({attrs:Ei,parseDOM:n.map(t=>({tag:t,getAttrs:Mi})),toDOM:e}),tb=n=>({attrs:{...Ei},parseDOM:[{tag:`span[${n}]`,getAttrs:e=>({...Mi(e)})}],toDOM(e){return["span",{...Fe(e),[n]:!0},0]}}),nb={strong:Pn(["strong","b"],n=>["b",Fe(n)]),link:Pn(["a"],n=>["a",Fe(n),0]),em:Pn(["em","i"],n=>["em",Fe(n)]),underline:Pn(["u"],n=>["u",Fe(n),0]),strikethrough:Pn(["s"],n=>["s",Fe(n),0]),wrapStyle:tb(Ep),font_size:{attrs:{...Ei,size:{default:null}},parseDOM:[{tag:`span[${Ea}]`,getAttrs:n=>({...Mi(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...Fe(n),[Ea]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}},color:Kr({key:X1,cssProperty:"color"}),bgColor:Kr({key:Q1,cssProperty:"background-color"})},Ma=new ym({nodes:eb,marks:nb}),ho=new WeakMap,$s=new WeakMap,ob=(n,e,t)=>{ho.set(n,{view:e,gjsView:t,initialDoc:e.state.doc}),$s.set(e,{el:n,gjsView:t})},ib=(n,e)=>{ho.delete(n),$s.delete(e)},Ho=n=>ho.get(n),Mp=n=>$s.get(n),Aa=n=>{const e=Ho(n),t=e==null?void 0:e.view,o=e==null?void 0:e.initialDoc;return!(t&&o&&o.eq(t.state.doc))},er=n=>{var e,t;return(t=(e=Mp(n))==null?void 0:e.gjsView)==null?void 0:t.model},rb=n=>n.dispatchEvent(new CustomEvent("input"));function sb(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(ci)){if(t.getAttribute("style")){t.removeAttribute(ci);return}const o=t.parentElement;if(o){for(;t.firstChild;)o.insertBefore(t.firstChild,t);o.removeChild(t)}}else Array.from(t.children).forEach(o=>e(o))};e(n)}const Ap=n=>{n.childNodes.forEach(e=>{if(e.nodeName==="BR"){const{nextSibling:t}=e,o=n.lastChild===e,i=(t==null?void 0:t.nodeType)===Node.ELEMENT_NODE&&(t==null?void 0:t.nodeName)!=="BR";(o||i)&&e.remove()}else Ap(e)})},lb=(n,e)=>{const t=jp(n);return t&&xb(t)?cb(n,e):t?Pd(()=>({type:n.schema.nodes.div}))(n,e):!1},ab=(n,e)=>(t,o)=>{var l;const i=jp(t),r=ho.get(n.el).view,s=(l=e.onEnter)==null?void 0:l.call(e,{...n,node:i,commands:Ps(r,n.editor,e),proseMirror:{view:r,dispatch:o}});return s!==void 0?s:lb(t,o)};function jp(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 cb(n,e){const{selection:t,schema:o,tr:i}=n;i.split(t.from,1);const r=t.from+1,s=i.doc.nodeAt(r),l={...s.attrs.attrs,id:void 0},a=s.textContent.length>0,c=s.textContent.length||0,d=s.textContent||" ",p=o.text(d),u=o.nodes.div.create(l,a?p:[],[]);return i.replaceRangeWith(r,r+c+2,u),i.setSelection(R.create(i.doc,r+1)),e==null||e(i.scrollIntoView()),!0}function db(n,e,t){const{state:o,dispatch:i}=n,{selection:r,tr:s}=o,l=(a,c,d)=>{const p={};return a.split(";").forEach(u=>{const[f,h]=u.split(":").map(g=>g.trim());f&&(p[f]=h)}),p[c]=d,Object.entries(p).map(([u,f])=>`${u}: ${f}`).join("; ")};if(!r.empty||t)s.doc.nodesBetween(r.from,r.to,(a,c)=>{var d,p;if(a.type===o.schema.nodes.image){const u=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}else if(a.type.isBlock){const u=l(((p=a.attrs.attrs)==null?void 0:p.style)||"","text-align",e);$p(a)?s.setBlockType(r.from,void 0,o.schema.nodes.div,{attrs:{style:u}}):s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}});else{const a=o.doc.resolve(r.from),c=a.start(a.depth),d=o.doc.nodeAt(c);if(d!=null&&d.type.isBlock){const p=l(d.attrs.style||"","text-align",e);s.setNodeMarkup(c,void 0,{...d.attrs,style:p})}}s.docChanged&&i(s.scrollIntoView())}const Nn=(n,e)=>{const{from:t,to:o}=n.selection;let i=!1;return n.doc.nodesBetween(t,o,r=>{if(i)return!1;r.marks.some(s=>s.type===e)&&(i=!0)}),i};function pb(n){var p,u;const{view:e,href:t,options:o,target:i="_blank"}=n,{state:r,dispatch:s}=e,{schema:l,selection:a,tr:c}=r,d=l.marks.link;try{const f={href:t,target:i},h=((u=(p=o.commandAttrs)==null?void 0:p.link)==null?void 0:u.call(p,f))||f,g=d.create({[it]:JSON.stringify(h)});c.addMark(a.from,a.to,g),s(c.scrollIntoView())}catch(f){console.error("Error applying link mark:",f)}}function ub(n,e){const{state:t,dispatch:o}=n,{selection:i,tr:r}=t;if(i.empty)return;const s=t.schema.marks.font_size;if(!s){console.error("Font size mark is not defined in the schema.");return}r.addMark(i.from,i.to,s.create({size:e})),o(r.scrollIntoView())}function fb(n,e){const{state:t,dispatch:o}=n,{selection:i,tr:r}=t;if(i.empty)return;const s=t.schema.marks.color;if(!s){console.error("Color mark is not defined in the schema.");return}r.addMark(i.from,i.to,s.create({value:e})),o(r.scrollIntoView())}function hb(n,e){const{state:t,dispatch:o}=n,{selection:i,tr:r}=t;if(i.empty)return;const s=t.schema.marks.bgColor;if(!s){console.error("Background color mark is not defined in the schema.");return}r.addMark(i.from,i.to,s.create({value:e})),o(r.scrollIntoView())}const It=(n,e)=>{const{doc:t,selection:o}=n.state,i=t.resolve(o.from);for(let r=i.depth;r>0;r--){const s=i.node(r);if(e(s))return{pos:r>0?i.before(r):0,start:i.start(r),depth:r,node:s}}},mb=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,o])=>(t=t.replace(/-./g,i=>i.toUpperCase()[1]).trim(),e[t]=`${o}`.trim(),e),{});function gb(...n){return(e,t)=>{const o=s=>{e=e.apply(s),t==null||t(s)},i=n.pop();return n.reduce((s,l)=>s||l(e,o),!1)&&i!==void 0&&i(e,t)}}const bb=(n,e)=>{const{state:t,dispatch:o}=n;if(e!=null&&e.event){const{event:i}=e,r=n.posAtCoords({left:i.clientX,top:i.clientY});r!=null&&r.pos&&o(t.tr.setSelection(R.create(t.doc,r.pos)))}else Nd(t,o);setTimeout(()=>setTimeout(()=>n.focus()))},Jr=n=>n.isBlock,$p=n=>n.type.name==="inlineFragment",yb=n=>Jr(n)&&!$p(n),Pp=n=>n.type.name==="bulletList",Np=n=>n.type.name==="orderedList",xb=n=>n.type.name==="heading",vb=n=>Pp(n)||Np(n),ja=(n,e)=>{var r,s;const t=(r=It(n,l=>l.type===e))==null?void 0:r.node,o=n.state.schema.nodes.listItem;let i;return t?i=Nr(o):(s=It(n,vb))!=null&&s.node?i=gb(Nr(o),Dl(e)):i=Dl(e),i(n.state,n.dispatch)},Op=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(o=>o.type.name===e)},wb=n=>{var s;const{view:e,prop:t,editor:o,propCSS:i}=n,r=(s=It(e,yb))==null?void 0:s.node;if(r){const l=r.attrs.attrs||{},a=mb(l.style);if(t in a)return a[t]||"";if(l.id){const c=o.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[i]||""}}return""},tr=n=>{const{view:e,prop:t,markName:o,editor:i,propCSS:r}=n,s=Op(e,o);if(s){const l=s.attrs;if(l[t])return l[t];if(l[it]){const a=Fe(s).id;if(a){const c=i.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[r]||""}}}return""},Ps=(n,e,t)=>{const{dispatch:o}=n,{nodes:i,marks:r}=n.state.schema,s={text:{selected:()=>{const{selection:l,doc:a}=n.state;return a.textBetween(l.from,l.to," ")},replace:(l,a={})=>{const{state:c}=n,{from:d}=c.selection;let p=c.tr.replaceSelectionWith(c.schema.text(l));a.select&&(p=p.setSelection(R.create(p.doc,d,d+l.length))),o==null||o(p)},replaceHtml:l=>{const{schema:a,selection:c,tr:d}=n.state,p=document.createElement("div");p.innerHTML=l;const u=_t.fromSchema(a).parse(p),{from:f,to:h}=c;return o==null?void 0:o(d.replaceRangeWith(f,h,u).scrollIntoView())},wrapStyle:()=>{const l=er(n),a=s.text.selected(),c=`i${e.Components._createId().slice(0,4)}`;s.text.replaceHtml(`<span id="${c}" ${Ep}>${a}</span>`),l==null||l.trigger("disable"),setTimeout(()=>{const d=l==null?void 0:l.find(`#${c}`)[0];d&&e.select(d)})},createBreak:()=>{const{state:l}=n,a=l.tr.replaceSelectionWith(i.inlineBreak.create()).scrollIntoView();return o==null?void 0:o(a)}},bold:{toggle:()=>At(r.strong)(n.state,o),isActive:()=>Nn(n.state,r.strong)},italic:{toggle:()=>At(r.em)(n.state,o),isActive:()=>Nn(n.state,r.em)},underline:{toggle:()=>At(r.underline)(n.state,o),isActive:()=>Nn(n.state,r.underline)},strikethrough:{toggle:()=>At(r.strikethrough)(n.state,o),isActive:()=>Nn(n.state,r.strikethrough)},link:{get:()=>{const l=er(n),a=l==null?void 0:l.getTrait("href");if(l!=null&&l.is("link"))return l.getAttributes();if(a)return{href:a.getValue()};{const c=Op(n,"link");return c?Fe(c):{}}},toggle:()=>At(r.link)(n.state,o),isActive:()=>Nn(n.state,r.link),create:l=>{const a=er(n),c=a==null?void 0:a.getTrait("href"),{url:d,target:p}=l,u=()=>{var h,g;const f=(g=(h=Mp(n))==null?void 0:h.gjsView)==null?void 0:g.el;f&&f.contentEditable!=="true"&&(f.contentEditable="true"),n.focus()};a!=null&&a.is("link")?(a.addAttributes({href:d,target:p}),u()):c?(a==null||a.addAttributes({[c.getName()]:d}),u()):pb({view:n,href:d,target:p,options:t})}},alignText:{get:()=>wb({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:l=>db(n,l.value,!0)},fontSize:{get:()=>tr({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:l=>ub(n,l.value)},color:{get:()=>tr({view:n,editor:e,markName:"color",prop:"value",propCSS:"color"}),set:l=>fb(n,l.value)},bgColor:{get:()=>tr({view:n,editor:e,markName:"bgColor",prop:"value",propCSS:"background-color"}),set:l=>hb(n,l.value)},image:{open(){const l="assetLayout",{state:a,dispatch:c}=n,{selection:d,doc:p}=a,u=p.textBetween(d.from,d.to," "),f={id:l,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:h=>{const g={alt:u,src:h.asset.getSrc()};c(a.tr.replaceSelectionWith(i.image.createAndFill({attrs:g})))}}};e.runCommand(G.layoutToggle,f)}},heading:{get:()=>{var a;const l=(a=It(n,Jr))==null?void 0:a.node;return`${(l==null?void 0:l.attrs.level)||""}`},set:({value:l})=>{var d;const{state:a}=n,c=(d=It(n,Jr))==null?void 0:d.node;pg(a.schema.nodes.heading,{attrs:c==null?void 0:c.attrs.attrs,level:l?parseInt(l,10):0})(a,o)}},listBullet:{isActive:()=>{var l;return!!((l=It(n,Pp))!=null&&l.node)},toggle:()=>ja(n,i.bulletList)},listOrdered:{isActive:()=>{var l;return!!((l=It(n,Np))!=null&&l.node)},toggle:()=>ja(n,i.orderedList)}};return s};class St{constructor(e,t,o={}){this.match=e,this.match=e,this.handler=typeof t=="string"?Sb(t):t,this.undoable=o.undoable!==!1,this.inCode=o.inCode||!1}}function Sb(n){return function(e,t,o,i){let r=n;if(t[1]){let s=t[0].lastIndexOf(t[1]);r+=t[0].slice(s+t[1].length),o+=s;let l=o-i;l>0&&(r=t[0].slice(s-l,s)+r,o=i)}return e.tr.insertText(r,o,i)}}const Cb=500;function kb({rules:n}){let e=new Tn({state:{init(){return null},apply(t,o){let i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:o)}},props:{handleTextInput(t,o,i,r){return $a(t,o,i,r,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:o}=t.state.selection;o&&$a(t,o.pos,o.pos,"",n,e)})}}},isInputRules:!0});return e}function $a(n,e,t,o,i,r){if(n.composing)return!1;let s=n.state,l=s.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-Cb),l.parentOffset,null,"")+o;for(let c=0;c<i.length;c++){let d=i[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let p=d.match.exec(a),u=p&&d.handler(s,p,e-(p[0].length-o.length),t);if(u)return d.undoable&&u.setMeta(r,{transform:u,from:e,to:t,text:o}),n.dispatch(u),!0}return!1}const Tb=new St(/--$/,"—"),Eb=new St(/\.\.\.$/,"…"),Mb=new St(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Ab=new St(/"$/,"”"),jb=new St(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),$b=new St(/'$/,"’"),Pb=[Mb,Ab,jb,$b];function Ns(n,e,t=null,o){return new St(n,(i,r,s,l)=>{let a=t instanceof Function?t(r):t,c=i.tr.delete(s,l),d=c.doc.resolve(s),p=d.blockRange(),u=p&&md(p,e,a);if(!u)return null;c.wrap(p,u);let f=c.doc.resolve(s-1).nodeBefore;return f&&f.type==e&&vi(c.doc,s-1)&&(!o||o(r,f))&&c.join(s-1),c})}function Ip(n,e,t=null){return new St(n,(o,i,r,s)=>{let l=o.doc.resolve(r),a=t instanceof Function?t(i):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?o.tr.delete(r,s).setBlockType(r,r,e,a):null})}function Nb(n){return Ns(/^\s*>\s$/,n)}function Ob(n){return Ns(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function Ib(n){return Ns(/^\s*([-+*])\s$/,n)}function Db(n){return Ip(/^```$/,n)}function zb(n,e){return Ip(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function Rb(n){const e=Pb.concat(Eb,Tb);let t;return(t=n.nodes.blockquote)&&e.push(Nb(t)),(t=n.nodes.orderedList)&&e.push(Ob(t)),(t=n.nodes.bulletList)&&e.push(Ib(t)),(t=n.nodes.codeBlock)&&e.push(Db(t)),(t=n.nodes.heading)&&e.push(zb(t,6)),kb({rules:e})}const Dp="rteProseMirror",Lb=F.free,de="rte:selectionchange",Z={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>',color:'<svg viewBox="0 0 24 24"><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /></svg>',bgColor:'<svg viewBox="0 0 24 24"><path d="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z" /></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>'},Pa=n=>({state:e})=>({type:"column",style:{alignItems:"center",background:"none"},children:[{type:"icon",icon:n,size:16},{type:"row",style:{width:16,height:2,backgroundColor:e.value||"currentColor",borderRadius:1}}]}),Bb=(n,e)=>{var a;const{editor:t,el:o}=n,i=ho.get(o).view,r=Ps(i,t,e),s={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},wrapStyle:{id:"wrapper",type:"button",icon:"tag",tooltip:"Wrap for styling",editorEvents:{[de]:({setState:c})=>{c({disabled:i.state.selection.empty})}},onClick:()=>r.text.wrapStyle()},bold:{id:"bold",icon:Z.bold,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.bold.isActive()})}},onClick:({setState:c})=>{r.bold.toggle(),c({active:r.bold.isActive()})}},italic:{id:"italic",icon:Z.italic,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.italic.isActive()})}},onClick:({setState:c})=>{r.italic.toggle(),c({active:r.italic.isActive()})}},underline:{id:"underline",icon:Z.underline,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.underline.isActive()})}},onClick:({setState:c})=>{r.underline.toggle(),c({active:r.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:Z.strikethrough,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.strikethrough.isActive()})}},onClick:({setState:c})=>{r.strikethrough.toggle(),c({active:r.strikethrough.isActive()})}},image:{id:"image",icon:Z.image,size:"s",type:"button",onClick:()=>r.image.open()},link:{id:"link",icon:Z.link,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.link.isActive(),disabled:i.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,p="linkLayout",u=()=>t.runCommand(G.layoutRemove,{id:p}),f=r.link.get(),h={id:p,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,target:d},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:g=>{g.preventDefault();const b=new FormData(g.currentTarget);r.link.create({url:b.get("url"),target:b.get("target")}),u()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(f==null?void 0:f.href)||"",onChange:({value:g,setState:b})=>b({value:g})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(f==null?void 0:f.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:g,setState:b})=>b({value:g})},{type:"row",style:{gap:10,justifyContent:"end"},children:[r.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{r.link.toggle(),u()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(G.layoutToggle,h)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:Z.alignTextLeft},{id:"center",icon:Z.alignTextCenter},{id:"right",icon:Z.alignTextRight},{id:"justify",icon:Z.alignTextJustify}],editorEvents:{[de]:({setState:c})=>{c({value:r.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.alignText.set({value:c})}},alignTextMenu:{id:"alignTextMenu",type:"buttonMenu",size:"s",value:"",options:[{id:"left",icon:Z.alignTextLeft},{id:"center",icon:Z.alignTextCenter},{id:"right",icon:Z.alignTextRight},{id:"justify",icon:Z.alignTextJustify}],editorEvents:{[de]:({setState:c})=>{c({value:r.alignText.get()})}},onOptionSelect:({option:c,state:d,setState:p})=>{const u=c.id===d.value?"":c.id;p({value:u}),r.alignText.set({value:u})},onClick:({state:c})=>{c.value&&r.alignText.set({value:c.value})}},listBullet:{id:"listBullet",icon:Z.listBullet,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.listBullet.isActive()})}},onClick:({setState:c})=>{r.listBullet.toggle(),c({active:r.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:Z.listOrdered,size:"s",type:"button",editorEvents:{[de]:({setState:c})=>{c({active:r.listOrdered.isActive()})}},onClick:({setState:c})=>{r.listOrdered.toggle(),c({active:r.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:{[de]:({setState:c})=>{c({value:r.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.heading.set({value:c}),i.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"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:{[de]:({setState:c})=>{c({value:r.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.fontSize.set({value:c}),i.focus()}},color:{id:"color",type:"buttonMenu",size:"s",value:"",label:Pa(Z.color),editorEvents:{[de]:({setState:c})=>{c({disabled:i.state.selection.empty})}},children:({state:c,setState:d})=>({type:"colorPicker",value:c.value||"",onChange:p=>{const{value:u}=p;d({value:u}),p.setState({value:u}),r.color.set({value:u}),i.focus()}}),onClick:({state:c})=>{c.value&&(r.color.set({value:c.value}),i.focus())}},bgColor:{id:"bgColor",type:"buttonMenu",size:"s",value:"",label:Pa(Z.bgColor),editorEvents:{[de]:({setState:c})=>{c({disabled:i.state.selection.empty})}},children:({state:c,setState:d})=>({type:"colorPicker",value:c.value||"",onChange:p=>{const{value:u}=p;d({value:u}),p.setState({value:u}),r.bgColor.set({value:u}),i.focus()}}),onClick:({state:c})=>{c.value&&(r.bgColor.set({value:c.value}),i.focus())}}},l=[s.bold,s.italic,s.underline,s.strikethrough,s.image,s.link,s.listBullet,s.listOrdered,s.color,s.bgColor,s.alignTextMenu,s.heading,s.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:r,layouts:s,proseMirror:{view:i},items:l}))||l};class Vb{constructor(e,t,o){this.editor=o,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(i=>{this.dom.setAttribute(i,e.attrs.attrs[i])}),this.dom.addEventListener("dblclick",i=>this.handleDoubleClick(i))}handleDoubleClick(e){const{editor:t,view:o}=this;Ps(o,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=""}}const Hb=function(n,e={}){const t={plugins:l=>l.plugins,...e},o=(l,a)=>{var b,x;const c=((b=t.schema)==null?void 0:b.call(t,{editor:n,schema:Ma,createCustomMark:Kr}))||Ma,{nodes:d,marks:p}=c,u={...a,component:a.view.model,editor:n,el:l};Ap(l);const f=_t.fromSchema(c).parse(l),h=ln.create({doc:f,schema:c,plugins:(x=t.plugins)==null?void 0:x.call(t,{editor:n,Plugin:Tn,plugins:[H1(),Z1(),Rb(c),Cg(),Ui({Tab:ya(1),"Shift-Tab":ya(-1)}),Ui({Enter:to($d,Pg(d.listItem),ab(u,t)),"Shift-Enter":to(jd,(C,y)=>(y&&y(C.tr.replaceSelectionWith(d.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":Ld,"Mod-y":Pr,"Mod-Shift-z":Pr,"Mod-b":At(p.strong),"Mod-i":At(p.em),"Shift-Tab":Nr(d.listItem),Tab:Ig(d.listItem)}),Ui(hg)]})}),g=new u1({mount:l},{state:h,dispatchTransaction(C){var S;const{state:y}=g,v=y.apply(C),k=!y.doc.eq(v.doc);g.updateState(v);const w=!y.selection.eq(v.selection);k&&(rb(((S=a==null?void 0:a.view)==null?void 0:S.el)||l),g.focus()),(w||k)&&n.trigger(de)}});return l.__rteView=g,g.setProps({nodeViews:{image(C){return new Vb(C,g,n)}}}),g},i=l=>Bb(l,t);n.setCustomRte({toolbar:i,parseContent:!0,async enable(l,a,c){const d=Ho(l);if(d)return d;const p=o(l,c);return ob(l,p,c.view),bb(p,c),p},disable(l){const a=Ho(l),c=a==null?void 0:a.view;if(c){const d=Aa(l);return ib(l,c),d||n.once(n.RichTextEditor.events.disable,()=>{a.gjsView.model.trigger("rerender")}),c.destroy(),{forceSync:d}}},getContent(l,a,c){var p;const d=(p=Ho(l))==null?void 0:p.view;if(d){const{schema:u,doc:f}=d.state;if(!Aa(l))return c.view.lastContent;const h=document.createElement("div"),g=Ut.fromSchema(u).serializeFragment(f.content);return g.childNodes.forEach(b=>{var x;b.nodeType===Node.ELEMENT_NODE&&(b.innerHTML===""?b.innerHTML="<br/>":((x=b.lastChild)==null?void 0:x.nodeName)==="BR"&&b.appendChild(document.createElement("br")))}),h.appendChild(g),sb(h),l.classList.remove("ProseMirror-focused"),h.innerHTML}return l.innerHTML}});const r=Wc(n,t.enableOnClick),s=Uh(n,t.disableOnEsc);q({editor:n,licenseKey:t.licenseKey,plan:Lb,pluginName:Dp,cleanup:()=>{n.RichTextEditor.customRte=void 0,r(),s()}})},Fb=W(Hb,Dp),zp="canvasEmptyState",_b=F.startup,Gb=function(n,e={}){const t=new WeakMap,o=new WeakMap,i=new WeakMap,r=new Set,s=new WeakMap,l={emptyStates:[],...e},a=(y,v)=>{let k=!1;const{isValid:w}=v;return Array.isArray(w)?k=w.some(S=>y.is(S)):We(w)?k=w({component:y,editor:n}):k=y.is(w),k},c=y=>{const v=t.get(y);t.delete(y),v==null||v()},d=y=>{y.views.forEach(v=>c(v)),i.delete(y)},p=y=>{if(!(!y||r.has(y)))try{r.add(y);const v=y.components().length>0,k=i.get(y);if(v&&k)d(y);else if(!v&&!k){const w=s.has(y)?s.get(y):l.emptyStates.find(S=>a(y,S));if(s.set(y,w),!w)return;y.views.forEach(S=>{const E=w.render({editor:n,component:y,componentView:S,mount:T=>{o.set(S,T),i.set(y,!0);const A=S.getChildrenContainer();A==null||A.appendChild(T)},unmount:()=>c(S)});t.set(S,()=>{E==null||E();const T=o.get(S);T==null||T.remove()})})}}finally{r.delete(y)}},u=y=>{i.has(y)&&d(y)},f=({model:y})=>{p(y.getComponent())},h=n.Components.events,g=`${h.update}:components`,b="component:mount",x=n.Canvas.events.frameLoadBody,C=h.removed;n.on(g,p),n.on(b,p),n.on(C,u),n.on(x,f),q({editor:n,licenseKey:l.licenseKey,plan:_b,pluginName:zp,cleanup:()=>{n.off(g,p),n.off(b,p),n.off(C,u),n.off(x,f)}})},Wb=W(Gb,zp),Yr="canvasFullSize",qb=F.startup,Ub=(n,e)=>{const{rule:t,ruleView:o}=e,{style:i}=t.attributes;if(i&&i[n]){const r=i[n],s=/([0-9.]+)(vh|dvh|lvh|svh)/g,l=s.test(r),a=o.frameView.model;if(l&&a.hasAutoHeight()){const c=r.replace(s,(p,u)=>`${window.innerHeight*(parseFloat(u)/100)}px`),d=t.toCSS({style:{...i,[n]:c}});e.css=d}}},Kb=n=>{["height","min-height","max-height"].forEach(e=>Ub(e,n))},Jb=function(n,e={}){const{Canvas:t,Commands:o,Devices:i,Css:r}=n,s={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...e},{canvasOffsetY:l,canvasOffsetX:a,canvasTransition:c,deviceMaxWidth:d,deviceMinHeigth:p,deviceFixedHeight:u,frameBorderRadius:f,frameTransition:h}=s,g=`${p}px`,b=t.events,x="core:preview",C=`${o.events.stopCommand}${x}`,y=t.getConfig(),v=`${Yr}:disable`,k=i.getAll().map(B=>({...B.attributes})),w=c*1e3,S={x:a,y:l};let E={},T,A;y.scrollableCanvas=!u,i.getAll().map(B=>{!B.get("width")&&B.set("width",`${d}px`),!B.get("height")&&B.set("height",u?"100vh":"auto"),!B.get("minHeight")&&B.set("minHeight",g)});const $=B=>{const me=`${_o}canvas-full-size`,ge=document.querySelector(`style[${me}]`);if(B&&ge)return ge.remove();const Re=ge||document.createElement("style"),go=t.getZoomMultiplier();Re.setAttribute(me,"true"),Re.innerHTML=`
|
|
917
|
+
.gjs-frame-wrapper { transition: width ${h}s !important; }
|
|
918
|
+
.gjs-frame-wrapper__bottom { height: ${l*go}px }
|
|
919
|
+
.gjs-frame { border-radius: ${f}px }
|
|
920
|
+
`,!ge&&document.body.appendChild(Re)};n.on(b.frameLoadHead,B=>{if(!y.scrollableCanvas)return;const{window:me}=B,ge=me.document,Re=ge.head,go=`${_o}canvas-full-size-wrappers`,bo=Re.querySelector(`style[${go}]`)||ge.createElement("style");bo.setAttribute(go,"true"),bo.innerHTML=`
|
|
921
921
|
body { height: auto !important; }
|
|
922
|
-
[data-gjs-type="wrapper"] { min-height: ${
|
|
923
|
-
[data-gjs-type="mjml"] { min-height: ${
|
|
924
|
-
[data-gjs-type="mj-body"] { min-height: ${
|
|
925
|
-
`,!
|
|
926
|
-
.${
|
|
922
|
+
[data-gjs-type="wrapper"] { min-height: ${g} !important; }
|
|
923
|
+
[data-gjs-type="mjml"] { min-height: ${g} !important; }
|
|
924
|
+
[data-gjs-type="mj-body"] { min-height: ${g} !important; }
|
|
925
|
+
`,!Re.contains(bo)&&Re.appendChild(bo)});const P=()=>T.style.display="none",N=()=>T.style.display="",I=()=>{var Re;if(!u)return;const B=t.getZoomMultiplier(),ge=t.getRect().height*B-l*2;(Re=i.getSelected())==null||Re.set("height",`${Math.max(ge,p)}px`),t.fitViewport({zoom:t.getZoom(),gap:S})},_=Jn(()=>{t.fitViewport({zoom:B=>B>100?100:B,ignoreHeight:!0,gap:S}),I(),$(),setTimeout(()=>{var me,ge;const{em:B}=n;B.destroyed||((ge=(me=n.getSelected())==null?void 0:me.getEl())==null||ge.scrollIntoView({block:"nearest"}),n.refresh({tools:!0}),N(),o.isActive(x)?B.stopDefault():B.runDefault())},w)},100),ae=(B={})=>{B.options&&B.options.from!=="fitViewport"&&t.fitViewport({zoom:t.getZoom(),ignoreHeight:!0,gap:S})},ce=()=>{P(),_()},Ze=()=>{E.overflowX="hidden",E.overflowY="auto"},we=()=>{A==null||A.disconnect(),_.clear()},Te=[[i.events.select,ce],[b.zoom,ae],[C,Ze],[n.events.destroy,we],[r.events.mountBefore,Kb]];o.add(v,()=>{i.devices.reset(k),y.scrollableCanvas=!1,t.getModel().updateDevice(),t.setZoom(100),t.setCoords(0,0),E.overflowY="hidden",$(!0),Te.forEach(([B,me])=>n.off(B,me)),we(),o.run("studio:canvasReload")}),Te.forEach(([B,me])=>n.on(B,me)),n.onReady(()=>{const B=t.getElement(),me=t.getFramesEl(),ge=t.getCanvasView();T=t.getSpotsEl(),E=B.style,E.overflowX="hidden",me.style.transition=`transform ${c}s`,document.removeEventListener("keypress",ge.onKeyPress),$(),A=new ResizeObserver(()=>{P(),_()}),A.observe(B.parentElement),_()}),q({editor:n,licenseKey:s.licenseKey,plan:qb,pluginName:Yr,cleanup:()=>{n.runCommand(v)}})},Yb=W(Jb,Yr),di="canvasGridMode",Zb=F.startup,Zr="component-grid-mode",so="grid-mode",mo="gjs-drag-grid-spot",Rp=`${mo}__grid-item`,Lp=`${mo}__grid-target`,Bp=`${mo}__snapped`,Xb=`${mo}__container`,Qb=()=>{const n="data-gjs-drag-grid-style",e=document,t="var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight))",o="var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue))",i=e.querySelector(`style[${n}]`)||e.createElement("style");i.setAttribute(n,"true"),i.innerHTML=`
|
|
926
|
+
.${Rp} {
|
|
927
927
|
outline: 2px solid ${o};
|
|
928
928
|
background: ${t};
|
|
929
929
|
outline-offset: -2px;
|
|
@@ -932,14 +932,14 @@
|
|
|
932
932
|
height: 100%;
|
|
933
933
|
opacity: 0.1;
|
|
934
934
|
}
|
|
935
|
-
.${
|
|
935
|
+
.${Bp} {
|
|
936
936
|
width: 100%;
|
|
937
937
|
height: 100%;
|
|
938
938
|
outline: 2px solid ${o};
|
|
939
939
|
outline-offset: -2px;
|
|
940
940
|
position: absolute;
|
|
941
941
|
}
|
|
942
|
-
.${
|
|
942
|
+
.${Lp} {
|
|
943
943
|
position: absolute;
|
|
944
944
|
z-index: -1;
|
|
945
945
|
background: ${t};
|
|
@@ -947,14 +947,14 @@
|
|
|
947
947
|
outline-offset: -1px;
|
|
948
948
|
opacity: 0.35;
|
|
949
949
|
}
|
|
950
|
-
`,e.head.appendChild(s)};function ap(n){const{editor:e,type:t}=n,o=Ay(e,n.component),s=Ci(e,o.component);if(!Py(e,o,s,t))return{target:o,container:s,startScroll:up(e).scroll,shadowContainerEl:document.createElement("div"),shadowSnappedEl:document.createElement("div"),shadowTargetEl:document.createElement("div"),spot:e.Canvas.addSpot({type:no,component:s.component})}}function cp(n){const{editor:e,shadowTargetEl:t,shadowSnappedEl:o,shadowContainerEl:s,spotEl:r,target:i,container:l}=n,{Canvas:a}=e,c=e.config.stylePrefix;r==null||r.appendChild(s),s==null||s.appendChild(t),s==null||s.appendChild(o),ky(s,l),Ey(t,i,l),Ty(o,i),My(s,l.el),i.el.style.opacity="0";const d=a.getSpots().filter(p=>p.type!==no);e.em.stopDefault({preserveSelected:!0}),a.removeSpots(d),a.startAutoscroll(),a.getBody().classList.add(`${c}is__grabbing`)}function dp(n){const{editor:e,shadowSnappedEl:t,shadowContainerEl:o,target:s,cancelled:r}=n,{Canvas:i}=e,l=e.config.stylePrefix,{component:a}=s;if(!r){const c=window.getComputedStyle(t);a.addStyle({"grid-area":c.gridArea,width:"",height:""})}s.el.style.opacity="",o.contains(t)&&(o==null||o.removeChild(t)),e.getModel().runDefault({preserveSelected:1}),i.stopAutoscroll(),i.getBody().classList.remove(`${l}is__grabbing`),i.removeSpots({type:no}),e.select(a)}function ky(n,{rows:e,columns:t}){const o=[];for(let s=0;s<t.length;s++){o[s]=[];for(let r=0;r<e.length;r++){const i=document.createElement("div");i.className=rp,i.style.gridArea=`${r+1} / ${s+1}`,o[s][r]=i,n.appendChild(i)}}return o}function Ey(n,e,t){return n.className=ip,n.style.top=`${e.offset.top-t.offset.top}px`,n.style.left=`${e.offset.left-t.offset.left}px`,n.style.width=`${e.offset.width+e.margin.left+e.margin.right}px`,n.style.height=`${e.offset.height+e.margin.top+e.margin.bottom}px`,n}function Ty(n,e){const t=hp(e.el,e.computedStyles);return n.className=lp,n.style.gridArea=`${t.row.start} / ${t.column.start} / ${t.row.end} / ${t.column.end}`,n}function My(n,e){const t=window.getComputedStyle(e);n.className=wy,n.style.position="relative",n.style.display=t.display,n.style.gap=t.gap,n.style.padding=t.padding,n.style.border=t.border,n.style.gridTemplateColumns=t.gridTemplateColumns,n.style.gridTemplateRows=t.gridTemplateRows}function pp(n,e){if(e){if(Array.isArray(e))return[...e].pop()}else return[...n.getSelectedAll()].pop();return e}function Ay(n,e){const t=pp(n,e),o=t.getEl(),s=window.getComputedStyle(o);return{component:t,el:o,offset:n.Canvas.offset(o),margin:{top:parseFloat(s.marginTop),right:parseFloat(s.marginRight),bottom:parseFloat(s.marginBottom),left:parseFloat(s.marginLeft)},computedStyles:s}}function Ci(n,e){const t=e.parent(),o=t.getEl(),s=window.getComputedStyle(o);return{component:t,el:o,offset:n.Canvas.offset(o),computedStyles:s,padding:{top:parseFloat(s.paddingTop),right:parseFloat(s.paddingRight),bottom:parseFloat(s.paddingBottom),left:parseFloat(s.paddingLeft)},columns:s.gridTemplateColumns.split(" ").map(i=>parseFloat(i)),rows:s.gridTemplateRows.split(" ").map(i=>parseFloat(i)),gap:{column:parseInt(s.columnGap),row:parseInt(s.rowGap)}}}function ut(n,e,t,o,s=1){let r=0;for(let i=e;i<=n.length;i++){if(r+(n[i-1]+o)*s>t)return i;r+=o+n[i-1]}return n.length+1}function up(n){const{scrollY:e,scrollX:t}=n.Canvas.getWindow();return{scroll:{top:e,left:t}}}function Py(n,e,t,o){const s=r=>n.em.logWarning(r);return o==="draggable"&&e.component.get(o)===!1?(s(`[${_r}] The element is not ${o}`),!0):t.computedStyles.display!=="grid"?(s(`[${_r}] The container does not have style display:grid`),!0):!1}function Xs(n,e,t={}){const o=pp(n,e),s=o==null?void 0:o.parent(),r=s==null?void 0:s.getEl();if(!s||!r)return!1;const{enableGrid:i}=t,l=window.getComputedStyle(r).display==="grid";return _t(i)?i({component:o,parent:s,isParentGrid:l}):l}const Ca=n=>n.split(" ").map(e=>parseFloat(e));function hp(n,e){const t=n.ownerDocument.defaultView,o=e||t.getComputedStyle(n),s=o.gridArea.split("/").some(S=>isNaN(parseInt(S.trim()))),r={isComputed:s,raw:o.gridArea},i={...r,row:{start:parseInt(o.gridRowStart)||1,end:parseInt(o.gridRowEnd)||2},column:{start:parseInt(o.gridColumnStart)||1,end:parseInt(o.gridColumnEnd)||2}};if(!s)return i;const l=n.parentElement;if(!l)return i;const a=t.getComputedStyle(l),c=parseFloat(a.columnGap)||0,d=parseFloat(a.rowGap)||0,p=Ca(a.gridTemplateColumns),u=Ca(a.gridTemplateRows),h=parseFloat(a.paddingLeft)||0,f=parseFloat(a.paddingTop)||0,m=l.getBoundingClientRect(),g=n.getBoundingClientRect(),b=(S,x,E,k,M)=>{let P=1,N=k+M;for(let O=0;O<x.length;O++){const R=x[O],F=N+R;if(S>=N&&S<F)return P;N=F+E,P++}return-1},w=b(g.left,p,c,m.left,h),y=b(g.right-1,p,c,m.left,h)+1,v=b(g.top,u,d,m.top,f),C=b(g.bottom-1,u,d,m.top,f)+1;return{...r,row:{start:v,end:C},column:{start:w,end:y}}}function Ny(n){n.Commands.add(Gr,{stop(){},run(e,t,o={}){const s=ap({editor:e,component:o.target,type:"draggable"});if(!s){this.stopCommand();return}const{spot:r,target:i,shadowContainerEl:l,shadowSnappedEl:a,shadowTargetEl:c,startScroll:d}=s;let{container:p}=s,u;new e.Utils.Dragger({doc:i.el.ownerDocument,onStart:()=>{u=setTimeout(()=>{cp({editor:e,shadowTargetEl:c,shadowSnappedEl:a,shadowContainerEl:l,spotEl:r.attributes.spotEl,target:i,container:p}),p=Ci(e,i.component)},10)},onEnd:(f,m,{cancelled:g})=>{clearTimeout(u),dp({editor:e,shadowSnappedEl:a,shadowContainerEl:l,target:i,cancelled:g}),this.stopCommand(),e.em.set("_cmpDrag",1)},setPosition:({x:f,y:m})=>{const{scroll:g}=up(e),{columns:b,rows:w,gap:y,offset:v,padding:C}=p,{offset:S,margin:x}=i,E=S.top-v.top-C.top-x.top+m-d.top+g.top,k=S.left-v.left-C.left-x.left+f-d.left+g.left,M=Math.min(ut(b,1,k,y.column,.5),b.length),P=Math.min(ut(w,1,E,y.row,.5),w.length),N=Math.min(ut(b,M,S.width,y.column)+1,b.length+1),O=Math.min(ut(w,P,S.height,y.row)+1,w.length+1);a.style.gridArea=`${P} / ${M} / ${O} / ${N}`,c.style.top=`${E+C.top}px`,c.style.left=`${k+C.left}px`}}).start(o.event)}})}function Oy(n,e){const t=ap({editor:n,component:e.component,type:"resizable"});if(!t)return;const{onMove:o,onEnd:s}=e.options||{},{spot:r,target:i,shadowContainerEl:l,shadowSnappedEl:a,shadowTargetEl:c}=t;let{container:d}=t,p="",u=!1,h;return{onStart:f=>{p=f.target.dataset.gjsHandler||"",u=!1,h=setTimeout(()=>{cp({editor:n,shadowTargetEl:c,shadowSnappedEl:a,shadowContainerEl:l,spotEl:r.attributes.spotEl,target:i,container:d}),d=Ci(n,i.component),u=!0},10),n.trigger("component:resize",{...i||{},type:"start"})},onEnd:(f,m)=>{const{startDim:g,rectDim:b}=m.resizer,w=JSON.stringify(g)===JSON.stringify(b);clearTimeout(h),u&&dp({editor:n,shadowSnappedEl:a,shadowContainerEl:l,target:i,cancelled:w}),u=!1,s==null||s(f,m)},onMove:(f,m)=>{if(!u||!a.parentElement)return;const g=hp(a),b=i.margin.left,w=i.margin.top,y=i.margin.bottom,v=i.margin.right,{w:C,t:S,l:x,h:E}=m.resizer.rectDim,k={t:S-w,l:x-b,h:E+w+y,w:C+b+v};p.endsWith("l")&&(g.column.start=ut(d.columns,1,k.l-d.offset.left-d.padding.left,d.gap.column,.5)),p.startsWith("t")&&(g.row.start=ut(d.rows,1,k.t-d.offset.top-d.padding.top,d.gap.row,.5)),p.endsWith("r")&&(g.column.end=Math.max(ut(d.columns,g.column.start,k.w,d.gap.column,.5),g.column.start+1)),p.startsWith("b")&&(g.row.end=Math.max(ut(d.rows,g.row.start,k.h,d.gap.row,.5),g.row.start+1)),a.style.gridArea=`${g.row.start} / ${g.column.start} / ${g.row.end} / ${g.column.end}`,c.style.width=`${k.w}px`,c.style.height=`${k.h}px`,c.style.left=`${k.l-d.offset.left}px`,c.style.top=`${k.t-d.offset.top}px`,o==null||o(f,m)}}}const ka=["px","%","em","rem","vw","vh"],Iy=(n,e)=>{const t=n.Styles.getSectors().find(o=>!!o.getProperty(e));return{sector:t,property:t?t.getProperty(e):void 0}},Ry=(n,e)=>Iy(n,e),Dy=(n,{x:e,y:t,mergable:o}={})=>{const s={property:`${n}-x`,type:"integer",units:ka,...e},r={property:`${n}-y`,type:"integer",units:ka,...t};return{property:n,type:"composite",properties:[s,r],...o&&{fromStyle(i,{name:l,separator:a,property:c}){const[d,p]=c.getProperties(),[u,h]=(i[l]||"").split(a);return{[d.getId()]:i[d.getName()]||u||"",[p.getId()]:i[p.getName()]||h||u||""}},toStyle(i,{name:l,property:a}){const[c,d]=a.getProperties(),p=i[c.getId()],u=i[d.getId()];return{[l]:p===u?p:`${p} ${u}`}}}}},Wr={display:["grid"]};function Ly(n=""){const e=/^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i,t=/^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i,o=n.match(e);if(!o)return null;const s=parseInt(o[1],10),r=o[2];let i=r,l=r;const a=r.match(t);return a&&(i=a[1],l=a[2]),{total:s,min:i===l?"":i,max:l}}function $y(n={}){let e="",t="",o="",s="";const r=m=>m.split("/").map(g=>g.trim()).filter(Boolean),i=n["grid-area"]||"",l=n["grid-column"]||"",a=n["grid-row"]||"",c=r(i),d=r(l),p=r(a),u=c.length,h=d.length,f=p.length;return u===4?(o=c[0],e=c[1],s=c[2],t=c[3]):u===3?(o=c[0],e=c[1],s=c[2]):u===2?(o=c[0],e=c[1]):u===1&&(o=c[0]),h===2?(e=d[0],t=d[1]):h===1&&(e=d[0]),f===2?(o=p[0],s=p[1]):f===1&&(o=p[0]),{columnStart:e,columnEnd:t,rowStart:o,rowEnd:s}}function Ea(n){const{property:e,label:t}=n,o="1",s="1fr";return{property:e,label:t,type:"composite",requires:Wr,generic:!0,properties:[{name:" ",property:`${e}-repeat`,type:"number",full:!0,min:1,default:"1"},{label:"Min size",property:`${e}-min`,type:"number",min:0,units:["px","%"],default:"0"},{label:"Max size",property:`${e}-max`,type:"number",min:1,units:["fr","px","%"],default:"1"}],fromStyle(r,i){const{name:l,property:a}=i,[c,d,p]=a.getProperties(),u=r[l],h=Ly(u),f=(h==null?void 0:h.max)??s;return{[c.id]:(h==null?void 0:h.total)??o,[d.id]:(h==null?void 0:h.min)??"",[p.id]:f===s?"":f}},toStyle(r,{name:i,property:l}){const[a,c,d]=l.getProperties(),p=r[a.id],u=r[c.id],h=r[d.id]||s,f=u&&h?`minmax(${u}, ${h})`:h;return{[i]:`repeat(${p||o}, ${f})`}}}}function zy(n,e){if(!e.styleableGrid)return;const{property:t,...o}=Ry(n,"display");if(!t)return;const s=t.getOption("grid"),r=o.sector;s||t.addOption({id:"grid",label:"Grid"}),r.addProperty(Ea({label:"Columns",property:"grid-template-columns"}),{}),r.addProperty(Ea({label:"Rows",property:"grid-template-rows"}),{}),r.addProperty({id:"grid-gap",requires:Wr,...Dy("gap",{x:{id:"grid-row-gap",label:"Row",property:"row-gap",min:0,default:"0"},y:{id:"grid-column-gap",label:"Column",property:"column-gap",min:0,default:"0"},mergable:!0})},{}),r.addProperty({type:"composite",property:"grid-area",label:"Grid area",requiresParent:Wr,generic:!0,properties:[{label:"Row start",property:"grid-row-start",type:"integer",default:"auto"},{label:"Row end",property:"grid-row-end",type:"integer",default:"auto"},{label:"Column start",property:"grid-column-start",type:"integer",default:"auto"},{label:"Column end",property:"grid-column-end",type:"integer",default:"auto"}],fromStyle(i){const l=$y(i);return{"grid-column-start":i["grid-column-start"]||l.columnStart,"grid-column-end":i["grid-column-end"]||l.columnEnd,"grid-row-start":i["grid-row-start"]||l.rowStart,"grid-row-end":i["grid-row-end"]||l.rowEnd}},toStyle(i,{name:l}){const a=i["grid-row-start"]||"auto",c=i["grid-row-end"]||"auto",d=i["grid-column-start"]||"auto",p=i["grid-column-end"]||"auto";return{[l]:`${a} / ${d} / ${c} / ${p}`}}},{})}const Vy=function(n,e={}){const t={itemResizable:!0,...e},{Canvas:o,Commands:s,Components:r}=n,{itemResizable:i}=t,l=o.events,a=s.events,c=r.events,d=`${a.runBeforeCommand}tlb-move`,p=`${a.runBeforeCommand}resize`;let u;Ny(n);const h=({options:y})=>{Xs(n,y.target,t)&&(n.runCommand(Gr,{...y}),y.abort=!0)},f=y=>{const{options:v}=y;Xs(n,v.component,t)&&(v.options=Object.assign(v.options||{},Oy(n,v)))},m=()=>{const y=o.getSpots({type:no}).pop();if(!y)return;let v=y.attributes.spotEl;v||(v=document.createElement("div"),v.className=po,y.set({spotEl:v})),Object.entries(y.getStyle()).forEach(([C,S])=>v.style.setProperty(C,S)),u==null||u.appendChild(v)},g=({spot:y})=>{const v=y.attributes.spotEl;y.type!==no||!v||u==null||u.removeChild(v)};if(i){const y=v=>{const C=_t(i)?i({component:v}):i;return typeof C=="boolean"?C:{tl:!1,tc:!1,tr:!1,cl:!1,cr:!1,bl:!1,bc:!1,br:!1,...C}};n.on(c.resizeInit,v=>{const{component:C}=v;if(Xs(n,C,t)){const S=y(C);v.resizable=S}})}const b=[[d,h],[p,f],[l.spot,m],[l.spotRemove,g]];b.forEach(([y,v])=>{n.on(y,v)}),n.onReady(()=>{u=o.getSpotsEl(),Cy(),zy(n,t)});const w=()=>{delete n.Commands.commands[Gr],b.forEach(([y,v])=>{n.off(y,v)})};W({editor:n,licenseKey:t.licenseKey,plan:xy,pluginName:_r,cleanup:w})},By=G(Vy),Hy="canvasScreenshot",Fy=H.startup;var fp=(n=>(n.screenshot="studioPlugin:screenshot",n))(fp||{});const _y=async n=>await Op([{id:"html-to-image",src:n}]),Gy=async(n,e={},t={})=>{const{cdnScript:o}=t;if(!window.htmlToImage){if(!o)return;await _y(o)}return new Promise((s,r)=>{(async()=>{try{const{canvasWidth:l,canvasHeight:a,width:c,height:d,type:p,quality:u,addOptions:h}=e,f={pixelRatio:1,width:c,height:d,canvasWidth:l,canvasHeight:a},m=(h==null?void 0:h(f))||f,b=await window.htmlToImage.toCanvas(n,m);b.toBlob(w=>{w?s({file:w,canvas:b}):r(new Error("Failed to create file from canvas"))},p,u)}catch(l){r(l)}})()})},Qs=fp.screenshot,Wy=function(n,e={}){const{Commands:t,Canvas:o,Storage:s}=n,r=s.events.afterStore,i={cdnScript:"https://cdnjs.cloudflare.com/ajax/libs/html-to-image/1.11.13/html-to-image.min.js",...e};t.add(Qs,async(c,d,p)=>{const{el:u,...h}=p;return await Gy(u,h,i)});const l=async()=>{var d;const c=o.getBody();if(!c)return n.log("Canvas element not found");try{const p=await n.runCommand(Qs,{el:c,canvasWidth:400,canvasHeight:225,width:1200,height:675,type:"image/jpeg"});(d=i.screenshotOnSave)==null||d.call(i,{...p,editor:n})}catch(p){console.error("Screenshot error",p)}};i.screenshotOnSave&&n.on(r,l);const a=()=>{delete t.commands[Qs],n.off(r,l)};W({editor:n,licenseKey:e.licenseKey,plan:Fy,pluginName:Hy,cleanup:a})},jy=G(Wy);var Be=(n=>(n.panelBlocks="panelBlocks",n.panelPagesLayers="panelPagesLayers",n.panelGlobalStyles="panelGlobalStyles",n.panelSidebarTabs="panelSidebarTabs",n.panelAssets="panelAssets",n.aiChatPanel="aiChatPanel",n.panelDataSources="panelDataSources",n))(Be||{});const mp="sidebarButtonsTarget",Mo=(n,e)=>{const{id:t,icon:o,label:s,tooltip:r,className:i,skipSelfClose:l,removeLayouts:a,layoutComponent:c,layoutCommand:d}=n,{pluginOpts:p,breakpointProps:u}=e,h=t;return{id:gp(t),type:"button",icon:o,tooltip:s||r,className:i,editorEvents:{[`${$a.layoutToggleId}${h}`]:({fromEvent:f,setState:m,editor:g})=>{m({active:f.isOpen}),setTimeout(()=>g.refresh({tools:!0}),20)}},onClick:({editor:f,state:m})=>{var C;if(m.active&&l)return;const g=(d==null?void 0:d.placer)||{type:"static",layoutId:mp},b={...g,skipCleanup:g.type==="static"},w=a||Object.keys(Be).filter(S=>S!==h);yp(f,{removeLayouts:w,layout:{placer:b}});const y={id:h,placer:g,header:(d==null?void 0:d.header)??{label:s,close:!l},layout:c,style:{width:280,height:"100%",borderRightWidth:1,...d==null?void 0:d.style}},v=((C=p==null?void 0:p.sidebarLayoutCommand)==null?void 0:C.call(p,{...u,layoutCommand:y,sidebarButtonProps:n}))||y;f.runCommand(_.layoutToggle,{...v})}}},gp=n=>`button__${n}`,yp=(n,e={})=>{(e.removeLayouts||Object.keys(Be)).forEach(o=>n.runCommand(_.layoutRemove,{id:o,layout:e.layout}))},bp=n=>{const e=(n==null?void 0:n.breakpointTablet)??1024,t=(n==null?void 0:n.breakpointMobile)??768,o={},s=[{id:Be.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:Be.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:Be.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:Be.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:h,editor:f})=>{var w;const m=f.getSelected(),g={type:"image",src:h.src};let b;if(m!=null&&m.is("image"))return m.set("src",h.src);m&&f.Components.canMove(m,g)?b=m.append(g)[0]:m||(b=(w=f.getWrapper())==null?void 0:w.append(g)[0]),b&&f.select(b,{scroll:!0})}}}],r=[...s,{id:Be.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"}}],i={id:mp,type:"column",className:"gs-cmp-layout-sidebar-target",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:[]}}},c=h=>({breakpoint:h,breakpointTablet:e,breakpointMobile:t}),d=(h,f,m)=>{const g=c(f),b={pluginOpts:n,breakpointProps:g},w=h.map(v=>{const C=Mo(v,b);return n!=null&&n.sidebarButton?n.sidebarButton({id:v.id,buttonIds:Be,buttonProps:C,sidebarButtonProps:v,...g,createSidebarButton:S=>Mo({...v,...S},b)}):C}).filter(Boolean);return(n!=null&&n.sidebarButtons?n==null?void 0:n.sidebarButtons({buttonIds:Be,sidebarButtons:w,...g,createSidebarButton:v=>Mo({...v,layoutCommand:{...m==null?void 0:m.layoutCommand,...v.layoutCommand}},b)}):w).filter(Boolean)},p=(h,f,m)=>{var w;const g=c(m),b={pluginOpts:n,breakpointProps:g};return((w=n==null?void 0:n.rootLayout)==null?void 0:w.call(n,{sidebarButtons:f,rootLayout:h,layoutSidebarLeft:l,layoutSidebarTarget:i,...g,createSidebarButton:y=>Mo({...y},b)}))??h};if(e){const h=d(r,e);o[e]=p({type:"row",style:{height:"100%"},children:[{...l,children:h},i,a]},h,e)}if(t){const h={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},f=r.map(g=>({...g,layoutCommand:h})),m=d(f,t,{layoutCommand:h});o[t]=p({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:m}]},m,t)}const u=d(s,0);return{default:p({type:"row",style:{height:"100%"},children:[{...l,children:u},i,a,{type:"sidebarRight"}]},u,0),responsive:o}},Ta="layoutSidebarButtons",qy=H.free,Uy=function(n,e={}){const{Commands:t}=n,o=t.events,s={...e};(()=>{if(n.runCommand(_.layoutConfigGet)||s.skipLayoutConfig===!0)return;const l=bp(s);n.runCommand(_.layoutConfigSet,{...l})})(),t.add(`${Ta}:toggleButton`,(i,l,a)=>{const c=document.getElementById(gp(a==null?void 0:a.id));c==null||c.click()}),n.on(`${o.runCommand}core:preview`,()=>{yp(n)}),W({editor:n,licenseKey:s.licenseKey,plan:qy,pluginName:Ta,cleanup:()=>{n.runCommand(_.layoutConfigSet)}})},vp=G(Uy);vp.createLayoutConfig=n=>bp(n);const wt="page-break";var Ae=(n=>(n.A5="a5",n.A5Portrait="a5-portrait",n.A4="a4",n.A3="a3",n.B5="b5",n.B4="b4",n.letter="letter",n.legal="legal",n.ledger="ledger",n))(Ae||{});function jr(n,e){const o={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return o[e]?n*o[e]:null}const Ky=(n,e)=>{const{name:t,id:o,width:s,height:r,unit:i}=n,{fixedHeight:l}=e,a=`${s}${i}`,c=`${r}${i}`;return{id:o||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${a} x ${c})`,sizeH:r,sizeW:s,sizeUnit:i,widthMedia:"",width:a,minHeight:l?"0":`${jr(r,i)}px`,height:l?c:void 0}},qr="page-breaks",Ao="gjs-page-breaks-spot",er=n=>n.type===qr;function Jy(n){const{Devices:e}=n,{height:t,minHeight:o}=e.getSelected().attributes,r=parseFloat(`${t&&t!=="auto"?t:o}`),i=n.getWrapper(),l=i==null?void 0:i.getEl(),a=[];if(!i||!l)return a;const c=l.getBoundingClientRect().height,p=i.findType(wt).map(h=>h.getEl()).filter(Boolean).map(h=>({top:h.offsetTop,height:h.offsetHeight}));let u=0;for(;u<c;){const h=p.find(f=>f.top>u&&f.top<u+r);h?(u=h.top+h.height,a.push(h.top)):(u+=r,u<c&&a.push(u))}return a}function Zy(n,e){const{Canvas:t}=n,o=t.events,s=n.events;let r;const i=()=>{Yr(`${Bo}preset-printable-spots`,`.${Ao} {
|
|
950
|
+
`,e.head.appendChild(i)};function Vp(n){const{editor:e,type:t}=n,o=iy(e,n.component),i=Os(e,o.component);if(!ry(e,o,i,t))return{target:o,container:i,startScroll:Gp(e).scroll,shadowContainerEl:document.createElement("div"),shadowSnappedEl:document.createElement("div"),shadowTargetEl:document.createElement("div"),spot:e.Canvas.addSpot({type:so,component:i.component})}}function Hp(n){const{editor:e,shadowTargetEl:t,shadowSnappedEl:o,shadowContainerEl:i,spotEl:r,target:s,container:l}=n,{Canvas:a}=e,c=e.config.stylePrefix;r==null||r.appendChild(i),i==null||i.appendChild(t),i==null||i.appendChild(o),ey(i,l),ty(t,s,l),ny(o,s),oy(i,l.el),s.el.style.opacity="0";const d=a.getSpots().filter(p=>p.type!==so);e.em.stopDefault({preserveSelected:!0}),a.removeSpots(d),a.startAutoscroll(),a.getBody().classList.add(`${c}is__grabbing`)}function Fp(n){const{editor:e,shadowSnappedEl:t,shadowContainerEl:o,target:i,cancelled:r}=n,{Canvas:s}=e,l=e.config.stylePrefix,{component:a}=i;if(!r){const c=window.getComputedStyle(t);a.addStyle({"grid-area":c.gridArea,width:"",height:""})}i.el.style.opacity="",o.contains(t)&&(o==null||o.removeChild(t)),e.getModel().runDefault({preserveSelected:1}),s.stopAutoscroll(),s.getBody().classList.remove(`${l}is__grabbing`),s.removeSpots({type:so}),e.select(a)}function ey(n,{rows:e,columns:t}){const o=[];for(let i=0;i<t.length;i++){o[i]=[];for(let r=0;r<e.length;r++){const s=document.createElement("div");s.className=Rp,s.style.gridArea=`${r+1} / ${i+1}`,o[i][r]=s,n.appendChild(s)}}return o}function ty(n,e,t){return n.className=Lp,n.style.top=`${e.offset.top-t.offset.top}px`,n.style.left=`${e.offset.left-t.offset.left}px`,n.style.width=`${e.offset.width+e.margin.left+e.margin.right}px`,n.style.height=`${e.offset.height+e.margin.top+e.margin.bottom}px`,n}function ny(n,e){const t=Wp(e.el,e.computedStyles);return n.className=Bp,n.style.gridArea=`${t.row.start} / ${t.column.start} / ${t.row.end} / ${t.column.end}`,n}function oy(n,e){const t=window.getComputedStyle(e);n.className=Xb,n.style.position="relative",n.style.display=t.display,n.style.gap=t.gap,n.style.padding=t.padding,n.style.border=t.border,n.style.gridTemplateColumns=t.gridTemplateColumns,n.style.gridTemplateRows=t.gridTemplateRows}function _p(n,e){if(e){if(Array.isArray(e))return[...e].pop()}else return[...n.getSelectedAll()].pop();return e}function iy(n,e){const t=_p(n,e),o=t.getEl(),i=window.getComputedStyle(o);return{component:t,el:o,offset:n.Canvas.offset(o),margin:{top:parseFloat(i.marginTop),right:parseFloat(i.marginRight),bottom:parseFloat(i.marginBottom),left:parseFloat(i.marginLeft)},computedStyles:i}}function Os(n,e){const t=e.parent(),o=t.getEl(),i=window.getComputedStyle(o);return{component:t,el:o,offset:n.Canvas.offset(o),computedStyles:i,padding:{top:parseFloat(i.paddingTop),right:parseFloat(i.paddingRight),bottom:parseFloat(i.paddingBottom),left:parseFloat(i.paddingLeft)},columns:i.gridTemplateColumns.split(" ").map(s=>parseFloat(s)),rows:i.gridTemplateRows.split(" ").map(s=>parseFloat(s)),gap:{column:parseInt(i.columnGap),row:parseInt(i.rowGap)}}}function mt(n,e,t,o,i=1){let r=0;for(let s=e;s<=n.length;s++){if(r+(n[s-1]+o)*i>t)return s;r+=o+n[s-1]}return n.length+1}function Gp(n){const{scrollY:e,scrollX:t}=n.Canvas.getWindow();return{scroll:{top:e,left:t}}}function ry(n,e,t,o){const i=r=>n.em.logWarning(r);return o==="draggable"&&e.component.get(o)===!1?(i(`[${di}] The element is not ${o}`),!0):t.computedStyles.display!=="grid"?(i(`[${di}] The container does not have style display:grid`),!0):!1}function nr(n,e,t={}){const o=_p(n,e),i=o==null?void 0:o.parent(),r=i==null?void 0:i.getEl();if(!i||!r)return!1;const{enableGrid:s}=t,l=window.getComputedStyle(r).display==="grid";return We(s)?s({component:o,parent:i,isParentGrid:l}):l}const Na=n=>n.split(" ").map(e=>parseFloat(e));function Wp(n,e){const t=n.ownerDocument.defaultView,o=e||t.getComputedStyle(n),i=o.gridArea.split("/").some(w=>isNaN(parseInt(w.trim()))),r={isComputed:i,raw:o.gridArea},s={...r,row:{start:parseInt(o.gridRowStart)||1,end:parseInt(o.gridRowEnd)||2},column:{start:parseInt(o.gridColumnStart)||1,end:parseInt(o.gridColumnEnd)||2}};if(!i)return s;const l=n.parentElement;if(!l)return s;const a=t.getComputedStyle(l),c=parseFloat(a.columnGap)||0,d=parseFloat(a.rowGap)||0,p=Na(a.gridTemplateColumns),u=Na(a.gridTemplateRows),f=parseFloat(a.paddingLeft)||0,h=parseFloat(a.paddingTop)||0,g=l.getBoundingClientRect(),b=n.getBoundingClientRect(),x=(w,S,E,T,A)=>{let $=1,P=T+A;for(let N=0;N<S.length;N++){const I=S[N],_=P+I;if(w>=P&&w<_)return $;P=_+E,$++}return-1},C=x(b.left,p,c,g.left,f),y=x(b.right-1,p,c,g.left,f)+1,v=x(b.top,u,d,g.top,h),k=x(b.bottom-1,u,d,g.top,h)+1;return{...r,row:{start:v,end:k},column:{start:C,end:y}}}function sy(n){n.Commands.add(Zr,{stop(){},run(e,t,o={}){const i=Vp({editor:e,component:o.target,type:"draggable"});if(!i){this.stopCommand();return}const{spot:r,target:s,shadowContainerEl:l,shadowSnappedEl:a,shadowTargetEl:c,startScroll:d}=i;let{container:p}=i,u;new e.Utils.Dragger({doc:s.el.ownerDocument,onStart:()=>{u=setTimeout(()=>{Hp({editor:e,shadowTargetEl:c,shadowSnappedEl:a,shadowContainerEl:l,spotEl:r.attributes.spotEl,target:s,container:p}),p=Os(e,s.component)},10)},onEnd:(h,g,{cancelled:b})=>{clearTimeout(u),Fp({editor:e,shadowSnappedEl:a,shadowContainerEl:l,target:s,cancelled:b}),this.stopCommand(),e.em.set("_cmpDrag",1)},setPosition:({x:h,y:g})=>{const{scroll:b}=Gp(e),{columns:x,rows:C,gap:y,offset:v,padding:k}=p,{offset:w,margin:S}=s,E=w.top-v.top-k.top-S.top+g-d.top+b.top,T=w.left-v.left-k.left-S.left+h-d.left+b.left,A=Math.min(mt(x,1,T,y.column,.5),x.length),$=Math.min(mt(C,1,E,y.row,.5),C.length),P=Math.min(mt(x,A,w.width,y.column)+1,x.length+1),N=Math.min(mt(C,$,w.height,y.row)+1,C.length+1);a.style.gridArea=`${$} / ${A} / ${N} / ${P}`,c.style.top=`${E+k.top}px`,c.style.left=`${T+k.left}px`}}).start(o.event)}})}function ly(n,e){const t=Vp({editor:n,component:e.component,type:"resizable"});if(!t)return;const{onMove:o,onEnd:i}=e.options||{},{spot:r,target:s,shadowContainerEl:l,shadowSnappedEl:a,shadowTargetEl:c}=t;let{container:d}=t,p="",u=!1,f;return{onStart:h=>{p=h.target.dataset.gjsHandler||"",u=!1,f=setTimeout(()=>{Hp({editor:n,shadowTargetEl:c,shadowSnappedEl:a,shadowContainerEl:l,spotEl:r.attributes.spotEl,target:s,container:d}),d=Os(n,s.component),u=!0},10),n.trigger("component:resize",{...s||{},type:"start"})},onEnd:(h,g)=>{const{startDim:b,rectDim:x}=g.resizer,C=JSON.stringify(b)===JSON.stringify(x);clearTimeout(f),u&&Fp({editor:n,shadowSnappedEl:a,shadowContainerEl:l,target:s,cancelled:C}),u=!1,i==null||i(h,g)},onMove:(h,g)=>{if(!u||!a.parentElement)return;const b=Wp(a),x=s.margin.left,C=s.margin.top,y=s.margin.bottom,v=s.margin.right,{w:k,t:w,l:S,h:E}=g.resizer.rectDim,T={t:w-C,l:S-x,h:E+C+y,w:k+x+v};p.endsWith("l")&&(b.column.start=mt(d.columns,1,T.l-d.offset.left-d.padding.left,d.gap.column,.5)),p.startsWith("t")&&(b.row.start=mt(d.rows,1,T.t-d.offset.top-d.padding.top,d.gap.row,.5)),p.endsWith("r")&&(b.column.end=Math.max(mt(d.columns,b.column.start,T.w,d.gap.column,.5),b.column.start+1)),p.startsWith("b")&&(b.row.end=Math.max(mt(d.rows,b.row.start,T.h,d.gap.row,.5),b.row.start+1)),a.style.gridArea=`${b.row.start} / ${b.column.start} / ${b.row.end} / ${b.column.end}`,c.style.width=`${T.w}px`,c.style.height=`${T.h}px`,c.style.left=`${T.l-d.offset.left}px`,c.style.top=`${T.t-d.offset.top}px`,o==null||o(h,g)}}}const Oa=["px","%","em","rem","vw","vh"],ay=(n,e)=>{const t=n.Styles.getSectors().find(o=>!!o.getProperty(e));return{sector:t,property:t?t.getProperty(e):void 0}},cy=(n,e)=>ay(n,e),dy=(n,{x:e,y:t,mergable:o}={})=>{const i={property:`${n}-x`,type:"integer",units:Oa,...e},r={property:`${n}-y`,type:"integer",units:Oa,...t};return{property:n,type:"composite",properties:[i,r],...o&&{fromStyle(s,{name:l,separator:a,property:c}){const[d,p]=c.getProperties(),[u,f]=(s[l]||"").split(a);return{[d.getId()]:s[d.getName()]||u||"",[p.getId()]:s[p.getName()]||f||u||""}},toStyle(s,{name:l,property:a}){const[c,d]=a.getProperties(),p=s[c.getId()],u=s[d.getId()];return{[l]:p===u?p:`${p} ${u}`}}}}},Xr={display:["grid"]};function py(n=""){const e=/^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i,t=/^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i,o=n.match(e);if(!o)return null;const i=parseInt(o[1],10),r=o[2];let s=r,l=r;const a=r.match(t);return a&&(s=a[1],l=a[2]),{total:i,min:s===l?"":s,max:l}}function uy(n={}){let e="",t="",o="",i="";const r=g=>g.split("/").map(b=>b.trim()).filter(Boolean),s=n["grid-area"]||"",l=n["grid-column"]||"",a=n["grid-row"]||"",c=r(s),d=r(l),p=r(a),u=c.length,f=d.length,h=p.length;return u===4?(o=c[0],e=c[1],i=c[2],t=c[3]):u===3?(o=c[0],e=c[1],i=c[2]):u===2?(o=c[0],e=c[1]):u===1&&(o=c[0]),f===2?(e=d[0],t=d[1]):f===1&&(e=d[0]),h===2?(o=p[0],i=p[1]):h===1&&(o=p[0]),{columnStart:e,columnEnd:t,rowStart:o,rowEnd:i}}function Ia(n){const{property:e,label:t}=n,o="1",i="1fr";return{property:e,label:t,type:"composite",requires:Xr,generic:!0,properties:[{name:" ",property:`${e}-repeat`,type:"number",full:!0,min:1,default:"1"},{label:"Min size",property:`${e}-min`,type:"number",min:0,units:["px","%"],default:"0"},{label:"Max size",property:`${e}-max`,type:"number",min:1,units:["fr","px","%"],default:"1"}],fromStyle(r,s){const{name:l,property:a}=s,[c,d,p]=a.getProperties(),u=r[l],f=py(u),h=(f==null?void 0:f.max)??i;return{[c.id]:(f==null?void 0:f.total)??o,[d.id]:(f==null?void 0:f.min)??"",[p.id]:h===i?"":h}},toStyle(r,{name:s,property:l}){const[a,c,d]=l.getProperties(),p=r[a.id],u=r[c.id],f=r[d.id]||i,h=u&&f?`minmax(${u}, ${f})`:f;return{[s]:`repeat(${p||o}, ${h})`}}}}function fy(n,e){if(!e.styleableGrid)return;const{property:t,...o}=cy(n,"display");if(!t)return;const i=t.getOption("grid"),r=o.sector;i||t.addOption({id:"grid",label:"Grid"}),r.addProperty(Ia({label:"Columns",property:"grid-template-columns"}),{}),r.addProperty(Ia({label:"Rows",property:"grid-template-rows"}),{}),r.addProperty({id:"grid-gap",requires:Xr,...dy("gap",{x:{id:"grid-row-gap",label:"Row",property:"row-gap",min:0,default:"0"},y:{id:"grid-column-gap",label:"Column",property:"column-gap",min:0,default:"0"},mergable:!0})},{}),r.addProperty({type:"composite",property:"grid-area",label:"Grid area",requiresParent:Xr,generic:!0,properties:[{label:"Row start",property:"grid-row-start",type:"integer",default:"auto"},{label:"Row end",property:"grid-row-end",type:"integer",default:"auto"},{label:"Column start",property:"grid-column-start",type:"integer",default:"auto"},{label:"Column end",property:"grid-column-end",type:"integer",default:"auto"}],fromStyle(s){const l=uy(s);return{"grid-column-start":s["grid-column-start"]||l.columnStart,"grid-column-end":s["grid-column-end"]||l.columnEnd,"grid-row-start":s["grid-row-start"]||l.rowStart,"grid-row-end":s["grid-row-end"]||l.rowEnd}},toStyle(s,{name:l}){const a=s["grid-row-start"]||"auto",c=s["grid-row-end"]||"auto",d=s["grid-column-start"]||"auto",p=s["grid-column-end"]||"auto";return{[l]:`${a} / ${d} / ${c} / ${p}`}}},{})}const hy=function(n,e={}){const t={itemResizable:!0,...e},{Canvas:o,Commands:i,Components:r}=n,{itemResizable:s}=t,l=o.events,a=i.events,c=r.events,d=`${a.runBeforeCommand}tlb-move`,p=`${a.runBeforeCommand}resize`;let u;sy(n);const f=({options:y})=>{nr(n,y.target,t)&&(n.runCommand(Zr,{...y}),y.abort=!0)},h=y=>{const{options:v}=y;nr(n,v.component,t)&&(v.options=Object.assign(v.options||{},ly(n,v)))},g=()=>{const y=o.getSpots({type:so}).pop();if(!y)return;let v=y.attributes.spotEl;v||(v=document.createElement("div"),v.className=mo,y.set({spotEl:v})),Object.entries(y.getStyle()).forEach(([k,w])=>v.style.setProperty(k,w)),u==null||u.appendChild(v)},b=({spot:y})=>{const v=y.attributes.spotEl;y.type!==so||!v||u==null||u.removeChild(v)};if(s){const y=v=>{const k=We(s)?s({component:v}):s;return typeof k=="boolean"?k:{tl:!1,tc:!1,tr:!1,cl:!1,cr:!1,bl:!1,bc:!1,br:!1,...k}};n.on(c.resizeInit,v=>{const{component:k}=v;if(nr(n,k,t)){const w=y(k);v.resizable=w}})}const x=[[d,f],[p,h],[l.spot,g],[l.spotRemove,b]];x.forEach(([y,v])=>{n.on(y,v)}),n.onReady(()=>{u=o.getSpotsEl(),Qb(),fy(n,t)});const C=()=>{delete n.Commands.commands[Zr],x.forEach(([y,v])=>{n.off(y,v)})};q({editor:n,licenseKey:t.licenseKey,plan:Zb,pluginName:di,cleanup:C})},my=W(hy,di),qp="canvasScreenshot",gy=F.startup;var Up=(n=>(n.screenshot="studioPlugin:screenshot",n))(Up||{});const by=async n=>await xu([{id:"html-to-image",src:n}]),yy=async(n,e={},t={})=>{const{cdnScript:o}=t;if(!window.htmlToImage){if(!o)return;await by(o)}return new Promise((i,r)=>{(async()=>{try{const{canvasWidth:l,canvasHeight:a,width:c,height:d,type:p,quality:u,addOptions:f}=e,h={pixelRatio:1,width:c,height:d,canvasWidth:l,canvasHeight:a},g=(f==null?void 0:f(h))||h,x=await window.htmlToImage.toCanvas(n,g);x.toBlob(C=>{C?i({file:C,canvas:x}):r(new Error("Failed to create file from canvas"))},p,u)}catch(l){r(l)}})()})},or=Up.screenshot,xy=function(n,e={}){const{Commands:t,Canvas:o,Storage:i}=n,r=i.events.afterStore,s={cdnScript:"https://cdnjs.cloudflare.com/ajax/libs/html-to-image/1.11.13/html-to-image.min.js",...e};t.add(or,async(c,d,p)=>{const{el:u,...f}=p;return await yy(u,f,s)});const l=async()=>{var d;const c=o.getBody();if(!c)return n.log("Canvas element not found");try{const p=await n.runCommand(or,{el:c,canvasWidth:400,canvasHeight:225,width:1200,height:675,type:"image/jpeg"});(d=s.screenshotOnSave)==null||d.call(s,{...p,editor:n})}catch(p){console.error("Screenshot error",p)}};s.screenshotOnSave&&n.on(r,l);const a=()=>{delete t.commands[or],n.off(r,l)};q({editor:n,licenseKey:e.licenseKey,plan:gy,pluginName:qp,cleanup:a})},vy=W(xy,qp);var He=(n=>(n.panelBlocks="panelBlocks",n.panelPagesLayers="panelPagesLayers",n.panelGlobalStyles="panelGlobalStyles",n.panelSidebarTabs="panelSidebarTabs",n.panelAssets="panelAssets",n.aiChatPanel="aiChatPanel",n.panelDataSources="panelDataSources",n))(He||{});const Kp="sidebarButtonsTarget",Po=(n,e)=>{const{id:t,icon:o,label:i,tooltip:r,className:s,skipSelfClose:l,removeLayouts:a,layoutComponent:c,layoutCommand:d}=n,{pluginOpts:p,breakpointProps:u}=e,f=t;return{id:Jp(t),type:"button",icon:o,tooltip:i||r,className:s,editorEvents:{[`${ec.layoutToggleId}${f}`]:({fromEvent:h,setState:g,editor:b})=>{g({active:h.isOpen}),setTimeout(()=>b.refresh({tools:!0}),20)}},onClick:({editor:h,state:g})=>{var k;if(g.active&&l)return;const b=(d==null?void 0:d.placer)||{type:"static",layoutId:Kp},x={...b,skipCleanup:b.type==="static"},C=a||Object.keys(He).filter(w=>w!==f);Yp(h,{removeLayouts:C,layout:{placer:x}});const y={id:f,placer:b,header:(d==null?void 0:d.header)??{label:i,close:!l},layout:c,style:{width:280,height:"100%",borderRightWidth:1,...d==null?void 0:d.style}},v=((k=p==null?void 0:p.sidebarLayoutCommand)==null?void 0:k.call(p,{...u,layoutCommand:y,sidebarButtonProps:n}))||y;h.runCommand(G.layoutToggle,{...v})}}},Jp=n=>`button__${n}`,Yp=(n,e={})=>{(e.removeLayouts||Object.keys(He)).forEach(o=>n.runCommand(G.layoutRemove,{id:o,layout:e.layout}))},Zp=n=>{const e=(n==null?void 0:n.breakpointTablet)??1024,t=(n==null?void 0:n.breakpointMobile)??768,o={},i=[{id:He.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:He.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:He.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:He.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:f,editor:h})=>{var C;const g=h.getSelected(),b={type:"image",src:f.src};let x;if(g!=null&&g.is("image"))return g.set("src",f.src);g&&h.Components.canMove(g,b)?x=g.append(b)[0]:g||(x=(C=h.getWrapper())==null?void 0:C.append(b)[0]),x&&h.select(x,{scroll:!0})}}}],r=[...i,{id:He.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"}}],s={id:Kp,type:"column",className:"gs-cmp-layout-sidebar-target",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:[]}}},c=f=>({breakpoint:f,breakpointTablet:e,breakpointMobile:t}),d=(f,h,g)=>{const b=c(h),x={pluginOpts:n,breakpointProps:b},C=f.map(v=>{const k=Po(v,x);return n!=null&&n.sidebarButton?n.sidebarButton({id:v.id,buttonIds:He,buttonProps:k,sidebarButtonProps:v,...b,createSidebarButton:w=>Po({...v,...w},x)}):k}).filter(Boolean);return(n!=null&&n.sidebarButtons?n==null?void 0:n.sidebarButtons({buttonIds:He,sidebarButtons:C,...b,createSidebarButton:v=>Po({...v,layoutCommand:{...g==null?void 0:g.layoutCommand,...v.layoutCommand}},x)}):C).filter(Boolean)},p=(f,h,g)=>{var C;const b=c(g),x={pluginOpts:n,breakpointProps:b};return((C=n==null?void 0:n.rootLayout)==null?void 0:C.call(n,{sidebarButtons:h,rootLayout:f,layoutSidebarLeft:l,layoutSidebarTarget:s,...b,createSidebarButton:y=>Po({...y},x)}))??f};if(e){const f=d(r,e);o[e]=p({type:"row",style:{height:"100%"},children:[{...l,children:f},s,a]},f,e)}if(t){const f={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},h=r.map(b=>({...b,layoutCommand:f})),g=d(h,t,{layoutCommand:f});o[t]=p({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:g}]},g,t)}const u=d(i,0);return{default:p({type:"row",style:{height:"100%"},children:[{...l,children:u},s,a,{type:"sidebarRight"}]},u,0),responsive:o}},Qr="layoutSidebarButtons",wy=F.free,Sy=function(n,e={}){const{Commands:t}=n,o=t.events,i={...e};(()=>{if(n.runCommand(G.layoutConfigGet)||i.skipLayoutConfig===!0)return;const l=Zp(i);n.runCommand(G.layoutConfigSet,{...l})})(),t.add(`${Qr}:toggleButton`,(s,l,a)=>{const c=document.getElementById(Jp(a==null?void 0:a.id));c==null||c.click()}),n.on(`${o.runCommand}core:preview`,()=>{Yp(n)}),q({editor:n,licenseKey:i.licenseKey,plan:wy,pluginName:Qr,cleanup:()=>{n.runCommand(G.layoutConfigSet)}})},Xp=W(Sy,Qr);Xp.createLayoutConfig=n=>Zp(n);const Et="page-break";var $e=(n=>(n.A5="a5",n.A5Portrait="a5-portrait",n.A4="a4",n.A3="a3",n.B5="b5",n.B4="b4",n.letter="letter",n.legal="legal",n.ledger="ledger",n))($e||{});function es(n,e){const o={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return o[e]?n*o[e]:null}const Cy=(n,e)=>{const{name:t,id:o,width:i,height:r,unit:s}=n,{fixedHeight:l}=e,a=`${i}${s}`,c=`${r}${s}`;return{id:o||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${a} x ${c})`,sizeH:r,sizeW:i,sizeUnit:s,widthMedia:"",width:a,minHeight:l?"0":`${es(r,s)}px`,height:l?c:void 0}},ts="page-breaks",No="gjs-page-breaks-spot",ir=n=>n.type===ts;function ky(n){const{Devices:e}=n,{height:t,minHeight:o}=e.getSelected().attributes,r=parseFloat(`${t&&t!=="auto"?t:o}`),s=n.getWrapper(),l=s==null?void 0:s.getEl(),a=[];if(!s||!l)return a;const c=l.getBoundingClientRect().height,p=s.findType(Et).map(f=>f.getEl()).filter(Boolean).map(f=>({top:f.offsetTop,height:f.offsetHeight}));let u=0;for(;u<c;){const f=p.find(h=>h.top>u&&h.top<u+r);f?(u=f.top+f.height,a.push(f.top)):(u+=r,u<c&&a.push(u))}return a}function Ty(n,e){const{Canvas:t}=n,o=t.events,i=n.events;let r;const s=()=>{ls(`${_o}preset-printable-spots`,`.${No} {
|
|
951
951
|
position: absolute;
|
|
952
952
|
left: 0;
|
|
953
953
|
width: 100%;
|
|
954
954
|
border-top: 1px dashed var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue));
|
|
955
955
|
color: var(--gs-theme-cl-prm-txt, var(--gjs-font-color));
|
|
956
956
|
}
|
|
957
|
-
.${
|
|
957
|
+
.${No}::after {
|
|
958
958
|
background-color: var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight));
|
|
959
959
|
content: attr(data-page-number);
|
|
960
960
|
display: block;
|
|
@@ -965,9 +965,9 @@
|
|
|
965
965
|
right: 0;
|
|
966
966
|
transform: translate(100%, -50%);
|
|
967
967
|
}
|
|
968
|
-
`,{target:window.document.head})},l=()=>{if(e.enablePageBreaksSpot===!1)return;const
|
|
969
|
-
${!!parseFloat(`${
|
|
970
|
-
[data-gjs-type="wrapper"] { min-height: ${
|
|
968
|
+
`,{target:window.document.head})},l=()=>{if(e.enablePageBreaksSpot===!1)return;const b={id:ts,type:ts,component:n.getWrapper()};return t.getSpots(b).pop()||t.addSpot(b)},a=({spot:b})=>{const{spotEl:x}=b.attributes;!ir(b)||!x||!r||r.removeChild(x)},c=({spot:b})=>{if(!ir(b)||!r)return;let{spotEl:x}=b.attributes;x||(x=document.createElement("div"),x.className=`${No}__items`,b.set({spotEl:x})),r.appendChild(x)},d=({spot:b})=>{const{spotEl:x,pageBreaks:C=[]}=b.attributes;!ir(b)||!x||!r||(Object.entries(b.getStyle()).forEach(([y,v])=>x.style.setProperty(y,v)),x.innerHTML="",C.forEach((y,v)=>{const k=document.createElement("div");k.setAttribute("data-page-number",`${v+2}`),k.className=No,k.style.top=`${y}px`,x.appendChild(k)}))},p=Jn(()=>{if(n.em.destroyed)return;const b=l();b&&b.set({pageBreaks:ky(n),up:(b.attributes.up||0)+1})},150),u=Jn(p,200),f=()=>{r=t.getSpotsEl(),l()},h=()=>{const b=l();b&&b.set({up:(b.attributes.up||0)+1})},g=[["component:input",p],["frame:scroll",h],[i.update,p],[o.spotAdd,c],[o.spotUpdate,d],[o.spotRemove,a],[o.frameLoadBody,f]];return g.forEach(([b,x])=>n.on(b,x)),n.onReady(()=>{s(),new ResizeObserver(h).observe(t.getElement().parentElement)}),()=>{g.forEach(([b,x])=>n.off(b,x)),p.clear(),u.clear()}}var ns=(n=>(n.print="presetPrintable:print",n))(ns||{});const Da=n=>new Promise(e=>{const t=document.createElement("iframe");t.style.cssText="position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;",t.srcdoc=n.content,t.onload=()=>e(t),document.body.appendChild(t)});function Ey(n,e){const{Commands:t,Pages:o}=n;return t.add(ns.print,async(i,r,s={})=>{const l={page:s.allPages?void 0:o.getSelected(),styles:"inline",optionsHtml:{exporter:null}},c=(await t.run(G.projectFiles,l)).filter(u=>u.filename.endsWith(".html")),d=c.map(u=>u.content).join('<div style="break-before: page;"></div>'),p=[];if(s.separatePrints)for(const u of c)p.push(await Da(u));else p.push(await Da({content:d,filename:"",mimeType:""}));for(const u of p){const f=u.contentWindow;f.focus(),f.print()}setTimeout(()=>p.forEach(u=>u.remove()),1e3)}),t.add("presetPrintable:exp",async i=>{await dr("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"),await dr("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");const{Devices:r,Canvas:s}=i,{sizeW:l,sizeH:a,sizeUnit:c}=r.getSelected().attributes,d=s.getFrameEl().contentDocument,p="px",u=[es(l,c),es(a,c)],f=new window.jspdf.jsPDF({unit:p,format:u}),h=d.body;f.html(h,{callback:g=>g.save()})}),()=>{delete n.Commands.commands[ns.print]}}function My(n,e){const{blockPageBreak:t={}}=e,{Components:o,Blocks:i}=n,r="Page Break",s=`${je}${Et}`;return o.addType(Et,{block:t&&{label:r,media:'<svg viewBox="0 0 24 24"><path d="M18 20H6v-2H4v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2h-2v2M14 2H6a2 2 0 0 0-2 2v8h2V4h8v4h4v4h2V8l-6-6m-3 14H8v-2h3v2m5 0h-3v-2h3v2M3 14h3v2H3v-2m18 2h-3v-2h3v2Z"/></svg>',category:"Extra",select:!0,...t},isComponent:Ue(Et),model:{defaults:{name:r,classes:s,attributes:{[De]:Et},emptyState:!0,stylable:!1,droppable:!1,draggable:ss("wrapper"),styles:`.${s} { break-before: page; }`,traits:[]}}}),()=>{o.removeType(Et),i.remove(Et)}}const Qp="presetPrintable",Ay=F.free,jy=function(n,e={}){var w;const t={selectedDevice:$e.A4,...e},{Canvas:o,Devices:i,Blocks:r}=n,s=o.events,l=n.events,a=t.selectedDevice||i.getConfig().default,c=[{id:$e.A5,name:"A5",width:148,height:210,unit:"mm"},{id:$e.A5Portrait,name:"A5 Portrait",width:210,height:148,unit:"mm"},{id:$e.A4,name:"A4",width:210,height:297,unit:"mm"},{id:$e.A3,name:"A3",width:297,height:420,unit:"mm"},{id:$e.B5,name:"B5",width:176,height:250,unit:"mm"},{id:$e.B4,name:"B4",width:250,height:353,unit:"mm"},{id:$e.letter,name:"Letter",width:8.5,height:11,unit:"in"},{id:$e.legal,name:"Legal",width:8.5,height:14,unit:"in"},{id:$e.ledger,name:"Ledger",width:11,height:17,unit:"in"}],p=(((w=t.devices)==null?void 0:w.call(t,{items:c}))||c).map(S=>Cy(S,t));i.devices.reset(p);const u=a&&i.get(a)||i.getAll().at(0);i.select(u),["map","video"].forEach(S=>r.remove(S));const h=(S={})=>{const E="page-rule",{rules:T}=n.Css,{width:A,height:$,minHeight:P}=i.getSelected().attributes,N=$&&$!=="auto"?$:P,I=T.where({id:E}).pop(),_=I||T.add({id:E,selectors:[],selectorsAdd:"@page"},{at:0});(S.fromDeviceChange||!I)&&_.addStyle({size:`${A} ${N}`,...!I&&{margin:"0"}})},g=(S,E={})=>{const T=S.document,{minHeight:A}=i.getSelected().attributes,P=`
|
|
969
|
+
${!!parseFloat(`${A}`)?`
|
|
970
|
+
[data-gjs-type="wrapper"] { min-height: ${A}; }
|
|
971
971
|
`:`
|
|
972
972
|
body {
|
|
973
973
|
overflow: hidden;
|
|
@@ -978,33 +978,921 @@
|
|
|
978
978
|
height: 100dvh;
|
|
979
979
|
}
|
|
980
980
|
`}
|
|
981
|
-
`;
|
|
982
|
-
|
|
981
|
+
`;ls(`${_o}preset-printable`,P,{doc:T,target:T.head}),h(E)};n.on(s.frameLoadBody,S=>{const E=S.window;if(g(E),t.fixedHeight){const A=S.model.getComponent().getEl();A==null||A.addEventListener("scroll",$=>{const P=$.target;P.scrollTop>0&&P.scrollTo(0,0)})}}),n.on(i.events.select,()=>{var E;const S=(E=o.getFrameEl().contentDocument)==null?void 0:E.defaultView;S&&g(S,{fromDeviceChange:!0})});const b=()=>{const E=n.Css.getRules().filter(T=>T.selectorsToString()==="body").pop();E==null||E.addStyle({"margin-top":"","margin-right":"","margin-bottom":"","margin-left":"",margin:"0"})},x=[[l.projectLoad,b]];x.forEach(([S,E])=>n.on(S,E));const C=Ty(n,t),y=Ey(n),v=My(n,t);n.onReady(()=>{n.UndoManager.clear()});const k=()=>{x.forEach(([S,E])=>n.off(S,E)),C(),y(),v()};n.on(l.destroy,k),q({editor:n,licenseKey:t.licenseKey,plan:Ay,pluginName:Qp,cleanup:k})},$y=W(jy,Qp);var eu=(n=>(n.globalStyles="globalStyles",n.globalData="globalData",n))(eu||{});const tu="presetBlockLibrary",Py=F.startup,Ny=n=>{var e;return n.is("mj-body")&&!!((e=n.parent())!=null&&e.is("mjml"))},L={header:{id:"preset-block-library-header",open:!1,label:"Header",icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21 3a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm-1 2H4v14h16zm-2 2v2H6V7z"/></svg>'},hero:{id:"preset-block-library-hero",open:!1,label:"Hero",icon:'<svg viewBox="0 0 24 24"><path d="M4 20h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2m0-9h16v7H4z"/></svg>'},content:{id:"preset-block-library-content",open:!1,label:"Content",icon:'<svg viewBox="0 0 24 24"><path d="M21 3H3c-.6 0-1 .4-1 1v6c0 .6.4 1 1 1h18c.6 0 1-.4 1-1V4c0-.6-.4-1-1-1m0 10H3c-.6 0-1 .4-1 1v6c0 .6.4 1 1 1h18c.6 0 1-.4 1-1v-6c0-.6-.4-1-1-1"/></svg>'},cta:{id:"preset-block-library-cta",open:!1,label:"Call to Action",icon:'<svg viewBox="0 0 24 24"><path d="M13 5a4 4 0 0 1 2 7.46v-1.22A3.01 3.01 0 0 0 13 6a3 3 0 0 0-2 5.24v1.22A4 4 0 0 1 13 5m7 15.5a1.55 1.55 0 0 1-1.5 1.5H13q-.59 0-1-.43l-4-4.2.74-.77a1 1 0 0 1 .76-.32h.2L12 18V9c0-.55.45-1 1-1s1 .45 1 1v4.47l1.21.13 3.94 2.19c.53.24.85.77.85 1.35zM20 2H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4v-2H4V4h16v8h-2v2h2v-.04l.04.04c1.09 0 1.96-.91 1.96-2V4a2 2 0 0 0-2-2"/></svg>'},gallery:{id:"preset-block-library-gallery",open:!1,label:"Gallery",icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4 5h7v14H4V5m9 0h7v6h-7V5m0 8h7v6h-7v-6Z"/></svg>'},people:{id:"preset-block-library-people",open:!1,label:"People",icon:'<svg viewBox="0 0 24 24"><path d="M16 17v2H2v-2s0-4 7-4 7 4 7 4m-3.5-9.5A3.5 3.5 0 1 0 9 11a3.5 3.5 0 0 0 3.5-3.5m3.44 5.5A5.3 5.3 0 0 1 18 17v2h4v-2s0-3.63-6.06-4M15 4a3.4 3.4 0 0 0-1.93.59 5 5 0 0 1 0 5.82A3.4 3.4 0 0 0 15 11a3.5 3.5 0 0 0 0-7"/></svg>'},footer:{id:"preset-block-library-footer",open:!1,label:"Footer",icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21 3a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm-1 2H4v14h16zm-2 10v2H6v-2z"/></svg>'}},nu=({editor:n,content:e},t)=>{var a;if(typeof e!="string"||!Xa(n))return;const o=n.getWrapper(),i=o==null?void 0:o.findFirstType("mj-head"),r=o==null?void 0:o.findFirstType(Ny),s=!!(t!=null&&t.withGlobalStyles),l=s?` ${((a=r==null?void 0:r.__attrToString)==null?void 0:a.call(r))||""}`:' background-color="#E7E7E7"';return{mjml:`<mjml>${s&&(i==null?void 0:i.toHTML())||""}<mj-body${l}>${e}</mj-body></mjml>`,width:700}},za={id:"preset-block-library",label:"Preset Blocks",icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z" /></svg>',preview:n=>nu(n)},Oy=n=>n.withGlobalStyles?{...za,preview:e=>nu(e,n)}:za,kt=wu({width:320,height:96,text:"Logo",bg:"e2e8f0",fg:"334155"}),Iy=({id:n,label:e,category:t,library:o})=>({id:n,label:e,category:t,library:o,select:!0,full:!0,media:t.icon}),m={spacing:{section:"10px 0px 10px 0px"},colors:{primary:"#cf549e",secondary:"#7c3aed",white:"#ffffff",text:{heading:"#0f172a",body:"#475569"},bg:{section:"#ffffff",transparent:"#00000000"}},radii:{s:"8px",m:"16px",l:"32px",card:"10px",pill:"999px"},buttons:{primary:'background-color="#cf549e" color="#ffffff"',secondary:'background-color="#7c3aed" color="#ffffff"'},attrs:{bgTransparent:'background-color="#00000000"',bgSection:'background-color="#ffffff"'}},Dy="https://images.unsplash.com/photo-1713171158509-f2a6582581a0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w3NzE5NjR8MHwxfHNlYXJjaHw0MXx8YWJzdHJhY3QlMjBwdXJwbGUlMjB3YXZlc3xlbnwwfHx8fDE3ODAxNjIzNTd8MA&ixlib=rb-4.1.0&q=80&w=1080",zy="https://images.unsplash.com/photo-1637611331620-51149c7ceb94?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w3NzE5NjR8MHwxfHNlYXJjaHw3M3x8YWJzdHJhY3QlMjBwdXJwbGV8ZW58MHx8fHwxNzgwMjk5NDUxfDA&ixlib=rb-4.1.0&q=80&w=1080",On="https://images.unsplash.com/photo-1670189577367-2c6ef31a4b8c?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w3NzE5NjR8MHwxfHNlYXJjaHwxNXx8YWJzdHJhY3QlMjBwdXJwbGV8ZW58MHx8fHwxNzgwMjk5NDMyfDA&ixlib=rb-4.1.0&q=80&w=1080",Ry="https://images.unsplash.com/photo-1607371059636-720f2c169e82?q=80&w=928&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Ra="https://images.unsplash.com/photo-1674247489394-524fef63c0ff?q=80&w=928&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",rr="https://images.unsplash.com/photo-1729119578980-91838d6014d9?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",La="https://images.unsplash.com/photo-1729119579013-decd9c61c395?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Ly="https://images.unsplash.com/photo-1729119578960-45095ebc3b8a?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",By="https://images.unsplash.com/photo-1729119578920-240c46516e91?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Ba="https://images.unsplash.com/photo-1659468525744-314c75acdd38?q=80&w=2064&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Vy="https://images.unsplash.com/photo-1739978291558-6dbdd5b9f9f8?q=80&w=2064&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Hy="https://images.unsplash.com/photo-1698429894924-ee93fc16279a?q=80&w=2200&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Fy="https://images.unsplash.com/photo-1698430484227-006b70bc83cb?q=80&w=2000&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",_y="https://images.unsplash.com/photo-1698429894931-fa699270a2fa?q=80&w=2200&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",sr="https://images.unsplash.com/photo-1638248308805-d488b66ea854?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Va="https://images.unsplash.com/photo-1706720097169-b4120bb97a30?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Ha="https://images.unsplash.com/photo-1706720093772-be76963b01a3?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",lr="https://images.unsplash.com/photo-1716032936139-33cb6cd84dc0?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",ar="https://images.unsplash.com/photo-1566319743996-123ad0f44a68?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Fa="https://images.unsplash.com/photo-1706466615511-18622e5ef756?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",_a="https://images.unsplash.com/photo-1527980965255-d3b416303d12?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Ga="https://images.unsplash.com/photo-1485893086445-ed75865251e0?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Gy="https://images.unsplash.com/photo-1586299485759-f62264d6b63f?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Wy="https://images.unsplash.com/photo-1595897950118-1037962bc920?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",qy="https://images.unsplash.com/photo-1642060603505-e716140d45d2?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",Uy=n=>{const e=t=>n.withGlobalStyles?"":` ${t}`;return{presetEmailHeaderLogo:{label:"Centered Logo",category:L.header,getContent:({getImageUrl:t})=>`<mj-section background-color="${m.colors.bg.section}" padding="${m.spacing.section}">
|
|
982
|
+
<mj-column>
|
|
983
|
+
<mj-image src="${t(kt)}" alt="Brand logo" width="160px"/>
|
|
984
|
+
</mj-column>
|
|
985
|
+
</mj-section>`},presetEmailHeaderLogoNav:{label:"Logo + Menu",category:L.header,getContent:({getImageUrl:t})=>`<mj-section background-color="${m.colors.bg.section}" padding="${m.spacing.section}">
|
|
986
|
+
<mj-column width="35%" vertical-align="middle">
|
|
987
|
+
<mj-image src="${t(kt)}" alt="Brand logo" width="107px" align="left" />
|
|
988
|
+
</mj-column>
|
|
989
|
+
<mj-column width="65%" vertical-align="middle">
|
|
990
|
+
<mj-navbar align="right" base-url="https://example.com">
|
|
991
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/shop">Shop</mj-navbar-link>
|
|
992
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/stories">Stories</mj-navbar-link>
|
|
993
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/support">Support</mj-navbar-link>
|
|
994
|
+
</mj-navbar>
|
|
995
|
+
</mj-column>
|
|
996
|
+
</mj-section>`},presetEmailHeaderLogoCta:{label:"Logo + Button",category:L.header,getContent:({getImageUrl:t})=>`<mj-section background-color="${m.colors.bg.section}" padding="${m.spacing.section}">
|
|
997
|
+
<mj-column vertical-align="middle">
|
|
998
|
+
<mj-image src="${t(kt)}" alt="Brand logo" width="120px" align="left" />
|
|
999
|
+
</mj-column>
|
|
1000
|
+
<mj-column vertical-align="middle">
|
|
1001
|
+
<mj-button align="right" ${m.buttons.secondary}>
|
|
1002
|
+
Get started
|
|
1003
|
+
</mj-button>
|
|
1004
|
+
</mj-column>
|
|
1005
|
+
</mj-section>`},presetEmailHeaderSocialLogo:{label:"Logo + Socials",category:L.header,getContent:({getImageUrl:t})=>`<mj-section background-color="${m.colors.bg.section}" padding="${m.spacing.section}">
|
|
1006
|
+
<mj-column vertical-align="middle">
|
|
1007
|
+
<mj-social align="left" mode="horizontal">
|
|
1008
|
+
<mj-social-element name="facebook" background-color="${m.colors.secondary}"></mj-social-element>
|
|
1009
|
+
<mj-social-element name="linkedin" background-color="${m.colors.secondary}"></mj-social-element>
|
|
1010
|
+
<mj-social-element name="youtube" background-color="${m.colors.secondary}"></mj-social-element>
|
|
1011
|
+
</mj-social>
|
|
1012
|
+
</mj-column>
|
|
1013
|
+
<mj-column vertical-align="middle">
|
|
1014
|
+
<mj-image src="${t(kt)}" alt="Brand logo" width="95px" align="right"/>
|
|
1015
|
+
</mj-column>
|
|
1016
|
+
</mj-section>`},presetEmailHeaderStackedMenu:{label:"Stacked Logo + Menu",category:L.header,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1017
|
+
<mj-section background-color="#ffffff" padding="0px">
|
|
1018
|
+
<mj-column>
|
|
1019
|
+
<mj-image src="${t(kt)}" alt="Brand logo" width="160px" align="center" />
|
|
1020
|
+
<mj-divider border-width="1px" border-color="#e7e7e7"></mj-divider>
|
|
1021
|
+
</mj-column>
|
|
1022
|
+
</mj-section>
|
|
1023
|
+
<mj-section background-color="#ffffff" padding="0px">
|
|
1024
|
+
<mj-column>
|
|
1025
|
+
<mj-navbar align="center" base-url="https://example.com">
|
|
1026
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/shop">Shop</mj-navbar-link>
|
|
1027
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/stories">Stories</mj-navbar-link>
|
|
1028
|
+
<mj-navbar-link color="#475569" font-size="13px" href="/support">Support</mj-navbar-link>
|
|
1029
|
+
</mj-navbar>
|
|
1030
|
+
</mj-column>
|
|
1031
|
+
</mj-section>
|
|
1032
|
+
</mj-wrapper>`},presetEmailHeroCenteredCta:{label:"Centered Hero + CTA",category:L.hero,getContent:()=>`<mj-section padding="${m.spacing.section}">
|
|
1033
|
+
<mj-column padding="40px 20px" border-radius="20px"${e('background-color="#ffffff"')}>
|
|
1034
|
+
<mj-text padding="5px 0" align="center" font-size="12px" font-weight="700" text-transform="uppercase" letter-spacing="1px"${e('color="#1e293b"')}>
|
|
1035
|
+
Fresh release
|
|
1036
|
+
</mj-text>
|
|
1037
|
+
<mj-text align="center" font-size="32px" font-weight="700" line-height="40px"${e('color="#0f172a"')}>
|
|
1038
|
+
Launch polished campaigns
|
|
1039
|
+
</mj-text>
|
|
1040
|
+
<mj-text align="center" font-size="16px" line-height="24px"${e('color="#334155"')}>
|
|
1041
|
+
Start with ready-made sections, swap in your content, and ship a clean newsletter without building every block from scratch.
|
|
1042
|
+
</mj-text>
|
|
1043
|
+
<mj-spacer height="30px"></mj-spacer>
|
|
1044
|
+
<mj-button align="center" font-weight="700" padding="0" inner-padding="14px 28px" ${e('background-color="#8b5cf6" color="#ffffff" border-radius="999px"')}>
|
|
1045
|
+
Explore the collection
|
|
1046
|
+
</mj-button>
|
|
1047
|
+
</mj-column>
|
|
1048
|
+
</mj-section>`},presetEmailHeroBackground:{label:"Background Hero",category:L.hero,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1049
|
+
<mj-section
|
|
1050
|
+
background-url="${t(Dy)}"
|
|
1051
|
+
background-size="cover"
|
|
1052
|
+
background-repeat="no-repeat"
|
|
1053
|
+
background-color="#c7a5c9"
|
|
1054
|
+
padding="110px 24px 96px 24px"
|
|
1055
|
+
border-radius="${m.radii.card}"
|
|
1056
|
+
>
|
|
1057
|
+
<mj-column background-color="#00000000">
|
|
1058
|
+
<mj-text color="#ffffff" align="center" font-weight="700" font-size="12px" line-height="30px" letter-spacing="2px" padding="0">
|
|
1059
|
+
SEASONAL LAUNCH
|
|
1060
|
+
</mj-text>
|
|
1061
|
+
<mj-text align="center" color="#9767c4" font-size="50px" font-weight="700" line-height="52px" letter-spacing="1px" padding="10px 0">
|
|
1062
|
+
UP TO 70% OFF
|
|
1063
|
+
</mj-text>
|
|
1064
|
+
<mj-text color="#ffffff" align="center" font-size="24px" line-height="32px" padding="0">
|
|
1065
|
+
Limited-time collection
|
|
1066
|
+
</mj-text>
|
|
1067
|
+
<mj-button font-size="16px" border-radius="999px" padding="30px 0 0 0" inner-padding="20px 40px" font-weight="700" letter-spacing="1px" background-color="#9767c4" color="#ffffff">
|
|
1068
|
+
SHOP NOW
|
|
1069
|
+
</mj-button>
|
|
1070
|
+
</mj-column>
|
|
1071
|
+
</mj-section>
|
|
1072
|
+
</mj-wrapper>`},presetEmailHeroSplitBackground:{label:"Split Background Hero",category:L.hero,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1073
|
+
<mj-section
|
|
1074
|
+
padding="48px 24px"
|
|
1075
|
+
background-url="${t(zy)}"
|
|
1076
|
+
background-color="#c7a5c9"
|
|
1077
|
+
background-size="cover"
|
|
1078
|
+
background-repeat="no-repeat"
|
|
1079
|
+
background-color="#1e293b"
|
|
1080
|
+
border-radius="${m.radii.card}"
|
|
1081
|
+
>
|
|
1082
|
+
<mj-column ${m.attrs.bgTransparent}></mj-column>
|
|
1083
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1084
|
+
<mj-text font-size="40px" line-height="48px" color="#ffffff" font-weight="700" padding="0">
|
|
1085
|
+
Spend & Save
|
|
1086
|
+
</mj-text>
|
|
1087
|
+
<mj-text padding="20px 0" color="#ffffff" line-height="24px">
|
|
1088
|
+
Spotlight a campaign with image-led energy while keeping the key message and CTA anchored in a readable column.
|
|
1089
|
+
</mj-text>
|
|
1090
|
+
<mj-button background-color="#ffffff" color="#cf549e" width="100%" border-radius="999px" padding="30px 0 0 0" font-weight="700" letter-spacing="1px">
|
|
1091
|
+
SHOP NOW
|
|
1092
|
+
</mj-button>
|
|
1093
|
+
</mj-column>
|
|
1094
|
+
</mj-section>
|
|
1095
|
+
</mj-wrapper>`},presetEmailHeroImageCopy:{label:"Image + Copy Hero",category:L.hero,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1096
|
+
<mj-section background-color="#ffffff" padding="5px" border-radius="20px">
|
|
1097
|
+
<mj-column vertical-align="middle">
|
|
1098
|
+
<mj-image src="${t(On)}" alt="Campaign preview" padding="0" border-radius="18px" />
|
|
1099
|
+
</mj-column>
|
|
1100
|
+
<mj-column vertical-align="middle" padding="0 20px">
|
|
1101
|
+
<mj-text color="#0f172a" font-size="28px" font-weight="700" line-height="36px" padding="12px 0">
|
|
1102
|
+
Put your next story front
|
|
1103
|
+
</mj-text>
|
|
1104
|
+
<mj-text color="#475569" line-height="23px" padding="10px 0 20px 0">
|
|
1105
|
+
Combine imagery, concise copy, and a single call to action to guide subscribers toward your most important announcement.
|
|
1106
|
+
</mj-text>
|
|
1107
|
+
<mj-button align="left" background-color="#0f172a" color="#ffffff" border-radius="999px" inner-padding="14px 26px" padding="20px 0 0 0">
|
|
1108
|
+
Read the update
|
|
1109
|
+
</mj-button>
|
|
1110
|
+
</mj-column>
|
|
1111
|
+
</mj-section>
|
|
1112
|
+
</mj-wrapper>`},presetEmailHeroMenuBottom:{label:"Hero + Menu Bottom",category:L.hero,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1113
|
+
<mj-section padding="0" background-color="#8b5cf6" border-radius="10px 10px 0px 0px">
|
|
1114
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="middle" padding="40px 30px">
|
|
1115
|
+
<mj-image align="left" src="${t(kt)}" alt="Brand logo" width="100px" padding="0"></mj-image>
|
|
1116
|
+
<mj-text padding="25px 0 0 0" align="left" font-size="52px" font-weight="700" line-height="60px" color="#ffffff">
|
|
1117
|
+
50% OFF
|
|
1118
|
+
</mj-text>
|
|
1119
|
+
<mj-text padding="0" align="left" font-size="32px" line-height="42px" font-weight="700" color="#ffffff">
|
|
1120
|
+
selected products this week
|
|
1121
|
+
</mj-text>
|
|
1122
|
+
</mj-column>
|
|
1123
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1124
|
+
<mj-image src="${t(Ry)}" alt="Promotional image" padding="0"></mj-image>
|
|
1125
|
+
</mj-column>
|
|
1126
|
+
</mj-section>
|
|
1127
|
+
<mj-section padding="0">
|
|
1128
|
+
<mj-column border-radius="0px 0px 10px 10px" background-color="#7c3aed">
|
|
1129
|
+
<mj-navbar base-url="https://example.com" align="center">
|
|
1130
|
+
<mj-navbar-link font-weight="700" text-transform="uppercase" padding="20px 15px" color="#ffffff" href="/home">Home</mj-navbar-link>
|
|
1131
|
+
<mj-navbar-link font-weight="700" text-transform="uppercase" padding="20px 15px" color="#ffffff" href="/blog">Blog</mj-navbar-link>
|
|
1132
|
+
<mj-navbar-link font-weight="700" text-transform="uppercase" padding="20px 15px" color="#ffffff" href="/contact">Contact</mj-navbar-link>
|
|
1133
|
+
</mj-navbar>
|
|
1134
|
+
</mj-column>
|
|
1135
|
+
</mj-section>
|
|
1136
|
+
</mj-wrapper>`},presetEmailHeroMenuTop:{label:"Hero + Menu Top",category:L.hero,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1137
|
+
<mj-section padding="20px 24px" background-color="#ffffff" border-radius="10px 10px 0px 0px">
|
|
1138
|
+
<mj-column vertical-align="middle" width="22%">
|
|
1139
|
+
<mj-image src="${t(kt)}" alt="Brand logo" padding="0"></mj-image>
|
|
1140
|
+
</mj-column>
|
|
1141
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="middle" width="50%">
|
|
1142
|
+
<mj-navbar align="center">
|
|
1143
|
+
<mj-navbar-link color="#101828" font-size="14px" font-weight="700" href="/home">Home</mj-navbar-link>
|
|
1144
|
+
<mj-navbar-link color="#101828" font-size="14px" font-weight="700" href="/about">About</mj-navbar-link>
|
|
1145
|
+
<mj-navbar-link color="#101828" font-size="14px" font-weight="700" href="/services">Services</mj-navbar-link>
|
|
1146
|
+
</mj-navbar>
|
|
1147
|
+
</mj-column>
|
|
1148
|
+
<mj-column vertical-align="middle" width="28%">
|
|
1149
|
+
<mj-text padding="10px 15px" align="center" font-size="14px" font-weight="700" color="#ffffff" container-background-color="#414141">
|
|
1150
|
+
UPDATES
|
|
1151
|
+
</mj-text>
|
|
1152
|
+
</mj-column>
|
|
1153
|
+
</mj-section>
|
|
1154
|
+
<mj-section padding="0" background-color="#f4f2f8" border-radius="0px 0px 10px 10px">
|
|
1155
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1156
|
+
<mj-image src="${t(On)}" alt="Campaign image" padding="0"></mj-image>
|
|
1157
|
+
</mj-column>
|
|
1158
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="middle" padding="40px 30px">
|
|
1159
|
+
<mj-text padding="0" align="left" font-size="44px" line-height="48px" color="#d0549e" font-weight="700">
|
|
1160
|
+
Digital
|
|
1161
|
+
</mj-text>
|
|
1162
|
+
<mj-text padding="0" align="left" font-size="38px" line-height="42px" font-weight="700">
|
|
1163
|
+
Marketing
|
|
1164
|
+
</mj-text>
|
|
1165
|
+
<mj-text padding="20px 0" align="left" font-size="14px" line-height="24px">
|
|
1166
|
+
Pair a navigational masthead with a crisp two-column hero for agency intros, event emails, or editorial launches.
|
|
1167
|
+
</mj-text>
|
|
1168
|
+
<mj-button font-size="16px" font-weight="700" padding="10px 0" align="left" inner-padding="15px 30px" background-color="#d0549e" color="#ffffff">
|
|
1169
|
+
Get started
|
|
1170
|
+
</mj-button>
|
|
1171
|
+
</mj-column>
|
|
1172
|
+
</mj-section>
|
|
1173
|
+
</mj-wrapper>`},presetEmailHeroFullWidthBg:{label:"Full Width Background Hero",category:L.hero,getContent:({getImageUrl:t})=>`<mj-section
|
|
1174
|
+
padding="48px 12px"
|
|
1175
|
+
background-url="${t(On)}"
|
|
1176
|
+
background-size="cover"
|
|
1177
|
+
background-repeat="no-repeat"
|
|
1178
|
+
background-color="#cfaac4"
|
|
1179
|
+
full-width="full-width"
|
|
1180
|
+
>
|
|
1181
|
+
<mj-column background-color="#ffffffab" padding="40px 30px" border-radius="10px" border="2px solid #f4d9eb" width="90%">
|
|
1182
|
+
<mj-text padding="0px 0px 20px 0px" align="left" font-size="38px" line-height="50px" font-weight="700">
|
|
1183
|
+
Your <span style="color: #d0549e;">Conference</span>
|
|
1184
|
+
</mj-text>
|
|
1185
|
+
<mj-text padding="10px 0" align="left" font-size="30px" line-height="36px" font-weight="700">
|
|
1186
|
+
22-23 September
|
|
1187
|
+
</mj-text>
|
|
1188
|
+
<mj-text padding="0 0 20px 0" align="left" font-size="16px" line-height="24px">
|
|
1189
|
+
Don't miss out on these limited-time events happening across the city!<br/>
|
|
1190
|
+
Grand Horizon Hotel, 123 Innovation Boulevard, Tech City.
|
|
1191
|
+
</mj-text>
|
|
1192
|
+
<mj-button ${m.buttons.primary} align="left" font-size="16px" padding="10px 0" border-radius="999px" inner-padding="15px 30px">
|
|
1193
|
+
Purchase ticket
|
|
1194
|
+
</mj-button>
|
|
1195
|
+
</mj-column>
|
|
1196
|
+
</mj-section>`},presetEmailContentIntro:{label:"Content Intro",category:L.content,getContent:()=>`<mj-section background-color="#ffffff" padding="24px">
|
|
1197
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1198
|
+
<mj-text color="${m.colors.primary}" font-size="26px" font-weight="700" line-height="32px" padding="0">
|
|
1199
|
+
A simple intro section
|
|
1200
|
+
</mj-text>
|
|
1201
|
+
<mj-text color="${m.colors.text.body}" line-height="30px" padding="0 0 12px 0">
|
|
1202
|
+
Use this section to set the tone, explain what changed, or frame the key message before readers move into product details and supporting content.
|
|
1203
|
+
</mj-text>
|
|
1204
|
+
<mj-divider border-color="#dbe4f0" border-width="1px" padding="12px 0 0 0" />
|
|
1205
|
+
</mj-column>
|
|
1206
|
+
</mj-section>`},presetEmailContentTwoColumn:{label:"Content Two Column",category:L.content,getContent:()=>`<mj-section background-color="#ffffff" padding="24px">
|
|
1207
|
+
<mj-column ${m.attrs.bgTransparent} padding="0 12px 12px 0">
|
|
1208
|
+
<mj-text color="${m.colors.primary}" font-size="14px" font-weight="700" line-height="28px" padding="0">Label 1</mj-text>
|
|
1209
|
+
<mj-text color="${m.colors.text.heading}" font-size="20px" font-weight="700" line-height="28px" padding="0 0 10px 0">
|
|
1210
|
+
Editorial note
|
|
1211
|
+
</mj-text>
|
|
1212
|
+
<mj-text color="${m.colors.text.body}" font-size="15px" line-height="24px" padding="0">
|
|
1213
|
+
Share context, a product update, or a short story that helps readers understand why this message matters right now.
|
|
1214
|
+
</mj-text>
|
|
1215
|
+
</mj-column>
|
|
1216
|
+
<mj-column ${m.attrs.bgTransparent} padding="0">
|
|
1217
|
+
<mj-text color="${m.colors.primary}" font-size="14px" font-weight="700" line-height="28px" padding="0">Label 2</mj-text>
|
|
1218
|
+
<mj-text color="${m.colors.text.heading}" font-size="20px" font-weight="700" line-height="28px" padding="0 0 10px 0">
|
|
1219
|
+
Key takeaway
|
|
1220
|
+
</mj-text>
|
|
1221
|
+
<mj-text color="${m.colors.text.body}" font-size="15px" line-height="24px" padding="0">
|
|
1222
|
+
Pair it with supporting details, release notes, customer-facing benefits, or a concise summary that encourages the next click.
|
|
1223
|
+
</mj-text>
|
|
1224
|
+
</mj-column>
|
|
1225
|
+
</mj-section>`},presetEmailContentCenterImageColumns:{label:"Center Image Columns",category:L.content,getContent:({getImageUrl:t})=>`<mj-section padding="50px 24px 24px" background-color="#ffffff">
|
|
1226
|
+
<mj-column width="33%">
|
|
1227
|
+
<mj-text color="${m.colors.text.heading}" padding="0 15px 5px" align="right" font-size="16px" font-weight="600">
|
|
1228
|
+
24/7 support
|
|
1229
|
+
</mj-text>
|
|
1230
|
+
<mj-text color="${m.colors.text.body}" padding="0 15px 30px" align="right" font-size="13px" line-height="22px">
|
|
1231
|
+
Explain one service or capability on the left to frame the main visual.
|
|
1232
|
+
</mj-text>
|
|
1233
|
+
<mj-text color="${m.colors.text.heading}" padding="0 15px 5px" align="right" font-size="16px" font-weight="600">
|
|
1234
|
+
Cloud sync
|
|
1235
|
+
</mj-text>
|
|
1236
|
+
<mj-text color="${m.colors.text.body}" padding="0 15px 30px" align="right" font-size="13px" line-height="22px">
|
|
1237
|
+
A second supporting point balances the composition.
|
|
1238
|
+
</mj-text>
|
|
1239
|
+
</mj-column>
|
|
1240
|
+
<mj-column width="34%">
|
|
1241
|
+
<mj-image src="${t(On)}" alt="Feature" padding="0 0 30px" border-radius="${m.radii.s}"></mj-image>
|
|
1242
|
+
</mj-column>
|
|
1243
|
+
<mj-column width="33%">
|
|
1244
|
+
<mj-text color="${m.colors.text.heading}" padding="0 15px 5px" align="left" font-size="16px" font-weight="600">
|
|
1245
|
+
Free updates
|
|
1246
|
+
</mj-text>
|
|
1247
|
+
<mj-text color="${m.colors.text.body}" padding="0 15px 30px" align="left" font-size="13px" line-height="22px">
|
|
1248
|
+
The right column works well for platform highlights and benefits.
|
|
1249
|
+
</mj-text>
|
|
1250
|
+
<mj-text color="${m.colors.text.heading}" padding="0 15px 5px" align="left" font-size="16px" font-weight="600">
|
|
1251
|
+
Multi-platform
|
|
1252
|
+
</mj-text>
|
|
1253
|
+
<mj-text color="${m.colors.text.body}" padding="0 15px" align="left" font-size="13px" line-height="22px">
|
|
1254
|
+
Keep each paragraph short so the layout stays clean and easy to scan.
|
|
1255
|
+
</mj-text>
|
|
1256
|
+
</mj-column>
|
|
1257
|
+
</mj-section>`},presetEmailContentRowImageArticle:{label:"Row Image Article",category:L.content,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1258
|
+
<mj-section ${m.attrs.bgSection} padding="0" border-radius="${m.radii.m}">
|
|
1259
|
+
<mj-column ${m.attrs.bgTransparent} width="40%">
|
|
1260
|
+
<mj-image src="${t(rr)}" alt="Article" padding="0"></mj-image>
|
|
1261
|
+
</mj-column>
|
|
1262
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="top" width="60%" padding="20px">
|
|
1263
|
+
<mj-text color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" padding="0">
|
|
1264
|
+
LABEL
|
|
1265
|
+
</mj-text>
|
|
1266
|
+
<mj-text color="${m.colors.text.heading}" padding="10px 0" align="left" font-size="24px" line-height="34px" font-weight="600">
|
|
1267
|
+
Article heading
|
|
1268
|
+
</mj-text>
|
|
1269
|
+
<mj-text color="${m.colors.text.body}" align="left" font-size="14px" line-height="26px" padding="0">
|
|
1270
|
+
Use the article row for updates, editorial roundups, or product explainers.
|
|
1271
|
+
</mj-text>
|
|
1272
|
+
<mj-button ${m.attrs.bgTransparent} color="${m.colors.text.heading}" font-weight="700" font-size="12px" align="left"
|
|
1273
|
+
border="2px solid ${m.colors.text.heading}" padding="40px 0px 0px 0px">VIEW DETAILS →</mj-button>
|
|
1274
|
+
</mj-column>
|
|
1275
|
+
</mj-section>
|
|
1276
|
+
</mj-wrapper>`},presetEmailContentAlternatingRowImageArticles:{label:"Alternating Row Image Articles",category:L.content,getContent:({getImageUrl:t})=>`<mj-wrapper gap="12px">
|
|
1277
|
+
<mj-section padding="16px 0" border-radius="${m.radii.m}" ${m.attrs.bgSection}>
|
|
1278
|
+
<mj-column ${m.attrs.bgTransparent} width="40%" vertical-align="top" padding="10px 20px">
|
|
1279
|
+
<mj-image src="${t(La)}" border-radius="${m.radii.m}" padding="0" alt="Article visual"></mj-image>
|
|
1280
|
+
</mj-column>
|
|
1281
|
+
<mj-column ${m.attrs.bgTransparent} width="60%" vertical-align="top" padding="10px 20px">
|
|
1282
|
+
<mj-text color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" padding="0">
|
|
1283
|
+
FEATURE STORY
|
|
1284
|
+
</mj-text>
|
|
1285
|
+
<mj-text color="${m.colors.text.heading}" padding="10px 0" align="left" font-size="24px" line-height="34px" font-weight="600">
|
|
1286
|
+
First Article
|
|
1287
|
+
</mj-text>
|
|
1288
|
+
<mj-text color="${m.colors.text.body}" align="left" font-size="14px" line-height="26px" padding="0">
|
|
1289
|
+
Use alternating article rows for updates, editorial roundups, or product explainers that need more room than a standard card.
|
|
1290
|
+
</mj-text>
|
|
1291
|
+
<mj-button ${m.attrs.bgTransparent} color="${m.colors.text.heading}" font-weight="700" font-size="12px" align="left" padding="40px 0px 0px 0px" inner-padding="0">
|
|
1292
|
+
READ MORE →
|
|
1293
|
+
</mj-button>
|
|
1294
|
+
</mj-column>
|
|
1295
|
+
</mj-section>
|
|
1296
|
+
<mj-section padding="16px 0" border-radius="${m.radii.m}" ${m.attrs.bgSection}>
|
|
1297
|
+
<mj-column ${m.attrs.bgTransparent} width="60%" vertical-align="top" padding="10px 20px">
|
|
1298
|
+
<mj-text color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" padding="0">
|
|
1299
|
+
UPDATE
|
|
1300
|
+
</mj-text>
|
|
1301
|
+
<mj-text color="${m.colors.text.heading}" padding="10px 0" align="left" font-size="24px" line-height="34px" font-weight="600">
|
|
1302
|
+
Second Article
|
|
1303
|
+
</mj-text>
|
|
1304
|
+
<mj-text color="${m.colors.text.body}" align="left" font-size="14px" line-height="26px" padding="0">
|
|
1305
|
+
The mirrored second row keeps longer campaign emails from feeling repetitive while preserving a consistent structure.
|
|
1306
|
+
</mj-text>
|
|
1307
|
+
<mj-button ${m.attrs.bgTransparent} color="${m.colors.text.heading}" font-weight="700" font-size="12px" align="left" padding="40px 0px 0px 0px" inner-padding="0">
|
|
1308
|
+
READ MORE →
|
|
1309
|
+
</mj-button>
|
|
1310
|
+
</mj-column>
|
|
1311
|
+
<mj-column ${m.attrs.bgTransparent} width="40%" vertical-align="top" padding="10px 20px">
|
|
1312
|
+
<mj-image src="${t(rr)}" border-radius="${m.radii.m}" padding="0" alt="Article visual"></mj-image>
|
|
1313
|
+
</mj-column>
|
|
1314
|
+
</mj-section>
|
|
1315
|
+
</mj-wrapper>`},presetEmailContentGridArticles:{label:"Grid Articles",category:L.content,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1316
|
+
<mj-section padding="0" border-radius="${m.radii.m} ${m.radii.m} 0 0" ${m.attrs.bgSection}>
|
|
1317
|
+
<mj-column vertical-align="middle">
|
|
1318
|
+
<mj-image src="${t(Ly)}" alt="Destination one" padding="0"></mj-image>
|
|
1319
|
+
</mj-column>
|
|
1320
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="middle" padding="34px 24px">
|
|
1321
|
+
<mj-text color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" padding="0 0 10px">
|
|
1322
|
+
LABEL ONE
|
|
1323
|
+
</mj-text>
|
|
1324
|
+
<mj-text align="left" font-size="22px" line-height="28px" letter-spacing="1px" padding="0">
|
|
1325
|
+
First Article
|
|
1326
|
+
</mj-text>
|
|
1327
|
+
<mj-text padding="8px 0 10px" align="left" font-size="14px" line-height="24px">
|
|
1328
|
+
Pair each image with a short destination, story, or offer summary inside a balanced half-and-half layout.
|
|
1329
|
+
</mj-text>
|
|
1330
|
+
<mj-button border-radius="${m.radii.m}" background-color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" align="left" padding="30px 0 0 0" width="100%">
|
|
1331
|
+
Book now
|
|
1332
|
+
</mj-button>
|
|
1333
|
+
</mj-column>
|
|
1334
|
+
</mj-section>
|
|
1335
|
+
<mj-section padding="0" border-radius="0 0 ${m.radii.m} ${m.radii.m}" ${m.attrs.bgSection}>
|
|
1336
|
+
<mj-column ${m.attrs.bgTransparent} vertical-align="middle" padding="34px 24px">
|
|
1337
|
+
<mj-text color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" padding="0 0 10px">
|
|
1338
|
+
LABEL TWO
|
|
1339
|
+
</mj-text>
|
|
1340
|
+
<mj-text align="left" font-size="22px" line-height="28px" letter-spacing="1px" padding="0">
|
|
1341
|
+
Second Article
|
|
1342
|
+
</mj-text>
|
|
1343
|
+
<mj-text padding="8px 0 10px" align="left" font-size="14px" line-height="24px">
|
|
1344
|
+
The second row can invert the order to create a tidy editorial grid without needing a dedicated card component.
|
|
1345
|
+
</mj-text>
|
|
1346
|
+
<mj-button border-radius="${m.radii.m}" background-color="${m.colors.secondary}" font-size="12px" font-weight="700" letter-spacing="1px" align="left" padding="30px 0 0 0" width="100%">
|
|
1347
|
+
Explore the offer
|
|
1348
|
+
</mj-button>
|
|
1349
|
+
</mj-column>
|
|
1350
|
+
<mj-column vertical-align="middle">
|
|
1351
|
+
<mj-image src="${t(By)}" alt="Destination two" padding="0"></mj-image>
|
|
1352
|
+
</mj-column>
|
|
1353
|
+
</mj-section>
|
|
1354
|
+
</mj-wrapper>`},presetEmailContentSplitArticles:{label:"Split Articles",category:L.content,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1355
|
+
<mj-section padding="0" ${m.attrs.bgSection}>
|
|
1356
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1357
|
+
<mj-image src="${t(On)}" alt="Feature image" padding="0 0 30px"></mj-image>
|
|
1358
|
+
<mj-text padding="0px 10px 10px 10px" color="${m.colors.primary}" font-size="12px" font-weight="700" letter-spacing="1px">
|
|
1359
|
+
LABEL TWO
|
|
1360
|
+
</mj-text>
|
|
1361
|
+
<mj-text padding="0 10px" align="left" font-size="30px" line-height="36px" font-weight="700">
|
|
1362
|
+
Your studio
|
|
1363
|
+
</mj-text>
|
|
1364
|
+
<mj-text padding="15px 10px" align="left" font-size="14px" line-height="24px">
|
|
1365
|
+
Combine image-led storytelling and a short CTA inside a split layout that still feels more editorial than a standard promo row.
|
|
1366
|
+
</mj-text>
|
|
1367
|
+
<mj-button border-radius="${m.radii.m}" background-color="${m.colors.primary}" font-size="14px" font-weight="700" align="left" padding="10px">
|
|
1368
|
+
Read more
|
|
1369
|
+
</mj-button>
|
|
1370
|
+
</mj-column>
|
|
1371
|
+
<mj-column ${m.attrs.bgTransparent} padding="30px 0 0">
|
|
1372
|
+
<mj-text padding="0px 10px 10px 10px" color="${m.colors.primary}" font-size="12px" font-weight="700" letter-spacing="1px">
|
|
1373
|
+
LABEL ONE
|
|
1374
|
+
</mj-text>
|
|
1375
|
+
<mj-text padding="0 10px" align="left" font-size="30px" line-height="36px" font-weight="700">
|
|
1376
|
+
Creative team
|
|
1377
|
+
</mj-text>
|
|
1378
|
+
<mj-text padding="15px 10px" align="left" font-size="14px" line-height="24px">
|
|
1379
|
+
The mirrored second half lets you highlight another department, service, or offer while keeping the section cohesive.
|
|
1380
|
+
</mj-text>
|
|
1381
|
+
<mj-button border-radius="${m.radii.m}" background-color="${m.colors.primary}" font-size="14px" font-weight="700" align="left" padding="10px">
|
|
1382
|
+
Explore more
|
|
1383
|
+
</mj-button>
|
|
1384
|
+
<mj-image src="${t(Ra)}" alt="Image" padding="30px 0 0"></mj-image>
|
|
1385
|
+
</mj-column>
|
|
1386
|
+
</mj-section>
|
|
1387
|
+
</mj-wrapper>`},presetEmailContentColumnImageArticle:{label:"Column Image Article",category:L.content,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1388
|
+
<mj-section padding="5px" border-radius="${m.radii.m}" ${m.attrs.bgSection}>
|
|
1389
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1390
|
+
<mj-image src="${t(Ba)}" border-radius="${m.radii.m}" padding="0" alt="Article"/>
|
|
1391
|
+
<mj-text padding="24px 12px 12px" font-size="12px" font-weight="700" letter-spacing="1px" color="${m.colors.primary}">
|
|
1392
|
+
LABEL ONE
|
|
1393
|
+
</mj-text>
|
|
1394
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="28px" font-weight="700" line-height="36px">
|
|
1395
|
+
Put your next story front
|
|
1396
|
+
</mj-text>
|
|
1397
|
+
<mj-text padding="12px 12px 24px" color="${m.colors.text.body}" line-height="26px">
|
|
1398
|
+
Combine imagery, concise copy, and a single call to action to guide subscribers toward your most important announcement.
|
|
1399
|
+
</mj-text>
|
|
1400
|
+
<mj-button align="left" border-radius="999px" padding="12px 12px 24px" inner-padding="12px 32px" ${m.buttons.primary}>
|
|
1401
|
+
READ THE UPDATE
|
|
1402
|
+
</mj-button>
|
|
1403
|
+
</mj-column>
|
|
1404
|
+
</mj-section>
|
|
1405
|
+
</mj-wrapper>`},presetEmailContentTwoColumnImageArticles:{label:"Two Column Image Articles",category:L.content,getContent:({getImageUrl:t})=>`<mj-section padding="16px 0">
|
|
1406
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="49%" ${m.attrs.bgSection}>
|
|
1407
|
+
<mj-image src="${t(Ba)}" border-radius="${m.radii.s}" padding="0" alt="Article"/>
|
|
1408
|
+
<mj-text color="${m.colors.primary}" padding="24px 12px 12px" font-size="12px" font-weight="700" letter-spacing="1px">
|
|
1409
|
+
LABEL ONE
|
|
1410
|
+
</mj-text>
|
|
1411
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="18px" font-weight="700" line-height="36px">
|
|
1412
|
+
First Article
|
|
1413
|
+
</mj-text>
|
|
1414
|
+
<mj-text color="${m.colors.text.body}" padding="12px 12px 24px 12px" line-height="26px">
|
|
1415
|
+
Combine imagery, concise copy, and a single call to action to guide subscribers.
|
|
1416
|
+
</mj-text>
|
|
1417
|
+
<mj-button border-radius="${m.radii.s}" align="center" inner-padding="12px 32px" padding="12px" ${m.buttons.primary}>
|
|
1418
|
+
Read the update
|
|
1419
|
+
</mj-button>
|
|
1420
|
+
</mj-column>
|
|
1421
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="2%" ${m.attrs.bgTransparent}></mj-column>
|
|
1422
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="49%" ${m.attrs.bgSection}>
|
|
1423
|
+
<mj-image src="${t(Vy)}" border-radius="${m.radii.s}" padding="0" alt="Article"/>
|
|
1424
|
+
<mj-text color="${m.colors.primary}" padding="24px 12px 12px" font-size="12px" font-weight="700" letter-spacing="1px">
|
|
1425
|
+
LABEL TWO
|
|
1426
|
+
</mj-text>
|
|
1427
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="18px" font-weight="700" line-height="36px">
|
|
1428
|
+
Second Article
|
|
1429
|
+
</mj-text>
|
|
1430
|
+
<mj-text color="${m.colors.text.body}" padding="12px 12px 24px 12px" line-height="26px">
|
|
1431
|
+
Product update, or a short story that helps readers understand why this message.
|
|
1432
|
+
</mj-text>
|
|
1433
|
+
<mj-button border-radius="${m.radii.s}" align="center" inner-padding="12px 32px" padding="12px" ${m.buttons.primary}>
|
|
1434
|
+
Read the update
|
|
1435
|
+
</mj-button>
|
|
1436
|
+
</mj-column>
|
|
1437
|
+
</mj-section>`},presetEmailContentThreeColumnImageArticles:{label:"Three Column Image Articles",category:L.content,getContent:({getImageUrl:t})=>`<mj-section padding="16px 0">
|
|
1438
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="32%" ${m.attrs.bgSection}>
|
|
1439
|
+
<mj-image src="${t(Hy)}" border-radius="${m.radii.s}" padding="0" alt="Article"/>
|
|
1440
|
+
<mj-text color="${m.colors.secondary}" padding="12px 12px 8px" font-size="10px" font-weight="700" letter-spacing="1px">
|
|
1441
|
+
LABEL ONE
|
|
1442
|
+
</mj-text>
|
|
1443
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="16px" font-weight="700" line-height="24px">
|
|
1444
|
+
First Article
|
|
1445
|
+
</mj-text>
|
|
1446
|
+
<mj-text color="${m.colors.text.body}" padding="12px" line-height="24px" font-size="14px">
|
|
1447
|
+
Combine imagery, concise copy, and a single call to action.
|
|
1448
|
+
</mj-text>
|
|
1449
|
+
<mj-button border-radius="${m.radii.l}" align="center" inner-padding="${m.radii.s}" padding="${m.radii.s}" width="100%" ${m.buttons.secondary}>
|
|
1450
|
+
OPEN
|
|
1451
|
+
</mj-button>
|
|
1452
|
+
</mj-column>
|
|
1453
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="2%" ${m.attrs.bgTransparent}></mj-column>
|
|
1454
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="32%" ${m.attrs.bgSection}>
|
|
1455
|
+
<mj-image src="${t(Fy)}" border-radius="${m.radii.s}" padding="0" alt="Article"/>
|
|
1456
|
+
<mj-text color="${m.colors.secondary}" padding="12px 12px 8px" font-size="10px" font-weight="700" letter-spacing="1px">
|
|
1457
|
+
LABEL TWO
|
|
1458
|
+
</mj-text>
|
|
1459
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="16px" font-weight="700" line-height="24px">
|
|
1460
|
+
Second Article
|
|
1461
|
+
</mj-text>
|
|
1462
|
+
<mj-text color="${m.colors.text.body}" padding="12px" line-height="24px" font-size="14px">
|
|
1463
|
+
Short story that helps understand the message.
|
|
1464
|
+
</mj-text>
|
|
1465
|
+
<mj-button border-radius="${m.radii.l}" align="center" inner-padding="${m.radii.s}" padding="${m.radii.s}" width="100%" ${m.buttons.secondary}>
|
|
1466
|
+
READ
|
|
1467
|
+
</mj-button>
|
|
1468
|
+
</mj-column>
|
|
1469
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="2%" ${m.attrs.bgTransparent}></mj-column>
|
|
1470
|
+
<mj-column border-radius="${m.radii.s}" padding="${m.radii.s}" width="32%" ${m.attrs.bgSection}>
|
|
1471
|
+
<mj-image src="${t(_y)}" border-radius="${m.radii.s}" padding="0" alt="Article"/>
|
|
1472
|
+
<mj-text color="${m.colors.secondary}" padding="12px 12px 8px" font-size="10px" font-weight="700" letter-spacing="1px">
|
|
1473
|
+
LABEL THREE
|
|
1474
|
+
</mj-text>
|
|
1475
|
+
<mj-text color="${m.colors.text.heading}" padding="0px 12px" font-size="16px" font-weight="700" line-height="24px">
|
|
1476
|
+
Third Article
|
|
1477
|
+
</mj-text>
|
|
1478
|
+
<mj-text color="${m.colors.text.body}" padding="12px" line-height="24px" font-size="14px">
|
|
1479
|
+
Round out the trio with the last supporting point.
|
|
1480
|
+
</mj-text>
|
|
1481
|
+
<mj-button border-radius="${m.radii.l}" align="center" inner-padding="${m.radii.s}" padding="${m.radii.s}" width="100%" ${m.buttons.secondary}>
|
|
1482
|
+
MORE
|
|
1483
|
+
</mj-button>
|
|
1484
|
+
</mj-column>
|
|
1485
|
+
</mj-section>`},presetEmailTwoColumnProducts:{label:"Two Column Products",category:L.content,getContent:({getImageUrl:t})=>`<mj-section padding="12px" ${m.attrs.bgSection}>
|
|
1486
|
+
<mj-column padding="15px" ${m.attrs.bgTransparent}>
|
|
1487
|
+
<mj-image src="${t(rr)}" alt="Product" border-radius="${m.radii.s}" padding="${m.radii.s}"></mj-image>
|
|
1488
|
+
<mj-text padding="15px 10px 5px" align="left" line-height="24px" letter-spacing="1px">
|
|
1489
|
+
<b style="background-color:${m.colors.secondary};border-radius:${m.radii.l};color:white;padding:6px 12px;font-size:10px;">Category</b>
|
|
1490
|
+
</mj-text>
|
|
1491
|
+
<mj-text padding="0 10px" align="left" font-size="26px" line-height="34px" color="${m.colors.text.heading}" font-weight="900">
|
|
1492
|
+
Product one
|
|
1493
|
+
</mj-text>
|
|
1494
|
+
<mj-text padding="10px" align="left" font-size="14px" line-height="24px" color="${m.colors.text.body}">
|
|
1495
|
+
Use this format for featured products, bundles, or collections.
|
|
1496
|
+
</mj-text>
|
|
1497
|
+
<mj-text padding="0 10px 5px" align="left" font-size="14px" color="${m.colors.text.body}">FROM</mj-text>
|
|
1498
|
+
<mj-text padding="0 10px 20px" align="left" font-size="28px" line-height="32px" color="${m.colors.secondary}" font-weight="700">
|
|
1499
|
+
$129 <s style="font-size:16px;font-weight:300;color:${m.colors.text.body}">$289</s>
|
|
1500
|
+
</mj-text>
|
|
1501
|
+
<mj-button background-color="${m.colors.text.heading}" color="#ffffff" font-size="14px" font-weight="700" letter-spacing="1px" padding="0 10px" width="100%" border-radius="${m.radii.s}">
|
|
1502
|
+
Buy now
|
|
1503
|
+
</mj-button>
|
|
1504
|
+
</mj-column>
|
|
1505
|
+
<mj-column padding="15px" ${m.attrs.bgTransparent}>
|
|
1506
|
+
<mj-image src="${t(La)}" alt="Product" border-radius="${m.radii.s}" padding="${m.radii.s}"></mj-image>
|
|
1507
|
+
<mj-text padding="15px 10px 5px" align="left" line-height="24px" letter-spacing="1px">
|
|
1508
|
+
<b style="background-color:${m.colors.secondary};border-radius:${m.radii.l};color:white;padding:6px 12px;font-size:10px;">Category</b>
|
|
1509
|
+
</mj-text>
|
|
1510
|
+
<mj-text padding="0 10px" align="left" font-size="26px" line-height="34px" color="${m.colors.text.heading}" font-weight="900">
|
|
1511
|
+
Product two
|
|
1512
|
+
</mj-text>
|
|
1513
|
+
<mj-text padding="10px" align="left" font-size="14px" line-height="24px" color="${m.colors.text.body}">
|
|
1514
|
+
The second card mirrors the first so you can build compact sections.
|
|
1515
|
+
</mj-text>
|
|
1516
|
+
<mj-text padding="0 10px 5px" align="left" font-size="14px" color="${m.colors.text.body}">FROM</mj-text>
|
|
1517
|
+
<mj-text padding="0 10px 20px" align="left" font-size="28px" line-height="32px" color="${m.colors.secondary}" font-weight="700">
|
|
1518
|
+
$89 <s style="font-size:16px;font-weight:300;color:${m.colors.text.body}">$189</s>
|
|
1519
|
+
</mj-text>
|
|
1520
|
+
<mj-button background-color="${m.colors.text.heading}" color="#ffffff" font-size="14px" font-weight="700" letter-spacing="1px" padding="0 10px" width="100%" border-radius="${m.radii.s}">
|
|
1521
|
+
Buy now
|
|
1522
|
+
</mj-button>
|
|
1523
|
+
</mj-column>
|
|
1524
|
+
</mj-section>`},presetEmailThreePricingCards:{label:"Three Pricing Cards",category:L.content,getContent:()=>`<mj-section padding="24px 0" ${m.attrs.bgTransparent}>
|
|
1525
|
+
<mj-column width="32%" border-radius="4px" padding="10px" ${m.attrs.bgSection}>
|
|
1526
|
+
<mj-text padding="20px 0 10px 0" align="center" color="${m.colors.secondary}" font-size="16px">Starter pass</mj-text>
|
|
1527
|
+
<mj-text padding="10px 0 20px 0" align="center" font-size="36px" font-weight="700">$49</mj-text>
|
|
1528
|
+
<mj-divider border-style="dashed" border-width="4px" border-color="#47556955"></mj-divider>
|
|
1529
|
+
<mj-text padding="15px 0" align="center" line-height="24px" font-size="12px">
|
|
1530
|
+
Workshops<br/>
|
|
1531
|
+
Keynotes<br/>
|
|
1532
|
+
Community access
|
|
1533
|
+
</mj-text>
|
|
1534
|
+
<mj-button width="100%" font-size="12px" padding="10px 0" border-radius="${m.radii.s}" ${m.buttons.secondary}>Purchase</mj-button>
|
|
1535
|
+
</mj-column>
|
|
1536
|
+
<mj-column padding="${m.radii.s}" width="2%" ${m.attrs.bgTransparent}></mj-column>
|
|
1537
|
+
<mj-column width="32%" border-radius="4px" padding="10px" ${m.attrs.bgSection}>
|
|
1538
|
+
<mj-text padding="20px 0 10px 0" align="center" color="${m.colors.secondary}" font-size="16px">Full pass</mj-text>
|
|
1539
|
+
<mj-text padding="10px 0 20px 0" align="center" font-size="36px" font-weight="700">$149</mj-text>
|
|
1540
|
+
<mj-divider border-style="dashed" border-width="4px" border-color="#47556955"></mj-divider>
|
|
1541
|
+
<mj-text padding="15px 0" align="center" line-height="24px" font-size="12px">
|
|
1542
|
+
All sessions<br/>
|
|
1543
|
+
Workshops<br/>
|
|
1544
|
+
Networking events
|
|
1545
|
+
</mj-text>
|
|
1546
|
+
<mj-button width="100%" font-size="12px" padding="10px 0" border-radius="${m.radii.s}" ${m.buttons.secondary}>Purchase</mj-button>
|
|
1547
|
+
</mj-column>
|
|
1548
|
+
<mj-column padding="${m.radii.s}" width="2%" ${m.attrs.bgTransparent}></mj-column>
|
|
1549
|
+
<mj-column width="32%" border-radius="4px" padding="10px" ${m.attrs.bgSection}>
|
|
1550
|
+
<mj-text padding="20px 0 10px 0" align="center" color="${m.colors.secondary}" font-size="16px">VIP pass</mj-text>
|
|
1551
|
+
<mj-text padding="10px 0 20px 0" align="center" font-size="36px" font-weight="700">$249</mj-text>
|
|
1552
|
+
<mj-divider border-style="dashed" border-width="4px" border-color="#47556955"></mj-divider>
|
|
1553
|
+
<mj-text padding="15px 0" align="center" line-height="24px" font-size="12px">
|
|
1554
|
+
Priority seating<br/>
|
|
1555
|
+
Private sessions<br/>
|
|
1556
|
+
Speaker lounge
|
|
1557
|
+
</mj-text>
|
|
1558
|
+
<mj-button width="100%" font-size="12px" padding="10px 0" border-radius="${m.radii.s}" ${m.buttons.secondary}>Purchase</mj-button>
|
|
1559
|
+
</mj-column>
|
|
1560
|
+
</mj-section>`},presetEmailGridGallery:{label:"Grid Gallery",category:L.gallery,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1561
|
+
<mj-section padding="16px 24px" border-radius="${m.radii.s} ${m.radii.s} 0 0" ${m.attrs.bgSection}>
|
|
1562
|
+
<mj-column>
|
|
1563
|
+
<mj-text color="${m.colors.text.heading}" align="center" font-size="24px" line-height="35px" letter-spacing="1px">
|
|
1564
|
+
Grid Gallery
|
|
1565
|
+
</mj-text>
|
|
1566
|
+
</mj-column>
|
|
1567
|
+
</mj-section>
|
|
1568
|
+
<mj-section padding="0 24px" ${m.attrs.bgSection}>
|
|
1569
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(sr)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1570
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(Va)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1571
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(Ha)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1572
|
+
</mj-section>
|
|
1573
|
+
<mj-section padding="0 24px" ${m.attrs.bgSection}>
|
|
1574
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(lr)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1575
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(ar)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1576
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(Fa)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image></mj-column>
|
|
1577
|
+
</mj-section>
|
|
1578
|
+
<mj-section padding="0px 24px 8px 24px" border-radius="0 0 ${m.radii.s} ${m.radii.s}" ${m.attrs.bgSection}>
|
|
1579
|
+
<mj-column>
|
|
1580
|
+
<mj-spacer/>
|
|
1581
|
+
</mj-column>
|
|
1582
|
+
</mj-section>
|
|
1583
|
+
</mj-wrapper>`},presetEmailSplitImageGallery:{label:"Split Image Gallery",category:L.gallery,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1584
|
+
<mj-section padding="24px" border-radius="${m.radii.s} ${m.radii.s} 0 0" ${m.attrs.bgSection}>
|
|
1585
|
+
<mj-column width="66.66%" ${m.attrs.bgTransparent}>
|
|
1586
|
+
<mj-image src="${t(sr)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image>
|
|
1587
|
+
</mj-column>
|
|
1588
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}>
|
|
1589
|
+
<mj-image src="${t(lr)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image>
|
|
1590
|
+
<mj-image src="${t(ar)}" alt="Image" padding="5px" border-radius="${m.radii.s}"></mj-image>
|
|
1591
|
+
</mj-column>
|
|
1592
|
+
</mj-section>
|
|
1593
|
+
<mj-section padding="0 24px 8px 24px" border-radius="0 0 ${m.radii.s} ${m.radii.s}" ${m.attrs.bgSection}>
|
|
1594
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1595
|
+
<mj-text padding="0 0 12px 0" line-height="30px" align="center" font-size="16px" color="${m.colors.text.body}">
|
|
1596
|
+
Use this section to set the tone, explain what changed, or frame the key message into product details and supporting content.
|
|
1597
|
+
</mj-text>
|
|
1598
|
+
<mj-button padding="12px 12px 24px" inner-padding="12px 48px" border-radius="${m.radii.l}" ${m.buttons.primary}>
|
|
1599
|
+
VIEW MORE
|
|
1600
|
+
</mj-button>
|
|
1601
|
+
</mj-column>
|
|
1602
|
+
</mj-section>
|
|
1603
|
+
</mj-wrapper>`},presetEmailMasonryGallery:{label:"Masonry Gallery",category:L.gallery,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1604
|
+
<mj-section padding="16px 24px" border-radius="${m.radii.s} ${m.radii.s} 0 0" ${m.attrs.bgSection}>
|
|
1605
|
+
<mj-column>
|
|
1606
|
+
<mj-text color="${m.colors.primary}" align="center" font-size="24px" line-height="35px" letter-spacing="1px">
|
|
1607
|
+
Masonry Gallery
|
|
1608
|
+
</mj-text>
|
|
1609
|
+
<mj-text padding="0 0 12px 0" line-height="30px" align="center" font-size="16px" color="${m.colors.text.body}">
|
|
1610
|
+
Use this section to set the tone, explain what changed, or frame the key message into product details and supporting content.
|
|
1611
|
+
</mj-text>
|
|
1612
|
+
</mj-column>
|
|
1613
|
+
</mj-section>
|
|
1614
|
+
<mj-section padding="0" ${m.attrs.bgSection}>
|
|
1615
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}>
|
|
1616
|
+
<mj-image src="${t(sr)}" alt="Image" padding="0"></mj-image>
|
|
1617
|
+
<mj-image src="${t(Va)}" alt="Image" padding="0"></mj-image>
|
|
1618
|
+
</mj-column>
|
|
1619
|
+
<mj-column width="66.66%" ${m.attrs.bgTransparent}>
|
|
1620
|
+
<mj-image src="${t(Ha)}" alt="Image" padding="0"></mj-image>
|
|
1621
|
+
</mj-column>
|
|
1622
|
+
</mj-section>
|
|
1623
|
+
<mj-section padding="0" ${m.attrs.bgSection}>
|
|
1624
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(lr)}" alt="Image" padding="0"></mj-image></mj-column>
|
|
1625
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(ar)}" alt="Image" padding="0"></mj-image></mj-column>
|
|
1626
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}><mj-image src="${t(Fa)}" alt="Image" padding="0"></mj-image></mj-column>
|
|
1627
|
+
</mj-section>
|
|
1628
|
+
<mj-section padding="0 24px 8px" border-radius="0 0 ${m.radii.s} ${m.radii.s}" ${m.attrs.bgSection}>
|
|
1629
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1630
|
+
<mj-button padding="36px 24px 12px" inner-padding="12px 48px" border-radius="${m.radii.l}" ${m.buttons.primary}>
|
|
1631
|
+
VIEW MORE
|
|
1632
|
+
</mj-button>
|
|
1633
|
+
</mj-column>
|
|
1634
|
+
</mj-section>
|
|
1635
|
+
</mj-wrapper>`},presetEmailCtaPromoBanner:{label:"Promo Banner",category:L.cta,getContent:()=>`<mj-wrapper>
|
|
1636
|
+
<mj-section padding="32px 24px" background-color="${m.colors.secondary}" border-radius="${m.radii.m}">
|
|
1637
|
+
<mj-column vertical-align="middle" width="65%" ${m.attrs.bgTransparent}>
|
|
1638
|
+
<mj-text padding="0 0 8px 0" color="#ffffff" font-size="26px" font-weight="700" line-height="34px">
|
|
1639
|
+
Save your strongest CTA
|
|
1640
|
+
</mj-text>
|
|
1641
|
+
<mj-text padding="0px 0px 12px 0px" color="#ffffffde" font-size="15px" line-height="23px">
|
|
1642
|
+
Great for a launch push, limited-time campaign, or any section.
|
|
1643
|
+
</mj-text>
|
|
1644
|
+
</mj-column>
|
|
1645
|
+
<mj-column vertical-align="middle" width="35%" ${m.attrs.bgTransparent}>
|
|
1646
|
+
<mj-button align="right" background-color="#ffffff" color="${m.colors.secondary}" border-radius="${m.radii.l}" font-weight="700" inner-padding="14px 38px" padding="0px">
|
|
1647
|
+
CLAIM OFFER
|
|
1648
|
+
</mj-button>
|
|
1649
|
+
</mj-column>
|
|
1650
|
+
</mj-section>
|
|
1651
|
+
</mj-wrapper>`},presetEmailCtaOfferBanner:{label:"Offer Banner",category:L.cta,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1652
|
+
<mj-section padding="64px 32px" background-color="${m.colors.primary}" border-radius="${m.radii.m}"
|
|
1653
|
+
background-url="${t(Ra)}" background-size="cover" background-repeat="no-repeat" border="2px solid #e59fc9"
|
|
1654
|
+
>
|
|
1655
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1656
|
+
<mj-text padding="0px 0px 8px 0px" font-weight="700" letter-spacing="1px" align="center">
|
|
1657
|
+
<b style="background-color:${m.colors.primary};color:white;padding:6px 12px;border-radius:${m.radii.m};font-size:8px;">
|
|
1658
|
+
LIMITED-TIME CODE
|
|
1659
|
+
</b>
|
|
1660
|
+
</mj-text>
|
|
1661
|
+
<mj-text padding="12px 0" color="#8c3469" font-size="20px" line-height="26px" align="center">
|
|
1662
|
+
Use <span style="font-weight:700;">WELCOME20</span> to unlock a launch offer before Friday.
|
|
1663
|
+
</mj-text>
|
|
1664
|
+
<mj-button background-color="#ffffff" color="${m.colors.primary}" border-radius="${m.radii.l}" inner-padding="12px 38px" padding="20px 0 0 0" font-weight="700" font-size="18px">
|
|
1665
|
+
REDEEM NOW
|
|
1666
|
+
</mj-button>
|
|
1667
|
+
</mj-column>
|
|
1668
|
+
</mj-section>
|
|
1669
|
+
</mj-wrapper>`},presetEmailThreeTeamProfiles:{label:"Three Team Profiles",category:L.people,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1670
|
+
<mj-section padding="24px 32px 12px" border-radius="${m.radii.m} ${m.radii.m} 0 0" ${m.attrs.bgSection}>
|
|
1671
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1672
|
+
<mj-text padding="12px 0 0 " color="#0f172977" font-size="22px">Event speakers</mj-text>
|
|
1673
|
+
<mj-text padding="12px 0 10px 0" font-size="42px" line-height="50px" font-weight="700" color="${m.colors.text.heading}">
|
|
1674
|
+
Meet our speakers
|
|
1675
|
+
</mj-text>
|
|
1676
|
+
<mj-divider border-width="1px" border-color="#0f172933" padding="12px 0"></mj-divider>
|
|
1677
|
+
</mj-column>
|
|
1678
|
+
</mj-section>
|
|
1679
|
+
<mj-section padding="20px 12px 40px" border-radius="0 0 ${m.radii.m} ${m.radii.m}" ${m.attrs.bgSection}>
|
|
1680
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}>
|
|
1681
|
+
<mj-image src="${t(_a)}" border-radius="50%" alt="Speaker"></mj-image>
|
|
1682
|
+
<mj-text align="center" font-weight="700" font-size="16px" padding-top="10px" color="${m.colors.text.heading}">James Doe</mj-text>
|
|
1683
|
+
<mj-text align="center" font-size="12px" color="${m.colors.text.body}">Advertiser</mj-text>
|
|
1684
|
+
</mj-column>
|
|
1685
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}>
|
|
1686
|
+
<mj-image src="${t(Ga)}" border-radius="50%" alt="Speaker"></mj-image>
|
|
1687
|
+
<mj-text align="center" font-weight="700" font-size="16px" padding-top="10px" color="${m.colors.text.heading}">Mia Dolce</mj-text>
|
|
1688
|
+
<mj-text align="center" font-size="12px" color="${m.colors.text.body}">UX Designer</mj-text>
|
|
1689
|
+
</mj-column>
|
|
1690
|
+
<mj-column width="33.33%" ${m.attrs.bgTransparent}>
|
|
1691
|
+
<mj-image src="${t(Gy)}" border-radius="50%" alt="Speaker"></mj-image>
|
|
1692
|
+
<mj-text align="center" font-weight="700" font-size="16px" padding-top="10px" color="${m.colors.text.heading}">Sophia Evans</mj-text>
|
|
1693
|
+
<mj-text align="center" font-size="12px" color="${m.colors.text.body}">Designer</mj-text>
|
|
1694
|
+
</mj-column>
|
|
1695
|
+
</mj-section>
|
|
1696
|
+
</mj-wrapper>`},presetEmailTeamAlternatingTeamCards:{label:"Alternating Team Cards",category:L.people,getContent:({getImageUrl:t})=>`<mj-wrapper gap="20px" padding="20px 20px 40px" ${m.attrs.bgSection}>
|
|
1697
|
+
<mj-section padding="0" ${m.attrs.bgTransparent}>
|
|
1698
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1699
|
+
<mj-text align="center" font-size="26px" line-height="36px" font-weight="600" letter-spacing="1px">
|
|
1700
|
+
Our experts
|
|
1701
|
+
</mj-text>
|
|
1702
|
+
</mj-column>
|
|
1703
|
+
</mj-section>
|
|
1704
|
+
<mj-section padding="0" background-color="${m.colors.text.heading}">
|
|
1705
|
+
<mj-column width="40%" padding="0">
|
|
1706
|
+
<mj-image src="${t(_a)}" alt="Expert" padding="0"></mj-image>
|
|
1707
|
+
</mj-column>
|
|
1708
|
+
<mj-column vertical-align="middle" width="60%" padding="20px" ${m.attrs.bgTransparent}>
|
|
1709
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="18px" line-height="28px" font-weight="600" letter-spacing="1px" color="#ffffff">
|
|
1710
|
+
James Mitchell
|
|
1711
|
+
</mj-text>
|
|
1712
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="12px" line-height="22px" font-weight="600" letter-spacing="1px" color="#ffffff">
|
|
1713
|
+
Founder & Lead Designer
|
|
1714
|
+
</mj-text>
|
|
1715
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="14px" line-height="24px" color="#ffffffad">
|
|
1716
|
+
Pair portrait photography with a short bio and social row for studio intros, speaker features, or team highlights.
|
|
1717
|
+
</mj-text>
|
|
1718
|
+
<mj-social align="left" icon-size="25px" mode="horizontal" padding="10px 0 0 0">
|
|
1719
|
+
<mj-social-element name="facebook" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1720
|
+
<mj-social-element name="linkedin" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1721
|
+
<mj-social-element name="instagram" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1722
|
+
</mj-social>
|
|
1723
|
+
</mj-column>
|
|
1724
|
+
</mj-section>
|
|
1725
|
+
<mj-section padding="0" background-color="${m.colors.text.heading}">
|
|
1726
|
+
<mj-column width="60%" padding="20px" ${m.attrs.bgTransparent}>
|
|
1727
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="18px" line-height="28px" font-weight="600" letter-spacing="1px" color="#ffffff">
|
|
1728
|
+
Sophia White
|
|
1729
|
+
</mj-text>
|
|
1730
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="12px" line-height="22px" font-weight="600" letter-spacing="1px" color="#ffffff">
|
|
1731
|
+
Senior Interior Architect
|
|
1732
|
+
</mj-text>
|
|
1733
|
+
<mj-text padding="0 0 5px 0" align="left" font-size="14px" line-height="24px" color="#ffffffad">
|
|
1734
|
+
The alternating second row keeps the layout dynamic while still using the same reusable content pattern.
|
|
1735
|
+
</mj-text>
|
|
1736
|
+
<mj-social align="left" icon-size="25px" mode="horizontal" padding="10px 0 0 0">
|
|
1737
|
+
<mj-social-element name="facebook" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1738
|
+
<mj-social-element name="linkedin" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1739
|
+
<mj-social-element name="instagram" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1740
|
+
</mj-social>
|
|
1741
|
+
</mj-column>
|
|
1742
|
+
<mj-column width="40%" padding="0">
|
|
1743
|
+
<mj-image src="${t(Ga)}" alt="Expert" padding="0"></mj-image>
|
|
1744
|
+
</mj-column>
|
|
1745
|
+
</mj-section>
|
|
1746
|
+
</mj-wrapper>`},presetEmailTestimonialsTwoRows:{label:"Testimonials Two Rows",category:L.people,getContent:({getImageUrl:t})=>`<mj-wrapper>
|
|
1747
|
+
<mj-section padding="20px 0" ${m.attrs.bgSection}>
|
|
1748
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1749
|
+
<mj-text align="center" font-size="26px" line-height="36px" font-weight="600" letter-spacing="1px">
|
|
1750
|
+
Client testimonials
|
|
1751
|
+
</mj-text>
|
|
1752
|
+
</mj-column>
|
|
1753
|
+
</mj-section>
|
|
1754
|
+
<mj-section padding="20px 24px 0px 24px" ${m.attrs.bgSection}>
|
|
1755
|
+
<mj-column background-color="#4755690f" border-radius="${m.radii.s}">
|
|
1756
|
+
<mj-text padding="25px" font-size="16px" line-height="24px" font-style="italic" letter-spacing="1px" color="${m.colors.text.body}" align="left">
|
|
1757
|
+
“This layout is perfect for highlighting short testimonials without taking over the whole campaign.”
|
|
1758
|
+
</mj-text>
|
|
1759
|
+
</mj-column>
|
|
1760
|
+
</mj-section>
|
|
1761
|
+
<mj-section padding="0" ${m.attrs.bgSection}>
|
|
1762
|
+
<mj-column vertical-align="middle" width="20%" ${m.attrs.bgTransparent}>
|
|
1763
|
+
<mj-image src="${t(qy)}" alt="Customer" border-radius="50%"></mj-image>
|
|
1764
|
+
</mj-column>
|
|
1765
|
+
<mj-column vertical-align="middle" ${m.attrs.bgTransparent} width="80%" padding="10px 10px 10px 15px">
|
|
1766
|
+
<mj-text padding="0" align="left" font-size="16px" line-height="26px" font-weight="600" letter-spacing="1px" color="${m.colors.text.heading}">Marcus Rivera</mj-text>
|
|
1767
|
+
<mj-text padding="0" align="left" font-size="12px" line-height="22px" font-weight="600" letter-spacing="1px" color="${m.colors.text.body}">Architect</mj-text>
|
|
1768
|
+
</mj-column>
|
|
1769
|
+
</mj-section>
|
|
1770
|
+
<mj-section padding="0" ${m.attrs.bgSection}>
|
|
1771
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1772
|
+
<mj-divider border-width="1px" border-style="solid" border-color="#4755692e"></mj-divider>
|
|
1773
|
+
</mj-column>
|
|
1774
|
+
</mj-section>
|
|
1775
|
+
<mj-section padding="20px 24px 0px 24px" ${m.attrs.bgSection}>
|
|
1776
|
+
<mj-column background-color="#4755690f" border-radius="${m.radii.s}">
|
|
1777
|
+
<mj-text padding="25px" font-size="16px" line-height="24px" font-style="italic" letter-spacing="1px" color="${m.colors.text.body}" align="right">
|
|
1778
|
+
“Use it for customer proof, partner quotes, or event feedback where symmetry matters.”
|
|
1779
|
+
</mj-text>
|
|
1780
|
+
</mj-column>
|
|
1781
|
+
</mj-section>
|
|
1782
|
+
<mj-section padding="0 0 30px" ${m.attrs.bgSection}>
|
|
1783
|
+
<mj-column vertical-align="middle" ${m.attrs.bgTransparent} width="80%" padding="10px 15px 10px 10px">
|
|
1784
|
+
<mj-text padding="0" align="right" font-size="16px" line-height="26px" font-weight="600" letter-spacing="1px" color="${m.colors.text.heading}">Elena Kowalski</mj-text>
|
|
1785
|
+
<mj-text padding="0" align="right" font-size="12px" line-height="22px" font-weight="600" letter-spacing="1px" color="${m.colors.text.body}">Project Manager</mj-text>
|
|
1786
|
+
</mj-column>
|
|
1787
|
+
<mj-column vertical-align="middle" width="20%" ${m.attrs.bgTransparent}>
|
|
1788
|
+
<mj-image src="${t(Wy)}" alt="Customer" border-radius="50%"></mj-image>
|
|
1789
|
+
</mj-column>
|
|
1790
|
+
</mj-section>
|
|
1791
|
+
</mj-wrapper>`},presetEmailFooterSocial:{label:"Social Footer",category:L.footer,getContent:()=>`<mj-section background-color="${m.colors.text.heading}" padding="40px 24px">
|
|
1792
|
+
<mj-column ${m.attrs.bgTransparent}>
|
|
1793
|
+
<mj-text align="center" color="#ffffff" font-size="18px" font-weight="700" padding="0 0 12px">Stay in the loop</mj-text>
|
|
1794
|
+
<mj-social font-size="12px" icon-size="20px" mode="horizontal" padding="0" inner-padding="7px">
|
|
1795
|
+
<mj-social-element name="facebook" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1796
|
+
<mj-social-element name="linkedin" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1797
|
+
<mj-social-element name="instagram" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1798
|
+
</mj-social>
|
|
1799
|
+
<mj-text padding="12px 0 0 0" align="center" color="#ffffff88" font-size="12px" line-height="18px">
|
|
1800
|
+
123 Example Street, Suite 400, <br/>
|
|
1801
|
+
San Francisco, CA
|
|
1802
|
+
</mj-text>
|
|
1803
|
+
<mj-text padding="12px 0 0" align="center" color="#47556994" font-size="12px" line-height="20px">
|
|
1804
|
+
<a href="#" style="color:${m.colors.secondary};text-decoration:none;font-weight:700;">Unsubscribe</a>
|
|
1805
|
+
</mj-text>
|
|
1806
|
+
</mj-column>
|
|
1807
|
+
</mj-section>`},presetEmailTwoColumnFooter:{label:"Two Column Footer",category:L.footer,getContent:()=>`<mj-wrapper padding="0">
|
|
1808
|
+
<mj-section padding="32px 24px 0px 24px" ${m.attrs.bgSection}>
|
|
1809
|
+
<mj-column>
|
|
1810
|
+
<mj-text align="left" font-size="18px" font-weight="700" color="${m.colors.text.heading}" padding="10px 0px 10px 0px">Follow Us
|
|
1811
|
+
</mj-text>
|
|
1812
|
+
<mj-text padding="0 0 20px" font-size="12px" line-height="22px" color="${m.colors.text.body}">Follow us on social for more updates</mj-text>
|
|
1813
|
+
<mj-social align="left" font-size="12px" icon-size="18px" mode="horizontal" padding="0" inner-padding="5px">
|
|
1814
|
+
<mj-social-element name="facebook" background-color="${m.colors.text.heading}"></mj-social-element>
|
|
1815
|
+
<mj-social-element name="linkedin" background-color="${m.colors.text.heading}"></mj-social-element>
|
|
1816
|
+
<mj-social-element name="instagram" background-color="${m.colors.text.heading}"></mj-social-element>
|
|
1817
|
+
</mj-social>
|
|
1818
|
+
</mj-column>
|
|
1819
|
+
<mj-column>
|
|
1820
|
+
<mj-text padding="10px 0px" align="left" font-size="18px" font-weight="700" color="${m.colors.text.heading}">Contact Us</mj-text>
|
|
1821
|
+
<mj-text padding="0 0 20px" font-size="12px" line-height="22px" color="${m.colors.text.body}">
|
|
1822
|
+
245 Design Avenue, Suite 100<br/>
|
|
1823
|
+
San Francisco, CA 94102<br/><a href="tel:+1-555-321-9870"
|
|
1824
|
+
style="color:${m.colors.secondary};font-weight:700;">+1-555-321-9870</a></mj-text>
|
|
1825
|
+
</mj-column>
|
|
1826
|
+
</mj-section>
|
|
1827
|
+
<mj-section ${m.attrs.bgSection} padding="12px 24px 24px">
|
|
1828
|
+
<mj-column width="100%">
|
|
1829
|
+
<mj-divider border-color="#e2e8f0" border-width="1px" padding="0 0 16px 0"></mj-divider>
|
|
1830
|
+
<mj-text padding="0" align="center" color="#47556994" font-size="12px" line-height="20px">You are receiving this
|
|
1831
|
+
email because you subscribed from our site. <a href="#" style="color:${m.colors.secondary};font-weight:700;text-decoration:none;">Unsubscribe</a></mj-text>
|
|
1832
|
+
</mj-column>
|
|
1833
|
+
</mj-section>
|
|
1834
|
+
</mj-wrapper>`},presetEmailThreeColumnFooter:{label:"Three Column Footer",category:L.footer,getContent:()=>`<mj-section padding="30px 24px" background-color="${m.colors.text.heading}" full-width="full-width">
|
|
1835
|
+
<mj-column width="30%" padding="0 0 20px" ${m.attrs.bgTransparent}>
|
|
1836
|
+
<mj-text padding="0 0 15px" font-size="14px" font-weight="700" line-height="24px" color="#ffffff">About us</mj-text>
|
|
1837
|
+
<mj-text padding="0" font-size="12px" color="#ffffff99" line-height="22px">
|
|
1838
|
+
<a style="color:#ffffff99;">About us</a><br/>
|
|
1839
|
+
<a style="color:#ffffff99;">Contact us</a><br/>
|
|
1840
|
+
<a style="color:#ffffff99;">Team</a><br/>
|
|
1841
|
+
<a style="color:#ffffff99;">Blog</a>
|
|
1842
|
+
</mj-text>
|
|
1843
|
+
</mj-column>
|
|
1844
|
+
<mj-column width="30%" padding="0 0 20px" ${m.attrs.bgTransparent}>
|
|
1845
|
+
<mj-text padding="0 0 15px" font-size="14px" font-weight="700" line-height="24px" color="#ffffff">Links
|
|
1846
|
+
</mj-text>
|
|
1847
|
+
<mj-text padding="0" font-size="12px" color="#ffffff99" line-height="22px">
|
|
1848
|
+
<a style="color:#ffffff99;">Shop</a><br/>
|
|
1849
|
+
<a style="color:#ffffff99;">Terms</a><br/>
|
|
1850
|
+
<a style="color:#ffffff99;">Privacy</a><br/>
|
|
1851
|
+
<a style="color:#ffffff99;">Reviews</a>
|
|
1852
|
+
</mj-text>
|
|
1853
|
+
</mj-column>
|
|
1854
|
+
<mj-column width="40%" ${m.attrs.bgTransparent}>
|
|
1855
|
+
<mj-text padding="0 0 15px" font-size="14px" font-weight="700" line-height="24px" color="#ffffff">Our location</mj-text>
|
|
1856
|
+
<mj-text padding="0 0 20px" font-size="12px" line-height="22px" color="#ffffff">
|
|
1857
|
+
245 Design Avenue, Suite 100<br/>
|
|
1858
|
+
San Francisco, CA 94102<br/>
|
|
1859
|
+
<a href="tel:+1-555-321-9870" style="color:#ffffff99;">+1-555-321-9870</a>
|
|
1860
|
+
</mj-text>
|
|
1861
|
+
<mj-text padding="0" font-size="14px" font-weight="700" line-height="24px" color="#ffffff">Socials</mj-text>
|
|
1862
|
+
<mj-social font-size="12px" icon-size="24px" mode="horizontal" padding="0" align="left">
|
|
1863
|
+
<mj-social-element name="facebook" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1864
|
+
<mj-social-element name="linkedin" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1865
|
+
<mj-social-element name="instagram" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1866
|
+
<mj-social-element name="youtube" ${m.attrs.bgTransparent}></mj-social-element>
|
|
1867
|
+
</mj-social>
|
|
1868
|
+
</mj-column>
|
|
1869
|
+
</mj-section>`}}},Ky=({library:n,options:e})=>Object.entries(Uy(e)).map(([t,o])=>{const i=Iy({id:t,label:o.label,category:o.category,library:n}),r=o.getContent({getImageUrl:s=>{var l;return((l=e.getImageUrl)==null?void 0:l.call(e,{block:i}))||s}});return{...i,content:r}}),Jy=(n={})=>{const e=Oy(n),t=We(n.defaultLibrary)?n.defaultLibrary({...e})||void 0:e,o=Ky({library:t,options:n}),i=n.categories?new Set(n.categories):null,r=new Map;return o.flatMap(s=>{const l=typeof s.category=="string"?void 0:s.category;if(i&&l&&!i.has(l.id))return[];let a=l;if(l&&We(n.category)){if(!r.has(l.id)){const u=n.category({...l});r.set(l.id,u===!1?!1:u||l)}const p=r.get(l.id);if(p===!1)return[];a=p||l}const c=a!==s.category?{...s,category:a}:s;if(!We(n.block))return[c];const d=n.block({...c});return d?[d||c]:[]})};function Yy(n,e){const{Blocks:t}=n,o=Jy(e);return o.forEach(i=>i.id&&t.add(i.id,i)),{blocks:o}}const Zy=function(n,e={}){var s,l;const t={...e};if(!Xa(n))return;const{blocks:o}=Yy(n,t),i=t.selectLibrary?(l=(s=o.find(a=>a.library))==null?void 0:s.library)==null?void 0:l.id:void 0,r=[];return i&&n.runCommand(G.setBlocksPanel,{selectedLibrary:i}),t.withGlobalStyles&&r.push((()=>{const a=`${n.DataSources.events.pathSource}:${eu.globalStyles}`,c=()=>n.runCommand(G.setBlocksPanel,{previewCache:new Map});return n.on(a,c),()=>n.off(a,c)})()),q({editor:n,licenseKey:t.licenseKey,plan:Py,pluginName:tu,cleanup:Pu}),({cleanup:a})=>{a(),r.forEach(c=>c())}},Xy=W(Zy,tu),Qy=n=>{const e=n;return e.logicalOperator==="and"||e.logicalOperator==="or"},ou=(n,e)=>(n.config.optsHtml={...n.config.optsHtml,exporter:e},()=>{n.config.optsHtml.exporter=void 0}),iu=(n,e)=>{const t=i=>{const{input:r}=i,{contains:s}=e;(!s||r.includes(s))&&(i.input=e.importer.import(r))},o=n.Parser.events.htmlBefore;return n.on(o,t),()=>{n.off(o,t)}};class ex{getVariableSyntax({dataResolver:e}){const{defaultValue:t}=e,o=this.getFullPath(e),i=t?` || \`${t}\``:"";return`<%= ${o}${i} %>`}getCollectionStartSyntax({dataResolver:e}){const{collectionId:t,dataSource:o,startIndex:i,endIndex:r}=e,s=(o==null?void 0:o.path)||t||"",l=this._sanitizeVariableName(t);let a="";if(i!==void 0||r!==void 0){const c=i??0,d=r!==void 0?r:"";a=`.slice(${c}${d!==""?`, ${d}`:""})`}return`<% ${s}${a}.forEach(function(currentItem, index, arr) {
|
|
1870
|
+
const startIndex = parseInt(${i??0}, 10);
|
|
983
1871
|
const endIndex = startIndex + arr.length;
|
|
984
|
-
const ${l}={ currentItem, currentIndex: startIndex + index, remainingItems: endIndex - (startIndex + index)} %>`}_sanitizeVariableName(e){return e.replace(/[^a-zA-Z0-9_$]/g,"_")}getCollectionEndSyntax(){return"<% }) %>"}getConditionalStartSyntax({dataResolver:e}){return`<% if (${this._parseCondition(e.condition)}) { %>`}getConditionElseSyntax(){return"<% } else { %>"}getConditionalEndSyntax(){return"<% } %>"}getFullPath({collectionId:e,path:t,variableType:o}){return(e?[this._sanitizeVariableName(e),o,t].filter(Boolean).join("."):t)||""}_parseCondition(e){if(!e)return"";if(
|
|
1872
|
+
const ${l}={ currentItem, currentIndex: startIndex + index, remainingItems: endIndex - (startIndex + index)} %>`}_sanitizeVariableName(e){return e.replace(/[^a-zA-Z0-9_$]/g,"_")}getCollectionEndSyntax(){return"<% }) %>"}getConditionalStartSyntax({dataResolver:e}){return`<% if (${this._parseCondition(e.condition)}) { %>`}getConditionElseSyntax(){return"<% } else { %>"}getConditionalEndSyntax(){return"<% } %>"}getFullPath({collectionId:e,path:t,variableType:o}){return(e?[this._sanitizeVariableName(e),o,t].filter(Boolean).join("."):t)||""}_parseCondition(e){if(!e)return"";if(Qy(e)){const t=e.statements.map(r=>this._parseCondition(r)),o=tx[e.logicalOperator];let i=t.length>1?`(${t.join(`)${o}(`)})`:t[0];return e.logicalOperator==="xor"&&(i=`!!(${i})`),i}else{const t=this._parseValue(e.left),o=this._parseValue(e.right);switch(e.operator){case"equals":return`${t} === ${o}`;case">":case"<":case">=":case"<=":case"=":case"!=":return`${t} ${e.operator} ${o}`;case"contains":return`${t}?.includes(${o})`;case"startsWith":return`${t}?.startsWith(${o})`;case"endsWith":return`${t}?.endsWith(${o})`;case"equalsIgnoreCase":return`${t}?.toLowerCase() === ${o}?.toLowerCase()`;case"trimEquals":return`${t}?.trim() === ${o}?.trim()`;case"isTruthy":return`!!${t}`;case"isFalsy":return`!${t}`;case"isDefined":return`${t} !== undefined`;case"isNull":return`${t} === null`;case"isUndefined":return`${t} === undefined`;case"isArray":return`Array.isArray(${t})`;case"isObject":return`typeof ${t} === 'object' && ${t} !== null && !Array.isArray(${t})`;case"isString":return`typeof ${t} === 'string'`;case"isNumber":return`typeof ${t} === 'number' && !isNaN(${t})`;case"isBoolean":return`typeof ${t} === 'boolean'`;default:return`${t} ${e.operator} ${o}`}}}_parseValue(e){return typeof e=="object"?this.getFullPath(e):typeof e=="string"?`'${e.replace(/'/g,"\\'")}'`:String(e)}}const tx={and:"&&",or:"||",xor:"^"},nx=["===","==","!==","!=","<=",">=","<",">","&&","||"],ox={"===":"=","==":"=","!==":"!=","!=":"!=","<=":"<=",">=":">=","<":"<",">":">","&&":"&&","||":"||"};class ix{constructor(){this.messages=[],this.collectionStack=[]}import(e){this.messages=[],this.collectionStack=[];try{const t=this.parseEjsTemplate(e);return this.astToGrapesJS(t)}catch(t){return console.error("Error during import:",t),this.addMessage("error",`Error during import: ${t instanceof Error?t.message:String(t)}`),""}}parseEjsTemplate(e){const t=[];let o=0;for(;o<e.length;){const i=e.indexOf("<%",o);if(i===-1){o<e.length&&t.push(this.createAppendLiteral(e.slice(o)));break}i>o&&t.push(this.createAppendLiteral(e.slice(o,i)));const r=e.indexOf("%>",i);if(r===-1)throw new Error("Unclosed EJS tag");const s=e.slice(i+2,r).trim();if(o=r+2,s.startsWith("=")||s.startsWith("-")){const l=s.slice(1).trim();t.push(this.createAppendExpression(l))}else{if(s.startsWith("#"))continue;if(s.startsWith("if")){const l=this.parseIfStatement(s,e,o);t.push(l),o=l.endPos||o}else if(s.startsWith("for")){const l=this.parseForStatement(s,e,o);t.push(l),o=l.endPos||o}else{const l=s.match(/([\w][\w.-]*[\w])\s*\.\s*forEach\s*\(\s*(\w+)\s*=>\s*\{?/);if(l){const a=l[1],c=l[2],d=this.parseForEachStatement(a,c,e,o);t.push(d),o=d.endPos||o}else this.addMessage("info",`Unsupported scriptlet content: ${s}`)}}}return{type:"Program",body:t}}createAppendLiteral(e){return{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"__append"},arguments:[{type:"Literal",value:e}]}}}createAppendExpression(e){return{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"__append"},arguments:[this.parseJsExpression(e)]}}}parseIfStatement(e,t,o){const i=e.match(/if\s*\((.*)\)\s*\{?/);if(!i)throw new Error("Invalid if statement syntax");const r=this.parseJsExpression(i[1]),{body:s,endPos:l}=this.parseTemplateBlock(t,o);let a=null,c=l;const d=t.indexOf("<%",c);if(d===c){const p=t.indexOf("%>",d);if(p!==-1){const u=t.slice(d+2,p).trim(),f=p+2-d;if(u.startsWith("} else if")){c=d+f;const h=u.substring(u.indexOf("if")).trim(),g=this.parseIfStatement(h,t,c);a={type:"IfStatement",test:g.test,consequent:g.consequent,alternate:g.alternate},c=g.endPos}else if(u.startsWith("} else")){c=d+f;const{body:h,endPos:g}=this.parseTemplateBlock(t,c);a={type:"BlockStatement",body:h},c=g;const b=t.indexOf("<%",c),x=t.indexOf("%>",b);b===c&&t.slice(b+2,x).trim()==="}"&&(c=x+2)}else u==="}"&&(c=d+f)}}return{type:"IfStatement",test:r,consequent:{type:"BlockStatement",body:s},alternate:a,endPos:c}}parseForStatement(e,t,o){const i=e.match(/for\s*\((.*)\)\s*\{?/);if(!i)throw new Error("Invalid for statement syntax");const r=i[1].split("of");if(r.length!==2)throw new Error("Only for...of loops are supported");const s=r[0].trim().replace(/^let\s+|^const\s+|^var\s+/,""),l=r[1].trim(),{body:a,endPos:c}=this.parseTemplateBlock(t,o);return{type:"ForStatement",init:{type:"VariableDeclaration",kind:"let",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:this.parseJsExpression(l)}]},test:null,update:null,body:{type:"BlockStatement",body:a},endPos:(()=>{const d=t.indexOf("<%",c),p=t.indexOf("%>",d);return d===c&&t.slice(d+2,p).trim()==="}"?p+2:c})()}}parseForEachStatement(e,t,o,i){const{body:r,endPos:s}=this.parseTemplateBlock(o,i);return{type:"ForEachStatement",collection:this.parseJsExpression(e),itemIdentifier:{type:"Identifier",name:t},body:{type:"BlockStatement",body:r},endPos:(()=>{const l=o.indexOf("<%",s),a=o.indexOf("%>",l);return l===s&&o.slice(l+2,a).trim()==="}"?a+2:s})()}}parseTemplateBlock(e,t){const o=[];let i=t;for(;i<e.length;){const r=e.indexOf("<%",i);if(r===-1){i<e.length&&o.push(this.createAppendLiteral(e.slice(i))),i=e.length;break}r>i&&o.push(this.createAppendLiteral(e.slice(i,r)));const s=e.indexOf("%>",r);if(s===-1)throw new Error("Unclosed EJS tag within block");const l=e.slice(r+2,s).trim();if(l==="}"||l.startsWith("} else")){i=r;break}if(i=s+2,l.startsWith("=")||l.startsWith("-")){const a=l.slice(1).trim();o.push(this.createAppendExpression(a))}else{if(l.startsWith("#"))continue;if(l.startsWith("if")){const a=this.parseIfStatement(l,e,i);o.push(a),i=a.endPos||i}else if(l.startsWith("for")){const a=this.parseForStatement(l,e,i);o.push(a),i=a.endPos||i}else{const a=l.match(/([\w][\w.-]*[\w])\s*\.\s*forEach\s*\(\s*(\w+)\s*=>\s*\{?/);if(a){const c=a[1],d=a[2],p=this.parseForEachStatement(c,d,e,i);o.push(p),i=p.endPos||i}else this.addMessage("info",`Unsupported scriptlet content within block: ${l}`)}}}return{body:o,endPos:i}}parseJsExpression(e){if(/^(['"]).*\1$/.test(e))return{type:"Literal",value:e.slice(1,-1)};if(/^-?\d+$/.test(e))return{type:"Literal",value:parseInt(e,10)};if(/^-?\d+\.\d+$/.test(e))return{type:"Literal",value:parseFloat(e)};if(e==="true"||e==="false")return{type:"Literal",value:e==="true"};for(const i of nx){const r=e.lastIndexOf(i);if(r>0&&e[r-1]!=="!"&&e[r-1]!=="="&&e[r-1]!=="<"&&e[r-1]!==">")return{type:i==="&&"||i==="||"?"LogicalExpression":"BinaryExpression",operator:ox[i],left:this.parseJsExpression(e.slice(0,r).trim()),right:this.parseJsExpression(e.slice(r+i.length).trim())}}const t=e.indexOf("."),o=e.indexOf("[");if(t>0&&(o===-1||t<o)||o>0&&(t===-1||o<t)){const i=t>0&&(o===-1||t<o)?t:o;let r,s,l=!1;if(i===t)r=e.slice(0,t),s={type:"Identifier",name:e.slice(t+1)},l=!1;else{r=e.slice(0,o);const a=e.indexOf("]",o);if(a===-1)throw new Error("Unclosed bracket in expression");const c=e.slice(o+1,a);s=/^(['"]).*\1$/.test(c)||/^-?\d+(\.\d+)?$/.test(c)?this.parseJsExpression(c):{type:"Identifier",name:c},l=!0}return{type:"MemberExpression",object:this.parseJsExpression(r),property:s,computed:l}}return{type:"Identifier",name:e}}astToGrapesJS(e){switch(e.type){case"Program":return this.handleProgram(e);case"VariableDeclaration":return this.handleVariableDeclaration(e);case"ExpressionStatement":return this.handleExpressionStatement(e);case"IfStatement":return this.handleIfStatement(e);case"ForStatement":return this.handleForStatement(e);case"ForEachStatement":return this.handleForEachStatement(e);case"BlockStatement":return this.handleBlockStatement(e);case"Literal":return this.handleLiteral(e);case"Identifier":return this.handleIdentifier(e);case"MemberExpression":return this.handleMemberExpression(e);case"BinaryExpression":return this.handleBinaryExpression(e);case"LogicalExpression":return this.handleLogicalExpression(e);case"CallExpression":return this.handleCallExpression(e);default:return this.addMessage("warning",`Unsupported node type: ${e.type}`),""}}handleProgram(e){let t="";for(const o of e.body)t+=this.astToGrapesJS(o);return t}handleVariableDeclaration(e){return""}handleExpressionStatement(e){return e.expression.type==="CallExpression"&&e.expression.callee.type==="Identifier"&&e.expression.callee.name==="__append"&&e.expression.arguments.length>0?this.astToGrapesJS(e.expression.arguments[0]):""}handleIfStatement(e){const t=this.getConditionExpression(e.test),o=this.astToGrapesJS(e.consequent);let i="";return e.alternate&&(i=this.astToGrapesJS(e.alternate)),`
|
|
985
1873
|
<data-condition data-gjs-data-resolver='${JSON.stringify({condition:t})}'>
|
|
986
1874
|
<data-condition-true-content>${o}</data-condition-true-content>
|
|
987
|
-
<data-condition-false-content>${
|
|
1875
|
+
<data-condition-false-content>${i}</data-condition-false-content>
|
|
988
1876
|
</data-condition>
|
|
989
|
-
`}handleForStatement(e){var l;if(((l=e.init)==null?void 0:l.type)!=="VariableDeclaration"||e.init.declarations.length===0)return this.addMessage("warning","Unsupported for loop init format"),"";const t=e.init.declarations[0];if(t.id.type!=="Identifier")return this.addMessage("warning","Unsupported for loop variable declaration id"),"";let o="";if(t.init)o=this.getExpressionString(t.init);else return this.addMessage("warning","For loop collection is undefined"),"";const
|
|
1877
|
+
`}handleForStatement(e){var l;if(((l=e.init)==null?void 0:l.type)!=="VariableDeclaration"||e.init.declarations.length===0)return this.addMessage("warning","Unsupported for loop init format"),"";const t=e.init.declarations[0];if(t.id.type!=="Identifier")return this.addMessage("warning","Unsupported for loop variable declaration id"),"";let o="";if(t.init)o=this.getExpressionString(t.init);else return this.addMessage("warning","For loop collection is undefined"),"";const i=t.id.name,r=i;this.collectionStack.push(i);const s=this.astToGrapesJS(e.body);return this.collectionStack.pop(),`
|
|
990
1878
|
<data-collection data-gjs-data-resolver='${JSON.stringify({dataSource:{type:"data-variable",path:o},collectionId:r})}'>
|
|
991
1879
|
<data-collection-item>
|
|
992
|
-
${
|
|
1880
|
+
${s}
|
|
993
1881
|
</data-collection-item>
|
|
994
1882
|
</data-collection>
|
|
995
|
-
`}handleForEachStatement(e){const t=this.getExpressionString(e.collection),o=e.itemIdentifier.name,
|
|
996
|
-
<data-collection data-gjs-data-resolver='${JSON.stringify({dataSource:{type:"data-variable",path:t},collectionId:
|
|
1883
|
+
`}handleForEachStatement(e){const t=this.getExpressionString(e.collection),o=e.itemIdentifier.name,i=o;this.collectionStack.push(o);const r=this.astToGrapesJS(e.body);return this.collectionStack.pop(),`
|
|
1884
|
+
<data-collection data-gjs-data-resolver='${JSON.stringify({dataSource:{type:"data-variable",path:t},collectionId:i})}'>
|
|
997
1885
|
<data-collection-item>
|
|
998
1886
|
${r}
|
|
999
1887
|
</data-collection-item>
|
|
1000
1888
|
</data-collection>
|
|
1001
|
-
`}handleBlockStatement(e){let t="";for(const o of e.body)t+=this.astToGrapesJS(o);return t}handleLiteral(e){return String(e.value??"")}handleIdentifier(e){let t={path:e.name};if(this.collectionStack.length>0){const o=this.collectionStack[this.collectionStack.length-1];e.name===o&&(t={collectionId:o,variableType:"currentItem"})}return`<data-variable data-gjs-data-resolver='${JSON.stringify(t)}'></data-variable>`}handleMemberExpression(e,t={}){let
|
|
1889
|
+
`}handleBlockStatement(e){let t="";for(const o of e.body)t+=this.astToGrapesJS(o);return t}handleLiteral(e){return String(e.value??"")}handleIdentifier(e){let t={path:e.name};if(this.collectionStack.length>0){const o=this.collectionStack[this.collectionStack.length-1];e.name===o&&(t={collectionId:o,variableType:"currentItem"})}return`<data-variable data-gjs-data-resolver='${JSON.stringify(t)}'></data-variable>`}handleMemberExpression(e,t={}){let i={path:this.getExpressionString(e),...t};if(this.collectionStack.length>0){const r=this.collectionStack[this.collectionStack.length-1];let s=e;const l=[];for(;s.type==="MemberExpression";)s.property.type==="Identifier"&&!s.computed?l.unshift(s.property.name):s.property.type==="Literal"&&s.computed?l.unshift(String(s.property.value)):l.unshift(this.getExpressionString(s.property)),s=s.object;if(s.type==="Identifier"&&s.name===r){const a=l.join(".");i={...t,collectionId:r,variableType:"currentItem",path:a}}}return`<data-variable data-gjs-data-resolver='${JSON.stringify(i)}'></data-variable>`}handleBinaryExpression(e){return`${this.getExpressionString(e.left)} ${e.operator} ${this.getExpressionString(e.right)}`}handleLogicalExpression(e){return e.operator==="||"&&e.right.type==="Literal"?this.handleMemberExpression(e.left,{defaultValue:e.right.value}):`${this.getExpressionString(e.left)} ${e.operator} ${this.getExpressionString(e.right)}`}handleCallExpression(e){var t;if(e.callee.type==="Identifier"&&e.callee.name==="include"){const o=((t=e.arguments[0])==null?void 0:t.type)==="Literal"?String(e.arguments[0].value):"";return this.addMessage("info",`Partial includes are not fully supported: ${o}`),""}return""}getConditionExpression(e){if(e.type==="Identifier")return{logicalOperator:"and",statements:[{left:{type:"data-variable",path:e.name},operator:"isTruthy"}]};if(e.type==="MemberExpression"){let t=this.getExpressionString(e),o="isTruthy";return t.startsWith("!!")?(o="isTruthy",t=t.slice(2)):t.startsWith("!")&&(o="isFalsy",t=t.slice(1)),{logicalOperator:"and",statements:[{left:{type:"data-variable",path:t},operator:o}]}}if(e.type==="BinaryExpression"||e.type==="LogicalExpression"){const t=this.getConditionExpression(e.left),o=this.getConditionExpression(e.right);return`${t} ${e.operator} ${o}`}return e.type==="Literal"?typeof e.value=="string"?`'${e.value}'`:String(e.value??""):this.getExpressionString(e)}getExpressionString(e){switch(e.type){case"Identifier":return e.name;case"Literal":return String(e.value??"");case"MemberExpression":{const t=this.getExpressionString(e.object),o=this.getExpressionString(e.property);return e.computed?`${t}[${o}]`:`${t}.${o}`}case"BinaryExpression":{const t=this.getExpressionString(e.left),o=this.getExpressionString(e.right);return`${t} ${e.operator} ${o}`}case"LogicalExpression":{const t=this.getExpressionString(e.left),o=this.getExpressionString(e.right);return`${t} ${e.operator} ${o}`}default:return this.addMessage("warning",`Unsupported expression type for getExpressionString: ${e.type}`),""}}addMessage(e,t){this.messages.push({type:e,message:t})}}const ru="dataSourceEjs",rx=F.startup,sx=function(n,e={}){const t=ou(n,new ex),o=iu(n,{contains:"<%",importer:new ix});q({editor:n,licenseKey:e.licenseKey,plan:rx,pluginName:ru,cleanup:()=>{t(),o()}})},lx=W(sx,ru),su={equals:"equals",isTruthy:"isTruthy",isFalsy:"isFalsy",isDefined:"isDefined",isNull:"isNull",isUndefined:"isUndefined",isArray:"isArray",isObject:"isObject",isString:"isString",isNumber:"isNumber",isBoolean:"isBoolean",isDefaultValue:"isDefaultValue"},ax={">":"numGt","<":"numLt",">=":"numGte","<=":"numLte","=":"numEq","!=":"numNeq"},cx={contains:"strContains",startsWith:"strStartsWith",endsWith:"strEndsWith",equalsIgnoreCase:"strEqualsIgnoreCase",trimEquals:"strTrimEquals"},dx={...su,...ax,...cx};class px{getHelperId(e){return dx[e]||e}getFullPath({collectionId:e,path:t}){let o=t;return e&&(o=[this._sanitizeVariableName(e),t].filter(Boolean).join(".")),o||""}getVariableSyntax({dataResolver:e}){const{defaultValue:t}=e,o=this.getFullPath(e);return t?`{{#if ${o}}}{{{${o}}}}{{else}}${t}{{/if}}`:`{{{${o}}}}`}getCollectionStartSyntax({dataResolver:e}){const{collectionId:t,dataSource:o}=e,i=o==null?void 0:o.path;let r="";if(e.startIndex!==void 0||e.endIndex!==void 0){const c=e.startIndex??0,d=e.endIndex!==void 0?e.endIndex:"";d!==""?r=` (slice ${i} ${c} ${d})`:r=` (slice ${i} ${c})`}const l=` as |${this._sanitizeVariableName(t)}|`;return`{{#each ${r||i}${l}}}`}getCollectionEndSyntax(){return"{{/each}}"}getConditionalStartSyntax({dataResolver:e}){const t=e.condition;if(!t)return"";const o=t,i=t;if(i.statements&&i.logicalOperator==="and"||i.logicalOperator==="or"){const{statements:r}=i,s=i.logicalOperator,l=r.map(c=>this._parseCondition(c)).join(" ");return`{{#if ${r.length>1?`(${s} ${l})`:l}}}`}else return`{{#if ${this._parseCondition(o)}}}`}_parseCondition(e){if(!e)return"";const t=e,o=e;if(o.statements&&o.logicalOperator==="and"||o.logicalOperator==="or"){const{statements:i}=o,r=o.logicalOperator,s=o.statements.map(l=>this._parseCondition(l)).join(" ");return i.length>1?`(${r} ${s})`:s}else{const i=t.operator,r=this.getHelperId(i),s=this._parseValue(t.left),l=this._parseValue(t.right);return this.getExpressionStr(r,s,l)}}getExpressionStr(e,t,o){return su[e]?e==="isTruthy"?t:e==="isFalsy"?`!${t}`:`${e} ${t}`:`(${e} ${t} ${o})`}_parseValue(e){return typeof e=="object"?this.getFullPath(e):typeof e=="string"?`'${e.replace(/'/g,"\\'")}'`:String(e)}_sanitizeVariableName(e){return e.replace(/[^a-zA-Z0-9_$]/g,"_")}getConditionElseSyntax(){return"{{else}}"}getConditionalEndSyntax(){return"{{/if}}"}}class ux{constructor(){this.messages=[],this.collectionStack=[]}import(e){this.messages=[],this.collectionStack=[];const t=this.parse(e);return this.astToGrapesJS(t)}parse(e){try{return fu.parse(e)}catch(t){if(t instanceof Error&&t.message.includes("Parse error")){const o=t.message.match(/line (\d+)/),i=o?parseInt(o[1]):0,r=t.message.match(/column (\d+)/),s=r?parseInt(r[1]):0;throw new Error(`Handlebars syntax error at line ${i}, column ${s}: ${t.message}`)}throw t}}astToGrapesJS(e){switch(e.type){case"Program":return this.handleProgram(e);case"ContentStatement":return this.handleContentStatement(e);case"MustacheStatement":return this.handleMustacheStatement(e);case"BlockStatement":return this.handleBlockStatement(e);case"PartialStatement":return this.handlePartialStatement(e);case"CommentStatement":return this.handleCommentStatement(e);case"ElementNode":return this.handleElementNode(e);case"TextNode":return this.handleTextNode(e);default:return this.addMessage("warning",`Unsupported node type: ${e.type}`,e.loc),""}}handleProgram(e){let t="";if(e.body)for(const o of e.body)t+=this.astToGrapesJS(o);return t}handleContentStatement(e){return e.value||""}handleMustacheStatement(e,t={}){const o=this.getExpressionString(e.path),i={...t};return this.collectionStack.length>0?this.processPathWithCollectionContext(o,i):i.path=o,`<data-variable data-gjs-data-resolver='${JSON.stringify(i)}'></data-variable>`}processPathWithCollectionContext(e,t){e.startsWith("@")?this.handleDirectCollectionReference(e,t):this.handleRelativePathReference(e,t)}handleDirectCollectionReference(e,t){if(this.isSpecialIterationVariable(e)){this.setSpecialVariableResolver(this.collectionStack[this.collectionStack.length-1],e,t);return}const[o,...i]=e.substring(1).split("/"),r=i.join(".");this.collectionStack.includes(o)?this.setCurrentItemResolver(o,r,t):this.handleParentReferenceFallback(e,t)}isSpecialIterationVariable(e){return["index","@index","key","@key"].includes(e)}setSpecialVariableResolver(e,t,o){o.collectionId=e;const i={index:"currentIndex","@index":"currentIndex",key:"currentKey","@key":"currentKey"};o.variableType=i[t]}setCurrentItemResolver(e,t,o){o.collectionId=e,o.variableType="currentItem",t&&(o.path=t)}handleRelativePathReference(e,t){const o=is(e),{parentLevel:i,remainingPathParts:r}=this.calculateParentLevel(o),s=r.join("."),l=this.collectionStack.length-1-i;l>=0&&l<this.collectionStack.length?this.resolveRelativePath(s,l,t):t.path=r.join(".")}calculateParentLevel(e){const t=this.collectionStack.findLastIndex(r=>r===e[0]);if(t!==-1)return{parentLevel:this.collectionStack.length-1-t,remainingPathParts:e.slice(1)};let o=0;const i=[...e];for(;i[0]==="..";)o++,i.shift();return{parentLevel:o,remainingPathParts:i}}resolveRelativePath(e,t,o){const i=this.collectionStack[t];o.collectionId=i,o.variableType="currentItem",e!=="this"&&(o.path=e.startsWith("this.")?e.split(".").slice(1).join("."):e)}handleParentReferenceFallback(e,t){const o=is(e),{parentLevel:i,remainingPathParts:r}=this.calculateParentLevel(o),s=r.join("."),l=this.collectionStack.length-1-i;l>=0&&l<this.collectionStack.length?this.resolveRelativePath(s,l,t):t.path=r.join(".")}handleBlockStatement(e){const t=e.path.original;switch(t){case"if":case"unless":return this.handleConditionalBlock(e,t);case"each":return this.handleEachBlock(e);default:return this.addMessage("warning",`Unsupported block helper: ${t}`,e.loc),this.handleGenericBlock(e)}}handleConditionalBlock(e,t){const r={logicalOperator:"and",statements:[{left:{type:"data-variable",path:this.getExpressionString(e.params[0])},operator:t==="unless"?"isFalsy":"isTruthy"}]},s=this.handleProgram(e.program),l=e.inverse?this.handleProgram(e.inverse):"";return`
|
|
1002
1890
|
<data-condition data-gjs-data-resolver='${JSON.stringify({condition:r})}'>
|
|
1003
|
-
<data-condition-true-content>${
|
|
1891
|
+
<data-condition-true-content>${s}</data-condition-true-content>
|
|
1004
1892
|
<data-condition-false-content>${l}</data-condition-false-content>
|
|
1005
1893
|
</data-condition>
|
|
1006
|
-
`}handleEachBlock(e){var r,
|
|
1894
|
+
`}handleEachBlock(e){var r,s,l;const t=this.getExpressionString(e.params[0]);let o;e.params.length>=3&&e.params[1]==="as"&&((r=e.params[2])==null?void 0:r.type)==="PathExpression"?o=e.params[2].original:(l=(s=e.program)==null?void 0:s.blockParams)!=null&&l.length?o=e.program.blockParams[0]:o=`collection-${Math.random().toString(36).substring(2,10)}`,this.collectionStack.push(o);const i=this.handleProgram(e.program);return this.collectionStack.pop(),`
|
|
1007
1895
|
<data-collection data-gjs-data-resolver='${JSON.stringify({dataSource:{type:"data-variable",path:t},collectionId:o})}'>
|
|
1008
|
-
<data-collection-item>${
|
|
1896
|
+
<data-collection-item>${i}</data-collection-item>
|
|
1009
1897
|
</data-collection>
|
|
1010
|
-
`}handleCommentStatement(e){return`<!--${e.value}-->`}handleElementNode(e){let t="";if(e.attributes)for(const s of e.attributes)s.value.type==="TextNode"?t+=` ${s.name}="${s.value.chars}"`:(this.addMessage("warning",`Complex attribute values not fully supported: ${s.name}`,e.loc),t+=` ${s.name}="${this.getExpressionString(s.value)}"`);let o="";if(e.children)for(const s of e.children)o+=this.astToGrapesJS(s);return`<${e.tag}${t}>${o}</${e.tag}>`}handleTextNode(e){return e.chars||""}handlePartialStatement(e){return this.addMessage("warning",`Partials are not fully supported: ${e.name.original}`,e.loc),`{{> ${e.name.original}}}`}handleGenericBlock(e){const t=this.handleProgram(e.program);return`<!-- Unsupported block: ${e.path.original} -->${t}`}getExpressionString(e){return e.type==="PathExpression"?e.original:e.type==="StringLiteral"?e.value:e.type==="NumberLiteral"?e.value.toString():e.type==="BooleanLiteral"?e.value?"true":"false":e.type==="SubExpression"?this.getExpressionString(e.params[0]):e.type==="Hash"?`{${e.pairs.map(o=>`${o.key}=${this.getExpressionString(o.value)}`).join(", ")}}`:(this.addMessage("warning",`Complex expression type not fully supported: ${e.type}`,e.loc),"")}addMessage(e,t,o){this.messages.push({type:e,message:t,location:o?{line:o.start.line,column:o.start.column}:void 0})}}const Kr=n=>{if(n==null||n==="")return[];if(n===".")return["this"];if(n===".."||n==="../")return[".."];if(n.startsWith("../")){const i=n.substring(3);return["..",...Kr(i)]}const e=[];let t=0,o=n.replace(/\[(?:(['"])(.*?)\1|([^\]]*))\]/g,(i,l,a,c)=>{const d=a!==void 0?a:c||"";return e[t]=d,`__HANDLEBARS_PLACEHOLDER_${t++}__`});o=o.replace(/\//g,".");const s=o.split("."),r=[];for(const i of s){const l=/^__HANDLEBARS_PLACEHOLDER_(\d+)__$/.exec(i);if(l){const a=parseInt(l[1],10);r.push(e[a])}else i!==""&&r.push(i)}return r},bb="dataSourceHandlebars",vb=H.startup,Sb=function(n,e={}){const t=Sp(n,new gb),o=xp(n,{contains:"{{",importer:new yb});W({editor:n,licenseKey:e.licenseKey,plan:vb,pluginName:bb,cleanup:()=>{t(),o()}})},xb=G(Sb),wb=n=>{const e={};for(const t of Object.keys(n)){let o=n[t];o&&(Array.isArray(o)?o=o.map(s=>s.toString()).join(","):o=o.toString(),e[t]=o)}return new URLSearchParams(e)},Aa="youtube-video",Cb=n=>{const{apiKey:e,searchParams:t,thumbnailQuality:o="high"}=n,s=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",d=wb(l);return`${c}?${d}`},r=l=>{var a,c,d;return((a=l[o])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((d=l.medium)==null?void 0:d.url)||l.default.url},i=l=>{const a=r(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,type:Aa,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:[Aa],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}),p={...c,...d};p.part?p.part.includes("snippet")||p.part.push("snippet"):p.part=["snippet"];const h=await(await fetch(s(p))).json();return(m=h.items)!=null&&m.length?{items:h.items.map(i),nextPageCustomData:{token:h.nextPageToken},isLastPage:!h.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}}]})}},kb={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},Eb="youtubeAssetProvider",Tb=H.startup,Mb=function(n,e){var c;const{skipVideoComponent:t,i18n:o={}}=e,s=Cb(e);n.runCommand(_.assetProviderAdd,{provider:s});const r="search-on-youtube",i="video",l=(c=n.Components.getType(i))==null?void 0:c.model.prototype,a=d=>{n.Assets.open({modalTitle:n.I18n.t("youtubeAssetProvider.modalTitle"),providerId:s.id,typeId:s.types[0],providers:[],types:[],select:p=>{n.Assets.close(),d.set({videoId:p.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!t&&l&&n.Components.addType(i,{model:{getYoutubeTraits(){const[d,...p]=l.getYoutubeTraits.apply(this);return[d,{id:r,type:"button",label:n.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>a(this)},...p]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:d}=this,p=d.get("provider")||"";p!=null&&p.startsWith("yt")&&a(d)}}}),n.I18n.addMessages({en:kb,...o}),W({editor:n,licenseKey:e.licenseKey,plan:Tb,pluginName:Eb,cleanup:()=>{n.runCommand(_.assetProviderRemove,{id:s.id}),!t&&l&&n.Components.addType(i,{model:{getYoutubeTraits(){return l.getYoutubeTraits.apply(this).filter(d=>d.id!==r)}}})}})},Ab=G(Mb),oo=n=>n.replaceAll('"',"").replaceAll("'",""),Jr=n=>n.includes(",")?n:/\s/.test(n)?`'${oo(n)}'`:oo(n),Pa=(n,e,t)=>({family:n,variant:e,...t}),Cp=(n,e)=>{n=Jr(n);const{menuVariant:t,variants:o}=e;return{family:n,familyLabel:oo(n),menuVariant:t&&Pa(Jr(`menuFont-${oo(n)}`),"regular",t),variants:Object.assign({},...Object.entries(o).map(([s,r])=>({[s]:Pa(n,s,r)})))}},Na=(n,e)=>{var l;const t=Cp(n.family,n),o=t.menuVariant??((l=Object.values(t.variants))==null?void 0:l[0]);if(!o)return"Arial, Helvetica, sans-serif";const{source:s,descriptors:r}=o,i=oo(o.family);if(!e){const a=new FontFace(i,`url("${s}")`,r),c=Array.from(document.fonts.values()).filter(d=>d.family===i);for(const d of c)document.fonts.delete(d);document.fonts.add(a),a.load().catch(()=>{})}return Jr(i)},Pb=n=>{const{family:e,menu:t,axes:o}=n,s=!!o,r=Object.assign({},...n.variants.map(i=>{var d,p;let l,a;if(s){const u=o.find(h=>h.tag==="wght");if(u){const{start:h,end:f}=u;l=`${h} ${f}`}}return l||(l=((d=i.match(/\d+/))==null?void 0:d[0])??"400"),a=((p=i.match(/[a-zA-Z]+/))==null?void 0:p[0])==="italic"?"italic":void 0,{[i]:{source:n.files[i],descriptors:{style:a,weight:l}}}}));return Cp(e,{menuVariant:{source:t},variants:r})},Nb=n=>({id:`${n.family}/${n.version}`,type:"font",src:n.menu,name:n.family,customData:{font:Pb(n),needsLoading:!0}}),Ob=n=>{const{font:e}=n.customData;return n.customData.needsLoading?(n.customData.needsLoading=!1,Na(e)):Na(e,!0)};let Nn;const Ib=n=>{const e=[];for(const t of Object.keys(n)){let o=n[t];o&&(Array.isArray(o)?e.push(...o.map(s=>[t,s.toString()])):(o=o.toString(),e.push([t,o])))}return new URLSearchParams(e)},Rb=n=>{const{apiKey:e,searchParams:t}=n,o=(s={})=>{const r="https://www.googleapis.com/webfonts/v1/webfonts",i=Ib(s);return`${r}?${i}`};return{id:"google-fonts",types:["font"],label:({editor:s})=>s.I18n.t("googleFontsAssetProvider.providerLabel"),search:{reloadOnInput:!1},async onLoad(){var c;if(Nn)return Nn;const s={key:e,sort:"alpha",subset:"latin",capability:["WOFF2","VF"]},r=t==null?void 0:t(),i={...s,...r},a=await(await fetch(o(i))).json();return(c=a.items)!=null&&c.length?(Nn=a.items.map(Nb),Nn):[]},itemLayout:s=>{const r=Nn.find(l=>l.id===s.assetProps.id),i=Ob(r);return{type:"column",onClick:()=>s.onSelect(r),htmlAttrs:{title:r.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"text",content:r.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:i,fontSize:"24px",paddingLeft:"8px",paddingRight:"8px"}},{type:"text",content:r.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"16px",paddingLeft:"8px",paddingRight:"8px"}}]}}}},Db={googleFontsAssetProvider:{searchBtn:"Search on Google Fonts",modalTitle:"Select Font",providerLabel:"Google Fonts"}},Lb="googleFontsAssetProvider",$b=H.startup,zb=function(n,e){const{i18n:t={}}=e,o=Rb(e);n.runCommand(_.assetProviderAdd,{provider:o}),n.I18n.addMessages({en:Db,...t}),W({editor:n,licenseKey:e.licenseKey,plan:$b,pluginName:Lb,cleanup:()=>{n.runCommand(_.assetProviderRemove,{id:o.id})}})},Vb=G(zb),Bb="canvasAbsoluteMode",Hb=H.startup,Fb=(n,e,t)=>{var c,d;const o=t.enableAbsolute??(p=>p.hasAbsolute),r=(Array.isArray(e)?e:e?[e]:[...n.getSelectedAll()])[0],i=((d=(c=r==null?void 0:r.delegate)==null?void 0:c.move)==null?void 0:d.call(c,r))||r;if(!i)return;const l=i.getEl();return{result:_t(o)?o({component:i,hasAbsolute:!!l&&getComputedStyle(l).position==="absolute"}):!1,component:i,dmode:i.get("dmode")}};function Vo({guideMatched:n,canvasView:e}){var M;const t=n.guide.x===void 0?"y":"x";let o=0,s=0,r=0,i=0;const{guide:l,matched:a}=n,c=e.getElBoxRect(l.componentView.el),d=e.getElBoxRect(((M=a.componentView)==null?void 0:M.el)||a.componentEl),p=c.y,u=c.y+c.height,h=c.x,f=c.x+c.width,m=d.y,g=d.y+d.height,b=d.x,w=d.x+d.width,y=Math.max(0,p-g),v=Math.max(0,m-u),C=Math.max(0,h-w),S=Math.max(0,b-f),x=y>v,E=C>S,k=l.type;return t==="x"&&(k==="l"?(o=h,x?(s=g,r=y):(s=u,r=v)):k==="r"?(o=f,x?(s=g,r=y):(s=u,r=v)):k==="x"&&(o=h-(h-f)/2,x?(s=g,r=y):(s=u,r=v))),t==="y"&&(k==="t"?(s=p,E?(o=w,i=C):(o=f,i=S)):k==="b"?(s=u,E?(o=w,i=C):(o=f,i=S)):k==="y"&&(s=p-(p-u)/2,E?(o=w,i=C):(o=f,i=S))),{axis:t,x:o,y:s,width:i,height:r}}function _b({guideMatched:n,component:e,canvasView:t}){const o=n.guide.x===void 0?"x":"y",{guide:s,matched:r}=n,i=s.type,l=r.type,a=t.getElementPos(s.componentView.el).rect,c=t.getElementPos(r.componentView.el).rect;if(o==="x"){const d=a.height,p=c.top,u=c.top+c.height;let h=0;i==="t"?l==="t"?h=p-d:l==="b"?h=u-d:l==="y"&&(h=p-d-(p-u)/2):i==="b"?l==="t"?h=p-d*2:l==="b"?h=u-d*2:l==="y"&&(h=p-d*2-(p-u)/2):i==="y"&&(l==="t"?h=p-d*1.5:l==="b"?h=u-d*1.5:l==="y"&&(h=p-d*1.5-(p-u)/2)),e.addStyle({top:`${h-5}px`},{partial:!0})}if(o==="y"){const d=a.width,p=c.left,u=c.left+c.width;let h=0;i==="l"?l==="l"?h=p:l==="r"?h=u:l==="x"&&(h=p-(p-u)/2):i==="r"?l==="l"?h=p-d:l==="r"?h=u-d:l==="x"&&(h=p-d-(p-u)/2):i==="x"&&(l==="l"?h=p-d/2:l==="r"&&(h=u-d/2)),e.addStyle({left:`${h}px`},{partial:!0})}}function kp({snapping:n,editor:e,props:t}){var P,N;const{command:o,guidesMatched:s}=t,r=t.component,i=r.getEl(),l=e.Canvas.getCanvasView(),{x:a,y:c}=n??{x:10,y:10},d=o.opts.event,p=d.clientX,u=d.clientY;if(!r.__lastSnappedPosition){const O=l.getElBoxRect(i),R=p-O.x,F=u-O.y;r.__lastSnappedPosition={left:O.x,top:O.y},r.__dragOffset={x:R,y:F}}const h=((P=r.__dragOffset)==null?void 0:P.x)||0,f=((N=r.__dragOffset)==null?void 0:N.y)||0,m=r.__lastSnappedPosition,g=p-m.left-h,b=u-m.top-f;let w=m.left,y=m.top;const v=s==null?void 0:s[0],C=(v==null?void 0:v.guide.type)==="l",S=(v==null?void 0:v.guide.type)==="x",x=(v==null?void 0:v.guide.type)==="r",E=(v==null?void 0:v.guide.type)==="t",k=(v==null?void 0:v.guide.type)==="b",M=(v==null?void 0:v.guide.type)==="y";if(v){const{x:O,y:R}=Vo({guideMatched:v,canvasView:l}),F=i.offsetWidth,ie=i.offsetHeight;C?w=O:x?w=O-F:S?w=O-F/2:E?y=R:k?y=R-ie:M&&(y=R-ie/2),r.__lastSnappedGuideMatched=v}else Math.abs(g)>=a&&(w=Math.round((m.left+g)/a)*a,r.__lastSnappedGuideMatched=null),Math.abs(b)>=c&&(y=Math.round((m.top+b)/c)*c,r.__lastSnappedGuideMatched=null);return r.addStyle({left:`${w}px`,top:`${y}px`},{partial:!0}),r.__lastSnappedPosition={left:w,top:y},{x:w,y,guideMatched:r.__lastSnappedGuideMatched}}function Gb({snapping:n,props:e,editor:t}){const{x:o,y:s}=kp({snapping:n,props:e,editor:t}),r=e.component;r.addStyle({left:`${o}px`,top:`${s}px`}),delete r.__lastSnappedPosition,delete r.__lastSnappedGuideMatched}const Wb="core:component-drag",jb="studio:setDragAbsolute",qb="dmode:start",Oa="dmode:move",Ia="dmode:end",tr="dragAbsolute",Ub="select",Kb="hover",Jb="spacing",Zb=function(n,e={}){const{Commands:t}=n,o=t.events,s=t.getConfig().defaultOptions??{},r=`${o.runBeforeCommand}tlb-move`;s[Wb]={run:x=>({...x,skipGuidesRender:!0})};const{snapping:i,locking:l,globalAbsolute:a=!0}=e;a&&n.setDragMode("absolute");const c=!!(i!=null&&i.x||i!=null&&i.y),d=!!(l!=null&&l.x||l!=null&&l.y),{Canvas:p}=n;let u=null;const h=x=>{const{component:E,guidesMatched:k,command:M}=x,P=E.view,N=n.Canvas.getCanvasView(),O=E.getEl();let R=k.map(le=>le.matched.componentEl),F=k.map(le=>Vo({guideMatched:le,canvasView:N}));if(c){const{guideMatched:le}=kp({snapping:i,props:x,editor:n});le?(R=[le.matched.componentEl],F=[Vo({guideMatched:le,canvasView:N})]):(R=[],F=[])}if(d)if(M.opts.event.shiftKey)if(!u)u=k[0];else{const Ke=u,ve=Ke.guide.x===void 0?"x":"y";(ve==="x"&&(l==null?void 0:l.x)||ve==="y"&&(l==null?void 0:l.y))&&(_b({guideMatched:Ke,component:E,canvasView:N}),R=[Ke.matched.componentEl],F=[Vo({guideMatched:Ke,canvasView:N})])}else u=null;const ie={id:tr,type:tr,component:E,componentView:P,originComponent:O,matchedComponents:R,originMatchedDistances:F};p.addSpot(ie)},f=({enabled:x})=>{n.runCommand(jb,{enabled:x})},m=({type:x})=>{p.removeSpots({type:x})},g=()=>{m({type:Ub}),m({type:Kb}),m({type:Jb})},b=x=>{f({enabled:!0}),h(x),g()},w=x=>{h(x),g()},y=x=>{m({type:tr}),c&&Gb({snapping:i,props:x,editor:n}),f({enabled:!1})},S=[[qb,x=>{b(x),n.on(Oa,w);const E=()=>{y(x),n.off(Oa,w),n.off(Ia,E)};n.on(Ia,E)}],[r,x=>{if(a)return;const E=x.options.target,k=Fb(n,E,e);k!=null&&k.result&&!k.dmode&&(x.options.mode="absolute")}]];S.forEach(([x,E])=>n.on(x,E)),W({editor:n,licenseKey:e.licenseKey,plan:Hb,pluginName:Bb,cleanup:()=>{f({enabled:!1}),S.forEach(([x,E])=>n.off(x,E))}})},Yb=G(Zb);exports.accordionComponent=Ph;exports.animationComponent=af;exports.canvasAbsoluteMode=Yb;exports.canvasEmptyState=my;exports.canvasFullSize=Sy;exports.canvasGridMode=By;exports.canvasScreenshot=jy;exports.dataSourceEjs=ub;exports.dataSourceHandlebars=xb;exports.dialogComponent=Up;exports.flexComponent=Yh;exports.fsLightboxComponent=qu;exports.googleFontsAssetProvider=Vb;exports.iconifyComponent=lu;exports.layoutSidebarButtons=vp;exports.lightGalleryComponent=oh;exports.listPagesComponent=Fu;exports.presetPrintable=nb;exports.rteProseMirror=py;exports.rteTinyMce=Cf;exports.shapeDividerComponent=uf;exports.swiperComponent=vh;exports.tableComponent=Ru;exports.youtubeAssetProvider=Ab;
|
|
1898
|
+
`}handleCommentStatement(e){return`<!--${e.value}-->`}handleElementNode(e){let t="";if(e.attributes)for(const i of e.attributes)i.value.type==="TextNode"?t+=` ${i.name}="${i.value.chars}"`:(this.addMessage("warning",`Complex attribute values not fully supported: ${i.name}`,e.loc),t+=` ${i.name}="${this.getExpressionString(i.value)}"`);let o="";if(e.children)for(const i of e.children)o+=this.astToGrapesJS(i);return`<${e.tag}${t}>${o}</${e.tag}>`}handleTextNode(e){return e.chars||""}handlePartialStatement(e){return this.addMessage("warning",`Partials are not fully supported: ${e.name.original}`,e.loc),`{{> ${e.name.original}}}`}handleGenericBlock(e){const t=this.handleProgram(e.program);return`<!-- Unsupported block: ${e.path.original} -->${t}`}getExpressionString(e){return e.type==="PathExpression"?e.original:e.type==="StringLiteral"?e.value:e.type==="NumberLiteral"?e.value.toString():e.type==="BooleanLiteral"?e.value?"true":"false":e.type==="SubExpression"?this.getExpressionString(e.params[0]):e.type==="Hash"?`{${e.pairs.map(o=>`${o.key}=${this.getExpressionString(o.value)}`).join(", ")}}`:(this.addMessage("warning",`Complex expression type not fully supported: ${e.type}`,e.loc),"")}addMessage(e,t,o){this.messages.push({type:e,message:t,location:o?{line:o.start.line,column:o.start.column}:void 0})}}const is=n=>{if(n==null||n==="")return[];if(n===".")return["this"];if(n===".."||n==="../")return[".."];if(n.startsWith("../")){const s=n.substring(3);return["..",...is(s)]}const e=[];let t=0,o=n.replace(/\[(?:(['"])(.*?)\1|([^\]]*))\]/g,(s,l,a,c)=>{const d=a!==void 0?a:c||"";return e[t]=d,`__HANDLEBARS_PLACEHOLDER_${t++}__`});o=o.replace(/\//g,".");const i=o.split("."),r=[];for(const s of i){const l=/^__HANDLEBARS_PLACEHOLDER_(\d+)__$/.exec(s);if(l){const a=parseInt(l[1],10);r.push(e[a])}else s!==""&&r.push(s)}return r},lu="dataSourceHandlebars",fx=F.startup,hx=function(n,e={}){const t=ou(n,new px),o=iu(n,{contains:"{{",importer:new ux});q({editor:n,licenseKey:e.licenseKey,plan:fx,pluginName:lu,cleanup:()=>{t(),o()}})},mx=W(hx,lu),gx=n=>{const e={};for(const t of Object.keys(n)){let o=n[t];o&&(Array.isArray(o)?o=o.map(i=>i.toString()).join(","):o=o.toString(),e[t]=o)}return new URLSearchParams(e)},Wa="youtube-video",bx=n=>{const{apiKey:e,searchParams:t,thumbnailQuality:o="high"}=n,i=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",d=gx(l);return`${c}?${d}`},r=l=>{var a,c,d;return((a=l[o])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((d=l.medium)==null?void 0:d.url)||l.default.url},s=l=>{const a=r(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,type:Wa,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:[Wa],label:({editor:l})=>l.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:l,pageCustomData:a}){var g;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}),p={...c,...d};p.part?p.part.includes("snippet")||p.part.push("snippet"):p.part=["snippet"];const f=await(await fetch(i(p))).json();return(g=f.items)!=null&&g.length?{items:f.items.map(s),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}}]})}},yx={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},au="youtubeAssetProvider",xx=F.startup,vx=function(n,e){var c;const{skipVideoComponent:t,i18n:o={}}=e,i=bx(e);n.runCommand(G.assetProviderAdd,{provider:i});const r="search-on-youtube",s="video",l=(c=n.Components.getType(s))==null?void 0:c.model.prototype,a=d=>{n.Assets.open({modalTitle:n.I18n.t("youtubeAssetProvider.modalTitle"),providerId:i.id,typeId:i.types[0],providers:[],types:[],select:p=>{n.Assets.close(),d.set({videoId:p.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!t&&l&&n.Components.addType(s,{model:{getYoutubeTraits(){const[d,...p]=l.getYoutubeTraits.apply(this);return[d,{id:r,type:"button",label:n.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>a(this)},...p]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:d}=this,p=d.get("provider")||"";p!=null&&p.startsWith("yt")&&a(d)}}}),n.I18n.addMessages({en:yx,...o}),q({editor:n,licenseKey:e.licenseKey,plan:xx,pluginName:au,cleanup:()=>{n.runCommand(G.assetProviderRemove,{id:i.id}),!t&&l&&n.Components.addType(s,{model:{getYoutubeTraits(){return l.getYoutubeTraits.apply(this).filter(d=>d.id!==r)}}})}})},wx=W(vx,au),lo=n=>n.replaceAll('"',"").replaceAll("'",""),rs=n=>n.includes(",")?n:/\s/.test(n)?`'${lo(n)}'`:lo(n),qa=(n,e,t)=>({family:n,variant:e,...t}),cu=(n,e)=>{n=rs(n);const{menuVariant:t,variants:o}=e;return{family:n,familyLabel:lo(n),menuVariant:t&&qa(rs(`menuFont-${lo(n)}`),"regular",t),variants:Object.assign({},...Object.entries(o).map(([i,r])=>({[i]:qa(n,i,r)})))}},Ua=(n,e)=>{var l;const t=cu(n.family,n),o=t.menuVariant??((l=Object.values(t.variants))==null?void 0:l[0]);if(!o)return"Arial, Helvetica, sans-serif";const{source:i,descriptors:r}=o,s=lo(o.family);if(!e){const a=new FontFace(s,`url("${i}")`,r),c=Array.from(document.fonts.values()).filter(d=>d.family===s);for(const d of c)document.fonts.delete(d);document.fonts.add(a),a.load().catch(()=>{})}return rs(s)},Sx=n=>{const{family:e,menu:t,axes:o}=n,i=!!o,r=Object.assign({},...n.variants.map(s=>{var d,p;let l,a;if(i){const u=o.find(f=>f.tag==="wght");if(u){const{start:f,end:h}=u;l=`${f} ${h}`}}return l||(l=((d=s.match(/\d+/))==null?void 0:d[0])??"400"),a=((p=s.match(/[a-zA-Z]+/))==null?void 0:p[0])==="italic"?"italic":void 0,{[s]:{source:n.files[s],descriptors:{style:a,weight:l}}}}));return cu(e,{menuVariant:{source:t},variants:r})},Cx=n=>({id:`${n.family}/${n.version}`,type:"font",src:n.menu,name:n.family,customData:{font:Sx(n),needsLoading:!0}}),kx=n=>{const{font:e}=n.customData;return n.customData.needsLoading?(n.customData.needsLoading=!1,Ua(e)):Ua(e,!0)};let In;const Tx=n=>{const e=[];for(const t of Object.keys(n)){let o=n[t];o&&(Array.isArray(o)?e.push(...o.map(i=>[t,i.toString()])):(o=o.toString(),e.push([t,o])))}return new URLSearchParams(e)},Ex=n=>{const{apiKey:e,searchParams:t}=n,o=(i={})=>{const r="https://www.googleapis.com/webfonts/v1/webfonts",s=Tx(i);return`${r}?${s}`};return{id:"google-fonts",types:["font"],label:({editor:i})=>i.I18n.t("googleFontsAssetProvider.providerLabel"),search:{reloadOnInput:!1},async onLoad(){var c;if(In)return In;const i={key:e,sort:"alpha",subset:"latin",capability:["WOFF2","VF"]},r=t==null?void 0:t(),s={...i,...r},a=await(await fetch(o(s))).json();return(c=a.items)!=null&&c.length?(In=a.items.map(Cx),In):[]},itemLayout:i=>{const r=In.find(l=>l.id===i.assetProps.id),s=kx(r);return{type:"column",onClick:()=>i.onSelect(r),htmlAttrs:{title:r.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"text",content:r.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:s,fontSize:"24px",paddingLeft:"8px",paddingRight:"8px"}},{type:"text",content:r.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"16px",paddingLeft:"8px",paddingRight:"8px"}}]}}}},Mx={googleFontsAssetProvider:{searchBtn:"Search on Google Fonts",modalTitle:"Select Font",providerLabel:"Google Fonts"}},du="googleFontsAssetProvider",Ax=F.startup,jx=function(n,e){const{i18n:t={}}=e,o=Ex(e);n.runCommand(G.assetProviderAdd,{provider:o}),n.I18n.addMessages({en:Mx,...t}),q({editor:n,licenseKey:e.licenseKey,plan:Ax,pluginName:du,cleanup:()=>{n.runCommand(G.assetProviderRemove,{id:o.id})}})},$x=W(jx,du),pu="canvasAbsoluteMode",Px=F.startup,Nx=(n,e,t)=>{var c,d;const o=t.enableAbsolute??(p=>p.hasAbsolute),r=(Array.isArray(e)?e:e?[e]:[...n.getSelectedAll()])[0],s=((d=(c=r==null?void 0:r.delegate)==null?void 0:c.move)==null?void 0:d.call(c,r))||r;if(!s)return;const l=s.getEl();return{result:We(o)?o({component:s,hasAbsolute:!!l&&getComputedStyle(l).position==="absolute"}):!1,component:s,dmode:s.get("dmode")}};function Fo({guideMatched:n,canvasView:e}){var A;const t=n.guide.x===void 0?"y":"x";let o=0,i=0,r=0,s=0;const{guide:l,matched:a}=n,c=e.getElBoxRect(l.componentView.el),d=e.getElBoxRect(((A=a.componentView)==null?void 0:A.el)||a.componentEl),p=c.y,u=c.y+c.height,f=c.x,h=c.x+c.width,g=d.y,b=d.y+d.height,x=d.x,C=d.x+d.width,y=Math.max(0,p-b),v=Math.max(0,g-u),k=Math.max(0,f-C),w=Math.max(0,x-h),S=y>v,E=k>w,T=l.type;return t==="x"&&(T==="l"?(o=f,S?(i=b,r=y):(i=u,r=v)):T==="r"?(o=h,S?(i=b,r=y):(i=u,r=v)):T==="x"&&(o=f-(f-h)/2,S?(i=b,r=y):(i=u,r=v))),t==="y"&&(T==="t"?(i=p,E?(o=C,s=k):(o=h,s=w)):T==="b"?(i=u,E?(o=C,s=k):(o=h,s=w)):T==="y"&&(i=p-(p-u)/2,E?(o=C,s=k):(o=h,s=w))),{axis:t,x:o,y:i,width:s,height:r}}function Ox({guideMatched:n,component:e,canvasView:t}){const o=n.guide.x===void 0?"x":"y",{guide:i,matched:r}=n,s=i.type,l=r.type,a=t.getElementPos(i.componentView.el).rect,c=t.getElementPos(r.componentView.el).rect;if(o==="x"){const d=a.height,p=c.top,u=c.top+c.height;let f=0;s==="t"?l==="t"?f=p-d:l==="b"?f=u-d:l==="y"&&(f=p-d-(p-u)/2):s==="b"?l==="t"?f=p-d*2:l==="b"?f=u-d*2:l==="y"&&(f=p-d*2-(p-u)/2):s==="y"&&(l==="t"?f=p-d*1.5:l==="b"?f=u-d*1.5:l==="y"&&(f=p-d*1.5-(p-u)/2)),e.addStyle({top:`${f-5}px`},{partial:!0})}if(o==="y"){const d=a.width,p=c.left,u=c.left+c.width;let f=0;s==="l"?l==="l"?f=p:l==="r"?f=u:l==="x"&&(f=p-(p-u)/2):s==="r"?l==="l"?f=p-d:l==="r"?f=u-d:l==="x"&&(f=p-d-(p-u)/2):s==="x"&&(l==="l"?f=p-d/2:l==="r"&&(f=u-d/2)),e.addStyle({left:`${f}px`},{partial:!0})}}function uu({snapping:n,editor:e,props:t}){var $,P;const{command:o,guidesMatched:i}=t,r=t.component,s=r.getEl(),l=e.Canvas.getCanvasView(),{x:a,y:c}=n??{x:10,y:10},d=o.opts.event,p=d.clientX,u=d.clientY;if(!r.__lastSnappedPosition){const N=l.getElBoxRect(s),I=p-N.x,_=u-N.y;r.__lastSnappedPosition={left:N.x,top:N.y},r.__dragOffset={x:I,y:_}}const f=(($=r.__dragOffset)==null?void 0:$.x)||0,h=((P=r.__dragOffset)==null?void 0:P.y)||0,g=r.__lastSnappedPosition,b=p-g.left-f,x=u-g.top-h;let C=g.left,y=g.top;const v=i==null?void 0:i[0],k=(v==null?void 0:v.guide.type)==="l",w=(v==null?void 0:v.guide.type)==="x",S=(v==null?void 0:v.guide.type)==="r",E=(v==null?void 0:v.guide.type)==="t",T=(v==null?void 0:v.guide.type)==="b",A=(v==null?void 0:v.guide.type)==="y";if(v){const{x:N,y:I}=Fo({guideMatched:v,canvasView:l}),_=s.offsetWidth,ae=s.offsetHeight;k?C=N:S?C=N-_:w?C=N-_/2:E?y=I:T?y=I-ae:A&&(y=I-ae/2),r.__lastSnappedGuideMatched=v}else Math.abs(b)>=a&&(C=Math.round((g.left+b)/a)*a,r.__lastSnappedGuideMatched=null),Math.abs(x)>=c&&(y=Math.round((g.top+x)/c)*c,r.__lastSnappedGuideMatched=null);return r.addStyle({left:`${C}px`,top:`${y}px`},{partial:!0}),r.__lastSnappedPosition={left:C,top:y},{x:C,y,guideMatched:r.__lastSnappedGuideMatched}}function Ix({snapping:n,props:e,editor:t}){const{x:o,y:i}=uu({snapping:n,props:e,editor:t}),r=e.component;r.addStyle({left:`${o}px`,top:`${i}px`}),delete r.__lastSnappedPosition,delete r.__lastSnappedGuideMatched}const Dx="core:component-drag",zx="studio:setDragAbsolute",Rx="dmode:start",Ka="dmode:move",Ja="dmode:end",cr="dragAbsolute",Lx="select",Bx="hover",Vx="spacing",Hx=function(n,e={}){const{Commands:t}=n,o=t.events,i=t.getConfig().defaultOptions??{},r=`${o.runBeforeCommand}tlb-move`;i[Dx]={run:S=>({...S,skipGuidesRender:!0})};const{snapping:s,locking:l,globalAbsolute:a=!0}=e;a&&n.setDragMode("absolute");const c=!!(s!=null&&s.x||s!=null&&s.y),d=!!(l!=null&&l.x||l!=null&&l.y),{Canvas:p}=n;let u=null;const f=S=>{const{component:E,guidesMatched:T,command:A}=S,$=E.view,P=n.Canvas.getCanvasView(),N=E.getEl();let I=T.map(ce=>ce.matched.componentEl),_=T.map(ce=>Fo({guideMatched:ce,canvasView:P}));if(c){const{guideMatched:ce}=uu({snapping:s,props:S,editor:n});ce?(I=[ce.matched.componentEl],_=[Fo({guideMatched:ce,canvasView:P})]):(I=[],_=[])}if(d)if(A.opts.event.shiftKey)if(!u)u=T[0];else{const Ze=u,we=Ze.guide.x===void 0?"x":"y";(we==="x"&&(l==null?void 0:l.x)||we==="y"&&(l==null?void 0:l.y))&&(Ox({guideMatched:Ze,component:E,canvasView:P}),I=[Ze.matched.componentEl],_=[Fo({guideMatched:Ze,canvasView:P})])}else u=null;const ae={id:cr,type:cr,component:E,componentView:$,originComponent:N,matchedComponents:I,originMatchedDistances:_};p.addSpot(ae)},h=({enabled:S})=>{n.runCommand(zx,{enabled:S})},g=({type:S})=>{p.removeSpots({type:S})},b=()=>{g({type:Lx}),g({type:Bx}),g({type:Vx})},x=S=>{h({enabled:!0}),f(S),b()},C=S=>{f(S),b()},y=S=>{g({type:cr}),c&&Ix({snapping:s,props:S,editor:n}),h({enabled:!1})},w=[[Rx,S=>{x(S),n.on(Ka,C);const E=()=>{y(S),n.off(Ka,C),n.off(Ja,E)};n.on(Ja,E)}],[r,S=>{if(a)return;const E=S.options.target,T=Nx(n,E,e);T!=null&&T.result&&!T.dmode&&(S.options.mode="absolute")}]];w.forEach(([S,E])=>n.on(S,E)),q({editor:n,licenseKey:e.licenseKey,plan:Px,pluginName:pu,cleanup:()=>{h({enabled:!1}),w.forEach(([S,E])=>n.off(S,E))}})},Fx=W(Hx,pu);exports.accordionComponent=uh;exports.animationComponent=Fh;exports.canvasAbsoluteMode=Fx;exports.canvasEmptyState=Wb;exports.canvasFullSize=Yb;exports.canvasGridMode=my;exports.canvasScreenshot=vy;exports.dataSourceEjs=lx;exports.dataSourceHandlebars=mx;exports.dialogComponent=zu;exports.flexComponent=Oh;exports.fsLightboxComponent=Nf;exports.googleFontsAssetProvider=$x;exports.iconifyComponent=Ju;exports.layoutSidebarButtons=Xp;exports.lightGalleryComponent=Ff;exports.listPagesComponent=Af;exports.presetBlockLibrary=Xy;exports.presetPrintable=$y;exports.rteProseMirror=Fb;exports.rteTinyMce=tm;exports.shapeDividerComponent=Wh;exports.swiperComponent=oh;exports.tableComponent=wf;exports.youtubeAssetProvider=wx;
|