@veevarts/design-system 1.0.0-alpha.10 → 1.0.0-alpha.12
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/components/index.d.ts +12 -0
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8004 -8512
- package/dist/patterns/EventDetails/EventDetails.d.ts +1 -1
- package/dist/patterns/RevenueDistribution/RevenueDistributionCard.d.ts +16 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionCard.test.d.ts +1 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionEmpty.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionError.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionSkeleton.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/examples/InteractiveExample.d.ts +8 -0
- package/dist/patterns/RevenueDistribution/examples/MultipleDistributionsFormExample.d.ts +10 -0
- package/dist/patterns/RevenueDistribution/examples/WithGlAccountSearchExample.d.ts +7 -0
- package/dist/patterns/RevenueDistribution/examples/index.d.ts +9 -0
- package/dist/patterns/RevenueDistribution/index.d.ts +14 -0
- package/dist/patterns/RevenueDistribution/types.d.ts +394 -0
- package/dist/patterns/RevenueDistribution/utils/amount.d.ts +56 -0
- package/dist/patterns/RevenueDistribution/utils/data.d.ts +4 -0
- package/dist/patterns/RevenueDistribution/utils/index.d.ts +5 -0
- package/dist/patterns/RichText/TipTapArea/TipTapArea.d.ts +1 -1
- package/dist/patterns/RichText/types/props.d.ts +1 -1
- package/dist/patterns/Stepper/Stepper.d.ts +1 -1
- package/dist/patterns/index.d.ts +1 -2
- package/dist/tokens/colors.d.ts +39 -0
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),m=require("@heroui/react"),k=require("react"),v=require("lucide-react"),Y=require("framer-motion"),hn=require("@tiptap/react"),C=require("@tiptap/core"),qs=require("@tiptap/extension-underline"),Vs=require("@tiptap/extension-color"),Ks=require("@tiptap/extension-highlight"),Us=require("@tiptap/extension-link"),Js=require("@tiptap/extension-task-list"),Ws=require("@tiptap/extension-task-item"),_s=require("@tiptap/extension-text-align"),Gt={brand:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:"#C14615",600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:"#C14615"}},semantic:{secondary:"#000000",success:"#057A54",warning:"#F5A524",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",black:"#000000",gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"}}},Gs={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},Zs={fontFamily:{primary:'"NeueMontreal", system-ui, sans-serif',secondary:'"Scholar", Georgia, serif',sans:'"NeueMontreal", system-ui, sans-serif',serif:'"Scholar", Georgia, serif',mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem"},fontWeight:{normal:"400",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},Qs={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:Gt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:Gt.brand.primary},secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"}}};function Xs({children:t}){return u.jsx(m.HeroUIProvider,{children:t})}function ht({color:t="primary",radius:e="full",...n}){return u.jsx(m.Button,{color:t,radius:e,...n})}const Ys={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function ei({languages:t,selectedLanguage:e,onLanguageChange:n,label:r}){return u.jsx("div",{className:"flex items-center",children:u.jsxs("div",{className:"relative flex items-center",children:[u.jsx(v.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),u.jsx(m.Select,{"data-testid":"language-select-desktop","aria-label":r,selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;n?.(i)},className:"min-w-40 hidden md:inline-flex",isDisabled:t.length===0,placeholder:r,startContent:u.jsx(v.Globe,{className:"w-5 h-5 text-black"}),children:t.map(s=>u.jsx(m.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),u.jsx(m.Select,{"aria-label":r,"data-testid":"language-select-mobile",selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;n?.(i)},className:"min-w-20 inline-flex md:hidden",isDisabled:t.length===0,placeholder:e||"Language",children:t.map(s=>u.jsx(m.SelectItem,{className:"min-w-4",textValue:s.code.toUpperCase(),"data-testid":`language-select-option-mobile-${s.code}`,children:s.code.toUpperCase()},s.code))})]})})}function ti({isLoggedIn:t,onLogin:e,onLogout:n,labels:r}){return t?u.jsxs(m.Button,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,children:[u.jsx(v.User,{className:"inline w-5 h-5"}),u.jsx("span",{className:"hidden md:inline",children:r.logout})]}):u.jsxs(m.Button,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:e,children:[u.jsx(v.User,{className:"inline w-5 h-5"}),u.jsx("span",{className:"hidden md:inline",children:r.login})]})}function ni({logo:t,languages:e=[],selectedLanguage:n,onLanguageChange:r,isLoggedIn:s,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:a,labels:c={},className:d}){const f={...Ys,...c};return u.jsxs("nav",{"data-testid":"navbar",className:m.cn("w-full px-4 md:px-8 py-4 bg-white border-b border-zinc-100 flex items-center justify-between",d),children:[u.jsx("div",{className:"flex items-center min-w-10",children:t&&u.jsx("a",{href:"/",className:"block",children:u.jsx("img",{"data-testid":"navbar-logo",src:t,alt:"Logo",className:"h-8 max-w-28 md:max-w-40"})})}),u.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||e.length>0)&&u.jsx(ei,{languages:e,selectedLanguage:n,onLanguageChange:r,label:f.selectLanguage}),a&&u.jsx(ti,{isLoggedIn:s,onLogin:i,onLogout:o,labels:f})]})]})}var jt;const ri=typeof document<"u"?(jt=k.useInsertionEffect)!==null&&jt!==void 0?jt:k.useLayoutEffect:()=>{};function pn(t,e,n){let[r,s]=k.useState(t||e),i=k.useRef(r),o=k.useRef(t!==void 0),l=t!==void 0;k.useEffect(()=>{let f=o.current;f!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let a=l?t:r;ri(()=>{i.current=a});let[,c]=k.useReducer(()=>({}),{}),d=k.useCallback((f,...h)=>{let p=typeof f=="function"?f(i.current):f;Object.is(i.current,p)||(i.current=p,s(p),c(),n?.(p,...h))},[n]);return[a,d]}function si(t){return u.jsx("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:u.jsx(Y.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const wr=k.forwardRef(({color:t="primary",stepsCount:e=3,defaultStep:n=0,label:r,onStepChange:s,currentStep:i,hideProgressBars:o=!1,stepClassName:l,className:a,...c},d)=>{const[f,h]=pn(i,n,s),p=k.useMemo(()=>{let x,g;const y=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(t){case"primary":x="[--step-color:var(--heroui-primary)]",g="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":x="[--step-color:var(--heroui-secondary)]",g="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":x="[--step-color:var(--heroui-success)]",g="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":x="[--step-color:var(--heroui-warning)]",g="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":x="[--step-color:var(--heroui-danger)]",g="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":x="[--step-color:var(--heroui-default)]",g="[--step-fg-color:var(--heroui-default-foreground)]";break;default:x="[--step-color:var(--heroui-primary)]",g="[--step-fg-color:var(--heroui-primary-foreground)]";break}return y.unshift(g),y.unshift(x),y},[t]);return u.jsxs("nav",{ref:d,"aria-label":"Progress",className:m.cn("flex max-w-fit items-center overflow-x-auto",a),"data-testid":"stepper-root",...c,children:[r&&u.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light w-full me-3","data-testid":"stepper-label",children:r}),u.jsx("ol",{className:m.cn("flex flex-row flex-nowrap gap-x-3",p,a),"data-testid":"stepper-list",children:Array.from({length:e})?.map((x,g)=>{const y=f===g?"active":f<g?"inactive":"complete";return u.jsx("li",{className:"relative flex w-full items-center pr-12","data-testid":`stepper-step-${g}`,children:u.jsxs("button",{"aria-current":y==="active"?"step":void 0,className:m.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",l),onClick:()=>h(g),"data-testid":`stepper-step-btn-${g}`,children:[u.jsx("div",{className:"h-full relative flex items-center",children:u.jsx(Y.LazyMotion,{features:Y.domAnimation,children:u.jsx(Y.m.div,{animate:y,className:"relative",children:u.jsx(Y.m.div,{animate:y,className:m.cn("border-medium text-large text-default-foreground relative flex h-[26px] w-[26px] items-center justify-center rounded-full font-semibold",{"shadow-lg":y==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:u.jsx("div",{className:"flex items-center justify-center",children:y==="complete"?u.jsx(si,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${g}`}):u.jsx("span",{})})})})})}),g<e-1&&!o&&u.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 left-[26px] w-[calc(100%-13px)] flex-none items-center",style:{"--idx":g},children:u.jsx("div",{className:m.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":g<f})})})]},g)},g)})})]})});wr.displayName="Stepper";function ii(){return u.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}function _e(t){return typeof t=="string"?t:t.type}function ye({className:t}){return u.jsx("div",{className:`flex items-center h-6 ${t||""}`,children:u.jsx(m.Divider,{orientation:"vertical"})})}function ae({icon:t,label:e,isActive:n=!1,isDisabled:r=!1,onClick:s,shortcut:i,iconSize:o=16,className:l}){const a=i?`${e} (${i})`:e;return u.jsx(m.Tooltip,{content:a,children:u.jsx(m.Button,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:r,onPress:s,"aria-label":e,className:l,children:u.jsx(t,{size:o})})})}const oe={bold:{execute:({editor:t})=>t.chain().focus().toggleBold().run(),canExecute:t=>t.can().chain().focus().toggleBold().run(),isActive:t=>t.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:t})=>t.chain().focus().toggleItalic().run(),canExecute:t=>t.can().chain().focus().toggleItalic().run(),isActive:t=>t.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:t})=>t.chain().focus().toggleStrike().run(),canExecute:t=>t.can().chain().focus().toggleStrike().run(),isActive:t=>t.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:t})=>t.chain().focus().toggleUnderline().run(),canExecute:t=>t.can().chain().focus().toggleUnderline().run(),isActive:t=>t.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:t})=>t.chain().focus().toggleCode().run(),canExecute:t=>t.can().chain().focus().toggleCode().run(),isActive:t=>t.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:t,config:e})=>{const n=e?.type==="textColor"?e.color:"";n?t.chain().focus().setColor(n).run():t.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:t=>t.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:t,config:e})=>{const n=e?.type==="highlight"?e.color:"";n?t.chain().focus().setHighlight({color:n}).run():t.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:t=>t.isActive("highlight"),label:"Highlight"},link:{execute:({editor:t,config:e})=>{const n=e?.type==="link"?e.href:"";if(n){const r=e?.type==="link"?e.target:void 0,s=e?.type==="link"?e.rel:void 0;t.chain().focus().setLink({href:n,target:r,rel:s}).run()}else t.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:t=>t.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:t})=>t.chain().focus().setParagraph().run(),canExecute:t=>t.can().chain().focus().setParagraph().run(),isActive:t=>t.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:t,config:e})=>{const n=e?.type==="heading"?e.level:1;t.chain().focus().toggleHeading({level:n}).run()},canExecute:(t,e)=>{const n=e?.type==="heading"?e.level:1;return t.can().chain().focus().toggleHeading({level:n}).run()},isActive:(t,e)=>e?.type==="heading"?t.isActive("heading",{level:e.level}):t.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:t})=>t.chain().focus().toggleBulletList().run(),canExecute:t=>t.can().chain().focus().toggleBulletList().run(),isActive:t=>t.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:t})=>t.chain().focus().toggleOrderedList().run(),canExecute:t=>t.can().chain().focus().toggleOrderedList().run(),isActive:t=>t.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:t})=>t.chain().focus().toggleTaskList().run(),canExecute:t=>t.can().chain().focus().toggleTaskList().run(),isActive:t=>t.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:t})=>t.chain().focus().toggleCodeBlock().run(),canExecute:t=>t.can().chain().focus().toggleCodeBlock().run(),isActive:t=>t.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:t})=>t.chain().focus().toggleBlockquote().run(),canExecute:t=>t.can().chain().focus().toggleBlockquote().run(),isActive:t=>t.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:t})=>t.chain().focus().setHorizontalRule().run(),canExecute:t=>t.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:t})=>t.chain().focus().setHardBreak().run(),canExecute:t=>t.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:t,config:e})=>{const n=e?.type==="textAlign"?e.alignment:"left";t.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(t,e)=>e?.type==="textAlign"?t.isActive({textAlign:e.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:t})=>t.chain().focus().unsetAllMarks().run(),canExecute:t=>t.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:t})=>t.chain().focus().clearNodes().run(),canExecute:t=>t.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:t})=>t.chain().focus().undo().run(),canExecute:t=>t.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:t})=>t.chain().focus().redo().run(),canExecute:t=>t.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},oi={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function li({editor:t,levels:e=[1,2,3,4,5,6],isDisabled:n=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const o=()=>r(l=>l+1);return t.on("selectionUpdate",o),t.on("transaction",o),()=>{t.off("selectionUpdate",o),t.off("transaction",o)}},[t]);const s=e.find(o=>t.isActive("heading",{level:o})),i=o=>{const l=Number(o),a=oe.heading;a&&a.execute({editor:t,config:{type:"heading",level:l}})};return u.jsxs(m.Dropdown,{children:[u.jsx(m.DropdownTrigger,{children:u.jsx(m.Button,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:n,startContent:u.jsx(v.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),u.jsx(m.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>u.jsx(m.DropdownItem,{startContent:t.isActive("heading",{level:o})?u.jsx(v.Check,{size:16}):u.jsx("div",{className:"w-4"}),children:oi[o]},o))})]})}const Dt={bulletList:{label:"Bullet List",icon:v.List},orderedList:{label:"Numbered List",icon:v.ListOrdered},taskList:{label:"Task List",icon:v.ListTodo}};function ai({editor:t,types:e=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const l=()=>r(a=>a+1);return t.on("selectionUpdate",l),t.on("transaction",l),()=>{t.off("selectionUpdate",l),t.off("transaction",l)}},[t]);const s=e.find(l=>t.isActive(l)),i=s?Dt[s].icon:v.List,o=l=>{const c=oe[l];c&&c.execute({editor:t})};return u.jsxs(m.Dropdown,{children:[u.jsx(m.DropdownTrigger,{children:u.jsx(m.Button,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:n,isIconOnly:!0,"aria-label":"Select list type",children:u.jsx(i,{size:16})})}),u.jsx(m.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=Dt[l].icon;return u.jsx(m.DropdownItem,{startContent:u.jsx(a,{size:16}),children:Dt[l].label},l)})})]})}function ci({colors:t,selectedColor:e,onColorSelect:n,columns:r=4}){return u.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:t.map(s=>{const i=e===s;return u.jsx("button",{type:"button",onClick:()=>n(s),className:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),A=require("@heroui/react"),k=require("react"),S=require("lucide-react"),Re=require("framer-motion"),an=require("@tiptap/react"),b=require("@tiptap/core"),Is=require("@tiptap/extension-underline"),Os=require("@tiptap/extension-color"),Ds=require("@tiptap/extension-highlight"),Ls=require("@tiptap/extension-link"),Rs=require("@tiptap/extension-task-list"),Ps=require("@tiptap/extension-task-item"),js=require("@tiptap/extension-text-align"),Kt={brand:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:"#C14615",600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:"#C14615"}},semantic:{secondary:"#000000",success:"#057A54",warning:"#F5A524",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",black:"#000000",gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"},danger:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#B62214",600:"#a31e12",700:"#8b1a0f",800:"#73160d",900:"#5c120a",DEFAULT:"#B62214"},success:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#057A54",600:"#046c4a",700:"#035e40",800:"#025035",900:"#01422b",DEFAULT:"#057A54"},warning:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#F5A524",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",DEFAULT:"#F5A524"}}},Fs={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},zs={fontFamily:{primary:'"NeueMontreal", system-ui, sans-serif',secondary:'"Scholar", Georgia, serif',sans:'"NeueMontreal", system-ui, sans-serif',serif:'"Scholar", Georgia, serif',mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem"},fontWeight:{normal:"400",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},Bs={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:Kt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:Kt.brand.primary},secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"}}};function Hs({children:n}){return d.jsx(A.HeroUIProvider,{children:n})}function Z({color:n="primary",radius:e="full",...t}){return d.jsx(A.Button,{color:n,radius:e,...t})}function $s(n,e){const t=n.icons,r=n.aliases||Object.create(null),s=Object.create(null);function i(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(t).concat(Object.keys(r)).forEach(i),s}const xr=Object.freeze({left:0,top:0,width:16,height:16}),ot=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cn=Object.freeze({...xr,...ot}),Jt=Object.freeze({...cn,body:"",hidden:!1});function Vs(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const r=((n.rotate||0)+(e.rotate||0))%4;return r&&(t.rotate=r),t}function Mn(n,e){const t=Vs(n,e);for(const r in Jt)r in ot?r in n&&!(r in t)&&(t[r]=ot[r]):r in e?t[r]=e[r]:r in n&&(t[r]=n[r]);return t}function qs(n,e,t){const r=n.icons,s=n.aliases||Object.create(null);let i={};function o(l){i=Mn(r[l]||s[l],i)}return o(e),t.forEach(o),Mn(n,i)}function br(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(s=>{e(s,null),t.push(s)});const r=$s(n);for(const s in r){const i=r[s];i&&(e(s,qs(n,s,i)),t.push(s))}return t}const Ks={provider:"",aliases:{},not_found:{},...xr};function wt(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function kr(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!wt(n,Ks))return null;const t=e.icons;for(const s in t){const i=t[s];if(!s||typeof i.body!="string"||!wt(i,Jt))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!t[o]&&!r[o]||!wt(i,Jt))return null}return e}const wn=Object.create(null);function Js(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Ie(n,e){const t=wn[n]||(wn[n]=Object.create(null));return t[e]||(t[e]=Js(n,e))}function Sr(n,e){return kr(e)?br(e,(t,r)=>{r?n.icons[t]=r:n.missing.add(t)}):[]}function Us(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}const Cr=/^[a-z0-9]+(-[a-z0-9]+)*$/,yt=(n,e,t,r="")=>{const s=n.split(":");if(n.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),c={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!tt(c)?null:c}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!tt(l)?null:l}if(t&&r===""){const l={provider:r,prefix:"",name:i};return e&&!tt(l,t)?null:l}return null},tt=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;let He=!1;function Ar(n){return typeof n=="boolean"&&(He=n),He}function Nn(n){const e=typeof n=="string"?yt(n,!0,He):n;if(e){const t=Ie(e.provider,e.prefix),r=e.name;return t.icons[r]||(t.missing.has(r)?null:void 0)}}function Ws(n,e){const t=yt(n,!0,He);if(!t)return!1;const r=Ie(t.provider,t.prefix);return e?Us(r,t.name,e):(r.missing.add(t.name),!0)}function _s(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),He&&!e&&!n.prefix){let s=!1;return kr(n)&&(n.prefix="",br(n,(i,o)=>{Ws(i,o)&&(s=!0)})),s}const t=n.prefix;if(!tt({prefix:t,name:"a"}))return!1;const r=Ie(e,t);return!!Sr(r,n)}const Tr=Object.freeze({width:null,height:null}),Er=Object.freeze({...Tr,...ot}),Gs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Zs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function In(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const r=n.split(Gs);if(r===null||!r.length)return n;const s=[];let i=r.shift(),o=Zs.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*t)/t)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function Xs(n,e="defs"){let t="";const r=n.indexOf("<"+e);for(;r>=0;){const s=n.indexOf(">",r),i=n.indexOf("</"+e);if(s===-1||i===-1)break;const o=n.indexOf(">",i);if(o===-1)break;t+=n.slice(s+1,i).trim(),n=n.slice(0,r).trim()+n.slice(o+1)}return{defs:t,content:n}}function Qs(n,e){return n?"<defs>"+n+"</defs>"+e:e}function Ys(n,e,t){const r=Xs(n);return Qs(r.defs,e+r.content+t)}const ei=n=>n==="unset"||n==="undefined"||n==="none";function ti(n,e){const t={...cn,...n},r={...Er,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let i=t.body;[t,r].forEach(m=>{const g=[],x=m.hFlip,w=m.vFlip;let N=m.rotate;x?w?N+=2:(g.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),g.push("scale(-1 1)"),s.top=s.left=0):w&&(g.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),g.push("scale(1 -1)"),s.top=s.left=0);let O;switch(N<0&&(N-=Math.floor(N/4)*4),N=N%4,N){case 1:O=s.height/2+s.top,g.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:g.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:O=s.width/2+s.left,g.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}N%2===1&&(s.left!==s.top&&(O=s.left,s.left=s.top,s.top=O),s.width!==s.height&&(O=s.width,s.width=s.height,s.height=O)),g.length&&(i=Ys(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,c=s.height;let u,f;o===null?(f=l===null?"1em":l==="auto"?c:l,u=In(f,a/c)):(u=o==="auto"?a:o,f=l===null?In(u,c/a):l==="auto"?c:l);const h={},p=(m,g)=>{ei(g)||(h[m]=g.toString())};p("width",u),p("height",f);const y=[s.left,s.top,a,c];return h.viewBox=y.join(" "),{attributes:h,viewBox:y,body:i}}const ni=/\sid="(\S+)"/g,ri="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let si=0;function ii(n,e=ri){const t=[];let r;for(;r=ni.exec(n);)t.push(r[1]);if(!t.length)return n;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(i=>{const o=typeof e=="function"?e(i):e+(si++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),n=n.replace(new RegExp(s,"g"),""),n}const Ut=Object.create(null);function oi(n,e){Ut[n]=e}function Wt(n){return Ut[n]||Ut[""]}function un(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const fn=Object.create(null),Oe=["https://api.simplesvg.com","https://api.unisvg.com"],nt=[];for(;Oe.length>0;)Oe.length===1||Math.random()>.5?nt.push(Oe.shift()):nt.push(Oe.pop());fn[""]=un({resources:["https://api.iconify.design"].concat(nt)});function li(n,e){const t=un(e);return t===null?!1:(fn[n]=t,!0)}function dn(n){return fn[n]}const ai=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let On=ai();function ci(n,e){const t=dn(n);if(!t)return 0;let r;if(!t.maxURL)r=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=t.maxURL-s-t.path.length-i.length}return r}function ui(n){return n===404}const fi=(n,e,t)=>{const r=[],s=ci(n,e),i="icons";let o={type:i,provider:n,prefix:e,icons:[]},l=0;return t.forEach((a,c)=>{l+=a.length+1,l>=s&&c>0&&(r.push(o),o={type:i,provider:n,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function di(n){if(typeof n=="string"){const e=dn(n);if(e)return e.path}return"/"}const hi=(n,e,t)=>{if(!On){t("abort",424);return}let r=di(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:t("abort",400);return}let s=503;On(n+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{t(ui(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?t("abort",i):t("next",s)});return}setTimeout(()=>{t("success",i)})}).catch(()=>{t("next",s)})},pi={prepare:fi,send:hi};function vr(n,e){n.forEach(t=>{const r=t.loaderCallbacks;r&&(t.loaderCallbacks=r.filter(s=>s.id!==e))})}function mi(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const r=n.provider,s=n.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const c=a.name;if(n.icons[c])o.loaded.push({provider:r,prefix:s,name:c});else if(n.missing.has(c))o.missing.push({provider:r,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==l&&(t||vr([n],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let gi=0;function yi(n,e,t){const r=gi++,s=vr.bind(null,t,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:n,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function xi(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return n.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=t[i]||(t[i]=Object.create(null)),c=a[o]||(a[o]=Ie(i,o));let u;l in c.icons?u=e.loaded:o===""||c.missing.has(l)?u=e.missing:u=e.pending;const f={provider:i,prefix:o,name:l};u.push(f)}),e}function bi(n,e=!0,t=!1){const r=[];return n.forEach(s=>{const i=typeof s=="string"?yt(s,e,t):s;i&&r.push(i)}),r}const ki={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Si(n,e,t,r){const s=n.resources.length,i=n.random?Math.floor(Math.random()*s):n.index;let o;if(n.random){let T=n.resources.slice(0);for(o=[];T.length>1;){const C=Math.floor(Math.random()*T.length);o.push(T[C]),T=T.slice(0,C).concat(T.slice(C+1))}o=o.concat(T)}else o=n.resources.slice(i).concat(n.resources.slice(0,i));const l=Date.now();let a="pending",c=0,u,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function y(){f&&(clearTimeout(f),f=null)}function m(){a==="pending"&&(a="aborted"),y(),h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function g(T,C){C&&(p=[]),typeof T=="function"&&p.push(T)}function x(){return{startTime:l,payload:e,status:a,queriesSent:c,queriesPending:h.length,subscribe:g,abort:m}}function w(){a="failed",p.forEach(T=>{T(void 0,u)})}function N(){h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function O(T,C,V){const U=C!=="success";switch(h=h.filter(W=>W!==T),a){case"pending":break;case"failed":if(U||!n.dataAfterTimeout)return;break;default:return}if(C==="abort"){u=V,w();return}if(U){u=V,h.length||(o.length?P():w());return}if(y(),N(),!n.random){const W=n.resources.indexOf(T.resource);W!==-1&&W!==n.index&&(n.index=W)}a="completed",p.forEach(W=>{W(V)})}function P(){if(a!=="pending")return;y();const T=o.shift();if(T===void 0){if(h.length){f=setTimeout(()=>{y(),a==="pending"&&(N(),w())},n.timeout);return}w();return}const C={status:"pending",resource:T,callback:(V,U)=>{O(C,V,U)}};h.push(C),c++,f=setTimeout(P,n.rotate),t(T,e,C.callback)}return setTimeout(P),x}function Mr(n){const e={...ki,...n};let t=[];function r(){t=t.filter(l=>l().status==="pending")}function s(l,a,c){const u=Si(e,l,a,(f,h)=>{r(),c&&c(f,h)});return t.push(u),u}function i(l){return t.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function Dn(){}const Nt=Object.create(null);function Ci(n){if(!Nt[n]){const e=dn(n);if(!e)return;const t=Mr(e),r={config:e,redundancy:t};Nt[n]=r}return Nt[n]}function Ai(n,e,t){let r,s;if(typeof n=="string"){const i=Wt(n);if(!i)return t(void 0,424),Dn;s=i.send;const o=Ci(n);o&&(r=o.redundancy)}else{const i=un(n);if(i){r=Mr(i);const o=n.resources?n.resources[0]:"",l=Wt(o);l&&(s=l.send)}}return!r||!s?(t(void 0,424),Dn):r.query(e,s,t)().abort}function Ln(){}function Ti(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,mi(n)}))}function Ei(n){const e=[],t=[];return n.forEach(r=>{(r.match(Cr)?e:t).push(r)}),{valid:e,invalid:t}}function De(n,e,t){function r(){const s=n.pendingIcons;e.forEach(i=>{s&&s.delete(i),n.icons[i]||n.missing.add(i)})}if(t&&typeof t=="object")try{if(!Sr(n,t).length){r();return}}catch(s){console.error(s)}r(),Ti(n)}function Rn(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function vi(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:r}=n,s=n.iconsToLoad;if(delete n.iconsToLoad,!s||!s.length)return;const i=n.loadIcon;if(n.loadIcons&&(s.length>1||!i)){Rn(n.loadIcons(s,r,t),u=>{De(n,s,u)});return}if(i){s.forEach(u=>{const f=i(u,r,t);Rn(f,h=>{const p=h?{prefix:r,icons:{[u]:h}}:null;De(n,[u],p)})});return}const{valid:o,invalid:l}=Ei(s);if(l.length&&De(n,l,null),!o.length)return;const a=r.match(Cr)?Wt(t):null;if(!a){De(n,o,null);return}a.prepare(t,r,o).forEach(u=>{Ai(t,u,f=>{De(n,u.icons,f)})})}))}const Mi=(n,e)=>{const t=bi(n,!0,Ar()),r=xi(t);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Ln)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:c,prefix:u}=a;if(u===l&&c===o)return;o=c,l=u,i.push(Ie(c,u));const f=s[c]||(s[c]=Object.create(null));f[u]||(f[u]=[])}),r.pending.forEach(a=>{const{provider:c,prefix:u,name:f}=a,h=Ie(c,u),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),s[c][u].push(f))}),i.forEach(a=>{const c=s[a.provider][a.prefix];c.length&&vi(a,c)}),e?yi(e,r,i):Ln};function wi(n,e){const t={...n};for(const r in e){const s=e[r],i=typeof s;r in Tr?(s===null||s&&(i==="string"||i==="number"))&&(t[r]=s):i===typeof t[r]&&(t[r]=r==="rotate"?s%4:s)}return t}const Ni=/[\s,]+/;function Ii(n,e){e.split(Ni).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function Oi(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(n);return isNaN(s)?0:r(s)}else if(t!==n){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(n.slice(0,n.length-t.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Di(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)t+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function Li(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ri(n){return"data:image/svg+xml,"+Li(n)}function Pi(n){return'url("'+Ri(n)+'")'}let je;function ji(){try{je=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{je=null}}function Fi(n){return je===void 0&&ji(),je?je.createHTML(n):n}const wr={...Er,inline:!1},zi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Bi={display:"inline-block"},_t={backgroundColor:"currentColor"},Nr={backgroundColor:"transparent"},Pn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:_t,mask:_t,background:Nr};for(const n in jn){const e=jn[n];for(const t in Pn)e[n+t]=Pn[t]}const Hi={...wr,inline:!0};function Fn(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const $i=(n,e,t)=>{const r=e.inline?Hi:wr,s=wi(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?zi:{}};if(t){const g=yt(t,!1,!0);if(g){const x=["iconify"],w=["provider","prefix"];for(const N of w)g[N]&&x.push("iconify--"+g[N]);a.className=x.join(" ")}}for(let g in e){const x=e[g];if(x!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=x;break;case"className":a[g]=(a[g]?a[g]+" ":"")+x;break;case"inline":case"hFlip":case"vFlip":s[g]=x===!0||x==="true"||x===1;break;case"flip":typeof x=="string"&&Ii(s,x);break;case"color":o.color=x;break;case"rotate":typeof x=="string"?s[g]=Oi(x):typeof x=="number"&&(s[g]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete a["aria-hidden"];break;default:r[g]===void 0&&(a[g]=x)}}const c=ti(n,s),u=c.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,u);let g=0,x=e.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:Fi(ii(c.body,x?()=>x+"ID"+g++:"iconifyReact"))},k.createElement("svg",a)}const{body:f,width:h,height:p}=n,y=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),m=Di(f,{...u,width:h+"",height:p+""});return a.style={...o,"--svg":Pi(m),width:Fn(u.width),height:Fn(u.height),...Bi,...y?_t:Nr,...l},k.createElement("span",a)};Ar(!0);oi("",pi);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!_s(r))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const r="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;li(t,s)||console.error(r)}catch{console.error(r)}}}}function Ir(n){const[e,t]=k.useState(!!n.ssr),[r,s]=k.useState({});function i(p){if(p){const y=n.icon;if(typeof y=="object")return{name:"",data:y};const m=Nn(y);if(m)return{name:y,data:m}}return{name:""}}const[o,l]=k.useState(i(!!n.ssr));function a(){const p=r.callback;p&&(p(),s({}))}function c(p){if(JSON.stringify(o)!==JSON.stringify(p))return a(),l(p),!0}function u(){var p;const y=n.icon;if(typeof y=="object"){c({name:"",data:y});return}const m=Nn(y);if(c({name:y,data:m}))if(m===void 0){const g=Mi([y],u);s({callback:g})}else m&&((p=n.onLoad)===null||p===void 0||p.call(n,y))}k.useEffect(()=>(t(!0),a),[]),k.useEffect(()=>{e&&u()},[n.icon,e]);const{name:f,data:h}=o;return h?$i({...cn,...h},n,f):n.children?n.children:n.fallback?n.fallback:k.createElement("span",{})}k.forwardRef((n,e)=>Ir({...n,_ref:e}));k.forwardRef((n,e)=>Ir({inline:!0,...n,_ref:e}));const Vi={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function qi({languages:n,selectedLanguage:e,onLanguageChange:t,label:r}){return d.jsx("div",{className:"flex items-center",children:d.jsxs("div",{className:"relative flex items-center",children:[d.jsx(S.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),d.jsx(A.Select,{"data-testid":"language-select-desktop","aria-label":r,selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-40 hidden md:inline-flex",isDisabled:n.length===0,placeholder:r,startContent:d.jsx(S.Globe,{className:"w-5 h-5 text-black"}),children:n.map(s=>d.jsx(A.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),d.jsx(A.Select,{"aria-label":r,"data-testid":"language-select-mobile",selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-20 inline-flex md:hidden",isDisabled:n.length===0,placeholder:e||"Language",children:n.map(s=>d.jsx(A.SelectItem,{className:"min-w-4",textValue:s.code.toUpperCase(),"data-testid":`language-select-option-mobile-${s.code}`,children:s.code.toUpperCase()},s.code))})]})})}function Ki({isLoggedIn:n,onLogin:e,onLogout:t,labels:r}){return n?d.jsxs(Z,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:t,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.logout})]}):d.jsxs(Z,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:e,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.login})]})}function Ji({logo:n,languages:e=[],selectedLanguage:t,onLanguageChange:r,isLoggedIn:s,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:a,labels:c={},className:u}){const f={...Vi,...c};return d.jsxs("nav",{"data-testid":"navbar",className:A.cn("w-full px-4 md:px-8 py-4 bg-white border-b border-zinc-100 flex items-center justify-between",u),children:[d.jsx("div",{className:"flex items-center min-w-10",children:n&&d.jsx("a",{href:"/",className:"block",children:d.jsx("img",{"data-testid":"navbar-logo",src:n,alt:"Logo",className:"h-8 max-w-28 md:max-w-40"})})}),d.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||e.length>0)&&d.jsx(qi,{languages:e,selectedLanguage:t,onLanguageChange:r,label:f.selectLanguage}),a&&d.jsx(Ki,{isLoggedIn:s,onLogin:i,onLogout:o,labels:f})]})]})}var It;const Ui=typeof document<"u"?(It=k.useInsertionEffect)!==null&&It!==void 0?It:k.useLayoutEffect:()=>{};function hn(n,e,t){let[r,s]=k.useState(n||e),i=k.useRef(r),o=k.useRef(n!==void 0),l=n!==void 0;k.useEffect(()=>{let f=o.current;f!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let a=l?n:r;Ui(()=>{i.current=a});let[,c]=k.useReducer(()=>({}),{}),u=k.useCallback((f,...h)=>{let p=typeof f=="function"?f(i.current):f;Object.is(i.current,p)||(i.current=p,s(p),c(),t?.(p,...h))},[t]);return[a,u]}function Wi(n){return d.jsx("svg",{...n,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:d.jsx(Re.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Or=k.forwardRef(({color:n="primary",stepsCount:e=3,defaultStep:t=0,label:r,onStepChange:s,currentStep:i,hideProgressBars:o=!1,stepClassName:l,className:a,...c},u)=>{const[f,h]=hn(i,t,s),p=k.useMemo(()=>{let y,m;const g=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(n){case"primary":y="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":y="[--step-color:var(--heroui-secondary)]",m="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":y="[--step-color:var(--heroui-success)]",m="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":y="[--step-color:var(--heroui-warning)]",m="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":y="[--step-color:var(--heroui-danger)]",m="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":y="[--step-color:var(--heroui-default)]",m="[--step-fg-color:var(--heroui-default-foreground)]";break;default:y="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break}return g.unshift(m),g.unshift(y),g},[n]);return d.jsxs("nav",{ref:u,"aria-label":"Progress",className:A.cn("flex max-w-fit items-center overflow-x-auto",a),"data-testid":"stepper-root",...c,children:[r&&d.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light w-full me-3","data-testid":"stepper-label",children:r}),d.jsx("ol",{className:A.cn("flex flex-row flex-nowrap gap-x-3",p,a),"data-testid":"stepper-list",children:Array.from({length:e})?.map((y,m)=>{const g=f===m?"active":f<m?"inactive":"complete";return d.jsx("li",{className:"relative flex w-full items-center pr-12","data-testid":`stepper-step-${m}`,children:d.jsxs("button",{"aria-current":g==="active"?"step":void 0,className:A.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",l),onClick:()=>h(m),"data-testid":`stepper-step-btn-${m}`,children:[d.jsx("div",{className:"h-full relative flex items-center",children:d.jsx(Re.LazyMotion,{features:Re.domAnimation,children:d.jsx(Re.m.div,{animate:g,className:"relative",children:d.jsx(Re.m.div,{animate:g,className:A.cn("border-medium text-large text-default-foreground relative flex h-[26px] w-[26px] items-center justify-center rounded-full font-semibold",{"shadow-lg":g==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:d.jsx("div",{className:"flex items-center justify-center",children:g==="complete"?d.jsx(Wi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${m}`}):d.jsx("span",{})})})})})}),m<e-1&&!o&&d.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 left-[26px] w-[calc(100%-13px)] flex-none items-center",style:{"--idx":m},children:d.jsx("div",{className:A.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":m<f})})})]},m)},m)})})]})});Or.displayName="Stepper";function _i(){return d.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}function $e(n){return typeof n=="string"?n:n.type}function pe({className:n}){return d.jsx("div",{className:`flex items-center h-6 ${n||""}`,children:d.jsx(A.Divider,{orientation:"vertical"})})}function le({icon:n,label:e,isActive:t=!1,isDisabled:r=!1,onClick:s,shortcut:i,iconSize:o=16,className:l}){const a=i?`${e} (${i})`:e;return d.jsx(A.Tooltip,{content:a,children:d.jsx(Z,{size:"sm",radius:"sm",color:t?"primary":"default",variant:t?"solid":"bordered",isIconOnly:!0,isDisabled:r,onPress:s,"aria-label":e,className:l,children:d.jsx(n,{size:o})})})}const ie={bold:{execute:({editor:n})=>n.chain().focus().toggleBold().run(),canExecute:n=>n.can().chain().focus().toggleBold().run(),isActive:n=>n.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:n})=>n.chain().focus().toggleItalic().run(),canExecute:n=>n.can().chain().focus().toggleItalic().run(),isActive:n=>n.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:n})=>n.chain().focus().toggleStrike().run(),canExecute:n=>n.can().chain().focus().toggleStrike().run(),isActive:n=>n.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:n})=>n.chain().focus().toggleUnderline().run(),canExecute:n=>n.can().chain().focus().toggleUnderline().run(),isActive:n=>n.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:n})=>n.chain().focus().toggleCode().run(),canExecute:n=>n.can().chain().focus().toggleCode().run(),isActive:n=>n.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:n,config:e})=>{const t=e?.type==="textColor"?e.color:"";t?n.chain().focus().setColor(t).run():n.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:n=>n.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:n,config:e})=>{const t=e?.type==="highlight"?e.color:"";t?n.chain().focus().setHighlight({color:t}).run():n.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:n=>n.isActive("highlight"),label:"Highlight"},link:{execute:({editor:n,config:e})=>{const t=e?.type==="link"?e.href:"";if(t){const r=e?.type==="link"?e.target:void 0,s=e?.type==="link"?e.rel:void 0;n.chain().focus().setLink({href:t,target:r,rel:s}).run()}else n.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:n=>n.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:n})=>n.chain().focus().setParagraph().run(),canExecute:n=>n.can().chain().focus().setParagraph().run(),isActive:n=>n.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:n,config:e})=>{const t=e?.type==="heading"?e.level:1;n.chain().focus().toggleHeading({level:t}).run()},canExecute:(n,e)=>{const t=e?.type==="heading"?e.level:1;return n.can().chain().focus().toggleHeading({level:t}).run()},isActive:(n,e)=>e?.type==="heading"?n.isActive("heading",{level:e.level}):n.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:n})=>n.chain().focus().toggleBulletList().run(),canExecute:n=>n.can().chain().focus().toggleBulletList().run(),isActive:n=>n.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:n})=>n.chain().focus().toggleOrderedList().run(),canExecute:n=>n.can().chain().focus().toggleOrderedList().run(),isActive:n=>n.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:n})=>n.chain().focus().toggleTaskList().run(),canExecute:n=>n.can().chain().focus().toggleTaskList().run(),isActive:n=>n.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:n})=>n.chain().focus().toggleCodeBlock().run(),canExecute:n=>n.can().chain().focus().toggleCodeBlock().run(),isActive:n=>n.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:n})=>n.chain().focus().toggleBlockquote().run(),canExecute:n=>n.can().chain().focus().toggleBlockquote().run(),isActive:n=>n.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:n})=>n.chain().focus().setHorizontalRule().run(),canExecute:n=>n.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:n})=>n.chain().focus().setHardBreak().run(),canExecute:n=>n.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:n,config:e})=>{const t=e?.type==="textAlign"?e.alignment:"left";n.chain().focus().setTextAlign(t).run()},canExecute:()=>!0,isActive:(n,e)=>e?.type==="textAlign"?n.isActive({textAlign:e.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:n})=>n.chain().focus().unsetAllMarks().run(),canExecute:n=>n.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:n})=>n.chain().focus().clearNodes().run(),canExecute:n=>n.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:n})=>n.chain().focus().undo().run(),canExecute:n=>n.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:n})=>n.chain().focus().redo().run(),canExecute:n=>n.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Gi={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Zi({editor:n,levels:e=[1,2,3,4,5,6],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const o=()=>r(l=>l+1);return n.on("selectionUpdate",o),n.on("transaction",o),()=>{n.off("selectionUpdate",o),n.off("transaction",o)}},[n]);const s=e.find(o=>n.isActive("heading",{level:o})),i=o=>{const l=Number(o),a=ie.heading;a&&a.execute({editor:n,config:{type:"heading",level:l}})};return d.jsxs(A.Dropdown,{children:[d.jsx(A.DropdownTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,startContent:d.jsx(S.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),d.jsx(A.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>d.jsx(A.DropdownItem,{startContent:n.isActive("heading",{level:o})?d.jsx(S.Check,{size:16}):d.jsx("div",{className:"w-4"}),children:Gi[o]},o))})]})}const Ot={bulletList:{label:"Bullet List",icon:S.List},orderedList:{label:"Numbered List",icon:S.ListOrdered},taskList:{label:"Task List",icon:S.ListTodo}};function Xi({editor:n,types:e=["bulletList","orderedList","taskList"],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const l=()=>r(a=>a+1);return n.on("selectionUpdate",l),n.on("transaction",l),()=>{n.off("selectionUpdate",l),n.off("transaction",l)}},[n]);const s=e.find(l=>n.isActive(l)),i=s?Ot[s].icon:S.List,o=l=>{const c=ie[l];c&&c.execute({editor:n})};return d.jsxs(A.Dropdown,{children:[d.jsx(A.DropdownTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,isIconOnly:!0,"aria-label":"Select list type",children:d.jsx(i,{size:16})})}),d.jsx(A.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=Ot[l].icon;return d.jsx(A.DropdownItem,{startContent:d.jsx(a,{size:16}),children:Ot[l].label},l)})})]})}function Qi({colors:n,selectedColor:e,onColorSelect:t,columns:r=4}){return d.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:n.map(s=>{const i=e===s;return d.jsx("button",{type:"button",onClick:()=>t(s),className:`
|
|
2
2
|
w-8 h-8 rounded-full border-2 cursor-pointer
|
|
3
3
|
transition-all duration-200
|
|
4
4
|
hover:scale-110 hover:shadow-md
|
|
5
5
|
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
6
6
|
${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
|
|
7
|
-
`,style:{backgroundColor:s},"aria-label":`Select color ${s}`,title:s},s)})})}const
|
|
7
|
+
`,style:{backgroundColor:s},"aria-label":`Select color ${s}`,title:s},s)})})}const Yi=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],eo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Dt(n){return/^#([0-9A-F]{3}){1,2}$/i.test(n)}const H={min:50,max:200,step:10,default:100},zn={lineHeight:24,toolbarHeight:60},to={bold:S.Bold,italic:S.Italic,strike:S.Strikethrough,underline:S.Underline,code:S.Code,textColor:S.Palette,highlight:S.Highlighter,link:S.Link2,paragraph:S.FileText,heading:S.Heading,bulletList:S.List,orderedList:S.ListOrdered,taskList:S.ListTodo,codeBlock:S.CodeSquare,blockquote:S.Quote,horizontalRule:S.Minus,clearMarks:S.Eraser,clearNodes:S.Eraser,undo:S.Undo2,redo:S.Redo2,hardBreak:S.CornerDownLeft,textAlign:S.AlignLeft},no={left:S.AlignLeft,center:S.AlignCenter,right:S.AlignRight,justify:S.AlignJustify};function me(n){return to[n]}function ro({value:n,onChange:e,onApply:t,placeholder:r="#000000"}){const[s,i]=k.useState(""),o=c=>{const u=c.target.value;e(u),s&&i("")},l=()=>{if(!n){i("Please enter a color");return}if(!Dt(n)){i("Invalid hex color (e.g., #FF0000)");return}i(""),t(n)},a=c=>{c.key==="Enter"&&(c.preventDefault(),l())};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(A.Input,{type:"text",value:n,onChange:o,onKeyDown:a,placeholder:r,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!s,errorMessage:s,startContent:d.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Dt(n)?n:"transparent"}})}),d.jsx(Z,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!n||!Dt(n),children:d.jsx(S.Check,{size:16})})]}),d.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Bn({editor:n,type:e,allowCustomColor:t=!0,label:r,isDisabled:s=!1}){const[i,o]=k.useState(!1),[l,a]=k.useState(""),c=e==="textColor"?Yi:eo,u=m=>{const g=ie[e];g&&g.execute({editor:n,config:{type:e,color:m}}),o(!1),a("")},f=m=>{u(m)},h=()=>{const m=ie[e];m&&m.execute({editor:n,config:{type:e,color:""}}),o(!1)},p=e==="textColor"?n.isActive("textStyle"):n.isActive("highlight"),y=e==="textColor"?S.Palette:S.Highlighter;return d.jsxs(A.Popover,{isOpen:i,onOpenChange:o,placement:"bottom",showArrow:!0,children:[d.jsx(A.PopoverTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":r,children:d.jsx(y,{size:16})})}),d.jsx(A.PopoverContent,{className:"w-64",children:d.jsxs("div",{className:"px-2 py-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-semibold",children:r}),d.jsx(Z,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:d.jsx(S.X,{size:16})})]}),d.jsx(Qi,{colors:c,onColorSelect:u}),t&&d.jsxs(d.Fragment,{children:[d.jsx(A.Divider,{}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),d.jsx(ro,{value:l,onChange:a,onApply:f})]})]})]})})]})}function so({zoom:n,onZoomChange:e,min:t=H.min,max:r=H.max,step:s=H.step}){const i=()=>{const f=Math.max(t,n-s);e(f)},o=()=>{const f=Math.min(r,n+s);e(f)},l=()=>{e(H.default)},a=n<=t,c=n>=r,u=n===H.default;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(A.Tooltip,{content:"Zoom out",children:d.jsx(Z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:a,onPress:i,"aria-label":"Zoom out",children:d.jsx(S.ZoomOut,{size:16})})}),d.jsx(A.Tooltip,{content:u?"Zoom percentage":"Click to reset zoom",children:d.jsxs("button",{type:"button",onClick:l,disabled:u,className:`
|
|
8
8
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
9
|
-
${
|
|
10
|
-
`,"aria-label":`Zoom level ${t}%`,children:[t,"%"]})}),u.jsx(m.Tooltip,{content:"Zoom in",children:u.jsx(m.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:u.jsx(v.ZoomIn,{size:16})})})]})}function gi({children:t,id:e,label:n,className:r,useButtonGroup:s=!0}){return s?u.jsx(m.ButtonGroup,{size:"sm",id:e,"aria-label":n,className:r,children:t}):u.jsx("div",{id:e,role:"group","aria-label":n,className:`flex items-center gap-2 ${r||""}`,children:t})}function Ar(t,e){const n=k.useMemo(()=>{if(!t)return{};const i={};return Array.from(new Set(e.map(l=>_e(l)))).forEach(l=>{const a=oe[l];if(a)try{const c=a.canExecute?.(t)??!0,d=a.isActive?.(t)??!1;i[l]={isActive:d,isDisabled:!c,canExecute:c}}catch(c){console.warn(`Extension not available for modifier: ${l}`,c),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[t,e]),[r,s]=k.useState(n);return k.useEffect(()=>{if(!t)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>_e(a)))).forEach(a=>{const c=oe[a];if(c)try{const d=c.canExecute?.(t)??!0,f=c.isActive?.(t)??!1;o[a]={isActive:f,isDisabled:!d,canExecute:d}}catch(d){console.warn(`Extension not available for modifier: ${a}`,d),o[a]={isActive:!1,isDisabled:!0,canExecute:!1}}}),s(o)};return t.on("selectionUpdate",i),t.on("transaction",i),()=>{t.off("selectionUpdate",i),t.off("transaction",i)}},[t,e,n]),r}function Nr(t,e){const n=k.useCallback((o,l)=>{if(!t)return;const a=oe[o];if(a)try{a.execute({editor:t,config:l}),e?.({type:"toggle",modifier:o})}catch(c){console.warn(`Failed to execute command for modifier: ${o}`,c)}},[t,e]),r=k.useCallback(o=>{n(o)},[n]),s=k.useCallback((o,l)=>{if(!t)return!1;const a=oe[o];try{return a?.canExecute?.(t,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[t]),i=k.useCallback((o,l)=>{if(!t)return!1;const a=oe[o];try{return a?.isActive?.(t,l)??!1}catch(c){return console.warn(`Failed to check isActive for modifier: ${o}`,c),!1}},[t]);return{executeCommand:n,toggleModifier:r,canExecute:s,isActive:i}}function yi(t=V.default){const[e,n]=k.useState(t),r=k.useCallback((l=V.step)=>{n(a=>Math.min(V.max,a+l))},[]),s=k.useCallback((l=V.step)=>{n(a=>Math.max(V.min,a-l))},[]),i=k.useCallback(()=>{n(V.default)},[]),o=k.useCallback(l=>{const a=Math.max(V.min,Math.min(V.max,l));n(a)},[]);return{zoom:e,setZoom:o,zoomIn:r,zoomOut:s,resetZoom:i,isMinZoom:e<=V.min,isMaxZoom:e>=V.max,isDefaultZoom:e===V.default}}const xi=["bold","italic","strike","underline","code"];function bi({editor:t,modifiers:e,onToolbarAction:n}){const r=Ar(t,e),{toggleModifier:s}=Nr(t,n);if(!t)return null;const i=e.map(o=>_e(o)).filter(o=>xi.includes(o));return i.length===0?null:u.jsx(gi,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=r[o],a=xe(o);return u.jsx(ae,{icon:a,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>s(o)},o)})})}function ki({editor:t,modifiers:e,zoom:n=100,onZoomChange:r,sticky:s=!0,className:i,onToolbarAction:o}){const l=Ar(t,e),{toggleModifier:a,executeCommand:c}=Nr(t,o);if(!t)return null;const d=e.map(S=>_e(S)),f=d.some(S=>["bold","italic","strike","underline","code"].includes(S)),h=d.some(S=>["textColor","highlight"].includes(S)),p=d.includes("heading"),x=d.includes("textAlign"),g=d.some(S=>["bulletList","orderedList","taskList"].includes(S)),y=d.includes("blockquote"),b=d.includes("codeBlock"),A=d.includes("link"),N=d.includes("horizontalRule"),I=d.some(S=>["undo","redo"].includes(S)),j=n!==void 0&&r!==void 0,w=s?"sticky top-0 z-10":"";return u.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${w} ${i||""}`,children:u.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[f&&u.jsxs(u.Fragment,{children:[u.jsx(bi,{editor:t,modifiers:e,onToolbarAction:o}),(h||p||x||g||y||b||A||N||I||j)&&u.jsx(ye,{})]}),h&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1",children:[d.includes("textColor")&&u.jsx(Ln,{editor:t,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),d.includes("highlight")&&u.jsx(Ln,{editor:t,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||x||g||y||b||A||N||I||j)&&u.jsx(ye,{})]}),p&&u.jsxs(u.Fragment,{children:[u.jsx(li,{editor:t}),(x||g||y||b||A||N||I||j)&&u.jsx(ye,{})]}),x&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(S=>{const O=hi[S],F=t.isActive({textAlign:S});return u.jsx(ae,{icon:O,label:`Align ${S}`,isActive:F,onClick:()=>c("textAlign",{type:"textAlign",alignment:S})},S)})}),(g||y||b||A||N||I||j)&&u.jsx(ye,{})]}),g&&u.jsxs(u.Fragment,{children:[u.jsx(ai,{editor:t,types:d.filter(S=>["bulletList","orderedList","taskList"].includes(S))}),(y||b||A||N||I||j)&&u.jsx(ye,{})]}),(y||b||A||N)&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1",children:[y&&u.jsx(ae,{icon:xe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),b&&u.jsx(ae,{icon:xe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),A&&u.jsx(ae,{icon:xe("link"),label:"Link",isActive:l.link?.isActive,isDisabled:l.link?.isDisabled,onClick:()=>{const S=window.prompt("Enter URL:");S&&c("link",{type:"link",href:S})}}),N&&u.jsx(ae,{icon:xe("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(I||j)&&u.jsx(ye,{})]}),I&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1",children:[d.includes("undo")&&u.jsx(ae,{icon:xe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),d.includes("redo")&&u.jsx(ae,{icon:xe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),j&&u.jsx(ye,{})]}),j&&u.jsx(mi,{zoom:n,onZoomChange:S=>{r?.(S),o?.({type:"zoom",modifier:`${S}%`})}})]})})}const Ci=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Si=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,vi=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,wi=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ai=C.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[C.markInputRule({find:Ci,type:this.type}),C.markInputRule({find:vi,type:this.type})]},addPasteRules(){return[C.markPasteRule({find:Si,type:this.type}),C.markPasteRule({find:wi,type:this.type})]}}),Ni=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ti=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ei=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mi=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ii=C.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[C.markInputRule({find:Ni,type:this.type}),C.markInputRule({find:Ei,type:this.type})]},addPasteRules(){return[C.markPasteRule({find:Ti,type:this.type}),C.markPasteRule({find:Mi,type:this.type})]}}),Oi=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ji=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Di=C.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[C.markInputRule({find:Oi,type:this.type})]},addPasteRules(){return[C.markPasteRule({find:ji,type:this.type})]}}),Li=/(^|[^`])`([^`]+)`(?!`)/,Pi=/(^|[^`])`([^`]+)`(?!`)/g,Ri=C.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[C.markInputRule({find:Li,type:this.type})]},addPasteRules(){return[C.markPasteRule({find:Pi,type:this.type})]}}),Fi=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,s;const i=n.getAttribute("style"),o=(s=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||s===void 0?void 0:s.getAttribute("style");n.setAttribute("style",`${o};${i}`)})},zi=C.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Fi(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),Bi=C.Node.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,C.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>C.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),$i=C.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hi="listItem",Pn="textStyle",Rn=/^\s*([-+*])\s$/,qi=C.Node.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Hi,this.editor.getAttributes(Pn)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=C.wrappingInputRule({find:Rn,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=C.wrappingInputRule({find:Rn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Pn),editor:this.editor})),[t]}}),Vi="listItem",Fn="textStyle",zn=/^(\d+)\.\s$/,Ki=C.Node.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",C.mergeAttributes(this.options.HTMLAttributes,n),0]:["ol",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vi,this.editor.getAttributes(Fn)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=C.wrappingInputRule({find:zn,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=C.wrappingInputRule({find:zn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Fn)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Ui=C.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",C.mergeAttributes(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function Tr(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=Tr(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Er(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=Er(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class T{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-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)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new T(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new T(r,s)}cutByIndex(e,n){return e==n?T.empty:e==0&&n==this.content.length?this:new T(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new T(s,i)}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 n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Tr(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Er(this,e,n,r)}findIndex(e){if(e==0)return rt(0,e);if(e==this.size)return rt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?rt(n+1,i):rt(n,r);r=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,n){if(!n)return T.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new T(n||e,r)}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 Pt={index:0,offset:0};function rt(t,e){return Pt.index=t,Pt.offset=e,Pt}function Zt(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Zt(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Zt(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class G{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return G.none;if(e instanceof G)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}}G.none=[];class Ji extends Error{}class E{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ir(this.content,e+this.openStart,n);return r&&new E(r,this.openStart,this.openEnd)}removeBetween(e,n){return new E(Mr(this.content,e+this.openStart,n+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,n){if(!n)return E.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new E(T.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new E(e,r,s)}}E.empty=new E(T.empty,0,0);function Mr(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Mr(i.content,e-s-1,n-s-1)))}function Ir(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ir(o.content,e-i-1,n,o);return l&&t.replaceChild(s,o.copy(l))}function Wi(t){return t.tag!=null}function _i(t){return t.style!=null}class pt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(Wi(s))this.tags.push(s);else if(_i(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new $n(this,n,!1);return r.addAll(e,G.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new $n(this,n,!0);return r.addAll(e,G.none,n.from,n.to),E.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Qi(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Hn(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Hn(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new pt(e,pt.schemaRules(e)))}}const Or={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},Gi={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jr={ol:!0,ul:!0},Ge=1,Qt=2,Ke=4;function Bn(t,e,n){return e!=null?(e?Ge:0)|(e==="full"?Qt:0):t&&t.whitespace=="pre"?Ge|Qt:n&~Ke}class st{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=G.none,this.match=i||(o&Ke?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(T.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ge)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=T.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Or.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class $n{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Bn(null,n.preserveWhitespace,0)|(r?Ke:0);s?i=new st(s.type,s.attrs,G.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new st(null,null,G.none,!0,null,o):i=new st(e.schema.topNodeType,null,G.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Qt?"full":this.localPreserveWS||(s.options&Ge)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
11
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),
|
|
12
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=G.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):qn(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Bn(e,i,o.options);o.options&Ke&&o.content.length==0&&(l|=Ke);let a=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):qn(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new st(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ge)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&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)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Zi(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jr.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Qi(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Hn(t){let e={};for(let n in t)e[n]=t[n];return e}function qn(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class At{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Rt(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,n);d&&(i.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=at(Rt(n),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,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&at(Rt(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return at(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new At(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Vn(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Vn(e.marks)}}function Vn(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Rt(t){return t.document||window.document}const Kn=new WeakMap;function Xi(t){let e=Kn.get(t);return e===void 0&&Kn.set(t,e=Yi(t)),e}function Yi(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function at(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Xi(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:x}=at(t,h,n,r);if(a.appendChild(p),x){if(l)throw new RangeError("Multiple content holes");l=x}}}return{dom:a,contentDOM:l}}const Dr=65535,Lr=Math.pow(2,16);function eo(t,e){return t+e*Lr}function Un(t){return t&Dr}function to(t){return(t-(t&Dr))/Lr}const Pr=1,Rr=2,ct=4,Fr=8;class Xt{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Fr)>0}get deletedBefore(){return(this.delInfo&(Pr|ct))>0}get deletedAfter(){return(this.delInfo&(Rr|ct))>0}get deletedAcross(){return(this.delInfo&ct)>0}}class J{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&J.empty)return J.empty}recover(e){let n=0,r=Un(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+to(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+o],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:n:n,p=a+s+(h<0?0:d);if(r)return p;let x=e==(n<0?a:f)?null:eo(l/3,e-a),g=e==a?Rr:e==f?Pr:ct;return(n<0?e!=a:e!=f)&&(g|=Fr),new Xt(p,g,x)}s+=d-c}return r?e+s:new Xt(e+s,0,null)}touches(e,n){let r=0,s=Un(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],d=this.ranges[s+r];e(l,l+c,a,a+d),i+=d-c}}invert(){return new J(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?J.empty:new J(e<0?[0,-e,0]:[0,0,e])}}J.empty=new J([]);class mt{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new mt(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new mt;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Xt(e,s,null)}}const Ft=Object.create(null);class K{getMap(){return J.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ft[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ft)throw new RangeError("Duplicate use of step JSON ID "+e);return Ft[e]=n,n.prototype.jsonID=e,n}}class R{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new R(e,null)}static fail(e){return new R(null,e)}static fromReplace(e,n,r,s){try{return R.ok(e.replace(n,r,s))}catch(i){if(i instanceof Ji)return R.fail(i.message);throw i}}}function mn(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(mn(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return T.fromArray(r)}class ke extends K{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new E(mn(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return R.fromReplace(e,this.from,this.to,i)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ke(n.pos,r.pos,this.mark)}merge(e){return e instanceof ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ke(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ke(n.from,n.to,e.markFromJSON(n.mark))}}K.jsonID("addMark",ke);class Ce extends K{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new E(mn(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return R.fromReplace(e,this.from,this.to,r)}invert(){return new ke(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ce(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(n.from,n.to,e.markFromJSON(n.mark))}}K.jsonID("removeMark",Ce);class Se extends K{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return R.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return R.fromReplace(e,this.pos,this.pos+1,new E(T.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Se(this.pos,n.marks[s]);return new Se(this.pos,this.mark)}}return new Ze(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Se(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Se(n.pos,e.markFromJSON(n.mark))}}K.jsonID("addNodeMark",Se);class Ze extends K{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return R.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return R.fromReplace(e,this.pos,this.pos+1,new E(T.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Se(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ze(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ze(n.pos,e.markFromJSON(n.mark))}}K.jsonID("removeNodeMark",Ze);class ie extends K{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Yt(e,this.from,this.to)?R.fail("Structure replace would overwrite content"):R.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new J([this.from,this.to-this.from,this.slice.size])}invert(e){return new ie(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ie(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ie)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?E.empty:new E(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ie(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?E.empty:new E(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ie(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ie(n.from,n.to,E.fromJSON(e,n.slice),!!n.structure)}}K.jsonID("replace",ie);class Pe extends K{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Yt(e,this.from,this.gapFrom)||Yt(e,this.gapTo,this.to)))return R.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return R.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?R.fromReplace(e,this.from,this.to,r):R.fail("Content does not fit in gap")}getMap(){return new J([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Pe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Pe(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pe(n.from,n.to,n.gapFrom,n.gapTo,E.fromJSON(e,n.slice),n.insert,!!n.structure)}}K.jsonID("replaceAround",Pe);function Yt(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function zr(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),d=!1;if(i==1)d=c.canReplace(a,a,s);else{let f=c.contentMatchAt(a).findWrapping(s.firstChild.type);d=f&&c.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}class Ue extends K{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return R.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return R.fromReplace(e,this.pos,this.pos+1,new E(T.from(s),0,n.isLeaf?0:1))}getMap(){return J.empty}invert(e){return new Ue(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ue(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ue(n.pos,n.attr,n.value)}}K.jsonID("attr",Ue);class gt extends K{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return R.ok(r)}getMap(){return J.empty}invert(e){return new gt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new gt(n.attr,n.value)}}K.jsonID("docAttr",gt);let Qe=class extends Error{};Qe=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Qe.prototype=Object.create(Error.prototype);Qe.prototype.constructor=Qe;Qe.prototype.name="TransformError";const zt=Object.create(null);class L{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new no(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=E.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?E.empty:n),l==0&&_n(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),d=a.map(l.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),_n(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new D(e):De(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?De(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):De(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new re(e.node(0))}static atStart(e){return De(e,e,0,0,1)||new re(e)}static atEnd(e){return De(e,e,e.content.size,e.childCount,-1)||new re(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=zt[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in zt)throw new RangeError("Duplicate use of selection JSON ID "+e);return zt[e]=n,n.prototype.jsonID=e,n}getBookmark(){return D.between(this.$anchor,this.$head).getBookmark()}}L.prototype.visible=!0;class no{constructor(e,n){this.$from=e,this.$to=n}}let Jn=!1;function Wn(t){!Jn&&!t.parent.inlineContent&&(Jn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class D extends L{constructor(e,n=e){Wn(e),Wn(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return L.near(r);let s=e.resolve(n.map(this.anchor));return new D(s.parent.inlineContent?s:r,r)}replace(e,n=E.empty){if(super.replace(e,n),n==E.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof D&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new D(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=L.findFrom(n,r,!0)||L.findFrom(n,-r,!0);if(i)n=i.$head;else return L.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(L.findFrom(e,-r,!0)||L.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new D(e,n)}}L.jsonID("text",D);class Nt{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nt(e.map(this.anchor),e.map(this.head))}resolve(e){return D.between(e.resolve(this.anchor),e.resolve(this.head))}}class M extends L{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?L.near(i):new M(i)}content(){return new E(T.from(this.node),0,0)}eq(e){return e instanceof M&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new gn(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new M(e.resolve(n.anchor))}static create(e,n){return new M(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}M.prototype.visible=!1;L.jsonID("node",M);class gn{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Nt(r,r):new gn(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&M.isSelectable(r)?new M(n):L.near(n)}}class re extends L{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=E.empty){if(n==E.empty){e.delete(0,e.doc.content.size);let r=L.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new re(e)}map(e){return new re(e)}eq(e){return e instanceof re}getBookmark(){return ro}}L.jsonID("all",re);const ro={map(){return this},resolve(t){return new re(t)}};function De(t,e,n,r,s,i=!1){if(e.inlineContent)return D.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&M.isSelectable(l))return M.create(t,n-(s<0?l.nodeSize:0))}else{let a=De(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function _n(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof ie||s instanceof Pe))return;let i=t.mapping.maps[r],o;i.forEach((l,a,c,d)=>{o==null&&(o=d)}),t.setSelection(L.near(t.doc.resolve(o),n))}function Gn(t,e){return!e||!t?t:t.bind(e)}class it{constructor(e,n,r){this.name=e,this.init=Gn(n.init,r),this.apply=Gn(n.apply,r)}}new it("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new it("selection",{init(t,e){return t.selection||L.atStart(e.doc)},apply(t){return t.selection}}),new it("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new it("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});function Br(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Br(s,e,{})),n[r]=s}return n}class Tt{constructor(e){this.spec=e,this.props={},e.props&&Br(e.props,this,this.props),this.key=e.key?e.key.key:$r("plugin")}getState(e){return e[this.key]}}const Bt=Object.create(null);function $r(t){return t in Bt?t+"$"+ ++Bt[t]:(Bt[t]=0,t+"$")}class yn{constructor(e="key"){this.key=$r(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const so=/^```([a-z]+)?[\s\n]$/,io=/^~~~([a-z]+)?[\s\n]$/,oo=C.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",C.mergeAttributes(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
9
|
+
${u?"cursor-default":"cursor-pointer hover:text-primary"}
|
|
10
|
+
`,"aria-label":`Zoom level ${n}%`,children:[n,"%"]})}),d.jsx(A.Tooltip,{content:"Zoom in",children:d.jsx(Z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:d.jsx(S.ZoomIn,{size:16})})})]})}function io({children:n,id:e,label:t,className:r,useButtonGroup:s=!0}){return s?d.jsx(A.ButtonGroup,{size:"sm",id:e,"aria-label":t,className:r,children:n}):d.jsx("div",{id:e,role:"group","aria-label":t,className:`flex items-center gap-2 ${r||""}`,children:n})}function Dr(n,e){const t=k.useMemo(()=>{if(!n)return{};const i={};return Array.from(new Set(e.map(l=>$e(l)))).forEach(l=>{const a=ie[l];if(a)try{const c=a.canExecute?.(n)??!0,u=a.isActive?.(n)??!1;i[l]={isActive:u,isDisabled:!c,canExecute:c}}catch(c){console.warn(`Extension not available for modifier: ${l}`,c),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[n,e]),[r,s]=k.useState(t);return k.useEffect(()=>{if(!n)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>$e(a)))).forEach(a=>{const c=ie[a];if(c)try{const u=c.canExecute?.(n)??!0,f=c.isActive?.(n)??!1;o[a]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${a}`,u),o[a]={isActive:!1,isDisabled:!0,canExecute:!1}}}),s(o)};return n.on("selectionUpdate",i),n.on("transaction",i),()=>{n.off("selectionUpdate",i),n.off("transaction",i)}},[n,e,t]),r}function Lr(n,e){const t=k.useCallback((o,l)=>{if(!n)return;const a=ie[o];if(a)try{a.execute({editor:n,config:l}),e?.({type:"toggle",modifier:o})}catch(c){console.warn(`Failed to execute command for modifier: ${o}`,c)}},[n,e]),r=k.useCallback(o=>{t(o)},[t]),s=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.canExecute?.(n,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[n]),i=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.isActive?.(n,l)??!1}catch(c){return console.warn(`Failed to check isActive for modifier: ${o}`,c),!1}},[n]);return{executeCommand:t,toggleModifier:r,canExecute:s,isActive:i}}function oo(n=H.default){const[e,t]=k.useState(n),r=k.useCallback((l=H.step)=>{t(a=>Math.min(H.max,a+l))},[]),s=k.useCallback((l=H.step)=>{t(a=>Math.max(H.min,a-l))},[]),i=k.useCallback(()=>{t(H.default)},[]),o=k.useCallback(l=>{const a=Math.max(H.min,Math.min(H.max,l));t(a)},[]);return{zoom:e,setZoom:o,zoomIn:r,zoomOut:s,resetZoom:i,isMinZoom:e<=H.min,isMaxZoom:e>=H.max,isDefaultZoom:e===H.default}}const lo=["bold","italic","strike","underline","code"];function ao({editor:n,modifiers:e,onToolbarAction:t}){const r=Dr(n,e),{toggleModifier:s}=Lr(n,t);if(!n)return null;const i=e.map(o=>$e(o)).filter(o=>lo.includes(o));return i.length===0?null:d.jsx(io,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=r[o],a=me(o);return d.jsx(le,{icon:a,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>s(o)},o)})})}function co({editor:n,modifiers:e,zoom:t=100,onZoomChange:r,sticky:s=!0,className:i,onToolbarAction:o}){const l=Dr(n,e),{toggleModifier:a,executeCommand:c}=Lr(n,o);if(!n)return null;const u=e.map(C=>$e(C)),f=u.some(C=>["bold","italic","strike","underline","code"].includes(C)),h=u.some(C=>["textColor","highlight"].includes(C)),p=u.includes("heading"),y=u.includes("textAlign"),m=u.some(C=>["bulletList","orderedList","taskList"].includes(C)),g=u.includes("blockquote"),x=u.includes("codeBlock"),w=u.includes("link"),N=u.includes("horizontalRule"),O=u.some(C=>["undo","redo"].includes(C)),P=t!==void 0&&r!==void 0,T=s?"sticky top-0 z-10":"";return d.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${T} ${i||""}`,children:d.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[f&&d.jsxs(d.Fragment,{children:[d.jsx(ao,{editor:n,modifiers:e,onToolbarAction:o}),(h||p||y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),h&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("textColor")&&d.jsx(Bn,{editor:n,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),u.includes("highlight")&&d.jsx(Bn,{editor:n,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx(Zi,{editor:n}),(y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),y&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const V=no[C],U=n.isActive({textAlign:C});return d.jsx(le,{icon:V,label:`Align ${C}`,isActive:U,onClick:()=>c("textAlign",{type:"textAlign",alignment:C})},C)})}),(m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx(Xi,{editor:n,types:u.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(g||x||w||N||O||P)&&d.jsx(pe,{})]}),(g||x||w||N)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[g&&d.jsx(le,{icon:me("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),x&&d.jsx(le,{icon:me("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),w&&d.jsx(le,{icon:me("link"),label:"Link",isActive:l.link?.isActive,isDisabled:l.link?.isDisabled,onClick:()=>{const C=window.prompt("Enter URL:");C&&c("link",{type:"link",href:C})}}),N&&d.jsx(le,{icon:me("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(O||P)&&d.jsx(pe,{})]}),O&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("undo")&&d.jsx(le,{icon:me("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),u.includes("redo")&&d.jsx(le,{icon:me("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),P&&d.jsx(pe,{})]}),P&&d.jsx(so,{zoom:t,onZoomChange:C=>{r?.(C),o?.({type:"zoom",modifier:`${C}%`})}})]})})}const uo=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,fo=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ho=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,po=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mo=b.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[b.markInputRule({find:uo,type:this.type}),b.markInputRule({find:ho,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:fo,type:this.type}),b.markPasteRule({find:po,type:this.type})]}}),go=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yo=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xo=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bo=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ko=b.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[b.markInputRule({find:go,type:this.type}),b.markInputRule({find:xo,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:yo,type:this.type}),b.markPasteRule({find:bo,type:this.type})]}}),So=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Co=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ao=b.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[b.markInputRule({find:So,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Co,type:this.type})]}}),To=/(^|[^`])`([^`]+)`(?!`)/,Eo=/(^|[^`])`([^`]+)`(?!`)/g,vo=b.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[b.markInputRule({find:To,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Eo,type:this.type})]}}),Mo=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,s;const i=t.getAttribute("style"),o=(s=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||s===void 0?void 0:s.getAttribute("style");t.setAttribute("style",`${o};${i}`)})},wo=b.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Mo(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),No=b.Node.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,b.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>b.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Io=b.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Oo="listItem",Hn="textStyle",$n=/^\s*([-+*])\s$/,Do=b.Node.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Oo,this.editor.getAttributes(Hn)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=b.wrappingInputRule({find:$n,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:$n,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Hn),editor:this.editor})),[n]}}),Lo="listItem",Vn="textStyle",qn=/^(\d+)\.\s$/,Ro=b.Node.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",b.mergeAttributes(this.options.HTMLAttributes,t),0]:["ol",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Lo,this.editor.getAttributes(Vn)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=b.wrappingInputRule({find:qn,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:qn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Vn)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Po=b.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function Rr(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Rr(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Pr(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Pr(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class E{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!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)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new E(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new E(r,s)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new E(s,i)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Rr(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pr(this,e,t,r)}findIndex(e){if(e==0)return Xe(0,e);if(e==this.size)return Xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Xe(t+1,i):Xe(t,r);r=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 E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const Lt={index:0,offset:0};function Xe(n,e){return Lt.index=n,Lt.offset=e,Lt}function Gt(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 r=0;r<n.length;r++)if(!Gt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gt(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class G{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||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&&Gt(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return G.none;if(e instanceof G)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}}G.none=[];class jo extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Fr(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(jr(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 v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(E.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(E.empty,0,0);function jr(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(jr(i.content,e-s-1,t-s-1)))}function Fr(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Fr(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Fo(n){return n.tag!=null}function zo(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Fo(s))this.tags.push(s);else if(zo(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Jn(this,t,!1);return r.addAll(e,G.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Jn(this,t,!0);return r.addAll(e,G.none,t.from,t.to),v.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if($o(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Un(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Un(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const zr={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},Bo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Br={ol:!0,ul:!0},Ve=1,Zt=2,Fe=4;function Kn(n,e,t){return e!=null?(e?Ve:0)|(e==="full"?Zt:0):n&&n.whitespace=="pre"?Ve|Zt:t&~Fe}class Qe{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=G.none,this.match=i||(o&Fe?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ve)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.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&&!zr.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jn{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Kn(null,t.preserveWhitespace,0)|(r?Fe:0);s?i=new Qe(s.type,s.attrs,G.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Qe(null,null,G.none,!0,null,o):i=new Qe(e.schema.topNodeType,null,G.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Zt?"full":this.localPreserveWS||(s.options&Ve)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
11
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Br.hasOwnProperty(o)&&this.parser.normalizeLists&&Ho(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Bo.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(zr.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
12
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,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,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));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,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=G.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Wn(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Kn(e,i,o.options);o.options&Fe&&o.content.length==0&&(l|=Fe);let a=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Wn(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Qe(e,t,a,s,null,l)),this.open++,r}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;this.localPreserveWS&&(this.nodes[t].options|=Ve)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].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,r){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)&(r?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("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Ho(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Br.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function $o(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Un(n){let e={};for(let t in n)e[t]=n[t];return e}function Wn(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class xt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Rt(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=rt(Rt(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 r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&rt(Rt(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return rt(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=_n(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return _n(e.marks)}}function _n(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Rt(n){return n.document||window.document}const Gn=new WeakMap;function Vo(n){let e=Gn.get(n);return e===void 0&&Gn.set(n,e=qo(n)),e}function qo(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function rt(n,e,t,r){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],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Vo(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:y}=rt(n,h,t,r);if(a.appendChild(p),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:a,contentDOM:l}}const Hr=65535,$r=Math.pow(2,16);function Ko(n,e){return n+e*$r}function Zn(n){return n&Hr}function Jo(n){return(n-(n&Hr))/$r}const Vr=1,qr=2,st=4,Kr=8;class Xt{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Kr)>0}get deletedBefore(){return(this.delInfo&(Vr|st))>0}get deletedAfter(){return(this.delInfo&(qr|st))>0}get deletedAcross(){return(this.delInfo&st)>0}}class K{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&K.empty)return K.empty}recover(e){let t=0,r=Zn(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Jo(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:t:t,p=a+s+(h<0?0:u);if(r)return p;let y=e==(t<0?a:f)?null:Ko(l/3,e-a),m=e==a?qr:e==f?Vr:st;return(t<0?e!=a:e!=f)&&(m|=Kr),new Xt(p,m,y)}s+=u-c}return r?e+s:new Xt(e+s,0,null)}touches(e,t){let r=0,s=Zn(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new K(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?K.empty:new K(e<0?[0,-e,0]:[0,0,e])}}K.empty=new K([]);class at{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new at(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+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,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new at;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Xt(e,s,null)}}const Pt=Object.create(null);class ${getMap(){return K.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pt[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Pt)throw new RangeError("Duplicate use of step JSON ID "+e);return Pt[e]=t,t.prototype.jsonID=e,t}}class R{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new R(e,null)}static fail(e){return new R(null,e)}static fromReplace(e,t,r,s){try{return R.ok(e.replace(t,r,s))}catch(i){if(i instanceof jo)return R.fail(i.message);throw i}}}function pn(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(pn(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return E.fromArray(r)}class ye extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new v(pn(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,i)}invert(){return new xe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ye(t.pos,r.pos,this.mark)}merge(e){return e instanceof ye&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ye(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 ye(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("addMark",ye);class xe extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(pn(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,r)}invert(){return new ye(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new xe(t.pos,r.pos,this.mark)}merge(e){return e instanceof xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xe(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 xe(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("removeMark",xe);class be extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new be(this.pos,t.marks[s]);return new be(this.pos,this.mark)}}return new qe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new be(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 be(t.pos,e.markFromJSON(t.mark))}}$.jsonID("addNodeMark",be);class qe extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new be(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qe(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 qe(t.pos,e.markFromJSON(t.mark))}}$.jsonID("removeNodeMark",qe);class se extends ${constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Qt(e,this.from,this.to)?R.fail("Structure replace would overwrite content"):R.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new K([this.from,this.to-this.from,this.slice.size])}invert(e){return new se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof se)||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?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new se(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?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new se(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 se(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}$.jsonID("replace",se);class we extends ${constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Qt(e,this.from,this.gapFrom)||Qt(e,this.gapTo,this.to)))return R.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return R.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?R.fromReplace(e,this.from,this.to,r):R.fail("Content does not fit in gap")}getMap(){return new K([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 we(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),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new we(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new we(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}$.jsonID("replaceAround",we);function Qt(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Jr(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(a,a,s);else{let f=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}class ze extends ${constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(s),0,t.isLeaf?0:1))}getMap(){return K.empty}invert(e){return new ze(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 ze(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 ze(t.pos,t.attr,t.value)}}$.jsonID("attr",ze);class ct extends ${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 r=e.type.create(t,e.content,e.marks);return R.ok(r)}getMap(){return K.empty}invert(e){return new ct(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 ct(t.attr,t.value)}}$.jsonID("docAttr",ct);let Ke=class extends Error{};Ke=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ke.prototype=Object.create(Error.prototype);Ke.prototype.constructor=Ke;Ke.prototype.name="TransformError";const jt=Object.create(null);class D{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Uo(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=v.empty){let r=t.content.lastChild,s=null;for(let l=0;l<t.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?v.empty:t),l==0&&Yn(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Yn(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new I(e):ve(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?ve(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):ve(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new te(e.node(0))}static atStart(e){return ve(e,e,0,0,1)||new te(e)}static atEnd(e){return ve(e,e,e.content.size,e.childCount,-1)||new te(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=jt[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jt)throw new RangeError("Duplicate use of selection JSON ID "+e);return jt[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class Uo{constructor(e,t){this.$from=e,this.$to=t}}let Xn=!1;function Qn(n){!Xn&&!n.parent.inlineContent&&(Xn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends D{constructor(e,t=e){Qn(e),Qn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return D.near(r);let s=e.resolve(t.map(this.anchor));return new I(s.parent.inlineContent?s:r,r)}replace(e,t=v.empty){if(super.replace(e,t),t==v.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bt(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 I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=D.findFrom(t,r,!0)||D.findFrom(t,-r,!0);if(i)t=i.$head;else return D.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(D.findFrom(e,-r,!0)||D.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new I(e,t)}}D.jsonID("text",I);class bt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new bt(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class M extends D{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?D.near(i):new M(i)}content(){return new v(E.from(this.node),0,0)}eq(e){return e instanceof M&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mn(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new M(e.resolve(t.anchor))}static create(e,t){return new M(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}M.prototype.visible=!1;D.jsonID("node",M);class mn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new bt(r,r):new mn(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&M.isSelectable(r)?new M(t):D.near(t)}}class te extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=v.empty){if(t==v.empty){e.delete(0,e.doc.content.size);let r=D.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new te(e)}map(e){return new te(e)}eq(e){return e instanceof te}getBookmark(){return Wo}}D.jsonID("all",te);const Wo={map(){return this},resolve(n){return new te(n)}};function ve(n,e,t,r,s,i=!1){if(e.inlineContent)return I.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&M.isSelectable(l))return M.create(n,t-(s<0?l.nodeSize:0))}else{let a=ve(n,l,t+s,s<0?l.childCount:0,s,i);if(a)return a}t+=l.nodeSize*s}return null}function Yn(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof se||s instanceof we))return;let i=n.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(D.near(n.doc.resolve(o),t))}function er(n,e){return!e||!n?n:n.bind(e)}class Ye{constructor(e,t,r){this.name=e,this.init=er(t.init,r),this.apply=er(t.apply,r)}}new Ye("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ye("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Ye("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ye("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Ur(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Ur(s,e,{})),t[r]=s}return t}class kt{constructor(e){this.spec=e,this.props={},e.props&&Ur(e.props,this,this.props),this.key=e.key?e.key.key:Wr("plugin")}getState(e){return e[this.key]}}const Ft=Object.create(null);function Wr(n){return n in Ft?n+"$"+ ++Ft[n]:(Ft[n]=0,n+"$")}class gn{constructor(e="key"){this.key=Wr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const _o=/^```([a-z]+)?[\s\n]$/,Go=/^~~~([a-z]+)?[\s\n]$/,Zo=b.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",b.mergeAttributes(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
13
13
|
|
|
14
|
-
`);return!i||!o?!1:
|
|
15
|
-
`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(
|
|
16
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var yt=200,H=function(){};H.prototype.append=function(e){return e.length?(e=H.from(e),!this.length&&e||e.length<yt&&this.leafAppend(e)||this.length<yt&&e.leafPrepend(this)||this.appendInner(e)):this};H.prototype.prepend=function(e){return e.length?H.from(e).append(this):this};H.prototype.appendInner=function(e){return new fo(this,e)};H.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?H.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};H.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};H.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};H.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};H.from=function(e){return e instanceof H?e:e&&e.length?new Hr(e):H.empty};var Hr=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=yt)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=yt)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(H);H.empty=new Hr([]);var fo=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(H);const ho=500;class X{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,d.push(f);return}if(s){d.push(new te(f.map));let p=f.step.map(s.slice(i)),x;p&&o.maybeStep(p).doc&&(x=o.mapping.maps[o.mapping.maps.length-1],c.push(new te(x,void 0,void 0,c.length+d.length))),i--,x&&s.appendMap(x,i)}else o.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(i)):f.selection,a=new X(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=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 f=e.steps[d].invert(e.docs[d]),h=new te(e.mapping.maps[d],f,n),p;(p=a&&a.merge(h))&&(h=p,d?i.pop():l=l.slice(0,l.length-1)),i.push(h),n&&(o++,n=void 0),s||(a=h)}let c=o-r.depth;return c>mo&&(l=po(l,c),o-=c),new X(l.append(i),o)}remapping(e,n){let r=new mt;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new X(this.items.append(e.map(n=>new te(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=n;this.items.forEach(h=>{let p=i.getMirror(--a);if(p==null)return;o=Math.min(o,p);let x=i.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(i.slice(a+1,p));y&&l++,r.push(new te(x,g,y))}else r.push(new te(x))},s);let c=[];for(let h=n;h<o;h++)c.push(new te(i.maps[h]));let d=this.items.slice(0,s).append(c).append(r),f=new X(d,l);return f.emptyItemCount()>ho&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let f=new te(c.invert(),a,d),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new X(H.from(s.reverse()),i)}}X.empty=new X(H.empty,0);function po(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class te{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new te(n.getMap().invert(),n,this.selection)}}}class ce{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const mo=20;function go(t,e,n,r){let s=n.getMeta(ve),i;if(s)return s.historyState;n.getMeta(bo)&&(t=new ce(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ve))return o.getMeta(ve).redo?new ce(t.done.addTransform(n,void 0,r,ut(e)),t.undone,Zn(n.mapping.maps),t.prevTime,t.prevComposition):new ce(t.done,t.undone.addTransform(n,void 0,r,ut(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yo(n,t.prevRanges)),c=o?$t(t.prevRanges,n.mapping):Zn(n.mapping.maps);return new ce(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,ut(e)),X.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ce(t.done.rebased(n,i),t.undone.rebased(n,i),$t(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ce(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),$t(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yo(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Zn(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function $t(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function xo(t,e,n){let r=ut(e),s=ve.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new ce(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(ve,{redo:n,historyState:a})}let Ht=!1,Qn=null;function ut(t){let e=t.plugins;if(Qn!=e){Ht=!1,Qn=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ht=!0;break}}return Ht}const ve=new yn("history"),bo=new yn("closeHistory");function ko(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Tt({key:ve,state:{init(){return new ce(X.empty,X.empty,null,0,-1)},apply(e,n,r){return go(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Vr:r=="historyRedo"?Kr:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function qr(t,e){return(n,r)=>{let s=ve.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=xo(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Vr=qr(!1,!0),Kr=qr(!0,!0),Ve=C.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Vr(t,e),redo:()=>({state:t,dispatch:e})=>Kr(t,e)}},addProseMirrorPlugins(){return[ko(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Co=C.Node.create({name:"doc",topNode:!0,content:"block+"}),So=C.Node.create({name:"text",group:"inline"});function vo(t={}){return new Tt({view(e){return new wo(e,t)}})}class wo{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let x=p.getBoundingClientRect(),g=f?x.bottom:x.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:x.left,right:x.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,d=f.top-a.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=zr(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Ao=C.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[vo(this.options)]}});var pe={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:"'"},xt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},No=typeof navigator<"u"&&/Mac/.test(navigator.platform),To=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var q=0;q<10;q++)pe[48+q]=pe[96+q]=String(q);for(var q=1;q<=24;q++)pe[q+111]="F"+q;for(var q=65;q<=90;q++)pe[q]=String.fromCharCode(q+32),xt[q]=String.fromCharCode(q);for(var qt in pe)xt.hasOwnProperty(qt)||(xt[qt]=pe[qt]);function Eo(t){var e=No&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||To&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xt:pe)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Mo=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Io=typeof navigator<"u"&&/Win/.test(navigator.platform);function Oo(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Mo?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function jo(t){let e=Object.create(null);for(let n in t)e[Oo(n)]=t[n];return e}function Vt(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Do(t){let e=jo(t);return function(n,r){let s=Eo(r),i,o=e[Vt(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Vt(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Io&&r.ctrlKey&&r.altKey)&&(i=pe[r.keyCode])&&i!=s){let l=e[Vt(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Ne=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ur=function(t,e,n,r){return n&&(Xn(t,e,n,r,-1)||Xn(t,e,n,r,1))},Lo=/^(img|br|input|textarea|hr)$/i;function Xn(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:bt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||xn(t)||Lo.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ne(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?bt(t):0}else return!1}}function bt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Po(t,e,n){for(let r=e==0,s=e==bt(t);r||s;){if(t==n)return!0;let i=Ne(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==bt(t)}}function xn(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Jr=function(t){return t.focusNode&&Ur(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Wr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const se=typeof navigator<"u"?navigator:null,Yn=typeof document<"u"?document:null,me=se&&se.userAgent||"",en=/Edge\/(\d+)/.exec(me),_r=/MSIE \d/.exec(me),tn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(me),tt=!!(_r||tn||en),Gr=_r?document.documentMode:tn?+tn[1]:en?+en[1]:0,Et=!tt&&/gecko\/(\d+)/i.test(me);Et&&+(/Firefox\/(\d+)/.exec(me)||[0,0])[1];const nn=!tt&&/Chrome\/(\d+)/.exec(me),le=!!nn,Zr=nn?+nn[1]:0,Te=!tt&&!!se&&/Apple Computer/.test(se.vendor),bn=Te&&(/Mobile\/\w+/.test(me)||!!se&&se.maxTouchPoints>2),_=bn||(se?/Mac/.test(se.platform):!1),Qr=se?/Win/.test(se.platform):!1,nt=/Android \d/.test(me),kn=!!Yn&&"webkitFontSmoothing"in Yn.documentElement.style,Ro=kn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Fo(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Jr(n)){for(a=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&M.isSelectable(f)&&s.parent&&!(f.isInline&&Po(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;c=new M(o==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,h=o;for(let p=0;p<n.rangeCount;p++){let x=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(x.startContainer,x.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(x.endContainer,x.endOffset,-1))}if(f<0)return null;[a,o]=h==t.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Yr(t,d,l,f)}return c}function Xr(t){return t.editable?t.hasFocus():Ho(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Cn(t,e=!1){let n=t.state.selection;if($o(t,n),!!Xr(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&le){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Ur(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Bo(t);else{let{anchor:r,head:s}=n,i,o;er&&!(n instanceof D)&&(n.$from.parent.inlineContent||(i=tr(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=tr(t,n.to))),t.docView.setSelection(r,s,t,e),er&&(i&&nr(i),o&&nr(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&zo(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const er=Te||le&&Zr<63;function tr(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Te&&s&&s.contentEditable=="false")return Kt(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Kt(s);if(i)return Kt(i)}}function Kt(t){return t.contentEditable="true",Te&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function nr(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function zo(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Xr(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Bo(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ne(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&tt&&Gr<=11&&(n.disabled=!0,n.disabled=!1)}function $o(t,e){if(e instanceof M){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(rr(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else rr(t)}function rr(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Yr(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||D.between(e,n,r)}function Ho(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function rn(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&L.findFrom(i,e)}function ue(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function sr(t,e,n){let r=t.state.selection;if(r instanceof D)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return ue(t,new D(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=rn(t.state,e);return s&&s instanceof M?ue(t,s):!1}else if(!(_&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?M.isSelectable(i)?ue(t,new M(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):kn?ue(t,new D(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return ue(t,new D(e>0?r.$to:r.$from));{let s=rn(t.state,e);return s?ue(t,s):!1}}}function kt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Je(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function je(t,e){return e<0?qo(t):Vo(t)}function qo(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Et&&n.nodeType==1&&r<kt(n)&&Je(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Je(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(es(n))break;{let l=n.previousSibling;for(;l&&Je(l,-1);)s=n.parentNode,i=Ne(l),l=l.previousSibling;if(l)n=l,r=kt(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?sn(t,n,r):s&&sn(t,s,i)}function Vo(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=kt(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Je(l,1))i=n,o=++r;else break}else{if(es(n))break;{let l=n.nextSibling;for(;l&&Je(l,1);)i=l.parentNode,o=Ne(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=kt(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&sn(t,i,o)}function es(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ko(t,e){for(;t&&e==t.childNodes.length&&!xn(t);)e=Ne(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Uo(t,e){for(;t&&!e&&!xn(t);)e=Ne(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function sn(t,e,n){if(e.nodeType!=3){let i,o;(o=Ko(e,n))?(e=o,n=0):(i=Uo(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Jr(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Cn(t)},50)}function ir(t,e){let n=t.state.doc.resolve(e);if(!(le||Qr)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function or(t,e,n){let r=t.state.selection;if(r instanceof D&&!r.empty||n.indexOf("s")>-1||_&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=rn(t.state,e);if(o&&o instanceof M)return ue(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof re?L.near(o,e):L.findFrom(o,e);return l?ue(t,l):!1}return!1}function lr(t,e){if(!(t.state.selection instanceof D))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function ar(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jo(t){if(!Te||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ar(t,r,"true"),setTimeout(()=>ar(t,r,"false"),20)}return!1}function Wo(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function _o(t,e){let n=e.keyCode,r=Wo(e);if(n==8||_&&n==72&&r=="c")return lr(t,-1)||je(t,-1);if(n==46&&!e.shiftKey||_&&n==68&&r=="c")return lr(t,1)||je(t,1);if(n==13||n==27)return!0;if(n==37||_&&n==66&&r=="c"){let s=n==37?ir(t,t.state.selection.from)=="ltr"?-1:1:-1;return sr(t,s,r)||je(t,s)}else if(n==39||_&&n==70&&r=="c"){let s=n==39?ir(t,t.state.selection.from)=="ltr"?1:-1:1;return sr(t,s,r)||je(t,s)}else{if(n==38||_&&n==80&&r=="c")return or(t,-1,r)||je(t,-1);if(n==40||_&&n==78&&r=="c")return Jo(t)||or(t,1,r)||je(t,1);if(r==(_?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ts(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||At.fromSchema(t.state.schema),l=ls(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=os[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let x=l.createElement(d[p]);for(;a.firstChild;)x.appendChild(a.firstChild);a.appendChild(x),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
14
|
+
`);return!i||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(D.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[b.textblockTypeInputRule({find:_o,type:this.type,getAttributes:n=>({language:n[1]})}),b.textblockTypeInputRule({find:Go,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new kt({key:new gn("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!t||!i)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
|
|
15
|
+
`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(I.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Xo=/^\s*>\s$/,Qo=b.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[b.wrappingInputRule({find:Xo,type:this.type})]}}),Yo=b.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",b.mergeAttributes(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!b.canInsertNode(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:r,$to:s}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):b.isNodeSelection(t)?i.insertContentAt(s.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(I.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(M.create(o.doc,c.pos)):o.setSelection(I.create(o.doc,c.pos));else{const f=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(o.insert(u,f),o.setSelection(I.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[b.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),el=b.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",b.mergeAttributes(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
16
|
+
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var ut=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<ut&&this.leafAppend(e)||this.length<ut&&e.leafPrepend(this)||this.appendInner(e)):this};F.prototype.prepend=function(e){return e.length?F.from(e).append(this):this};F.prototype.appendInner=function(e){return new tl(this,e)};F.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?F.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};F.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};F.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};F.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};F.from=function(e){return e instanceof F?e:e&&e.length?new _r(e):F.empty};var _r=(function(n){function e(r){n.call(this),this.values=r}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,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ut)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ut)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})(F);F.empty=new _r([]);var tl=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(F);const nl=500;class X{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(f);return}if(s){u.push(new Y(f.map));let p=f.step.map(s.slice(i)),y;p&&o.maybeStep(p).doc&&(y=o.mapping.maps[o.mapping.maps.length-1],c.push(new Y(y,void 0,void 0,c.length+u.length))),i--,y&&s.appendMap(y,i)}else o.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(i)):f.selection,a=new X(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Y(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(h),t&&(o++,t=void 0),s||(a=h)}let c=o-r.depth;return c>sl&&(l=rl(l,c),o-=c),new X(l.append(i),o)}remapping(e,t){let r=new at;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new X(this.items.append(e.map(t=>new Y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=t;this.items.forEach(h=>{let p=i.getMirror(--a);if(p==null)return;o=Math.min(o,p);let y=i.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(i.slice(a+1,p));g&&l++,r.push(new Y(y,m,g))}else r.push(new Y(y))},s);let c=[];for(let h=t;h<o;h++)c.push(new Y(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new X(u,l);return f.emptyItemCount()>nl&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let f=new Y(c.invert(),a,u),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new X(F.from(s.reverse()),i)}}X.empty=new X(F.empty,0);function rl(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Y{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Y(t.getMap().invert(),t,this.selection)}}}class ae{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const sl=20;function il(n,e,t,r){let s=t.getMeta(ke),i;if(s)return s.historyState;t.getMeta(al)&&(n=new ae(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(ke))return o.getMeta(ke).redo?new ae(n.done.addTransform(t,void 0,r,it(e)),n.undone,tr(t.mapping.maps),n.prevTime,n.prevComposition):new ae(n.done,n.undone.addTransform(t,void 0,r,it(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!ol(t,n.prevRanges)),c=o?zt(n.prevRanges,t.mapping):tr(t.mapping.maps);return new ae(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,it(e)),X.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new ae(n.done.rebased(t,i),n.undone.rebased(t,i),zt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ae(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),zt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ol(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function tr(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function zt(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function ll(n,e,t){let r=it(e),s=ke.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new ae(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(ke,{redo:t,historyState:a})}let Bt=!1,nr=null;function it(n){let e=n.plugins;if(nr!=e){Bt=!1,nr=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Bt=!0;break}}return Bt}const ke=new gn("history"),al=new gn("closeHistory");function cl(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new kt({key:ke,state:{init(){return new ae(X.empty,X.empty,null,0,-1)},apply(e,t,r){return il(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Zr:r=="historyRedo"?Xr:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Gr(n,e){return(t,r)=>{let s=ke.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=ll(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Zr=Gr(!1,!0),Xr=Gr(!0,!0),Pe=b.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Zr(n,e),redo:()=>({state:n,dispatch:e})=>Xr(n,e)}},addProseMirrorPlugins(){return[cl(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ul=b.Node.create({name:"doc",topNode:!0,content:"block+"}),fl=b.Node.create({name:"text",group:"inline"});function dl(n={}){return new kt({view(e){return new hl(e,n)}})}class hl{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let y=p.getBoundingClientRect(),m=f?y.bottom:y.top;f&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:y.left,right:y.right,top:m-g,bottom:m+g}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Jr(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const pl=b.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[dl(this.options)]}});var de={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:"'"},ft={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ml=typeof navigator<"u"&&/Mac/.test(navigator.platform),gl=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var B=0;B<10;B++)de[48+B]=de[96+B]=String(B);for(var B=1;B<=24;B++)de[B+111]="F"+B;for(var B=65;B<=90;B++)de[B]=String.fromCharCode(B+32),ft[B]=String.fromCharCode(B);for(var Ht in de)ft.hasOwnProperty(Ht)||(ft[Ht]=de[Ht]);function yl(n){var e=ml&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||gl&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ft:de)[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 xl=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),bl=typeof navigator<"u"&&/Win/.test(navigator.platform);function kl(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))xl?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Sl(n){let e=Object.create(null);for(let t in n)e[kl(t)]=n[t];return e}function $t(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 Cl(n){let e=Sl(n);return function(t,r){let s=yl(r),i,o=e[$t(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[$t(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(bl&&r.ctrlKey&&r.altKey)&&(i=de[r.keyCode])&&i!=s){let l=e[$t(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ae=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Qr=function(n,e,t,r){return t&&(rr(n,e,t,r,-1)||rr(n,e,t,r,1))},Al=/^(img|br|input|textarea|hr)$/i;function rr(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:dt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||yn(n)||Al.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ae(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?dt(n):0}else return!1}}function dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Tl(n,e,t){for(let r=e==0,s=e==dt(n);r||s;){if(n==t)return!0;let i=Ae(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==dt(n)}}function yn(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 Yr=function(n){return n.focusNode&&Qr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function es(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const ne=typeof navigator<"u"?navigator:null,sr=typeof document<"u"?document:null,he=ne&&ne.userAgent||"",Yt=/Edge\/(\d+)/.exec(he),ts=/MSIE \d/.exec(he),en=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),We=!!(ts||en||Yt),ns=ts?document.documentMode:en?+en[1]:Yt?+Yt[1]:0,St=!We&&/gecko\/(\d+)/i.test(he);St&&+(/Firefox\/(\d+)/.exec(he)||[0,0])[1];const tn=!We&&/Chrome\/(\d+)/.exec(he),oe=!!tn,rs=tn?+tn[1]:0,Te=!We&&!!ne&&/Apple Computer/.test(ne.vendor),xn=Te&&(/Mobile\/\w+/.test(he)||!!ne&&ne.maxTouchPoints>2),_=xn||(ne?/Mac/.test(ne.platform):!1),ss=ne?/Win/.test(ne.platform):!1,_e=/Android \d/.test(he),bn=!!sr&&"webkitFontSmoothing"in sr.documentElement.style,El=bn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Yr(t)){for(a=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&M.isSelectable(f)&&s.parent&&!(f.isInline&&Tl(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;c=new M(o==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let y=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(y.startContainer,y.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[a,o]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=os(n,u,l,f)}return c}function is(n){return n.editable?n.hasFocus():Il(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function kn(n,e=!1){let t=n.state.selection;if(Nl(n,t),!!is(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&oe){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Qr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)wl(n);else{let{anchor:r,head:s}=t,i,o;ir&&!(t instanceof I)&&(t.$from.parent.inlineContent||(i=or(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=or(n,t.to))),n.docView.setSelection(r,s,n,e),ir&&(i&&lr(i),o&&lr(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ml(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ir=Te||oe&&rs<63;function or(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Te&&s&&s.contentEditable=="false")return Vt(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Vt(s);if(i)return Vt(i)}}function Vt(n){return n.contentEditable="true",Te&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function lr(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Ml(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!is(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function wl(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ae(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&ns<=11&&(t.disabled=!0,t.disabled=!1)}function Nl(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ar(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ar(n)}function ar(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function os(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||I.between(e,t,r)}function Il(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 nn(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&D.findFrom(i,e)}function ce(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function cr(n,e,t){let r=n.state.selection;if(r instanceof I)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return ce(n,new I(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=nn(n.state,e);return s&&s instanceof M?ce(n,s):!1}else if(!(_&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?M.isSelectable(i)?ce(n,new M(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):bn?ce(n,new I(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return ce(n,new I(e>0?r.$to:r.$from));{let s=nn(n.state,e);return s?ce(n,s):!1}}}function ht(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Be(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ee(n,e){return e<0?Ol(n):Dl(n)}function Ol(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(St&&t.nodeType==1&&r<ht(t)&&Be(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Be(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(ls(t))break;{let l=t.previousSibling;for(;l&&Be(l,-1);)s=t.parentNode,i=Ae(l),l=l.previousSibling;if(l)t=l,r=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?rn(n,t,r):s&&rn(n,s,i)}function Dl(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=ht(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Be(l,1))i=t,o=++r;else break}else{if(ls(t))break;{let l=t.nextSibling;for(;l&&Be(l,1);)i=l.parentNode,o=Ae(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&rn(n,i,o)}function ls(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ll(n,e){for(;n&&e==n.childNodes.length&&!yn(n);)e=Ae(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 Rl(n,e){for(;n&&!e&&!yn(n);)e=Ae(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 rn(n,e,t){if(e.nodeType!=3){let i,o;(o=Ll(e,t))?(e=o,t=0):(i=Rl(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Yr(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&kn(n)},50)}function ur(n,e){let t=n.state.doc.resolve(e);if(!(oe||ss)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function fr(n,e,t){let r=n.state.selection;if(r instanceof I&&!r.empty||t.indexOf("s")>-1||_&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=nn(n.state,e);if(o&&o instanceof M)return ce(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof te?D.near(o,e):D.findFrom(o,e);return l?ce(n,l):!1}return!1}function dr(n,e){if(!(n.state.selection instanceof I))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function hr(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Pl(n){if(!Te||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 r=e.firstChild;hr(n,r,"true"),setTimeout(()=>hr(n,r,"false"),20)}return!1}function jl(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Fl(n,e){let t=e.keyCode,r=jl(e);if(t==8||_&&t==72&&r=="c")return dr(n,-1)||Ee(n,-1);if(t==46&&!e.shiftKey||_&&t==68&&r=="c")return dr(n,1)||Ee(n,1);if(t==13||t==27)return!0;if(t==37||_&&t==66&&r=="c"){let s=t==37?ur(n,n.state.selection.from)=="ltr"?-1:1:-1;return cr(n,s,r)||Ee(n,s)}else if(t==39||_&&t==70&&r=="c"){let s=t==39?ur(n,n.state.selection.from)=="ltr"?1:-1:1;return cr(n,s,r)||Ee(n,s)}else{if(t==38||_&&t==80&&r=="c")return fr(n,-1,r)||Ee(n,-1);if(t==40||_&&t==78&&r=="c")return Pl(n)||fr(n,1,r)||Ee(n,1);if(r==(_?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function as(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||xt.fromSchema(n.state.schema),l=ps(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=hs[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let y=l.createElement(u[p]);for(;a.firstChild;)y.appendChild(a.firstChild);a.appendChild(y),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
|
|
17
17
|
|
|
18
|
-
`);return{dom:a,text:h,slice:e}}function
|
|
19
|
-
`))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(f)l=f;else{let h=s.marks(),{schema:p}=t.state,x=At.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(x.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=Xo(n),kn&&Yo(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||pt.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Go.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=el(cr(l,+d[1],+d[2]),d[4]);else if(l=E.maxOpen(Zo(l.content,s),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=cr(l,f,h)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}const Go=/^(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 Zo(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&ss(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=is(o[o.length-1],i.length));let d=rs(l,a);o.push(d),s=s.matchType(d.type),i=a}}),o)return T.from(o)}return t}function rs(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,T.from(t));return t}function ss(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=ss(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(T.from(rs(n,t,s+1))))}}function is(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,is(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(T.empty,!0);return t.copy(n.append(r))}function on(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=on(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(T.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function cr(t,e,n){return e<t.openStart&&(t=new E(on(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new E(on(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const os={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 ur=null;function ls(){return ur||(ur=document.implementation.createHTMLDocument("title"))}let Ut=null;function Qo(t){let e=window.trustedTypes;return e?(Ut||(Ut=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ut.createHTML(t)):t}function Xo(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ls().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&os[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Qo(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Yo(t){let e=t.querySelectorAll(le?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function el(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=T.from(a.create(r[l+1],s)),i++,o++}return new E(s,i,o)}const ee={},W={};function fe(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}W.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!cs(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(nt&&le&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Wr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||_o(t,n)?n.preventDefault():fe(t,"key")};W.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};W.keypress=(t,e)=>{let n=e;if(cs(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||_&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof D)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Mt(t){return{left:t.clientX,top:t.clientY}}function tl(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sn(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Re(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function nl(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(Re(t,new M(n)),!0):!1}function rl(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof M&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(M.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Re(t,M.create(t.state.doc,s)),!0):!1}function sl(t,e,n,r,s){return Sn(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?rl(t,n):nl(t,n))}function il(t,e,n,r){return Sn(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function ol(t,e,n,r){return Sn(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||ll(t,n,r)}function ll(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Re(t,D.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Re(t,D.create(r,l+1,l+1+o.content.size));else if(M.isSelectable(o))Re(t,M.create(r,l));else continue;return!0}}function vn(t){return Ct(t)}const as=_?"metaKey":"ctrlKey";ee.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=vn(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&tl(n,t.input.lastClick)&&!n[as]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Mt(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new al(t,o,n,!!r)):(i=="doubleClick"?il:ol)(t,o.pos,o.inside,n)?n.preventDefault():fe(t,"pointer"))};class al{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[as],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Et&&!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)),fe(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(()=>Cn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Mt(e))),this.updateAllowDefault(e),this.allowDefault||!n?fe(this.view,"pointer"):sl(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Te&&this.mightDrag&&!this.mightDrag.node.isAtom||le&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Re(this.view,L.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fe(this.view,"pointer")}move(e){this.updateAllowDefault(e),fe(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)}}ee.touchstart=t=>{t.input.lastTouch=Date.now(),vn(t),fe(t,"pointer")};ee.touchmove=t=>{t.input.lastTouch=Date.now(),fe(t,"pointer")};ee.contextmenu=t=>vn(t);function cs(t,e){return t.composing?!0:Te&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const cl=nt?5e3:-1;W.compositionstart=W.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof D&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||le&&Qr&&ul(t)))t.markCursor=t.state.storedMarks||n.marks(),Ct(t,!0),t.markCursor=null;else if(Ct(t,!e.selection.empty),Et&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}us(t,cl)};function ul(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}W.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,us(t,20))};function us(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ct(t),e))}function dl(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=fl());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function fl(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ct(t,e=!1){if(!(nt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dl(t),e||t.docView&&t.docView.dirty){let n=Fo(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function hl(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Xe=tt&&Gr<15||bn&&Ro<604;ee.copy=W.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Xe?null:n.clipboardData,o=r.content(),{dom:l,text:a}=ts(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):hl(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pl(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ml(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ln(t,r.value,null,s,e):ln(t,r.textContent,r.innerHTML,s,e)},50)}function ln(t,e,n,r,s){let i=ns(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||E.empty)))return!0;if(!i)return!1;let o=pl(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ds(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}W.paste=(t,e)=>{let n=e;if(t.composing&&!nt)return;let r=Xe?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ln(t,ds(r),r.getData("text/html"),s,n)?n.preventDefault():ml(t,n)};class gl{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const yl=_?"altKey":"ctrlKey";function fs(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[yl]}ee.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Mt(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof M?s.to-1:s.to))){if(r&&r.mightDrag)o=M.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=M.create(t.state.doc,f.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:d}=ts(t,l);(!n.dataTransfer.files.length||!le||Zr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Xe?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Xe||n.dataTransfer.setData("text/plain",c),t.dragging=new gl(d,fs(t,n),o)};ee.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};W.dragover=W.dragenter=(t,e)=>e.preventDefault();W.drop=(t,e)=>{try{xl(t,e,t.dragging)}finally{t.dragging=null}};function xl(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Mt(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=ns(t,ds(e.dataTransfer),Xe?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&fs(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||E.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?zr(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:p}=n;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(f))return;let h=a.doc.resolve(c);if(d&&M.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new M(h));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((x,g,y,b)=>p=b),a.setSelection(Yr(t,h,a.doc.resolve(p)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}ee.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Cn(t)},20))};ee.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ee.beforeinput=(t,e)=>{if(le&&nt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Wr(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in W)ee[t]=W[t];function Ye(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class St{constructor(e,n){this.toDOM=e,this.spec=n||we,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new ne(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof St&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ye(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class he{constructor(e,n){this.attrs=e,this.spec=n||we}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ne(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof he&&Ye(this.attrs,e.attrs)&&Ye(this.spec,e.spec)}static is(e){return e.type instanceof he}destroy(){}}class wn{constructor(e,n){this.attrs=e,this.spec=n||we}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ne(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof wn&&Ye(this.attrs,e.attrs)&&Ye(this.spec,e.spec)}destroy(){}}class ne{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ne(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ne(e,e,new St(n,r))}static inline(e,n,r,s){return new ne(e,n,new he(r,s))}static node(e,n,r,s){return new ne(e,n,new wn(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof he}get widget(){return this.type instanceof St}}const Le=[],we={};class ${constructor(e,n){this.local=e.length?e:Le,this.children=n.length?n:Le}static create(e,n){return n.length?vt(n,e,0,we):U}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==U||e.maps.length==0?this:this.mapInner(e,n,0,0,r||we)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?bl(this.children,o||[],e,n,r,s,i):o?new $(o.sort(Ae),Le):U}add(e,n){return n.length?this==U?$.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,d;if(d=ps(n,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,d,c+1):s.splice(i,0,a,a+l.nodeSize,vt(d,l,c+1,we)),i+=3}});let o=hs(i?ms(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new $(o.length?this.local.concat(o).sort(Ae):this.local,s||this.children)}remove(e){return e.length==0||this==U?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=U?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new $(s,r):U}forChild(e,n){if(this==U)return this;if(n.isLeaf)return $.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof he){let c=Math.max(i,a.from)-i,d=Math.min(o,a.to)-i;c<d&&(s||(s=[])).push(a.copy(c,d))}}if(s){let l=new $(s.sort(Ae),Le);return r?new be([l,r]):l}return r||U}eq(e){if(this==e)return!0;if(!(e instanceof $)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return An(this.localsInner(e))}localsInner(e){if(this==U)return Le;if(e.inlineContent||!this.local.some(he.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof he||n.push(this.local[r]);return n}forEachSet(e){e(this)}}$.empty=new $([],[]);$.removeOverlap=An;const U=$.empty;class be{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,we));return be.from(r)}forChild(e,n){if(n.isLeaf)return $.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=U&&(i instanceof be?r=r.concat(i.members):r.push(i))}return be.from(r)}eq(e){if(!(e instanceof be)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?An(r?n:n.sort(Ae)):Le}static from(e){switch(e.length){case 0:return U;case 1:return e[0];default:return new be(e.every(n=>n instanceof $)?e:e.reduce((n,r)=>n.concat(r instanceof $?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function bl(t,e,n,r,s,i,o){let l=t.slice();for(let c=0,d=i;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,x,g)=>{let y=g-x-(p-h);for(let b=0;b<l.length;b+=3){let A=l[b+1];if(A<0||h>A+d-f)continue;let N=l[b]+d-f;p>=N?l[b+1]=h<=N?-2:-1:h>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=n.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=n.map(t[c]+i),f=d-s;if(f<0||f>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+i,-1),p=h-s,{index:x,offset:g}=r.content.findIndex(f),y=r.maybeChild(x);if(y&&g==f&&g+y.nodeSize==p){let b=l[c+2].mapInner(n,y,d+1,t[c]+i+1,o);b!=U?(l[c]=f,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=kl(l,t,e,n,s,i,o),d=vt(c,r,0,o);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new $(e.sort(Ae),l)}function hs(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new ne(s.from+e,s.to+e,s.type))}return n}function kl(t,e,n,r,s,i,o){function l(a,c){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,s,c);f?n.push(f):o.onRemove&&o.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<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function ps(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function ms(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function vt(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let c=ps(t,l,a+n);if(c){i=!0;let d=vt(c,l,n+a+1,r);d!=U&&s.push(a,a+l.nodeSize,d)}});let o=hs(i?ms(t):t,-n).sort(Ae);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new $(o,s):U}function Ae(t,e){return t.from-e.from||t.to-e.to}function An(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),dr(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),dr(e,s,r.copy(i.from,r.to)));break}}}return e}function dr(t,e,n){for(;e<t.length&&Ae(n,t[e])>0;)e++;t.splice(e,0,n)}class P extends L{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return P.valid(r)?new P(r):L.near(r)}content(){return E.empty}eq(e){return e instanceof P&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new P(e.resolve(n.pos))}getBookmark(){return new Nn(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Cl(e)||!Sl(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&P.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(P.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!M.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(P.valid(l))return l}return null}}}P.prototype.visible=!1;P.findFrom=P.findGapCursorFrom;L.jsonID("gapcursor",P);class Nn{constructor(e){this.pos=e}map(e){return new Nn(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return P.valid(n)?new P(n):L.near(n)}}function gs(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Cl(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||gs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Sl(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||gs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function vl(){return new Tt({props:{decorations:Tl,createSelectionBetween(t,e,n){return e.pos==n.pos&&P.valid(n)?new P(n):null},handleClick:Al,handleKeyDown:wl,handleDOMEvents:{beforeinput:Nl}}})}const wl=Do({ArrowLeft:ot("horiz",-1),ArrowRight:ot("horiz",1),ArrowUp:ot("vert",-1),ArrowDown:ot("vert",1)});function ot(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof D){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=P.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new P(c))),!0):!1}}function Al(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!P.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&M.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new P(r))),!0)}function Nl(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof P))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=T.empty;for(let o=r.length-1;o>=0;o--)s=T.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new E(s,0,0));return i.setSelection(D.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Tl(t){if(!(t.selection instanceof P))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",$.create(t.doc,[ne.widget(t.selection.head,e,{key:"gapcursor"})])}const El=C.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[vl()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=C.callOrReturn(C.getExtensionField(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),$e={bold:{category:"mark",extension:Ai,priority:100},italic:{category:"mark",extension:Ii,priority:100},strike:{category:"mark",extension:Di,priority:100},underline:{category:"mark",extension:qs.Underline,priority:100},code:{category:"mark",extension:Ri,priority:100},textColor:{category:"mark",extension:Vs.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Ks.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Us.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Bi,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:qi,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Ki,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Js.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:oo,priority:100},blockquote:{category:"node",extension:ao,priority:100},horizontalRule:{category:"node",extension:co,priority:100},hardBreak:{category:"node",extension:uo,priority:100},undo:{category:"extension",extension:Ve,priority:50},redo:{category:"extension",extension:Ve,priority:50},textAlign:{category:"extension",extension:_s.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Ve,priority:50},clearNodes:{category:"extension",extension:Ve,priority:50}},Ml=[Co,So,$i,zi,Ui,Ws.TaskItem,Ve,Ao,El];function Il(t){const e=[],n=new Set,r=new Set;Ml.forEach(l=>{l&&(e.push(l),r.add(l.name),l.name==="history"&&(n.add("undo"),n.add("redo")))});const s=t.map(l=>_e(l)),i=new Set;return s.forEach(l=>{const a=$e[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(n.has(l))return;const a=$e[l];if(!a||a.extension===null)return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),n.add(l)}),s.forEach(l=>{if(n.has(l))return;const a=$e[l];if(!a||a.extension===null){console.warn(`Extension not found or not installed for modifier: ${l}`);return}if(a.extension.name==="history"&&n.has("undo"))return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),n.add(l),(l==="undo"||l==="redo")&&(n.add("undo"),n.add("redo"))}),e.sort((l,a)=>{const c=Object.values($e).find(p=>p?.extension?.name===l.name),d=Object.values($e).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(d?.priority??100)-f})}const ys={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},Ol=({modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})=>{const{editor:s}=hn.useCurrentEditor();return u.jsx(ki,{editor:s,modifiers:t,zoom:e,onZoomChange:n,onToolbarAction:r})},jl=({showCharacterCount:t,showWordCount:e})=>{const{editor:n}=hn.useCurrentEditor();if(!n||!t&&!e)return null;const r=n.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return u.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[t&&u.jsxs("span",{children:[s," characters"]}),e&&u.jsxs("span",{children:[i," words"]})]})},an=k.forwardRef((t,e)=>{const{minRows:n=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=ys.full,variant:c="bordered",initialContent:d,content:f,onContentChange:h,onUpdate:p,onToolbarAction:x,isReadOnly:g=!1,isDisabled:y=!1,...b}=t,{zoom:A,setZoom:N}=yi(),I=Dn.lineHeight,j=n*I,w=s?void 0:r*I,S=k.useMemo(()=>Il(a),[a]),{Component:O,label:F,shouldLabelBeOutside:B,getBaseProps:ze,getLabelProps:Be,getInputWrapperProps:Ee}=m.useInput({...b,variant:c,ref:e,isMultiline:!0}),Me=F?u.jsx("label",{...Be(),children:F}):null,z=k.useCallback(({editor:Z})=>{const Ie=Z.getHTML(),Oe=Z.getJSON(),Q=Z.getText(),ge=Q.length,Hs=Q.split(/\s+/).filter(Ot=>Ot.length>0).length,jn={html:Ie,json:Oe,text:Q,characters:ge,words:Hs};if(h?.(jn),p?.(jn),"onChange"in b&&typeof b.onChange=="function"){const Ot={target:{value:Ie},currentTarget:{value:Ie}};b.onChange(Ot)}},[h,p,b]);return u.jsxs(O,{...ze(),children:[B?Me:null,u.jsx("div",{...Ee(),className:m.cn(Ee().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:w?`${w+Dn.toolbarHeight}px`:void 0,overflow:w?"auto":void 0},children:u.jsx(hn.EditorProvider,{editable:!g&&!y,slotBefore:l?u.jsx(Ol,{modifiers:a,zoom:A,onZoomChange:N,onToolbarAction:x}):void 0,slotAfter:u.jsx(jl,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${j}px`,fontSize:`${A}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:S,content:f||d||t.defaultValue||"",onUpdate:z})})]})});an.displayName="TipTapEditor";const xs=k.forwardRef((t,e)=>{const{adapter:n="tiptap",variant:r="bordered",...s}=t;return n==="tiptap"?u.jsx(an,{...s,variant:r,ref:e}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),u.jsx(an,{...s,variant:r,ref:e}))});xs.displayName="RichTextArea";function Dl(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}const fr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Ll={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},bs=({presetAmounts:t=fr,selectedDonation:e,defaultSelectedDonation:n=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:c,mobileColumns:d=2,desktopColumns:f=3,isDisabled:h=!1,buttonVariant:p="bordered",buttonColor:x="default",inputVariant:g="bordered",className:y="",showCard:b=!0})=>{const A={...Ll,...c},N=Array.isArray(t)?t:fr,I={2:"grid-cols-2",3:"grid-cols-3"},j={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},w=`${I[d]} ${j[f]}`,[S,O]=pn(e,n,r),[F,B]=k.useState(""),ze=k.useCallback(z=>{if(h)return;const Z={amount:z.amount,isCustom:!1,presetId:z.id};O(Z),B("")},[h,O]),Be=k.useCallback(z=>{if(h)return;if(B(z!==void 0?String(z):""),z===void 0||isNaN(z)){O(null);return}O({amount:z,isCustom:!0})},[h,O]),Ee=k.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Me=u.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[A.title&&u.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:A.title}),N.length>0&&u.jsx("div",{className:m.cn("grid gap-3",w),"data-testid":"donation-amounts-presets",children:N.map(z=>{const Z=S!==null&&!S.isCustom&&S.presetId===z.id;return u.jsx(m.Button,{color:Z?"primary":x,variant:Z?"solid":p,className:"w-full",onPress:()=>ze(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||Dl(z.amount,i,s)},z.id)})}),o&&u.jsx(m.NumberInput,{placeholder:A.customAmountPlaceholder,"aria-label":A.customAmountAriaLabel,variant:g,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:Ee,value:F!==""?parseFloat(F):void 0,onValueChange:Be,isDisabled:h,"data-testid":"donation-amounts-custom-input"},S?.isCustom===!1?S.presetId:"custom")]});return b?u.jsx(m.Card,{className:m.cn("w-full",y),"data-testid":"donation-amounts-card",children:u.jsx(m.CardBody,{children:Me})}):u.jsx("div",{className:m.cn("w-full",y),"data-testid":"donation-amounts-plain",children:Me})};bs.displayName="DonationAmounts";const Pl=t=>{const e=Math.max(0,t),n=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${n}:${r} minutes`},Rl=t=>{switch(t){case"warning":return v.Clock;case"error":return v.AlertCircle;case"success":return v.CheckCircle;default:return v.Clock}},Fl=t=>{switch(t){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},ks=k.forwardRef(({timeLeft:t,defaultTimeLeft:e=1200,onTimeChange:n,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:c="fixed",autoStart:d=!0,formatTime:f=Pl,className:h,...p},x)=>{const[g,y]=pn(t!==void 0?Math.max(0,t):void 0,Math.max(0,e),n),b=k.useRef(null),A=k.useRef(!1);k.useEffect(()=>()=>{b.current&&clearInterval(b.current)},[]),k.useEffect(()=>{if(!d||g<=0){b.current&&(clearInterval(b.current),b.current=null);return}return b.current=setInterval(()=>{y(w=>w<=1?(b.current&&(clearInterval(b.current),b.current=null),A.current||(A.current=!0,r?.()),0):w-1)},1e3),()=>{b.current&&(clearInterval(b.current),b.current=null)}},[d,g,y,r]),k.useEffect(()=>{g>0&&(A.current=!1)},[g]);const N=a||Rl(s),I=Fl(i),j={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return u.jsx("div",{ref:x,role:"banner","aria-live":"polite","aria-label":`${o} ${f(g)}`,"data-testid":"expire-cart-timer",className:m.cn("w-full text-white z-50",I,j[c],h),...p,children:u.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:u.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[u.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&u.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:u.jsx(N,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),u.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),u.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:u.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(g)}`,"data-testid":"expire-cart-timer-value",children:f(g)})})]})})})});ks.displayName="ExpireCartTimer";function zl(t,e){const n=t.icons,r=t.aliases||Object.create(null),s=Object.create(null);function i(o){if(n[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}const Cs=Object.freeze({left:0,top:0,width:16,height:16}),wt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Tn=Object.freeze({...Cs,...wt}),cn=Object.freeze({...Tn,body:"",hidden:!1});function Bl(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const r=((t.rotate||0)+(e.rotate||0))%4;return r&&(n.rotate=r),n}function hr(t,e){const n=Bl(t,e);for(const r in cn)r in wt?r in t&&!(r in n)&&(n[r]=wt[r]):r in e?n[r]=e[r]:r in t&&(n[r]=t[r]);return n}function $l(t,e,n){const r=t.icons,s=t.aliases||Object.create(null);let i={};function o(l){i=hr(r[l]||s[l],i)}return o(e),n.forEach(o),hr(t,i)}function Ss(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(s=>{e(s,null),n.push(s)});const r=zl(t);for(const s in r){const i=r[s];i&&(e(s,$l(t,s,i)),n.push(s))}return n}const Hl={provider:"",aliases:{},not_found:{},...Cs};function Jt(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function vs(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Jt(t,Hl))return null;const n=e.icons;for(const s in n){const i=n[s];if(!s||typeof i.body!="string"||!Jt(i,cn))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!n[o]&&!r[o]||!Jt(i,cn))return null}return e}const pr=Object.create(null);function ql(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Fe(t,e){const n=pr[t]||(pr[t]=Object.create(null));return n[e]||(n[e]=ql(t,e))}function ws(t,e){return vs(e)?Ss(e,(n,r)=>{r?t.icons[n]=r:t.missing.add(n)}):[]}function Vl(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}const As=/^[a-z0-9]+(-[a-z0-9]+)*$/,It=(t,e,n,r="")=>{const s=t.split(":");if(t.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),c={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!dt(c)?null:c}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!dt(l)?null:l}if(n&&r===""){const l={provider:r,prefix:"",name:i};return e&&!dt(l,n)?null:l}return null},dt=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;let et=!1;function Ns(t){return typeof t=="boolean"&&(et=t),et}function mr(t){const e=typeof t=="string"?It(t,!0,et):t;if(e){const n=Fe(e.provider,e.prefix),r=e.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Kl(t,e){const n=It(t,!0,et);if(!n)return!1;const r=Fe(n.provider,n.prefix);return e?Vl(r,n.name,e):(r.missing.add(n.name),!0)}function Ul(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),et&&!e&&!t.prefix){let s=!1;return vs(t)&&(t.prefix="",Ss(t,(i,o)=>{Kl(i,o)&&(s=!0)})),s}const n=t.prefix;if(!dt({prefix:n,name:"a"}))return!1;const r=Fe(e,n);return!!ws(r,t)}const Ts=Object.freeze({width:null,height:null}),Es=Object.freeze({...Ts,...wt}),Jl=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Wl=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function gr(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Jl);if(r===null||!r.length)return t;const s=[];let i=r.shift(),o=Wl.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function _l(t,e="defs"){let n="";const r=t.indexOf("<"+e);for(;r>=0;){const s=t.indexOf(">",r),i=t.indexOf("</"+e);if(s===-1||i===-1)break;const o=t.indexOf(">",i);if(o===-1)break;n+=t.slice(s+1,i).trim(),t=t.slice(0,r).trim()+t.slice(o+1)}return{defs:n,content:t}}function Gl(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Zl(t,e,n){const r=_l(t);return Gl(r.defs,e+r.content+n)}const Ql=t=>t==="unset"||t==="undefined"||t==="none";function Xl(t,e){const n={...Tn,...t},r={...Es,...e},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(g=>{const y=[],b=g.hFlip,A=g.vFlip;let N=g.rotate;b?A?N+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):A&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let I;switch(N<0&&(N-=Math.floor(N/4)*4),N=N%4,N){case 1:I=s.height/2+s.top,y.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,y.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}N%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),y.length&&(i=Zl(i,'<g transform="'+y.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,c=s.height;let d,f;o===null?(f=l===null?"1em":l==="auto"?c:l,d=gr(f,a/c)):(d=o==="auto"?a:o,f=l===null?gr(d,c/a):l==="auto"?c:l);const h={},p=(g,y)=>{Ql(y)||(h[g]=y.toString())};p("width",d),p("height",f);const x=[s.left,s.top,a,c];return h.viewBox=x.join(" "),{attributes:h,viewBox:x,body:i}}const Yl=/\sid="(\S+)"/g,ea="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let ta=0;function na(t,e=ea){const n=[];let r;for(;r=Yl.exec(t);)n.push(r[1]);if(!n.length)return t;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof e=="function"?e(i):e+(ta++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),t=t.replace(new RegExp(s,"g"),""),t}const un=Object.create(null);function ra(t,e){un[t]=e}function dn(t){return un[t]||un[""]}function En(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Mn=Object.create(null),He=["https://api.simplesvg.com","https://api.unisvg.com"],ft=[];for(;He.length>0;)He.length===1||Math.random()>.5?ft.push(He.shift()):ft.push(He.pop());Mn[""]=En({resources:["https://api.iconify.design"].concat(ft)});function sa(t,e){const n=En(e);return n===null?!1:(Mn[t]=n,!0)}function In(t){return Mn[t]}const ia=()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}};let yr=ia();function oa(t,e){const n=In(t);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function la(t){return t===404}const aa=(t,e,n)=>{const r=[],s=oa(t,e),i="icons";let o={type:i,provider:t,prefix:e,icons:[]},l=0;return n.forEach((a,c)=>{l+=a.length+1,l>=s&&c>0&&(r.push(o),o={type:i,provider:t,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function ca(t){if(typeof t=="string"){const e=In(t);if(e)return e.path}return"/"}const ua=(t,e,n)=>{if(!yr){n("abort",424);return}let r=ca(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;yr(t+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(la(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},da={prepare:aa,send:ua};function Ms(t,e){t.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==e))})}function fa(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const r=t.provider,s=t.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const c=a.name;if(t.icons[c])o.loaded.push({provider:r,prefix:s,name:c});else if(t.missing.has(c))o.missing.push({provider:r,prefix:s,name:c});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||Ms([t],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let ha=0;function pa(t,e,n){const r=ha++,s=Ms.bind(null,n,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:t,abort:s};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function ma(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return t.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=n[i]||(n[i]=Object.create(null)),c=a[o]||(a[o]=Fe(i,o));let d;l in c.icons?d=e.loaded:o===""||c.missing.has(l)?d=e.missing:d=e.pending;const f={provider:i,prefix:o,name:l};d.push(f)}),e}function ga(t,e=!0,n=!1){const r=[];return t.forEach(s=>{const i=typeof s=="string"?It(s,e,n):s;i&&r.push(i)}),r}const ya={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function xa(t,e,n,r){const s=t.resources.length,i=t.random?Math.floor(Math.random()*s):t.index;let o;if(t.random){let w=t.resources.slice(0);for(o=[];w.length>1;){const S=Math.floor(Math.random()*w.length);o.push(w[S]),w=w.slice(0,S).concat(w.slice(S+1))}o=o.concat(w)}else o=t.resources.slice(i).concat(t.resources.slice(0,i));const l=Date.now();let a="pending",c=0,d,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function x(){f&&(clearTimeout(f),f=null)}function g(){a==="pending"&&(a="aborted"),x(),h.forEach(w=>{w.status==="pending"&&(w.status="aborted")}),h=[]}function y(w,S){S&&(p=[]),typeof w=="function"&&p.push(w)}function b(){return{startTime:l,payload:e,status:a,queriesSent:c,queriesPending:h.length,subscribe:y,abort:g}}function A(){a="failed",p.forEach(w=>{w(void 0,d)})}function N(){h.forEach(w=>{w.status==="pending"&&(w.status="aborted")}),h=[]}function I(w,S,O){const F=S!=="success";switch(h=h.filter(B=>B!==w),a){case"pending":break;case"failed":if(F||!t.dataAfterTimeout)return;break;default:return}if(S==="abort"){d=O,A();return}if(F){d=O,h.length||(o.length?j():A());return}if(x(),N(),!t.random){const B=t.resources.indexOf(w.resource);B!==-1&&B!==t.index&&(t.index=B)}a="completed",p.forEach(B=>{B(O)})}function j(){if(a!=="pending")return;x();const w=o.shift();if(w===void 0){if(h.length){f=setTimeout(()=>{x(),a==="pending"&&(N(),A())},t.timeout);return}A();return}const S={status:"pending",resource:w,callback:(O,F)=>{I(S,O,F)}};h.push(S),c++,f=setTimeout(j,t.rotate),n(w,e,S.callback)}return setTimeout(j),b}function Is(t){const e={...ya,...t};let n=[];function r(){n=n.filter(l=>l().status==="pending")}function s(l,a,c){const d=xa(e,l,a,(f,h)=>{r(),c&&c(f,h)});return n.push(d),d}function i(l){return n.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function xr(){}const Wt=Object.create(null);function ba(t){if(!Wt[t]){const e=In(t);if(!e)return;const n=Is(e),r={config:e,redundancy:n};Wt[t]=r}return Wt[t]}function ka(t,e,n){let r,s;if(typeof t=="string"){const i=dn(t);if(!i)return n(void 0,424),xr;s=i.send;const o=ba(t);o&&(r=o.redundancy)}else{const i=En(t);if(i){r=Is(i);const o=t.resources?t.resources[0]:"",l=dn(o);l&&(s=l.send)}}return!r||!s?(n(void 0,424),xr):r.query(e,s,n)().abort}function br(){}function Ca(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,fa(t)}))}function Sa(t){const e=[],n=[];return t.forEach(r=>{(r.match(As)?e:n).push(r)}),{valid:e,invalid:n}}function qe(t,e,n){function r(){const s=t.pendingIcons;e.forEach(i=>{s&&s.delete(i),t.icons[i]||t.missing.add(i)})}if(n&&typeof n=="object")try{if(!ws(t,n).length){r();return}}catch(s){console.error(s)}r(),Ca(t)}function kr(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function va(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:r}=t,s=t.iconsToLoad;if(delete t.iconsToLoad,!s||!s.length)return;const i=t.loadIcon;if(t.loadIcons&&(s.length>1||!i)){kr(t.loadIcons(s,r,n),d=>{qe(t,s,d)});return}if(i){s.forEach(d=>{const f=i(d,r,n);kr(f,h=>{const p=h?{prefix:r,icons:{[d]:h}}:null;qe(t,[d],p)})});return}const{valid:o,invalid:l}=Sa(s);if(l.length&&qe(t,l,null),!o.length)return;const a=r.match(As)?dn(n):null;if(!a){qe(t,o,null);return}a.prepare(n,r,o).forEach(d=>{ka(n,d,f=>{qe(t,d.icons,f)})})}))}const wa=(t,e)=>{const n=ga(t,!0,Ns()),r=ma(n);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,br)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:c,prefix:d}=a;if(d===l&&c===o)return;o=c,l=d,i.push(Fe(c,d));const f=s[c]||(s[c]=Object.create(null));f[d]||(f[d]=[])}),r.pending.forEach(a=>{const{provider:c,prefix:d,name:f}=a,h=Fe(c,d),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),s[c][d].push(f))}),i.forEach(a=>{const c=s[a.provider][a.prefix];c.length&&va(a,c)}),e?pa(e,r,i):br};function Aa(t,e){const n={...t};for(const r in e){const s=e[r],i=typeof s;r in Ts?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const Na=/[\s,]+/;function Ta(t,e){e.split(Na).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Ea(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(t);return isNaN(s)?0:r(s)}else if(n!==t){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Ma(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function Ia(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Oa(t){return"data:image/svg+xml,"+Ia(t)}function ja(t){return'url("'+Oa(t)+'")'}let We;function Da(){try{We=window.trustedTypes.createPolicy("iconify",{createHTML:t=>t})}catch{We=null}}function La(t){return We===void 0&&Da(),We?We.createHTML(t):t}const Os={...Es,inline:!1},Pa={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Ra={display:"inline-block"},fn={backgroundColor:"currentColor"},js={backgroundColor:"transparent"},Cr={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Sr={WebkitMask:fn,mask:fn,background:js};for(const t in Sr){const e=Sr[t];for(const n in Cr)e[t+n]=Cr[n]}const Fa={...Os,inline:!0};function vr(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const za=(t,e,n)=>{const r=e.inline?Fa:Os,s=Aa(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?Pa:{}};if(n){const y=It(n,!1,!0);if(y){const b=["iconify"],A=["provider","prefix"];for(const N of A)y[N]&&b.push("iconify--"+y[N]);a.className=b.join(" ")}}for(let y in e){const b=e[y];if(b!==void 0)switch(y){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=b;break;case"className":a[y]=(a[y]?a[y]+" ":"")+b;break;case"inline":case"hFlip":case"vFlip":s[y]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&Ta(s,b);break;case"color":o.color=b;break;case"rotate":typeof b=="string"?s[y]=Ea(b):typeof b=="number"&&(s[y]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete a["aria-hidden"];break;default:r[y]===void 0&&(a[y]=b)}}const c=Xl(t,s),d=c.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,d);let y=0,b=e.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:La(na(c.body,b?()=>b+"ID"+y++:"iconifyReact"))},k.createElement("svg",a)}const{body:f,width:h,height:p}=t,x=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),g=Ma(f,{...d,width:h+"",height:p+""});return a.style={...o,"--svg":ja(g),width:vr(d.width),height:vr(d.height),...Ra,...x?fn:js,...l},k.createElement("span",a)};Ns(!0);ra("",da);if(typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Ul(r))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const r="IconifyProviders["+n+"] is invalid.";try{const s=e[n];if(typeof s!="object"||!s||s.resources===void 0)continue;sa(n,s)||console.error(r)}catch{console.error(r)}}}}function Ds(t){const[e,n]=k.useState(!!t.ssr),[r,s]=k.useState({});function i(p){if(p){const x=t.icon;if(typeof x=="object")return{name:"",data:x};const g=mr(x);if(g)return{name:x,data:g}}return{name:""}}const[o,l]=k.useState(i(!!t.ssr));function a(){const p=r.callback;p&&(p(),s({}))}function c(p){if(JSON.stringify(o)!==JSON.stringify(p))return a(),l(p),!0}function d(){var p;const x=t.icon;if(typeof x=="object"){c({name:"",data:x});return}const g=mr(x);if(c({name:x,data:g}))if(g===void 0){const y=wa([x],d);s({callback:y})}else g&&((p=t.onLoad)===null||p===void 0||p.call(t,x))}k.useEffect(()=>(n(!0),a),[]),k.useEffect(()=>{e&&d()},[t.icon,e]);const{name:f,data:h}=o;return h?za({...Tn,...h},t,f):t.children?t.children:t.fallback?t.fallback:k.createElement("span",{})}const de=k.forwardRef((t,e)=>Ds({...t,_ref:e}));k.forwardRef((t,e)=>Ds({inline:!0,...t,_ref:e}));const _t=({icon:t,children:e,testId:n})=>u.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[u.jsx(de,{icon:t,width:20,className:"text-default-500"}),u.jsx("span",{children:e})]}),Ba=({classes:t="",name:e,imageUrl:n,eventDate:r,eventTime:s,location:i,description:o,showImage:l=!1,showMoreButtonClassName:a,labels:c})=>{const[d,f]=k.useState(!1),[h,p]=k.useState(!1),x=k.useRef(null);return k.useEffect(()=>{const g=()=>{if(x.current){const y=x.current.scrollHeight>x.current.clientHeight;p(y)}};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[o]),u.jsxs(m.Card,{className:m.cn("border-0 shadow-none",t),"data-testid":"event-details-root",children:[u.jsxs(m.CardHeader,{className:"pt-2 pb-0 flex-col items-start space-y-2","data-testid":"event-details-header",children:[l&&n&&u.jsx("div",{className:"w-full aspect-[3/1] overflow-hidden rounded-xl","data-testid":"event-details-image-wrapper",children:u.jsx(m.Image,{alt:`Event image for ${e}`,className:"w-full h-full object-cover",src:n,"data-testid":"event-details-image"})}),u.jsx("h2",{className:"font-semibold text-xl text-gray-800","data-testid":"event-details-title",children:e})]}),u.jsxs(m.CardBody,{className:"py-3 space-y-3","data-testid":"event-details-body",children:[u.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:c.eventInformation}),u.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[r&&u.jsx(_t,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:r}),s&&u.jsx(_t,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:s}),i&&u.jsx(_t,{icon:"solar:point-on-map-outline",testId:"event-details-location",children:i})]}),o&&u.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[u.jsx("p",{ref:x,className:m.cn("text-sm text-gray-700 leading-relaxed transition-all",!d&&"line-clamp-2"),"data-testid":"event-details-description",children:o}),(h||d)&&u.jsx("div",{className:"flex justify-end mt-1",children:u.jsx(ht,{onPress:()=>f(!d),variant:"light",className:m.cn("text-primary",a),startContent:u.jsx(de,{icon:d?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:d?c.showLess||"Hide":c.showMore||"Show"})})]})]})]})};function Ls(t,e="en-US",n="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${t.toFixed(2)}`}}function $a(t){const e=t.replace(/[^\d.,-]/g,""),n=e.match(/,\d{1,2}$/);let r;n?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");const s=parseFloat(r);return isNaN(s)?null:s}const Ha={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached"},lt=t=>typeof t=="number"&&!isNaN(t),On=({offer:t,quantity:e,defaultQuantity:n=0,onQuantityChange:r,currency:s="USD",locale:i="en-US",labels:o,slots:l,isDisabled:a=!1,buttonVariant:c="bordered",buttonColor:d="default",showCard:f=!0,showDescription:h=!0,showPeopleCount:p=!0,showPrice:x=!0,classNames:g={},"data-testid":y,selectedColor:b="primary"})=>{const A={...Ha,...o},[N,I]=k.useState(n),j=e!==void 0?e:N,w=Q=>{if(a)return;const ge=Math.max(0,j+Q);e===void 0&&I(ge),r?.(t.id,ge)},S=k.useMemo(()=>!lt(t.totalTicketsSold)||!lt(t.ticketsAllowed)?!1:t.totalTicketsSold>=t.ticketsAllowed,[t.totalTicketsSold,t.ticketsAllowed]),O=k.useMemo(()=>S||!lt(t.ticketsAllowed)?!1:j>=t.ticketsAllowed-(t.totalTicketsSold??0),[S,t.ticketsAllowed,t.totalTicketsSold,j]),F=Ls(t.price,i,s),B=()=>l?.renderName?l.renderName(t.name,t):u.jsx("h2",{"data-testid":"offer-card-name",className:m.cn("text-base font-medium",g.name),children:t.name}),ze=()=>x?l?.renderPrice?l.renderPrice(t.price,F,t):u.jsx("p",{"data-testid":"offer-card-price",className:m.cn("text-primary text-base mt-1",g.price),children:F}):null,Be=()=>!h||!t.description?null:l?.renderDescription?l.renderDescription(t.description,t):u.jsx("p",{"data-testid":"offer-card-description",className:m.cn("mb-4 text-sm text-gray-700 leading-relaxed",g.description),children:t.description}),Ee=()=>{if(!p||!lt(t.numberOfPeople)||t.numberOfPeople<=0)return null;const Q=t.numberOfPeople===1?A.person:A.people;return l?.renderPeopleCount?l.renderPeopleCount(t.numberOfPeople,Q,t):u.jsxs("p",{"data-testid":"offer-card-people-count",className:m.cn("text-sm text-gray-600 flex items-center mt-2",g.peopleCount),children:[u.jsx(de,{icon:t.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),t.numberOfPeople," ",Q]})},Me=()=>{const Q=j===0||a,ge=O||a;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:j,onIncrement:()=>w(1),onDecrement:()=>w(-1),isDecrementDisabled:Q,isIncrementDisabled:ge,isDisabled:a}):u.jsxs("div",{className:m.cn("flex items-center gap-2",g.quantitySelector),children:[u.jsx(ht,{"data-testid":"offer-card-decrement-button",onPress:()=>w(-1),isDisabled:Q,variant:c,color:j>0?b:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Decrease quantity",children:u.jsx(de,{icon:"gravity-ui:minus",width:16})}),u.jsx("span",{"data-testid":"offer-card-quantity",className:m.cn("min-w-[2rem] text-center font-medium",j>0&&`text-${b}`),children:j}),u.jsx(ht,{"data-testid":"offer-card-increment-button",onPress:()=>w(1),isDisabled:ge,variant:c,color:j>0?b:d,radius:"full",isIconOnly:!0,size:"sm","aria-label":"Increase quantity",children:u.jsx(de,{icon:"gravity-ui:plus",width:16})})]})},z=()=>l?.renderSoldOut?l.renderSoldOut(A.soldOut):u.jsx(m.Chip,{"data-testid":"offer-card-sold-out-chip",color:"danger",className:m.cn("",g.soldOut),startContent:u.jsx(de,{icon:"gravity-ui:circle-info-fill",width:14}),children:u.jsx("span",{className:"font-medium text-sm",children:A.soldOut})}),Z=()=>l?.renderMaxReachedAlert?l.renderMaxReachedAlert(A.maxReached):u.jsx(m.Chip,{"data-testid":"offer-card-max-reached-chip",color:"warning",className:g.maxReachedAlert,startContent:u.jsx(de,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:u.jsx("span",{className:"font-medium text-sm",children:A.maxReached})}),Ie=u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 gap-2 items-start",children:[u.jsxs("div",{className:m.cn("h-full col-span-2",S?"opacity-50 pointer-events-none select-none":""),children:[B(),ze(),u.jsxs("div",{className:m.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",S?"opacity-50 pointer-events-none select-none":""),children:[Ee(),Be()]})]}),u.jsx("div",{className:"h-full flex items-center justify-start md:justify-center space-x-2 p-2",children:S?z():Me()})]}),Oe=O&&!S&&u.jsx(Y.motion.div,{className:"w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Z()});return f?u.jsxs(m.Card,{className:m.cn("w-full",g.base),"data-testid":y||`offer-card-${t.id}`,children:[u.jsx(m.CardBody,{className:m.cn("pt-1 pb-0",g.body),children:Ie}),u.jsx(Y.AnimatePresence,{children:Oe&&u.jsx(m.CardFooter,{className:m.cn("w-full mt-0 pt-0",g.footer),children:Oe})})]}):u.jsxs("div",{className:m.cn("w-full",g.base),"data-testid":y||`offer-card-${t.id}`,children:[u.jsx("div",{className:m.cn("pt-1 pb-0",g.body),children:Ie}),u.jsx(Y.AnimatePresence,{children:Oe&&u.jsx("div",{className:m.cn("w-full mt-0 pt-0",g.footer),children:Oe})})]})};On.displayName="OfferCard";const Ps={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Rs={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},qa={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Fs=({offers:t=[],selection:e,defaultSelection:n={},onSelectionChange:r,onQuantityChange:s,currency:i="USD",locale:o="en-US",labels:l,slots:a,isDisabled:c=!1,buttonVariant:d="bordered",buttonColor:f="default",showCard:h=!0,animated:p=!0,gap:x=2,classNames:g={}})=>{const[y,b]=k.useState(n),A=e!==void 0?e:y,N=k.useCallback((O,F)=>{const B={...A,[O]:Math.max(0,F)};e===void 0&&b(B),r?.(B),s?.(O,B[O])},[A,e,r,s]),I=[...t].sort((O,F)=>(O.position??0)-(F.position??0)),j=qa[x],w=m.cn("grid mx-auto pt-2",j,g.base),S=O=>u.jsx(On,{offer:O,quantity:A[O.id]||0,onQuantityChange:N,currency:i,locale:o,labels:l,slots:a,isDisabled:c,buttonVariant:d,buttonColor:f,showCard:h,classNames:g.card},O.id);return p?u.jsx(Y.motion.div,{"data-testid":"offer-card-list",className:w,variants:Ps,initial:"hidden",animate:"show",children:u.jsx(Y.AnimatePresence,{children:I.map(O=>u.jsx(Y.motion.div,{"data-testid":`offer-card-list-item-${O.id}`,className:g.cardWrapper,variants:Rs,exit:{opacity:0,y:-20},transition:{duration:.3},children:S(O)},O.id))})}):u.jsx("div",{"data-testid":"offer-card-list",className:w,children:I.map(S)})};Fs.displayName="OfferCardList";const Va={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},zs=({quantity:t=2,gap:e=4,classNames:n={}})=>{const r=Va[e];return u.jsx("div",{"data-testid":"offer-card-skeleton-container",className:m.cn(r,n.base),children:Array.from({length:t}).map((s,i)=>u.jsxs(m.Card,{"data-testid":`offer-card-skeleton-${i}`,className:m.cn("w-full",n.card),children:[u.jsx(m.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:u.jsxs("div",{className:"space-y-2 w-full",children:[u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:u.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:u.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),u.jsx(m.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[u.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:u.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:u.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),u.jsx("div",{className:"flex items-start justify-end",children:u.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),u.jsx(m.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};zs.displayName="OfferCardSkeleton";const Ka={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Bs=({error:t,labels:e,showCard:n=!0,color:r="danger",classNames:s={}})=>{const i={...Ka,...e},o=u.jsx(m.Alert,{"data-testid":"offer-card-error-alert",color:r,title:i.title,description:t||i.description,className:s.alert});return n?u.jsx(m.Card,{"data-testid":"offer-card-error",className:m.cn("w-full",s.base),children:u.jsx(m.CardBody,{"data-testid":"offer-card-error-body",children:o})}):u.jsx("div",{"data-testid":"offer-card-error",className:m.cn("w-full",s.base),children:o})};Bs.displayName="OfferCardError";const $s=({message:t="No offers available.",icon:e="solar:ticket-sale-outline",iconSize:n=48,showCard:r=!0,classNames:s={},renderEmpty:i})=>{if(i){const l=i();return r?u.jsx(m.Card,{"data-testid":"offer-card-empty",className:m.cn("w-full",s.base),children:u.jsx(m.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):u.jsx("div",{"data-testid":"offer-card-empty",className:m.cn("w-full",s.base),children:l})}const o=u.jsxs("div",{"data-testid":"offer-card-empty-content",className:m.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",s.content),children:[u.jsx(de,{"data-testid":"offer-card-empty-icon",icon:e,width:n,className:m.cn("mb-4",s.icon)}),u.jsx("h3",{"data-testid":"offer-card-empty-message",className:m.cn("text-lg",s.message),children:t})]});return r?u.jsx(m.Card,{"data-testid":"offer-card-empty",className:m.cn("w-full",s.base),children:u.jsx(m.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):u.jsx("div",{"data-testid":"offer-card-empty",className:m.cn("w-full",s.base),children:o})};$s.displayName="OfferCardEmpty";function Ua(t){return u.jsx("div",{className:"min-h-screen flex flex-col",children:u.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:u.jsx(m.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}function Ja(t){return u.jsx("div",{className:"min-h-screen flex flex-col",children:u.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:u.jsx(m.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}exports.Button=ht;exports.ConfirmationPageTemplate=Ua;exports.DonationAmounts=bs;exports.EventDetails=Ba;exports.EventDetailsTemplate=Ja;exports.ExpireCartTimer=ks;exports.Footer=ii;exports.HeroUIProvider=Xs;exports.Navbar=ni;exports.OfferCard=On;exports.OfferCardEmpty=$s;exports.OfferCardError=Bs;exports.OfferCardList=Fs;exports.OfferCardSkeleton=zs;exports.RICH_TEXT_PRESETS=ys;exports.RichTextArea=xs;exports.Stepper=wr;exports.colors=Gt;exports.formatOfferCurrency=Ls;exports.offerCardVariants=Rs;exports.offerListVariants=Ps;exports.parseOfferCurrency=$a;exports.spacing=Gs;exports.theme=Qs;exports.typography=Zs;Object.keys(m).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>m[t]})});
|
|
18
|
+
`);return{dom:a,text:h,slice:e}}function cs(n,e,t,r,s){let i=s.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,i||r,n)}),i)return l=new v(E.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
19
|
+
`))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(f)l=f;else{let h=s.marks(),{schema:p}=n.state,y=xt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(y.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=$l(t),bn&&Vl(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||lt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!zl.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=ql(pr(l,+u[1],+u[2]),u[4]);else if(l=v.maxOpen(Bl(l.content,s),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=pr(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const zl=/^(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 Bl(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)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&fs(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ds(o[o.length-1],i.length));let u=us(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return E.from(o)}return n}function us(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,E.from(n));return n}function fs(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=fs(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(E.from(us(t,n,s+1))))}}function ds(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ds(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(E.empty,!0);return n.copy(t.append(r))}function sn(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=sn(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(E.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function pr(n,e,t){return e<n.openStart&&(n=new v(sn(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new v(sn(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const hs={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 mr=null;function ps(){return mr||(mr=document.implementation.createHTMLDocument("title"))}let qt=null;function Hl(n){let e=window.trustedTypes;return e?(qt||(qt=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),qt.createHTML(n)):n}function $l(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ps().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&hs[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Hl(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function Vl(n){let e=n.querySelectorAll(oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function ql(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=E.from(a.create(r[l+1],s)),i++,o++}return new v(s,i,o)}const Q={},J={};function ue(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}J.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!gs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(_e&&oe&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,es(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Fl(n,t)?t.preventDefault():ue(n,"key")};J.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};J.keypress=(n,e)=>{let t=e;if(gs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||_&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Ct(n){return{left:n.clientX,top:n.clientY}}function Kl(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Sn(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Ne(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Jl(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(Ne(n,new M(t)),!0):!1}function Ul(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof M&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(M.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Ne(n,M.create(n.state.doc,s)),!0):!1}function Wl(n,e,t,r,s){return Sn(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Ul(n,t):Jl(n,t))}function _l(n,e,t,r){return Sn(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Gl(n,e,t,r){return Sn(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Zl(n,t,r)}function Zl(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ne(n,I.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Ne(n,I.create(r,l+1,l+1+o.content.size));else if(M.isSelectable(o))Ne(n,M.create(r,l));else continue;return!0}}function Cn(n){return pt(n)}const ms=_?"metaKey":"ctrlKey";Q.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Cn(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&Kl(t,n.input.lastClick)&&!t[ms]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(Ct(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Xl(n,o,t,!!r)):(i=="doubleClick"?_l:Gl)(n,o.pos,o.inside,t)?t.preventDefault():ue(n,"pointer"))};class Xl{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ms],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&St&&!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)),ue(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(()=>kn(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(Ct(e))),this.updateAllowDefault(e),this.allowDefault||!t?ue(this.view,"pointer"):Wl(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Te&&this.mightDrag&&!this.mightDrag.node.isAtom||oe&&!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)?(Ne(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ue(this.view,"pointer")}move(e){this.updateAllowDefault(e),ue(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)}}Q.touchstart=n=>{n.input.lastTouch=Date.now(),Cn(n),ue(n,"pointer")};Q.touchmove=n=>{n.input.lastTouch=Date.now(),ue(n,"pointer")};Q.contextmenu=n=>Cn(n);function gs(n,e){return n.composing?!0:Te&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Ql=_e?5e3:-1;J.compositionstart=J.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||oe&&ss&&Yl(n)))n.markCursor=n.state.storedMarks||t.marks(),pt(n,!0),n.markCursor=null;else if(pt(n,!e.selection.empty),St&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}ys(n,Ql)};function Yl(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}J.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.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,ys(n,20))};function ys(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>pt(n),e))}function ea(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=ta());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ta(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function pt(n,e=!1){if(!(_e&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),ea(n),e||n.docView&&n.docView.dirty){let t=vl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function na(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 r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Je=We&&ns<15||xn&&El<604;Q.copy=J.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Je?null:t.clipboardData,o=r.content(),{dom:l,text:a}=as(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):na(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ra(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function sa(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?on(n,r.value,null,s,e):on(n,r.textContent,r.innerHTML,s,e)},50)}function on(n,e,t,r,s){let i=cs(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||v.empty)))return!0;if(!i)return!1;let o=ra(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xs(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," "):""}J.paste=(n,e)=>{let t=e;if(n.composing&&!_e)return;let r=Je?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&on(n,xs(r),r.getData("text/html"),s,t)?t.preventDefault():sa(n,t)};class ia{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const oa=_?"altKey":"ctrlKey";function bs(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[oa]}Q.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Ct(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof M?s.to-1:s.to))){if(r&&r.mightDrag)o=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=M.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=as(n,l);(!t.dataTransfer.files.length||!oe||rs>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Je?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Je||t.dataTransfer.setData("text/plain",c),n.dragging=new ia(u,bs(n,t),o)};Q.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};J.dragover=J.dragenter=(n,e)=>e.preventDefault();J.drop=(n,e)=>{try{la(n,e,n.dragging)}finally{n.dragging=null}};function la(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Ct(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=cs(n,xs(e.dataTransfer),Je?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&bs(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||v.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Jr(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:p}=t;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(f))return;let h=a.doc.resolve(c);if(u&&M.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new M(h));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((y,m,g,x)=>p=x),a.setSelection(os(n,h,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Q.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())&&kn(n)},20))};Q.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)};Q.beforeinput=(n,e)=>{if(oe&&_e&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,es(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 J)Q[n]=J[n];function Ue(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 mt{constructor(e,t){this.toDOM=e,this.spec=t||Se,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new ee(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof mt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ue(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class fe{constructor(e,t){this.attrs=e,this.spec=t||Se}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ee(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof fe&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}static is(e){return e.type instanceof fe}destroy(){}}class An{constructor(e,t){this.attrs=e,this.spec=t||Se}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ee(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof An&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}destroy(){}}class ee{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ee(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,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ee(e,e,new mt(t,r))}static inline(e,t,r,s){return new ee(e,t,new fe(r,s))}static node(e,t,r,s){return new ee(e,t,new An(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof fe}get widget(){return this.type instanceof mt}}const Me=[],Se={};class j{constructor(e,t){this.local=e.length?e:Me,this.children=t.length?t:Me}static create(e,t){return t.length?gt(t,e,0,Se):q}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==q||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Se)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?aa(this.children,o||[],e,t,r,s,i):o?new j(o.sort(Ce),Me):q}add(e,t){return t.length?this==q?j.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Ss(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,gt(u,l,c+1,Se)),i+=3}});let o=ks(i?Cs(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new j(o.length?this.local.concat(o).sort(Ce):this.local,s||this.children)}remove(e){return e.length==0||this==q?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=q?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new j(s,r):q}forChild(e,t){if(this==q)return this;if(t.isLeaf)return j.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof fe){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new j(s.sort(Ce),Me);return r?new ge([l,r]):l}return r||q}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 Tn(this.localsInner(e))}localsInner(e){if(this==q)return Me;if(e.inlineContent||!this.local.some(fe.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof fe||t.push(this.local[r]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=Tn;const q=j.empty;class ge{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Se));return ge.from(r)}forChild(e,t){if(t.isLeaf)return j.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=q&&(i instanceof ge?r=r.concat(i.members):r.push(i))}return ge.from(r)}eq(e){if(!(e instanceof ge)||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,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?Tn(r?t:t.sort(Ce)):Me}static from(e){switch(e.length){case 0:return q;case 1:return e[0];default:return new ge(e.every(t=>t instanceof j)?e:e.reduce((t,r)=>t.concat(r instanceof j?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function aa(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let f=0;t.maps[c].forEach((h,p,y,m)=>{let g=m-y-(p-h);for(let x=0;x<l.length;x+=3){let w=l[x+1];if(w<0||h>w+u-f)continue;let N=l[x]+u-f;p>=N?l[x+1]=h<=N?-2:-1:h>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=t.maps[c].map(u,-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 u=t.map(n[c]+i),f=u-s;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[c+1]+i,-1),p=h-s,{index:y,offset:m}=r.content.findIndex(f),g=r.maybeChild(y);if(g&&m==f&&m+g.nodeSize==p){let x=l[c+2].mapInner(t,g,u+1,n[c]+i+1,o);x!=q?(l[c]=f,l[c+1]=p,l[c+2]=x):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ca(l,n,e,t,s,i,o),u=gt(c,r,0,o);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new j(e.sort(Ce),l)}function ks(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new ee(s.from+e,s.to+e,s.type))}return t}function ca(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,s,c);f?t.push(f):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Ss(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Cs(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function gt(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Ss(n,l,a+t);if(c){i=!0;let u=gt(c,l,t+a+1,r);u!=q&&s.push(a,a+l.nodeSize,u)}});let o=ks(i?Cs(n):n,-t).sort(Ce);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new j(o,s):q}function Ce(n,e){return n.from-e.from||n.to-e.to}function Tn(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),gr(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),gr(e,s,r.copy(i.from,r.to)));break}}}return e}function gr(n,e,t){for(;e<n.length&&Ce(t,n[e])>0;)e++;n.splice(e,0,t)}class L extends D{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return L.valid(r)?new L(r):D.near(r)}content(){return v.empty}eq(e){return e instanceof L&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new L(e.resolve(t.pos))}getBookmark(){return new En(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ua(e)||!fa(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&L.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(L.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!M.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(L.valid(l))return l}return null}}}L.prototype.visible=!1;L.findFrom=L.findGapCursorFrom;D.jsonID("gapcursor",L);class En{constructor(e){this.pos=e}map(e){return new En(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):D.near(t)}}function As(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function ua(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||As(s.type))return!0;if(s.inlineContent)return!1}}return!0}function fa(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||As(s.type))return!0;if(s.inlineContent)return!1}}return!0}function da(){return new kt({props:{decorations:ga,createSelectionBetween(n,e,t){return e.pos==t.pos&&L.valid(t)?new L(t):null},handleClick:pa,handleKeyDown:ha,handleDOMEvents:{beforeinput:ma}}})}const ha=Cl({ArrowLeft:et("horiz",-1),ArrowRight:et("horiz",1),ArrowUp:et("vert",-1),ArrowDown:et("vert",1)});function et(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof I){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=L.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new L(c))),!0):!1}}function pa(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!L.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&M.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new L(r))),!0)}function ma(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof L))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=E.empty;for(let o=r.length-1;o>=0;o--)s=E.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new v(s,0,0));return i.setSelection(I.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ga(n){if(!(n.selection instanceof L))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",j.create(n.doc,[ee.widget(n.selection.head,e,{key:"gapcursor"})])}const ya=b.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[da()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=b.callOrReturn(b.getExtensionField(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Le={bold:{category:"mark",extension:mo,priority:100},italic:{category:"mark",extension:ko,priority:100},strike:{category:"mark",extension:Ao,priority:100},underline:{category:"mark",extension:Is.Underline,priority:100},code:{category:"mark",extension:vo,priority:100},textColor:{category:"mark",extension:Os.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Ds.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ls.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:No,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Do,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Ro,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Rs.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Zo,priority:100},blockquote:{category:"node",extension:Qo,priority:100},horizontalRule:{category:"node",extension:Yo,priority:100},hardBreak:{category:"node",extension:el,priority:100},undo:{category:"extension",extension:Pe,priority:50},redo:{category:"extension",extension:Pe,priority:50},textAlign:{category:"extension",extension:js.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Pe,priority:50},clearNodes:{category:"extension",extension:Pe,priority:50}},xa=[ul,fl,Io,wo,Po,Ps.TaskItem,Pe,pl,ya];function ba(n){const e=[],t=new Set,r=new Set;xa.forEach(l=>{l&&(e.push(l),r.add(l.name),l.name==="history"&&(t.add("undo"),t.add("redo")))});const s=n.map(l=>$e(l)),i=new Set;return s.forEach(l=>{const a=Le[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null)return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l)}),s.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null){console.warn(`Extension not found or not installed for modifier: ${l}`);return}if(a.extension.name==="history"&&t.has("undo"))return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l),(l==="undo"||l==="redo")&&(t.add("undo"),t.add("redo"))}),e.sort((l,a)=>{const c=Object.values(Le).find(p=>p?.extension?.name===l.name),u=Object.values(Le).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(u?.priority??100)-f})}const Ts={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},ka=({modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})=>{const{editor:s}=an.useCurrentEditor();return d.jsx(co,{editor:s,modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})},Sa=({showCharacterCount:n,showWordCount:e})=>{const{editor:t}=an.useCurrentEditor();if(!t||!n&&!e)return null;const r=t.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return d.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[n&&d.jsxs("span",{children:[s," characters"]}),e&&d.jsxs("span",{children:[i," words"]})]})},ln=k.forwardRef((n,e)=>{const{minRows:t=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=Ts.full,variant:c="bordered",initialContent:u,content:f,onContentChange:h,onUpdate:p,onToolbarAction:y,isReadOnly:m=!1,isDisabled:g=!1,...x}=n,{zoom:w,setZoom:N}=oo(),O=zn.lineHeight,P=t*O,T=s?void 0:r*O,C=k.useMemo(()=>ba(a),[a]),{Component:V,label:U,shouldLabelBeOutside:W,getBaseProps:At,getLabelProps:Tt,getInputWrapperProps:Ge}=A.useInput({...x,variant:c,ref:e,isMultiline:!0}),Ze=U?d.jsx("label",{...Tt(),children:U}):null,z=k.useCallback(({editor:re})=>{const Et=re.getHTML(),Ms=re.getJSON(),vt=re.getText(),ws=vt.length,Ns=vt.split(/\s+/).filter(Mt=>Mt.length>0).length,vn={html:Et,json:Ms,text:vt,characters:ws,words:Ns};if(h?.(vn),p?.(vn),"onChange"in x&&typeof x.onChange=="function"){const Mt={target:{value:Et},currentTarget:{value:Et}};x.onChange(Mt)}},[h,p,x]);return d.jsxs(V,{...At(),children:[W?Ze:null,d.jsx("div",{...Ge(),className:A.cn(Ge().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:T?`${T+zn.toolbarHeight}px`:void 0,overflow:T?"auto":void 0},children:d.jsx(an.EditorProvider,{editable:!m&&!g,slotBefore:l?d.jsx(ka,{modifiers:a,zoom:w,onZoomChange:N,onToolbarAction:y}):void 0,slotAfter:d.jsx(Sa,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${P}px`,fontSize:`${w}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:C,content:f||u||n.defaultValue||"",onUpdate:z})})]})});ln.displayName="TipTapEditor";const Es=k.forwardRef((n,e)=>{const{adapter:t="tiptap",variant:r="bordered",...s}=n;return t==="tiptap"?d.jsx(ln,{...s,variant:r,ref:e}):(console.warn(`Adapter "${t}" is not supported. Using TipTap.`),d.jsx(ln,{...s,variant:r,ref:e}))});Es.displayName="RichTextArea";function Ca(n,e="en-US",t="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2}).format(n)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${t} ${n.toFixed(2)}`}}const yr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Aa={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},vs=({presetAmounts:n=yr,selectedDonation:e,defaultSelectedDonation:t=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:c,mobileColumns:u=2,desktopColumns:f=3,isDisabled:h=!1,buttonVariant:p="bordered",buttonColor:y="default",inputVariant:m="bordered",className:g="",showCard:x=!0})=>{const w={...Aa,...c},N=Array.isArray(n)?n:yr,O={2:"grid-cols-2",3:"grid-cols-3"},P={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${O[u]} ${P[f]}`,[C,V]=hn(e,t,r),[U,W]=k.useState(""),At=k.useCallback(z=>{if(h)return;const re={amount:z.amount,isCustom:!1,presetId:z.id};V(re),W("")},[h,V]),Tt=k.useCallback(z=>{if(h)return;if(W(z!==void 0?String(z):""),z===void 0||isNaN(z)){V(null);return}V({amount:z,isCustom:!0})},[h,V]),Ge=k.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Ze=d.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&d.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),N.length>0&&d.jsx("div",{className:A.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:N.map(z=>{const re=C!==null&&!C.isCustom&&C.presetId===z.id;return d.jsx(Z,{color:re?"primary":y,variant:re?"solid":p,className:"w-full",onPress:()=>At(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||Ca(z.amount,i,s)},z.id)})}),o&&d.jsx(A.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:m,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:Ge,value:U!==""?parseFloat(U):void 0,onValueChange:Tt,isDisabled:h,"data-testid":"donation-amounts-custom-input"},C?.isCustom===!1?C.presetId:"custom")]});return x?d.jsx(A.Card,{className:A.cn("w-full",g),"data-testid":"donation-amounts-card",children:d.jsx(A.CardBody,{children:Ze})}):d.jsx("div",{className:A.cn("w-full",g),"data-testid":"donation-amounts-plain",children:Ze})};vs.displayName="DonationAmounts";const Ta=n=>{const e=Math.max(0,n),t=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${t}:${r} minutes`},Ea=n=>{switch(n){case"warning":return S.Clock;case"error":return S.AlertCircle;case"success":return S.CheckCircle;default:return S.Clock}},va=n=>{switch(n){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ma=k.forwardRef(({timeLeft:n,defaultTimeLeft:e=1200,onTimeChange:t,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:c="fixed",autoStart:u=!0,formatTime:f=Ta,className:h,...p},y)=>{const[m,g]=hn(n!==void 0?Math.max(0,n):void 0,Math.max(0,e),t),x=k.useRef(null),w=k.useRef(!1);k.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),k.useEffect(()=>{if(!u||m<=0){x.current&&(clearInterval(x.current),x.current=null);return}return x.current=setInterval(()=>{g(T=>T<=1?(x.current&&(clearInterval(x.current),x.current=null),w.current||(w.current=!0,r?.()),0):T-1)},1e3),()=>{x.current&&(clearInterval(x.current),x.current=null)}},[u,m,g,r]),k.useEffect(()=>{m>0&&(w.current=!1)},[m]);const N=a||Ea(s),O=va(i),P={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return d.jsx("div",{ref:y,role:"banner","aria-live":"polite","aria-label":`${o} ${f(m)}`,"data-testid":"expire-cart-timer",className:A.cn("w-full text-white z-50",O,P[c],h),...p,children:d.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:d.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[d.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&d.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:d.jsx(N,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),d.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),d.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:d.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(m)}`,"data-testid":"expire-cart-timer-value",children:f(m)})})]})})})});Ma.displayName="ExpireCartTimer";function wa(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(A.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}function Na(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(A.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}exports.Button=Z;exports.ConfirmationPageTemplate=wa;exports.DonationAmounts=vs;exports.EventDetailsTemplate=Na;exports.Footer=_i;exports.HeroUIProvider=Hs;exports.Navbar=Ji;exports.RICH_TEXT_PRESETS=Ts;exports.RichTextArea=Es;exports.Stepper=Or;exports.colors=Kt;exports.spacing=Fs;exports.theme=Bs;exports.typography=zs;Object.keys(A).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>A[n]})});
|
|
20
20
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|