@qkix/strapi-plugin-better-blocks 0.23.0 → 0.23.2

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.
@@ -1,6 +1,6 @@
1
- "use strict";var Kl=Object.create;var Go=Object.defineProperty;var Gl=Object.getOwnPropertyDescriptor;var Vl=Object.getOwnPropertyNames;var ql=Object.getPrototypeOf,Xl=Object.prototype.hasOwnProperty;var Yl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Vl(t))!Xl.call(e,s)&&s!==n&&Go(e,s,{get:()=>t[s],enumerable:!(r=Gl(t,s))||r.enumerable});return e};var Zl=(e,t,n)=>(n=e!=null?Kl(ql(e)):{},Yl(t||!e||!e.__esModule?Go(n,"default",{value:e,enumerable:!0}):n,e));const T=require("react"),o=require("react/jsx-runtime"),Jl=require("@strapi/icons/symbols"),Xe=require("@strapi/admin/strapi-admin"),p=require("@strapi/design-system"),O=require("react-intl"),d=require("slate"),ao=require("slate-history"),B=require("slate-react"),b=require("styled-components"),D=require("@strapi/icons"),io=require("shiki"),Ql=require("shiki/engine/javascript"),ec=require("katex");require("katex/dist/katex.min.css");const Yt=require("react-dom"),tc=require("@radix-ui/react-toolbar"),nc=require("remark-gfm"),rc=require("remark-math"),oc=require("remark-parse"),sc=require("unified"),ac=require("@radix-ui/react-tooltip"),qn=e=>e&&e.__esModule?e:{default:e};function lo(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=lo(T),ic=qn(ec),be=lo(tc),lc=qn(nc),cc=qn(rc),dc=qn(oc),uc=lo(ac),pc=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((s,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},z="better-blocks",hc=({setPlugin:e})=>{const t=T.useRef(e);return T.useEffect(()=>{t.current(z)},[]),null},fc=()=>o.jsx(Jl.BlocksField,{}),ot=e=>`${z}.${e}`,Ta=[{value:"asm",label:"Assembly",decorate:"asmatmel"},{value:"bash",label:"Bash"},{value:"c",label:"C"},{value:"clojure",label:"Clojure"},{value:"cobol",label:"COBOL"},{value:"cpp",label:"C++"},{value:"csharp",label:"C#"},{value:"css",label:"CSS"},{value:"dart",label:"Dart"},{value:"dockerfile",label:"Dockerfile",decorate:"docker"},{value:"elixir",label:"Elixir"},{value:"erlang",label:"Erlang"},{value:"fortran",label:"Fortran"},{value:"fsharp",label:"F#"},{value:"go",label:"Go"},{value:"graphql",label:"GraphQL"},{value:"groovy",label:"Groovy"},{value:"haskell",label:"Haskell"},{value:"haxe",label:"Haxe"},{value:"html",label:"HTML"},{value:"ini",label:"INI"},{value:"java",label:"Java"},{value:"javascript",label:"JavaScript"},{value:"jsx",label:"JavaScript (React)"},{value:"json",label:"JSON"},{value:"julia",label:"Julia"},{value:"kotlin",label:"Kotlin"},{value:"latex",label:"LaTeX"},{value:"lua",label:"Lua"},{value:"markdown",label:"Markdown"},{value:"matlab",label:"MATLAB"},{value:"makefile",label:"Makefile"},{value:"objectivec",label:"Objective-C"},{value:"perl",label:"Perl"},{value:"php",label:"PHP"},{value:"plaintext",label:"Plain text"},{value:"powershell",label:"PowerShell"},{value:"python",label:"Python"},{value:"r",label:"R"},{value:"ruby",label:"Ruby"},{value:"rust",label:"Rust"},{value:"sas",label:"SAS"},{value:"scala",label:"Scala"},{value:"scheme",label:"Scheme"},{value:"shell",label:"Shell"},{value:"sql",label:"SQL"},{value:"stata",label:"Stata"},{value:"swift",label:"Swift"},{value:"typescript",label:"TypeScript",decorate:"ts"},{value:"tsx",label:"TypeScript (React)"},{value:"vbnet",label:"VB.NET"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML",decorate:"yml"}],he=(e,t)=>{const[n,r]=d.Editor.last(e,[]);d.Transforms.unwrapNodes(e,{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type==="list",split:!0,at:e.selection??r});const[,s]=d.Editor.last(e,[]),a=d.Editor.above(e,{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"&&g.type!=="link",at:e.selection??s});if(!a||d.Editor.isEditor(a[0]))return;const[i,l]=a,{fontFamily:c,fontColor:u,fontSettings:h}=i,f=!["code","image"].includes(t.type);return d.Transforms.setNodes(e,{...gc(i),...t,...f&&c&&{fontFamily:c},...f&&u&&{fontColor:u},...f&&h&&{fontSettings:h}},{at:l}),l},gc=e=>{const{children:t,type:n,fontFamily:r,fontColor:s,fontSettings:a,...i}=e;return{...Object.keys(i).reduce((c,u)=>({...c,[u]:null}),{}),fontFamily:r,fontColor:s,fontSettings:a}},mc=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="text",Ma=e=>{const t=d.Editor.above(e,{match:l=>{if(!d.Editor.isEditor(l)&&"type"in l){const c=l.type;return!["link","text"].includes(c)}return!1}});if(!t||!e.selection)return;const[n,r]=t,s=d.Editor.isEnd(e,e.selection.anchor,r),a=n.children.at(-1),i=mc(a)&&a.text.endsWith(`
1
+ "use strict";var ql=Object.create;var Xo=Object.defineProperty;var Xl=Object.getOwnPropertyDescriptor;var Yl=Object.getOwnPropertyNames;var Zl=Object.getPrototypeOf,Jl=Object.prototype.hasOwnProperty;var Ql=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Yl(t))!Jl.call(e,s)&&s!==n&&Xo(e,s,{get:()=>t[s],enumerable:!(r=Xl(t,s))||r.enumerable});return e};var ec=(e,t,n)=>(n=e!=null?ql(Zl(e)):{},Ql(t||!e||!e.__esModule?Xo(n,"default",{value:e,enumerable:!0}):n,e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("react"),o=require("react/jsx-runtime"),tc=require("@strapi/icons/symbols"),Xe=require("@strapi/admin/strapi-admin"),p=require("@strapi/design-system"),O=require("react-intl"),d=require("slate"),lo=require("slate-history"),R=require("slate-react"),b=require("styled-components"),D=require("@strapi/icons"),co=require("shiki"),nc=require("shiki/engine/javascript"),rc=require("katex");require("katex/dist/katex.min.css");const oc=require("@qkix/better-blocks-core"),Zt=require("react-dom"),sc=require("@radix-ui/react-toolbar"),ac=require("remark-gfm"),ic=require("remark-math"),lc=require("remark-parse"),cc=require("unified"),dc=require("@radix-ui/react-tooltip"),Yn=e=>e&&e.__esModule?e:{default:e};function uo(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=uo(M),uc=Yn(rc),be=uo(sc),pc=Yn(ac),hc=Yn(ic),fc=Yn(lc),gc=uo(dc),mc=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((s,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},z="better-blocks",bc=({setPlugin:e})=>{const t=M.useRef(e);return M.useEffect(()=>{t.current(z)},[]),null},yc=()=>o.jsx(tc.BlocksField,{}),ot=e=>`${z}.${e}`,Ba=[{value:"asm",label:"Assembly",decorate:"asmatmel"},{value:"bash",label:"Bash"},{value:"c",label:"C"},{value:"clojure",label:"Clojure"},{value:"cobol",label:"COBOL"},{value:"cpp",label:"C++"},{value:"csharp",label:"C#"},{value:"css",label:"CSS"},{value:"dart",label:"Dart"},{value:"dockerfile",label:"Dockerfile",decorate:"docker"},{value:"elixir",label:"Elixir"},{value:"erlang",label:"Erlang"},{value:"fortran",label:"Fortran"},{value:"fsharp",label:"F#"},{value:"go",label:"Go"},{value:"graphql",label:"GraphQL"},{value:"groovy",label:"Groovy"},{value:"haskell",label:"Haskell"},{value:"haxe",label:"Haxe"},{value:"html",label:"HTML"},{value:"ini",label:"INI"},{value:"java",label:"Java"},{value:"javascript",label:"JavaScript"},{value:"jsx",label:"JavaScript (React)"},{value:"json",label:"JSON"},{value:"julia",label:"Julia"},{value:"kotlin",label:"Kotlin"},{value:"latex",label:"LaTeX"},{value:"lua",label:"Lua"},{value:"markdown",label:"Markdown"},{value:"matlab",label:"MATLAB"},{value:"makefile",label:"Makefile"},{value:"objectivec",label:"Objective-C"},{value:"perl",label:"Perl"},{value:"php",label:"PHP"},{value:"plaintext",label:"Plain text"},{value:"powershell",label:"PowerShell"},{value:"python",label:"Python"},{value:"r",label:"R"},{value:"ruby",label:"Ruby"},{value:"rust",label:"Rust"},{value:"sas",label:"SAS"},{value:"scala",label:"Scala"},{value:"scheme",label:"Scheme"},{value:"shell",label:"Shell"},{value:"sql",label:"SQL"},{value:"stata",label:"Stata"},{value:"swift",label:"Swift"},{value:"typescript",label:"TypeScript",decorate:"ts"},{value:"tsx",label:"TypeScript (React)"},{value:"vbnet",label:"VB.NET"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML",decorate:"yml"}],he=(e,t)=>{const[n,r]=d.Editor.last(e,[]);d.Transforms.unwrapNodes(e,{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type==="list",split:!0,at:e.selection??r});const[,s]=d.Editor.last(e,[]),a=d.Editor.above(e,{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"&&g.type!=="link",at:e.selection??s});if(!a||d.Editor.isEditor(a[0]))return;const[i,l]=a,{fontFamily:c,fontColor:u,fontSettings:h}=i,f=!["code","image"].includes(t.type);return d.Transforms.setNodes(e,{...xc(i),...t,...f&&c&&{fontFamily:c},...f&&u&&{fontColor:u},...f&&h&&{fontSettings:h}},{at:l}),l},xc=e=>{const{children:t,type:n,fontFamily:r,fontColor:s,fontSettings:a,...i}=e;return{...Object.keys(i).reduce((c,u)=>({...c,[u]:null}),{}),fontFamily:r,fontColor:s,fontSettings:a}},vc=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="text",Ia=e=>{const t=d.Editor.above(e,{match:l=>{if(!d.Editor.isEditor(l)&&"type"in l){const c=l.type;return!["link","text"].includes(c)}return!1}});if(!t||!e.selection)return;const[n,r]=t,s=d.Editor.isEnd(e,e.selection.anchor,r),a=n.children.at(-1),i=vc(a)&&a.text.endsWith(`
2
2
  `);if(s&&i){d.Transforms.delete(e,{distance:1,unit:"character",reverse:!0}),d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]});return}d.Transforms.insertText(e,`
3
- `),s&&["uppercase","superscript","subscript","bold","italic","underline","strikethrough","code"].forEach(l=>{d.Editor.removeMark(e,l)})},Ia="github-light",Ra="github-dark",Vo=["javascript","typescript","jsx","tsx","json","bash","html","css","python"],bc={objectivec:"objective-c",fortran:"fortran-free-form",vbnet:"vb"};let rn=null,qo=!1;const Br=new Set,kn=new Set,Fr=new Set,Ut=new Map,xc=200,Ba=()=>{Fr.forEach(e=>e())},yc=e=>(Fr.add(e),()=>{Fr.delete(e)}),vc=e=>{if(!e||e==="plaintext"||e==="text")return null;const t=bc[e]??e;return t in io.bundledLanguages?t:null},wc=()=>(qo||(qo=!0,io.createHighlighter({themes:[Ia,Ra],langs:Vo,engine:Ql.createJavaScriptRegexEngine({forgiving:!0})}).then(e=>{rn=e,Vo.forEach(t=>Br.add(t)),Ba()}).catch(()=>{})),rn),kc=e=>rn?Br.has(e)?!0:(kn.has(e)||!(e in io.bundledLanguages)||(kn.add(e),rn.loadLanguage(e).then(()=>{Br.add(e),kn.delete(e),Ba()}).catch(()=>{kn.delete(e)})),!1):!1,jc=(e,t,n)=>{const r=rn;if(!r)return null;const s=`${t}|${n}|${e}`,a=Ut.get(s);if(a)return a;let i;try{i=r.codeToTokens(e,{lang:t,theme:n})}catch{return null}if(Ut.size>=xc){const l=Ut.keys().next().value;l!==void 0&&Ut.delete(l)}return Ut.set(s,i),i},Dr=e=>!d.Editor.isEditor(e)&&d.Element.isElement(e)&&"type"in e&&e.type==="code",$c=(e,t)=>([n,r])=>{const s=[];if(!d.Text.isText(n)||r.length===0)return s;let a;try{a=d.Node.parent(e,r)}catch{return s}if(!Dr(a))return s;const i=vc(a.language);if(!i||!wc()||!kc(i))return s;const l=t?Ra:Ia,c=jc(n.text,i,l);if(!c)return s;for(const u of c.tokens)for(const h of u)!h.color||h.content.length===0||s.push({anchor:{path:r,offset:h.offset},focus:{path:r,offset:h.offset+h.content.length},color:h.color});return s},Ec=b.styled.pre`
3
+ `),s&&["uppercase","superscript","subscript","bold","italic","underline","strikethrough","code"].forEach(l=>{d.Editor.removeMark(e,l)})},Ra="github-light",Fa="github-dark",Yo=["javascript","typescript","jsx","tsx","json","bash","html","css","python"],wc={objectivec:"objective-c",fortran:"fortran-free-form",vbnet:"vb"};let on=null,Zo=!1;const Dr=new Set,jn=new Set,Ar=new Set,Wt=new Map,kc=200,Da=()=>{Ar.forEach(e=>e())},jc=e=>(Ar.add(e),()=>{Ar.delete(e)}),$c=e=>{if(!e||e==="plaintext"||e==="text")return null;const t=wc[e]??e;return t in co.bundledLanguages?t:null},Ec=()=>(Zo||(Zo=!0,co.createHighlighter({themes:[Ra,Fa],langs:Yo,engine:nc.createJavaScriptRegexEngine({forgiving:!0})}).then(e=>{on=e,Yo.forEach(t=>Dr.add(t)),Da()}).catch(()=>{})),on),Cc=e=>on?Dr.has(e)?!0:(jn.has(e)||!(e in co.bundledLanguages)||(jn.add(e),on.loadLanguage(e).then(()=>{Dr.add(e),jn.delete(e),Da()}).catch(()=>{jn.delete(e)})),!1):!1,Sc=(e,t,n)=>{const r=on;if(!r)return null;const s=`${t}|${n}|${e}`,a=Wt.get(s);if(a)return a;let i;try{i=r.codeToTokens(e,{lang:t,theme:n})}catch{return null}if(Wt.size>=kc){const l=Wt.keys().next().value;l!==void 0&&Wt.delete(l)}return Wt.set(s,i),i},_r=e=>!d.Editor.isEditor(e)&&d.Element.isElement(e)&&"type"in e&&e.type==="code",Tc=(e,t)=>([n,r])=>{const s=[];if(!d.Text.isText(n)||r.length===0)return s;let a;try{a=d.Node.parent(e,r)}catch{return s}if(!_r(a))return s;const i=$c(a.language);if(!i||!Ec()||!Cc(i))return s;const l=t?Fa:Ra,c=Sc(n.text,i,l);if(!c)return s;for(const u of c.tokens)for(const h of u)!h.color||h.content.length===0||s.push({anchor:{path:r,offset:h.offset},focus:{path:r,offset:h.offset+h.content.length},color:h.color});return s},Mc=b.styled.pre`
4
4
  border-radius: ${({theme:e})=>e.borderRadius};
5
5
  background-color: ${({theme:e})=>e.colors.neutral150};
6
6
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -18,7 +18,7 @@
18
18
  overflow: auto;
19
19
  max-width: 100%;
20
20
  }
21
- `,Cc=b.styled(p.Box)`
21
+ `,Bc=b.styled(p.Box)`
22
22
  position: absolute;
23
23
  top: ${({theme:e})=>e.spaces[1]};
24
24
  right: ${({theme:e})=>e.spaces[1]};
@@ -35,25 +35,25 @@
35
35
  svg {
36
36
  color: ${({theme:e})=>e.colors.primary600};
37
37
  }
38
- `,Sc=e=>{const{editor:t}=P("CodeEditor"),{formatMessage:n}=O.useIntl();return o.jsxs(p.Box,{position:"relative",width:"100%",children:[o.jsx(Ec,{...e.attributes,children:o.jsx("code",{children:e.children})}),o.jsx(Cc,{contentEditable:!1,hasRadius:!0,children:o.jsx(p.SingleSelect,{size:"S",onChange:r=>{const s=B.ReactEditor.findPath(t,e.element);d.Transforms.setNodes(t,{language:r.toString()},{at:s,match:a=>Dr(a)})},value:Dr(e.element)&&e.element.language||"plaintext",onOpenChange:r=>{r||B.ReactEditor.focus(t)},onCloseAutoFocus:r=>r.preventDefault(),"aria-label":n({id:"components.Blocks.blocks.code.languageLabel",defaultMessage:"Select a language"}),children:Ta.map(({value:r,label:s})=>o.jsx(p.SingleSelectOption,{value:r,children:s},r))})})]})},Tc={code:{renderElement:e=>o.jsx(Sc,{...e}),icon:D.CodeBlock,label:{id:"components.Blocks.blocks.code",defaultMessage:"Code block"},matchNode:e=>!d.Editor.isEditor(e)&&d.Element.isElement(e)&&"type"in e&&e.type==="code",isInBlocksSelector:!0,handleConvert(e){he(e,{type:"code",language:"plaintext",children:[{type:"text",text:""}]})},handleEnterKey(e){Ma(e)},snippets:["```"]}},xt=e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),n},Mc=b.styled(p.Typography).attrs({tag:"h1"})`
38
+ `,Ic=e=>{const{editor:t}=P("CodeEditor"),{formatMessage:n}=O.useIntl();return o.jsxs(p.Box,{position:"relative",width:"100%",children:[o.jsx(Mc,{...e.attributes,children:o.jsx("code",{children:e.children})}),o.jsx(Bc,{contentEditable:!1,hasRadius:!0,children:o.jsx(p.SingleSelect,{size:"S",onChange:r=>{const s=R.ReactEditor.findPath(t,e.element);d.Transforms.setNodes(t,{language:r.toString()},{at:s,match:a=>_r(a)})},value:_r(e.element)&&e.element.language||"plaintext",onOpenChange:r=>{r||R.ReactEditor.focus(t)},onCloseAutoFocus:r=>r.preventDefault(),"aria-label":n({id:"components.Blocks.blocks.code.languageLabel",defaultMessage:"Select a language"}),children:Ba.map(({value:r,label:s})=>o.jsx(p.SingleSelectOption,{value:r,children:s},r))})})]})},Rc={code:{renderElement:e=>o.jsx(Ic,{...e}),icon:D.CodeBlock,label:{id:"components.Blocks.blocks.code",defaultMessage:"Code block"},matchNode:e=>!d.Editor.isEditor(e)&&d.Element.isElement(e)&&"type"in e&&e.type==="code",isInBlocksSelector:!0,handleConvert(e){he(e,{type:"code",language:"plaintext",children:[{type:"text",text:""}]})},handleEnterKey(e){Ia(e)},snippets:["```"]}},yt=e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),n},Fc=b.styled(p.Typography).attrs({tag:"h1"})`
39
39
  font-size: 4.2rem;
40
40
  line-height: ${({theme:e})=>e.lineHeights[1]};
41
- `,Ic=b.styled(p.Typography).attrs({tag:"h2"})`
41
+ `,Dc=b.styled(p.Typography).attrs({tag:"h2"})`
42
42
  font-size: 3.5rem;
43
43
  line-height: ${({theme:e})=>e.lineHeights[1]};
44
- `,Rc=b.styled(p.Typography).attrs({tag:"h3"})`
44
+ `,Ac=b.styled(p.Typography).attrs({tag:"h3"})`
45
45
  font-size: 2.9rem;
46
46
  line-height: ${({theme:e})=>e.lineHeights[1]};
47
- `,Bc=b.styled(p.Typography).attrs({tag:"h4"})`
47
+ `,_c=b.styled(p.Typography).attrs({tag:"h4"})`
48
48
  font-size: 2.4rem;
49
49
  line-height: ${({theme:e})=>e.lineHeights[1]};
50
- `,Fc=b.styled(p.Typography).attrs({tag:"h5"})`
50
+ `,Nc=b.styled(p.Typography).attrs({tag:"h5"})`
51
51
  font-size: 2rem;
52
52
  line-height: ${({theme:e})=>e.lineHeights[1]};
53
- `,Dc=b.styled(p.Typography).attrs({tag:"h6"})`
53
+ `,Pc=b.styled(p.Typography).attrs({tag:"h6"})`
54
54
  font-size: 1.6rem;
55
55
  line-height: ${({theme:e})=>e.lineHeights[1]};
56
- `,Ac={paragraph:{fontSize:"1.4rem",fontWeight:400},"heading-one":{fontSize:"2.2rem",fontWeight:700},"heading-two":{fontSize:"1.95rem",fontWeight:700},"heading-three":{fontSize:"1.75rem",fontWeight:600},"heading-four":{fontSize:"1.6rem",fontWeight:600},"heading-five":{fontSize:"1.45rem",fontWeight:600},"heading-six":{fontSize:"1.35rem",fontWeight:600}},yt=(e,t)=>{he(e,{type:"heading",level:t})},_c={"heading-one":{renderElement:e=>o.jsx(Mc,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingOne,label:{id:"components.Blocks.blocks.heading1",defaultMessage:"Heading 1"},handleConvert:e=>yt(e,1),matchNode:e=>e.type==="heading"&&e.level===1,isInBlocksSelector:!0,snippets:["#"],dragHandleTopMargin:"14px"},"heading-two":{renderElement:e=>o.jsx(Ic,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingTwo,label:{id:"components.Blocks.blocks.heading2",defaultMessage:"Heading 2"},handleConvert:e=>yt(e,2),matchNode:e=>e.type==="heading"&&e.level===2,isInBlocksSelector:!0,snippets:["##"],dragHandleTopMargin:"10px"},"heading-three":{renderElement:e=>o.jsx(Rc,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingThree,label:{id:"components.Blocks.blocks.heading3",defaultMessage:"Heading 3"},handleConvert:e=>yt(e,3),matchNode:e=>e.type==="heading"&&e.level===3,isInBlocksSelector:!0,snippets:["###"],dragHandleTopMargin:"7px"},"heading-four":{renderElement:e=>o.jsx(Bc,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingFour,label:{id:"components.Blocks.blocks.heading4",defaultMessage:"Heading 4"},handleConvert:e=>yt(e,4),matchNode:e=>e.type==="heading"&&e.level===4,isInBlocksSelector:!0,snippets:["####"],dragHandleTopMargin:"4px"},"heading-five":{renderElement:e=>o.jsx(Fc,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingFive,label:{id:"components.Blocks.blocks.heading5",defaultMessage:"Heading 5"},handleConvert:e=>yt(e,5),matchNode:e=>e.type==="heading"&&e.level===5,isInBlocksSelector:!0,snippets:["#####"]},"heading-six":{renderElement:e=>o.jsx(Dc,{...e.attributes,style:xt(e),children:e.children}),icon:D.HeadingSix,label:{id:"components.Blocks.blocks.heading6",defaultMessage:"Heading 6"},handleConvert:e=>yt(e,6),matchNode:e=>e.type==="heading"&&e.level===6,isInBlocksSelector:!0,snippets:["######"],dragHandleTopMargin:"-2px"}},Nc=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="horizontal-line"?!0:t(n),e},Pc=b.styled.div`
56
+ `,Lc={paragraph:{fontSize:"1.4rem",fontWeight:400},"heading-one":{fontSize:"2.2rem",fontWeight:700},"heading-two":{fontSize:"1.95rem",fontWeight:700},"heading-three":{fontSize:"1.75rem",fontWeight:600},"heading-four":{fontSize:"1.6rem",fontWeight:600},"heading-five":{fontSize:"1.45rem",fontWeight:600},"heading-six":{fontSize:"1.35rem",fontWeight:600}},xt=(e,t)=>{he(e,{type:"heading",level:t})},Oc={"heading-one":{renderElement:e=>o.jsx(Fc,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingOne,label:{id:"components.Blocks.blocks.heading1",defaultMessage:"Heading 1"},handleConvert:e=>xt(e,1),matchNode:e=>e.type==="heading"&&e.level===1,isInBlocksSelector:!0,snippets:["#"],dragHandleTopMargin:"14px"},"heading-two":{renderElement:e=>o.jsx(Dc,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingTwo,label:{id:"components.Blocks.blocks.heading2",defaultMessage:"Heading 2"},handleConvert:e=>xt(e,2),matchNode:e=>e.type==="heading"&&e.level===2,isInBlocksSelector:!0,snippets:["##"],dragHandleTopMargin:"10px"},"heading-three":{renderElement:e=>o.jsx(Ac,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingThree,label:{id:"components.Blocks.blocks.heading3",defaultMessage:"Heading 3"},handleConvert:e=>xt(e,3),matchNode:e=>e.type==="heading"&&e.level===3,isInBlocksSelector:!0,snippets:["###"],dragHandleTopMargin:"7px"},"heading-four":{renderElement:e=>o.jsx(_c,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingFour,label:{id:"components.Blocks.blocks.heading4",defaultMessage:"Heading 4"},handleConvert:e=>xt(e,4),matchNode:e=>e.type==="heading"&&e.level===4,isInBlocksSelector:!0,snippets:["####"],dragHandleTopMargin:"4px"},"heading-five":{renderElement:e=>o.jsx(Nc,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingFive,label:{id:"components.Blocks.blocks.heading5",defaultMessage:"Heading 5"},handleConvert:e=>xt(e,5),matchNode:e=>e.type==="heading"&&e.level===5,isInBlocksSelector:!0,snippets:["#####"]},"heading-six":{renderElement:e=>o.jsx(Pc,{...e.attributes,style:yt(e),children:e.children}),icon:D.HeadingSix,label:{id:"components.Blocks.blocks.heading6",defaultMessage:"Heading 6"},handleConvert:e=>xt(e,6),matchNode:e=>e.type==="heading"&&e.level===6,isInBlocksSelector:!0,snippets:["######"],dragHandleTopMargin:"-2px"}},zc=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="horizontal-line"?!0:t(n),e},Hc=b.styled.div`
57
57
  width: 100%;
58
58
  padding: ${({theme:e})=>e.spaces[2]} 0;
59
59
  cursor: pointer;
@@ -68,13 +68,13 @@
68
68
  &[data-selected='true'] hr {
69
69
  border-top-color: ${({theme:e})=>e.colors.primary600};
70
70
  }
71
- `,Fa=e=>{const t={type:"horizontal-line",children:[{type:"text",text:""}]},n={type:"paragraph",children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,[t,n])},Lc={"horizontal-line":{renderElement:e=>o.jsxs("div",{...e.attributes,contentEditable:!1,children:[o.jsx(Pc,{"data-selected":!1,children:o.jsx("hr",{})}),o.jsx("span",{style:{display:"none"},children:e.children})]}),matchNode:e=>e.type==="horizontal-line",isInBlocksSelector:!1}},Oc=b.styled.figure`
71
+ `,Aa=e=>{const t={type:"horizontal-line",children:[{type:"text",text:""}]},n={type:"paragraph",children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,[t,n])},Uc={"horizontal-line":{renderElement:e=>o.jsxs("div",{...e.attributes,contentEditable:!1,children:[o.jsx(Hc,{"data-selected":!1,children:o.jsx("hr",{})}),o.jsx("span",{style:{display:"none"},children:e.children})]}),matchNode:e=>e.type==="horizontal-line",isInBlocksSelector:!1}},Wc=b.styled.figure`
72
72
  margin: ${({theme:e})=>e.spaces[2]} 0;
73
73
  text-align: ${({$align:e})=>e};
74
74
  display: flex;
75
75
  flex-direction: column;
76
76
  align-items: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":"center"};
77
- `,zc=b.styled(p.Flex)`
77
+ `,Kc=b.styled(p.Flex)`
78
78
  transition-property: box-shadow;
79
79
  transition-duration: 0.2s;
80
80
  ${e=>e.$isFocused&&b.css`
@@ -87,7 +87,7 @@
87
87
  max-width: 100%;
88
88
  object-fit: contain;
89
89
  }
90
- `,Hc=b.styled.figcaption`
90
+ `,Gc=b.styled.figcaption`
91
91
  margin-top: ${({theme:e})=>e.spaces[2]};
92
92
  font-size: ${({theme:e})=>e.fontSizes[1]};
93
93
  color: ${({theme:e})=>e.colors.neutral600};
@@ -101,14 +101,14 @@
101
101
  content: 'Add a caption...';
102
102
  color: ${({theme:e})=>e.colors.neutral400};
103
103
  }
104
- `,Da=b.styled(p.Flex)`
104
+ `,_a=b.styled(p.Flex)`
105
105
  position: absolute;
106
106
  top: 4px;
107
107
  right: 4px;
108
108
  z-index: 1;
109
109
  opacity: 0;
110
110
  transition: opacity 0.2s;
111
- `,Uc=b.styled.button`
111
+ `,Vc=b.styled.button`
112
112
  background: ${({theme:e,$active:t})=>t?e.colors.primary600:"rgba(0,0,0,0.6)"};
113
113
  border: none;
114
114
  color: white;
@@ -120,16 +120,16 @@
120
120
  &:hover {
121
121
  background: ${({theme:e})=>e.colors.primary600};
122
122
  }
123
- `,Wc=b.styled.div`
123
+ `,qc=b.styled.div`
124
124
  position: relative;
125
125
 
126
- &:hover ${Da} {
126
+ &:hover ${_a} {
127
127
  opacity: 1;
128
128
  }
129
- `,Kc=["name","alternativeText","url","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt"],Gc=(e,t)=>{const n=t.map(r=>[r,e[r]]);return Object.fromEntries(n)},Vc=e=>e&&e.startsWith("/")?`${window.strapi.backendURL}${e}`:e,qc=e=>"type"in e&&e.type==="image",Xc=({attributes:e,children:t,element:n})=>{const r=B.useFocused(),s=B.useSelected(),a=B.useSlateStatic();if(!qc(n))return null;const{url:i,alternativeText:l,width:c,height:u}=n.image,h=n.caption||"",f=n.imageAlign||"center",g=x=>{const y=B.ReactEditor.findPath(a,n);d.Transforms.setNodes(a,{imageAlign:x},{at:y})},m=x=>{const y=B.ReactEditor.findPath(a,n);d.Transforms.setNodes(a,{caption:x},{at:y})},w=k.useRef(null);return k.useEffect(()=>{const x=w.current;if(!x)return;const y=$=>$.stopPropagation();return x.addEventListener("beforeinput",y),x.addEventListener("input",y),()=>{x.removeEventListener("beforeinput",y),x.removeEventListener("input",y)}},[]),o.jsxs(p.Box,{...e,children:[t,o.jsxs(Oc,{contentEditable:!1,$align:f,children:[o.jsxs(Wc,{children:[o.jsx(Da,{gap:1,contentEditable:!1,children:["left","center","right"].map(x=>o.jsx(Uc,{$active:f===x,onMouseDown:y=>{y.preventDefault(),g(x)},children:x.charAt(0).toUpperCase()+x.slice(1)},x))}),o.jsx(zc,{background:"neutral100",justifyContent:"center",$isFocused:r&&s,hasRadius:!0,children:o.jsx("img",{src:i,alt:l,width:c,height:u})})]}),o.jsx(Hc,{ref:w,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:x=>x.stopPropagation(),onBlur:x=>m(x.currentTarget.textContent||""),children:h})]})]})},Yc=()=>{const[e,t]=k.useState(!0),{editor:n}=P("ImageDialog"),r=Xe.useStrapiApp("ImageDialog",l=>l.components);if(!r||!e)return null;const s=r["media-library"],a=l=>{d.Transforms.unwrapNodes(n,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list",split:!0});const c=d.Editor.above(n,{match(f){return d.Editor.isEditor(f)?!1:!["text","link"].includes(f.type)}});if(!c)return;const[,u]=c;d.Transforms.removeNodes(n);const h=l.map(f=>({type:"image",image:f,children:[{type:"text",text:""}]}));d.Transforms.insertNodes(n,h,{at:u}),d.Transforms.select(n,u)},i=l=>{const c=l.map(u=>{const h=Gc(u,Kc);return{...h,alternativeText:h.alternativeText||h.name,url:Vc(u.url)}});a(c),t(!1)};return o.jsx(s,{allowedTypes:["images"],onClose:()=>t(!1),onSelectAssets:i})},Zc=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="image"?!0:t(n),e},Jc={image:{renderElement:e=>o.jsx(Xc,{...e}),icon:D.Image,label:{id:"components.Blocks.blocks.image",defaultMessage:"Image"},matchNode:e=>e.type==="image",isInBlocksSelector:!0,handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph",image:null}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},handleConvert:()=>()=>o.jsx(Yc,{}),snippets:["!["]}},Qc=e=>e.type==="audio",co=e=>Object.entries(e),ed=e=>Object.keys(e),Aa=e=>e.type==="link",st=e=>e.type==="list",Xo=e=>e.type==="math",td=e=>e.type==="diagram",nd=e=>e.type==="button",rd=e=>e.type==="social-embed",od=e=>e.type==="embed",sd=e=>e.type==="video",ad=e=>e?e.startsWith("/")?`${window.strapi.backendURL}${e}`:e:"",id=e=>e.replace(/\.[^/.]+$/,""),_a=e=>{if(!e||e<=0)return"";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(n<10&&r>0?1:0)} ${t[r]}`},Na={autoplay:!1,loop:!1,controls:!0,preload:"metadata"},ld=b.styled(p.Modal.Content)`
129
+ `,Xc=["name","alternativeText","url","caption","width","height","formats","hash","ext","mime","size","previewUrl","provider","provider_metadata","createdAt","updatedAt"],Yc=(e,t)=>{const n=t.map(r=>[r,e[r]]);return Object.fromEntries(n)},Zc=e=>e&&e.startsWith("/")?`${window.strapi.backendURL}${e}`:e,Jc=e=>"type"in e&&e.type==="image",Qc=({attributes:e,children:t,element:n})=>{const r=R.useFocused(),s=R.useSelected(),a=R.useSlateStatic();if(!Jc(n))return null;const{url:i,alternativeText:l,width:c,height:u}=n.image,h=n.caption||"",f=n.imageAlign||"center",g=y=>{const v=R.ReactEditor.findPath(a,n);d.Transforms.setNodes(a,{imageAlign:y},{at:v})},m=y=>{const v=R.ReactEditor.findPath(a,n);d.Transforms.setNodes(a,{caption:y},{at:v})},x=k.useRef(null);return k.useEffect(()=>{const y=x.current;if(!y)return;const v=$=>$.stopPropagation();return y.addEventListener("beforeinput",v),y.addEventListener("input",v),()=>{y.removeEventListener("beforeinput",v),y.removeEventListener("input",v)}},[]),o.jsxs(p.Box,{...e,children:[t,o.jsxs(Wc,{contentEditable:!1,$align:f,children:[o.jsxs(qc,{children:[o.jsx(_a,{gap:1,contentEditable:!1,children:["left","center","right"].map(y=>o.jsx(Vc,{$active:f===y,onMouseDown:v=>{v.preventDefault(),g(y)},children:y.charAt(0).toUpperCase()+y.slice(1)},y))}),o.jsx(Kc,{background:"neutral100",justifyContent:"center",$isFocused:r&&s,hasRadius:!0,children:o.jsx("img",{src:i,alt:l,width:c,height:u})})]}),o.jsx(Gc,{ref:x,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:y=>y.stopPropagation(),onBlur:y=>m(y.currentTarget.textContent||""),children:h})]})]})},ed=()=>{const[e,t]=k.useState(!0),{editor:n}=P("ImageDialog"),r=Xe.useStrapiApp("ImageDialog",l=>l.components);if(!r||!e)return null;const s=r["media-library"],a=l=>{d.Transforms.unwrapNodes(n,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list",split:!0});const c=d.Editor.above(n,{match(f){return d.Editor.isEditor(f)?!1:!["text","link"].includes(f.type)}});if(!c)return;const[,u]=c;d.Transforms.removeNodes(n);const h=l.map(f=>({type:"image",image:f,children:[{type:"text",text:""}]}));d.Transforms.insertNodes(n,h,{at:u}),d.Transforms.select(n,u)},i=l=>{const c=l.map(u=>{const h=Yc(u,Xc);return{...h,alternativeText:h.alternativeText||h.name,url:Zc(u.url)}});a(c),t(!1)};return o.jsx(s,{allowedTypes:["images"],onClose:()=>t(!1),onSelectAssets:i})},td=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="image"?!0:t(n),e},nd={image:{renderElement:e=>o.jsx(Qc,{...e}),icon:D.Image,label:{id:"components.Blocks.blocks.image",defaultMessage:"Image"},matchNode:e=>e.type==="image",isInBlocksSelector:!0,handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph",image:null}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},handleConvert:()=>()=>o.jsx(ed,{}),snippets:["!["]}},rd=e=>e.type==="audio",po=e=>Object.entries(e),od=e=>Object.keys(e),Na=e=>e.type==="link",st=e=>e.type==="list",Jo=e=>e.type==="math",sd=e=>e.type==="diagram",ad=e=>e.type==="button",id=e=>e.type==="social-embed",ld=e=>e.type==="embed",cd=e=>e.type==="video",dd=e=>e?e.startsWith("/")?`${window.strapi.backendURL}${e}`:e:"",ud=e=>e.replace(/\.[^/.]+$/,""),Pa=e=>{if(!e||e<=0)return"";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(n<10&&r>0?1:0)} ${t[r]}`},La={autoplay:!1,loop:!1,controls:!0,preload:"metadata"},pd=b.styled(p.Modal.Content)`
130
130
  max-width: 640px;
131
131
  width: 90vw;
132
- `,cd=b.styled.div`
132
+ `,hd=b.styled.div`
133
133
  display: flex;
134
134
  flex-direction: column;
135
135
  gap: ${({theme:e})=>e.spaces[4]};
@@ -137,7 +137,7 @@
137
137
  ${({theme:e})=>e.spaces[6]};
138
138
  max-height: 70vh;
139
139
  overflow: auto;
140
- `,ur=b.styled.input`
140
+ `,hr=b.styled.input`
141
141
  width: 100%;
142
142
  box-sizing: border-box;
143
143
  min-height: 40px;
@@ -147,7 +147,7 @@
147
147
  font-size: 14px;
148
148
  color: ${({theme:e})=>e.colors.neutral800};
149
149
  background: ${({theme:e})=>e.colors.neutral0};
150
- `,dd=b.styled.select`
150
+ `,fd=b.styled.select`
151
151
  min-height: 40px;
152
152
  padding: 0 ${({theme:e})=>e.spaces[3]};
153
153
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -155,13 +155,13 @@
155
155
  font-size: 14px;
156
156
  color: ${({theme:e})=>e.colors.neutral800};
157
157
  background: ${({theme:e})=>e.colors.neutral0};
158
- `,ud=b.styled.div`
158
+ `,gd=b.styled.div`
159
159
  display: inline-flex;
160
160
  align-self: flex-start;
161
161
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
162
162
  border-radius: ${({theme:e})=>e.borderRadius};
163
163
  overflow: hidden;
164
- `,pd=b.styled.button`
164
+ `,md=b.styled.button`
165
165
  min-width: 84px;
166
166
  min-height: 34px;
167
167
  padding: 0 ${({theme:e})=>e.spaces[3]};
@@ -190,13 +190,13 @@
190
190
  outline: 2px solid ${({theme:e})=>e.colors.primary600};
191
191
  outline-offset: -2px;
192
192
  }
193
- `,pr=b.styled.label`
193
+ `,fr=b.styled.label`
194
194
  display: flex;
195
195
  align-items: center;
196
196
  gap: ${({theme:e})=>e.spaces[2]};
197
197
  cursor: pointer;
198
198
  user-select: none;
199
- `,hd=b.styled.div`
199
+ `,bd=b.styled.div`
200
200
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
201
201
  border-radius: ${({theme:e})=>e.borderRadius};
202
202
  background: ${({theme:e})=>e.colors.neutral100};
@@ -204,7 +204,7 @@
204
204
  display: flex;
205
205
  flex-direction: column;
206
206
  gap: ${({theme:e})=>e.spaces[2]};
207
- `,fd=b.styled.div`
207
+ `,yd=b.styled.div`
208
208
  display: flex;
209
209
  align-items: center;
210
210
  gap: ${({theme:e})=>e.spaces[2]};
@@ -219,13 +219,13 @@
219
219
  height: 1px;
220
220
  background: ${({theme:e})=>e.colors.neutral200};
221
221
  }
222
- `,gd=b.styled.audio`
222
+ `,xd=b.styled.audio`
223
223
  width: 100%;
224
- `,vt=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),md=["left","center","right","none"],bd=["none","metadata","auto"],xd=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),i=Xe.useStrapiApp("AudioEditorModal",y=>y.components),[l,c]=k.useState({file:t.file??{url:""},title:t.title,caption:t.caption,player:t.player??Na,alignment:t.alignment??"center"}),[u,h]=k.useState(!1),f=y=>c($=>({...$,...y})),g=y=>c($=>({...$,player:{...$.player,...y}})),m=i?.["media-library"],w=y=>{const $=y[0];if($){const E=typeof $.size=="number"?$.size:void 0,S=$.name??"audio";c(R=>({...R,file:{id:typeof $.id=="number"?$.id:void 0,url:ad($.url),name:S,ext:$.ext??void 0,hash:$.hash??void 0,mime:$.mime??void 0,size:E!==void 0?Math.round(E*1024):void 0,provider:$.provider??void 0},title:R.title?.trim()?R.title:id(S)}))}h(!1)},x=!!l.file?.url?.trim();return u&&m?o.jsx(m,{allowedTypes:["audios"],onClose:()=>h(!1),onSelectAssets:w}):o.jsx(p.Modal.Root,{open:e,onOpenChange:y=>{y||s()},children:o.jsxs(ld,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.audio.modal.title",defaultMessage:"Audio"})})}),o.jsxs(cd,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.source",defaultMessage:"Audio source"})}),o.jsxs(hd,{children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",justifyContent:"space-between",children:[o.jsx(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:x?o.jsxs(o.Fragment,{children:[o.jsx(p.Typography,{fontWeight:"bold",variant:"pi",children:l.file.name||l.file.url}),l.file.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[_a(l.file.size),l.file.mime?` · ${l.file.mime}`:""]}):null]}):o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a({id:"components.Blocks.audio.source.empty",defaultMessage:"No audio selected yet."})})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!m,onClick:()=>h(!0),children:a({id:"components.Blocks.audio.action.browse",defaultMessage:"Media Library"})})]}),o.jsx(fd,{children:a({id:"components.Blocks.audio.source.or",defaultMessage:"or"})}),o.jsx(ur,{type:"url",placeholder:"https://example.com/episode.mp3",value:l.file?.id?"":l.file?.url??"",onChange:y=>f({file:{url:y.target.value}})})]})]}),x?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.preview",defaultMessage:"Preview"})}),o.jsx(gd,{src:l.file.url,controls:!0,preload:"metadata"},l.file.url)]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.title",defaultMessage:"Title (optional)"})}),o.jsx(ur,{type:"text",value:l.title??"",onChange:y=>f({title:y.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(ur,{type:"text",value:l.caption??"",onChange:y=>f({caption:y.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.player",defaultMessage:"Player settings"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsxs(pr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.controls,onChange:y=>g({controls:y.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.controls",defaultMessage:"Show controls"})})]}),o.jsxs(pr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.autoplay,onChange:y=>g({autoplay:y.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.autoplay",defaultMessage:"Autoplay"})})]}),o.jsxs(pr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.loop,onChange:y=>g({loop:y.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.loop",defaultMessage:"Loop"})})]})]}),o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:a({id:"components.Blocks.audio.player.preload",defaultMessage:"Preload"})}),o.jsx(dd,{value:l.player.preload,onChange:y=>g({preload:y.target.value}),children:bd.map(y=>o.jsx("option",{value:y,children:y},y))})]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.alignment",defaultMessage:"Alignment"})}),o.jsx(ud,{children:md.map(y=>o.jsx(pd,{type:"button",$active:l.alignment===y,onClick:()=>f({alignment:y}),children:y},y))})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!x,onClick:()=>n(l),children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},Yo=()=>({type:"audio",file:{url:""},player:{...Na},alignment:"center",children:[{type:"text",text:""}]}),yd=e=>{const t=he(e,Yo());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,Yo(),{at:t,select:!0}))},vd=b.styled.div`
224
+ `,vt=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),vd=["left","center","right","none"],wd=["none","metadata","auto"],kd=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),i=Xe.useStrapiApp("AudioEditorModal",v=>v.components),[l,c]=k.useState({file:t.file??{url:""},title:t.title,caption:t.caption,player:t.player??La,alignment:t.alignment??"center"}),[u,h]=k.useState(!1),f=v=>c($=>({...$,...v})),g=v=>c($=>({...$,player:{...$.player,...v}})),m=i?.["media-library"],x=v=>{const $=v[0];if($){const E=typeof $.size=="number"?$.size:void 0,C=$.name??"audio";c(I=>({...I,file:{id:typeof $.id=="number"?$.id:void 0,url:dd($.url),name:C,ext:$.ext??void 0,hash:$.hash??void 0,mime:$.mime??void 0,size:E!==void 0?Math.round(E*1024):void 0,provider:$.provider??void 0},title:I.title?.trim()?I.title:ud(C)}))}h(!1)},y=!!l.file?.url?.trim();return u&&m?o.jsx(m,{allowedTypes:["audios"],onClose:()=>h(!1),onSelectAssets:x}):o.jsx(p.Modal.Root,{open:e,onOpenChange:v=>{v||s()},children:o.jsxs(pd,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.audio.modal.title",defaultMessage:"Audio"})})}),o.jsxs(hd,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.source",defaultMessage:"Audio source"})}),o.jsxs(bd,{children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",justifyContent:"space-between",children:[o.jsx(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:y?o.jsxs(o.Fragment,{children:[o.jsx(p.Typography,{fontWeight:"bold",variant:"pi",children:l.file.name||l.file.url}),l.file.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[Pa(l.file.size),l.file.mime?` · ${l.file.mime}`:""]}):null]}):o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a({id:"components.Blocks.audio.source.empty",defaultMessage:"No audio selected yet."})})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!m,onClick:()=>h(!0),children:a({id:"components.Blocks.audio.action.browse",defaultMessage:"Media Library"})})]}),o.jsx(yd,{children:a({id:"components.Blocks.audio.source.or",defaultMessage:"or"})}),o.jsx(hr,{type:"url",placeholder:"https://example.com/episode.mp3",value:l.file?.id?"":l.file?.url??"",onChange:v=>f({file:{url:v.target.value}})})]})]}),y?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.preview",defaultMessage:"Preview"})}),o.jsx(xd,{src:l.file.url,controls:!0,preload:"metadata"},l.file.url)]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.title",defaultMessage:"Title (optional)"})}),o.jsx(hr,{type:"text",value:l.title??"",onChange:v=>f({title:v.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(hr,{type:"text",value:l.caption??"",onChange:v=>f({caption:v.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.player",defaultMessage:"Player settings"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsxs(fr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.controls,onChange:v=>g({controls:v.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.controls",defaultMessage:"Show controls"})})]}),o.jsxs(fr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.autoplay,onChange:v=>g({autoplay:v.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.autoplay",defaultMessage:"Autoplay"})})]}),o.jsxs(fr,{children:[o.jsx("input",{type:"checkbox",checked:l.player.loop,onChange:v=>g({loop:v.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.audio.player.loop",defaultMessage:"Loop"})})]})]}),o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:a({id:"components.Blocks.audio.player.preload",defaultMessage:"Preload"})}),o.jsx(fd,{value:l.player.preload,onChange:v=>g({preload:v.target.value}),children:wd.map(v=>o.jsx("option",{value:v,children:v},v))})]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(vt,{children:a({id:"components.Blocks.audio.field.alignment",defaultMessage:"Alignment"})}),o.jsx(gd,{children:vd.map(v=>o.jsx(md,{type:"button",$active:l.alignment===v,onClick:()=>f({alignment:v}),children:v},v))})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!y,onClick:()=>n(l),children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},Qo=()=>({type:"audio",file:{url:""},player:{...La},alignment:"center",children:[{type:"text",text:""}]}),jd=e=>{const t=he(e,Qo());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,Qo(),{at:t,select:!0}))},$d=b.styled.div`
225
225
  margin: ${({theme:e})=>e.spaces[2]} 0;
226
226
  display: flex;
227
227
  justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
228
- `,wd=b.styled.div`
228
+ `,Ed=b.styled.div`
229
229
  display: flex;
230
230
  flex-direction: column;
231
231
  gap: ${({theme:e})=>e.spaces[2]};
@@ -238,9 +238,9 @@
238
238
  border-radius: ${({theme:e})=>e.borderRadius};
239
239
  background: ${({theme:e})=>e.colors.neutral0};
240
240
  box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
241
- `,kd=b.styled(p.Flex)`
241
+ `,Cd=b.styled(p.Flex)`
242
242
  gap: ${({theme:e})=>e.spaces[2]};
243
- `,jd=b.styled.span`
243
+ `,Sd=b.styled.span`
244
244
  display: inline-flex;
245
245
  color: ${({theme:e})=>e.colors.primary600};
246
246
 
@@ -248,16 +248,16 @@
248
248
  width: 18px;
249
249
  height: 18px;
250
250
  }
251
- `,$d=b.styled.audio`
251
+ `,Td=b.styled.audio`
252
252
  width: 100%;
253
- `,Ed=b.styled(p.Typography)`
253
+ `,Md=b.styled(p.Typography)`
254
254
  color: ${({theme:e})=>e.colors.neutral500};
255
- `,Cd=["file","title","caption","player","alignment"],Sd=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Audio"),i=B.useSelected(),[l,c]=k.useState((r.file?.url??"").trim()===""&&!a),u=r.alignment??"center",h=(r.file?.url??"").trim()!=="",f=()=>{try{return B.ReactEditor.findPath(s,r)}catch{return null}},g=()=>{const y=f();y&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:y}),d.Transforms.unsetNodes(s,Cd,{at:y})):d.Transforms.removeNodes(s,{at:y}))},m=y=>{const $=f();if($){d.Transforms.setNodes(s,y,{at:$});const E=["title","caption"].filter(S=>y[S]===void 0||y[S]==="");E.length&&d.Transforms.unsetNodes(s,E,{at:$})}c(!1),B.ReactEditor.focus(s)},w=()=>{g(),c(!1),B.ReactEditor.focus(s)},x=()=>{h||g(),c(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(vd,{$align:u,contentEditable:!1,children:o.jsxs(wd,{$selected:i,onMouseDown:y=>{y.target.closest("audio")||(y.preventDefault(),a||c(!0))},children:[o.jsxs(kd,{alignItems:"center",children:[o.jsx(jd,{children:o.jsx(D.MusicNotes,{})}),o.jsx(p.Typography,{fontWeight:"bold",children:r.title||r.file?.name||(h?"Audio":"Audio — click to add a file")})]}),h?o.jsx($d,{src:r.file.url,controls:r.player?.controls??!0,loop:r.player?.loop??!1,preload:r.player?.preload??"metadata"},r.file.url):o.jsx(Ed,{variant:"pi",children:"No audio selected — click to choose from the Media Library or paste a URL."}),r.file?.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[_a(r.file.size),r.file.mime?` · ${r.file.mime}`:""]}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]})}),l&&!a?o.jsx(xd,{open:!0,element:r,onSave:m,onRemove:w,onClose:x}):null]})},Td=e=>{const{isVoid:t}=e;return e.isVoid=n=>Qc(n)?!0:t(n),e},Md={audio:{renderElement:e=>o.jsx(Sd,{...e}),icon:D.MusicNotes,label:{id:"components.Blocks.blocks.audio",defaultMessage:"Audio"},matchNode:e=>e.type==="audio",isInBlocksSelector:!0,handleConvert(e){yd(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[audio]"]}},Ar=e=>{if(!e||e<=0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024))),r=e/Math.pow(1024,n);return`${parseFloat(r.toFixed(1))} ${t[n]}`},Id={pdf:"📄",doc:"📝",docx:"📝",rtf:"📝",txt:"📄",xls:"📊",xlsx:"📊",csv:"📊",ppt:"📽️",pptx:"📽️",zip:"📦",rar:"📦","7z":"📦",mp3:"🎵",wav:"🎵",ogg:"🎵",mp4:"🎬",mov:"🎬",avi:"🎬",webm:"🎬",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️"},_r=e=>{if(!e)return"📎";const t=e.replace(/^\./,"").toLowerCase();return Id[t]??"📎"},Rd=e=>e&&e.startsWith("/")?`${window.strapi.backendURL}${e}`:e,Bd=e=>e.replace(/\.[^./\\]+$/,""),Fd=b.styled(p.Modal.Content)`
255
+ `,Bd=["file","title","caption","player","alignment"],Id=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Audio"),i=R.useSelected(),[l,c]=k.useState((r.file?.url??"").trim()===""&&!a),u=r.alignment??"center",h=(r.file?.url??"").trim()!=="",f=()=>{try{return R.ReactEditor.findPath(s,r)}catch{return null}},g=()=>{const v=f();v&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:v}),d.Transforms.unsetNodes(s,Bd,{at:v})):d.Transforms.removeNodes(s,{at:v}))},m=v=>{const $=f();if($){d.Transforms.setNodes(s,v,{at:$});const E=["title","caption"].filter(C=>v[C]===void 0||v[C]==="");E.length&&d.Transforms.unsetNodes(s,E,{at:$})}c(!1),R.ReactEditor.focus(s)},x=()=>{g(),c(!1),R.ReactEditor.focus(s)},y=()=>{h||g(),c(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx($d,{$align:u,contentEditable:!1,children:o.jsxs(Ed,{$selected:i,onMouseDown:v=>{v.target.closest("audio")||(v.preventDefault(),a||c(!0))},children:[o.jsxs(Cd,{alignItems:"center",children:[o.jsx(Sd,{children:o.jsx(D.MusicNotes,{})}),o.jsx(p.Typography,{fontWeight:"bold",children:r.title||r.file?.name||(h?"Audio":"Audio — click to add a file")})]}),h?o.jsx(Td,{src:r.file.url,controls:r.player?.controls??!0,loop:r.player?.loop??!1,preload:r.player?.preload??"metadata"},r.file.url):o.jsx(Md,{variant:"pi",children:"No audio selected — click to choose from the Media Library or paste a URL."}),r.file?.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[Pa(r.file.size),r.file.mime?` · ${r.file.mime}`:""]}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]})}),l&&!a?o.jsx(kd,{open:!0,element:r,onSave:m,onRemove:x,onClose:y}):null]})},Rd=e=>{const{isVoid:t}=e;return e.isVoid=n=>rd(n)?!0:t(n),e},Fd={audio:{renderElement:e=>o.jsx(Id,{...e}),icon:D.MusicNotes,label:{id:"components.Blocks.blocks.audio",defaultMessage:"Audio"},matchNode:e=>e.type==="audio",isInBlocksSelector:!0,handleConvert(e){jd(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[audio]"]}},Nr=e=>{if(!e||e<=0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024))),r=e/Math.pow(1024,n);return`${parseFloat(r.toFixed(1))} ${t[n]}`},Dd={pdf:"📄",doc:"📝",docx:"📝",rtf:"📝",txt:"📄",xls:"📊",xlsx:"📊",csv:"📊",ppt:"📽️",pptx:"📽️",zip:"📦",rar:"📦","7z":"📦",mp3:"🎵",wav:"🎵",ogg:"🎵",mp4:"🎬",mov:"🎬",avi:"🎬",webm:"🎬",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️"},Pr=e=>{if(!e)return"📎";const t=e.replace(/^\./,"").toLowerCase();return Dd[t]??"📎"},Ad=e=>e&&e.startsWith("/")?`${window.strapi.backendURL}${e}`:e,_d=e=>e.replace(/\.[^./\\]+$/,""),Nd=b.styled(p.Modal.Content)`
256
256
  width: 95vw;
257
257
  height: 95vh;
258
258
  max-width: none;
259
259
  max-height: none;
260
- `,Dd=b.styled.div`
260
+ `,Pd=b.styled.div`
261
261
  display: flex;
262
262
  flex-direction: column;
263
263
  flex: 1;
@@ -265,9 +265,9 @@
265
265
  overflow: auto;
266
266
  padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
267
267
  ${({theme:e})=>e.spaces[6]};
268
- `,Ad=b.styled(p.Modal.Footer)`
268
+ `,Ld=b.styled(p.Modal.Footer)`
269
269
  flex: 0 0 auto;
270
- `,_d=b.styled.div`
270
+ `,Od=b.styled.div`
271
271
  flex: 1;
272
272
  display: grid;
273
273
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
@@ -279,11 +279,11 @@
279
279
  grid-template-columns: minmax(0, 1fr);
280
280
  grid-template-rows: auto auto;
281
281
  }
282
- `,Nd=b.styled.div`
282
+ `,zd=b.styled.div`
283
283
  min-height: 0;
284
284
  overflow: auto;
285
285
  padding-right: ${({theme:e})=>e.spaces[2]};
286
- `,Pd=b.styled.div`
286
+ `,Hd=b.styled.div`
287
287
  min-height: 0;
288
288
  overflow: auto;
289
289
  border: 1px solid ${({theme:e})=>e.colors.neutral150};
@@ -306,10 +306,10 @@
306
306
  outline: none;
307
307
  border-color: ${({theme:e})=>e.colors.primary600};
308
308
  }
309
- `,hr=b.styled.div`
309
+ `,gr=b.styled.div`
310
310
  display: flex;
311
311
  gap: ${({theme:e})=>e.spaces[1]};
312
- `,fr=b.styled.button`
312
+ `,mr=b.styled.button`
313
313
  flex: 1;
314
314
  padding: ${({theme:e})=>e.spaces[2]};
315
315
  cursor: pointer;
@@ -323,7 +323,7 @@
323
323
  &:hover {
324
324
  border-color: ${({theme:e})=>e.colors.primary600};
325
325
  }
326
- `,Ld=b.styled.input`
326
+ `,Ud=b.styled.input`
327
327
  width: 40px;
328
328
  height: 40px;
329
329
  flex-shrink: 0;
@@ -332,9 +332,9 @@
332
332
  border-radius: ${({theme:e})=>e.borderRadius};
333
333
  background: ${({theme:e})=>e.colors.neutral0};
334
334
  cursor: pointer;
335
- `,Od=b.styled(Fe)`
335
+ `,Wd=b.styled(Fe)`
336
336
  flex: 1;
337
- `,zd=b.styled.button`
337
+ `,Kd=b.styled.button`
338
338
  border: none;
339
339
  background: transparent;
340
340
  color: ${({theme:e})=>e.colors.neutral500};
@@ -345,12 +345,12 @@
345
345
  &:hover {
346
346
  color: ${({theme:e})=>e.colors.danger600};
347
347
  }
348
- `,Hd=b.styled(p.Flex)`
348
+ `,Gd=b.styled(p.Flex)`
349
349
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
350
350
  border-radius: ${({theme:e})=>e.borderRadius};
351
351
  background: ${({theme:e})=>e.colors.neutral100};
352
352
  padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[3]};
353
- `,Ud=b.styled.a`
353
+ `,Vd=b.styled.a`
354
354
  display: inline-flex;
355
355
  align-items: center;
356
356
  gap: 8px;
@@ -371,9 +371,9 @@
371
371
  ${({$hoverBg:e})=>e?`background-color: ${e};`:""}
372
372
  ${({$hoverText:e})=>e?`color: ${e};`:""}
373
373
  }
374
- `,Nr=["solid","dashed","dotted","double"],Pa=e=>{const t={enabled:!1,width:"1px",style:"solid",color:"#cccccc"},n=(e??"").trim();if(n===""||n==="none")return t;const r=n.split(/\s+/),s=r.find(l=>/^[\d.]+(px|em|rem|%)$/.test(l)),a=r.find(l=>Nr.includes(l)),i=r.find(l=>l!==s&&!Nr.includes(l)&&/^#|rgb|hsl|[a-z]/i.test(l));return{enabled:!0,width:s??t.width,style:a??t.style,color:i??t.color}},La=e=>e.borderEnabled?`${e.borderWidth||"1px"} ${e.borderStyle||"solid"} ${e.borderColor||"#cccccc"}`:"",Zo=e=>{const{border:t,variant:n,...r}=e.style??{},s=Pa(e.style?.border);return{buttonType:e.buttonType??"link",label:e.label??"",alignment:e.alignment??"center",url:e.link?.url??"",newTab:e.link?.target==="_blank",ariaLabel:e.link?.ariaLabel??"",file:e.file,showFileSize:e.showFileSize??!0,showFileIcon:e.showFileIcon??!0,filePreview:e.filePreview??!1,variant:e.style?.variant??"custom",style:{...r},cssClass:e.cssClass??"",borderEnabled:s.enabled,borderWidth:s.width,borderStyle:s.style,borderColor:s.color}},Wd=e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];typeof r=="string"&&r.trim()!==""&&(t[n]=r)}),t},Kd=e=>{const t=La(e),n={buttonType:e.buttonType,label:e.label.trim(),alignment:e.alignment,style:{...Wd(e.style),variant:e.variant,...t?{border:t}:{}},showFileSize:e.showFileSize,showFileIcon:e.showFileIcon,filePreview:e.filePreview,cssClass:e.cssClass.trim()||void 0};if(e.buttonType==="link"){const r={url:e.url.trim(),target:e.newTab?"_blank":"_self"};e.newTab&&(r.rel="noopener noreferrer"),e.ariaLabel.trim()&&(r.ariaLabel=e.ariaLabel.trim()),n.link=r}else n.file=e.file;return n},jn={primary:{backgroundColor:"#4945ff",textColor:"#ffffff",border:"none"},secondary:{backgroundColor:"#dcdce4",textColor:"#32324d",border:"none"},outline:{backgroundColor:"transparent",textColor:"#4945ff",border:"2px solid #4945ff"},filled:{backgroundColor:"#32324d",textColor:"#ffffff",border:"none"}},Gd=[{value:"primary",label:"Primary"},{value:"secondary",label:"Secondary"},{value:"outline",label:"Outline"},{value:"filled",label:"Filled"},{value:"custom",label:"Custom"}],Jo=[{value:"8px 16px",labelId:"small",label:"Small"},{value:"12px 24px",labelId:"medium",label:"Medium"},{value:"16px 32px",labelId:"large",label:"Large"}],Vd=[{value:"400",label:"Normal (400)"},{value:"500",label:"Medium (500)"},{value:"600",label:"Semibold (600)"},{value:"700",label:"Bold (700)"}],qd=["left","center","right"],J=({label:e,hint:t,children:n})=>o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[e?o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",tag:"label",children:e}):null,n,t?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:t}):null]}),Wt=({children:e})=>o.jsx(p.Typography,{variant:"delta",tag:"h3",children:e}),Kt=({label:e,value:t,onChange:n})=>o.jsx(J,{label:e,children:o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Ld,{type:"color",value:t&&/^#[0-9a-fA-F]{6}$/.test(t)?t:"#000000",onChange:r=>n(r.target.value)}),o.jsx(Od,{value:t??"",placeholder:"—",spellCheck:!1,onChange:r=>n(r.target.value)}),t?o.jsx(zd,{type:"button",onClick:()=>n(""),children:"Clear"}):null]})}),Xd=({open:e,element:t,presets:n,onSave:r,onRemove:s,onClose:a})=>{const{formatMessage:i}=O.useIntl(),l=Xe.useStrapiApp("ButtonEditorModal",v=>v.components),[c,u]=k.useState(()=>Zo(t)),[h,f]=k.useState(!1),g={primary:{...jn.primary,...n?.primary},secondary:{...jn.secondary,...n?.secondary},outline:{...jn.outline,...n?.outline},filled:{...jn.filled,...n?.filled}};k.useEffect(()=>{e&&u(Zo(t))},[e]);const m=v=>u(I=>({...I,style:{...I.style,...v}})),w=v=>u(I=>({...I,variant:"custom",style:{...I.style,...v}})),x=v=>u(I=>({...I,variant:"custom",...v})),y=v=>{if(v==="custom"){u(N=>({...N,variant:"custom"}));return}const I=g[v],A=Pa(I.border);u(N=>({...N,variant:v,style:{...N.style,backgroundColor:I.backgroundColor??N.style.backgroundColor,textColor:I.textColor??N.style.textColor},borderEnabled:A.enabled,borderWidth:A.width,borderStyle:A.style,borderColor:A.color}))},$=l?.["media-library"],E=v=>{const I=v[0];if(I){const A=typeof I.size=="number"?I.size:void 0,N={id:typeof I.id=="number"?I.id:void 0,url:Rd(I.url)??"",name:I.name??"file",size:A!==void 0?Math.round(A*1024):void 0,ext:I.ext??void 0,mime:I.mime??void 0};u(F=>({...F,file:N,label:F.label.trim()?F.label:Bd(N.name)}))}f(!1)},S=c.style.padding??"",R=Jo.some(v=>v.value===S),C=c.label.trim()||i({id:"components.Blocks.button.preview.placeholder",defaultMessage:"Button"}),M=c.buttonType==="file"&&c.showFileIcon,j=c.buttonType==="file"&&c.showFileSize&&!!c.file?.size;return o.jsxs(p.Modal.Root,{open:e,onOpenChange:v=>{v||a()},children:[o.jsxs(Fd,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:i({id:"components.Blocks.button.modal.title",defaultMessage:"Edit button"})})}),o.jsx(Dd,{children:o.jsxs(_d,{children:[o.jsx(Nd,{children:o.jsxs(p.Flex,{direction:"column",gap:4,alignItems:"stretch",children:[o.jsx(Wt,{children:i({id:"components.Blocks.button.section.content",defaultMessage:"Content"})}),o.jsx(J,{label:i({id:"components.Blocks.button.type",defaultMessage:"Button type"}),children:o.jsx(hr,{children:["link","file"].map(v=>o.jsx(fr,{type:"button",$active:c.buttonType===v,onClick:()=>u(I=>({...I,buttonType:v})),children:i(v==="link"?{id:"components.Blocks.button.type.link",defaultMessage:"🔗 Link"}:{id:"components.Blocks.button.type.file",defaultMessage:"📁 File download"})},v))})}),o.jsx(J,{label:i({id:"components.Blocks.button.text",defaultMessage:"Text"}),children:o.jsx(Fe,{value:c.label,placeholder:"Click me",onChange:v=>u(I=>({...I,label:v.target.value}))})}),c.buttonType==="link"?o.jsxs(o.Fragment,{children:[o.jsx(J,{label:i({id:"components.Blocks.button.url",defaultMessage:"URL"}),children:o.jsx(Fe,{value:c.url,placeholder:"https://example.com",spellCheck:!1,onChange:v=>u(I=>({...I,url:v.target.value}))})}),o.jsx(p.Checkbox,{checked:c.newTab,onCheckedChange:v=>u(I=>({...I,newTab:!!v})),children:i({id:"components.Blocks.button.newTab",defaultMessage:'Open in new tab (adds rel="noopener noreferrer")'})}),o.jsx(J,{label:i({id:"components.Blocks.button.ariaLabel",defaultMessage:"ARIA label (optional)"}),children:o.jsx(Fe,{value:c.ariaLabel,placeholder:"Accessible description",onChange:v=>u(I=>({...I,ariaLabel:v.target.value}))})})]}):o.jsxs(o.Fragment,{children:[o.jsx(J,{label:i({id:"components.Blocks.button.file",defaultMessage:"File"}),children:c.file?o.jsxs(Hd,{justifyContent:"space-between",gap:2,children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",overflow:"hidden",children:[o.jsx("span",{children:_r(c.file.ext)}),o.jsxs(p.Flex,{direction:"column",alignItems:"flex-start",children:[o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",ellipsis:!0,children:c.file.name}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:Ar(c.file.size)})]})]}),o.jsx(p.Button,{variant:"tertiary",type:"button",disabled:!$,onClick:()=>f(!0),children:i({id:"components.Blocks.button.file.change",defaultMessage:"Change"})})]}):o.jsx(p.Button,{variant:"secondary",type:"button",disabled:!$,onClick:()=>f(!0),children:i({id:"components.Blocks.button.file.select",defaultMessage:"Select from Media Library"})})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsx(p.Checkbox,{checked:c.showFileSize,onCheckedChange:v=>u(I=>({...I,showFileSize:!!v})),children:i({id:"components.Blocks.button.showFileSize",defaultMessage:"Show file size"})}),o.jsx(p.Checkbox,{checked:c.showFileIcon,onCheckedChange:v=>u(I=>({...I,showFileIcon:!!v})),children:i({id:"components.Blocks.button.showFileIcon",defaultMessage:"Show file icon"})})]}),o.jsx(J,{hint:i({id:"components.Blocks.button.filePreview.hint",defaultMessage:"On: open the file in a new tab (preview). Off: download it directly."}),children:o.jsx(p.Checkbox,{checked:c.filePreview,onCheckedChange:v=>u(I=>({...I,filePreview:!!v})),children:i({id:"components.Blocks.button.filePreview",defaultMessage:"Preview file instead of downloading"})})})]}),o.jsx(p.Divider,{}),o.jsx(Wt,{children:i({id:"components.Blocks.button.section.layout",defaultMessage:"Layout"})}),o.jsx(J,{label:i({id:"components.Blocks.button.alignment",defaultMessage:"Alignment"}),children:o.jsx(hr,{children:qd.map(v=>o.jsx(fr,{type:"button",$active:c.alignment===v,onClick:()=>u(I=>({...I,alignment:v})),children:v.charAt(0).toUpperCase()+v.slice(1)},v))})}),o.jsx(p.Divider,{}),o.jsx(Wt,{children:i({id:"components.Blocks.button.section.colors",defaultMessage:"Colors"})}),o.jsx(J,{label:i({id:"components.Blocks.button.preset",defaultMessage:"Style preset"}),hint:i({id:"components.Blocks.button.preset.hint",defaultMessage:"Apply a brand variant, then fine-tune below. Editing colors or the border switches to Custom."}),children:o.jsx(hr,{children:Gd.map(v=>o.jsx(fr,{type:"button",$active:c.variant===v.value,onClick:()=>y(v.value),children:v.label},v.value))})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(Kt,{label:i({id:"components.Blocks.button.bgColor",defaultMessage:"Background"}),value:c.style.backgroundColor,onChange:v=>w({backgroundColor:v})}),o.jsx(Kt,{label:i({id:"components.Blocks.button.textColor",defaultMessage:"Text"}),value:c.style.textColor,onChange:v=>w({textColor:v})}),o.jsx(Kt,{label:i({id:"components.Blocks.button.hoverBgColor",defaultMessage:"Hover background"}),value:c.style.hoverBackgroundColor,onChange:v=>w({hoverBackgroundColor:v})}),o.jsx(Kt,{label:i({id:"components.Blocks.button.hoverTextColor",defaultMessage:"Hover text"}),value:c.style.hoverTextColor,onChange:v=>w({hoverTextColor:v})})]}),o.jsx(p.Divider,{}),o.jsx(Wt,{children:i({id:"components.Blocks.button.section.sizing",defaultMessage:"Sizing & typography"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(J,{label:i({id:"components.Blocks.button.borderRadius",defaultMessage:"Border radius"}),children:o.jsx(Fe,{value:c.style.borderRadius??"",placeholder:"4px",onChange:v=>m({borderRadius:v.target.value})})}),o.jsx(J,{label:i({id:"components.Blocks.button.fontSize",defaultMessage:"Font size"}),children:o.jsx(Fe,{value:c.style.fontSize??"",placeholder:"16px",onChange:v=>m({fontSize:v.target.value})})})]}),o.jsx(J,{label:i({id:"components.Blocks.button.fontWeight",defaultMessage:"Font weight"}),children:o.jsxs(p.SingleSelect,{value:c.style.fontWeight||"inherit",onChange:v=>m({fontWeight:v==="inherit"?"":String(v)}),children:[o.jsx(p.SingleSelectOption,{value:"inherit",children:i({id:"components.Blocks.button.default",defaultMessage:"Default"})}),Vd.map(v=>o.jsx(p.SingleSelectOption,{value:v.value,children:v.label},v.value))]})}),o.jsx(J,{label:i({id:"components.Blocks.button.padding",defaultMessage:"Padding"}),hint:i({id:"components.Blocks.button.padding.hint",defaultMessage:"Pick a preset or type a custom CSS padding value."}),children:o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsxs(p.SingleSelect,{value:R?S:"custom",onChange:v=>{v!=="custom"&&m({padding:String(v)})},children:[Jo.map(v=>o.jsxs(p.SingleSelectOption,{value:v.value,children:[v.label," (",v.value,")"]},v.value)),o.jsx(p.SingleSelectOption,{value:"custom",children:i({id:"components.Blocks.button.padding.custom",defaultMessage:"Custom…"})})]}),o.jsx(Fe,{value:S,placeholder:"12px 24px",onChange:v=>m({padding:v.target.value})})]})}),o.jsx(J,{label:i({id:"components.Blocks.button.border",defaultMessage:"Border"}),children:o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(p.Checkbox,{checked:c.borderEnabled,onCheckedChange:v=>x({borderEnabled:!!v}),children:i({id:"components.Blocks.button.border.enable",defaultMessage:"Show border"})}),c.borderEnabled?o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(J,{label:i({id:"components.Blocks.button.border.width",defaultMessage:"Thickness"}),children:o.jsx(Fe,{value:c.borderWidth,placeholder:"1px",onChange:v=>x({borderWidth:v.target.value})})}),o.jsx(J,{label:i({id:"components.Blocks.button.border.style",defaultMessage:"Style"}),children:o.jsx(p.SingleSelect,{value:c.borderStyle,onChange:v=>x({borderStyle:String(v)}),children:Nr.map(v=>o.jsx(p.SingleSelectOption,{value:v,children:v.charAt(0).toUpperCase()+v.slice(1)},v))})}),o.jsx(Kt,{label:i({id:"components.Blocks.button.border.color",defaultMessage:"Color"}),value:c.borderColor,onChange:v=>x({borderColor:v})})]}):null]})}),o.jsx(p.Divider,{}),o.jsx(Wt,{children:i({id:"components.Blocks.button.section.advanced",defaultMessage:"Advanced"})}),o.jsx(J,{label:i({id:"components.Blocks.button.cssClass",defaultMessage:"Custom CSS class"}),hint:i({id:"components.Blocks.button.cssClass.hint",defaultMessage:"Applied to the rendered button for frontend theming."}),children:o.jsx(Fe,{value:c.cssClass,placeholder:"my-cta",spellCheck:!1,onChange:v=>u(I=>({...I,cssClass:v.target.value}))})})]})}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:i({id:"components.Blocks.button.preview",defaultMessage:"Preview"})}),o.jsx(Pd,{style:{textAlign:c.alignment},children:o.jsxs(Ud,{className:c.cssClass||void 0,$bg:c.style.backgroundColor,$text:c.style.textColor,$hoverBg:c.style.hoverBackgroundColor,$hoverText:c.style.hoverTextColor,$radius:c.style.borderRadius,$fontSize:c.style.fontSize,$fontWeight:c.style.fontWeight,$padding:c.style.padding,$border:La(c)||"none",onClick:v=>v.preventDefault(),children:[M?o.jsx("span",{children:_r(c.file?.ext)}):null,o.jsx("span",{children:C}),j?o.jsxs("span",{children:["(",Ar(c.file?.size),")"]}):null]})}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:i({id:"components.Blocks.button.preview.hoverHint",defaultMessage:"Hover the button to preview hover colors."})})]})]})}),o.jsxs(Ad,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:s,children:i({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:a,children:i({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",onClick:()=>r(Kd(c)),children:i({id:"global.save",defaultMessage:"Save"})})]})]})]}),h&&$?o.jsx($,{allowedTypes:["files","images","videos","audios"],onClose:()=>f(!1),onSelectAssets:E}):null]})},Yd=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",...t,children:[o.jsx("rect",{x:"2.5",y:"7.5",width:"19",height:"9",rx:"3",fill:s,opacity:"0.18",stroke:s,strokeWidth:"1.5"}),o.jsx("rect",{x:"7",y:"11",width:"10",height:"2",rx:"1",fill:s})]})},Zd=e=>{const t=e.pluginOptions,n=typeof t?.buttonDefaultBackgroundColor=="string"?t.buttonDefaultBackgroundColor:"#4945ff",r=typeof t?.buttonDefaultTextColor=="string"?t.buttonDefaultTextColor:"#ffffff";return{backgroundColor:n,textColor:r,borderRadius:"4px",padding:"12px 24px",fontSize:"16px",fontWeight:"600"}},Jd=e=>{const n=e.pluginOptions?.buttonPresets;return n&&typeof n=="object"?n:void 0},Qo=e=>({type:"button",buttonType:"link",label:"",alignment:"center",link:{url:"",target:"_self"},showFileSize:!0,showFileIcon:!0,style:Zd(e),children:[{type:"text",text:""}]}),Qd=e=>{const t=he(e,Qo(e));t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,Qo(e),{at:t,select:!0}))},eu=b.styled.div`
374
+ `,Lr=["solid","dashed","dotted","double"],Oa=e=>{const t={enabled:!1,width:"1px",style:"solid",color:"#cccccc"},n=(e??"").trim();if(n===""||n==="none")return t;const r=n.split(/\s+/),s=r.find(l=>/^[\d.]+(px|em|rem|%)$/.test(l)),a=r.find(l=>Lr.includes(l)),i=r.find(l=>l!==s&&!Lr.includes(l)&&/^#|rgb|hsl|[a-z]/i.test(l));return{enabled:!0,width:s??t.width,style:a??t.style,color:i??t.color}},za=e=>e.borderEnabled?`${e.borderWidth||"1px"} ${e.borderStyle||"solid"} ${e.borderColor||"#cccccc"}`:"",es=e=>{const{border:t,variant:n,...r}=e.style??{},s=Oa(e.style?.border);return{buttonType:e.buttonType??"link",label:e.label??"",alignment:e.alignment??"center",url:e.link?.url??"",newTab:e.link?.target==="_blank",ariaLabel:e.link?.ariaLabel??"",file:e.file,showFileSize:e.showFileSize??!0,showFileIcon:e.showFileIcon??!0,filePreview:e.filePreview??!1,variant:e.style?.variant??"custom",style:{...r},cssClass:e.cssClass??"",borderEnabled:s.enabled,borderWidth:s.width,borderStyle:s.style,borderColor:s.color}},qd=e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];typeof r=="string"&&r.trim()!==""&&(t[n]=r)}),t},Xd=e=>{const t=za(e),n={buttonType:e.buttonType,label:e.label.trim(),alignment:e.alignment,style:{...qd(e.style),variant:e.variant,...t?{border:t}:{}},showFileSize:e.showFileSize,showFileIcon:e.showFileIcon,filePreview:e.filePreview,cssClass:e.cssClass.trim()||void 0};if(e.buttonType==="link"){const r={url:e.url.trim(),target:e.newTab?"_blank":"_self"};e.newTab&&(r.rel="noopener noreferrer"),e.ariaLabel.trim()&&(r.ariaLabel=e.ariaLabel.trim()),n.link=r}else n.file=e.file;return n},$n={primary:{backgroundColor:"#4945ff",textColor:"#ffffff",border:"none"},secondary:{backgroundColor:"#dcdce4",textColor:"#32324d",border:"none"},outline:{backgroundColor:"transparent",textColor:"#4945ff",border:"2px solid #4945ff"},filled:{backgroundColor:"#32324d",textColor:"#ffffff",border:"none"}},Yd=[{value:"primary",label:"Primary"},{value:"secondary",label:"Secondary"},{value:"outline",label:"Outline"},{value:"filled",label:"Filled"},{value:"custom",label:"Custom"}],ts=[{value:"8px 16px",labelId:"small",label:"Small"},{value:"12px 24px",labelId:"medium",label:"Medium"},{value:"16px 32px",labelId:"large",label:"Large"}],Zd=[{value:"400",label:"Normal (400)"},{value:"500",label:"Medium (500)"},{value:"600",label:"Semibold (600)"},{value:"700",label:"Bold (700)"}],Jd=["left","center","right"],J=({label:e,hint:t,children:n})=>o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[e?o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",tag:"label",children:e}):null,n,t?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:t}):null]}),Kt=({children:e})=>o.jsx(p.Typography,{variant:"delta",tag:"h3",children:e}),Gt=({label:e,value:t,onChange:n})=>o.jsx(J,{label:e,children:o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Ud,{type:"color",value:t&&/^#[0-9a-fA-F]{6}$/.test(t)?t:"#000000",onChange:r=>n(r.target.value)}),o.jsx(Wd,{value:t??"",placeholder:"—",spellCheck:!1,onChange:r=>n(r.target.value)}),t?o.jsx(Kd,{type:"button",onClick:()=>n(""),children:"Clear"}):null]})}),Qd=({open:e,element:t,presets:n,onSave:r,onRemove:s,onClose:a})=>{const{formatMessage:i}=O.useIntl(),l=Xe.useStrapiApp("ButtonEditorModal",w=>w.components),[c,u]=k.useState(()=>es(t)),[h,f]=k.useState(!1),g={primary:{...$n.primary,...n?.primary},secondary:{...$n.secondary,...n?.secondary},outline:{...$n.outline,...n?.outline},filled:{...$n.filled,...n?.filled}};k.useEffect(()=>{e&&u(es(t))},[e]);const m=w=>u(B=>({...B,style:{...B.style,...w}})),x=w=>u(B=>({...B,variant:"custom",style:{...B.style,...w}})),y=w=>u(B=>({...B,variant:"custom",...w})),v=w=>{if(w==="custom"){u(N=>({...N,variant:"custom"}));return}const B=g[w],A=Oa(B.border);u(N=>({...N,variant:w,style:{...N.style,backgroundColor:B.backgroundColor??N.style.backgroundColor,textColor:B.textColor??N.style.textColor},borderEnabled:A.enabled,borderWidth:A.width,borderStyle:A.style,borderColor:A.color}))},$=l?.["media-library"],E=w=>{const B=w[0];if(B){const A=typeof B.size=="number"?B.size:void 0,N={id:typeof B.id=="number"?B.id:void 0,url:Ad(B.url)??"",name:B.name??"file",size:A!==void 0?Math.round(A*1024):void 0,ext:B.ext??void 0,mime:B.mime??void 0};u(F=>({...F,file:N,label:F.label.trim()?F.label:_d(N.name)}))}f(!1)},C=c.style.padding??"",I=ts.some(w=>w.value===C),S=c.label.trim()||i({id:"components.Blocks.button.preview.placeholder",defaultMessage:"Button"}),T=c.buttonType==="file"&&c.showFileIcon,j=c.buttonType==="file"&&c.showFileSize&&!!c.file?.size;return o.jsxs(p.Modal.Root,{open:e,onOpenChange:w=>{w||a()},children:[o.jsxs(Nd,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:i({id:"components.Blocks.button.modal.title",defaultMessage:"Edit button"})})}),o.jsx(Pd,{children:o.jsxs(Od,{children:[o.jsx(zd,{children:o.jsxs(p.Flex,{direction:"column",gap:4,alignItems:"stretch",children:[o.jsx(Kt,{children:i({id:"components.Blocks.button.section.content",defaultMessage:"Content"})}),o.jsx(J,{label:i({id:"components.Blocks.button.type",defaultMessage:"Button type"}),children:o.jsx(gr,{children:["link","file"].map(w=>o.jsx(mr,{type:"button",$active:c.buttonType===w,onClick:()=>u(B=>({...B,buttonType:w})),children:i(w==="link"?{id:"components.Blocks.button.type.link",defaultMessage:"🔗 Link"}:{id:"components.Blocks.button.type.file",defaultMessage:"📁 File download"})},w))})}),o.jsx(J,{label:i({id:"components.Blocks.button.text",defaultMessage:"Text"}),children:o.jsx(Fe,{value:c.label,placeholder:"Click me",onChange:w=>u(B=>({...B,label:w.target.value}))})}),c.buttonType==="link"?o.jsxs(o.Fragment,{children:[o.jsx(J,{label:i({id:"components.Blocks.button.url",defaultMessage:"URL"}),children:o.jsx(Fe,{value:c.url,placeholder:"https://example.com",spellCheck:!1,onChange:w=>u(B=>({...B,url:w.target.value}))})}),o.jsx(p.Checkbox,{checked:c.newTab,onCheckedChange:w=>u(B=>({...B,newTab:!!w})),children:i({id:"components.Blocks.button.newTab",defaultMessage:'Open in new tab (adds rel="noopener noreferrer")'})}),o.jsx(J,{label:i({id:"components.Blocks.button.ariaLabel",defaultMessage:"ARIA label (optional)"}),children:o.jsx(Fe,{value:c.ariaLabel,placeholder:"Accessible description",onChange:w=>u(B=>({...B,ariaLabel:w.target.value}))})})]}):o.jsxs(o.Fragment,{children:[o.jsx(J,{label:i({id:"components.Blocks.button.file",defaultMessage:"File"}),children:c.file?o.jsxs(Gd,{justifyContent:"space-between",gap:2,children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",overflow:"hidden",children:[o.jsx("span",{children:Pr(c.file.ext)}),o.jsxs(p.Flex,{direction:"column",alignItems:"flex-start",children:[o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",ellipsis:!0,children:c.file.name}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:Nr(c.file.size)})]})]}),o.jsx(p.Button,{variant:"tertiary",type:"button",disabled:!$,onClick:()=>f(!0),children:i({id:"components.Blocks.button.file.change",defaultMessage:"Change"})})]}):o.jsx(p.Button,{variant:"secondary",type:"button",disabled:!$,onClick:()=>f(!0),children:i({id:"components.Blocks.button.file.select",defaultMessage:"Select from Media Library"})})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsx(p.Checkbox,{checked:c.showFileSize,onCheckedChange:w=>u(B=>({...B,showFileSize:!!w})),children:i({id:"components.Blocks.button.showFileSize",defaultMessage:"Show file size"})}),o.jsx(p.Checkbox,{checked:c.showFileIcon,onCheckedChange:w=>u(B=>({...B,showFileIcon:!!w})),children:i({id:"components.Blocks.button.showFileIcon",defaultMessage:"Show file icon"})})]}),o.jsx(J,{hint:i({id:"components.Blocks.button.filePreview.hint",defaultMessage:"On: open the file in a new tab (preview). Off: download it directly."}),children:o.jsx(p.Checkbox,{checked:c.filePreview,onCheckedChange:w=>u(B=>({...B,filePreview:!!w})),children:i({id:"components.Blocks.button.filePreview",defaultMessage:"Preview file instead of downloading"})})})]}),o.jsx(p.Divider,{}),o.jsx(Kt,{children:i({id:"components.Blocks.button.section.layout",defaultMessage:"Layout"})}),o.jsx(J,{label:i({id:"components.Blocks.button.alignment",defaultMessage:"Alignment"}),children:o.jsx(gr,{children:Jd.map(w=>o.jsx(mr,{type:"button",$active:c.alignment===w,onClick:()=>u(B=>({...B,alignment:w})),children:w.charAt(0).toUpperCase()+w.slice(1)},w))})}),o.jsx(p.Divider,{}),o.jsx(Kt,{children:i({id:"components.Blocks.button.section.colors",defaultMessage:"Colors"})}),o.jsx(J,{label:i({id:"components.Blocks.button.preset",defaultMessage:"Style preset"}),hint:i({id:"components.Blocks.button.preset.hint",defaultMessage:"Apply a brand variant, then fine-tune below. Editing colors or the border switches to Custom."}),children:o.jsx(gr,{children:Yd.map(w=>o.jsx(mr,{type:"button",$active:c.variant===w.value,onClick:()=>v(w.value),children:w.label},w.value))})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(Gt,{label:i({id:"components.Blocks.button.bgColor",defaultMessage:"Background"}),value:c.style.backgroundColor,onChange:w=>x({backgroundColor:w})}),o.jsx(Gt,{label:i({id:"components.Blocks.button.textColor",defaultMessage:"Text"}),value:c.style.textColor,onChange:w=>x({textColor:w})}),o.jsx(Gt,{label:i({id:"components.Blocks.button.hoverBgColor",defaultMessage:"Hover background"}),value:c.style.hoverBackgroundColor,onChange:w=>x({hoverBackgroundColor:w})}),o.jsx(Gt,{label:i({id:"components.Blocks.button.hoverTextColor",defaultMessage:"Hover text"}),value:c.style.hoverTextColor,onChange:w=>x({hoverTextColor:w})})]}),o.jsx(p.Divider,{}),o.jsx(Kt,{children:i({id:"components.Blocks.button.section.sizing",defaultMessage:"Sizing & typography"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(J,{label:i({id:"components.Blocks.button.borderRadius",defaultMessage:"Border radius"}),children:o.jsx(Fe,{value:c.style.borderRadius??"",placeholder:"4px",onChange:w=>m({borderRadius:w.target.value})})}),o.jsx(J,{label:i({id:"components.Blocks.button.fontSize",defaultMessage:"Font size"}),children:o.jsx(Fe,{value:c.style.fontSize??"",placeholder:"16px",onChange:w=>m({fontSize:w.target.value})})})]}),o.jsx(J,{label:i({id:"components.Blocks.button.fontWeight",defaultMessage:"Font weight"}),children:o.jsxs(p.SingleSelect,{value:c.style.fontWeight||"inherit",onChange:w=>m({fontWeight:w==="inherit"?"":String(w)}),children:[o.jsx(p.SingleSelectOption,{value:"inherit",children:i({id:"components.Blocks.button.default",defaultMessage:"Default"})}),Zd.map(w=>o.jsx(p.SingleSelectOption,{value:w.value,children:w.label},w.value))]})}),o.jsx(J,{label:i({id:"components.Blocks.button.padding",defaultMessage:"Padding"}),hint:i({id:"components.Blocks.button.padding.hint",defaultMessage:"Pick a preset or type a custom CSS padding value."}),children:o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsxs(p.SingleSelect,{value:I?C:"custom",onChange:w=>{w!=="custom"&&m({padding:String(w)})},children:[ts.map(w=>o.jsxs(p.SingleSelectOption,{value:w.value,children:[w.label," (",w.value,")"]},w.value)),o.jsx(p.SingleSelectOption,{value:"custom",children:i({id:"components.Blocks.button.padding.custom",defaultMessage:"Custom…"})})]}),o.jsx(Fe,{value:C,placeholder:"12px 24px",onChange:w=>m({padding:w.target.value})})]})}),o.jsx(J,{label:i({id:"components.Blocks.button.border",defaultMessage:"Border"}),children:o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(p.Checkbox,{checked:c.borderEnabled,onCheckedChange:w=>y({borderEnabled:!!w}),children:i({id:"components.Blocks.button.border.enable",defaultMessage:"Show border"})}),c.borderEnabled?o.jsxs(p.Flex,{gap:4,wrap:"wrap",alignItems:"flex-start",children:[o.jsx(J,{label:i({id:"components.Blocks.button.border.width",defaultMessage:"Thickness"}),children:o.jsx(Fe,{value:c.borderWidth,placeholder:"1px",onChange:w=>y({borderWidth:w.target.value})})}),o.jsx(J,{label:i({id:"components.Blocks.button.border.style",defaultMessage:"Style"}),children:o.jsx(p.SingleSelect,{value:c.borderStyle,onChange:w=>y({borderStyle:String(w)}),children:Lr.map(w=>o.jsx(p.SingleSelectOption,{value:w,children:w.charAt(0).toUpperCase()+w.slice(1)},w))})}),o.jsx(Gt,{label:i({id:"components.Blocks.button.border.color",defaultMessage:"Color"}),value:c.borderColor,onChange:w=>y({borderColor:w})})]}):null]})}),o.jsx(p.Divider,{}),o.jsx(Kt,{children:i({id:"components.Blocks.button.section.advanced",defaultMessage:"Advanced"})}),o.jsx(J,{label:i({id:"components.Blocks.button.cssClass",defaultMessage:"Custom CSS class"}),hint:i({id:"components.Blocks.button.cssClass.hint",defaultMessage:"Applied to the rendered button for frontend theming."}),children:o.jsx(Fe,{value:c.cssClass,placeholder:"my-cta",spellCheck:!1,onChange:w=>u(B=>({...B,cssClass:w.target.value}))})})]})}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:i({id:"components.Blocks.button.preview",defaultMessage:"Preview"})}),o.jsx(Hd,{style:{textAlign:c.alignment},children:o.jsxs(Vd,{className:c.cssClass||void 0,$bg:c.style.backgroundColor,$text:c.style.textColor,$hoverBg:c.style.hoverBackgroundColor,$hoverText:c.style.hoverTextColor,$radius:c.style.borderRadius,$fontSize:c.style.fontSize,$fontWeight:c.style.fontWeight,$padding:c.style.padding,$border:za(c)||"none",onClick:w=>w.preventDefault(),children:[T?o.jsx("span",{children:Pr(c.file?.ext)}):null,o.jsx("span",{children:S}),j?o.jsxs("span",{children:["(",Nr(c.file?.size),")"]}):null]})}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:i({id:"components.Blocks.button.preview.hoverHint",defaultMessage:"Hover the button to preview hover colors."})})]})]})}),o.jsxs(Ld,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:s,children:i({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:a,children:i({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",onClick:()=>r(Xd(c)),children:i({id:"global.save",defaultMessage:"Save"})})]})]})]}),h&&$?o.jsx($,{allowedTypes:["files","images","videos","audios"],onClose:()=>f(!1),onSelectAssets:E}):null]})},eu=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",...t,children:[o.jsx("rect",{x:"2.5",y:"7.5",width:"19",height:"9",rx:"3",fill:s,opacity:"0.18",stroke:s,strokeWidth:"1.5"}),o.jsx("rect",{x:"7",y:"11",width:"10",height:"2",rx:"1",fill:s})]})},tu=e=>{const t=e.pluginOptions,n=typeof t?.buttonDefaultBackgroundColor=="string"?t.buttonDefaultBackgroundColor:"#4945ff",r=typeof t?.buttonDefaultTextColor=="string"?t.buttonDefaultTextColor:"#ffffff";return{backgroundColor:n,textColor:r,borderRadius:"4px",padding:"12px 24px",fontSize:"16px",fontWeight:"600"}},nu=e=>{const n=e.pluginOptions?.buttonPresets;return n&&typeof n=="object"?n:void 0},ns=e=>({type:"button",buttonType:"link",label:"",alignment:"center",link:{url:"",target:"_self"},showFileSize:!0,showFileIcon:!0,style:tu(e),children:[{type:"text",text:""}]}),ru=e=>{const t=he(e,ns(e));t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,ns(e),{at:t,select:!0}))},ou=b.styled.div`
375
375
  margin: ${({theme:e})=>e.spaces[2]} 0;
376
- `,tu=b.styled.span`
376
+ `,su=b.styled.span`
377
377
  display: inline-flex;
378
378
  align-items: center;
379
379
  gap: 8px;
@@ -396,11 +396,11 @@
396
396
  ${({$hoverBg:e})=>e?`background-color: ${e};`:""}
397
397
  ${({$hoverText:e})=>e?`color: ${e};`:""}
398
398
  }
399
- `,nu=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i}=P("Button"),l=B.useSelected(),[c,u]=k.useState((r.label??"").trim()===""&&!i),h=()=>{try{return B.ReactEditor.findPath(a,r)}catch{return null}},f=()=>{const E=h();E&&(a.children.length===1?(d.Transforms.setNodes(a,{type:"paragraph"},{at:E}),d.Transforms.unsetNodes(a,["buttonType","label","alignment","link","file","showFileSize","showFileIcon","filePreview","style","cssClass"],{at:E})):d.Transforms.removeNodes(a,{at:E}))},g=E=>{const S=h();S&&(d.Transforms.setNodes(a,E,{at:S}),d.Transforms.unsetNodes(a,E.buttonType==="link"?["file","showFileSize","showFileIcon","filePreview"]:["link"],{at:S})),u(!1),B.ReactEditor.focus(a)},m=()=>{f(),u(!1),B.ReactEditor.focus(a)},w=()=>{(r.label??"").trim()===""&&f(),u(!1)},x=r.alignment??"center",y=r.buttonType==="file",$=(r.label??"").trim()||s({id:"components.Blocks.button.preview.placeholder",defaultMessage:"Button"});return o.jsxs(p.Box,{...e,children:[t,o.jsx(eu,{style:{textAlign:x},contentEditable:!1,children:o.jsxs(tu,{className:r.cssClass||void 0,$selected:l,$bg:r.style?.backgroundColor,$text:r.style?.textColor,$hoverBg:r.style?.hoverBackgroundColor,$hoverText:r.style?.hoverTextColor,$radius:r.style?.borderRadius,$fontSize:r.style?.fontSize,$fontWeight:r.style?.fontWeight,$padding:r.style?.padding,$border:r.style?.border,onMouseDown:E=>{E.preventDefault(),i||u(!0)},children:[y&&r.showFileIcon&&r.file?o.jsx("span",{children:_r(r.file.ext)}):null,o.jsx("span",{children:$}),y&&r.showFileSize&&r.file?.size?o.jsxs("span",{children:["(",Ar(r.file.size),")"]}):null]})}),c&&!i?o.jsx(Xd,{open:!0,element:r,presets:Jd(a),onSave:g,onRemove:m,onClose:w}):null]})},ru=e=>{const{isVoid:t}=e;return e.isVoid=n=>nd(n)?!0:t(n),e},ou={button:{renderElement:e=>o.jsx(nu,{...e}),icon:Yd,label:{id:"components.Blocks.blocks.button",defaultMessage:"Button"},matchNode:e=>e.type==="button",isInBlocksSelector:!0,handleConvert(e){Qd(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[button]"]}},es=e=>{d.Transforms.unwrapNodes(e,{match:t=>!d.Editor.isEditor(t)&&d.Element.isElement(t)&&"type"in t&&t.type==="link"})},An=(e,{url:t})=>{if(e.selection)if(Array.from(d.Editor.nodes(e,{at:e.selection,match:r=>!d.Editor.isEditor(r)&&"type"in r&&r.type==="link"})).forEach(([,r])=>{d.Transforms.unwrapNodes(e,{at:r})}),d.Range.isCollapsed(e.selection)){const r={type:"link",url:t??"",children:[{type:"text",text:t}]};d.Transforms.insertNodes(e,r)}else{const r={type:"link",url:t??"",children:[]};d.Transforms.wrapNodes(e,r,{split:!0})}},su=(e,t)=>{const{url:n,text:r,target:s,rel:a}=t;if(!e.selection)return;const i=d.Editor.above(e,{match:l=>!d.Editor.isEditor(l)&&"type"in l&&l.type==="link"});if(i){const[,l]=i;d.Transforms.setNodes(e,{url:n,target:s??null,rel:a??null},{at:l}),r!==""&&r!==d.Editor.string(e,l)&&(Array.from(d.Node.children(e,l,{reverse:!0})).forEach(([,u])=>{d.Transforms.removeNodes(e,{at:u})}),d.Transforms.insertNodes(e,[{type:"text",text:r}],{at:l.concat(0)}))}},au=b.styled(p.Box)`
399
+ `,au=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i}=P("Button"),l=R.useSelected(),[c,u]=k.useState((r.label??"").trim()===""&&!i),h=()=>{try{return R.ReactEditor.findPath(a,r)}catch{return null}},f=()=>{const E=h();E&&(a.children.length===1?(d.Transforms.setNodes(a,{type:"paragraph"},{at:E}),d.Transforms.unsetNodes(a,["buttonType","label","alignment","link","file","showFileSize","showFileIcon","filePreview","style","cssClass"],{at:E})):d.Transforms.removeNodes(a,{at:E}))},g=E=>{const C=h();C&&(d.Transforms.setNodes(a,E,{at:C}),d.Transforms.unsetNodes(a,E.buttonType==="link"?["file","showFileSize","showFileIcon","filePreview"]:["link"],{at:C})),u(!1),R.ReactEditor.focus(a)},m=()=>{f(),u(!1),R.ReactEditor.focus(a)},x=()=>{(r.label??"").trim()===""&&f(),u(!1)},y=r.alignment??"center",v=r.buttonType==="file",$=(r.label??"").trim()||s({id:"components.Blocks.button.preview.placeholder",defaultMessage:"Button"});return o.jsxs(p.Box,{...e,children:[t,o.jsx(ou,{style:{textAlign:y},contentEditable:!1,children:o.jsxs(su,{className:r.cssClass||void 0,$selected:l,$bg:r.style?.backgroundColor,$text:r.style?.textColor,$hoverBg:r.style?.hoverBackgroundColor,$hoverText:r.style?.hoverTextColor,$radius:r.style?.borderRadius,$fontSize:r.style?.fontSize,$fontWeight:r.style?.fontWeight,$padding:r.style?.padding,$border:r.style?.border,onMouseDown:E=>{E.preventDefault(),i||u(!0)},children:[v&&r.showFileIcon&&r.file?o.jsx("span",{children:Pr(r.file.ext)}):null,o.jsx("span",{children:$}),v&&r.showFileSize&&r.file?.size?o.jsxs("span",{children:["(",Nr(r.file.size),")"]}):null]})}),c&&!i?o.jsx(Qd,{open:!0,element:r,presets:nu(a),onSave:g,onRemove:m,onClose:x}):null]})},iu=e=>{const{isVoid:t}=e;return e.isVoid=n=>ad(n)?!0:t(n),e},lu={button:{renderElement:e=>o.jsx(au,{...e}),icon:eu,label:{id:"components.Blocks.blocks.button",defaultMessage:"Button"},matchNode:e=>e.type==="button",isInBlocksSelector:!0,handleConvert(e){ru(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[button]"]}},rs=e=>{d.Transforms.unwrapNodes(e,{match:t=>!d.Editor.isEditor(t)&&d.Element.isElement(t)&&"type"in t&&t.type==="link"})},_n=(e,{url:t})=>{if(e.selection)if(Array.from(d.Editor.nodes(e,{at:e.selection,match:r=>!d.Editor.isEditor(r)&&"type"in r&&r.type==="link"})).forEach(([,r])=>{d.Transforms.unwrapNodes(e,{at:r})}),d.Range.isCollapsed(e.selection)){const r={type:"link",url:t??"",children:[{type:"text",text:t}]};d.Transforms.insertNodes(e,r)}else{const r={type:"link",url:t??"",children:[]};d.Transforms.wrapNodes(e,r,{split:!0})}},cu=(e,t)=>{const{url:n,text:r,target:s,rel:a}=t;if(!e.selection)return;const i=d.Editor.above(e,{match:l=>!d.Editor.isEditor(l)&&"type"in l&&l.type==="link"});if(i){const[,l]=i;d.Transforms.setNodes(e,{url:n,target:s??null,rel:a??null},{at:l}),r!==""&&r!==d.Editor.string(e,l)&&(Array.from(d.Node.children(e,l,{reverse:!0})).forEach(([,u])=>{d.Transforms.removeNodes(e,{at:u})}),d.Transforms.insertNodes(e,[{type:"text",text:r}],{at:l.concat(0)}))}},du=b.styled(p.Box)`
400
400
  text-decoration: none;
401
- `,iu=b.styled(p.Button)`
401
+ `,uu=b.styled(p.Button)`
402
402
  visibility: ${e=>e.$visible?"visible":"hidden"};
403
- `,lu=k.forwardRef(({link:e,children:t,attributes:n},r)=>{const{formatMessage:s}=O.useIntl(),{editor:a}=P("Link"),i=B.ReactEditor.findPath(a,e),[l,c]=k.useState(a.lastInsertedLinkPath?d.Path.equals(i,a.lastInsertedLinkPath):!1),u=e.children.map(v=>"text"in v?v.text:"").join(""),[h,f]=k.useState(u),[g,m]=k.useState(e.url),[w,x]=k.useState(e.target==="_blank"),y=k.useRef(null),$=a.lastInsertedLinkPath?!d.Path.equals(i,a.lastInsertedLinkPath):!0,[E,S]=k.useState(!1),R=v=>{S(!1),m(v.target.value);try{new URL(v.target.value?.startsWith("/")?`https://strapi.io${v.target.value}`:v.target.value)}catch{S(!0)}},C=v=>{if(v.stopPropagation(),a.selection&&d.Range.isCollapsed(a.selection)){const[,I]=d.Editor.parent(a,a.selection.focus?.path);d.Transforms.select(a,I)}su(a,{url:g,text:h,target:w?"_blank":void 0,rel:w?"noopener noreferrer":void 0}),c(!1),a.lastInsertedLinkPath=null,B.ReactEditor.focus(a)},M=()=>{e.url===""&&es(a),c(!1),B.ReactEditor.focus(a)};k.useEffect(()=>{l&&y.current?.focus()},[l]);const j=!h||!g||e.url&&e.url===g&&u&&u===h&&w===(e.target==="_blank");return o.jsxs(p.Popover.Root,{open:l,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(au,{...n,ref:r,tag:"a",href:e.url,target:e.target,rel:e.rel,onClick:()=>c(!0),color:"primary600",children:t})}),o.jsx(p.Popover.Content,{onPointerDownOutside:M,children:o.jsxs(p.Flex,{padding:4,direction:"column",gap:4,children:[o.jsx(p.Field.Root,{width:"368px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.popover.text",defaultMessage:"Text"})}),o.jsx(p.Field.Input,{name:"text",placeholder:s({id:"components.Blocks.popover.text.placeholder",defaultMessage:"Enter link text"}),value:h,onChange:v=>{f(v.target.value)}})]})}),o.jsx(p.Field.Root,{width:"368px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.popover.link",defaultMessage:"Link"})}),o.jsx(p.Field.Input,{ref:y,name:"url",placeholder:s({id:"components.Blocks.popover.link.placeholder",defaultMessage:"Paste link"}),value:g,onChange:R})]})}),o.jsx(p.Flex,{width:"368px",children:o.jsx(p.Checkbox,{checked:w,onCheckedChange:v=>x(v),children:s({id:"components.Blocks.popover.openInNewTab",defaultMessage:"Open in new tab"})})}),o.jsxs(p.Flex,{justifyContent:"space-between",width:"100%",children:[o.jsx(iu,{variant:"danger-light",onClick:()=>es(a),$visible:$,children:s({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,children:[o.jsx(p.Button,{variant:"tertiary",onClick:M,children:s({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{disabled:!!j||E,onClick:C,children:s({id:"global.save",defaultMessage:"Save"})})]})]})]})})]})}),cu=k.forwardRef((e,t)=>Aa(e.element)?o.jsx(lu,{...e,link:e.element,ref:t}):null),du={link:{renderElement:e=>o.jsx(cu,{element:e.element,attributes:e.attributes,children:e.children}),matchNode:e=>e.type==="link",isInBlocksSelector:!1}},Oa=b.css`
403
+ `,pu=k.forwardRef(({link:e,children:t,attributes:n},r)=>{const{formatMessage:s}=O.useIntl(),{editor:a}=P("Link"),i=R.ReactEditor.findPath(a,e),[l,c]=k.useState(a.lastInsertedLinkPath?d.Path.equals(i,a.lastInsertedLinkPath):!1),u=e.children.map(w=>"text"in w?w.text:"").join(""),[h,f]=k.useState(u),[g,m]=k.useState(e.url),[x,y]=k.useState(e.target==="_blank"),v=k.useRef(null),$=a.lastInsertedLinkPath?!d.Path.equals(i,a.lastInsertedLinkPath):!0,[E,C]=k.useState(!1),I=w=>{C(!1),m(w.target.value);try{new URL(w.target.value?.startsWith("/")?`https://strapi.io${w.target.value}`:w.target.value)}catch{C(!0)}},S=w=>{if(w.stopPropagation(),a.selection&&d.Range.isCollapsed(a.selection)){const[,B]=d.Editor.parent(a,a.selection.focus?.path);d.Transforms.select(a,B)}cu(a,{url:g,text:h,target:x?"_blank":void 0,rel:x?"noopener noreferrer":void 0}),c(!1),a.lastInsertedLinkPath=null,R.ReactEditor.focus(a)},T=()=>{e.url===""&&rs(a),c(!1),R.ReactEditor.focus(a)};k.useEffect(()=>{l&&v.current?.focus()},[l]);const j=!h||!g||e.url&&e.url===g&&u&&u===h&&x===(e.target==="_blank");return o.jsxs(p.Popover.Root,{open:l,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(du,{...n,ref:r,tag:"a",href:e.url,target:e.target,rel:e.rel,onClick:()=>c(!0),color:"primary600",children:t})}),o.jsx(p.Popover.Content,{onPointerDownOutside:T,children:o.jsxs(p.Flex,{padding:4,direction:"column",gap:4,children:[o.jsx(p.Field.Root,{width:"368px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.popover.text",defaultMessage:"Text"})}),o.jsx(p.Field.Input,{name:"text",placeholder:s({id:"components.Blocks.popover.text.placeholder",defaultMessage:"Enter link text"}),value:h,onChange:w=>{f(w.target.value)}})]})}),o.jsx(p.Field.Root,{width:"368px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.popover.link",defaultMessage:"Link"})}),o.jsx(p.Field.Input,{ref:v,name:"url",placeholder:s({id:"components.Blocks.popover.link.placeholder",defaultMessage:"Paste link"}),value:g,onChange:I})]})}),o.jsx(p.Flex,{width:"368px",children:o.jsx(p.Checkbox,{checked:x,onCheckedChange:w=>y(w),children:s({id:"components.Blocks.popover.openInNewTab",defaultMessage:"Open in new tab"})})}),o.jsxs(p.Flex,{justifyContent:"space-between",width:"100%",children:[o.jsx(uu,{variant:"danger-light",onClick:()=>rs(a),$visible:$,children:s({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,children:[o.jsx(p.Button,{variant:"tertiary",onClick:T,children:s({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{disabled:!!j||E,onClick:S,children:s({id:"global.save",defaultMessage:"Save"})})]})]})]})})]})}),hu=k.forwardRef((e,t)=>Na(e.element)?o.jsx(pu,{...e,link:e.element,ref:t}):null),fu={link:{renderElement:e=>o.jsx(hu,{element:e.element,attributes:e.attributes,children:e.children}),matchNode:e=>e.type==="link",isInBlocksSelector:!1}},Ha=b.css`
404
404
  display: flex;
405
405
  flex-direction: column;
406
406
  gap: ${({theme:e})=>e.spaces[2]};
@@ -417,13 +417,13 @@
417
417
  li {
418
418
  margin-inline-start: ${({theme:e})=>e.spaces[3]};
419
419
  }
420
- `,uu=b.styled.ol`
420
+ `,gu=b.styled.ol`
421
421
  list-style-type: ${e=>e.$listStyleType};
422
- ${Oa}
423
- `,pu=b.styled.ul`
422
+ ${Ha}
423
+ `,mu=b.styled.ul`
424
424
  list-style-type: ${e=>e.$listStyleType};
425
- ${Oa}
426
- `,hu=["decimal","lower-alpha","upper-roman"],fu=["disc","circle","square"],gr=({attributes:e,children:t,element:n})=>{if(!st(n))return null;const r=n,s=r.format==="ordered"?hu:fu,a=(r.indentLevel||0)%s.length,i=s[a];return r.format==="ordered"?o.jsx(uu,{$listStyleType:i,start:r.start,...e,children:t}):r.format==="todo"?o.jsx(gu,{...e,children:t}):o.jsx(pu,{$listStyleType:i,...e,children:t})},gu=b.styled.ul`
425
+ ${Ha}
426
+ `,bu=["decimal","lower-alpha","upper-roman"],yu=["disc","circle","square"],br=({attributes:e,children:t,element:n})=>{if(!st(n))return null;const r=n,s=r.format==="ordered"?bu:yu,a=(r.indentLevel||0)%s.length,i=s[a];return r.format==="ordered"?o.jsx(gu,{$listStyleType:i,start:r.start,...e,children:t}):r.format==="todo"?o.jsx(xu,{...e,children:t}):o.jsx(mu,{$listStyleType:i,...e,children:t})},xu=b.styled.ul`
427
427
  list-style-type: none;
428
428
  display: flex;
429
429
  flex-direction: column;
@@ -431,7 +431,7 @@
431
431
  margin-inline-start: ${({theme:e})=>e.spaces[0]};
432
432
  margin-inline-end: ${({theme:e})=>e.spaces[0]};
433
433
  padding-inline-start: ${({theme:e})=>e.spaces[2]};
434
- `,mu=b.styled.li`
434
+ `,vu=b.styled.li`
435
435
  display: flex;
436
436
  align-items: flex-start;
437
437
  gap: ${({theme:e})=>e.spaces[2]};
@@ -443,20 +443,20 @@
443
443
  text-decoration: ${({$checked:e})=>e?"line-through":"none"};
444
444
  opacity: ${({$checked:e})=>e?.6:1};
445
445
  }
446
- `,bu=b.styled.input.attrs({type:"checkbox"})`
446
+ `,wu=b.styled.input.attrs({type:"checkbox"})`
447
447
  margin-top: 4px;
448
448
  cursor: pointer;
449
449
  width: 16px;
450
450
  height: 16px;
451
451
  flex-shrink: 0;
452
- `,xu=({attributes:e,children:t,element:n})=>{const r=!!n.checked,s=B.useSlateStatic(),a=i=>{const l=B.ReactEditor.findPath(s,n);d.Transforms.setNodes(s,{checked:i.target.checked},{at:l})};return o.jsxs(mu,{...e,$checked:r,children:[o.jsx("span",{contentEditable:!1,children:o.jsx(bu,{checked:r,onChange:a})}),o.jsx("span",{children:t})]})},za=(e,t)=>{d.Transforms.removeNodes(e,{at:t}),t[0]===0&&(d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:t}),d.Transforms.select(e,t))},kt=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="text",mr=(e,t)=>{if(!e.selection)return;const[n,r]=d.Editor.parent(e,e.selection.anchor),[s,a]=d.Editor.parent(e,r),i=s.children.length===1&&kt(n.children[0])&&n.children[0].text==="",l=n.children.length===1&&kt(n.children[0])&&n.children[0].text==="",c=e.selection.focus.offset===0&&e.selection.focus.path.at(-2)===0;if(i)d.Editor.above(e,{at:a,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type==="list"})||(t.preventDefault(),za(e,a));else if(c)d.Transforms.liftNodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&u.type==="list-item"}),d.Transforms.setNodes(e,{type:"paragraph"});else if(l){const u=d.Editor.previous(e,{at:r}),h=d.Editor.next(e,{at:r});if(u&&h){t.preventDefault(),d.Transforms.removeNodes(e,{at:r});const[f]=u,[g]=h;!d.Editor.isEditor(f)&&!kt(f)&&st(f)&&!d.Editor.isEditor(g)&&!kt(g)&&st(g)&&f.type==="list"&&g.type==="list"&&f.format===g.format&&f.indentLevel===g.indentLevel&&d.Transforms.mergeNodes(e,{at:r})}}},br=e=>{const t=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list-item"});if(!t||!e.selection)return;const[n,r]=t,[s,a]=d.Editor.parent(e,r),i=!d.Editor.isEditor(s)&&"type"in s&&s.type==="list"&&s.format==="todo",l={type:"list-item"};i&&(l.checked=!1);const c=s.children.length===1&&kt(n.children[0])&&n.children[0].text==="",u=n.children.length===1&&kt(n.children[0])&&n.children[0].text==="",h=e.selection.focus.offset===0&&e.selection.focus.path.at(-1)===0;if(c)za(e,a);else if(h&&!u){const f=d.Editor.above(e,{at:e.selection.anchor});if(d.Transforms.insertNodes(e,{...l,children:[{type:"text",text:""}]}),f){const g=f[1],m=[...g.slice(0,-1),g[g.length-1]+1];d.Transforms.select(e,{anchor:{path:m.concat(0),offset:0},focus:{path:m.concat(0),offset:0}})}}else if(u){if(!d.Editor.isEditor(s)&&st(s)&&s?.indentLevel!==void 0&&s.indentLevel>0){const g=s.indentLevel-1;if(d.Editor.above(e,{match:w=>!d.Editor.isEditor(w)&&"type"in w&&w.type==="list"&&w.indentLevel===g})){const w=r.slice(0,-1);w.length>0&&(w[w.length-1]+=1),d.Transforms.moveNodes(e,{at:r,to:w});return}}d.Transforms.removeNodes(e,{at:r});const f=d.Path.next(a);d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:f}),d.Transforms.select(e,f)}else d.Editor.isEnd(e,e.selection.anchor,r)?d.Transforms.insertNodes(e,{...l,children:[{type:"text",text:""}]}):(d.Transforms.splitNodes(e),i&&d.Transforms.setNodes(e,{checked:!1},{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type==="list-item"}))},xr=(e,t)=>{const n={type:"list-item"};t==="todo"&&(n.checked=!1);const r=he(e,n);r&&d.Transforms.wrapNodes(e,{type:"list",format:t,children:[]},{at:r})},yu=e=>{const t=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&"type"in a&&a.type==="list-item"});if(!t||!e.selection)return;const[,n]=t,[r,s]=d.Editor.parent(e,n);if(!d.Editor.isEditor(r)&&st(r))if(d.Editor.above(e,{at:s,match:i=>!d.Editor.isEditor(i)&&"type"in i&&i.type==="list"})){const i=d.Path.next(s);d.Transforms.moveNodes(e,{at:n,to:i});try{const l=d.Editor.node(e,s);if(l){const[c]=l;!d.Editor.isEditor(c)&&"children"in c&&c.children.length===0&&d.Transforms.removeNodes(e,{at:s})}}catch{}}else d.Transforms.liftNodes(e,{at:n}),d.Transforms.setNodes(e,{type:"paragraph"},{at:[n[0]]})},yr=(e,t)=>{if(t.shiftKey){yu(e);return}const n=d.Editor.above(e,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&c.type==="list-item"});if(!n||!e.selection)return;const[r,s]=n,[a]=d.Editor.parent(e,s);if(r===a.children[0])return;const i=a.children.findIndex(c=>c===r),l=a.children[i-1];if(l.type==="list"){const c=B.ReactEditor.findPath(e,l),u=l.children.length;d.Transforms.moveNodes(e,{at:s,to:c.concat(u)});return}!d.Editor.isEditor(a)&&st(a)&&d.Transforms.wrapNodes(e,{type:"list",format:a.format,indentLevel:a.indentLevel+1,children:[]})},vu={"list-ordered":{renderElement:e=>o.jsx(gr,{...e}),label:{id:"components.Blocks.blocks.orderedList",defaultMessage:"Numbered list"},icon:D.NumberList,matchNode:e=>e.type==="list"&&e.format==="ordered",isInBlocksSelector:!0,handleConvert:e=>xr(e,"ordered"),handleEnterKey:br,handleBackspaceKey:mr,handleTab:yr,snippets:["1."]},"list-unordered":{renderElement:e=>o.jsx(gr,{...e}),label:{id:"components.Blocks.blocks.unorderedList",defaultMessage:"Bulleted list"},icon:D.BulletList,matchNode:e=>e.type==="list"&&e.format==="unordered",isInBlocksSelector:!0,handleConvert:e=>xr(e,"unordered"),handleEnterKey:br,handleBackspaceKey:mr,handleTab:yr,snippets:["-","*","+"]},"list-todo":{renderElement:e=>o.jsx(gr,{...e}),label:{id:"components.Blocks.blocks.todoList",defaultMessage:"To-do list"},icon:D.Check,matchNode:e=>e.type==="list"&&e.format==="todo",isInBlocksSelector:!0,handleConvert:e=>xr(e,"todo"),handleEnterKey:br,handleBackspaceKey:mr,handleTab:yr,snippets:["[]","[x]"]},"list-item":{renderElement:e=>typeof e.element.checked=="boolean"?o.jsx(xu,{...e}):o.jsx(p.Typography,{tag:"li",...e.attributes,children:e.children}),matchNode:e=>e.type==="list-item",isInBlocksSelector:!1,dragHandleTopMargin:"-2px"}},Qt={note:{icon:D.Information,family:"secondary",label:{id:"components.Blocks.callout.note",defaultMessage:"Note"}},tip:{icon:D.Lightbulb,family:"success",label:{id:"components.Blocks.callout.tip",defaultMessage:"Tip"}},important:{icon:D.Bell,family:"alternative",label:{id:"components.Blocks.callout.important",defaultMessage:"Important"}},warning:{icon:D.WarningCircle,family:"warning",label:{id:"components.Blocks.callout.warning",defaultMessage:"Warning"}},caution:{icon:D.CrossCircle,family:"danger",label:{id:"components.Blocks.callout.caution",defaultMessage:"Caution"}}},Ha=["note","tip","important","warning","caution"],$t=e=>`${e}600`,Ua=e=>`${e}100`,Wa=(e,t="note")=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[])),d.Transforms.wrapNodes(e,{type:"callout",variant:t,children:[]},{match:(n,r)=>!d.Editor.isEditor(n)&&d.Element.isElement(n)&&r.length===1&&n.type!=="callout",split:!0})},wu=e=>{const{selection:t}=e;if(!t||!d.Range.isCollapsed(t))return!1;const n=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&f.type==="callout"});if(!n)return!1;const[r,s]=n,a=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&!e.isInline(f),mode:"lowest"});if(!a)return!1;const[i,l]=a,c=l[l.length-1]===r.children.length-1,u=d.Editor.isEmpty(e,i),h=d.Editor.isEnd(e,t.anchor,l);return c&&u&&h?(d.Transforms.removeNodes(e,{at:l}),d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:d.Path.next(s),select:!0}),!0):!1},Ve=(e,t)=>e.colors[t]??t,ku=b.styled.aside`
452
+ `,ku=({attributes:e,children:t,element:n})=>{const r=!!n.checked,s=R.useSlateStatic(),a=i=>{const l=R.ReactEditor.findPath(s,n);d.Transforms.setNodes(s,{checked:i.target.checked},{at:l})};return o.jsxs(vu,{...e,$checked:r,children:[o.jsx("span",{contentEditable:!1,children:o.jsx(wu,{checked:r,onChange:a})}),o.jsx("span",{children:t})]})},Ua=(e,t)=>{d.Transforms.removeNodes(e,{at:t}),t[0]===0&&(d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:t}),d.Transforms.select(e,t))},kt=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="text",yr=(e,t)=>{if(!e.selection)return;const[n,r]=d.Editor.parent(e,e.selection.anchor),[s,a]=d.Editor.parent(e,r),i=s.children.length===1&&kt(n.children[0])&&n.children[0].text==="",l=n.children.length===1&&kt(n.children[0])&&n.children[0].text==="",c=e.selection.focus.offset===0&&e.selection.focus.path.at(-2)===0;if(i)d.Editor.above(e,{at:a,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type==="list"})||(t.preventDefault(),Ua(e,a));else if(c)d.Transforms.liftNodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&u.type==="list-item"}),d.Transforms.setNodes(e,{type:"paragraph"});else if(l){const u=d.Editor.previous(e,{at:r}),h=d.Editor.next(e,{at:r});if(u&&h){t.preventDefault(),d.Transforms.removeNodes(e,{at:r});const[f]=u,[g]=h;!d.Editor.isEditor(f)&&!kt(f)&&st(f)&&!d.Editor.isEditor(g)&&!kt(g)&&st(g)&&f.type==="list"&&g.type==="list"&&f.format===g.format&&f.indentLevel===g.indentLevel&&d.Transforms.mergeNodes(e,{at:r})}}},xr=e=>{const t=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list-item"});if(!t||!e.selection)return;const[n,r]=t,[s,a]=d.Editor.parent(e,r),i=!d.Editor.isEditor(s)&&"type"in s&&s.type==="list"&&s.format==="todo",l={type:"list-item"};i&&(l.checked=!1);const c=s.children.length===1&&kt(n.children[0])&&n.children[0].text==="",u=n.children.length===1&&kt(n.children[0])&&n.children[0].text==="",h=e.selection.focus.offset===0&&e.selection.focus.path.at(-1)===0;if(c)Ua(e,a);else if(h&&!u){const f=d.Editor.above(e,{at:e.selection.anchor});if(d.Transforms.insertNodes(e,{...l,children:[{type:"text",text:""}]}),f){const g=f[1],m=[...g.slice(0,-1),g[g.length-1]+1];d.Transforms.select(e,{anchor:{path:m.concat(0),offset:0},focus:{path:m.concat(0),offset:0}})}}else if(u){if(!d.Editor.isEditor(s)&&st(s)&&s?.indentLevel!==void 0&&s.indentLevel>0){const g=s.indentLevel-1;if(d.Editor.above(e,{match:x=>!d.Editor.isEditor(x)&&"type"in x&&x.type==="list"&&x.indentLevel===g})){const x=r.slice(0,-1);x.length>0&&(x[x.length-1]+=1),d.Transforms.moveNodes(e,{at:r,to:x});return}}d.Transforms.removeNodes(e,{at:r});const f=d.Path.next(a);d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:f}),d.Transforms.select(e,f)}else d.Editor.isEnd(e,e.selection.anchor,r)?d.Transforms.insertNodes(e,{...l,children:[{type:"text",text:""}]}):(d.Transforms.splitNodes(e),i&&d.Transforms.setNodes(e,{checked:!1},{match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type==="list-item"}))},vr=(e,t)=>{const n={type:"list-item"};t==="todo"&&(n.checked=!1);const r=he(e,n);r&&d.Transforms.wrapNodes(e,{type:"list",format:t,children:[]},{at:r})},ju=e=>{const t=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&"type"in a&&a.type==="list-item"});if(!t||!e.selection)return;const[,n]=t,[r,s]=d.Editor.parent(e,n);if(!d.Editor.isEditor(r)&&st(r))if(d.Editor.above(e,{at:s,match:i=>!d.Editor.isEditor(i)&&"type"in i&&i.type==="list"})){const i=d.Path.next(s);d.Transforms.moveNodes(e,{at:n,to:i});try{const l=d.Editor.node(e,s);if(l){const[c]=l;!d.Editor.isEditor(c)&&"children"in c&&c.children.length===0&&d.Transforms.removeNodes(e,{at:s})}}catch{}}else d.Transforms.liftNodes(e,{at:n}),d.Transforms.setNodes(e,{type:"paragraph"},{at:[n[0]]})},wr=(e,t)=>{if(t.shiftKey){ju(e);return}const n=d.Editor.above(e,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&c.type==="list-item"});if(!n||!e.selection)return;const[r,s]=n,[a]=d.Editor.parent(e,s);if(r===a.children[0])return;const i=a.children.findIndex(c=>c===r),l=a.children[i-1];if(l.type==="list"){const c=R.ReactEditor.findPath(e,l),u=l.children.length;d.Transforms.moveNodes(e,{at:s,to:c.concat(u)});return}!d.Editor.isEditor(a)&&st(a)&&d.Transforms.wrapNodes(e,{type:"list",format:a.format,indentLevel:a.indentLevel+1,children:[]})},$u={"list-ordered":{renderElement:e=>o.jsx(br,{...e}),label:{id:"components.Blocks.blocks.orderedList",defaultMessage:"Numbered list"},icon:D.NumberList,matchNode:e=>e.type==="list"&&e.format==="ordered",isInBlocksSelector:!0,handleConvert:e=>vr(e,"ordered"),handleEnterKey:xr,handleBackspaceKey:yr,handleTab:wr,snippets:["1."]},"list-unordered":{renderElement:e=>o.jsx(br,{...e}),label:{id:"components.Blocks.blocks.unorderedList",defaultMessage:"Bulleted list"},icon:D.BulletList,matchNode:e=>e.type==="list"&&e.format==="unordered",isInBlocksSelector:!0,handleConvert:e=>vr(e,"unordered"),handleEnterKey:xr,handleBackspaceKey:yr,handleTab:wr,snippets:["-","*","+"]},"list-todo":{renderElement:e=>o.jsx(br,{...e}),label:{id:"components.Blocks.blocks.todoList",defaultMessage:"To-do list"},icon:D.Check,matchNode:e=>e.type==="list"&&e.format==="todo",isInBlocksSelector:!0,handleConvert:e=>vr(e,"todo"),handleEnterKey:xr,handleBackspaceKey:yr,handleTab:wr,snippets:["[]","[x]"]},"list-item":{renderElement:e=>typeof e.element.checked=="boolean"?o.jsx(ku,{...e}):o.jsx(p.Typography,{tag:"li",...e.attributes,children:e.children}),matchNode:e=>e.type==="list-item",isInBlocksSelector:!1,dragHandleTopMargin:"-2px"}},en={note:{icon:D.Information,family:"secondary",label:{id:"components.Blocks.callout.note",defaultMessage:"Note"}},tip:{icon:D.Lightbulb,family:"success",label:{id:"components.Blocks.callout.tip",defaultMessage:"Tip"}},important:{icon:D.Bell,family:"alternative",label:{id:"components.Blocks.callout.important",defaultMessage:"Important"}},warning:{icon:D.WarningCircle,family:"warning",label:{id:"components.Blocks.callout.warning",defaultMessage:"Warning"}},caution:{icon:D.CrossCircle,family:"danger",label:{id:"components.Blocks.callout.caution",defaultMessage:"Caution"}}},Wa=["note","tip","important","warning","caution"],$t=e=>`${e}600`,Ka=e=>`${e}100`,Ga=(e,t="note")=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[])),d.Transforms.wrapNodes(e,{type:"callout",variant:t,children:[]},{match:(n,r)=>!d.Editor.isEditor(n)&&d.Element.isElement(n)&&r.length===1&&n.type!=="callout",split:!0})},Eu=e=>{const{selection:t}=e;if(!t||!d.Range.isCollapsed(t))return!1;const n=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&f.type==="callout"});if(!n)return!1;const[r,s]=n,a=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&!e.isInline(f),mode:"lowest"});if(!a)return!1;const[i,l]=a,c=l[l.length-1]===r.children.length-1,u=d.Editor.isEmpty(e,i),h=d.Editor.isEnd(e,t.anchor,l);return c&&u&&h?(d.Transforms.removeNodes(e,{at:l}),d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:d.Path.next(s),select:!0}),!0):!1},Ve=(e,t)=>e.colors[t]??t,Cu=b.styled.aside`
453
453
  margin: ${({theme:e})=>e.spaces[3]} 0;
454
454
  padding: ${({theme:e})=>e.spaces[3]} ${({theme:e})=>e.spaces[4]};
455
455
  border-radius: ${({theme:e})=>e.borderRadius};
456
456
  border-left: 4px solid
457
457
  ${({theme:e,$family:t})=>Ve(e,$t(t))};
458
- background: ${({theme:e,$family:t})=>Ve(e,Ua(t))};
459
- `,ju=b.styled.div`
458
+ background: ${({theme:e,$family:t})=>Ve(e,Ka(t))};
459
+ `,Su=b.styled.div`
460
460
  display: inline-flex;
461
461
  align-items: center;
462
462
  gap: ${({theme:e})=>e.spaces[2]};
@@ -473,14 +473,14 @@
473
473
  svg path {
474
474
  fill: ${({theme:e,$family:t})=>Ve(e,$t(t))};
475
475
  }
476
- `,$u=b.styled.div`
476
+ `,Tu=b.styled.div`
477
477
  & > *:first-child {
478
478
  margin-top: 0;
479
479
  }
480
480
  & > *:last-child {
481
481
  margin-bottom: 0;
482
482
  }
483
- `,Eu=b.styled.button`
483
+ `,Mu=b.styled.button`
484
484
  display: flex;
485
485
  align-items: center;
486
486
  gap: ${({theme:e})=>e.spaces[2]};
@@ -489,7 +489,7 @@
489
489
  border: 1px solid
490
490
  ${({theme:e,$family:t,$active:n})=>n?Ve(e,$t(t)):e.colors.neutral200};
491
491
  border-radius: ${({theme:e})=>e.borderRadius};
492
- background: ${({theme:e,$family:t,$active:n})=>n?Ve(e,Ua(t)):e.colors.neutral0};
492
+ background: ${({theme:e,$family:t,$active:n})=>n?Ve(e,Ka(t)):e.colors.neutral0};
493
493
  color: ${({theme:e})=>e.colors.neutral800};
494
494
  cursor: pointer;
495
495
  font-size: ${({theme:e})=>e.fontSizes[1]};
@@ -505,7 +505,7 @@
505
505
  &:hover {
506
506
  border-color: ${({theme:e,$family:t})=>Ve(e,$t(t))};
507
507
  }
508
- `,Cu=b.styled.input`
508
+ `,Bu=b.styled.input`
509
509
  width: 100%;
510
510
  padding: ${({theme:e})=>e.spaces[2]};
511
511
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -518,14 +518,14 @@
518
518
  outline: none;
519
519
  border-color: ${({theme:e})=>e.colors.primary600};
520
520
  }
521
- `,Su=({attributes:e,children:t,element:n})=>{const r=n,s=Qt[r.variant]?r.variant:"note",a=Qt[s],i=a.icon,{formatMessage:l}=O.useIntl(),{editor:c,disabled:u}=P("Callout"),[h,f]=k.useState(!1),[g,m]=k.useState(r.title??"");k.useEffect(()=>{m(r.title??"")},[r.title]);const w=()=>{try{return B.ReactEditor.findPath(c,r)}catch{return null}},x=S=>{const R=w();R&&d.Transforms.setNodes(c,{variant:S},{at:R})},y=()=>{const S=w();if(!S)return;const R=g.trim();R?d.Transforms.setNodes(c,{title:R},{at:S}):d.Transforms.unsetNodes(c,"title",{at:S})},$=()=>{const S=w();S&&(d.Transforms.unwrapNodes(c,{at:S,match:R=>!d.Editor.isEditor(R)&&d.Element.isElement(R)&&R.type==="callout",split:!0}),f(!1),B.ReactEditor.focus(c))},E=r.title?.trim()?r.title:l(a.label);return o.jsxs(ku,{...e,$family:a.family,role:"note",children:[o.jsx("div",{contentEditable:!1,children:o.jsxs(p.Popover.Root,{open:h&&!u,children:[o.jsx(p.Popover.Trigger,{children:o.jsxs(ju,{$family:a.family,onClick:()=>!u&&f(!0),children:[o.jsx(i,{}),o.jsx("span",{children:E})]})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>{y(),f(!1)},onEscapeKeyDown:()=>{y(),f(!1)},children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,width:"320px",alignItems:"stretch",children:[o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:l({id:"components.Blocks.callout.type",defaultMessage:"Type"})}),Ha.map(S=>{const R=Qt[S],C=R.icon;return o.jsxs(Eu,{type:"button",$family:R.family,$active:S===s,onClick:()=>x(S),children:[o.jsx(C,{}),l(R.label)]},S)})]}),o.jsx(p.Field.Root,{children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:l({id:"components.Blocks.callout.title",defaultMessage:"Custom title (optional)"})}),o.jsx(Cu,{value:g,placeholder:l(a.label),onChange:S=>m(S.target.value),onBlur:y,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),y(),f(!1))}})]})}),o.jsx(p.Flex,{justifyContent:"flex-end",children:o.jsx(p.Button,{variant:"danger-light",onClick:$,children:l({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})})})]})})]})}),o.jsx($u,{children:t})]})},Tu=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(d.Element.isElement(r)&&r.type==="callout"){if(r.children.length===0){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:[...s,0]});return}for(const[a,i]of d.Node.children(e,s)){if(d.Text.isText(a)||e.isInline(a)){d.Transforms.wrapNodes(e,{type:"paragraph",children:[]},{at:i});return}if(d.Element.isElement(a)&&a.type==="callout"){d.Transforms.unwrapNodes(e,{at:i});return}}}t(n)},e},Mu={callout:{renderElement:e=>o.jsx(Su,{...e}),icon:D.Information,label:{id:"components.Blocks.blocks.callout",defaultMessage:"Callout"},matchNode:e=>e.type==="callout",isInBlocksSelector:!0,handleConvert(e){Wa(e,"note")},handleEnterKey(e){wu(e)||e.insertBreak()}}},Ka="Click to expand",Iu=e=>{const n=e.pluginOptions?.detailsDefaultSummary;return typeof n=="string"&&n.trim()?n.trim():Ka},Ga=(e,t)=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[])),d.Transforms.wrapNodes(e,{type:"details",summary:Iu(e),defaultOpen:!0,children:[]},{match:(n,r)=>{if(d.Editor.isEditor(n)||!d.Element.isElement(n)||e.isInline(n)||n.type==="details")return!1;const a=d.Editor.parent(e,r)?.[0];return!!a&&(d.Editor.isEditor(a)||d.Element.isElement(a)&&a.type==="details")},split:!0})},Ru=e=>{const{selection:t}=e;if(!t||!d.Range.isCollapsed(t))return!1;const n=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&f.type==="details"});if(!n)return!1;const[r,s]=n,a=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&!e.isInline(f),mode:"lowest"});if(!a)return!1;const[i,l]=a,c=l[l.length-1]===r.children.length-1,u=d.Editor.isEmpty(e,i),h=d.Editor.isEnd(e,t.anchor,l);return c&&u&&h?(d.Transforms.removeNodes(e,{at:l}),d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:d.Path.next(s),select:!0}),!0):!1},Bu=b.styled.div`
521
+ `,Iu=({attributes:e,children:t,element:n})=>{const r=n,s=en[r.variant]?r.variant:"note",a=en[s],i=a.icon,{formatMessage:l}=O.useIntl(),{editor:c,disabled:u}=P("Callout"),[h,f]=k.useState(!1),[g,m]=k.useState(r.title??"");k.useEffect(()=>{m(r.title??"")},[r.title]);const x=()=>{try{return R.ReactEditor.findPath(c,r)}catch{return null}},y=C=>{const I=x();I&&d.Transforms.setNodes(c,{variant:C},{at:I})},v=()=>{const C=x();if(!C)return;const I=g.trim();I?d.Transforms.setNodes(c,{title:I},{at:C}):d.Transforms.unsetNodes(c,"title",{at:C})},$=()=>{const C=x();C&&(d.Transforms.unwrapNodes(c,{at:C,match:I=>!d.Editor.isEditor(I)&&d.Element.isElement(I)&&I.type==="callout",split:!0}),f(!1),R.ReactEditor.focus(c))},E=r.title?.trim()?r.title:l(a.label);return o.jsxs(Cu,{...e,$family:a.family,role:"note",children:[o.jsx("div",{contentEditable:!1,children:o.jsxs(p.Popover.Root,{open:h&&!u,children:[o.jsx(p.Popover.Trigger,{children:o.jsxs(Su,{$family:a.family,onClick:()=>!u&&f(!0),children:[o.jsx(i,{}),o.jsx("span",{children:E})]})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>{v(),f(!1)},onEscapeKeyDown:()=>{v(),f(!1)},children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,width:"320px",alignItems:"stretch",children:[o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:l({id:"components.Blocks.callout.type",defaultMessage:"Type"})}),Wa.map(C=>{const I=en[C],S=I.icon;return o.jsxs(Mu,{type:"button",$family:I.family,$active:C===s,onClick:()=>y(C),children:[o.jsx(S,{}),l(I.label)]},C)})]}),o.jsx(p.Field.Root,{children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:l({id:"components.Blocks.callout.title",defaultMessage:"Custom title (optional)"})}),o.jsx(Bu,{value:g,placeholder:l(a.label),onChange:C=>m(C.target.value),onBlur:v,onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),v(),f(!1))}})]})}),o.jsx(p.Flex,{justifyContent:"flex-end",children:o.jsx(p.Button,{variant:"danger-light",onClick:$,children:l({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})})})]})})]})}),o.jsx(Tu,{children:t})]})},Ru=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(d.Element.isElement(r)&&r.type==="callout"){if(r.children.length===0){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:[...s,0]});return}for(const[a,i]of d.Node.children(e,s)){if(d.Text.isText(a)||e.isInline(a)){d.Transforms.wrapNodes(e,{type:"paragraph",children:[]},{at:i});return}if(d.Element.isElement(a)&&a.type==="callout"){d.Transforms.unwrapNodes(e,{at:i});return}}}t(n)},e},Fu={callout:{renderElement:e=>o.jsx(Iu,{...e}),icon:D.Information,label:{id:"components.Blocks.blocks.callout",defaultMessage:"Callout"},matchNode:e=>e.type==="callout",isInBlocksSelector:!0,handleConvert(e){Ga(e,"note")},handleEnterKey(e){Eu(e)||e.insertBreak()}}},Va="Click to expand",Du=e=>{const n=e.pluginOptions?.detailsDefaultSummary;return typeof n=="string"&&n.trim()?n.trim():Va},qa=(e,t)=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[])),d.Transforms.wrapNodes(e,{type:"details",summary:Du(e),defaultOpen:!0,children:[]},{match:(n,r)=>{if(d.Editor.isEditor(n)||!d.Element.isElement(n)||e.isInline(n)||n.type==="details")return!1;const a=d.Editor.parent(e,r)?.[0];return!!a&&(d.Editor.isEditor(a)||d.Element.isElement(a)&&a.type==="details")},split:!0})},Au=e=>{const{selection:t}=e;if(!t||!d.Range.isCollapsed(t))return!1;const n=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&f.type==="details"});if(!n)return!1;const[r,s]=n,a=d.Editor.above(e,{match:f=>!d.Editor.isEditor(f)&&d.Element.isElement(f)&&!e.isInline(f),mode:"lowest"});if(!a)return!1;const[i,l]=a,c=l[l.length-1]===r.children.length-1,u=d.Editor.isEmpty(e,i),h=d.Editor.isEnd(e,t.anchor,l);return c&&u&&h?(d.Transforms.removeNodes(e,{at:l}),d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:d.Path.next(s),select:!0}),!0):!1},_u=b.styled.div`
522
522
  margin: ${({theme:e})=>e.spaces[3]} 0;
523
523
  ${({theme:e,$style:t})=>t==="custom"?`
524
524
  border: 1px solid ${e.colors.neutral200};
525
525
  border-radius: ${e.borderRadius};
526
526
  overflow: hidden;
527
527
  `:""}
528
- `,Fu=b.styled.div`
528
+ `,Nu=b.styled.div`
529
529
  display: flex;
530
530
  align-items: center;
531
531
  gap: ${({theme:e})=>e.spaces[1]};
@@ -541,7 +541,7 @@
541
541
  `:`
542
542
  padding: ${e.spaces[1]} 0;
543
543
  `}
544
- `,Du=b.styled.button`
544
+ `,Pu=b.styled.button`
545
545
  display: inline-flex;
546
546
  align-items: center;
547
547
  justify-content: center;
@@ -561,7 +561,7 @@
561
561
  svg path {
562
562
  fill: ${({theme:e})=>e.colors.neutral600};
563
563
  }
564
- `,Au=b.styled.span`
564
+ `,Lu=b.styled.span`
565
565
  flex: 1;
566
566
  text-align: left;
567
567
  border: none;
@@ -572,14 +572,14 @@
572
572
  font-weight: inherit;
573
573
  color: inherit;
574
574
  cursor: pointer;
575
- `,_u=b.styled.div`
575
+ `,Ou=b.styled.div`
576
576
  display: grid;
577
577
  grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
578
578
  transition: grid-template-rows 0.2s ease;
579
- `,Nu=b.styled.div`
579
+ `,zu=b.styled.div`
580
580
  overflow: hidden;
581
581
  min-height: 0;
582
- `,Pu=b.styled.div`
582
+ `,Hu=b.styled.div`
583
583
  padding: ${({theme:e,$style:t})=>t==="custom"?`${e.spaces[3]}`:`${e.spaces[2]} 0 ${e.spaces[2]} ${e.spaces[5]}`};
584
584
 
585
585
  & > *:first-child {
@@ -588,7 +588,7 @@
588
588
  & > *:last-child {
589
589
  margin-bottom: 0;
590
590
  }
591
- `,Lu=b.styled.input`
591
+ `,Uu=b.styled.input`
592
592
  width: 100%;
593
593
  padding: ${({theme:e})=>e.spaces[2]};
594
594
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -601,7 +601,7 @@
601
601
  outline: none;
602
602
  border-color: ${({theme:e})=>e.colors.primary600};
603
603
  }
604
- `,ts=b.styled.button`
604
+ `,os=b.styled.button`
605
605
  flex: 1;
606
606
  padding: ${({theme:e})=>e.spaces[2]};
607
607
  border: 1px solid
@@ -615,7 +615,7 @@
615
615
  &:hover {
616
616
  border-color: ${({theme:e})=>e.colors.primary600};
617
617
  }
618
- `,Ou=b.styled.button`
618
+ `,Wu=b.styled.button`
619
619
  position: relative;
620
620
  width: 40px;
621
621
  height: 22px;
@@ -626,7 +626,7 @@
626
626
  cursor: pointer;
627
627
  background: ${({theme:e,$on:t})=>t?e.colors.primary600:e.colors.neutral200};
628
628
  transition: background 0.15s ease;
629
- `,zu=b.styled.span`
629
+ `,Ku=b.styled.span`
630
630
  position: absolute;
631
631
  top: 2px;
632
632
  left: ${({$on:e})=>e?"20px":"2px"};
@@ -635,12 +635,12 @@
635
635
  border-radius: 50%;
636
636
  background: ${({theme:e})=>e.colors.neutral0};
637
637
  transition: left 0.15s ease;
638
- `,Hu=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i,pluginOptions:l}=P("Details"),c=l?.detailsStyle,u=r.style==="github"||r.style==="custom"?r.style:c==="custom"?"custom":"github",h=r.defaultOpen!==!1,[f,g]=k.useState(h);k.useEffect(()=>{g(h)},[h]);const[m,w]=k.useState(!1),[x,y]=k.useState(r.summary??"");k.useEffect(()=>{y(r.summary??"")},[r.summary]);const $=()=>{try{return B.ReactEditor.findPath(a,r)}catch{return null}},E=I=>{const A=$();A&&d.Transforms.setNodes(a,{defaultOpen:I},{at:A})},S=I=>{I.stopPropagation(),g(A=>!A)},R=I=>{const A=$();A&&d.Transforms.setNodes(a,{style:I},{at:A})},C=()=>{const I=$();if(!I)return;const A=x.trim()||M();d.Transforms.setNodes(a,{summary:A},{at:I}),y(A)},M=()=>{const I=l?.detailsDefaultSummary;return typeof I=="string"&&I.trim()?I.trim():Ka},j=()=>{const I=$();I&&(d.Transforms.unwrapNodes(a,{at:I,match:A=>!d.Editor.isEditor(A)&&d.Element.isElement(A)&&A.type==="details",split:!0}),w(!1),B.ReactEditor.focus(a))},v=r.summary?.trim()?r.summary:M();return o.jsxs(Bu,{...e,$style:u,children:[o.jsx("div",{contentEditable:!1,children:o.jsxs(Fu,{$style:u,$open:f,children:[o.jsx(Du,{type:"button",$open:f,"aria-expanded":f,"aria-label":s({id:"components.Blocks.details.toggle",defaultMessage:"Toggle section"}),onClick:S,children:o.jsx(D.CaretDown,{})}),o.jsxs(p.Popover.Root,{open:m&&!i,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Au,{as:"button",type:"button",onClick:()=>!i&&w(!0),children:v})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>{C(),w(!1)},onEscapeKeyDown:()=>{C(),w(!1)},children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,width:"320px",alignItems:"stretch",children:[o.jsx(p.Field.Root,{children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.details.summary",defaultMessage:"Summary text"})}),o.jsx(Lu,{value:x,placeholder:s({id:"components.Blocks.details.summary.placeholder",defaultMessage:"Enter summary text…"}),onChange:I=>y(I.target.value),onBlur:C,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),C(),w(!1))}})]})}),o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:s({id:"components.Blocks.details.style",defaultMessage:"Style"})}),o.jsxs(p.Flex,{gap:2,children:[o.jsx(ts,{type:"button",$active:u==="github",onClick:()=>R("github"),children:s({id:"components.Blocks.details.style.github",defaultMessage:"GitHub"})}),o.jsx(ts,{type:"button",$active:u==="custom",onClick:()=>R("custom"),children:s({id:"components.Blocks.details.style.custom",defaultMessage:"Custom"})})]})]}),o.jsxs(p.Flex,{justifyContent:"space-between",alignItems:"center",children:[o.jsx(p.Typography,{variant:"omega",children:s({id:"components.Blocks.details.openByDefault",defaultMessage:"Open by default"})}),o.jsx(Ou,{type:"button",role:"switch","aria-checked":h,$on:h,onClick:()=>E(!h),children:o.jsx(zu,{$on:h})})]}),o.jsx(p.Flex,{justifyContent:"flex-end",children:o.jsx(p.Button,{variant:"danger-light",onClick:j,children:s({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})})})]})})]})]})}),o.jsx(_u,{$open:f,children:o.jsx(Nu,{children:o.jsx(Pu,{$style:u,children:t})})})]})},Uu=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(d.Element.isElement(r)&&r.type==="details"){if(r.children.length===0){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:[...s,0]});return}for(const[a,i]of d.Node.children(e,s))if(d.Text.isText(a)||e.isInline(a)){d.Transforms.wrapNodes(e,{type:"paragraph",children:[]},{at:i});return}}t(n)},e},Wu={details:{renderElement:e=>o.jsx(Hu,{...e}),icon:D.CaretDown,label:{id:"components.Blocks.blocks.details",defaultMessage:"Details (collapsible)"},matchNode:e=>e.type==="details",isInBlocksSelector:!0,handleConvert(e){Ga(e)},handleEnterKey(e){Ru(e)||e.insertBreak()}}},Ku=b.styled(p.Modal.Content)`
638
+ `,Gu=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i,pluginOptions:l}=P("Details"),c=l?.detailsStyle,u=r.style==="github"||r.style==="custom"?r.style:c==="custom"?"custom":"github",h=r.defaultOpen!==!1,[f,g]=k.useState(h);k.useEffect(()=>{g(h)},[h]);const[m,x]=k.useState(!1),[y,v]=k.useState(r.summary??"");k.useEffect(()=>{v(r.summary??"")},[r.summary]);const $=()=>{try{return R.ReactEditor.findPath(a,r)}catch{return null}},E=B=>{const A=$();A&&d.Transforms.setNodes(a,{defaultOpen:B},{at:A})},C=B=>{B.stopPropagation(),g(A=>!A)},I=B=>{const A=$();A&&d.Transforms.setNodes(a,{style:B},{at:A})},S=()=>{const B=$();if(!B)return;const A=y.trim()||T();d.Transforms.setNodes(a,{summary:A},{at:B}),v(A)},T=()=>{const B=l?.detailsDefaultSummary;return typeof B=="string"&&B.trim()?B.trim():Va},j=()=>{const B=$();B&&(d.Transforms.unwrapNodes(a,{at:B,match:A=>!d.Editor.isEditor(A)&&d.Element.isElement(A)&&A.type==="details",split:!0}),x(!1),R.ReactEditor.focus(a))},w=r.summary?.trim()?r.summary:T();return o.jsxs(_u,{...e,$style:u,children:[o.jsx("div",{contentEditable:!1,children:o.jsxs(Nu,{$style:u,$open:f,children:[o.jsx(Pu,{type:"button",$open:f,"aria-expanded":f,"aria-label":s({id:"components.Blocks.details.toggle",defaultMessage:"Toggle section"}),onClick:C,children:o.jsx(D.CaretDown,{})}),o.jsxs(p.Popover.Root,{open:m&&!i,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Lu,{as:"button",type:"button",onClick:()=>!i&&x(!0),children:w})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>{S(),x(!1)},onEscapeKeyDown:()=>{S(),x(!1)},children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,width:"320px",alignItems:"stretch",children:[o.jsx(p.Field.Root,{children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:s({id:"components.Blocks.details.summary",defaultMessage:"Summary text"})}),o.jsx(Uu,{value:y,placeholder:s({id:"components.Blocks.details.summary.placeholder",defaultMessage:"Enter summary text…"}),onChange:B=>v(B.target.value),onBlur:S,onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),S(),x(!1))}})]})}),o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:s({id:"components.Blocks.details.style",defaultMessage:"Style"})}),o.jsxs(p.Flex,{gap:2,children:[o.jsx(os,{type:"button",$active:u==="github",onClick:()=>I("github"),children:s({id:"components.Blocks.details.style.github",defaultMessage:"GitHub"})}),o.jsx(os,{type:"button",$active:u==="custom",onClick:()=>I("custom"),children:s({id:"components.Blocks.details.style.custom",defaultMessage:"Custom"})})]})]}),o.jsxs(p.Flex,{justifyContent:"space-between",alignItems:"center",children:[o.jsx(p.Typography,{variant:"omega",children:s({id:"components.Blocks.details.openByDefault",defaultMessage:"Open by default"})}),o.jsx(Wu,{type:"button",role:"switch","aria-checked":h,$on:h,onClick:()=>E(!h),children:o.jsx(Ku,{$on:h})})]}),o.jsx(p.Flex,{justifyContent:"flex-end",children:o.jsx(p.Button,{variant:"danger-light",onClick:j,children:s({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})})})]})})]})]})}),o.jsx(Ou,{$open:f,children:o.jsx(zu,{children:o.jsx(Hu,{$style:u,children:t})})})]})},Vu=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(d.Element.isElement(r)&&r.type==="details"){if(r.children.length===0){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]},{at:[...s,0]});return}for(const[a,i]of d.Node.children(e,s))if(d.Text.isText(a)||e.isInline(a)){d.Transforms.wrapNodes(e,{type:"paragraph",children:[]},{at:i});return}}t(n)},e},qu={details:{renderElement:e=>o.jsx(Gu,{...e}),icon:D.CaretDown,label:{id:"components.Blocks.blocks.details",defaultMessage:"Details (collapsible)"},matchNode:e=>e.type==="details",isInBlocksSelector:!0,handleConvert(e){qa(e)},handleEnterKey(e){Au(e)||e.insertBreak()}}},Xu=b.styled(p.Modal.Content)`
639
639
  width: 95vw;
640
640
  height: 95vh;
641
641
  max-width: none;
642
642
  max-height: none;
643
- `,Gu=b.styled.div`
643
+ `,Yu=b.styled.div`
644
644
  display: flex;
645
645
  flex-direction: column;
646
646
  flex: 1;
@@ -649,9 +649,9 @@
649
649
  overflow: auto;
650
650
  padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
651
651
  ${({theme:e})=>e.spaces[6]};
652
- `,Vu=b.styled(p.Modal.Footer)`
652
+ `,Zu=b.styled(p.Modal.Footer)`
653
653
  flex: 0 0 auto;
654
- `,qu=b.styled.div`
654
+ `,Ju=b.styled.div`
655
655
  flex: 1;
656
656
  display: grid;
657
657
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
@@ -663,10 +663,10 @@
663
663
  grid-template-columns: minmax(0, 1fr);
664
664
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
665
665
  }
666
- `,ns=b.styled(p.Flex)`
666
+ `,ss=b.styled(p.Flex)`
667
667
  min-height: 0;
668
668
  min-width: 0;
669
- `,Xu=b.styled.textarea`
669
+ `,Qu=b.styled.textarea`
670
670
  flex: 1;
671
671
  width: 100%;
672
672
  min-height: 200px;
@@ -685,13 +685,13 @@
685
685
  outline: none;
686
686
  border-color: ${({theme:e})=>e.colors.primary600};
687
687
  }
688
- `,Yu=b.styled.div`
688
+ `,ep=b.styled.div`
689
689
  flex: 1;
690
690
  overflow: auto;
691
691
  border: 1px solid ${({theme:e})=>e.colors.neutral150};
692
692
  border-radius: ${({theme:e})=>e.borderRadius};
693
693
  background: ${({theme:e})=>e.colors.neutral100};
694
- `,Zu=b.styled.div`
694
+ `,tp=b.styled.div`
695
695
  zoom: ${({$scale:e})=>e};
696
696
  display: flex;
697
697
  /* The safe keyword keeps the start edge reachable (not clipped) when content
@@ -722,7 +722,7 @@
722
722
  .katex {
723
723
  font-size: 2.4rem;
724
724
  }
725
- `,Va=({open:e,title:t,label:n,placeholder:r,source:s,onSourceChange:a,renderPreview:i,onSave:l,onRemove:c,onClose:u})=>{const{formatMessage:h}=O.useIntl(),f=k.useRef(null),[g,m]=k.useState(1),w=.25,x=4,y=1.25,$=C=>Math.min(x,Math.max(w,C)),E=()=>m(C=>$(C*y)),S=()=>m(C=>$(C/y)),R=()=>m(1);return k.useEffect(()=>{if(e){m(1);const C=window.setTimeout(()=>f.current?.focus(),0);return()=>window.clearTimeout(C)}},[e]),o.jsx(p.Modal.Root,{open:e,onOpenChange:C=>{C||u()},children:o.jsxs(Ku,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:t})}),o.jsx(Gu,{children:o.jsxs(qu,{children:[o.jsxs(ns,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",tag:"label",children:n}),o.jsx(Xu,{ref:f,value:s,spellCheck:!1,placeholder:r,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())}})]}),o.jsxs(ns,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsxs(p.Flex,{justifyContent:"space-between",alignItems:"center",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:h({id:"components.Blocks.sourceEditor.preview",defaultMessage:"Preview"})}),s.trim()?o.jsxs(p.Flex,{gap:1,alignItems:"center",children:[o.jsx(p.IconButton,{variant:"ghost",onClick:S,disabled:g<=w,label:h({id:"components.Blocks.sourceEditor.zoomOut",defaultMessage:"Zoom out"}),children:o.jsx(D.Minus,{})}),o.jsxs(p.Typography,{variant:"pi",textColor:"neutral600",style:{minWidth:"4ch",textAlign:"center"},children:[Math.round(g*100),"%"]}),o.jsx(p.IconButton,{variant:"ghost",onClick:E,disabled:g>=x,label:h({id:"components.Blocks.sourceEditor.zoomIn",defaultMessage:"Zoom in"}),children:o.jsx(D.Plus,{})}),o.jsx(p.IconButton,{variant:"ghost",onClick:R,disabled:g===1,label:h({id:"components.Blocks.sourceEditor.zoomReset",defaultMessage:"Reset zoom"}),children:o.jsx(D.ArrowClockwise,{})})]}):null]}),o.jsx(Yu,{children:o.jsx(Zu,{$scale:g,children:s.trim()?i(s):o.jsx(p.Typography,{variant:"pi",textColor:"neutral400",children:"—"})})})]})]})}),o.jsxs(Vu,{children:[o.jsx(p.Button,{variant:"danger-light",onClick:c,children:h({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",onClick:u,children:h({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{onClick:l,children:h({id:"global.save",defaultMessage:"Save"})})]})]})]})})},qa=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:s,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...t,children:[o.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"2.5",y:"16.5",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"14.5",y:"16.5",width:"7",height:"5",rx:"1"}),o.jsx("path",{d:"M12 7.5v4"}),o.jsx("path",{d:"M6 16.5v-2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2"})]})};let rs=0;const Ju=e=>{if(!e)return!1;const t=e.trim().replace("#","");if(t.length!==3&&t.length!==6)return!1;const n=t.length===3?t.split("").map(i=>i+i).join(""):t,r=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return(.299*r+.587*s+.114*a)/255<.5},os=({value:e,isDark:t})=>{const{formatMessage:n}=O.useIntl(),[r,s]=k.useState(null),[a,i]=k.useState(!1);return k.useEffect(()=>{let l=!1;if(e.trim()===""){s(null),i(!1);return}return(async()=>{try{const c=(await import("mermaid")).default;c.initialize({startOnLoad:!1,theme:t?"dark":"default",securityLevel:"strict"}),await c.parse(e),rs+=1;const{svg:u}=await c.render(`bb-mermaid-${rs}`,e);l||(s(u),i(!1))}catch{l||(s(null),i(!0))}})(),()=>{l=!0}},[e,t]),a?o.jsx(p.Typography,{variant:"pi",textColor:"danger600",children:n({id:"components.Blocks.diagram.invalid",defaultMessage:"Invalid diagram"})}):r===null?o.jsx(p.Typography,{variant:"pi",textColor:"neutral400",children:"…"}):o.jsx("span",{dangerouslySetInnerHTML:{__html:r}})},uo=e=>{const t=he(e,{type:"diagram",format:"mermaid",value:"",children:[{type:"text",text:""}]});t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,{type:"diagram",format:"mermaid",value:"",children:[{type:"text",text:""}]},{at:t,select:!0}))},Qu=b.styled.div`
725
+ `,Xa=({open:e,title:t,label:n,placeholder:r,source:s,onSourceChange:a,renderPreview:i,onSave:l,onRemove:c,onClose:u})=>{const{formatMessage:h}=O.useIntl(),f=k.useRef(null),[g,m]=k.useState(1),x=.25,y=4,v=1.25,$=S=>Math.min(y,Math.max(x,S)),E=()=>m(S=>$(S*v)),C=()=>m(S=>$(S/v)),I=()=>m(1);return k.useEffect(()=>{if(e){m(1);const S=window.setTimeout(()=>f.current?.focus(),0);return()=>window.clearTimeout(S)}},[e]),o.jsx(p.Modal.Root,{open:e,onOpenChange:S=>{S||u()},children:o.jsxs(Xu,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:t})}),o.jsx(Yu,{children:o.jsxs(Ju,{children:[o.jsxs(ss,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",tag:"label",children:n}),o.jsx(Qu,{ref:f,value:s,spellCheck:!1,placeholder:r,onChange:S=>a(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.metaKey||S.ctrlKey)&&(S.preventDefault(),l())}})]}),o.jsxs(ss,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsxs(p.Flex,{justifyContent:"space-between",alignItems:"center",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:h({id:"components.Blocks.sourceEditor.preview",defaultMessage:"Preview"})}),s.trim()?o.jsxs(p.Flex,{gap:1,alignItems:"center",children:[o.jsx(p.IconButton,{variant:"ghost",onClick:C,disabled:g<=x,label:h({id:"components.Blocks.sourceEditor.zoomOut",defaultMessage:"Zoom out"}),children:o.jsx(D.Minus,{})}),o.jsxs(p.Typography,{variant:"pi",textColor:"neutral600",style:{minWidth:"4ch",textAlign:"center"},children:[Math.round(g*100),"%"]}),o.jsx(p.IconButton,{variant:"ghost",onClick:E,disabled:g>=y,label:h({id:"components.Blocks.sourceEditor.zoomIn",defaultMessage:"Zoom in"}),children:o.jsx(D.Plus,{})}),o.jsx(p.IconButton,{variant:"ghost",onClick:I,disabled:g===1,label:h({id:"components.Blocks.sourceEditor.zoomReset",defaultMessage:"Reset zoom"}),children:o.jsx(D.ArrowClockwise,{})})]}):null]}),o.jsx(ep,{children:o.jsx(tp,{$scale:g,children:s.trim()?i(s):o.jsx(p.Typography,{variant:"pi",textColor:"neutral400",children:"—"})})})]})]})}),o.jsxs(Zu,{children:[o.jsx(p.Button,{variant:"danger-light",onClick:c,children:h({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",onClick:u,children:h({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{onClick:l,children:h({id:"global.save",defaultMessage:"Save"})})]})]})]})})},Ya=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:s,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...t,children:[o.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"2.5",y:"16.5",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"14.5",y:"16.5",width:"7",height:"5",rx:"1"}),o.jsx("path",{d:"M12 7.5v4"}),o.jsx("path",{d:"M6 16.5v-2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2"})]})};let as=0;const np=e=>{if(!e)return!1;const t=e.trim().replace("#","");if(t.length!==3&&t.length!==6)return!1;const n=t.length===3?t.split("").map(i=>i+i).join(""):t,r=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return(.299*r+.587*s+.114*a)/255<.5},is=({value:e,isDark:t})=>{const{formatMessage:n}=O.useIntl(),[r,s]=k.useState(null),[a,i]=k.useState(!1);return k.useEffect(()=>{let l=!1;if(e.trim()===""){s(null),i(!1);return}return(async()=>{try{const c=(await import("mermaid")).default;c.initialize({startOnLoad:!1,theme:t?"dark":"default",securityLevel:"strict"}),await c.parse(e),as+=1;const{svg:u}=await c.render(`bb-mermaid-${as}`,e);l||(s(u),i(!1))}catch{l||(s(null),i(!0))}})(),()=>{l=!0}},[e,t]),a?o.jsx(p.Typography,{variant:"pi",textColor:"danger600",children:n({id:"components.Blocks.diagram.invalid",defaultMessage:"Invalid diagram"})}):r===null?o.jsx(p.Typography,{variant:"pi",textColor:"neutral400",children:"…"}):o.jsx("span",{dangerouslySetInnerHTML:{__html:r}})},ho=e=>{const t=he(e,{type:"diagram",format:"mermaid",value:"",children:[{type:"text",text:""}]});t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,{type:"diagram",format:"mermaid",value:"",children:[{type:"text",text:""}]},{at:t,select:!0}))},rp=b.styled.div`
726
726
  margin: ${({theme:e})=>e.spaces[2]} 0;
727
727
  padding: ${({theme:e})=>e.spaces[4]};
728
728
  text-align: center;
@@ -742,8 +742,8 @@
742
742
  &:hover {
743
743
  border-color: ${({theme:e})=>e.colors.primary600};
744
744
  }
745
- `,ep=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i}=P("Diagram"),l=b.useTheme(),c=Ju(l?.colors?.neutral0),[u,h]=k.useState(r.value.trim()===""&&!i),[f,g]=k.useState(r.value),m=()=>{try{return B.ReactEditor.findPath(a,r)}catch{return null}},w=()=>{const C=m();C&&(d.Transforms.setNodes(a,{type:"paragraph"},{at:C}),d.Transforms.unsetNodes(a,["value","format"],{at:C}))},x=()=>{const C=m();C&&d.Transforms.setNodes(a,{value:f},{at:C}),h(!1),B.ReactEditor.focus(a)},y=()=>{w(),h(!1),B.ReactEditor.focus(a)},$=()=>{r.value.trim()===""?w():g(r.value),h(!1)},E=r.value.trim()==="",S=E?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:s({id:"components.Blocks.diagram.placeholder",defaultMessage:"Add a Mermaid diagram"})}):o.jsx(os,{value:r.value,isDark:c}),R=o.jsx(Va,{open:u&&!i,title:s({id:"components.Blocks.diagram.modal.title",defaultMessage:"Edit Mermaid diagram"}),label:s({id:"components.Blocks.diagram.label",defaultMessage:"Mermaid"}),placeholder:`graph TD
746
- A[Start] --> B[End];`,source:f,onSourceChange:g,renderPreview:C=>o.jsx(os,{value:C,isDark:c}),onSave:x,onRemove:y,onClose:$});return o.jsxs("div",{...e,contentEditable:!1,children:[o.jsx(Qu,{$selected:u,$empty:E,onClick:()=>!i&&h(!0),children:S}),R,o.jsx("span",{style:{display:"none"},children:t})]})},tp=e=>{const{isVoid:t}=e;return e.isVoid=n=>td(n)?!0:t(n),e},np={diagram:{renderElement:e=>o.jsx(ep,{...e}),icon:qa,label:{id:"components.Blocks.blocks.diagram",defaultMessage:"Diagram"},matchNode:e=>e.type==="diagram",isInBlocksSelector:!0,handleConvert(e){uo(e)},snippets:["```mermaid"]}},po=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",width:16,height:16,fill:s,...t,children:o.jsx("text",{x:"16",y:"23",fontSize:"22",fontFamily:"KaTeX_Main, Cambria Math, Times New Roman, serif",fontWeight:"600",textAnchor:"middle",children:"Σ"})})},ss=({value:e,displayMode:t})=>{const n=k.useMemo(()=>{try{return ic.default.renderToString(e,{displayMode:t,throwOnError:!1,output:"htmlAndMathml",errorColor:"#d02b20"})}catch{return null}},[e,t]);return n===null?o.jsx("span",{style:{color:"#d02b20"},children:"Invalid formula"}):o.jsx("span",{dangerouslySetInnerHTML:{__html:n}})},Xa=(e,t="")=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[]));const n={type:"math",format:"inline",value:t,children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,n)},ho=e=>{const t=he(e,{type:"math",format:"block",value:"",children:[{type:"text",text:""}]});t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,{type:"math",format:"block",value:"",children:[{type:"text",text:""}]},{at:t,select:!0}))},rp=b.styled.div`
745
+ `,op=({attributes:e,children:t,element:n})=>{const r=n,{formatMessage:s}=O.useIntl(),{editor:a,disabled:i}=P("Diagram"),l=b.useTheme(),c=np(l?.colors?.neutral0),[u,h]=k.useState(r.value.trim()===""&&!i),[f,g]=k.useState(r.value),m=()=>{try{return R.ReactEditor.findPath(a,r)}catch{return null}},x=()=>{const S=m();S&&(d.Transforms.setNodes(a,{type:"paragraph"},{at:S}),d.Transforms.unsetNodes(a,["value","format"],{at:S}))},y=()=>{const S=m();S&&d.Transforms.setNodes(a,{value:f},{at:S}),h(!1),R.ReactEditor.focus(a)},v=()=>{x(),h(!1),R.ReactEditor.focus(a)},$=()=>{r.value.trim()===""?x():g(r.value),h(!1)},E=r.value.trim()==="",C=E?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:s({id:"components.Blocks.diagram.placeholder",defaultMessage:"Add a Mermaid diagram"})}):o.jsx(is,{value:r.value,isDark:c}),I=o.jsx(Xa,{open:u&&!i,title:s({id:"components.Blocks.diagram.modal.title",defaultMessage:"Edit Mermaid diagram"}),label:s({id:"components.Blocks.diagram.label",defaultMessage:"Mermaid"}),placeholder:`graph TD
746
+ A[Start] --> B[End];`,source:f,onSourceChange:g,renderPreview:S=>o.jsx(is,{value:S,isDark:c}),onSave:y,onRemove:v,onClose:$});return o.jsxs("div",{...e,contentEditable:!1,children:[o.jsx(rp,{$selected:u,$empty:E,onClick:()=>!i&&h(!0),children:C}),I,o.jsx("span",{style:{display:"none"},children:t})]})},sp=e=>{const{isVoid:t}=e;return e.isVoid=n=>sd(n)?!0:t(n),e},ap={diagram:{renderElement:e=>o.jsx(op,{...e}),icon:Ya,label:{id:"components.Blocks.blocks.diagram",defaultMessage:"Diagram"},matchNode:e=>e.type==="diagram",isInBlocksSelector:!0,handleConvert(e){ho(e)},snippets:["```mermaid"]}},fo=({fill:e="currentColor",...t})=>{const r=b.useTheme()?.colors,s=r&&e in r?r[e]:e;return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",width:16,height:16,fill:s,...t,children:o.jsx("text",{x:"16",y:"23",fontSize:"22",fontFamily:"KaTeX_Main, Cambria Math, Times New Roman, serif",fontWeight:"600",textAnchor:"middle",children:"Σ"})})},ls=({value:e,displayMode:t})=>{const n=k.useMemo(()=>{try{return uc.default.renderToString(e,{displayMode:t,throwOnError:!1,output:"htmlAndMathml",errorColor:"#d02b20"})}catch{return null}},[e,t]);return n===null?o.jsx("span",{style:{color:"#d02b20"},children:"Invalid formula"}):o.jsx("span",{dangerouslySetInnerHTML:{__html:n}})},Za=(e,t="")=>{e.selection||d.Transforms.select(e,d.Editor.end(e,[]));const n={type:"math",format:"inline",value:t,children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,n)},go=e=>{const t=he(e,{type:"math",format:"block",value:"",children:[{type:"text",text:""}]});t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,{type:"math",format:"block",value:"",children:[{type:"text",text:""}]},{at:t,select:!0}))},ip=b.styled.div`
747
747
  margin: ${({theme:e})=>e.spaces[2]} 0;
748
748
  padding: ${({theme:e})=>e.spaces[4]};
749
749
  text-align: center;
@@ -758,7 +758,7 @@
758
758
  &:hover {
759
759
  border-color: ${({theme:e})=>e.colors.primary600};
760
760
  }
761
- `,op=b.styled.span`
761
+ `,lp=b.styled.span`
762
762
  display: inline-block;
763
763
  vertical-align: middle;
764
764
  padding: 0 ${({theme:e})=>e.spaces[1]};
@@ -771,10 +771,10 @@
771
771
  &:hover {
772
772
  background: ${({theme:e})=>e.colors.primary100};
773
773
  }
774
- `,sp=({attributes:e,children:t,element:n})=>{const r=n,s=r.format==="block",{formatMessage:a}=O.useIntl(),{editor:i,disabled:l}=P("Math"),[c,u]=k.useState(r.value.trim()===""&&!l),[h,f]=k.useState(r.value),g=()=>{try{return B.ReactEditor.findPath(i,r)}catch{return null}},m=()=>{const R=g();R&&(s?(d.Transforms.setNodes(i,{type:"paragraph"},{at:R}),d.Transforms.unsetNodes(i,["value","format"],{at:R})):d.Transforms.removeNodes(i,{at:R}))},w=()=>{const R=g();R&&d.Transforms.setNodes(i,{value:h},{at:R}),u(!1),B.ReactEditor.focus(i)},x=()=>{m(),u(!1),B.ReactEditor.focus(i)},y=()=>{r.value.trim()===""?m():f(r.value),u(!1)},$=r.value.trim()==="",E=$?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a(s?{id:"components.Blocks.math.block.placeholder",defaultMessage:"Add a math formula"}:{id:"components.Blocks.math.inline.placeholder",defaultMessage:"ƒ(x)"})}):o.jsx(ss,{value:r.value,displayMode:s}),S=o.jsx(Va,{open:c&&!l,title:a({id:"components.Blocks.math.modal.title",defaultMessage:"Edit LaTeX"}),label:a({id:"components.Blocks.math.label",defaultMessage:"LaTeX"}),placeholder:s?"\\int_0^\\infty e^{-x^2}\\,dx":"E = mc^2",source:h,onSourceChange:f,renderPreview:R=>o.jsx(ss,{value:R,displayMode:s}),onSave:w,onRemove:x,onClose:y});return s?o.jsxs("div",{...e,contentEditable:!1,children:[o.jsx(rp,{$selected:c,$empty:$,onClick:()=>!l&&u(!0),children:E}),S,o.jsx("span",{style:{display:"none"},children:t})]}):o.jsxs("span",{...e,contentEditable:!1,children:[o.jsx(op,{$selected:c,$empty:$,onClick:()=>!l&&u(!0),children:E}),S,o.jsx("span",{style:{display:"none"},children:t})]})},ap=e=>{const{isVoid:t,isInline:n}=e;return e.isVoid=r=>Xo(r)?!0:t(r),e.isInline=r=>Xo(r)&&r.format==="inline"?!0:n(r),e},ip={math:{renderElement:e=>o.jsx(sp,{...e}),icon:po,label:{id:"components.Blocks.blocks.math",defaultMessage:"Math"},matchNode:e=>e.type==="math",isInBlocksSelector:!0,handleConvert(e){ho(e)},snippets:["$$"]}},fo=[{provider:"youtube",label:"YouTube",patterns:[/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i],toEmbedSrc:e=>`https://www.youtube.com/embed/${e}`,toThumbnail:e=>`https://img.youtube.com/vi/${e}/hqdefault.jpg`,frameHost:"https://www.youtube.com"},{provider:"vimeo",label:"Vimeo",patterns:[/vimeo\.com\/video\/(\d+)/i,/player\.vimeo\.com\/video\/(\d+)/i,/vimeo\.com\/(\d+)/i],toEmbedSrc:e=>`https://player.vimeo.com/video/${e}`,frameHost:"https://player.vimeo.com"},{provider:"loom",label:"Loom",patterns:[/loom\.com\/(?:share|embed)\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://www.loom.com/embed/${e}`,frameHost:"https://www.loom.com"},{provider:"wistia",label:"Wistia",patterns:[/wistia\.com\/(?:medias|embed\/iframe)\/([a-zA-Z0-9]+)/i,/wi\.st\/medias\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://fast.wistia.net/embed/iframe/${e}`,frameHost:"https://fast.wistia.net"},{provider:"dailymotion",label:"Dailymotion",patterns:[/dailymotion\.com\/video\/([a-zA-Z0-9]+)/i,/dai\.ly\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://www.dailymotion.com/embed/video/${e}`,frameHost:"https://www.dailymotion.com"},{provider:"api-video",label:"api.video",patterns:[/embed\.api\.video\/vod\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://embed.api.video/vod/${e}`,frameHost:"https://embed.api.video"}];fo.map(e=>e.frameHost);const Xn=e=>{const t=e.trim();for(const n of fo)for(const r of n.patterns){const s=t.match(r);if(s)return{spec:n,id:s[1]}}return null},Ya=e=>fo.find(t=>t.provider===e)?.label??"Embed",Za=e=>{const t=Xn(e);return t?t.spec.provider:"generic"},lp=e=>{const t=Xn(e);return t?t.spec.toEmbedSrc(t.id):null},Pr=e=>{const t=Xn(e);return t?.spec.toThumbnail?t.spec.toThumbnail(t.id):null},cp=e=>Xn(e)!==null,dp=["src","width","height","title","allow","allowfullscreen","loading","referrerpolicy","frameborder","scrolling","sandbox"],up=["accelerometer","autoplay","clipboard-write","encrypted-media","fullscreen","gyroscope","picture-in-picture","web-share"],pp=e=>e.split(";").map(t=>t.trim().split(/\s+/)[0].toLowerCase()).filter(t=>up.includes(t)).join("; "),hp=e=>{const n=new DOMParser().parseFromString(e,"text/html").querySelector("iframe");if(!n)return{error:"no-iframe"};const r=n.getAttribute("src")?.trim();if(!r)return{error:"no-src"};const s=r.startsWith("//")?`https:${r}`:r;let a;try{a=new URL(s)}catch{return{error:"insecure-src"}}if(a.protocol!=="https:")return{error:"insecure-src"};const i=[`src="${a.toString()}"`];for(const l of dp){if(l==="src")continue;const c=n.getAttribute(l);if(c===null)continue;if(l==="allowfullscreen"){i.push("allowfullscreen");continue}const u=l==="allow"?pp(c):c.trim();!u||/["<>]/.test(u)||i.push(`${l}="${u}"`)}return{html:`<iframe ${i.join(" ")}></iframe>`,src:a.toString(),width:n.getAttribute("width")?.trim()||void 0,height:n.getAttribute("height")?.trim()||void 0}},as=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Ja=(e,t)=>{const n=lp(e);return n?{html:`<iframe ${[`src="${as(n)}"`,t?`title="${as(t)}"`:null,'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"',"allowfullscreen",'loading="lazy"','referrerpolicy="strict-origin-when-cross-origin"'].filter(Boolean).join(" ")}></iframe>`,src:n}:null},Lr=["16:9","21:9","4:3","1:1"],Yn=e=>{if(!e)return"16 / 9";const[t,n]=e.split(":");return n?`${t.trim()} / ${n.trim()}`:e},fp=(e,t)=>{const n=Number(e),r=Number(t);if(!n||!r)return null;const s=n/r,i=[["16:9",16/9],["21:9",21/9],["4:3",4/3],["1:1",1]].find(([,l])=>Math.abs(s-l)<.05);return i?i[0]:null},gp=b.styled(p.Modal.Content)`
774
+ `,cp=({attributes:e,children:t,element:n})=>{const r=n,s=r.format==="block",{formatMessage:a}=O.useIntl(),{editor:i,disabled:l}=P("Math"),[c,u]=k.useState(r.value.trim()===""&&!l),[h,f]=k.useState(r.value),g=()=>{try{return R.ReactEditor.findPath(i,r)}catch{return null}},m=()=>{const I=g();I&&(s?(d.Transforms.setNodes(i,{type:"paragraph"},{at:I}),d.Transforms.unsetNodes(i,["value","format"],{at:I})):d.Transforms.removeNodes(i,{at:I}))},x=()=>{const I=g();I&&d.Transforms.setNodes(i,{value:h},{at:I}),u(!1),R.ReactEditor.focus(i)},y=()=>{m(),u(!1),R.ReactEditor.focus(i)},v=()=>{r.value.trim()===""?m():f(r.value),u(!1)},$=r.value.trim()==="",E=$?o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a(s?{id:"components.Blocks.math.block.placeholder",defaultMessage:"Add a math formula"}:{id:"components.Blocks.math.inline.placeholder",defaultMessage:"ƒ(x)"})}):o.jsx(ls,{value:r.value,displayMode:s}),C=o.jsx(Xa,{open:c&&!l,title:a({id:"components.Blocks.math.modal.title",defaultMessage:"Edit LaTeX"}),label:a({id:"components.Blocks.math.label",defaultMessage:"LaTeX"}),placeholder:s?"\\int_0^\\infty e^{-x^2}\\,dx":"E = mc^2",source:h,onSourceChange:f,renderPreview:I=>o.jsx(ls,{value:I,displayMode:s}),onSave:x,onRemove:y,onClose:v});return s?o.jsxs("div",{...e,contentEditable:!1,children:[o.jsx(ip,{$selected:c,$empty:$,onClick:()=>!l&&u(!0),children:E}),C,o.jsx("span",{style:{display:"none"},children:t})]}):o.jsxs("span",{...e,contentEditable:!1,children:[o.jsx(lp,{$selected:c,$empty:$,onClick:()=>!l&&u(!0),children:E}),C,o.jsx("span",{style:{display:"none"},children:t})]})},dp=e=>{const{isVoid:t,isInline:n}=e;return e.isVoid=r=>Jo(r)?!0:t(r),e.isInline=r=>Jo(r)&&r.format==="inline"?!0:n(r),e},up={math:{renderElement:e=>o.jsx(cp,{...e}),icon:fo,label:{id:"components.Blocks.blocks.math",defaultMessage:"Math"},matchNode:e=>e.type==="math",isInBlocksSelector:!0,handleConvert(e){go(e)},snippets:["$$"]}},mo=[{provider:"youtube",label:"YouTube",patterns:[/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i],toEmbedSrc:e=>`https://www.youtube.com/embed/${e}`,toThumbnail:e=>`https://img.youtube.com/vi/${e}/hqdefault.jpg`,frameHost:"https://www.youtube.com"},{provider:"vimeo",label:"Vimeo",patterns:[/vimeo\.com\/video\/(\d+)/i,/player\.vimeo\.com\/video\/(\d+)/i,/vimeo\.com\/(\d+)/i],toEmbedSrc:e=>`https://player.vimeo.com/video/${e}`,frameHost:"https://player.vimeo.com"},{provider:"loom",label:"Loom",patterns:[/loom\.com\/(?:share|embed)\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://www.loom.com/embed/${e}`,frameHost:"https://www.loom.com"},{provider:"wistia",label:"Wistia",patterns:[/wistia\.com\/(?:medias|embed\/iframe)\/([a-zA-Z0-9]+)/i,/wi\.st\/medias\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://fast.wistia.net/embed/iframe/${e}`,frameHost:"https://fast.wistia.net"},{provider:"dailymotion",label:"Dailymotion",patterns:[/dailymotion\.com\/video\/([a-zA-Z0-9]+)/i,/dai\.ly\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://www.dailymotion.com/embed/video/${e}`,frameHost:"https://www.dailymotion.com"},{provider:"api-video",label:"api.video",patterns:[/embed\.api\.video\/vod\/([a-zA-Z0-9]+)/i],toEmbedSrc:e=>`https://embed.api.video/vod/${e}`,frameHost:"https://embed.api.video"}];mo.map(e=>e.frameHost);const Zn=e=>{const t=e.trim();for(const n of mo)for(const r of n.patterns){const s=t.match(r);if(s)return{spec:n,id:s[1]}}return null},Ja=e=>mo.find(t=>t.provider===e)?.label??"Embed",Qa=e=>{const t=Zn(e);return t?t.spec.provider:"generic"},pp=e=>{const t=Zn(e);return t?t.spec.toEmbedSrc(t.id):null},Or=e=>{const t=Zn(e);return t?.spec.toThumbnail?t.spec.toThumbnail(t.id):null},hp=e=>Zn(e)!==null,fp=["src","width","height","title","allow","allowfullscreen","loading","referrerpolicy","frameborder","scrolling","sandbox"],gp=["accelerometer","autoplay","clipboard-write","encrypted-media","fullscreen","gyroscope","picture-in-picture","web-share"],mp=e=>e.split(";").map(t=>t.trim().split(/\s+/)[0].toLowerCase()).filter(t=>gp.includes(t)).join("; "),bp=e=>{const n=new DOMParser().parseFromString(e,"text/html").querySelector("iframe");if(!n)return{error:"no-iframe"};const r=n.getAttribute("src")?.trim();if(!r)return{error:"no-src"};const s=r.startsWith("//")?`https:${r}`:r;let a;try{a=new URL(s)}catch{return{error:"insecure-src"}}if(a.protocol!=="https:")return{error:"insecure-src"};const i=[`src="${a.toString()}"`];for(const l of fp){if(l==="src")continue;const c=n.getAttribute(l);if(c===null)continue;if(l==="allowfullscreen"){i.push("allowfullscreen");continue}const u=l==="allow"?mp(c):c.trim();!u||/["<>]/.test(u)||i.push(`${l}="${u}"`)}return{html:`<iframe ${i.join(" ")}></iframe>`,src:a.toString(),width:n.getAttribute("width")?.trim()||void 0,height:n.getAttribute("height")?.trim()||void 0}},cs=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),ei=(e,t)=>{const n=pp(e);return n?{html:`<iframe ${[`src="${cs(n)}"`,t?`title="${cs(t)}"`:null,'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"',"allowfullscreen",'loading="lazy"','referrerpolicy="strict-origin-when-cross-origin"'].filter(Boolean).join(" ")}></iframe>`,src:n}:null},zr=["16:9","21:9","4:3","1:1"],Jn=e=>{if(!e)return"16 / 9";const[t,n]=e.split(":");return n?`${t.trim()} / ${n.trim()}`:e},yp=(e,t)=>{const n=Number(e),r=Number(t);if(!n||!r)return null;const s=n/r,i=[["16:9",16/9],["21:9",21/9],["4:3",4/3],["1:1",1]].find(([,l])=>Math.abs(s-l)<.05);return i?i[0]:null},xp=b.styled(p.Modal.Content)`
775
775
  max-width: 720px;
776
776
  width: 92vw;
777
- `,mp=b.styled.div`
777
+ `,vp=b.styled.div`
778
778
  display: flex;
779
779
  flex-direction: column;
780
780
  gap: ${({theme:e})=>e.spaces[4]};
@@ -782,7 +782,7 @@
782
782
  ${({theme:e})=>e.spaces[6]};
783
783
  max-height: 70vh;
784
784
  overflow: auto;
785
- `,$n=b.styled.input`
785
+ `,En=b.styled.input`
786
786
  width: 100%;
787
787
  box-sizing: border-box;
788
788
  min-height: 40px;
@@ -792,7 +792,7 @@
792
792
  font-size: 14px;
793
793
  color: ${({theme:e})=>e.colors.neutral800};
794
794
  background: ${({theme:e})=>e.colors.neutral0};
795
- `,bp=b.styled.textarea`
795
+ `,wp=b.styled.textarea`
796
796
  width: 100%;
797
797
  box-sizing: border-box;
798
798
  min-height: 120px;
@@ -805,7 +805,7 @@
805
805
  resize: vertical;
806
806
  color: ${({theme:e})=>e.colors.neutral800};
807
807
  background: ${({theme:e})=>e.colors.neutral0};
808
- `,xp=b.styled.select`
808
+ `,kp=b.styled.select`
809
809
  min-height: 40px;
810
810
  padding: 0 ${({theme:e})=>e.spaces[3]};
811
811
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -813,13 +813,13 @@
813
813
  font-size: 14px;
814
814
  color: ${({theme:e})=>e.colors.neutral800};
815
815
  background: ${({theme:e})=>e.colors.neutral0};
816
- `,yp=b.styled.div`
816
+ `,jp=b.styled.div`
817
817
  display: inline-flex;
818
818
  align-self: flex-start;
819
819
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
820
820
  border-radius: ${({theme:e})=>e.borderRadius};
821
821
  overflow: hidden;
822
- `,vp=b.styled.button`
822
+ `,$p=b.styled.button`
823
823
  min-width: 84px;
824
824
  min-height: 34px;
825
825
  padding: 0 ${({theme:e})=>e.spaces[3]};
@@ -846,11 +846,11 @@
846
846
  outline: 2px solid ${({theme:e})=>e.colors.primary600};
847
847
  outline-offset: -2px;
848
848
  }
849
- `,wp=b.styled.div`
849
+ `,Ep=b.styled.div`
850
850
  display: flex;
851
851
  gap: ${({theme:e})=>e.spaces[4]};
852
852
  border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
853
- `,is=b.styled.button`
853
+ `,ds=b.styled.button`
854
854
  padding: ${({theme:e})=>e.spaces[2]} 0;
855
855
  border: none;
856
856
  border-bottom: 2px solid
@@ -860,7 +860,7 @@
860
860
  font-size: 14px;
861
861
  font-weight: ${({$active:e})=>e?600:400};
862
862
  color: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral600};
863
- `,kp=b.styled.div`
863
+ `,Cp=b.styled.div`
864
864
  width: 100%;
865
865
  aspect-ratio: ${({$ratio:e})=>e};
866
866
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -873,15 +873,15 @@
873
873
  border: 0;
874
874
  display: block;
875
875
  }
876
- `,vr=b.styled(p.Typography)`
876
+ `,kr=b.styled(p.Typography)`
877
877
  color: ${({theme:e})=>e.colors.neutral500};
878
- `,jp=b.styled(p.Typography)`
878
+ `,Sp=b.styled(p.Typography)`
879
879
  color: ${({theme:e})=>e.colors.danger600};
880
- `,Je=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),$p=["left","center","right","none"],Ep=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),[i,l]=k.useState({source:t.source??"url",url:t.url,iframe:t.iframe,aspectRatio:t.aspectRatio??"16:9",customAspectRatio:t.customAspectRatio,alignment:t.alignment??"center",caption:t.caption,title:t.title}),c=x=>l(y=>({...y,...x})),u=k.useMemo(()=>{if(i.source==="url"){const $=(i.url??"").trim();if(!$)return{error:null};const E=Ja($,i.title);if(!E)return{error:a({id:"components.Blocks.embed.error.unknownUrl",defaultMessage:"That URL isn't a provider we can embed automatically. Switch to the Embed code tab and paste the platform's iframe instead."})};const S=Za($);return{error:null,embedHtml:E.html,embedSrc:E.src,provider:S,thumbnail:Pr($)??void 0}}const x=(i.iframe??"").trim();if(!x)return{error:null};const y=hp(x);return y.error?{error:{"no-iframe":a({id:"components.Blocks.embed.error.noIframe",defaultMessage:"No <iframe> found in that snippet. Paste the full embed code from the platform."}),"no-src":a({id:"components.Blocks.embed.error.noSrc",defaultMessage:"That iframe has no src attribute."}),"insecure-src":a({id:"components.Blocks.embed.error.insecureSrc",defaultMessage:"Only https:// embeds are allowed. Scripts and other embed types are stripped for security."})}[y.error]}:{error:null,embedHtml:y.html,embedSrc:y.src,provider:"generic",width:y.width,height:y.height}},[i.source,i.url,i.iframe,i.title,a]),h=k.useMemo(()=>fp(u.width,u.height),[u.width,u.height]),f=k.useRef(null);k.useEffect(()=>{if(!h)return;const x=`${u.embedSrc}:${h}`;f.current!==x&&(f.current=x,l(y=>({...y,aspectRatio:h})))},[h,u.embedSrc]);const g=i.aspectRatio==="custom"?i.customAspectRatio||"16 / 9":Yn(i.aspectRatio),m=!!u.embedHtml,w=()=>{u.embedHtml&&n({...i,url:i.source==="url"?i.url?.trim():void 0,iframe:i.source==="iframe"?i.iframe?.trim():void 0,embedHtml:u.embedHtml,embedSrc:u.embedSrc,provider:u.provider,thumbnail:u.thumbnail})};return o.jsx(p.Modal.Root,{open:e,onOpenChange:x=>{x||s()},children:o.jsxs(gp,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.embed.modal.title",defaultMessage:"Embed"})})}),o.jsxs(mp,{children:[o.jsxs(wp,{children:[o.jsx(is,{type:"button",$active:i.source==="url",onClick:()=>c({source:"url"}),children:a({id:"components.Blocks.embed.tab.url",defaultMessage:"URL"})}),o.jsx(is,{type:"button",$active:i.source==="iframe",onClick:()=>c({source:"iframe"}),children:a({id:"components.Blocks.embed.tab.code",defaultMessage:"Embed code"})})]}),i.source==="url"?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.url",defaultMessage:"Video or page URL"})}),o.jsx($n,{type:"url",autoFocus:!0,placeholder:"https://www.youtube.com/watch?v=…",value:i.url??"",onChange:x=>c({url:x.target.value})}),o.jsx(vr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.url",defaultMessage:"YouTube, Vimeo, Loom, Wistia, Dailymotion and api.video are converted automatically. For anything else, use the Embed code tab."})})]}):o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.code",defaultMessage:"Embed code"})}),o.jsx(bp,{autoFocus:!0,spellCheck:!1,placeholder:'<iframe src="https://…" allowfullscreen></iframe>',value:i.iframe??"",onChange:x=>c({iframe:x.target.value})}),o.jsx(vr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.code",defaultMessage:"Only the <iframe> is kept — scripts, event handlers and unknown attributes are removed before saving."})})]}),u.error?o.jsx(jp,{variant:"pi",children:u.error}):null,u.embedHtml?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.preview",defaultMessage:"Preview"})}),o.jsx(kp,{$ratio:g,dangerouslySetInnerHTML:{__html:u.embedHtml}}),o.jsx(vr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.provider",defaultMessage:"Detected: {provider}. The preview only renders if its host is allowed in your admin frame-src CSP."},{provider:Ya(u.provider)})})]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.title",defaultMessage:"Title (accessible name, optional)"})}),o.jsx($n,{type:"text",value:i.title??"",onChange:x=>c({title:x.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx($n,{type:"text",value:i.caption??"",onChange:x=>c({caption:x.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.aspectRatio",defaultMessage:"Aspect ratio"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",wrap:"wrap",children:[o.jsxs(xp,{value:i.aspectRatio,onChange:x=>c({aspectRatio:x.target.value}),children:[Lr.map(x=>o.jsx("option",{value:x,children:x},x)),o.jsx("option",{value:"custom",children:a({id:"components.Blocks.embed.aspectRatio.custom",defaultMessage:"Custom"})})]}),i.aspectRatio==="custom"?o.jsx($n,{type:"text",style:{maxWidth:160},placeholder:"3 / 2",value:i.customAspectRatio??"",onChange:x=>c({customAspectRatio:x.target.value})}):null]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.alignment",defaultMessage:"Alignment"})}),o.jsx(yp,{children:$p.map(x=>o.jsx(vp,{type:"button",$active:i.alignment===x,onClick:()=>c({alignment:x}),children:x},x))})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!m,onClick:w,children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},Qa=()=>({type:"embed",source:"url",aspectRatio:"16:9",alignment:"center",children:[{type:"text",text:""}]}),ei=(e,t)=>{const n={...Qa(),...t},r=he(e,n);r&&(d.Transforms.removeNodes(e,{at:r}),d.Transforms.insertNodes(e,n,{at:r,select:!0}))},Cp=(e,t)=>{const n=t.trim(),r=Ja(n);if(!r)return!1;const s={...Qa(),url:n,embedHtml:r.html,embedSrc:r.src,provider:Za(n),...Pr(n)?{thumbnail:Pr(n)}:{}},a={type:"paragraph",children:[{type:"text",text:""}]};return d.Transforms.insertNodes(e,[s,a]),!0},Sp=b.styled.div`
880
+ `,Je=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),Tp=["left","center","right","none"],Mp=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),[i,l]=k.useState({source:t.source??"url",url:t.url,iframe:t.iframe,aspectRatio:t.aspectRatio??"16:9",customAspectRatio:t.customAspectRatio,alignment:t.alignment??"center",caption:t.caption,title:t.title}),c=y=>l(v=>({...v,...y})),u=k.useMemo(()=>{if(i.source==="url"){const $=(i.url??"").trim();if(!$)return{error:null};const E=ei($,i.title);if(!E)return{error:a({id:"components.Blocks.embed.error.unknownUrl",defaultMessage:"That URL isn't a provider we can embed automatically. Switch to the Embed code tab and paste the platform's iframe instead."})};const C=Qa($);return{error:null,embedHtml:E.html,embedSrc:E.src,provider:C,thumbnail:Or($)??void 0}}const y=(i.iframe??"").trim();if(!y)return{error:null};const v=bp(y);return v.error?{error:{"no-iframe":a({id:"components.Blocks.embed.error.noIframe",defaultMessage:"No <iframe> found in that snippet. Paste the full embed code from the platform."}),"no-src":a({id:"components.Blocks.embed.error.noSrc",defaultMessage:"That iframe has no src attribute."}),"insecure-src":a({id:"components.Blocks.embed.error.insecureSrc",defaultMessage:"Only https:// embeds are allowed. Scripts and other embed types are stripped for security."})}[v.error]}:{error:null,embedHtml:v.html,embedSrc:v.src,provider:"generic",width:v.width,height:v.height}},[i.source,i.url,i.iframe,i.title,a]),h=k.useMemo(()=>yp(u.width,u.height),[u.width,u.height]),f=k.useRef(null);k.useEffect(()=>{if(!h)return;const y=`${u.embedSrc}:${h}`;f.current!==y&&(f.current=y,l(v=>({...v,aspectRatio:h})))},[h,u.embedSrc]);const g=i.aspectRatio==="custom"?i.customAspectRatio||"16 / 9":Jn(i.aspectRatio),m=!!u.embedHtml,x=()=>{u.embedHtml&&n({...i,url:i.source==="url"?i.url?.trim():void 0,iframe:i.source==="iframe"?i.iframe?.trim():void 0,embedHtml:u.embedHtml,embedSrc:u.embedSrc,provider:u.provider,thumbnail:u.thumbnail})};return o.jsx(p.Modal.Root,{open:e,onOpenChange:y=>{y||s()},children:o.jsxs(xp,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.embed.modal.title",defaultMessage:"Embed"})})}),o.jsxs(vp,{children:[o.jsxs(Ep,{children:[o.jsx(ds,{type:"button",$active:i.source==="url",onClick:()=>c({source:"url"}),children:a({id:"components.Blocks.embed.tab.url",defaultMessage:"URL"})}),o.jsx(ds,{type:"button",$active:i.source==="iframe",onClick:()=>c({source:"iframe"}),children:a({id:"components.Blocks.embed.tab.code",defaultMessage:"Embed code"})})]}),i.source==="url"?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.url",defaultMessage:"Video or page URL"})}),o.jsx(En,{type:"url",autoFocus:!0,placeholder:"https://www.youtube.com/watch?v=…",value:i.url??"",onChange:y=>c({url:y.target.value})}),o.jsx(kr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.url",defaultMessage:"YouTube, Vimeo, Loom, Wistia, Dailymotion and api.video are converted automatically. For anything else, use the Embed code tab."})})]}):o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.code",defaultMessage:"Embed code"})}),o.jsx(wp,{autoFocus:!0,spellCheck:!1,placeholder:'<iframe src="https://…" allowfullscreen></iframe>',value:i.iframe??"",onChange:y=>c({iframe:y.target.value})}),o.jsx(kr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.code",defaultMessage:"Only the <iframe> is kept — scripts, event handlers and unknown attributes are removed before saving."})})]}),u.error?o.jsx(Sp,{variant:"pi",children:u.error}):null,u.embedHtml?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.preview",defaultMessage:"Preview"})}),o.jsx(Cp,{$ratio:g,dangerouslySetInnerHTML:{__html:u.embedHtml}}),o.jsx(kr,{variant:"pi",children:a({id:"components.Blocks.embed.hint.provider",defaultMessage:"Detected: {provider}. The preview only renders if its host is allowed in your admin frame-src CSP."},{provider:Ja(u.provider)})})]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.title",defaultMessage:"Title (accessible name, optional)"})}),o.jsx(En,{type:"text",value:i.title??"",onChange:y=>c({title:y.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(En,{type:"text",value:i.caption??"",onChange:y=>c({caption:y.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.aspectRatio",defaultMessage:"Aspect ratio"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",wrap:"wrap",children:[o.jsxs(kp,{value:i.aspectRatio,onChange:y=>c({aspectRatio:y.target.value}),children:[zr.map(y=>o.jsx("option",{value:y,children:y},y)),o.jsx("option",{value:"custom",children:a({id:"components.Blocks.embed.aspectRatio.custom",defaultMessage:"Custom"})})]}),i.aspectRatio==="custom"?o.jsx(En,{type:"text",style:{maxWidth:160},placeholder:"3 / 2",value:i.customAspectRatio??"",onChange:y=>c({customAspectRatio:y.target.value})}):null]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Je,{children:a({id:"components.Blocks.embed.field.alignment",defaultMessage:"Alignment"})}),o.jsx(jp,{children:Tp.map(y=>o.jsx($p,{type:"button",$active:i.alignment===y,onClick:()=>c({alignment:y}),children:y},y))})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!m,onClick:x,children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},ti=()=>({type:"embed",source:"url",aspectRatio:"16:9",alignment:"center",children:[{type:"text",text:""}]}),ni=(e,t)=>{const n={...ti(),...t},r=he(e,n);r&&(d.Transforms.removeNodes(e,{at:r}),d.Transforms.insertNodes(e,n,{at:r,select:!0}))},Bp=(e,t)=>{const n=t.trim(),r=ei(n);if(!r)return!1;const s={...ti(),url:n,embedHtml:r.html,embedSrc:r.src,provider:Qa(n),...Or(n)?{thumbnail:Or(n)}:{}},a={type:"paragraph",children:[{type:"text",text:""}]};return d.Transforms.insertNodes(e,[s,a]),!0},Ip=b.styled.div`
881
881
  margin: ${({theme:e})=>e.spaces[2]} 0;
882
882
  display: flex;
883
883
  justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
884
- `,Tp=b.styled.div`
884
+ `,Rp=b.styled.div`
885
885
  display: flex;
886
886
  flex-direction: column;
887
887
  gap: ${({theme:e})=>e.spaces[2]};
@@ -890,10 +890,10 @@
890
890
  user-select: none;
891
891
  border-radius: ${({theme:e})=>e.borderRadius};
892
892
  box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
893
- `,Mp=b.styled.div`
893
+ `,Fp=b.styled.div`
894
894
  position: relative;
895
895
  width: 100%;
896
- `,Ip=b.styled.div`
896
+ `,Dp=b.styled.div`
897
897
  width: 100%;
898
898
  aspect-ratio: ${({$ratio:e})=>e};
899
899
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -906,10 +906,10 @@
906
906
  border: 0;
907
907
  display: block;
908
908
  }
909
- `,Rp=b.styled.div`
909
+ `,Ap=b.styled.div`
910
910
  position: absolute;
911
911
  inset: 0;
912
- `,Bp=b.styled.div`
912
+ `,_p=b.styled.div`
913
913
  position: absolute;
914
914
  top: 8px;
915
915
  left: 8px;
@@ -920,14 +920,14 @@
920
920
  font-size: 12px;
921
921
  font-weight: 600;
922
922
  pointer-events: none;
923
- `,Fp=b.styled(p.Flex)`
923
+ `,Np=b.styled(p.Flex)`
924
924
  width: min(100%, 640px);
925
925
  padding: ${({theme:e})=>e.spaces[4]};
926
926
  border: 1px dashed ${({theme:e})=>e.colors.neutral300};
927
927
  border-radius: ${({theme:e})=>e.borderRadius};
928
928
  background: ${({theme:e})=>e.colors.neutral100};
929
929
  color: ${({theme:e})=>e.colors.neutral600};
930
- `,Dp=["source","url","iframe","embedHtml","embedSrc","provider","thumbnail","aspectRatio","customAspectRatio","alignment","caption","title"],Ap=["url","iframe","thumbnail","customAspectRatio","caption","title"],_p=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Embed"),i=B.useSelected(),l=(r.embedHtml??"").trim()!=="",[c,u]=k.useState(!l&&!a),h=r.alignment??"center",f=r.aspectRatio==="custom"?r.customAspectRatio||"16 / 9":Yn(r.aspectRatio),g=()=>{try{return B.ReactEditor.findPath(s,r)}catch{return null}},m=()=>{const $=g();$&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:$}),d.Transforms.unsetNodes(s,Dp,{at:$})):d.Transforms.removeNodes(s,{at:$}))},w=$=>{const E=g();if(E){d.Transforms.setNodes(s,$,{at:E});const S=Ap.filter(R=>$[R]===void 0||$[R]==="");S.length&&d.Transforms.unsetNodes(s,S,{at:E})}u(!1),B.ReactEditor.focus(s)},x=()=>{m(),u(!1),B.ReactEditor.focus(s)},y=()=>{l||m(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(Sp,{$align:h,contentEditable:!1,children:l?o.jsxs(Tp,{$selected:i,$full:h==="none",onMouseDown:$=>{$.preventDefault(),a||u(!0)},children:[o.jsxs(Mp,{children:[o.jsx(Ip,{$ratio:f,dangerouslySetInnerHTML:{__html:r.embedHtml}}),o.jsx(Bp,{children:Ya(r.provider)}),o.jsx(Rp,{})]}),r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]}):o.jsxs(Fp,{alignItems:"center",gap:2,children:[o.jsx(D.Code,{}),o.jsx(p.Typography,{variant:"pi",children:"Embed — click to add a URL or embed code."})]})}),c&&!a?o.jsx(Ep,{open:!0,element:r,onSave:w,onRemove:x,onClose:y}):null]})},Np=e=>{const{isVoid:t}=e;return e.isVoid=n=>od(n)?!0:t(n),e},Pp={embed:{renderElement:e=>o.jsx(_p,{...e}),icon:D.Code,label:{id:"components.Blocks.blocks.embed",defaultMessage:"Embed"},matchNode:e=>e.type==="embed",isInBlocksSelector:!0,handleConvert(e){ei(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})}}},ti=/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,ni=/(?:vimeo\.com\/)(\d+)/,Lp=e=>{const t=e.match(ti);return t?`https://img.youtube.com/vi/${t[1]}/hqdefault.jpg`:(e.match(ni),null)},Op=e=>ti.test(e)?"YouTube":ni.test(e)?"Vimeo":"Video",zp=b.styled(p.Box)`
930
+ `,Pp=["source","url","iframe","embedHtml","embedSrc","provider","thumbnail","aspectRatio","customAspectRatio","alignment","caption","title"],Lp=["url","iframe","thumbnail","customAspectRatio","caption","title"],Op=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Embed"),i=R.useSelected(),l=(r.embedHtml??"").trim()!=="",[c,u]=k.useState(!l&&!a),h=r.alignment??"center",f=r.aspectRatio==="custom"?r.customAspectRatio||"16 / 9":Jn(r.aspectRatio),g=()=>{try{return R.ReactEditor.findPath(s,r)}catch{return null}},m=()=>{const $=g();$&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:$}),d.Transforms.unsetNodes(s,Pp,{at:$})):d.Transforms.removeNodes(s,{at:$}))},x=$=>{const E=g();if(E){d.Transforms.setNodes(s,$,{at:E});const C=Lp.filter(I=>$[I]===void 0||$[I]==="");C.length&&d.Transforms.unsetNodes(s,C,{at:E})}u(!1),R.ReactEditor.focus(s)},y=()=>{m(),u(!1),R.ReactEditor.focus(s)},v=()=>{l||m(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(Ip,{$align:h,contentEditable:!1,children:l?o.jsxs(Rp,{$selected:i,$full:h==="none",onMouseDown:$=>{$.preventDefault(),a||u(!0)},children:[o.jsxs(Fp,{children:[o.jsx(Dp,{$ratio:f,dangerouslySetInnerHTML:{__html:r.embedHtml}}),o.jsx(_p,{children:Ja(r.provider)}),o.jsx(Ap,{})]}),r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]}):o.jsxs(Np,{alignItems:"center",gap:2,children:[o.jsx(D.Code,{}),o.jsx(p.Typography,{variant:"pi",children:"Embed — click to add a URL or embed code."})]})}),c&&!a?o.jsx(Mp,{open:!0,element:r,onSave:x,onRemove:y,onClose:v}):null]})},zp=e=>{const{isVoid:t}=e;return e.isVoid=n=>ld(n)?!0:t(n),e},Hp={embed:{renderElement:e=>o.jsx(Op,{...e}),icon:D.Code,label:{id:"components.Blocks.blocks.embed",defaultMessage:"Embed"},matchNode:e=>e.type==="embed",isInBlocksSelector:!0,handleConvert(e){ni(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})}}},ri=/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,oi=/(?:vimeo\.com\/)(\d+)/,Up=e=>{const t=e.match(ri);return t?`https://img.youtube.com/vi/${t[1]}/hqdefault.jpg`:(e.match(oi),null)},Wp=e=>ri.test(e)?"YouTube":oi.test(e)?"Vimeo":"Video",Kp=b.styled(p.Box)`
931
931
  position: relative;
932
932
  width: 100%;
933
933
  aspect-ratio: 16 / 9;
@@ -936,18 +936,18 @@
936
936
  overflow: hidden;
937
937
  background: ${({theme:e})=>e.colors.neutral900};
938
938
  cursor: default;
939
- `,Hp=b.styled.img`
939
+ `,Gp=b.styled.img`
940
940
  width: 100%;
941
941
  height: 100%;
942
942
  object-fit: cover;
943
943
  opacity: 0.85;
944
- `,Up=b.styled(p.Flex)`
944
+ `,Vp=b.styled(p.Flex)`
945
945
  position: absolute;
946
946
  inset: 0;
947
947
  align-items: center;
948
948
  justify-content: center;
949
949
  pointer-events: none;
950
- `,Wp=b.styled.div`
950
+ `,qp=b.styled.div`
951
951
  width: 64px;
952
952
  height: 64px;
953
953
  border-radius: 50%;
@@ -966,7 +966,7 @@
966
966
  border-color: transparent transparent transparent white;
967
967
  margin-left: 4px;
968
968
  }
969
- `,Kp=b.styled.div`
969
+ `,Xp=b.styled.div`
970
970
  position: absolute;
971
971
  top: 8px;
972
972
  left: 8px;
@@ -976,7 +976,7 @@
976
976
  border-radius: 4px;
977
977
  font-size: 12px;
978
978
  font-weight: 600;
979
- `,Gp=b.styled.div`
979
+ `,Yp=b.styled.div`
980
980
  position: absolute;
981
981
  bottom: 8px;
982
982
  left: 8px;
@@ -986,16 +986,16 @@
986
986
  overflow: hidden;
987
987
  text-overflow: ellipsis;
988
988
  white-space: nowrap;
989
- `,Vp=b.styled(p.Flex)`
989
+ `,Zp=b.styled(p.Flex)`
990
990
  width: 100%;
991
991
  height: 100%;
992
992
  background: ${({theme:e})=>e.colors.neutral200};
993
993
  color: ${({theme:e})=>e.colors.neutral600};
994
994
  font-size: 14px;
995
- `,qp=({attributes:e,children:t,element:n})=>{const r=n.originalUrl||"",s=Lp(r),a=Op(r);return o.jsxs("div",{...e,contentEditable:!1,children:[o.jsxs(zp,{children:[s?o.jsx(Hp,{src:s,alt:`${a} video`}):o.jsxs(Vp,{alignItems:"center",justifyContent:"center",children:[a," Video"]}),o.jsx(Up,{children:o.jsx(Wp,{})}),o.jsx(Kp,{children:a}),r&&o.jsx(Gp,{children:r})]}),o.jsx("span",{style:{display:"none"},children:t})]})},Xp=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="media-embed"?!0:t(n),e},Yp={"media-embed":{renderElement:e=>o.jsx(qp,{...e}),matchNode:e=>e.type==="media-embed",isInBlocksSelector:!1}},jt={twitter:{label:"X / Twitter",icon:"𝕏",color:"#000000"},instagram:{label:"Instagram",icon:"📸",color:"#E1306C"},facebook:{label:"Facebook",icon:"👍",color:"#1877F2"},tiktok:{label:"TikTok",icon:"🎵",color:"#010101"},linkedin:{label:"LinkedIn",icon:"💼",color:"#0A66C2"},pinterest:{label:"Pinterest",icon:"📌",color:"#E60023"}},Or=["twitter","instagram","facebook","tiktok","linkedin","pinterest"],ls=e=>/(?:twitter\.com|x\.com)\/[^/]+\/status/i.test(e)?"twitter":/instagram\.com\/(?:p|reel|tv)\//i.test(e)?"instagram":/tiktok\.com\/@[^/]+\/video\//i.test(e)?"tiktok":/facebook\.com\//i.test(e)?"facebook":/linkedin\.com\//i.test(e)?"linkedin":/(?:pinterest\.[a-z.]+|pin\.it)\//i.test(e)?"pinterest":null,Zp=e=>e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim(),Jp=e=>{const t=[{re:/data-instgrm-permalink=["']([^"']+)["']/i,dropQuery:!0},{re:/\bcite=["'](https?:\/\/[^"']+)["']/i,dropQuery:!0},{re:/<iframe[^>]+src=["'](https?:\/\/[^"']+)["']/i},{re:/<a[^>]+href=["'](https?:\/\/[^"']+)["']/i,dropQuery:!0}];for(const{re:n,dropQuery:r}of t){const s=e.match(n);if(!s)continue;const a=s[1].replace(/&amp;/g,"&");return r?a.split("?")[0]:a}return null},Qp=b.styled(p.Modal.Content)`
995
+ `,Jp=({attributes:e,children:t,element:n})=>{const r=n.originalUrl||"",s=Up(r),a=Wp(r);return o.jsxs("div",{...e,contentEditable:!1,children:[o.jsxs(Kp,{children:[s?o.jsx(Gp,{src:s,alt:`${a} video`}):o.jsxs(Zp,{alignItems:"center",justifyContent:"center",children:[a," Video"]}),o.jsx(Vp,{children:o.jsx(qp,{})}),o.jsx(Xp,{children:a}),r&&o.jsx(Yp,{children:r})]}),o.jsx("span",{style:{display:"none"},children:t})]})},Qp=e=>{const{isVoid:t}=e;return e.isVoid=n=>n.type==="media-embed"?!0:t(n),e},eh={"media-embed":{renderElement:e=>o.jsx(Jp,{...e}),matchNode:e=>e.type==="media-embed",isInBlocksSelector:!1}},jt={twitter:{label:"X / Twitter",icon:"𝕏",color:"#000000"},instagram:{label:"Instagram",icon:"📸",color:"#E1306C"},facebook:{label:"Facebook",icon:"👍",color:"#1877F2"},tiktok:{label:"TikTok",icon:"🎵",color:"#010101"},linkedin:{label:"LinkedIn",icon:"💼",color:"#0A66C2"},pinterest:{label:"Pinterest",icon:"📌",color:"#E60023"}},Hr=["twitter","instagram","facebook","tiktok","linkedin","pinterest"],us=e=>/(?:twitter\.com|x\.com)\/[^/]+\/status/i.test(e)?"twitter":/instagram\.com\/(?:p|reel|tv)\//i.test(e)?"instagram":/tiktok\.com\/@[^/]+\/video\//i.test(e)?"tiktok":/facebook\.com\//i.test(e)?"facebook":/linkedin\.com\//i.test(e)?"linkedin":/(?:pinterest\.[a-z.]+|pin\.it)\//i.test(e)?"pinterest":null,th=e=>e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim(),nh=e=>{const t=[{re:/data-instgrm-permalink=["']([^"']+)["']/i,dropQuery:!0},{re:/\bcite=["'](https?:\/\/[^"']+)["']/i,dropQuery:!0},{re:/<iframe[^>]+src=["'](https?:\/\/[^"']+)["']/i},{re:/<a[^>]+href=["'](https?:\/\/[^"']+)["']/i,dropQuery:!0}];for(const{re:n,dropQuery:r}of t){const s=e.match(n);if(!s)continue;const a=s[1].replace(/&amp;/g,"&");return r?a.split("?")[0]:a}return null},rh=b.styled(p.Modal.Content)`
996
996
  max-width: 760px;
997
997
  width: 90vw;
998
- `,eh=b.styled.div`
998
+ `,oh=b.styled.div`
999
999
  display: flex;
1000
1000
  flex-direction: column;
1001
1001
  gap: ${({theme:e})=>e.spaces[4]};
@@ -1003,11 +1003,11 @@
1003
1003
  ${({theme:e})=>e.spaces[6]};
1004
1004
  max-height: 70vh;
1005
1005
  overflow: auto;
1006
- `,th=b.styled.div`
1006
+ `,sh=b.styled.div`
1007
1007
  display: grid;
1008
1008
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
1009
1009
  gap: ${({theme:e})=>e.spaces[2]};
1010
- `,nh=b.styled.button`
1010
+ `,ah=b.styled.button`
1011
1011
  display: flex;
1012
1012
  flex-direction: column;
1013
1013
  align-items: center;
@@ -1024,10 +1024,10 @@
1024
1024
  &:hover {
1025
1025
  border-color: ${({$color:e})=>e};
1026
1026
  }
1027
- `,rh=b.styled.span`
1027
+ `,ih=b.styled.span`
1028
1028
  font-size: 22px;
1029
1029
  line-height: 1;
1030
- `,cs=b.styled.input`
1030
+ `,ps=b.styled.input`
1031
1031
  width: 100%;
1032
1032
  box-sizing: border-box;
1033
1033
  min-height: 40px;
@@ -1037,7 +1037,7 @@
1037
1037
  font-size: 14px;
1038
1038
  color: ${({theme:e})=>e.colors.neutral800};
1039
1039
  background: ${({theme:e})=>e.colors.neutral0};
1040
- `,oh=b.styled.textarea`
1040
+ `,lh=b.styled.textarea`
1041
1041
  width: 100%;
1042
1042
  box-sizing: border-box;
1043
1043
  min-height: 80px;
@@ -1049,10 +1049,10 @@
1049
1049
  color: ${({theme:e})=>e.colors.neutral800};
1050
1050
  background: ${({theme:e})=>e.colors.neutral0};
1051
1051
  resize: vertical;
1052
- `,sh=b.styled.div`
1052
+ `,ch=b.styled.div`
1053
1053
  display: flex;
1054
1054
  gap: ${({theme:e})=>e.spaces[2]};
1055
- `,ah=b.styled.button`
1055
+ `,dh=b.styled.button`
1056
1056
  flex: 1;
1057
1057
  min-height: 36px;
1058
1058
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -1062,7 +1062,7 @@
1062
1062
  color: ${({theme:e})=>e.colors.neutral800};
1063
1063
  cursor: pointer;
1064
1064
  text-transform: capitalize;
1065
- `,ih=b.styled.div`
1065
+ `,uh=b.styled.div`
1066
1066
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
1067
1067
  border-radius: ${({theme:e})=>e.borderRadius};
1068
1068
  background: ${({theme:e})=>e.colors.neutral100};
@@ -1070,18 +1070,18 @@
1070
1070
  display: flex;
1071
1071
  gap: ${({theme:e})=>e.spaces[3]};
1072
1072
  align-items: center;
1073
- `,lh=b.styled.img`
1073
+ `,ph=b.styled.img`
1074
1074
  width: 72px;
1075
1075
  height: 72px;
1076
1076
  object-fit: cover;
1077
1077
  border-radius: ${({theme:e})=>e.borderRadius};
1078
1078
  flex: 0 0 auto;
1079
- `,ch=b.styled.div`
1079
+ `,hh=b.styled.div`
1080
1080
  color: ${({theme:e})=>e.colors.danger600};
1081
1081
  font-size: 13px;
1082
- `,Gt=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),dh=["left","center","right"],uh=({open:e,element:t,enabledPlatforms:n,onSave:r,onRemove:s,onClose:a})=>{const{formatMessage:i}=O.useIntl(),{get:l}=Xe.useFetchClient(),c=n&&n.length>0?n:Or,[u,h]=k.useState({platform:t.platform??c[0],url:t.url??"",embedCode:t.embedCode,oembed:t.oembed,alignment:t.alignment??"center",caption:t.caption}),[f,g]=k.useState(!1),[m,w]=k.useState(null),x=M=>h(j=>({...j,...M})),y=M=>{const j=ls(M);x({url:M,oembed:void 0,...j?{platform:j}:{}}),w(null)},$=M=>{const j=M.trim()===""?"":M;if(j&&!u.url.trim()){const v=Jp(j),I=v?ls(v):null;x({embedCode:j,...v?{url:v}:{},...I?{platform:I}:{}});return}x({embedCode:j})},E=async()=>{if(u.url.trim()){g(!0),w(null);try{const j=(await l(`/better-blocks/oembed?url=${encodeURIComponent(u.url.trim())}&platform=${u.platform}`)).data;x({oembed:{html:j.html??void 0,title:j.title,author:j.author,authorUrl:j.authorUrl,thumbnailUrl:j.thumbnailUrl,providerName:j.providerName,width:j.width,height:j.height}})}catch(M){const j=M?.response?.data?.error?.message||M?.message||"Failed to fetch embed.";w(j)}finally{g(!1)}}},S=u.oembed,R=jt[u.platform],C=!!(u.url.trim()||u.embedCode?.trim());return o.jsx(p.Modal.Root,{open:e,onOpenChange:M=>{M||a()},children:o.jsxs(Qp,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:i({id:"components.Blocks.social.modal.title",defaultMessage:"Social media embed"})})}),o.jsxs(eh,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Gt,{children:i({id:"components.Blocks.social.field.platform",defaultMessage:"Platform"})}),o.jsx(th,{children:c.map(M=>o.jsxs(nh,{type:"button",$active:u.platform===M,$color:jt[M].color,onClick:()=>x({platform:M}),children:[o.jsx(rh,{children:jt[M].icon}),jt[M].label]},M))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Gt,{children:i({id:"components.Blocks.social.field.url",defaultMessage:"Post URL"})}),o.jsxs(p.Flex,{gap:2,alignItems:"stretch",children:[o.jsx(cs,{type:"url",placeholder:"https://x.com/user/status/123…",value:u.url,onChange:M=>y(M.target.value)}),o.jsx(p.Button,{type:"button",variant:"secondary",onClick:E,disabled:!u.url.trim()||f,children:f?o.jsx(p.Loader,{small:!0,children:"…"}):i({id:"components.Blocks.social.action.fetch",defaultMessage:"Fetch preview"})})]}),m?o.jsx(ch,{children:m}):null]}),S&&(S.thumbnailUrl||S.author||S.title)?o.jsxs(ih,{children:[S.thumbnailUrl?o.jsx(lh,{src:S.thumbnailUrl,alt:""}):null,o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:[o.jsxs(p.Typography,{variant:"sigma",textColor:"neutral600",children:[R.icon," ",S.providerName||R.label]}),S.author?o.jsx(p.Typography,{fontWeight:"bold",children:S.author}):null,S.title?o.jsx(p.Typography,{variant:"pi",textColor:"neutral700",children:S.title}):null]})]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Gt,{children:i({id:"components.Blocks.social.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(cs,{type:"text",value:u.caption??"",onChange:M=>x({caption:M.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Gt,{children:i({id:"components.Blocks.social.field.alignment",defaultMessage:"Alignment"})}),o.jsx(sh,{children:dh.map(M=>o.jsx(ah,{type:"button",$active:u.alignment===M,onClick:()=>x({alignment:M}),children:M},M))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Gt,{children:i({id:"components.Blocks.social.field.embedCode",defaultMessage:"Embed code override (optional)"})}),o.jsx(oh,{placeholder:"<blockquote …>…</blockquote>",value:u.embedCode??"",onChange:M=>$(M.target.value)}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:i({id:"components.Blocks.social.field.embedCode.hint",defaultMessage:"Pasting an embed code is enough on its own — the post URL is optional."})})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:s,children:i({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:a,children:i({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!C,onClick:()=>r({...u,url:u.url.trim(),embedCode:u.embedCode&&Zp(u.embedCode)||void 0}),children:i({id:"global.save",defaultMessage:"Save"})})]})]})]})})},ph={twitter:"https://platform.twitter.com",instagram:"https://www.instagram.com",facebook:"https://www.facebook.com",tiktok:"https://www.tiktok.com",linkedin:"https://www.linkedin.com",pinterest:"https://assets.pinterest.com"},hh={twitter:560,instagram:700,facebook:680,tiktok:760,linkedin:600,pinterest:450},ds=e=>{const t=e?.match(/<iframe[^>]+src=["']([^"']+)["']/i);return t?t[1].replace(/&amp;/g,"&"):null},En=(e,...t)=>{for(const n of t)if(n)for(const r of e){const s=n.match(r);if(s)return s[1]}return null},fh=e=>{const{platform:t,url:n="",embedCode:r}=e,s=e.oembed?.html,a=hh[t]??600,i=ds(r)??ds(s);if(i)return{src:i,height:a};switch(t){case"twitter":{const l=En([/(?:twitter\.com|x\.com)\/[^/]+\/status(?:es)?\/(\d+)/i],n,r,s);return l?{src:`https://platform.twitter.com/embed/Tweet.html?id=${l}&dnt=true`,height:a}:null}case"instagram":{const l=En([/instagram\.com\/(?:p|reel|tv)\/([A-Za-z0-9_-]+)/i],n,r,s);return l?{src:`https://www.instagram.com/p/${l}/embed/captioned/`,height:a}:null}case"tiktok":{const l=En([/tiktok\.com\/@[^/]+\/video\/(\d+)/i,/data-video-id=["'](\d+)["']/i],n,r,s);return l?{src:`https://www.tiktok.com/embed/v2/${l}`,height:a}:null}case"pinterest":{const l=En([/\/pin\/(\d+)/i],n,r,s);return l?{src:`https://assets.pinterest.com/ext/embed.html?id=${l}`,height:a}:null}case"facebook":return n?{src:`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(n)}&show_text=true&width=500`,height:a}:null;case"linkedin":{const l=n.match(/(?:urn:li:)?(ugcPost|activity|share)[:-](\d{10,})/i);if(!l)return null;const c=l[1].toLowerCase()==="ugcpost"?"ugcPost":l[1].toLowerCase();return{src:`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(`urn:li:${c}:${l[2]}`)}`,height:a}}default:return null}},gh=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"18",cy:"5",r:"3"}),o.jsx("circle",{cx:"6",cy:"12",r:"3"}),o.jsx("circle",{cx:"18",cy:"19",r:"3"}),o.jsx("line",{x1:"8.6",y1:"10.7",x2:"15.4",y2:"6.3"}),o.jsx("line",{x1:"8.6",y1:"13.3",x2:"15.4",y2:"17.7"})]}),us=(e="twitter")=>({type:"social-embed",platform:e,url:"",alignment:"center",children:[{type:"text",text:""}]}),mh=e=>{const t=he(e,us());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,us(),{at:t,select:!0}))},bh=b.styled.div`
1082
+ `,Vt=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),fh=["left","center","right"],gh=({open:e,element:t,enabledPlatforms:n,onSave:r,onRemove:s,onClose:a})=>{const{formatMessage:i}=O.useIntl(),{get:l}=Xe.useFetchClient(),c=n&&n.length>0?n:Hr,[u,h]=k.useState({platform:t.platform??c[0],url:t.url??"",embedCode:t.embedCode,oembed:t.oembed,alignment:t.alignment??"center",caption:t.caption}),[f,g]=k.useState(!1),[m,x]=k.useState(null),y=T=>h(j=>({...j,...T})),v=T=>{const j=us(T);y({url:T,oembed:void 0,...j?{platform:j}:{}}),x(null)},$=T=>{const j=T.trim()===""?"":T;if(j&&!u.url.trim()){const w=nh(j),B=w?us(w):null;y({embedCode:j,...w?{url:w}:{},...B?{platform:B}:{}});return}y({embedCode:j})},E=async()=>{if(u.url.trim()){g(!0),x(null);try{const j=(await l(`/better-blocks/oembed?url=${encodeURIComponent(u.url.trim())}&platform=${u.platform}`)).data;y({oembed:{html:j.html??void 0,title:j.title,author:j.author,authorUrl:j.authorUrl,thumbnailUrl:j.thumbnailUrl,providerName:j.providerName,width:j.width,height:j.height}})}catch(T){const j=T?.response?.data?.error?.message||T?.message||"Failed to fetch embed.";x(j)}finally{g(!1)}}},C=u.oembed,I=jt[u.platform],S=!!(u.url.trim()||u.embedCode?.trim());return o.jsx(p.Modal.Root,{open:e,onOpenChange:T=>{T||a()},children:o.jsxs(rh,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:i({id:"components.Blocks.social.modal.title",defaultMessage:"Social media embed"})})}),o.jsxs(oh,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Vt,{children:i({id:"components.Blocks.social.field.platform",defaultMessage:"Platform"})}),o.jsx(sh,{children:c.map(T=>o.jsxs(ah,{type:"button",$active:u.platform===T,$color:jt[T].color,onClick:()=>y({platform:T}),children:[o.jsx(ih,{children:jt[T].icon}),jt[T].label]},T))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Vt,{children:i({id:"components.Blocks.social.field.url",defaultMessage:"Post URL"})}),o.jsxs(p.Flex,{gap:2,alignItems:"stretch",children:[o.jsx(ps,{type:"url",placeholder:"https://x.com/user/status/123…",value:u.url,onChange:T=>v(T.target.value)}),o.jsx(p.Button,{type:"button",variant:"secondary",onClick:E,disabled:!u.url.trim()||f,children:f?o.jsx(p.Loader,{small:!0,children:"…"}):i({id:"components.Blocks.social.action.fetch",defaultMessage:"Fetch preview"})})]}),m?o.jsx(hh,{children:m}):null]}),C&&(C.thumbnailUrl||C.author||C.title)?o.jsxs(uh,{children:[C.thumbnailUrl?o.jsx(ph,{src:C.thumbnailUrl,alt:""}):null,o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:[o.jsxs(p.Typography,{variant:"sigma",textColor:"neutral600",children:[I.icon," ",C.providerName||I.label]}),C.author?o.jsx(p.Typography,{fontWeight:"bold",children:C.author}):null,C.title?o.jsx(p.Typography,{variant:"pi",textColor:"neutral700",children:C.title}):null]})]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Vt,{children:i({id:"components.Blocks.social.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(ps,{type:"text",value:u.caption??"",onChange:T=>y({caption:T.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Vt,{children:i({id:"components.Blocks.social.field.alignment",defaultMessage:"Alignment"})}),o.jsx(ch,{children:fh.map(T=>o.jsx(dh,{type:"button",$active:u.alignment===T,onClick:()=>y({alignment:T}),children:T},T))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Vt,{children:i({id:"components.Blocks.social.field.embedCode",defaultMessage:"Embed code override (optional)"})}),o.jsx(lh,{placeholder:"<blockquote …>…</blockquote>",value:u.embedCode??"",onChange:T=>$(T.target.value)}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:i({id:"components.Blocks.social.field.embedCode.hint",defaultMessage:"Pasting an embed code is enough on its own — the post URL is optional."})})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:s,children:i({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:a,children:i({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!S,onClick:()=>r({...u,url:u.url.trim(),embedCode:u.embedCode&&th(u.embedCode)||void 0}),children:i({id:"global.save",defaultMessage:"Save"})})]})]})]})})},mh={twitter:"https://platform.twitter.com",instagram:"https://www.instagram.com",facebook:"https://www.facebook.com",tiktok:"https://www.tiktok.com",linkedin:"https://www.linkedin.com",pinterest:"https://assets.pinterest.com"},bh={twitter:560,instagram:700,facebook:680,tiktok:760,linkedin:600,pinterest:450},hs=e=>{const t=e?.match(/<iframe[^>]+src=["']([^"']+)["']/i);return t?t[1].replace(/&amp;/g,"&"):null},Cn=(e,...t)=>{for(const n of t)if(n)for(const r of e){const s=n.match(r);if(s)return s[1]}return null},yh=e=>{const{platform:t,url:n="",embedCode:r}=e,s=e.oembed?.html,a=bh[t]??600,i=hs(r)??hs(s);if(i)return{src:i,height:a};switch(t){case"twitter":{const l=Cn([/(?:twitter\.com|x\.com)\/[^/]+\/status(?:es)?\/(\d+)/i],n,r,s);return l?{src:`https://platform.twitter.com/embed/Tweet.html?id=${l}&dnt=true`,height:a}:null}case"instagram":{const l=Cn([/instagram\.com\/(?:p|reel|tv)\/([A-Za-z0-9_-]+)/i],n,r,s);return l?{src:`https://www.instagram.com/p/${l}/embed/captioned/`,height:a}:null}case"tiktok":{const l=Cn([/tiktok\.com\/@[^/]+\/video\/(\d+)/i,/data-video-id=["'](\d+)["']/i],n,r,s);return l?{src:`https://www.tiktok.com/embed/v2/${l}`,height:a}:null}case"pinterest":{const l=Cn([/\/pin\/(\d+)/i],n,r,s);return l?{src:`https://assets.pinterest.com/ext/embed.html?id=${l}`,height:a}:null}case"facebook":return n?{src:`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(n)}&show_text=true&width=500`,height:a}:null;case"linkedin":{const l=n.match(/(?:urn:li:)?(ugcPost|activity|share)[:-](\d{10,})/i);if(!l)return null;const c=l[1].toLowerCase()==="ugcpost"?"ugcPost":l[1].toLowerCase();return{src:`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(`urn:li:${c}:${l[2]}`)}`,height:a}}default:return null}},xh=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"18",cy:"5",r:"3"}),o.jsx("circle",{cx:"6",cy:"12",r:"3"}),o.jsx("circle",{cx:"18",cy:"19",r:"3"}),o.jsx("line",{x1:"8.6",y1:"10.7",x2:"15.4",y2:"6.3"}),o.jsx("line",{x1:"8.6",y1:"13.3",x2:"15.4",y2:"17.7"})]}),fs=(e="twitter")=>({type:"social-embed",platform:e,url:"",alignment:"center",children:[{type:"text",text:""}]}),vh=e=>{const t=he(e,fs());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,fs(),{at:t,select:!0}))},wh=b.styled.div`
1083
1083
  margin: ${({theme:e})=>e.spaces[2]} 0;
1084
- `,xh=b.styled.div`
1084
+ `,kh=b.styled.div`
1085
1085
  display: inline-flex;
1086
1086
  flex-direction: column;
1087
1087
  gap: ${({theme:e})=>e.spaces[2]};
@@ -1095,25 +1095,25 @@
1095
1095
  border-radius: ${({theme:e})=>e.borderRadius};
1096
1096
  background: ${({theme:e})=>e.colors.neutral0};
1097
1097
  box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
1098
- `,yh=b.styled(p.Flex)`
1098
+ `,jh=b.styled(p.Flex)`
1099
1099
  gap: ${({theme:e})=>e.spaces[2]};
1100
- `,vh=b.styled.span`
1100
+ `,$h=b.styled.span`
1101
1101
  font-size: 18px;
1102
1102
  line-height: 1;
1103
- `,wh=b.styled.img`
1103
+ `,Eh=b.styled.img`
1104
1104
  width: 100%;
1105
1105
  max-height: 220px;
1106
1106
  object-fit: cover;
1107
1107
  border-radius: ${({theme:e})=>e.borderRadius};
1108
- `,kh=b.styled.iframe`
1108
+ `,Ch=b.styled.iframe`
1109
1109
  width: 100%;
1110
1110
  border: 0;
1111
1111
  border-radius: ${({theme:e})=>e.borderRadius};
1112
1112
  background: ${({theme:e})=>e.colors.neutral150};
1113
- `,jh=b.styled.div`
1113
+ `,Sh=b.styled.div`
1114
1114
  font-size: 11px;
1115
1115
  color: ${({theme:e})=>e.colors.neutral500};
1116
- `,$h=b.styled.button`
1116
+ `,Th=b.styled.button`
1117
1117
  align-self: flex-start;
1118
1118
  padding: 2px 8px;
1119
1119
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -1127,16 +1127,16 @@
1127
1127
  border-color: ${({theme:e})=>e.colors.primary600};
1128
1128
  color: ${({theme:e})=>e.colors.primary600};
1129
1129
  }
1130
- `,ps=b.styled.div`
1130
+ `,gs=b.styled.div`
1131
1131
  font-size: 12px;
1132
1132
  color: ${({theme:e})=>e.colors.neutral500};
1133
1133
  overflow: hidden;
1134
1134
  text-overflow: ellipsis;
1135
1135
  white-space: nowrap;
1136
- `,Eh=["platform","url","embedCode","oembed","alignment","caption"],Ch=e=>{const n=e.pluginOptions?.socialPlatforms;return Array.isArray(n)&&n.length>0?n.filter(r=>Or.includes(r)):Or},Sh=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("SocialEmbed"),i=B.useSelected(),l=(r.url??"").trim()!==""||(r.embedCode??"").trim()!=="",[c,u]=k.useState(!l&&!a),[h,f]=k.useState(!1),g=fh(r);k.useEffect(()=>{f(!1)},[g?.src]);const m=jt[r.platform]??jt.twitter,w=r.alignment??"center",x=w==="left"?"flex-start":w==="right"?"flex-end":"center",y=()=>{try{return B.ReactEditor.findPath(s,r)}catch{return null}},$=()=>{const C=y();C&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:C}),d.Transforms.unsetNodes(s,Eh,{at:C})):d.Transforms.removeNodes(s,{at:C}))},E=C=>{const M=y();if(M){d.Transforms.setNodes(s,C,{at:M});const j=["embedCode","caption","oembed"].filter(v=>C[v]===void 0||C[v]==="");j.length&&d.Transforms.unsetNodes(s,j,{at:M})}u(!1),B.ReactEditor.focus(s)},S=()=>{$(),u(!1),B.ReactEditor.focus(s)},R=()=>{l||$(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(bh,{style:{display:"flex",justifyContent:x},contentEditable:!1,children:o.jsxs(xh,{$selected:i,$accent:m.color,onMouseDown:C=>{C.preventDefault(),a||u(!0)},children:[o.jsxs(yh,{alignItems:"center",children:[o.jsx(vh,{$color:m.color,children:m.icon}),o.jsx(p.Typography,{fontWeight:"bold",children:r.oembed?.author||r.oembed?.providerName||m.label})]}),g?o.jsx($h,{type:"button",onMouseDown:C=>{C.preventDefault(),C.stopPropagation(),f(M=>!M)},children:h?"Hide live post":"Show live post"}):null,g&&h?o.jsxs(o.Fragment,{children:[o.jsx(kh,{src:g.src,height:g.height,title:`${m.label} post preview`,loading:"lazy",referrerPolicy:"strict-origin-when-cross-origin",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation"}),o.jsxs(jh,{children:["Blank? Add ",ph[r.platform]," to `frame-src` in config/middlewares.ts."]})]}):null,!h&&r.oembed?.thumbnailUrl?o.jsx(wh,{src:r.oembed.thumbnailUrl,alt:""}):null,r.oembed?.title?o.jsx(p.Typography,{variant:"pi",textColor:"neutral700",children:r.oembed.title}):null,r.url?o.jsx(ps,{children:r.url}):r.embedCode?o.jsx(ps,{children:"Custom embed code"}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]})}),c&&!a?o.jsx(uh,{open:!0,element:r,enabledPlatforms:Ch(s),onSave:E,onRemove:S,onClose:R}):null]})},Th=e=>{const{isVoid:t}=e;return e.isVoid=n=>rd(n)?!0:t(n),e},Mh={"social-embed":{renderElement:e=>o.jsx(Sh,{...e}),icon:gh,label:{id:"components.Blocks.blocks.social",defaultMessage:"Social embed"},matchNode:e=>e.type==="social-embed",isInBlocksSelector:!0,handleConvert(e){mh(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[social]"]}},ri="mux-video-uploader",Ih=e=>`${window.strapi.backendURL}/${ri}/thumbnail/${e}`,Rh=12,Bh=e=>{const{get:t}=Xe.useFetchClient(),[n,r]=k.useState(null),[s,a]=k.useState([]),[i,l]=k.useState(0),[c,u]=k.useState(!1),[h,f]=k.useState(null),[g,m]=k.useState("");return k.useEffect(()=>{let w=!1;const x=setTimeout(async()=>{u(!0),f(null);try{const y=new URLSearchParams({start:"0",limit:String(Rh),sort:"createdAt",order:"desc"});g.trim()&&y.set("filters[title][$containsi]",g.trim());const{data:$}=await t(`/${ri}/mux-asset?${y.toString()}`);if(w)return;a($?.items??[]),l($?.totalCount??0),r(!0)}catch{if(w)return;r(!1),f("Could not load Mux assets.")}finally{w||u(!1)}},g?300:0);return()=>{w=!0,clearTimeout(x)}},[e,g,t]),{available:n,assets:s,totalCount:i,loading:c,error:h,search:m,query:g}},Fh=/^[A-Za-z0-9]{20,}$/,Dh=/stream\.mux\.com\/([A-Za-z0-9]+)(?:\.m3u8)?/i,Ah=/(?:embed\.api\.video\/vod|vod\.api\.video)\/([A-Za-z0-9]+)/i,_h=/res\.cloudinary\.com\/([^/]+)\/video\/upload\/(?:.*\/)?([^/.]+)\.[a-z0-9]+/i,oi={stream:"https://stream.mux.com",image:"https://image.mux.com"},zr=e=>`${oi.stream}/${e}.m3u8`,Hr=e=>`${oi.image}/${e}/thumbnail.jpg`,Nh=e=>Fh.test(e.trim()),Ph=e=>{const t=e.trim();if(!t)return null;if(!t.includes("/")&&Nh(t))return{provider:"mux",url:zr(t),playbackId:t,poster:Hr(t)};const n=t.match(Dh);if(n)return{provider:"mux",url:zr(n[1]),playbackId:n[1],poster:Hr(n[1])};const r=t.match(Ah);if(r)return{provider:"api-video",url:t,playbackId:r[1]};const s=t.match(_h);if(s){const[,a,i]=s;return{provider:"cloudinary",url:t,playbackId:i,poster:`https://res.cloudinary.com/${a}/video/upload/${i}.jpg`}}return{provider:"custom",url:t}},si=e=>/\.(m3u8|mpd)(\?|$)/i.test(e),Ur={local:"Media Library",mux:"Mux","api-video":"api.video",cloudinary:"Cloudinary",custom:"Direct URL"},Lh=e=>e?e.startsWith("/")?`${window.strapi.backendURL}${e}`:e:"",Oh=e=>e.replace(/\.[^/.]+$/,""),ai=e=>{if(!e||e<=0)return"";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(n<10&&r>0?1:0)} ${t[r]}`},ii={autoplay:!1,loop:!1,muted:!1,controls:!0},zh=b.styled(p.Modal.Content)`
1136
+ `,Mh=["platform","url","embedCode","oembed","alignment","caption"],Bh=e=>{const n=e.pluginOptions?.socialPlatforms;return Array.isArray(n)&&n.length>0?n.filter(r=>Hr.includes(r)):Hr},Ih=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("SocialEmbed"),i=R.useSelected(),l=(r.url??"").trim()!==""||(r.embedCode??"").trim()!=="",[c,u]=k.useState(!l&&!a),[h,f]=k.useState(!1),g=yh(r);k.useEffect(()=>{f(!1)},[g?.src]);const m=jt[r.platform]??jt.twitter,x=r.alignment??"center",y=x==="left"?"flex-start":x==="right"?"flex-end":"center",v=()=>{try{return R.ReactEditor.findPath(s,r)}catch{return null}},$=()=>{const S=v();S&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:S}),d.Transforms.unsetNodes(s,Mh,{at:S})):d.Transforms.removeNodes(s,{at:S}))},E=S=>{const T=v();if(T){d.Transforms.setNodes(s,S,{at:T});const j=["embedCode","caption","oembed"].filter(w=>S[w]===void 0||S[w]==="");j.length&&d.Transforms.unsetNodes(s,j,{at:T})}u(!1),R.ReactEditor.focus(s)},C=()=>{$(),u(!1),R.ReactEditor.focus(s)},I=()=>{l||$(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(wh,{style:{display:"flex",justifyContent:y},contentEditable:!1,children:o.jsxs(kh,{$selected:i,$accent:m.color,onMouseDown:S=>{S.preventDefault(),a||u(!0)},children:[o.jsxs(jh,{alignItems:"center",children:[o.jsx($h,{$color:m.color,children:m.icon}),o.jsx(p.Typography,{fontWeight:"bold",children:r.oembed?.author||r.oembed?.providerName||m.label})]}),g?o.jsx(Th,{type:"button",onMouseDown:S=>{S.preventDefault(),S.stopPropagation(),f(T=>!T)},children:h?"Hide live post":"Show live post"}):null,g&&h?o.jsxs(o.Fragment,{children:[o.jsx(Ch,{src:g.src,height:g.height,title:`${m.label} post preview`,loading:"lazy",referrerPolicy:"strict-origin-when-cross-origin",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation"}),o.jsxs(Sh,{children:["Blank? Add ",mh[r.platform]," to `frame-src` in config/middlewares.ts."]})]}):null,!h&&r.oembed?.thumbnailUrl?o.jsx(Eh,{src:r.oembed.thumbnailUrl,alt:""}):null,r.oembed?.title?o.jsx(p.Typography,{variant:"pi",textColor:"neutral700",children:r.oembed.title}):null,r.url?o.jsx(gs,{children:r.url}):r.embedCode?o.jsx(gs,{children:"Custom embed code"}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]})}),c&&!a?o.jsx(gh,{open:!0,element:r,enabledPlatforms:Bh(s),onSave:E,onRemove:C,onClose:I}):null]})},Rh=e=>{const{isVoid:t}=e;return e.isVoid=n=>id(n)?!0:t(n),e},Fh={"social-embed":{renderElement:e=>o.jsx(Ih,{...e}),icon:xh,label:{id:"components.Blocks.blocks.social",defaultMessage:"Social embed"},matchNode:e=>e.type==="social-embed",isInBlocksSelector:!0,handleConvert(e){vh(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})},snippets:["[social]"]}},si="mux-video-uploader",Dh=e=>`${window.strapi.backendURL}/${si}/thumbnail/${e}`,Ah=12,_h=e=>{const{get:t}=Xe.useFetchClient(),[n,r]=k.useState(null),[s,a]=k.useState([]),[i,l]=k.useState(0),[c,u]=k.useState(!1),[h,f]=k.useState(null),[g,m]=k.useState("");return k.useEffect(()=>{let x=!1;const y=setTimeout(async()=>{u(!0),f(null);try{const v=new URLSearchParams({start:"0",limit:String(Ah),sort:"createdAt",order:"desc"});g.trim()&&v.set("filters[title][$containsi]",g.trim());const{data:$}=await t(`/${si}/mux-asset?${v.toString()}`);if(x)return;a($?.items??[]),l($?.totalCount??0),r(!0)}catch{if(x)return;r(!1),f("Could not load Mux assets.")}finally{x||u(!1)}},g?300:0);return()=>{x=!0,clearTimeout(y)}},[e,g,t]),{available:n,assets:s,totalCount:i,loading:c,error:h,search:m,query:g}},Nh=/^[A-Za-z0-9]{20,}$/,Ph=/stream\.mux\.com\/([A-Za-z0-9]+)(?:\.m3u8)?/i,Lh=/(?:embed\.api\.video\/vod|vod\.api\.video)\/([A-Za-z0-9]+)/i,Oh=/res\.cloudinary\.com\/([^/]+)\/video\/upload\/(?:.*\/)?([^/.]+)\.[a-z0-9]+/i,ai={stream:"https://stream.mux.com",image:"https://image.mux.com"},Ur=e=>`${ai.stream}/${e}.m3u8`,Wr=e=>`${ai.image}/${e}/thumbnail.jpg`,zh=e=>Nh.test(e.trim()),Hh=e=>{const t=e.trim();if(!t)return null;if(!t.includes("/")&&zh(t))return{provider:"mux",url:Ur(t),playbackId:t,poster:Wr(t)};const n=t.match(Ph);if(n)return{provider:"mux",url:Ur(n[1]),playbackId:n[1],poster:Wr(n[1])};const r=t.match(Lh);if(r)return{provider:"api-video",url:t,playbackId:r[1]};const s=t.match(Oh);if(s){const[,a,i]=s;return{provider:"cloudinary",url:t,playbackId:i,poster:`https://res.cloudinary.com/${a}/video/upload/${i}.jpg`}}return{provider:"custom",url:t}},ii=e=>/\.(m3u8|mpd)(\?|$)/i.test(e),Kr={local:"Media Library",mux:"Mux","api-video":"api.video",cloudinary:"Cloudinary",custom:"Direct URL"},Uh=e=>e?e.startsWith("/")?`${window.strapi.backendURL}${e}`:e:"",Wh=e=>e.replace(/\.[^/.]+$/,""),li=e=>{if(!e||e<=0)return"";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(n<10&&r>0?1:0)} ${t[r]}`},ci={autoplay:!1,loop:!1,muted:!1,controls:!0},Kh=b.styled(p.Modal.Content)`
1137
1137
  max-width: 720px;
1138
1138
  width: 92vw;
1139
- `,Hh=b.styled.div`
1139
+ `,Gh=b.styled.div`
1140
1140
  display: flex;
1141
1141
  flex-direction: column;
1142
1142
  gap: ${({theme:e})=>e.spaces[4]};
@@ -1154,7 +1154,7 @@
1154
1154
  font-size: 14px;
1155
1155
  color: ${({theme:e})=>e.colors.neutral800};
1156
1156
  background: ${({theme:e})=>e.colors.neutral0};
1157
- `,Uh=b.styled.select`
1157
+ `,Vh=b.styled.select`
1158
1158
  min-height: 40px;
1159
1159
  padding: 0 ${({theme:e})=>e.spaces[3]};
1160
1160
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
@@ -1162,13 +1162,13 @@
1162
1162
  font-size: 14px;
1163
1163
  color: ${({theme:e})=>e.colors.neutral800};
1164
1164
  background: ${({theme:e})=>e.colors.neutral0};
1165
- `,Wh=b.styled.div`
1165
+ `,qh=b.styled.div`
1166
1166
  display: inline-flex;
1167
1167
  align-self: flex-start;
1168
1168
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
1169
1169
  border-radius: ${({theme:e})=>e.borderRadius};
1170
1170
  overflow: hidden;
1171
- `,Kh=b.styled.button`
1171
+ `,Xh=b.styled.button`
1172
1172
  min-width: 84px;
1173
1173
  min-height: 34px;
1174
1174
  padding: 0 ${({theme:e})=>e.spaces[3]};
@@ -1195,13 +1195,13 @@
1195
1195
  outline: 2px solid ${({theme:e})=>e.colors.primary600};
1196
1196
  outline-offset: -2px;
1197
1197
  }
1198
- `,Cn=b.styled.label`
1198
+ `,Sn=b.styled.label`
1199
1199
  display: flex;
1200
1200
  align-items: center;
1201
1201
  gap: ${({theme:e})=>e.spaces[2]};
1202
1202
  cursor: pointer;
1203
1203
  user-select: none;
1204
- `,Gh=b.styled.div`
1204
+ `,Yh=b.styled.div`
1205
1205
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
1206
1206
  border-radius: ${({theme:e})=>e.borderRadius};
1207
1207
  background: ${({theme:e})=>e.colors.neutral100};
@@ -1209,7 +1209,7 @@
1209
1209
  display: flex;
1210
1210
  flex-direction: column;
1211
1211
  gap: ${({theme:e})=>e.spaces[2]};
1212
- `,Vh=b.styled.div`
1212
+ `,Zh=b.styled.div`
1213
1213
  display: flex;
1214
1214
  align-items: center;
1215
1215
  gap: ${({theme:e})=>e.spaces[2]};
@@ -1224,7 +1224,7 @@
1224
1224
  height: 1px;
1225
1225
  background: ${({theme:e})=>e.colors.neutral200};
1226
1226
  }
1227
- `,qh=b.styled.div`
1227
+ `,Jh=b.styled.div`
1228
1228
  width: 100%;
1229
1229
  aspect-ratio: ${({$ratio:e})=>e};
1230
1230
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -1238,17 +1238,17 @@
1238
1238
  object-fit: contain;
1239
1239
  display: block;
1240
1240
  }
1241
- `,Vt=b.styled(p.Typography)`
1241
+ `,qt=b.styled(p.Typography)`
1242
1242
  color: ${({theme:e})=>e.colors.neutral500};
1243
- `,Xh=b.styled(p.Typography)`
1243
+ `,Qh=b.styled(p.Typography)`
1244
1244
  color: ${({theme:e})=>e.colors.danger600};
1245
- `,Yh=b.styled.div`
1245
+ `,ef=b.styled.div`
1246
1246
  display: grid;
1247
1247
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
1248
1248
  gap: ${({theme:e})=>e.spaces[2]};
1249
1249
  max-height: 260px;
1250
1250
  overflow: auto;
1251
- `,Zh=b.styled.button`
1251
+ `,tf=b.styled.button`
1252
1252
  display: flex;
1253
1253
  flex-direction: column;
1254
1254
  gap: ${({theme:e})=>e.spaces[1]};
@@ -1273,16 +1273,16 @@
1273
1273
  display: block;
1274
1274
  background: ${({theme:e})=>e.colors.neutral800};
1275
1275
  }
1276
- `,Jh=b.styled.div`
1276
+ `,nf=b.styled.div`
1277
1277
  padding: ${({theme:e})=>e.spaces[2]};
1278
1278
  display: flex;
1279
1279
  flex-direction: column;
1280
1280
  gap: 2px;
1281
- `,Be=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),Qh=["left","center","right","none"],ef=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),i=Xe.useStrapiApp("VideoEditorModal",j=>j.components),[l,c]=k.useState({provider:t.provider??"local",assetId:t.assetId,playbackId:t.playbackId,url:t.url??"",file:t.file,poster:t.poster,title:t.title,caption:t.caption,transcript:t.transcript,player:t.player??ii,alignment:t.alignment??"center",aspectRatio:t.aspectRatio??"16:9",customAspectRatio:t.customAspectRatio}),[u,h]=k.useState(null),[f,g]=k.useState(!1),m=Bh(!0),w=j=>c(v=>({...v,...j})),x=j=>c(v=>({...v,player:{...v.player,...j}})),y=i?.["media-library"],$=j=>{const v=j[0],I=u;if(h(null),!v)return;const A=Lh(v.url);if(I==="poster"){w({poster:A});return}if(I==="transcript"){w({transcript:A});return}const N=typeof v.size=="number"?v.size:void 0,F=v.name??"video";c(_=>({..._,provider:"local",url:A,playbackId:void 0,assetId:void 0,file:{id:typeof v.id=="number"?v.id:void 0,name:F,ext:v.ext??void 0,mime:v.mime??void 0,size:N!==void 0?Math.round(N*1024):void 0,duration:typeof v.duration=="number"?v.duration:void 0,provider:v.provider??void 0},title:_.title?.trim()?_.title:Oh(F)}))},E=j=>{const v=Ph(j);if(!v){w({url:"",provider:"local",playbackId:void 0,file:void 0});return}c(I=>({...I,provider:v.provider,url:v.url,playbackId:v.playbackId,poster:I.poster??v.poster,file:void 0}))},S=j=>{if(!j.playback_id)return;const v=j.aspect_ratio;c(I=>({...I,provider:"mux",assetId:j.asset_id,playbackId:j.playback_id,url:zr(j.playback_id),poster:Hr(j.playback_id),file:void 0,title:I.title?.trim()?I.title:j.title,aspectRatio:v&&Lr.includes(v)?v:I.aspectRatio})),g(!1)},R=!!l.url?.trim(),C=R&&si(l.url),M=l.aspectRatio==="custom"?l.customAspectRatio||"16 / 9":Yn(l.aspectRatio);return u&&y?o.jsx(y,{allowedTypes:u==="video"?["videos"]:u==="poster"?["images"]:["files"],onClose:()=>h(null),onSelectAssets:$}):o.jsx(p.Modal.Root,{open:e,onOpenChange:j=>{j||s()},children:o.jsxs(zh,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.video.modal.title",defaultMessage:"Video"})})}),o.jsxs(Hh,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.source",defaultMessage:"Video source"})}),o.jsxs(Gh,{children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",justifyContent:"space-between",children:[o.jsx(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:R?o.jsxs(o.Fragment,{children:[o.jsx(p.Typography,{fontWeight:"bold",variant:"pi",children:l.file?.name||l.playbackId||l.url}),o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[Ur[l.provider],l.file?.size?` · ${ai(l.file.size)}`:""]})]}):o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a({id:"components.Blocks.video.source.empty",defaultMessage:"No video selected yet."})})}),o.jsxs(p.Flex,{gap:2,children:[m.available?o.jsx(p.Button,{type:"button",variant:"secondary",onClick:()=>g(j=>!j),children:a({id:"components.Blocks.video.action.browseMux",defaultMessage:"Mux"})}):null,o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!y,onClick:()=>h("video"),children:a({id:"components.Blocks.video.action.browse",defaultMessage:"Media Library"})})]})]}),f&&m.available?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Qe,{type:"search",placeholder:a({id:"components.Blocks.video.mux.search",defaultMessage:"Search Mux assets by title…"}),value:m.query,onChange:j=>m.search(j.target.value)}),m.error?o.jsx(Xh,{variant:"pi",children:m.error}):null,m.loading?o.jsx(Vt,{variant:"pi",children:a({id:"components.Blocks.video.mux.loading",defaultMessage:"Loading…"})}):m.assets.length===0?o.jsx(Vt,{variant:"pi",children:a({id:"components.Blocks.video.mux.empty",defaultMessage:"No Mux assets found."})}):o.jsx(Yh,{children:m.assets.map(j=>{const v=!j.playback_id||!j.isReady||j.signed;return o.jsxs(Zh,{type:"button",disabled:v,$selected:l.playbackId===j.playback_id,onClick:()=>S(j),children:[j.playback_id?o.jsx("img",{src:Ih(j.playback_id),alt:"",loading:"lazy"}):null,o.jsxs(Jh,{children:[o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",children:j.title}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:j.signed?a({id:"components.Blocks.video.mux.signed",defaultMessage:"Signed playback — not supported"}):j.isReady?j.aspect_ratio||"":a({id:"components.Blocks.video.mux.notReady",defaultMessage:"Still processing"})})]})]},j.documentId)})})]}):null,o.jsx(Vh,{children:a({id:"components.Blocks.video.source.or",defaultMessage:"or"})}),o.jsx(Qe,{type:"text",placeholder:"https://stream.mux.com/…m3u8, a Mux playback ID, or https://example.com/video.mp4",value:l.file?.id?"":l.url??"",onChange:j=>E(j.target.value)}),o.jsx(Vt,{variant:"pi",children:a({id:"components.Blocks.video.hint.source",defaultMessage:"Mux, api.video and Cloudinary URLs are detected automatically. A bare Mux playback ID fills in the stream URL and poster for you. For YouTube or Vimeo, use the Embed block instead."})})]})]}),R?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.preview",defaultMessage:"Preview"})}),o.jsx(qh,{$ratio:M,children:C?l.poster?o.jsx("img",{src:l.poster,alt:a({id:"components.Blocks.video.preview.posterAlt",defaultMessage:"Video poster"})}):null:o.jsx("video",{src:l.url,poster:l.poster,controls:!0,preload:"metadata"},l.url)}),C?o.jsx(Vt,{variant:"pi",children:a({id:"components.Blocks.video.hint.streaming",defaultMessage:"HLS/DASH streams need a streaming-capable player, so the editor shows the poster frame instead. Playback works on the frontend via the provider player."})}):null]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.poster",defaultMessage:"Poster image (optional)"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Qe,{type:"url",placeholder:"https://…/thumbnail.jpg",value:l.poster??"",onChange:j=>w({poster:j.target.value})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!y,onClick:()=>h("poster"),children:a({id:"components.Blocks.video.action.browsePoster",defaultMessage:"Browse"})})]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.title",defaultMessage:"Title (optional)"})}),o.jsx(Qe,{type:"text",value:l.title??"",onChange:j=>w({title:j.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(Qe,{type:"text",value:l.caption??"",onChange:j=>w({caption:j.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.player",defaultMessage:"Player settings"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsxs(Cn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.controls,onChange:j=>x({controls:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.controls",defaultMessage:"Show controls"})})]}),o.jsxs(Cn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.autoplay,onChange:j=>x({autoplay:j.target.checked,...j.target.checked?{muted:!0}:{}})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.autoplay",defaultMessage:"Autoplay"})})]}),o.jsxs(Cn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.muted,onChange:j=>x({muted:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.muted",defaultMessage:"Muted"})})]}),o.jsxs(Cn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.loop,onChange:j=>x({loop:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.loop",defaultMessage:"Loop"})})]})]}),l.player.autoplay&&!l.player.muted?o.jsx(Vt,{variant:"pi",children:a({id:"components.Blocks.video.player.autoplayWarning",defaultMessage:"Most browsers block autoplay unless the video is muted."})}):null]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.aspectRatio",defaultMessage:"Aspect ratio"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",wrap:"wrap",children:[o.jsxs(Uh,{value:l.aspectRatio,onChange:j=>w({aspectRatio:j.target.value}),children:[Lr.map(j=>o.jsx("option",{value:j,children:j},j)),o.jsx("option",{value:"custom",children:a({id:"components.Blocks.embed.aspectRatio.custom",defaultMessage:"Custom"})})]}),l.aspectRatio==="custom"?o.jsx(Qe,{type:"text",style:{maxWidth:160},placeholder:"3 / 2",value:l.customAspectRatio??"",onChange:j=>w({customAspectRatio:j.target.value})}):null]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.alignment",defaultMessage:"Alignment"})}),o.jsx(Wh,{children:Qh.map(j=>o.jsx(Kh,{type:"button",$active:l.alignment===j,onClick:()=>w({alignment:j}),children:j},j))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Be,{children:a({id:"components.Blocks.video.field.transcript",defaultMessage:"Captions / transcript (WebVTT, optional)"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Qe,{type:"url",placeholder:"https://…/captions.vtt",value:l.transcript??"",onChange:j=>w({transcript:j.target.value})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!y,onClick:()=>h("transcript"),children:a({id:"components.Blocks.video.action.browseTranscript",defaultMessage:"Browse"})})]})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!R,onClick:()=>n(l),children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},hs=()=>({type:"video",provider:"local",url:"",player:{...ii},alignment:"center",aspectRatio:"16:9",children:[{type:"text",text:""}]}),li=e=>{const t=he(e,hs());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,hs(),{at:t,select:!0}))},tf=b.styled.div`
1281
+ `,Re=({children:e})=>o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral700",children:e}),rf=["left","center","right","none"],of=({open:e,element:t,onSave:n,onRemove:r,onClose:s})=>{const{formatMessage:a}=O.useIntl(),i=Xe.useStrapiApp("VideoEditorModal",j=>j.components),[l,c]=k.useState({provider:t.provider??"local",assetId:t.assetId,playbackId:t.playbackId,url:t.url??"",file:t.file,poster:t.poster,title:t.title,caption:t.caption,transcript:t.transcript,player:t.player??ci,alignment:t.alignment??"center",aspectRatio:t.aspectRatio??"16:9",customAspectRatio:t.customAspectRatio}),[u,h]=k.useState(null),[f,g]=k.useState(!1),m=_h(!0),x=j=>c(w=>({...w,...j})),y=j=>c(w=>({...w,player:{...w.player,...j}})),v=i?.["media-library"],$=j=>{const w=j[0],B=u;if(h(null),!w)return;const A=Uh(w.url);if(B==="poster"){x({poster:A});return}if(B==="transcript"){x({transcript:A});return}const N=typeof w.size=="number"?w.size:void 0,F=w.name??"video";c(_=>({..._,provider:"local",url:A,playbackId:void 0,assetId:void 0,file:{id:typeof w.id=="number"?w.id:void 0,name:F,ext:w.ext??void 0,mime:w.mime??void 0,size:N!==void 0?Math.round(N*1024):void 0,duration:typeof w.duration=="number"?w.duration:void 0,provider:w.provider??void 0},title:_.title?.trim()?_.title:Wh(F)}))},E=j=>{const w=Hh(j);if(!w){x({url:"",provider:"local",playbackId:void 0,file:void 0});return}c(B=>({...B,provider:w.provider,url:w.url,playbackId:w.playbackId,poster:B.poster??w.poster,file:void 0}))},C=j=>{if(!j.playback_id)return;const w=j.aspect_ratio;c(B=>({...B,provider:"mux",assetId:j.asset_id,playbackId:j.playback_id,url:Ur(j.playback_id),poster:Wr(j.playback_id),file:void 0,title:B.title?.trim()?B.title:j.title,aspectRatio:w&&zr.includes(w)?w:B.aspectRatio})),g(!1)},I=!!l.url?.trim(),S=I&&ii(l.url),T=l.aspectRatio==="custom"?l.customAspectRatio||"16 / 9":Jn(l.aspectRatio);return u&&v?o.jsx(v,{allowedTypes:u==="video"?["videos"]:u==="poster"?["images"]:["files"],onClose:()=>h(null),onSelectAssets:$}):o.jsx(p.Modal.Root,{open:e,onOpenChange:j=>{j||s()},children:o.jsxs(Kh,{children:[o.jsx(p.Modal.Header,{children:o.jsx(p.Modal.Title,{children:a({id:"components.Blocks.video.modal.title",defaultMessage:"Video"})})}),o.jsxs(Gh,{children:[o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.source",defaultMessage:"Video source"})}),o.jsxs(Yh,{children:[o.jsxs(p.Flex,{gap:2,alignItems:"center",justifyContent:"space-between",children:[o.jsx(p.Flex,{direction:"column",gap:1,alignItems:"flex-start",children:I?o.jsxs(o.Fragment,{children:[o.jsx(p.Typography,{fontWeight:"bold",variant:"pi",children:l.file?.name||l.playbackId||l.url}),o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[Kr[l.provider],l.file?.size?` · ${li(l.file.size)}`:""]})]}):o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:a({id:"components.Blocks.video.source.empty",defaultMessage:"No video selected yet."})})}),o.jsxs(p.Flex,{gap:2,children:[m.available?o.jsx(p.Button,{type:"button",variant:"secondary",onClick:()=>g(j=>!j),children:a({id:"components.Blocks.video.action.browseMux",defaultMessage:"Mux"})}):null,o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!v,onClick:()=>h("video"),children:a({id:"components.Blocks.video.action.browse",defaultMessage:"Media Library"})})]})]}),f&&m.available?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Qe,{type:"search",placeholder:a({id:"components.Blocks.video.mux.search",defaultMessage:"Search Mux assets by title…"}),value:m.query,onChange:j=>m.search(j.target.value)}),m.error?o.jsx(Qh,{variant:"pi",children:m.error}):null,m.loading?o.jsx(qt,{variant:"pi",children:a({id:"components.Blocks.video.mux.loading",defaultMessage:"Loading…"})}):m.assets.length===0?o.jsx(qt,{variant:"pi",children:a({id:"components.Blocks.video.mux.empty",defaultMessage:"No Mux assets found."})}):o.jsx(ef,{children:m.assets.map(j=>{const w=!j.playback_id||!j.isReady||j.signed;return o.jsxs(tf,{type:"button",disabled:w,$selected:l.playbackId===j.playback_id,onClick:()=>C(j),children:[j.playback_id?o.jsx("img",{src:Dh(j.playback_id),alt:"",loading:"lazy"}):null,o.jsxs(nf,{children:[o.jsx(p.Typography,{variant:"pi",fontWeight:"bold",children:j.title}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral500",children:j.signed?a({id:"components.Blocks.video.mux.signed",defaultMessage:"Signed playback — not supported"}):j.isReady?j.aspect_ratio||"":a({id:"components.Blocks.video.mux.notReady",defaultMessage:"Still processing"})})]})]},j.documentId)})})]}):null,o.jsx(Zh,{children:a({id:"components.Blocks.video.source.or",defaultMessage:"or"})}),o.jsx(Qe,{type:"text",placeholder:"https://stream.mux.com/…m3u8, a Mux playback ID, or https://example.com/video.mp4",value:l.file?.id?"":l.url??"",onChange:j=>E(j.target.value)}),o.jsx(qt,{variant:"pi",children:a({id:"components.Blocks.video.hint.source",defaultMessage:"Mux, api.video and Cloudinary URLs are detected automatically. A bare Mux playback ID fills in the stream URL and poster for you. For YouTube or Vimeo, use the Embed block instead."})})]})]}),I?o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.preview",defaultMessage:"Preview"})}),o.jsx(Jh,{$ratio:T,children:S?l.poster?o.jsx("img",{src:l.poster,alt:a({id:"components.Blocks.video.preview.posterAlt",defaultMessage:"Video poster"})}):null:o.jsx("video",{src:l.url,poster:l.poster,controls:!0,preload:"metadata"},l.url)}),S?o.jsx(qt,{variant:"pi",children:a({id:"components.Blocks.video.hint.streaming",defaultMessage:"HLS/DASH streams need a streaming-capable player, so the editor shows the poster frame instead. Playback works on the frontend via the provider player."})}):null]}):null,o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.poster",defaultMessage:"Poster image (optional)"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Qe,{type:"url",placeholder:"https://…/thumbnail.jpg",value:l.poster??"",onChange:j=>x({poster:j.target.value})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!v,onClick:()=>h("poster"),children:a({id:"components.Blocks.video.action.browsePoster",defaultMessage:"Browse"})})]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.title",defaultMessage:"Title (optional)"})}),o.jsx(Qe,{type:"text",value:l.title??"",onChange:j=>x({title:j.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.caption",defaultMessage:"Caption (optional)"})}),o.jsx(Qe,{type:"text",value:l.caption??"",onChange:j=>x({caption:j.target.value})})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.player",defaultMessage:"Player settings"})}),o.jsxs(p.Flex,{gap:4,wrap:"wrap",children:[o.jsxs(Sn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.controls,onChange:j=>y({controls:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.controls",defaultMessage:"Show controls"})})]}),o.jsxs(Sn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.autoplay,onChange:j=>y({autoplay:j.target.checked,...j.target.checked?{muted:!0}:{}})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.autoplay",defaultMessage:"Autoplay"})})]}),o.jsxs(Sn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.muted,onChange:j=>y({muted:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.muted",defaultMessage:"Muted"})})]}),o.jsxs(Sn,{children:[o.jsx("input",{type:"checkbox",checked:l.player.loop,onChange:j=>y({loop:j.target.checked})}),o.jsx(p.Typography,{variant:"pi",children:a({id:"components.Blocks.video.player.loop",defaultMessage:"Loop"})})]})]}),l.player.autoplay&&!l.player.muted?o.jsx(qt,{variant:"pi",children:a({id:"components.Blocks.video.player.autoplayWarning",defaultMessage:"Most browsers block autoplay unless the video is muted."})}):null]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.aspectRatio",defaultMessage:"Aspect ratio"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",wrap:"wrap",children:[o.jsxs(Vh,{value:l.aspectRatio,onChange:j=>x({aspectRatio:j.target.value}),children:[zr.map(j=>o.jsx("option",{value:j,children:j},j)),o.jsx("option",{value:"custom",children:a({id:"components.Blocks.embed.aspectRatio.custom",defaultMessage:"Custom"})})]}),l.aspectRatio==="custom"?o.jsx(Qe,{type:"text",style:{maxWidth:160},placeholder:"3 / 2",value:l.customAspectRatio??"",onChange:j=>x({customAspectRatio:j.target.value})}):null]})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.alignment",defaultMessage:"Alignment"})}),o.jsx(qh,{children:rf.map(j=>o.jsx(Xh,{type:"button",$active:l.alignment===j,onClick:()=>x({alignment:j}),children:j},j))})]}),o.jsxs(p.Flex,{direction:"column",gap:2,alignItems:"stretch",children:[o.jsx(Re,{children:a({id:"components.Blocks.video.field.transcript",defaultMessage:"Captions / transcript (WebVTT, optional)"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(Qe,{type:"url",placeholder:"https://…/captions.vtt",value:l.transcript??"",onChange:j=>x({transcript:j.target.value})}),o.jsx(p.Button,{type:"button",variant:"secondary",disabled:!v,onClick:()=>h("transcript"),children:a({id:"components.Blocks.video.action.browseTranscript",defaultMessage:"Browse"})})]})]})]}),o.jsxs(p.Modal.Footer,{children:[o.jsx(p.Button,{variant:"danger-light",type:"button",onClick:r,children:a({id:"components.Blocks.popover.remove",defaultMessage:"Remove"})}),o.jsxs(p.Flex,{gap:2,marginLeft:"auto",children:[o.jsx(p.Button,{variant:"tertiary",type:"button",onClick:s,children:a({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{type:"button",disabled:!I,onClick:()=>n(l),children:a({id:"global.save",defaultMessage:"Save"})})]})]})]})})},ms=()=>({type:"video",provider:"local",url:"",player:{...ci},alignment:"center",aspectRatio:"16:9",children:[{type:"text",text:""}]}),di=e=>{const t=he(e,ms());t&&(d.Transforms.removeNodes(e,{at:t}),d.Transforms.insertNodes(e,ms(),{at:t,select:!0}))},sf=b.styled.div`
1282
1282
  margin: ${({theme:e})=>e.spaces[2]} 0;
1283
1283
  display: flex;
1284
1284
  justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
1285
- `,nf=b.styled.div`
1285
+ `,af=b.styled.div`
1286
1286
  display: flex;
1287
1287
  flex-direction: column;
1288
1288
  gap: ${({theme:e})=>e.spaces[2]};
@@ -1291,7 +1291,7 @@
1291
1291
  user-select: none;
1292
1292
  border-radius: ${({theme:e})=>e.borderRadius};
1293
1293
  box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
1294
- `,rf=b.styled.div`
1294
+ `,lf=b.styled.div`
1295
1295
  position: relative;
1296
1296
  width: 100%;
1297
1297
  aspect-ratio: ${({$ratio:e})=>e};
@@ -1306,7 +1306,7 @@
1306
1306
  object-fit: contain;
1307
1307
  display: block;
1308
1308
  }
1309
- `,of=b.styled.div`
1309
+ `,cf=b.styled.div`
1310
1310
  position: absolute;
1311
1311
  top: 8px;
1312
1312
  left: 8px;
@@ -1317,13 +1317,13 @@
1317
1317
  font-size: 12px;
1318
1318
  font-weight: 600;
1319
1319
  pointer-events: none;
1320
- `,sf=b.styled(p.Flex)`
1320
+ `,df=b.styled(p.Flex)`
1321
1321
  position: absolute;
1322
1322
  inset: 0;
1323
1323
  align-items: center;
1324
1324
  justify-content: center;
1325
1325
  pointer-events: none;
1326
- `,af=b.styled.div`
1326
+ `,uf=b.styled.div`
1327
1327
  width: 64px;
1328
1328
  height: 64px;
1329
1329
  border-radius: 50%;
@@ -1342,24 +1342,24 @@
1342
1342
  border-color: transparent transparent transparent white;
1343
1343
  margin-left: 4px;
1344
1344
  }
1345
- `,lf=b.styled(p.Flex)`
1345
+ `,pf=b.styled(p.Flex)`
1346
1346
  width: 100%;
1347
1347
  height: 100%;
1348
1348
  color: ${({theme:e})=>e.colors.neutral200};
1349
1349
  font-size: 14px;
1350
- `,cf=b.styled(p.Flex)`
1350
+ `,hf=b.styled(p.Flex)`
1351
1351
  width: min(100%, 640px);
1352
1352
  padding: ${({theme:e})=>e.spaces[4]};
1353
1353
  border: 1px dashed ${({theme:e})=>e.colors.neutral300};
1354
1354
  border-radius: ${({theme:e})=>e.borderRadius};
1355
1355
  background: ${({theme:e})=>e.colors.neutral100};
1356
1356
  color: ${({theme:e})=>e.colors.neutral600};
1357
- `,df=["provider","assetId","playbackId","url","file","poster","title","caption","transcript","player","alignment","aspectRatio","customAspectRatio"],uf=["assetId","playbackId","file","poster","title","caption","transcript","customAspectRatio"],pf=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Video"),i=B.useSelected(),l=(r.url??"").trim()!=="",[c,u]=k.useState(!l&&!a),h=r.alignment??"center",f=r.aspectRatio==="custom"?r.customAspectRatio||"16 / 9":Yn(r.aspectRatio),g=l&&si(r.url),m=()=>{try{return B.ReactEditor.findPath(s,r)}catch{return null}},w=()=>{const E=m();E&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:E}),d.Transforms.unsetNodes(s,df,{at:E})):d.Transforms.removeNodes(s,{at:E}))},x=E=>{const S=m();if(S){d.Transforms.setNodes(s,E,{at:S});const R=uf.filter(C=>E[C]===void 0||E[C]==="");R.length&&d.Transforms.unsetNodes(s,R,{at:S})}u(!1),B.ReactEditor.focus(s)},y=()=>{w(),u(!1),B.ReactEditor.focus(s)},$=()=>{l||w(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(tf,{$align:h,contentEditable:!1,children:l?o.jsxs(nf,{$selected:i,$full:h==="none",onMouseDown:E=>{E.target.closest("video")||(E.preventDefault(),a||u(!0))},children:[o.jsxs(rf,{$ratio:f,children:[g?o.jsxs(o.Fragment,{children:[r.poster?o.jsx("img",{src:r.poster,alt:r.title||"Video poster"}):o.jsx(lf,{alignItems:"center",justifyContent:"center",children:Ur[r.provider]??"Video"}),o.jsx(sf,{children:o.jsx(af,{})})]}):o.jsx("video",{src:r.url,poster:r.poster,controls:r.player?.controls??!0,loop:r.player?.loop??!1,muted:r.player?.muted??!1,preload:"metadata"},r.url),o.jsx(of,{children:Ur[r.provider]??"Video"})]}),r.file?.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[ai(r.file.size),r.file.mime?` · ${r.file.mime}`:""]}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]}):o.jsxs(cf,{alignItems:"center",gap:2,children:[o.jsx(D.Play,{}),o.jsx(p.Typography,{variant:"pi",children:"Video — click to choose a file, paste a URL, or add a Mux playback ID."})]})}),c&&!a?o.jsx(ef,{open:!0,element:r,onSave:x,onRemove:y,onClose:$}):null]})},hf=e=>{const{isVoid:t}=e;return e.isVoid=n=>sd(n)?!0:t(n),e},ff={video:{renderElement:e=>o.jsx(pf,{...e}),icon:D.Play,label:{id:"components.Blocks.blocks.video",defaultMessage:"Video"},matchNode:e=>e.type==="video",isInBlocksSelector:!0,handleConvert(e){li(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})}}},gf={paragraph:{renderElement:e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),o.jsx(p.Typography,{tag:"p",variant:"omega",...e.attributes,style:n,children:e.children})},icon:D.Paragraph,label:{id:"components.Blocks.blocks.text",defaultMessage:"Text"},matchNode:e=>e.type==="paragraph",isInBlocksSelector:!0,dragHandleTopMargin:"-2px",handleConvert(e){he(e,{type:"paragraph"})},handleEnterKey(e){if(!e.selection)return;const t=e.selection.anchor.path;d.Transforms.splitNodes(e,{always:!0});const n=d.Editor.above(e,{match:l=>!d.Editor.isEditor(l)&&"type"in l&&l.type!=="text"});if(!n)return;const[,r]=n,s=d.Editor.isEnd(e,e.selection.anchor,r),[a]=d.Editor.parent(e,e.selection.anchor.path);d.Transforms.removeNodes(e);const i=e.children.length-t[0]>1;d.Transforms.insertNodes(e,{type:"paragraph",children:s?[{type:"text",text:""}]:a.children},{at:i?[t[0]+1]:[e.children.length]}),d.Transforms.select(e,e.start([t[0]+1]))}}},mf=b.styled.blockquote.attrs({role:"blockquote"})`
1357
+ `,ff=["provider","assetId","playbackId","url","file","poster","title","caption","transcript","player","alignment","aspectRatio","customAspectRatio"],gf=["assetId","playbackId","file","poster","title","caption","transcript","customAspectRatio"],mf=({attributes:e,children:t,element:n})=>{const r=n,{editor:s,disabled:a}=P("Video"),i=R.useSelected(),l=(r.url??"").trim()!=="",[c,u]=k.useState(!l&&!a),h=r.alignment??"center",f=r.aspectRatio==="custom"?r.customAspectRatio||"16 / 9":Jn(r.aspectRatio),g=l&&ii(r.url),m=()=>{try{return R.ReactEditor.findPath(s,r)}catch{return null}},x=()=>{const E=m();E&&(s.children.length===1?(d.Transforms.setNodes(s,{type:"paragraph"},{at:E}),d.Transforms.unsetNodes(s,ff,{at:E})):d.Transforms.removeNodes(s,{at:E}))},y=E=>{const C=m();if(C){d.Transforms.setNodes(s,E,{at:C});const I=gf.filter(S=>E[S]===void 0||E[S]==="");I.length&&d.Transforms.unsetNodes(s,I,{at:C})}u(!1),R.ReactEditor.focus(s)},v=()=>{x(),u(!1),R.ReactEditor.focus(s)},$=()=>{l||x(),u(!1)};return o.jsxs(p.Box,{...e,children:[t,o.jsx(sf,{$align:h,contentEditable:!1,children:l?o.jsxs(af,{$selected:i,$full:h==="none",onMouseDown:E=>{E.target.closest("video")||(E.preventDefault(),a||u(!0))},children:[o.jsxs(lf,{$ratio:f,children:[g?o.jsxs(o.Fragment,{children:[r.poster?o.jsx("img",{src:r.poster,alt:r.title||"Video poster"}):o.jsx(pf,{alignItems:"center",justifyContent:"center",children:Kr[r.provider]??"Video"}),o.jsx(df,{children:o.jsx(uf,{})})]}):o.jsx("video",{src:r.url,poster:r.poster,controls:r.player?.controls??!0,loop:r.player?.loop??!1,muted:r.player?.muted??!1,preload:"metadata"},r.url),o.jsx(cf,{children:Kr[r.provider]??"Video"})]}),r.file?.size?o.jsxs(p.Typography,{variant:"pi",textColor:"neutral500",children:[li(r.file.size),r.file.mime?` · ${r.file.mime}`:""]}):null,r.caption?o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"semiBold",children:r.caption}):null]}):o.jsxs(hf,{alignItems:"center",gap:2,children:[o.jsx(D.Play,{}),o.jsx(p.Typography,{variant:"pi",children:"Video — click to choose a file, paste a URL, or add a Mux playback ID."})]})}),c&&!a?o.jsx(of,{open:!0,element:r,onSave:y,onRemove:v,onClose:$}):null]})},bf=e=>{const{isVoid:t}=e;return e.isVoid=n=>cd(n)?!0:t(n),e},yf={video:{renderElement:e=>o.jsx(mf,{...e}),icon:D.Play,label:{id:"components.Blocks.blocks.video",defaultMessage:"Video"},matchNode:e=>e.type==="video",isInBlocksSelector:!0,handleConvert(e){di(e)},handleBackspaceKey(e){e.children.length===1?d.Transforms.setNodes(e,{type:"paragraph"}):d.Transforms.removeNodes(e)},handleEnterKey(e){d.Transforms.insertNodes(e,{type:"paragraph",children:[{type:"text",text:""}]})}}},xf={paragraph:{renderElement:e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),o.jsx(p.Typography,{tag:"p",variant:"omega",...e.attributes,style:n,children:e.children})},icon:D.Paragraph,label:{id:"components.Blocks.blocks.text",defaultMessage:"Text"},matchNode:e=>e.type==="paragraph",isInBlocksSelector:!0,dragHandleTopMargin:"-2px",handleConvert(e){he(e,{type:"paragraph"})},handleEnterKey(e){if(!e.selection)return;const t=e.selection.anchor.path;d.Transforms.splitNodes(e,{always:!0});const n=d.Editor.above(e,{match:l=>!d.Editor.isEditor(l)&&"type"in l&&l.type!=="text"});if(!n)return;const[,r]=n,s=d.Editor.isEnd(e,e.selection.anchor,r),[a]=d.Editor.parent(e,e.selection.anchor.path);d.Transforms.removeNodes(e);const i=e.children.length-t[0]>1;d.Transforms.insertNodes(e,{type:"paragraph",children:s?[{type:"text",text:""}]:a.children},{at:i?[t[0]+1]:[e.children.length]}),d.Transforms.select(e,e.start([t[0]+1]))}}},vf=b.styled.blockquote.attrs({role:"blockquote"})`
1358
1358
  font-weight: ${({theme:e})=>e.fontWeights.regular};
1359
1359
  border-left: ${({theme:e})=>`${e.spaces[1]} solid ${e.colors.neutral200}`};
1360
1360
  padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[4]};
1361
1361
  color: ${({theme:e})=>e.colors.neutral600};
1362
- `,bf={quote:{renderElement:e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),o.jsx("div",{children:o.jsx(mf,{...e.attributes,style:n,children:e.children})})},icon:D.Quotes,label:{id:"components.Blocks.blocks.quote",defaultMessage:"Quote"},matchNode:e=>e.type==="quote",isInBlocksSelector:!0,handleConvert(e){he(e,{type:"quote"})},handleEnterKey(e){Ma(e)},snippets:[">"]}},xf=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("text",{x:"2.7",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"AA"})})},yf=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"5",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"X"}),o.jsx("text",{x:"15",y:"10",fontFamily:"Arial",fontSize:"8",fill:t[e],children:"1"})]})},vf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,fill:"none",children:[o.jsx("path",{d:"M7 7h7a5 5 0 0 1 0 10H7",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M10 4 7 7l3 3",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},wf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,fill:"none",children:[o.jsx("path",{d:"M17 7h-7a5 5 0 0 0 0 10h7",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M14 4l3 3-3 3",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},go=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M3 10h12M3 14h18M3 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},ci=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M6 10h12M3 14h18M6 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},di=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M9 10h12M3 14h18M9 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},kf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M3 10h18M3 14h18M3 18h18",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},jf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:[o.jsx("path",{d:"M11 6h10M11 12h10M11 18h10",stroke:r,strokeWidth:"2",strokeLinecap:"round"}),o.jsx("path",{d:"M5 4l-2 3h4L5 4zM5 20l-2-3h4l-2 3z",fill:r}),o.jsx("path",{d:"M5 7v10",stroke:r,strokeWidth:"1.5",strokeLinecap:"round"})]})},$f=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("text",{x:"4",y:"18",fontFamily:"serif",fontSize:"18",fontWeight:"400",fill:r,children:"Ω"})})},Ef=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"5",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"X"}),o.jsx("text",{x:"15",y:"20",fontFamily:"Arial",fontSize:"8",fill:t[e],children:"1"})]})},De=e=>{const{colors:t}=b.useTheme();return e?t[e]||e:t.neutral600},Ae=({children:e})=>o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:e}),it=({color:e})=>o.jsxs("g",{stroke:e,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]}),lt=({color:e,x:t,y:n,width:r,height:s})=>o.jsx("rect",{x:t,y:n,width:r,height:s,fill:e,opacity:"0.22",rx:"1.5"}),Zn=({color:e,cx:t,cy:n})=>o.jsxs("g",{stroke:e,strokeWidth:"1.6",strokeLinecap:"round",children:[o.jsx("line",{x1:t-2,y1:n,x2:t+2,y2:n}),o.jsx("line",{x1:t,y1:n-2,x2:t,y2:n+2})]}),ui=({color:e,cx:t,cy:n})=>o.jsxs("g",{stroke:e,strokeWidth:"1.6",strokeLinecap:"round",children:[o.jsx("line",{x1:t-2,y1:n-2,x2:t+2,y2:n+2}),o.jsx("line",{x1:t+2,y1:n-2,x2:t-2,y2:n+2})]}),Cf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(Zn,{color:t,cx:12,cy:6})]})},Sf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:15,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(Zn,{color:t,cx:12,cy:18})]})},Tf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(Zn,{color:t,cx:6,cy:12})]})},Mf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:15,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(Zn,{color:t,cx:18,cy:12})]})},If=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:9,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(ui,{color:t,cx:12,cy:12})]})},Rf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:9,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(ui,{color:t,cx:12,cy:12})]})},Bf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"6",rx:"1.5",fill:t}),o.jsx(it,{color:t})]})},Ff=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:12,height:12}),o.jsxs("g",{stroke:t,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"6",y1:"9",x2:"12",y2:"9"}),o.jsx("polyline",{points:"10,7 12,9 10,11",fill:"none"})]})]})},Df=({fill:e})=>{const t=De(e);return o.jsx(Ae,{children:o.jsxs("g",{stroke:t,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21",strokeDasharray:"2.5 2.5"}),o.jsx("line",{x1:"5",y1:"12",x2:"9",y2:"12"}),o.jsx("polyline",{points:"7,10 5,12 7,14",fill:"none"}),o.jsx("line",{x1:"15",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"17,10 19,12 17,14",fill:"none"})]})})},fs=e=>{const t=typeof e=="number"?e:1;return Number.isFinite(t)&&t>=1?Math.floor(t):1},mo=(e,t)=>{const n=e.children??[],r=n.map(()=>[]),s=[];n.forEach((i,l)=>{const c=i.children??[];let u=0;c.forEach((h,f)=>{for(;r[l][u];)u++;const g={node:h,path:[...t,l,f],row:l,col:u,rowSpan:fs(h.rowSpan),colSpan:fs(h.colSpan),indexInRow:f};s.push(g);for(let m=l;m<l+g.rowSpan&&m<n.length;m++)for(let w=u;w<u+g.colSpan;w++)r[m][w]=g;u+=g.colSpan})});const a=r.reduce((i,l)=>Math.max(i,l.length),0);return{tablePath:t,rowCount:n.length,colCount:a,matrix:r,cells:s}},bo=(e,t)=>e.cells.find(n=>d.Path.equals(n.path,t)),pi=(e,t)=>e.cells.filter(n=>n.row===t),un=(e,t,n)=>pi(e,t).filter(r=>r.col<n).length,gs=(e,t,n)=>e.row<=t&&t<e.row+e.rowSpan&&e.col<=n&&n<e.col+e.colSpan,Af=(e,t)=>{const n={...t};let r=!0;for(;r;){r=!1;for(const s of e.cells)s.row<=n.bottom&&s.row+s.rowSpan-1>=n.top&&s.col<=n.right&&s.col+s.colSpan-1>=n.left&&(s.row<n.top&&(n.top=s.row,r=!0),s.col<n.left&&(n.left=s.col,r=!0),s.row+s.rowSpan-1>n.bottom&&(n.bottom=s.row+s.rowSpan-1,r=!0),s.col+s.colSpan-1>n.right&&(n.right=s.col+s.colSpan-1,r=!0))}return n},hi=(e,t)=>{const n=new Set;for(let r=t.top;r<=t.bottom;r++)for(let s=t.left;s<=t.right;s++){const a=e.matrix[r]?.[s];a&&n.add(a)}return[...n]},_f=e=>!!(e&&typeof e=="object"&&"type"in e&&(e.type==="table-cell"||e.type==="table-header-cell")),ms=(e,t,n)=>{const r=d.Editor.above(e,{at:n,match:s=>!d.Editor.isEditor(s)&&_f(s)});return r?bo(t,r[1]):void 0},Nf=(e,t)=>{if(!e.selection)return null;const n=ms(e,t,e.selection.anchor),r=ms(e,t,e.selection.focus);if(!n||!r||n===r)return null;const s=[n,r],a={top:Math.min(...s.map(i=>i.row)),left:Math.min(...s.map(i=>i.col)),bottom:Math.max(...s.map(i=>i.row+i.rowSpan-1)),right:Math.max(...s.map(i=>i.col+i.colSpan-1))};return Af(t,a)},Pf=["table-cell","table-header-cell"],fi=["table","table-row","table-cell","table-header-cell"],Jn=(e=!1)=>({type:e?"table-header-cell":"table-cell",children:[{type:"text",text:""}]}),_n=(e,t=!1)=>({type:"table-row",children:Array.from({length:e},()=>Jn(t))}),Lf=(e,t,n=!0)=>({type:"table",children:n?[_n(t,!0),...Array.from({length:Math.max(e-1,0)},()=>_n(t))]:Array.from({length:e},()=>_n(t))}),gi=(e,t=3,n=3,r=!0)=>{const s=Lf(t,n,r),a={type:"paragraph",children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,[s,a])},Ee=(e,t)=>{e.__allowTableEdit=!0;try{d.Editor.withoutNormalizing(e,t)}finally{e.__allowTableEdit=!1}},St=(e,t)=>{try{d.Transforms.select(e,d.Editor.start(e,t))}catch{}},mi=e=>!!(e&&typeof e=="object"&&"type"in e&&Pf.includes(e.type)),wr=e=>!!(e&&typeof e=="object"&&"type"in e&&fi.includes(e.type)),Of=e=>{const{selection:t}=e;if(!t)return null;const n=d.Editor.above(e,{at:t.anchor,match:u=>!d.Editor.isEditor(u)&&mi(u)});if(!n)return null;const[r,s]=n;if(s.length<3)return null;const a=s.slice(0,-2),[i]=d.Editor.node(e,a);if(!i||d.Editor.isEditor(i)||i.type!=="table")return null;const l=mo(i,a),c=bo(l,s);return c?{tablePath:a,table:i,grid:l,focused:c,range:Nf(e,l),rowIndex:c.row,colIndex:c.col,rowCount:l.rowCount,colCount:l.colCount,cell:r,cellPath:s}:null},xo=e=>{const t=e.children;return t.length>0&&t.every(n=>n.type==="table-header-cell")},qe=(e,t)=>{const n=e.children[t];return!!(n&&xo(n))},on=e=>e>1?e:void 0,bs=(e,t,n)=>{const{grid:r,focused:s,tablePath:a,table:i}=t,l=n==="left"?s.col:s.col+s.colSpan,c=r.cells.filter(g=>g.col<l&&g.col+g.colSpan>l),u=new Set(c),h=[];for(let g=0;g<r.rowCount;g++){const m=r.matrix[g]?.[l];m&&u.has(m)||h.push({path:[...a,g,un(r,g,l)],isHeader:qe(i,g)})}Ee(e,()=>{c.forEach(g=>{d.Transforms.setNodes(e,{colSpan:g.colSpan+1},{at:g.path})}),h.forEach(({path:g,isHeader:m})=>{d.Transforms.insertNodes(e,Jn(m),{at:g})})});const f=h.find(g=>g.path[g.path.length-2]===s.row);f&&St(e,f.path)},zf=(e,t)=>{const{grid:n,focused:r}=t;if(n.colCount<=1)return;const s=r.col,a=new Set;for(let c=0;c<n.rowCount;c++){const u=n.matrix[c]?.[s];u&&a.add(u)}const i=[...a].filter(c=>c.colSpan>1),l=[...a].filter(c=>c.colSpan===1);Ee(e,()=>{i.forEach(c=>{d.Transforms.setNodes(e,{colSpan:on(c.colSpan-1)},{at:c.path})}),l.map(c=>c.path).sort((c,u)=>d.Path.compare(u,c)).forEach(c=>d.Transforms.removeNodes(e,{at:c}))}),St(e,[...t.tablePath,r.row,Math.max(un(n,r.row,s)-1,0)])},xs=(e,t,n)=>{const{grid:r,focused:s,tablePath:a}=t,i=n==="above"?s.row:s.row+s.rowSpan,l=r.cells.filter(h=>h.row<i&&h.row+h.rowSpan>i),c=new Set(l);let u=0;for(let h=0;h<r.colCount;h++){const f=r.matrix[i]?.[h];f&&c.has(f)||u++}Ee(e,()=>{l.forEach(h=>{d.Transforms.setNodes(e,{rowSpan:h.rowSpan+1},{at:h.path})}),d.Transforms.insertNodes(e,_n(u),{at:[...a,i]})}),St(e,[...a,i,0])},Hf=(e,t)=>{const{grid:n,focused:r,tablePath:s,table:a}=t;if(n.rowCount<=1)return;const i=r.row,l=qe(a,i),c=n.cells.filter(h=>h.row<i&&h.row+h.rowSpan>i),u=n.cells.filter(h=>h.row===i&&h.rowSpan>1).sort((h,f)=>h.col-f.col);Ee(e,()=>{if(c.forEach(h=>{d.Transforms.setNodes(e,{rowSpan:on(h.rowSpan-1)},{at:h.path})}),u.forEach((h,f)=>{const g={...JSON.parse(JSON.stringify(h.node)),rowSpan:on(h.rowSpan-1)};d.Transforms.insertNodes(e,g,{at:[...s,i+1,un(n,i+1,h.col)+f]})}),d.Transforms.removeNodes(e,{at:[...s,i]}),l&&i===0){const[h]=d.Editor.node(e,[...s,0]);h.children.forEach((f,g)=>{d.Transforms.setNodes(e,{type:"table-header-cell"},{at:[...s,0,g]})})}}),St(e,[...s,Math.min(i,n.rowCount-2),0])},Uf=(e,t)=>{Ee(e,()=>{d.Transforms.removeNodes(e,{at:t.tablePath})})},yo=(e,t)=>{const n=qe(e,t.top);for(let r=t.top+1;r<=t.bottom;r++)if(qe(e,r)!==n)return!0;return!1},Wf=e=>!e.range||yo(e.table,e.range)?!1:hi(e.grid,e.range).length>1,Kf=e=>e.focused.colSpan>1||e.focused.rowSpan>1,Gf=(e,t)=>{const{grid:n,range:r,tablePath:s,table:a}=t;if(!r||yo(a,r))return;const i=n.matrix[r.top]?.[r.left];if(!i)return;const l=hi(n,r).filter(h=>h!==i);if(l.length===0)return;const c=l.filter(h=>d.Node.string(h.node).trim()!=="").flatMap(h=>JSON.parse(JSON.stringify(h.node.children))),u=d.Node.string(i.node).trim()!=="";Ee(e,()=>{if(c.length>0){const h=[...i.path,i.node.children.length];d.Transforms.insertNodes(e,u?[{type:"text",text:" "},...c]:c,{at:h})}d.Transforms.setNodes(e,{colSpan:on(r.right-r.left+1),rowSpan:on(r.bottom-r.top+1)},{at:i.path}),l.map(h=>h.path).sort((h,f)=>d.Path.compare(f,h)).forEach(h=>d.Transforms.removeNodes(e,{at:h}))}),St(e,[...s,i.row,i.indexInRow])},Vf=(e,t)=>{const{grid:n,focused:r,table:s,tablePath:a}=t;if(r.colSpan===1&&r.rowSpan===1)return;const i=[];for(let l=r.row;l<r.row+r.rowSpan;l++)for(let c=r.col;c<r.col+r.colSpan;c++)l===r.row&&c===r.col||i.push({row:l,col:c});Ee(e,()=>{d.Transforms.setNodes(e,{colSpan:void 0,rowSpan:void 0},{at:r.path});const l=new Map;i.forEach(({row:c,col:u})=>{const h=l.get(c)??0;d.Transforms.insertNodes(e,Jn(qe(s,c)),{at:[...a,c,un(n,c,u)+h]}),l.set(c,h+1)})}),St(e,r.path)},qf=(e,t)=>{const n=Array.from(d.Editor.nodes(e,{match:r=>!d.Editor.isEditor(r)&&mi(r)}));d.Editor.withoutNormalizing(e,()=>{n.forEach(([,r])=>{d.Transforms.setNodes(e,{align:t==="left"?void 0:t},{at:r})})})},Xf=e=>e.cell.align??"left",Yf=(e,t)=>{const{tablePath:n,table:r,grid:s}=t,a=r.children[0];if(!a)return;const i=xo(a)?"table-cell":"table-header-cell",l=pi(s,0).map(c=>c.path);Ee(e,()=>{l.forEach(c=>{d.Transforms.setNodes(e,{type:i},{at:c})})})},Zf=e=>{const t=e.table.children[0];return!!(t&&xo(t))},Jf=b.styled(p.Flex)`
1362
+ `,wf={quote:{renderElement:e=>{const t=e.element,n={};return t.fontColor&&(n.color=t.fontColor),t.textAlign&&(n.textAlign=t.textAlign),t.indent&&(n.marginLeft=`${t.indent*2}rem`),t.lineHeight&&(n.lineHeight=t.lineHeight),o.jsx("div",{children:o.jsx(vf,{...e.attributes,style:n,children:e.children})})},icon:D.Quotes,label:{id:"components.Blocks.blocks.quote",defaultMessage:"Quote"},matchNode:e=>e.type==="quote",isInBlocksSelector:!0,handleConvert(e){he(e,{type:"quote"})},handleEnterKey(e){Ia(e)},snippets:[">"]}},kf=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("text",{x:"2.7",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"AA"})})},jf=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"5",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"X"}),o.jsx("text",{x:"15",y:"10",fontFamily:"Arial",fontSize:"8",fill:t[e],children:"1"})]})},$f=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,fill:"none",children:[o.jsx("path",{d:"M7 7h7a5 5 0 0 1 0 10H7",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M10 4 7 7l3 3",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},Ef=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,fill:"none",children:[o.jsx("path",{d:"M17 7h-7a5 5 0 0 0 0 10h7",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M14 4l3 3-3 3",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},bo=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M3 10h12M3 14h18M3 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},ui=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M6 10h12M3 14h18M6 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},pi=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M9 10h12M3 14h18M9 18h12",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},Cf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("path",{d:"M3 6h18M3 10h18M3 14h18M3 18h18",stroke:r,strokeWidth:"2",strokeLinecap:"round"})})},Sf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:[o.jsx("path",{d:"M11 6h10M11 12h10M11 18h10",stroke:r,strokeWidth:"2",strokeLinecap:"round"}),o.jsx("path",{d:"M5 4l-2 3h4L5 4zM5 20l-2-3h4l-2 3z",fill:r}),o.jsx("path",{d:"M5 7v10",stroke:r,strokeWidth:"1.5",strokeLinecap:"round"})]})},Tf=({fill:e,...t})=>{const{colors:n}=b.useTheme(),r=e?n[e]||e:n.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:o.jsx("text",{x:"4",y:"18",fontFamily:"serif",fontSize:"18",fontWeight:"400",fill:r,children:"Ω"})})},Mf=({fill:e})=>{const{colors:t}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"5",y:"17",fontFamily:"Arial",fontSize:"14",fill:t[e],children:"X"}),o.jsx("text",{x:"15",y:"20",fontFamily:"Arial",fontSize:"8",fill:t[e],children:"1"})]})},De=e=>{const{colors:t}=b.useTheme();return e?t[e]||e:t.neutral600},Ae=({children:e})=>o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:e}),it=({color:e})=>o.jsxs("g",{stroke:e,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]}),lt=({color:e,x:t,y:n,width:r,height:s})=>o.jsx("rect",{x:t,y:n,width:r,height:s,fill:e,opacity:"0.22",rx:"1.5"}),Qn=({color:e,cx:t,cy:n})=>o.jsxs("g",{stroke:e,strokeWidth:"1.6",strokeLinecap:"round",children:[o.jsx("line",{x1:t-2,y1:n,x2:t+2,y2:n}),o.jsx("line",{x1:t,y1:n-2,x2:t,y2:n+2})]}),hi=({color:e,cx:t,cy:n})=>o.jsxs("g",{stroke:e,strokeWidth:"1.6",strokeLinecap:"round",children:[o.jsx("line",{x1:t-2,y1:n-2,x2:t+2,y2:n+2}),o.jsx("line",{x1:t+2,y1:n-2,x2:t-2,y2:n+2})]}),Bf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(Qn,{color:t,cx:12,cy:6})]})},If=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:15,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(Qn,{color:t,cx:12,cy:18})]})},Rf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(Qn,{color:t,cx:6,cy:12})]})},Ff=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:15,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(Qn,{color:t,cx:18,cy:12})]})},Df=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:9,width:18,height:6}),o.jsx(it,{color:t}),o.jsx(hi,{color:t,cx:12,cy:12})]})},Af=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:9,y:3,width:6,height:18}),o.jsx(it,{color:t}),o.jsx(hi,{color:t,cx:12,cy:12})]})},_f=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"6",rx:"1.5",fill:t}),o.jsx(it,{color:t})]})},Nf=({fill:e})=>{const t=De(e);return o.jsxs(Ae,{children:[o.jsx(lt,{color:t,x:3,y:3,width:12,height:12}),o.jsxs("g",{stroke:t,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"6",y1:"9",x2:"12",y2:"9"}),o.jsx("polyline",{points:"10,7 12,9 10,11",fill:"none"})]})]})},Pf=({fill:e})=>{const t=De(e);return o.jsx(Ae,{children:o.jsxs("g",{stroke:t,strokeWidth:"1.4",strokeLinecap:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21",strokeDasharray:"2.5 2.5"}),o.jsx("line",{x1:"5",y1:"12",x2:"9",y2:"12"}),o.jsx("polyline",{points:"7,10 5,12 7,14",fill:"none"}),o.jsx("line",{x1:"15",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"17,10 19,12 17,14",fill:"none"})]})})},bs=e=>{const t=typeof e=="number"?e:1;return Number.isFinite(t)&&t>=1?Math.floor(t):1},yo=(e,t)=>{const n=e.children??[],r=n.map(()=>[]),s=[];n.forEach((i,l)=>{const c=i.children??[];let u=0;c.forEach((h,f)=>{for(;r[l][u];)u++;const g={node:h,path:[...t,l,f],row:l,col:u,rowSpan:bs(h.rowSpan),colSpan:bs(h.colSpan),indexInRow:f};s.push(g);for(let m=l;m<l+g.rowSpan&&m<n.length;m++)for(let x=u;x<u+g.colSpan;x++)r[m][x]=g;u+=g.colSpan})});const a=r.reduce((i,l)=>Math.max(i,l.length),0);return{tablePath:t,rowCount:n.length,colCount:a,matrix:r,cells:s}},xo=(e,t)=>e.cells.find(n=>d.Path.equals(n.path,t)),fi=(e,t)=>e.cells.filter(n=>n.row===t),pn=(e,t,n)=>fi(e,t).filter(r=>r.col<n).length,ys=(e,t,n)=>e.row<=t&&t<e.row+e.rowSpan&&e.col<=n&&n<e.col+e.colSpan,Lf=(e,t)=>{const n={...t};let r=!0;for(;r;){r=!1;for(const s of e.cells)s.row<=n.bottom&&s.row+s.rowSpan-1>=n.top&&s.col<=n.right&&s.col+s.colSpan-1>=n.left&&(s.row<n.top&&(n.top=s.row,r=!0),s.col<n.left&&(n.left=s.col,r=!0),s.row+s.rowSpan-1>n.bottom&&(n.bottom=s.row+s.rowSpan-1,r=!0),s.col+s.colSpan-1>n.right&&(n.right=s.col+s.colSpan-1,r=!0))}return n},gi=(e,t)=>{const n=new Set;for(let r=t.top;r<=t.bottom;r++)for(let s=t.left;s<=t.right;s++){const a=e.matrix[r]?.[s];a&&n.add(a)}return[...n]},Of=e=>!!(e&&typeof e=="object"&&"type"in e&&(e.type==="table-cell"||e.type==="table-header-cell")),xs=(e,t,n)=>{const r=d.Editor.above(e,{at:n,match:s=>!d.Editor.isEditor(s)&&Of(s)});return r?xo(t,r[1]):void 0},zf=(e,t)=>{if(!e.selection)return null;const n=xs(e,t,e.selection.anchor),r=xs(e,t,e.selection.focus);if(!n||!r||n===r)return null;const s=[n,r],a={top:Math.min(...s.map(i=>i.row)),left:Math.min(...s.map(i=>i.col)),bottom:Math.max(...s.map(i=>i.row+i.rowSpan-1)),right:Math.max(...s.map(i=>i.col+i.colSpan-1))};return Lf(t,a)},Hf=["table-cell","table-header-cell"],mi=["table","table-row","table-cell","table-header-cell"],er=(e=!1)=>({type:e?"table-header-cell":"table-cell",children:[{type:"text",text:""}]}),Nn=(e,t=!1)=>({type:"table-row",children:Array.from({length:e},()=>er(t))}),Uf=(e,t,n=!0)=>({type:"table",children:n?[Nn(t,!0),...Array.from({length:Math.max(e-1,0)},()=>Nn(t))]:Array.from({length:e},()=>Nn(t))}),bi=(e,t=3,n=3,r=!0)=>{const s=Uf(t,n,r),a={type:"paragraph",children:[{type:"text",text:""}]};d.Transforms.insertNodes(e,[s,a])},Ee=(e,t)=>{e.__allowTableEdit=!0;try{d.Editor.withoutNormalizing(e,t)}finally{e.__allowTableEdit=!1}},Tt=(e,t)=>{try{d.Transforms.select(e,d.Editor.start(e,t))}catch{}},yi=e=>!!(e&&typeof e=="object"&&"type"in e&&Hf.includes(e.type)),jr=e=>!!(e&&typeof e=="object"&&"type"in e&&mi.includes(e.type)),Wf=e=>{const{selection:t}=e;if(!t)return null;const n=d.Editor.above(e,{at:t.anchor,match:u=>!d.Editor.isEditor(u)&&yi(u)});if(!n)return null;const[r,s]=n;if(s.length<3)return null;const a=s.slice(0,-2),[i]=d.Editor.node(e,a);if(!i||d.Editor.isEditor(i)||i.type!=="table")return null;const l=yo(i,a),c=xo(l,s);return c?{tablePath:a,table:i,grid:l,focused:c,range:zf(e,l),rowIndex:c.row,colIndex:c.col,rowCount:l.rowCount,colCount:l.colCount,cell:r,cellPath:s}:null},vo=e=>{const t=e.children;return t.length>0&&t.every(n=>n.type==="table-header-cell")},qe=(e,t)=>{const n=e.children[t];return!!(n&&vo(n))},sn=e=>e>1?e:void 0,vs=(e,t,n)=>{const{grid:r,focused:s,tablePath:a,table:i}=t,l=n==="left"?s.col:s.col+s.colSpan,c=r.cells.filter(g=>g.col<l&&g.col+g.colSpan>l),u=new Set(c),h=[];for(let g=0;g<r.rowCount;g++){const m=r.matrix[g]?.[l];m&&u.has(m)||h.push({path:[...a,g,pn(r,g,l)],isHeader:qe(i,g)})}Ee(e,()=>{c.forEach(g=>{d.Transforms.setNodes(e,{colSpan:g.colSpan+1},{at:g.path})}),h.forEach(({path:g,isHeader:m})=>{d.Transforms.insertNodes(e,er(m),{at:g})})});const f=h.find(g=>g.path[g.path.length-2]===s.row);f&&Tt(e,f.path)},Kf=(e,t)=>{const{grid:n,focused:r}=t;if(n.colCount<=1)return;const s=r.col,a=new Set;for(let c=0;c<n.rowCount;c++){const u=n.matrix[c]?.[s];u&&a.add(u)}const i=[...a].filter(c=>c.colSpan>1),l=[...a].filter(c=>c.colSpan===1);Ee(e,()=>{i.forEach(c=>{d.Transforms.setNodes(e,{colSpan:sn(c.colSpan-1)},{at:c.path})}),l.map(c=>c.path).sort((c,u)=>d.Path.compare(u,c)).forEach(c=>d.Transforms.removeNodes(e,{at:c}))}),Tt(e,[...t.tablePath,r.row,Math.max(pn(n,r.row,s)-1,0)])},ws=(e,t,n)=>{const{grid:r,focused:s,tablePath:a}=t,i=n==="above"?s.row:s.row+s.rowSpan,l=r.cells.filter(h=>h.row<i&&h.row+h.rowSpan>i),c=new Set(l);let u=0;for(let h=0;h<r.colCount;h++){const f=r.matrix[i]?.[h];f&&c.has(f)||u++}Ee(e,()=>{l.forEach(h=>{d.Transforms.setNodes(e,{rowSpan:h.rowSpan+1},{at:h.path})}),d.Transforms.insertNodes(e,Nn(u),{at:[...a,i]})}),Tt(e,[...a,i,0])},Gf=(e,t)=>{const{grid:n,focused:r,tablePath:s,table:a}=t;if(n.rowCount<=1)return;const i=r.row,l=qe(a,i),c=n.cells.filter(h=>h.row<i&&h.row+h.rowSpan>i),u=n.cells.filter(h=>h.row===i&&h.rowSpan>1).sort((h,f)=>h.col-f.col);Ee(e,()=>{if(c.forEach(h=>{d.Transforms.setNodes(e,{rowSpan:sn(h.rowSpan-1)},{at:h.path})}),u.forEach((h,f)=>{const g={...JSON.parse(JSON.stringify(h.node)),rowSpan:sn(h.rowSpan-1)};d.Transforms.insertNodes(e,g,{at:[...s,i+1,pn(n,i+1,h.col)+f]})}),d.Transforms.removeNodes(e,{at:[...s,i]}),l&&i===0){const[h]=d.Editor.node(e,[...s,0]);h.children.forEach((f,g)=>{d.Transforms.setNodes(e,{type:"table-header-cell"},{at:[...s,0,g]})})}}),Tt(e,[...s,Math.min(i,n.rowCount-2),0])},Vf=(e,t)=>{Ee(e,()=>{d.Transforms.removeNodes(e,{at:t.tablePath})})},wo=(e,t)=>{const n=qe(e,t.top);for(let r=t.top+1;r<=t.bottom;r++)if(qe(e,r)!==n)return!0;return!1},qf=e=>!e.range||wo(e.table,e.range)?!1:gi(e.grid,e.range).length>1,Xf=e=>e.focused.colSpan>1||e.focused.rowSpan>1,Yf=(e,t)=>{const{grid:n,range:r,tablePath:s,table:a}=t;if(!r||wo(a,r))return;const i=n.matrix[r.top]?.[r.left];if(!i)return;const l=gi(n,r).filter(h=>h!==i);if(l.length===0)return;const c=l.filter(h=>d.Node.string(h.node).trim()!=="").flatMap(h=>JSON.parse(JSON.stringify(h.node.children))),u=d.Node.string(i.node).trim()!=="";Ee(e,()=>{if(c.length>0){const h=[...i.path,i.node.children.length];d.Transforms.insertNodes(e,u?[{type:"text",text:" "},...c]:c,{at:h})}d.Transforms.setNodes(e,{colSpan:sn(r.right-r.left+1),rowSpan:sn(r.bottom-r.top+1)},{at:i.path}),l.map(h=>h.path).sort((h,f)=>d.Path.compare(f,h)).forEach(h=>d.Transforms.removeNodes(e,{at:h}))}),Tt(e,[...s,i.row,i.indexInRow])},Zf=(e,t)=>{const{grid:n,focused:r,table:s,tablePath:a}=t;if(r.colSpan===1&&r.rowSpan===1)return;const i=[];for(let l=r.row;l<r.row+r.rowSpan;l++)for(let c=r.col;c<r.col+r.colSpan;c++)l===r.row&&c===r.col||i.push({row:l,col:c});Ee(e,()=>{d.Transforms.setNodes(e,{colSpan:void 0,rowSpan:void 0},{at:r.path});const l=new Map;i.forEach(({row:c,col:u})=>{const h=l.get(c)??0;d.Transforms.insertNodes(e,er(qe(s,c)),{at:[...a,c,pn(n,c,u)+h]}),l.set(c,h+1)})}),Tt(e,r.path)},Jf=(e,t)=>{const n=Array.from(d.Editor.nodes(e,{match:r=>!d.Editor.isEditor(r)&&yi(r)}));d.Editor.withoutNormalizing(e,()=>{n.forEach(([,r])=>{d.Transforms.setNodes(e,{align:t==="left"?void 0:t},{at:r})})})},Qf=e=>e.cell.align??"left",eg=(e,t)=>{const{tablePath:n,table:r,grid:s}=t,a=r.children[0];if(!a)return;const i=vo(a)?"table-cell":"table-header-cell",l=fi(s,0).map(c=>c.path);Ee(e,()=>{l.forEach(c=>{d.Transforms.setNodes(e,{type:i},{at:c})})})},tg=e=>{const t=e.table.children[0];return!!(t&&vo(t))},ng=b.styled(p.Flex)`
1363
1363
  position: absolute;
1364
1364
  top: 0;
1365
1365
  left: 0;
@@ -1369,12 +1369,12 @@
1369
1369
  border-radius: ${({theme:e})=>e.borderRadius};
1370
1370
  box-shadow: ${({theme:e})=>e.shadows.filterShadow};
1371
1371
  padding: 2px;
1372
- `,Sn=b.styled.span`
1372
+ `,Tn=b.styled.span`
1373
1373
  width: 1px;
1374
1374
  align-self: stretch;
1375
1375
  margin: 2px 2px;
1376
1376
  background: ${({theme:e})=>e.colors.neutral200};
1377
- `,Qf=b.styled.button`
1377
+ `,rg=b.styled.button`
1378
1378
  display: flex;
1379
1379
  align-items: center;
1380
1380
  justify-content: center;
@@ -1398,12 +1398,12 @@
1398
1398
  outline: 2px solid ${({theme:e})=>e.colors.primary600};
1399
1399
  outline-offset: -2px;
1400
1400
  }
1401
- `,fe=({label:e,icon:t,onAction:n,isActive:r,isDanger:s,disabled:a})=>o.jsx(p.Tooltip,{label:e,children:o.jsx(Qf,{type:"button","aria-label":e,"aria-pressed":r,disabled:a,$active:r,$danger:s,onMouseDown:i=>{i.preventDefault(),a||n()},children:o.jsx(t,{fill:a?"neutral300":s?"danger600":r?"primary600":"neutral600"})})}),eg=[{value:"left",icon:go,id:"components.Blocks.table.alignLeft",defaultMessage:"Align cell left"},{value:"center",icon:ci,id:"components.Blocks.table.alignCenter",defaultMessage:"Align cell center"},{value:"right",icon:di,id:"components.Blocks.table.alignRight",defaultMessage:"Align cell right"}],tg=({location:e,disabled:t})=>{const n=B.useSlateStatic(),{formatMessage:r}=O.useIntl(),s=Xf(e),a=Zf(e),i=!!(e.range&&yo(e.table,e.range)),l=(c,u)=>r({id:c,defaultMessage:u});return o.jsxs(Jf,{contentEditable:!1,gap:0,alignItems:"center",children:[o.jsx(fe,{label:l("components.Blocks.table.insertRowAbove","Insert row above"),icon:Cf,disabled:t,onAction:()=>xs(n,e,"above")}),o.jsx(fe,{label:l("components.Blocks.table.insertRowBelow","Insert row below"),icon:Sf,disabled:t,onAction:()=>xs(n,e,"below")}),o.jsx(fe,{label:l("components.Blocks.table.deleteRow","Delete row"),icon:If,isDanger:!0,disabled:t||e.rowCount<=1,onAction:()=>Hf(n,e)}),o.jsx(Sn,{}),o.jsx(fe,{label:l("components.Blocks.table.insertColumnLeft","Insert column left"),icon:Tf,disabled:t,onAction:()=>bs(n,e,"left")}),o.jsx(fe,{label:l("components.Blocks.table.insertColumnRight","Insert column right"),icon:Mf,disabled:t,onAction:()=>bs(n,e,"right")}),o.jsx(fe,{label:l("components.Blocks.table.deleteColumn","Delete column"),icon:Rf,isDanger:!0,disabled:t||e.colCount<=1,onAction:()=>zf(n,e)}),o.jsx(Sn,{}),o.jsx(fe,{label:i?l("components.Blocks.table.mergeAcrossHeader","Header and body cells can't be merged"):l("components.Blocks.table.mergeCells","Merge cells"),icon:Ff,disabled:t||!Wf(e),onAction:()=>Gf(n,e)}),o.jsx(fe,{label:l("components.Blocks.table.splitCell","Split cell"),icon:Df,disabled:t||!Kf(e),onAction:()=>Vf(n,e)}),o.jsx(Sn,{}),eg.map(c=>o.jsx(fe,{label:l(c.id,c.defaultMessage),icon:c.icon,isActive:s===c.value,disabled:t,onAction:()=>qf(n,c.value)},c.value)),o.jsx(Sn,{}),o.jsx(fe,{label:l("components.Blocks.table.toggleHeaderRow","Toggle header row"),icon:Bf,isActive:a,disabled:t,onAction:()=>Yf(n,e)}),o.jsx(fe,{label:l("components.Blocks.table.deleteTable","Delete table"),icon:D.Trash,isDanger:!0,disabled:t,onAction:()=>Uf(n,e)})]})},ng="3.6rem",rg=b.styled(p.Box)`
1402
- padding-top: ${ng};
1403
- `,og=b.styled.div`
1401
+ `,fe=({label:e,icon:t,onAction:n,isActive:r,isDanger:s,disabled:a})=>o.jsx(p.Tooltip,{label:e,children:o.jsx(rg,{type:"button","aria-label":e,"aria-pressed":r,disabled:a,$active:r,$danger:s,onMouseDown:i=>{i.preventDefault(),a||n()},children:o.jsx(t,{fill:a?"neutral300":s?"danger600":r?"primary600":"neutral600"})})}),og=[{value:"left",icon:bo,id:"components.Blocks.table.alignLeft",defaultMessage:"Align cell left"},{value:"center",icon:ui,id:"components.Blocks.table.alignCenter",defaultMessage:"Align cell center"},{value:"right",icon:pi,id:"components.Blocks.table.alignRight",defaultMessage:"Align cell right"}],sg=({location:e,disabled:t})=>{const n=R.useSlateStatic(),{formatMessage:r}=O.useIntl(),s=Qf(e),a=tg(e),i=!!(e.range&&wo(e.table,e.range)),l=(c,u)=>r({id:c,defaultMessage:u});return o.jsxs(ng,{contentEditable:!1,gap:0,alignItems:"center",children:[o.jsx(fe,{label:l("components.Blocks.table.insertRowAbove","Insert row above"),icon:Bf,disabled:t,onAction:()=>ws(n,e,"above")}),o.jsx(fe,{label:l("components.Blocks.table.insertRowBelow","Insert row below"),icon:If,disabled:t,onAction:()=>ws(n,e,"below")}),o.jsx(fe,{label:l("components.Blocks.table.deleteRow","Delete row"),icon:Df,isDanger:!0,disabled:t||e.rowCount<=1,onAction:()=>Gf(n,e)}),o.jsx(Tn,{}),o.jsx(fe,{label:l("components.Blocks.table.insertColumnLeft","Insert column left"),icon:Rf,disabled:t,onAction:()=>vs(n,e,"left")}),o.jsx(fe,{label:l("components.Blocks.table.insertColumnRight","Insert column right"),icon:Ff,disabled:t,onAction:()=>vs(n,e,"right")}),o.jsx(fe,{label:l("components.Blocks.table.deleteColumn","Delete column"),icon:Af,isDanger:!0,disabled:t||e.colCount<=1,onAction:()=>Kf(n,e)}),o.jsx(Tn,{}),o.jsx(fe,{label:i?l("components.Blocks.table.mergeAcrossHeader","Header and body cells can't be merged"):l("components.Blocks.table.mergeCells","Merge cells"),icon:Nf,disabled:t||!qf(e),onAction:()=>Yf(n,e)}),o.jsx(fe,{label:l("components.Blocks.table.splitCell","Split cell"),icon:Pf,disabled:t||!Xf(e),onAction:()=>Zf(n,e)}),o.jsx(Tn,{}),og.map(c=>o.jsx(fe,{label:l(c.id,c.defaultMessage),icon:c.icon,isActive:s===c.value,disabled:t,onAction:()=>Jf(n,c.value)},c.value)),o.jsx(Tn,{}),o.jsx(fe,{label:l("components.Blocks.table.toggleHeaderRow","Toggle header row"),icon:_f,isActive:a,disabled:t,onAction:()=>eg(n,e)}),o.jsx(fe,{label:l("components.Blocks.table.deleteTable","Delete table"),icon:D.Trash,isDanger:!0,disabled:t,onAction:()=>Vf(n,e)})]})},ag="3.6rem",ig=b.styled(p.Box)`
1402
+ padding-top: ${ag};
1403
+ `,lg=b.styled.div`
1404
1404
  overflow-x: auto;
1405
1405
  max-width: 100%;
1406
- `,sg=b.styled.table`
1406
+ `,cg=b.styled.table`
1407
1407
  width: 100%;
1408
1408
  border-collapse: collapse;
1409
1409
  margin: ${({theme:e})=>e.spaces[2]} 0;
@@ -1441,12 +1441,12 @@
1441
1441
  /* While a range of cells is selected, the browser's own text highlight would
1442
1442
  paint across the range tint and read as two competing selections. */
1443
1443
  ${({$hasRange:e})=>e?"& ::selection { background: transparent; }":""}
1444
- `,bi=k.createContext(null),ag=({attributes:e,children:t,element:n})=>{const r=B.useSlate(),{disabled:s}=P("TableElement"),a=B.ReactEditor.findPath(r,n),i=Of(r),l=!!(i&&d.Path.equals(i.tablePath,a)),c=k.useMemo(()=>l&&i?{grid:i.grid,activeRow:i.rowIndex,activeCol:i.colIndex,range:i.range}:null,[l,i]);return o.jsxs(rg,{...e,position:"relative",children:[l&&i&&o.jsx(tg,{location:i,disabled:s}),o.jsx(og,{children:o.jsx(sg,{$hasRange:!!c?.range,children:o.jsx(bi.Provider,{value:c,children:o.jsx("tbody",{children:t})})})})]})},ig=({attributes:e,children:t})=>o.jsx("tr",{...e,children:t}),lg=e=>{const t=B.useSlateStatic(),n=k.useContext(bi);if(!n)return;let r;try{r=B.ReactEditor.findPath(t,e)}catch{return}const s=bo(n.grid,r);if(!s)return;const{range:a}=n;if(a)return s.row<=a.bottom&&s.row+s.rowSpan-1>=a.top&&s.col<=a.right&&s.col+s.colSpan-1>=a.left?"range":void 0;const i=gs(s,n.activeRow,s.col),l=gs(s,s.row,n.activeCol);return i||l?"active":void 0},ys=({attributes:e,children:t,element:n})=>{const r=n,s=r.type==="table-header-cell",a=s?"th":"td",i=r.align??"left",l=lg(n);return o.jsx(a,{...e,scope:s?"col":void 0,colSpan:r.colSpan&&r.colSpan>1?r.colSpan:void 0,rowSpan:r.rowSpan&&r.rowSpan>1?r.rowSpan:void 0,"data-highlight":l,style:{textAlign:i},children:t})},cg=(e,t,n)=>{const r=qe(e,n.row),s=Math.min(n.row+n.rowSpan,t.rowCount);for(let a=n.row+1;a<s;a++)if(qe(e,a)!==r)return a-n.row;return n.rowSpan},dg=(e,t,n)=>{const r=mo(t,n);let s=!1;for(const a of r.cells){const i=Math.min(Math.max(r.rowCount-a.row,1),cg(t,r,a)),l=Math.max(r.colCount-a.col,1),c={};a.rowSpan>i&&(c.rowSpan=i>1?i:void 0),a.colSpan>l&&(c.colSpan=l>1?l:void 0),Object.keys(c).length>0&&(Ee(e,()=>{d.Transforms.setNodes(e,c,{at:a.path})}),s=!0)}return s},ug=(e,t,n)=>{const r=mo(t,n);let s=!1;for(let a=0;a<r.rowCount;a++){const i=[];for(let c=0;c<r.colCount;c++)r.matrix[a]?.[c]||i.push(c);if(i.length===0)continue;const l=qe(t,a);Ee(e,()=>{i.forEach((c,u)=>{d.Transforms.insertNodes(e,Jn(l),{at:[...n,a,un(r,a,c)+u]})})}),s=!0}return s},pg=e=>{const{deleteBackward:t,deleteForward:n,insertBreak:r,normalizeNode:s,apply:a}=e;return e.apply=i=>{if(e.__allowTableEdit){a(i);return}if((i.type==="remove_node"||i.type==="merge_node"||i.type==="move_node")&&i.path.length>0)try{const l=i.type==="remove_node"?i.node:d.Editor.node(e,i.path)?.[0];if(l&&wr(l))return}catch{}if(i.type==="set_node"&&i.path.length>0)try{const[l]=d.Editor.node(e,i.path),c=i.newProperties?.type;if(wr(l)&&c&&!fi.includes(c))return}catch{}a(i)},e.normalizeNode=i=>{const[l,c]=i;if(wr(l))return l.type==="table"&&(dg(e,l,c)||ug(e,l,c)),void 0;s(i)},e.deleteBackward=i=>{const{selection:l}=e;if(l){const[c]=d.Editor.nodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&(u.type==="table-cell"||u.type==="table-header-cell")});if(c){const[,u]=c;if(d.Editor.isStart(e,l.anchor,u))return}}t(i)},e.deleteForward=i=>{const{selection:l}=e;if(l){const[c]=d.Editor.nodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&(u.type==="table-cell"||u.type==="table-header-cell")});if(c){const[,u]=c;if(d.Editor.isEnd(e,l.anchor,u))return}}n(i)},e.insertBreak=()=>{const{selection:i}=e;if(i){const[l]=d.Editor.nodes(e,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&c.type==="table"});if(l){d.Transforms.insertText(e,`
1445
- `);return}}r()},e},hg={table:{renderElement:e=>o.jsx(ag,{...e}),matchNode:e=>e.type==="table",isInBlocksSelector:!1},"table-row":{renderElement:e=>o.jsx(ig,{...e}),matchNode:e=>e.type==="table-row",isInBlocksSelector:!1},"table-cell":{renderElement:e=>o.jsx(ys,{...e}),matchNode:e=>e.type==="table-cell",isInBlocksSelector:!1},"table-header-cell":{renderElement:e=>o.jsx(ys,{...e}),matchNode:e=>e.type==="table-header-cell",isInBlocksSelector:!1}};function fg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return T.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Qn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Tt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vo(e){return"nodeType"in e}function ne(e){var t,n;return e?Tt(e)?e:vo(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wo(e){const{Document:t}=ne(e);return e instanceof t}function pn(e){return Tt(e)?!1:e instanceof ne(e).HTMLElement}function xi(e){return e instanceof ne(e).SVGElement}function Mt(e){return e?Tt(e)?e.document:vo(e)?wo(e)?e:pn(e)||xi(e)?e.ownerDocument:document:document:document}const je=Qn?T.useLayoutEffect:T.useEffect;function ko(e){const t=T.useRef(e);return je(()=>{t.current=e}),T.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function gg(){const e=T.useRef(null),t=T.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=T.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function sn(e,t){t===void 0&&(t=[e]);const n=T.useRef(e);return je(()=>{n.current!==e&&(n.current=e)},t),n}function hn(e,t){const n=T.useRef();return T.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Pn(e){const t=ko(e),n=T.useRef(null),r=T.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function Wr(e){const t=T.useRef();return T.useEffect(()=>{t.current=e},[e]),t.current}let kr={};function fn(e,t){return T.useMemo(()=>{if(t)return t;const n=kr[e]==null?0:kr[e]+1;return kr[e]=n,e+"-"+n},[e,t])}function yi(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((a,i)=>{const l=Object.entries(i);for(const[c,u]of l){const h=a[c];h!=null&&(a[c]=h+e*u)}return a},{...t})}}const Et=yi(1),Ln=yi(-1);function mg(e){return"clientX"in e&&"clientY"in e}function jo(e){if(!e)return!1;const{KeyboardEvent:t}=ne(e.target);return t&&e instanceof t}function bg(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Kr(e){if(bg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return mg(e)?{x:e.clientX,y:e.clientY}:null}const an=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[an.Translate.toString(e),an.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),vs="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xg(e){return e.matches(vs)?e:e.querySelector(vs)}const yg={display:"none"};function vg(e){let{id:t,value:n}=e;return k.default.createElement("div",{id:t,style:yg},n)}function wg(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return k.default.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function kg(){const[e,t]=T.useState("");return{announce:T.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const vi=T.createContext(null);function jg(e){const t=T.useContext(vi);T.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function $g(){const[e]=T.useState(()=>new Set),t=T.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[T.useCallback(r=>{let{type:s,event:a}=r;e.forEach(i=>{var l;return(l=i[s])==null?void 0:l.call(i,a)})},[e]),t]}const Eg={draggable:`
1444
+ `,xi=k.createContext(null),dg=({attributes:e,children:t,element:n})=>{const r=R.useSlate(),{disabled:s}=P("TableElement"),a=R.ReactEditor.findPath(r,n),i=Wf(r),l=!!(i&&d.Path.equals(i.tablePath,a)),c=k.useMemo(()=>l&&i?{grid:i.grid,activeRow:i.rowIndex,activeCol:i.colIndex,range:i.range}:null,[l,i]);return o.jsxs(ig,{...e,position:"relative",children:[l&&i&&o.jsx(sg,{location:i,disabled:s}),o.jsx(lg,{children:o.jsx(cg,{$hasRange:!!c?.range,children:o.jsx(xi.Provider,{value:c,children:o.jsx("tbody",{children:t})})})})]})},ug=({attributes:e,children:t})=>o.jsx("tr",{...e,children:t}),pg=e=>{const t=R.useSlateStatic(),n=k.useContext(xi);if(!n)return;let r;try{r=R.ReactEditor.findPath(t,e)}catch{return}const s=xo(n.grid,r);if(!s)return;const{range:a}=n;if(a)return s.row<=a.bottom&&s.row+s.rowSpan-1>=a.top&&s.col<=a.right&&s.col+s.colSpan-1>=a.left?"range":void 0;const i=ys(s,n.activeRow,s.col),l=ys(s,s.row,n.activeCol);return i||l?"active":void 0},ks=({attributes:e,children:t,element:n})=>{const r=n,s=r.type==="table-header-cell",a=s?"th":"td",i=r.align??"left",l=pg(n);return o.jsx(a,{...e,scope:s?"col":void 0,colSpan:r.colSpan&&r.colSpan>1?r.colSpan:void 0,rowSpan:r.rowSpan&&r.rowSpan>1?r.rowSpan:void 0,"data-highlight":l,style:{textAlign:i},children:t})},hg=(e,t,n)=>{const r=qe(e,n.row),s=Math.min(n.row+n.rowSpan,t.rowCount);for(let a=n.row+1;a<s;a++)if(qe(e,a)!==r)return a-n.row;return n.rowSpan},fg=(e,t,n)=>{const r=yo(t,n);let s=!1;for(const a of r.cells){const i=Math.min(Math.max(r.rowCount-a.row,1),hg(t,r,a)),l=Math.max(r.colCount-a.col,1),c={};a.rowSpan>i&&(c.rowSpan=i>1?i:void 0),a.colSpan>l&&(c.colSpan=l>1?l:void 0),Object.keys(c).length>0&&(Ee(e,()=>{d.Transforms.setNodes(e,c,{at:a.path})}),s=!0)}return s},gg=(e,t,n)=>{const r=yo(t,n);let s=!1;for(let a=0;a<r.rowCount;a++){const i=[];for(let c=0;c<r.colCount;c++)r.matrix[a]?.[c]||i.push(c);if(i.length===0)continue;const l=qe(t,a);Ee(e,()=>{i.forEach((c,u)=>{d.Transforms.insertNodes(e,er(l),{at:[...n,a,pn(r,a,c)+u]})})}),s=!0}return s},mg=e=>{const{deleteBackward:t,deleteForward:n,insertBreak:r,normalizeNode:s,apply:a}=e;return e.apply=i=>{if(e.__allowTableEdit){a(i);return}if((i.type==="remove_node"||i.type==="merge_node"||i.type==="move_node")&&i.path.length>0)try{const l=i.type==="remove_node"?i.node:d.Editor.node(e,i.path)?.[0];if(l&&jr(l))return}catch{}if(i.type==="set_node"&&i.path.length>0)try{const[l]=d.Editor.node(e,i.path),c=i.newProperties?.type;if(jr(l)&&c&&!mi.includes(c))return}catch{}a(i)},e.normalizeNode=i=>{const[l,c]=i;if(jr(l))return l.type==="table"&&(fg(e,l,c)||gg(e,l,c)),void 0;s(i)},e.deleteBackward=i=>{const{selection:l}=e;if(l){const[c]=d.Editor.nodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&(u.type==="table-cell"||u.type==="table-header-cell")});if(c){const[,u]=c;if(d.Editor.isStart(e,l.anchor,u))return}}t(i)},e.deleteForward=i=>{const{selection:l}=e;if(l){const[c]=d.Editor.nodes(e,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&(u.type==="table-cell"||u.type==="table-header-cell")});if(c){const[,u]=c;if(d.Editor.isEnd(e,l.anchor,u))return}}n(i)},e.insertBreak=()=>{const{selection:i}=e;if(i){const[l]=d.Editor.nodes(e,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&c.type==="table"});if(l){d.Transforms.insertText(e,`
1445
+ `);return}}r()},e},bg={table:{renderElement:e=>o.jsx(dg,{...e}),matchNode:e=>e.type==="table",isInBlocksSelector:!1},"table-row":{renderElement:e=>o.jsx(ug,{...e}),matchNode:e=>e.type==="table-row",isInBlocksSelector:!1},"table-cell":{renderElement:e=>o.jsx(ks,{...e}),matchNode:e=>e.type==="table-cell",isInBlocksSelector:!1},"table-header-cell":{renderElement:e=>o.jsx(ks,{...e}),matchNode:e=>e.type==="table-header-cell",isInBlocksSelector:!1}},Ln=new Map;function yg(e){const{type:t}=e;if(typeof t!="string"||t.length===0)throw new Error("A block definition needs a non-empty string `type`.");if(oc.isBuiltInBlockType(t))throw new Error(`"${t}" is a built-in Better Blocks type and cannot be re-registered.`);if(Ln.has(t))throw new Error(`Block type "${t}" is registered twice.`);Ln.set(t,e)}function Ct(){return[...Ln.values()]}function ko(e){return!!(e.icon&&e.label&&e.insert)}function vi(e){const{label:t,type:n}=e;return t&&typeof t!="string"?t:{id:`components.Blocks.blocks.${n}`,defaultMessage:t??n}}function xg(){Ln.clear()}function vg(e){const{isVoid:t}=e,n=new Set(Ct().filter(r=>(r.content??"void")==="void").map(r=>r.type));return e.isVoid=r=>n.has(r.type??"")||t(r),Ct().reduce((r,s)=>s.withEditor?.(r)??r,e)}function wg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return M.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const tr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function jo(e){return"nodeType"in e}function ne(e){var t,n;return e?Mt(e)?e:jo(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $o(e){const{Document:t}=ne(e);return e instanceof t}function hn(e){return Mt(e)?!1:e instanceof ne(e).HTMLElement}function wi(e){return e instanceof ne(e).SVGElement}function Bt(e){return e?Mt(e)?e.document:jo(e)?$o(e)?e:hn(e)||wi(e)?e.ownerDocument:document:document:document}const je=tr?M.useLayoutEffect:M.useEffect;function Eo(e){const t=M.useRef(e);return je(()=>{t.current=e}),M.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function kg(){const e=M.useRef(null),t=M.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=M.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function an(e,t){t===void 0&&(t=[e]);const n=M.useRef(e);return je(()=>{n.current!==e&&(n.current=e)},t),n}function fn(e,t){const n=M.useRef();return M.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function On(e){const t=Eo(e),n=M.useRef(null),r=M.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function Gr(e){const t=M.useRef();return M.useEffect(()=>{t.current=e},[e]),t.current}let $r={};function gn(e,t){return M.useMemo(()=>{if(t)return t;const n=$r[e]==null?0:$r[e]+1;return $r[e]=n,e+"-"+n},[e,t])}function ki(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((a,i)=>{const l=Object.entries(i);for(const[c,u]of l){const h=a[c];h!=null&&(a[c]=h+e*u)}return a},{...t})}}const Et=ki(1),zn=ki(-1);function jg(e){return"clientX"in e&&"clientY"in e}function Co(e){if(!e)return!1;const{KeyboardEvent:t}=ne(e.target);return t&&e instanceof t}function $g(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Vr(e){if($g(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return jg(e)?{x:e.clientX,y:e.clientY}:null}const ln=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ln.Translate.toString(e),ln.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),js="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eg(e){return e.matches(js)?e:e.querySelector(js)}const Cg={display:"none"};function Sg(e){let{id:t,value:n}=e;return k.default.createElement("div",{id:t,style:Cg},n)}function Tg(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return k.default.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Mg(){const[e,t]=M.useState("");return{announce:M.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ji=M.createContext(null);function Bg(e){const t=M.useContext(ji);M.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ig(){const[e]=M.useState(()=>new Set),t=M.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[M.useCallback(r=>{let{type:s,event:a}=r;e.forEach(i=>{var l;return(l=i[s])==null?void 0:l.call(i,a)})},[e]),t]}const Rg={draggable:`
1446
1446
  To pick up a draggable item, press the space bar.
1447
1447
  While dragging, use the arrow keys to move the item.
1448
1448
  Press space again to drop the item in its new position, or press escape to cancel.
1449
- `},Cg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Sg(e){let{announcements:t=Cg,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Eg}=e;const{announce:a,announcement:i}=kg(),l=fn("DndLiveRegion"),[c,u]=T.useState(!1);if(T.useEffect(()=>{u(!0)},[]),jg(T.useMemo(()=>({onDragStart(f){let{active:g}=f;a(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&a(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;a(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;a(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;a(t.onDragCancel({active:g,over:m}))}}),[a,t])),!c)return null;const h=k.default.createElement(k.default.Fragment,null,k.default.createElement(vg,{id:r,value:s.draggable}),k.default.createElement(wg,{id:l,announcement:i}));return n?Yt.createPortal(h,n):h}var X;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(X||(X={}));function On(){}function ws(e,t){return T.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Tg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return T.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const xe=Object.freeze({x:0,y:0});function Mg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ig(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Rg(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Bg(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ks(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Fg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=ks(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=Mg(ks(c),s);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Ig)};function Dg(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=s-r,l=a-n;if(r<s&&n<a){const c=t.width*t.height,u=e.width*e.height,h=i*l,f=h/(c+u-h);return Number(f.toFixed(4))}return 0}const Ag=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const c=Dg(l,t);c>0&&s.push({id:i,data:{droppableContainer:a,value:c}})}}return s.sort(Rg)};function _g(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xe}function Ng(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return s.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const Pg=Ng(1);function Lg(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Og(e,t,n){const r=Lg(t);if(!r)return e;const{scaleX:s,scaleY:a,x:i,y:l}=r,c=e.left-i-(1-s)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?e.width/s:e.width,f=a?e.height/a:e.height;return{width:h,height:f,top:u,right:c+h,bottom:u+f,left:c}}const zg={ignoreTransform:!1};function It(e,t){t===void 0&&(t=zg);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=ne(e).getComputedStyle(e);u&&(n=Og(n,u,h))}const{top:r,left:s,width:a,height:i,bottom:l,right:c}=n;return{top:r,left:s,width:a,height:i,bottom:l,right:c}}function js(e){return It(e,{ignoreTransform:!0})}function Hg(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ug(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function Wg(e,t){t===void 0&&(t=ne(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?n.test(a):!1})}function $o(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(wo(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!pn(s)||xi(s)||n.includes(s))return n;const a=ne(e).getComputedStyle(s);return s!==e&&Wg(s,a)&&n.push(s),Ug(s,a)?n:r(s.parentNode)}return e?r(e):n}function ki(e){const[t]=$o(e,1);return t??null}function jr(e){return!Qn||!e?null:Tt(e)?e:vo(e)?wo(e)||e===Mt(e).scrollingElement?window:pn(e)?e:null:null}function ji(e){return Tt(e)?e.scrollX:e.scrollLeft}function $i(e){return Tt(e)?e.scrollY:e.scrollTop}function Gr(e){return{x:ji(e),y:$i(e)}}var Y;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Y||(Y={}));function Ei(e){return!Qn||!e?!1:e===document.scrollingElement}function Ci(e){const t={x:0,y:0},n=Ei(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Kg={x:.2,y:.2};function Gg(e,t,n,r,s){let{top:a,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Kg);const{isTop:u,isBottom:h,isLeft:f,isRight:g}=Ci(e),m={x:0,y:0},w={x:0,y:0},x={height:t.height*s.y,width:t.width*s.x};return!u&&a<=t.top+x.height?(m.y=Y.Backward,w.y=r*Math.abs((t.top+x.height-a)/x.height)):!h&&c>=t.bottom-x.height&&(m.y=Y.Forward,w.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!g&&l>=t.right-x.width?(m.x=Y.Forward,w.x=r*Math.abs((t.right-x.width-l)/x.width)):!f&&i<=t.left+x.width&&(m.x=Y.Backward,w.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:m,speed:w}}function Vg(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Si(e){return e.reduce((t,n)=>Et(t,Gr(n)),xe)}function qg(e){return e.reduce((t,n)=>t+ji(n),0)}function Xg(e){return e.reduce((t,n)=>t+$i(n),0)}function Yg(e,t){if(t===void 0&&(t=It),!e)return;const{top:n,left:r,bottom:s,right:a}=t(e);ki(e)&&(s<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Zg=[["x",["left","right"],qg],["y",["top","bottom"],Xg]];class Eo{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=$o(n),s=Si(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of Zg)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=l(r),h=s[a]-u;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class en{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Jg(e){const{EventTarget:t}=ne(e);return e instanceof t?e:Mt(e)}function $r(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ue;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ue||(ue={}));function $s(e){e.preventDefault()}function Qg(e){e.stopPropagation()}var U;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(U||(U={}));const Ti={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},em=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}};class Mi{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new en(Mt(n)),this.windowListeners=new en(ne(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ue.Resize,this.handleCancel),this.windowListeners.add(ue.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ue.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Yg(r),n(xe)}handleKeyDown(t){if(jo(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:a=Ti,coordinateGetter:i=em,scrollBehavior:l="smooth"}=s,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:xe;this.referenceCoordinates||(this.referenceCoordinates=h);const f=i(t,{active:n,context:r.current,currentCoordinates:h});if(f){const g=Ln(f,h),m={x:0,y:0},{scrollableAncestors:w}=r.current;for(const x of w){const y=t.code,{isTop:$,isRight:E,isLeft:S,isBottom:R,maxScroll:C,minScroll:M}=Ci(x),j=Vg(x),v={x:Math.min(y===U.Right?j.right-j.width/2:j.right,Math.max(y===U.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===U.Down?j.bottom-j.height/2:j.bottom,Math.max(y===U.Down?j.top:j.top+j.height/2,f.y))},I=y===U.Right&&!E||y===U.Left&&!S,A=y===U.Down&&!R||y===U.Up&&!$;if(I&&v.x!==f.x){const N=x.scrollLeft+g.x,F=y===U.Right&&N<=C.x||y===U.Left&&N>=M.x;if(F&&!g.y){x.scrollTo({left:N,behavior:l});return}F?m.x=x.scrollLeft-N:m.x=y===U.Right?x.scrollLeft-C.x:x.scrollLeft-M.x,m.x&&x.scrollBy({left:-m.x,behavior:l});break}else if(A&&v.y!==f.y){const N=x.scrollTop+g.y,F=y===U.Down&&N<=C.y||y===U.Up&&N>=M.y;if(F&&!g.x){x.scrollTo({top:N,behavior:l});return}F?m.y=x.scrollTop-N:m.y=y===U.Down?x.scrollTop-C.y:x.scrollTop-M.y,m.y&&x.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Et(Ln(f,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Mi.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ti,onActivation:s}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Es(e){return!!(e&&"distance"in e)}function Cs(e){return!!(e&&"delay"in e)}class Co{constructor(t,n,r){var s;r===void 0&&(r=Jg(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=Mt(i),this.documentListeners=new en(this.document),this.listeners=new en(r),this.windowListeners=new en(ne(i)),this.initialCoordinates=(s=Kr(a))!=null?s:xe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ue.Resize,this.handleCancel),this.windowListeners.add(ue.DragStart,$s),this.windowListeners.add(ue.VisibilityChange,this.handleCancel),this.windowListeners.add(ue.ContextMenu,$s),this.documentListeners.add(ue.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cs(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Es(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ue.Click,Qg,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ue.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!s)return;const c=(n=Kr(t))!=null?n:xe,u=Ln(s,c);if(!r&&l){if(Es(l)){if(l.tolerance!=null&&$r(u,l.tolerance))return this.handleCancel();if($r(u,l.distance))return this.handleStart()}if(Cs(l)&&$r(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===U.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const tm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class So extends Co{constructor(t){const{event:n}=t,r=Mt(n.target);super(t,tm,r)}}So.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const nm={move:{name:"mousemove"},end:{name:"mouseup"}};var Vr;(function(e){e[e.RightClick=2]="RightClick"})(Vr||(Vr={}));class rm extends Co{constructor(t){super(t,nm,Mt(t.event.target))}}rm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vr.RightClick?!1:(r?.({event:n}),!0)}}];const Er={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ii extends Co{constructor(t){super(t,Er)}static setup(){return window.addEventListener(Er.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Er.move.name,t)};function t(){}}}Ii.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var tn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(tn||(tn={}));var zn;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(zn||(zn={}));function om(e){let{acceleration:t,activator:n=tn.Pointer,canScroll:r,draggingRect:s,enabled:a,interval:i=5,order:l=zn.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:h,delta:f,threshold:g}=e;const m=am({delta:f,disabled:!a}),[w,x]=gg(),y=T.useRef({x:0,y:0}),$=T.useRef({x:0,y:0}),E=T.useMemo(()=>{switch(n){case tn.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case tn.DraggableRect:return s}},[n,s,c]),S=T.useRef(null),R=T.useCallback(()=>{const M=S.current;if(!M)return;const j=y.current.x*$.current.x,v=y.current.y*$.current.y;M.scrollBy(j,v)},[]),C=T.useMemo(()=>l===zn.TreeOrder?[...u].reverse():u,[l,u]);T.useEffect(()=>{if(!a||!u.length||!E){x();return}for(const M of C){if(r?.(M)===!1)continue;const j=u.indexOf(M),v=h[j];if(!v)continue;const{direction:I,speed:A}=Gg(M,v,E,t,g);for(const N of["x","y"])m[N][I[N]]||(A[N]=0,I[N]=0);if(A.x>0||A.y>0){x(),S.current=M,w(R,i),y.current=A,$.current=I;return}}y.current={x:0,y:0},$.current={x:0,y:0},x()},[t,R,r,x,a,i,JSON.stringify(E),JSON.stringify(m),w,u,C,h,JSON.stringify(g)])}const sm={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function am(e){let{delta:t,disabled:n}=e;const r=Wr(t);return hn(s=>{if(n||!r||!s)return sm;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:s.x[Y.Backward]||a.x===-1,[Y.Forward]:s.x[Y.Forward]||a.x===1},y:{[Y.Backward]:s.y[Y.Backward]||a.y===-1,[Y.Forward]:s.y[Y.Forward]||a.y===1}}},[n,t,r])}function im(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return hn(s=>{var a;return t==null?null:(a=r??s)!=null?a:null},[r,t])}function lm(e,t){return T.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,a=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...a]},[]),[e,t])}var ln;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ln||(ln={}));var qr;(function(e){e.Optimized="optimized"})(qr||(qr={}));const Ss=new Map;function cm(e,t){let{dragging:n,dependencies:r,config:s}=t;const[a,i]=T.useState(null),{frequency:l,measure:c,strategy:u}=s,h=T.useRef(e),f=y(),g=sn(f),m=T.useCallback(function($){$===void 0&&($=[]),!g.current&&i(E=>E===null?$:E.concat($.filter(S=>!E.includes(S))))},[g]),w=T.useRef(null),x=hn($=>{if(f&&!n)return Ss;if(!$||$===Ss||h.current!==e||a!=null){const E=new Map;for(let S of e){if(!S)continue;if(a&&a.length>0&&!a.includes(S.id)&&S.rect.current){E.set(S.id,S.rect.current);continue}const R=S.node.current,C=R?new Eo(c(R),R):null;S.rect.current=C,C&&E.set(S.id,C)}return E}return $},[e,a,n,f,c]);return T.useEffect(()=>{h.current=e},[e]),T.useEffect(()=>{f||m()},[n,f]),T.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),T.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{m(),w.current=null},l))},[l,f,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:a!=null};function y(){switch(u){case ln.Always:return!1;case ln.BeforeDragging:return n;default:return!n}}}function Ri(e,t){return hn(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function dm(e,t){return Ri(e,t)}function um(e){let{callback:t,disabled:n}=e;const r=ko(t),s=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return T.useEffect(()=>()=>s?.disconnect(),[s]),s}function er(e){let{callback:t,disabled:n}=e;const r=ko(t),s=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return T.useEffect(()=>()=>s?.disconnect(),[s]),s}function pm(e){return new Eo(It(e),e)}function Ts(e,t,n){t===void 0&&(t=pm);const[r,s]=T.useState(null);function a(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const i=um({callback(c){if(e)for(const u of c){const{type:h,target:f}=u;if(h==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=er({callback:a});return je(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function hm(e){const t=Ri(e);return wi(e,t)}const Ms=[];function fm(e){const t=T.useRef(e),n=hn(r=>e?r&&r!==Ms&&e&&t.current&&e.parentNode===t.current.parentNode?r:$o(e):Ms,[e]);return T.useEffect(()=>{t.current=e},[e]),n}function gm(e){const[t,n]=T.useState(null),r=T.useRef(e),s=T.useCallback(a=>{const i=jr(a.target);i&&n(l=>l?(l.set(i,Gr(i)),new Map(l)):null)},[]);return T.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(c=>{const u=jr(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Gr(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const u=jr(c);u?.removeEventListener("scroll",s)})}},[s,e]),T.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Et(a,i),xe):Si(e):xe,[e,t])}function Is(e,t){t===void 0&&(t=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},t),T.useEffect(()=>{const r=e!==xe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ln(e,n.current):xe}function mm(e){T.useEffect(()=>{if(!Qn)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function bm(e,t){return T.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:a}=r;return n[s]=i=>{a(i,t)},n},{}),[e,t])}function Bi(e){return T.useMemo(()=>e?Hg(e):null,[e])}const Rs=[];function xm(e,t){t===void 0&&(t=It);const[n]=e,r=Bi(n?ne(n):null),[s,a]=T.useState(Rs);function i(){a(()=>e.length?e.map(c=>Ei(c)?r:new Eo(t(c),c)):Rs)}const l=er({callback:i});return je(()=>{l?.disconnect(),i(),e.forEach(c=>l?.observe(c))},[e]),s}function ym(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return pn(t)?t:e}function vm(e){let{measure:t}=e;const[n,r]=T.useState(null),s=T.useCallback(u=>{for(const{target:h}of u)if(pn(h)){r(f=>{const g=t(h);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),a=er({callback:s}),i=T.useCallback(u=>{const h=ym(u);a?.disconnect(),h&&a?.observe(h),r(h?t(h):null)},[t,a]),[l,c]=Pn(i);return T.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const wm=[{sensor:So,options:{}},{sensor:Mi,options:{}}],km={current:{}},Nn={draggable:{measure:js},droppable:{measure:js,strategy:ln.WhileDragging,frequency:qr.Optimized},dragOverlay:{measure:It}};class nn extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const jm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new nn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:On},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nn,measureDroppableContainers:On,windowRect:null,measuringScheduled:!1},$m={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:On,draggableNodes:new Map,over:null,measureDroppableContainers:On},tr=T.createContext($m),Fi=T.createContext(jm);function Em(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new nn}}}function Cm(e,t){switch(t.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new nn(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case X.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new nn(e.droppable.containers);return i.set(n,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case X.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new nn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Sm(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=T.useContext(tr),a=Wr(r),i=Wr(n?.id);return T.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!jo(a)||document.activeElement===a.target)return;const l=s.get(i);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[c.current,u.current]){if(!h)continue;const f=xg(h);if(f){f.focus();break}}})}},[r,t,s,i,a]),null}function Tm(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...r}),n):n}function Mm(e){return T.useMemo(()=>({draggable:{...Nn.draggable,...e?.draggable},droppable:{...Nn.droppable,...e?.droppable},dragOverlay:{...Nn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Im(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const a=T.useRef(!1),{x:i,y:l}=typeof s=="boolean"?{x:s,y:s}:s;je(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const h=n(u),f=wi(h,r);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=ki(u);g&&g.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const Di=T.createContext({...xe,scaleX:1,scaleY:1});var Ge;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ge||(Ge={}));const Rm=T.memo(function(t){var n,r,s,a;let{id:i,accessibility:l,autoScroll:c=!0,children:u,sensors:h=wm,collisionDetection:f=Ag,measuring:g,modifiers:m,...w}=t;const x=T.useReducer(Cm,void 0,Em),[y,$]=x,[E,S]=$g(),[R,C]=T.useState(Ge.Uninitialized),M=R===Ge.Initialized,{draggable:{active:j,nodes:v,translate:I},droppable:{containers:A}}=y,N=j!=null?v.get(j):null,F=T.useRef({initial:null,translated:null}),_=T.useMemo(()=>{var ee;return j!=null?{id:j,data:(ee=N?.data)!=null?ee:km,rect:F}:null},[j,N]),L=T.useRef(null),[H,V]=T.useState(null),[G,Ne]=T.useState(null),ae=sn(w,Object.values(w)),Se=fn("DndDescribedBy",i),Te=T.useMemo(()=>A.getEnabled(),[A]),q=Mm(g),{droppableRects:te,measureDroppableContainers:ie,measuringScheduled:ut}=cm(Te,{dragging:M,dependencies:[I.x,I.y],config:q.droppable}),le=im(v,j),yn=T.useMemo(()=>G?Kr(G):null,[G]),Pe=Wl(),Me=dm(le,q.draggable.measure);Im({activeNode:j!=null?v.get(j):null,config:Pe.layoutShiftCompensation,initialRect:Me,measure:q.draggable.measure});const W=Ts(le,q.draggable.measure,Me),Pt=Ts(le?le.parentElement:null),ye=T.useRef({activatorEvent:null,active:null,activeNode:le,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pt=A.getNodeFor((n=ye.current.over)==null?void 0:n.id),Ie=vm({measure:q.dragOverlay.measure}),ht=(r=Ie.nodeRef.current)!=null?r:le,ft=M?(s=Ie.rect)!=null?s:W:null,Po=!!(Ie.nodeRef.current&&Ie.rect),Lo=hm(Po?null:W),lr=Bi(ht?ne(ht):null),Le=fm(M?pt??le:null),vn=xm(Le),wn=Tm(m,{transform:{x:I.x-Lo.x,y:I.y-Lo.y,scaleX:1,scaleY:1},activatorEvent:G,active:_,activeNodeRect:W,containerNodeRect:Pt,draggingNodeRect:ft,over:ye.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:Le,scrollableAncestorRects:vn,windowRect:lr}),Oo=yn?Et(yn,I):null,zo=gm(Le),Nl=Is(zo),Pl=Is(zo,[W]),gt=Et(wn,Nl),mt=ft?Pg(ft,wn):null,Lt=_&&mt?f({active:_,collisionRect:mt,droppableRects:te,droppableContainers:Te,pointerCoordinates:Oo}):null,Ho=Bg(Lt,"id"),[Oe,Uo]=T.useState(null),Ll=Po?wn:Et(wn,Pl),Ol=_g(Ll,(a=Oe?.rect)!=null?a:null,W),cr=T.useRef(null),Wo=T.useCallback((ee,re)=>{let{sensor:oe,options:ze}=re;if(L.current==null)return;const ce=v.get(L.current);if(!ce)return;const se=ee.nativeEvent,ve=new oe({active:L.current,activeNode:ce,event:se,options:ze,context:ye,onAbort(Z){if(!v.get(Z))return;const{onDragAbort:we}=ae.current,Re={id:Z};we?.(Re),E({type:"onDragAbort",event:Re})},onPending(Z,He,we,Re){if(!v.get(Z))return;const{onDragPending:zt}=ae.current,Ue={id:Z,constraint:He,initialCoordinates:we,offset:Re};zt?.(Ue),E({type:"onDragPending",event:Ue})},onStart(Z){const He=L.current;if(He==null)return;const we=v.get(He);if(!we)return;const{onDragStart:Re}=ae.current,Ot={activatorEvent:se,active:{id:He,data:we.data,rect:F}};Yt.unstable_batchedUpdates(()=>{Re?.(Ot),C(Ge.Initializing),$({type:X.DragStart,initialCoordinates:Z,active:He}),E({type:"onDragStart",event:Ot}),V(cr.current),Ne(se)})},onMove(Z){$({type:X.DragMove,coordinates:Z})},onEnd:bt(X.DragEnd),onCancel:bt(X.DragCancel)});cr.current=ve;function bt(Z){return async function(){const{active:we,collisions:Re,over:Ot,scrollAdjustedTranslate:zt}=ye.current;let Ue=null;if(we&&zt){const{cancelDrop:Ht}=ae.current;Ue={activatorEvent:se,active:we,collisions:Re,delta:zt,over:Ot},Z===X.DragEnd&&typeof Ht=="function"&&await Promise.resolve(Ht(Ue))&&(Z=X.DragCancel)}L.current=null,Yt.unstable_batchedUpdates(()=>{$({type:Z}),C(Ge.Uninitialized),Uo(null),V(null),Ne(null),cr.current=null;const Ht=Z===X.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const dr=ae.current[Ht];dr?.(Ue),E({type:Ht,event:Ue})}})}}},[v]),zl=T.useCallback((ee,re)=>(oe,ze)=>{const ce=oe.nativeEvent,se=v.get(ze);if(L.current!==null||!se||ce.dndKit||ce.defaultPrevented)return;const ve={active:se};ee(oe,re.options,ve)===!0&&(ce.dndKit={capturedBy:re.sensor},L.current=ze,Wo(oe,re))},[v,Wo]),Ko=lm(h,zl);mm(h),je(()=>{W&&R===Ge.Initializing&&C(Ge.Initialized)},[W,R]),T.useEffect(()=>{const{onDragMove:ee}=ae.current,{active:re,activatorEvent:oe,collisions:ze,over:ce}=ye.current;if(!re||!oe)return;const se={active:re,activatorEvent:oe,collisions:ze,delta:{x:gt.x,y:gt.y},over:ce};Yt.unstable_batchedUpdates(()=>{ee?.(se),E({type:"onDragMove",event:se})})},[gt.x,gt.y]),T.useEffect(()=>{const{active:ee,activatorEvent:re,collisions:oe,droppableContainers:ze,scrollAdjustedTranslate:ce}=ye.current;if(!ee||L.current==null||!re||!ce)return;const{onDragOver:se}=ae.current,ve=ze.get(Ho),bt=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,Z={active:ee,activatorEvent:re,collisions:oe,delta:{x:ce.x,y:ce.y},over:bt};Yt.unstable_batchedUpdates(()=>{Uo(bt),se?.(Z),E({type:"onDragOver",event:Z})})},[Ho]),je(()=>{ye.current={activatorEvent:G,active:_,activeNode:le,collisionRect:mt,collisions:Lt,droppableRects:te,draggableNodes:v,draggingNode:ht,draggingNodeRect:ft,droppableContainers:A,over:Oe,scrollableAncestors:Le,scrollAdjustedTranslate:gt},F.current={initial:ft,translated:mt}},[_,le,Lt,mt,v,ht,ft,te,A,Oe,Le,gt]),om({...Pe,delta:I,draggingRect:mt,pointerCoordinates:Oo,scrollableAncestors:Le,scrollableAncestorRects:vn});const Hl=T.useMemo(()=>({active:_,activeNode:le,activeNodeRect:W,activatorEvent:G,collisions:Lt,containerNodeRect:Pt,dragOverlay:Ie,draggableNodes:v,droppableContainers:A,droppableRects:te,over:Oe,measureDroppableContainers:ie,scrollableAncestors:Le,scrollableAncestorRects:vn,measuringConfiguration:q,measuringScheduled:ut,windowRect:lr}),[_,le,W,G,Lt,Pt,Ie,v,A,te,Oe,ie,Le,vn,q,ut,lr]),Ul=T.useMemo(()=>({activatorEvent:G,activators:Ko,active:_,activeNodeRect:W,ariaDescribedById:{draggable:Se},dispatch:$,draggableNodes:v,over:Oe,measureDroppableContainers:ie}),[G,Ko,_,W,$,Se,v,Oe,ie]);return k.default.createElement(vi.Provider,{value:S},k.default.createElement(tr.Provider,{value:Ul},k.default.createElement(Fi.Provider,{value:Hl},k.default.createElement(Di.Provider,{value:Ol},u)),k.default.createElement(Sm,{disabled:l?.restoreFocus===!1})),k.default.createElement(Sg,{...l,hiddenTextDescribedById:Se}));function Wl(){const ee=H?.autoScrollEnabled===!1,re=typeof c=="object"?c.enabled===!1:c===!1,oe=M&&!ee&&!re;return typeof c=="object"?{...c,enabled:oe}:{enabled:oe}}}),Bm=T.createContext(null),Bs="button",Fm="Draggable";function Dm(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const a=fn(Fm),{activators:i,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:h,draggableNodes:f,over:g}=T.useContext(tr),{role:m=Bs,roleDescription:w="draggable",tabIndex:x=0}=s??{},y=c?.id===t,$=T.useContext(y?Di:Bm),[E,S]=Pn(),[R,C]=Pn(),M=bm(i,t),j=sn(n);je(()=>(f.set(t,{id:t,key:a,node:E,activatorNode:R,data:j}),()=>{const I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);const v=T.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&m===Bs?!0:void 0,"aria-roledescription":w,"aria-describedby":h.draggable}),[r,m,x,y,w,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:v,isDragging:y,listeners:r?void 0:M,node:E,over:g,setNodeRef:S,setActivatorNodeRef:C,transform:$}}function Am(){return T.useContext(Fi)}const _m="Droppable",Nm={timeout:25};function Pm(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const a=fn(_m),{active:i,dispatch:l,over:c,measureDroppableContainers:u}=T.useContext(tr),h=T.useRef({disabled:n}),f=T.useRef(!1),g=T.useRef(null),m=T.useRef(null),{disabled:w,updateMeasurementsFor:x,timeout:y}={...Nm,...s},$=sn(x??r),E=T.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray($.current)?$.current:[$.current]),m.current=null},y)},[y]),S=er({callback:E,disabled:w||!i}),R=T.useCallback((v,I)=>{S&&(I&&(S.unobserve(I),f.current=!1),v&&S.observe(v))},[S]),[C,M]=Pn(R),j=sn(t);return T.useEffect(()=>{!S||!C.current||(S.disconnect(),f.current=!1,S.observe(C.current))},[C,S]),T.useEffect(()=>(l({type:X.RegisterDroppable,element:{id:r,key:a,disabled:n,node:C,rect:g,data:j}}),()=>l({type:X.UnregisterDroppable,key:a,id:r})),[r]),T.useEffect(()=>{n!==h.current.disabled&&(l({type:X.SetDroppableDisabled,id:r,key:a,disabled:n}),h.current.disabled=n)},[r,a,n,l]),{active:i,rect:g,isOver:c?.id===r,node:C,over:c,setNodeRef:M}}function Ai(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Lm(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function Tn(e){return e!==null&&e>=0}function Om(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function zm(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const _i=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=Ai(t,r,n),i=t[s],l=a[s];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},Mn={scaleX:1,scaleY:1},Hm=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:i}=e;const l=(t=a[n])!=null?t:r;if(!l)return null;if(s===n){const u=a[i];return u?{x:0,y:n<i?u.top+u.height-(l.top+l.height):u.top-l.top,...Mn}:null}const c=Um(a,s,n);return s>n&&s<=i?{x:0,y:-l.height-c,...Mn}:s<n&&s>=i?{x:0,y:l.height+c,...Mn}:{x:0,y:0,...Mn}};function Um(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Ni="Sortable",Pi=k.default.createContext({activeIndex:-1,containerId:Ni,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_i,disabled:{draggable:!1,droppable:!1}});function Wm(e){let{children:t,id:n,items:r,strategy:s=_i,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:h}=Am(),f=fn(Ni,n),g=l.rect!==null,m=T.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),w=i!=null,x=i?m.indexOf(i.id):-1,y=u?m.indexOf(u.id):-1,$=T.useRef(m),E=!Om(m,$.current),S=y!==-1&&x===-1||E,R=zm(a);je(()=>{E&&w&&h(m)},[E,m,w,h]),T.useEffect(()=>{$.current=m},[m]);const C=T.useMemo(()=>({activeIndex:x,containerId:f,disabled:R,disableTransforms:S,items:m,overIndex:y,useDragOverlay:g,sortedRects:Lm(m,c),strategy:s}),[x,f,R.draggable,R.droppable,S,m,y,c,g,s]);return k.default.createElement(Pi.Provider,{value:C},t)}const Km=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return Ai(n,r,s).indexOf(t)},Gm=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:i,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&s===i?!1:n?!0:i!==s&&t===c},Vm={duration:200,easing:"ease"},Li="transform",qm=an.Transition.toString({property:Li,duration:0,easing:"linear"}),Xm={roleDescription:"sortable"};function Ym(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,i]=T.useState(null),l=T.useRef(n);return je(()=>{if(!t&&n!==l.current&&r.current){const c=s.current;if(c){const u=It(r.current,{ignoreTransform:!0}),h={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(h.x||h.y)&&i(h)}}n!==l.current&&(l.current=n)},[t,n,r,s]),T.useEffect(()=>{a&&i(null)},[a]),a}function Zm(e){let{animateLayoutChanges:t=Gm,attributes:n,disabled:r,data:s,getNewIndex:a=Km,id:i,strategy:l,resizeObserverConfig:c,transition:u=Vm}=e;const{items:h,containerId:f,activeIndex:g,disabled:m,disableTransforms:w,sortedRects:x,overIndex:y,useDragOverlay:$,strategy:E}=T.useContext(Pi),S=Jm(r,m),R=h.indexOf(i),C=T.useMemo(()=>({sortable:{containerId:f,index:R,items:h},...s}),[f,s,R,h]),M=T.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:j,node:v,isOver:I,setNodeRef:A}=Pm({id:i,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...c}}),{active:N,activatorEvent:F,activeNodeRect:_,attributes:L,setNodeRef:H,listeners:V,isDragging:G,over:Ne,setActivatorNodeRef:ae,transform:Se}=Dm({id:i,data:C,attributes:{...Xm,...n},disabled:S.draggable}),Te=fg(A,H),q=!!N,te=q&&!w&&Tn(g)&&Tn(y),ie=!$&&G,ut=ie&&te?Se:null,yn=te?ut??(l??E)({rects:x,activeNodeRect:_,activeIndex:g,overIndex:y,index:R}):null,Pe=Tn(g)&&Tn(y)?a({id:i,items:h,activeIndex:g,overIndex:y}):R,Me=N?.id,W=T.useRef({activeId:Me,items:h,newIndex:Pe,containerId:f}),Pt=h!==W.current.items,ye=t({active:N,containerId:f,isDragging:G,isSorting:q,id:i,index:R,items:h,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:u,wasDragging:W.current.activeId!=null}),pt=Ym({disabled:!ye,index:R,node:v,rect:j});return T.useEffect(()=>{q&&W.current.newIndex!==Pe&&(W.current.newIndex=Pe),f!==W.current.containerId&&(W.current.containerId=f),h!==W.current.items&&(W.current.items=h)},[q,Pe,f,h]),T.useEffect(()=>{if(Me===W.current.activeId)return;if(Me!=null&&W.current.activeId==null){W.current.activeId=Me;return}const ht=setTimeout(()=>{W.current.activeId=Me},50);return()=>clearTimeout(ht)},[Me]),{active:N,activeIndex:g,attributes:L,data:C,rect:j,index:R,newIndex:Pe,items:h,isOver:I,isSorting:q,isDragging:G,listeners:V,node:v,overIndex:y,over:Ne,setNodeRef:Te,setActivatorNodeRef:ae,setDroppableNodeRef:A,setDraggableNodeRef:H,transform:pt??yn,transition:Ie()};function Ie(){if(pt||Pt&&W.current.newIndex===R)return qm;if(!(ie&&!jo(F)||!u)&&(q||ye))return an.Transition.toString({...u,property:Li})}}function Jm(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}U.Down,U.Right,U.Up,U.Left;var In=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const Hn={UPWARD:"upward",DOWNWARD:"downward"},Qm=b.createGlobalStyle`
1449
+ `},Fg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Dg(e){let{announcements:t=Fg,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Rg}=e;const{announce:a,announcement:i}=Mg(),l=gn("DndLiveRegion"),[c,u]=M.useState(!1);if(M.useEffect(()=>{u(!0)},[]),Bg(M.useMemo(()=>({onDragStart(f){let{active:g}=f;a(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&a(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;a(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;a(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;a(t.onDragCancel({active:g,over:m}))}}),[a,t])),!c)return null;const h=k.default.createElement(k.default.Fragment,null,k.default.createElement(Sg,{id:r,value:s.draggable}),k.default.createElement(Tg,{id:l,announcement:i}));return n?Zt.createPortal(h,n):h}var X;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(X||(X={}));function Hn(){}function $s(e,t){return M.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ag(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return M.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ye=Object.freeze({x:0,y:0});function _g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ng(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Pg(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Lg(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Es(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Og=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=Es(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=_g(Es(c),s);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Ng)};function zg(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=s-r,l=a-n;if(r<s&&n<a){const c=t.width*t.height,u=e.width*e.height,h=i*l,f=h/(c+u-h);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const c=zg(l,t);c>0&&s.push({id:i,data:{droppableContainer:a,value:c}})}}return s.sort(Pg)};function Ug(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $i(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ye}function Wg(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return s.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const Kg=Wg(1);function Gg(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Vg(e,t,n){const r=Gg(t);if(!r)return e;const{scaleX:s,scaleY:a,x:i,y:l}=r,c=e.left-i-(1-s)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?e.width/s:e.width,f=a?e.height/a:e.height;return{width:h,height:f,top:u,right:c+h,bottom:u+f,left:c}}const qg={ignoreTransform:!1};function It(e,t){t===void 0&&(t=qg);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=ne(e).getComputedStyle(e);u&&(n=Vg(n,u,h))}const{top:r,left:s,width:a,height:i,bottom:l,right:c}=n;return{top:r,left:s,width:a,height:i,bottom:l,right:c}}function Cs(e){return It(e,{ignoreTransform:!0})}function Xg(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Yg(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function Zg(e,t){t===void 0&&(t=ne(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?n.test(a):!1})}function So(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if($o(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!hn(s)||wi(s)||n.includes(s))return n;const a=ne(e).getComputedStyle(s);return s!==e&&Zg(s,a)&&n.push(s),Yg(s,a)?n:r(s.parentNode)}return e?r(e):n}function Ei(e){const[t]=So(e,1);return t??null}function Er(e){return!tr||!e?null:Mt(e)?e:jo(e)?$o(e)||e===Bt(e).scrollingElement?window:hn(e)?e:null:null}function Ci(e){return Mt(e)?e.scrollX:e.scrollLeft}function Si(e){return Mt(e)?e.scrollY:e.scrollTop}function qr(e){return{x:Ci(e),y:Si(e)}}var Y;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Y||(Y={}));function Ti(e){return!tr||!e?!1:e===document.scrollingElement}function Mi(e){const t={x:0,y:0},n=Ti(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Jg={x:.2,y:.2};function Qg(e,t,n,r,s){let{top:a,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Jg);const{isTop:u,isBottom:h,isLeft:f,isRight:g}=Mi(e),m={x:0,y:0},x={x:0,y:0},y={height:t.height*s.y,width:t.width*s.x};return!u&&a<=t.top+y.height?(m.y=Y.Backward,x.y=r*Math.abs((t.top+y.height-a)/y.height)):!h&&c>=t.bottom-y.height&&(m.y=Y.Forward,x.y=r*Math.abs((t.bottom-y.height-c)/y.height)),!g&&l>=t.right-y.width?(m.x=Y.Forward,x.x=r*Math.abs((t.right-y.width-l)/y.width)):!f&&i<=t.left+y.width&&(m.x=Y.Backward,x.x=r*Math.abs((t.left+y.width-i)/y.width)),{direction:m,speed:x}}function em(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Bi(e){return e.reduce((t,n)=>Et(t,qr(n)),ye)}function tm(e){return e.reduce((t,n)=>t+Ci(n),0)}function nm(e){return e.reduce((t,n)=>t+Si(n),0)}function rm(e,t){if(t===void 0&&(t=It),!e)return;const{top:n,left:r,bottom:s,right:a}=t(e);Ei(e)&&(s<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const om=[["x",["left","right"],tm],["y",["top","bottom"],nm]];class To{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=So(n),s=Bi(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of om)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=l(r),h=s[a]-u;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tn{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function sm(e){const{EventTarget:t}=ne(e);return e instanceof t?e:Bt(e)}function Cr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ue;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ue||(ue={}));function Ss(e){e.preventDefault()}function am(e){e.stopPropagation()}var U;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(U||(U={}));const Ii={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},im=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}};class Ri{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new tn(Bt(n)),this.windowListeners=new tn(ne(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ue.Resize,this.handleCancel),this.windowListeners.add(ue.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ue.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&rm(r),n(ye)}handleKeyDown(t){if(Co(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:a=Ii,coordinateGetter:i=im,scrollBehavior:l="smooth"}=s,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:ye;this.referenceCoordinates||(this.referenceCoordinates=h);const f=i(t,{active:n,context:r.current,currentCoordinates:h});if(f){const g=zn(f,h),m={x:0,y:0},{scrollableAncestors:x}=r.current;for(const y of x){const v=t.code,{isTop:$,isRight:E,isLeft:C,isBottom:I,maxScroll:S,minScroll:T}=Mi(y),j=em(y),w={x:Math.min(v===U.Right?j.right-j.width/2:j.right,Math.max(v===U.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(v===U.Down?j.bottom-j.height/2:j.bottom,Math.max(v===U.Down?j.top:j.top+j.height/2,f.y))},B=v===U.Right&&!E||v===U.Left&&!C,A=v===U.Down&&!I||v===U.Up&&!$;if(B&&w.x!==f.x){const N=y.scrollLeft+g.x,F=v===U.Right&&N<=S.x||v===U.Left&&N>=T.x;if(F&&!g.y){y.scrollTo({left:N,behavior:l});return}F?m.x=y.scrollLeft-N:m.x=v===U.Right?y.scrollLeft-S.x:y.scrollLeft-T.x,m.x&&y.scrollBy({left:-m.x,behavior:l});break}else if(A&&w.y!==f.y){const N=y.scrollTop+g.y,F=v===U.Down&&N<=S.y||v===U.Up&&N>=T.y;if(F&&!g.x){y.scrollTo({top:N,behavior:l});return}F?m.y=y.scrollTop-N:m.y=v===U.Down?y.scrollTop-S.y:y.scrollTop-T.y,m.y&&y.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Et(zn(f,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ri.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ii,onActivation:s}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Ts(e){return!!(e&&"distance"in e)}function Ms(e){return!!(e&&"delay"in e)}class Mo{constructor(t,n,r){var s;r===void 0&&(r=sm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=Bt(i),this.documentListeners=new tn(this.document),this.listeners=new tn(r),this.windowListeners=new tn(ne(i)),this.initialCoordinates=(s=Vr(a))!=null?s:ye,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ue.Resize,this.handleCancel),this.windowListeners.add(ue.DragStart,Ss),this.windowListeners.add(ue.VisibilityChange,this.handleCancel),this.windowListeners.add(ue.ContextMenu,Ss),this.documentListeners.add(ue.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ms(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ts(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ue.Click,am,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ue.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!s)return;const c=(n=Vr(t))!=null?n:ye,u=zn(s,c);if(!r&&l){if(Ts(l)){if(l.tolerance!=null&&Cr(u,l.tolerance))return this.handleCancel();if(Cr(u,l.distance))return this.handleStart()}if(Ms(l)&&Cr(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===U.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const lm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Bo extends Mo{constructor(t){const{event:n}=t,r=Bt(n.target);super(t,lm,r)}}Bo.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const cm={move:{name:"mousemove"},end:{name:"mouseup"}};var Xr;(function(e){e[e.RightClick=2]="RightClick"})(Xr||(Xr={}));class dm extends Mo{constructor(t){super(t,cm,Bt(t.event.target))}}dm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Xr.RightClick?!1:(r?.({event:n}),!0)}}];const Sr={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Fi extends Mo{constructor(t){super(t,Sr)}static setup(){return window.addEventListener(Sr.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Sr.move.name,t)};function t(){}}}Fi.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var nn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(nn||(nn={}));var Un;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Un||(Un={}));function um(e){let{acceleration:t,activator:n=nn.Pointer,canScroll:r,draggingRect:s,enabled:a,interval:i=5,order:l=Un.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:h,delta:f,threshold:g}=e;const m=hm({delta:f,disabled:!a}),[x,y]=kg(),v=M.useRef({x:0,y:0}),$=M.useRef({x:0,y:0}),E=M.useMemo(()=>{switch(n){case nn.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case nn.DraggableRect:return s}},[n,s,c]),C=M.useRef(null),I=M.useCallback(()=>{const T=C.current;if(!T)return;const j=v.current.x*$.current.x,w=v.current.y*$.current.y;T.scrollBy(j,w)},[]),S=M.useMemo(()=>l===Un.TreeOrder?[...u].reverse():u,[l,u]);M.useEffect(()=>{if(!a||!u.length||!E){y();return}for(const T of S){if(r?.(T)===!1)continue;const j=u.indexOf(T),w=h[j];if(!w)continue;const{direction:B,speed:A}=Qg(T,w,E,t,g);for(const N of["x","y"])m[N][B[N]]||(A[N]=0,B[N]=0);if(A.x>0||A.y>0){y(),C.current=T,x(I,i),v.current=A,$.current=B;return}}v.current={x:0,y:0},$.current={x:0,y:0},y()},[t,I,r,y,a,i,JSON.stringify(E),JSON.stringify(m),x,u,S,h,JSON.stringify(g)])}const pm={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function hm(e){let{delta:t,disabled:n}=e;const r=Gr(t);return fn(s=>{if(n||!r||!s)return pm;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:s.x[Y.Backward]||a.x===-1,[Y.Forward]:s.x[Y.Forward]||a.x===1},y:{[Y.Backward]:s.y[Y.Backward]||a.y===-1,[Y.Forward]:s.y[Y.Forward]||a.y===1}}},[n,t,r])}function fm(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return fn(s=>{var a;return t==null?null:(a=r??s)!=null?a:null},[r,t])}function gm(e,t){return M.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,a=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...a]},[]),[e,t])}var cn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(cn||(cn={}));var Yr;(function(e){e.Optimized="optimized"})(Yr||(Yr={}));const Bs=new Map;function mm(e,t){let{dragging:n,dependencies:r,config:s}=t;const[a,i]=M.useState(null),{frequency:l,measure:c,strategy:u}=s,h=M.useRef(e),f=v(),g=an(f),m=M.useCallback(function($){$===void 0&&($=[]),!g.current&&i(E=>E===null?$:E.concat($.filter(C=>!E.includes(C))))},[g]),x=M.useRef(null),y=fn($=>{if(f&&!n)return Bs;if(!$||$===Bs||h.current!==e||a!=null){const E=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){E.set(C.id,C.rect.current);continue}const I=C.node.current,S=I?new To(c(I),I):null;C.rect.current=S,S&&E.set(C.id,S)}return E}return $},[e,a,n,f,c]);return M.useEffect(()=>{h.current=e},[e]),M.useEffect(()=>{f||m()},[n,f]),M.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),M.useEffect(()=>{f||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{m(),x.current=null},l))},[l,f,m,...r]),{droppableRects:y,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(u){case cn.Always:return!1;case cn.BeforeDragging:return n;default:return!n}}}function Di(e,t){return fn(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function bm(e,t){return Di(e,t)}function ym(e){let{callback:t,disabled:n}=e;const r=Eo(t),s=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return M.useEffect(()=>()=>s?.disconnect(),[s]),s}function nr(e){let{callback:t,disabled:n}=e;const r=Eo(t),s=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return M.useEffect(()=>()=>s?.disconnect(),[s]),s}function xm(e){return new To(It(e),e)}function Is(e,t,n){t===void 0&&(t=xm);const[r,s]=M.useState(null);function a(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const i=ym({callback(c){if(e)for(const u of c){const{type:h,target:f}=u;if(h==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=nr({callback:a});return je(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function vm(e){const t=Di(e);return $i(e,t)}const Rs=[];function wm(e){const t=M.useRef(e),n=fn(r=>e?r&&r!==Rs&&e&&t.current&&e.parentNode===t.current.parentNode?r:So(e):Rs,[e]);return M.useEffect(()=>{t.current=e},[e]),n}function km(e){const[t,n]=M.useState(null),r=M.useRef(e),s=M.useCallback(a=>{const i=Er(a.target);i&&n(l=>l?(l.set(i,qr(i)),new Map(l)):null)},[]);return M.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(c=>{const u=Er(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,qr(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const u=Er(c);u?.removeEventListener("scroll",s)})}},[s,e]),M.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Et(a,i),ye):Bi(e):ye,[e,t])}function Fs(e,t){t===void 0&&(t=[]);const n=M.useRef(null);return M.useEffect(()=>{n.current=null},t),M.useEffect(()=>{const r=e!==ye;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?zn(e,n.current):ye}function jm(e){M.useEffect(()=>{if(!tr)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function $m(e,t){return M.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:a}=r;return n[s]=i=>{a(i,t)},n},{}),[e,t])}function Ai(e){return M.useMemo(()=>e?Xg(e):null,[e])}const Ds=[];function Em(e,t){t===void 0&&(t=It);const[n]=e,r=Ai(n?ne(n):null),[s,a]=M.useState(Ds);function i(){a(()=>e.length?e.map(c=>Ti(c)?r:new To(t(c),c)):Ds)}const l=nr({callback:i});return je(()=>{l?.disconnect(),i(),e.forEach(c=>l?.observe(c))},[e]),s}function Cm(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return hn(t)?t:e}function Sm(e){let{measure:t}=e;const[n,r]=M.useState(null),s=M.useCallback(u=>{for(const{target:h}of u)if(hn(h)){r(f=>{const g=t(h);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),a=nr({callback:s}),i=M.useCallback(u=>{const h=Cm(u);a?.disconnect(),h&&a?.observe(h),r(h?t(h):null)},[t,a]),[l,c]=On(i);return M.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const Tm=[{sensor:Bo,options:{}},{sensor:Ri,options:{}}],Mm={current:{}},Pn={draggable:{measure:Cs},droppable:{measure:Cs,strategy:cn.WhileDragging,frequency:Yr.Optimized},dragOverlay:{measure:It}};class rn extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Bm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new rn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pn,measureDroppableContainers:Hn,windowRect:null,measuringScheduled:!1},Im={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Hn,draggableNodes:new Map,over:null,measureDroppableContainers:Hn},rr=M.createContext(Im),_i=M.createContext(Bm);function Rm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new rn}}}function Fm(e,t){switch(t.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new rn(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case X.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new rn(e.droppable.containers);return i.set(n,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case X.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new rn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Dm(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=M.useContext(rr),a=Gr(r),i=Gr(n?.id);return M.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!Co(a)||document.activeElement===a.target)return;const l=s.get(i);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[c.current,u.current]){if(!h)continue;const f=Eg(h);if(f){f.focus();break}}})}},[r,t,s,i,a]),null}function Am(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...r}),n):n}function _m(e){return M.useMemo(()=>({draggable:{...Pn.draggable,...e?.draggable},droppable:{...Pn.droppable,...e?.droppable},dragOverlay:{...Pn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Nm(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const a=M.useRef(!1),{x:i,y:l}=typeof s=="boolean"?{x:s,y:s}:s;je(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const h=n(u),f=$i(h,r);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=Ei(u);g&&g.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const Ni=M.createContext({...ye,scaleX:1,scaleY:1});var Ge;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ge||(Ge={}));const Pm=M.memo(function(t){var n,r,s,a;let{id:i,accessibility:l,autoScroll:c=!0,children:u,sensors:h=Tm,collisionDetection:f=Hg,measuring:g,modifiers:m,...x}=t;const y=M.useReducer(Fm,void 0,Rm),[v,$]=y,[E,C]=Ig(),[I,S]=M.useState(Ge.Uninitialized),T=I===Ge.Initialized,{draggable:{active:j,nodes:w,translate:B},droppable:{containers:A}}=v,N=j!=null?w.get(j):null,F=M.useRef({initial:null,translated:null}),_=M.useMemo(()=>{var ee;return j!=null?{id:j,data:(ee=N?.data)!=null?ee:Mm,rect:F}:null},[j,N]),L=M.useRef(null),[H,V]=M.useState(null),[G,Ne]=M.useState(null),ae=an(x,Object.values(x)),Se=gn("DndDescribedBy",i),Te=M.useMemo(()=>A.getEnabled(),[A]),q=_m(g),{droppableRects:te,measureDroppableContainers:ie,measuringScheduled:ut}=mm(Te,{dragging:T,dependencies:[B.x,B.y],config:q.droppable}),le=fm(w,j),vn=M.useMemo(()=>G?Vr(G):null,[G]),Pe=Vl(),Me=bm(le,q.draggable.measure);Nm({activeNode:j!=null?w.get(j):null,config:Pe.layoutShiftCompensation,initialRect:Me,measure:q.draggable.measure});const W=Is(le,q.draggable.measure,Me),Lt=Is(le?le.parentElement:null),xe=M.useRef({activatorEvent:null,active:null,activeNode:le,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:w,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pt=A.getNodeFor((n=xe.current.over)==null?void 0:n.id),Be=Sm({measure:q.dragOverlay.measure}),ht=(r=Be.nodeRef.current)!=null?r:le,ft=T?(s=Be.rect)!=null?s:W:null,zo=!!(Be.nodeRef.current&&Be.rect),Ho=vm(zo?null:W),dr=Ai(ht?ne(ht):null),Le=wm(T?pt??le:null),wn=Em(Le),kn=Am(m,{transform:{x:B.x-Ho.x,y:B.y-Ho.y,scaleX:1,scaleY:1},activatorEvent:G,active:_,activeNodeRect:W,containerNodeRect:Lt,draggingNodeRect:ft,over:xe.current.over,overlayNodeRect:Be.rect,scrollableAncestors:Le,scrollableAncestorRects:wn,windowRect:dr}),Uo=vn?Et(vn,B):null,Wo=km(Le),Ol=Fs(Wo),zl=Fs(Wo,[W]),gt=Et(kn,Ol),mt=ft?Kg(ft,kn):null,Ot=_&&mt?f({active:_,collisionRect:mt,droppableRects:te,droppableContainers:Te,pointerCoordinates:Uo}):null,Ko=Lg(Ot,"id"),[Oe,Go]=M.useState(null),Hl=zo?kn:Et(kn,zl),Ul=Ug(Hl,(a=Oe?.rect)!=null?a:null,W),ur=M.useRef(null),Vo=M.useCallback((ee,re)=>{let{sensor:oe,options:ze}=re;if(L.current==null)return;const ce=w.get(L.current);if(!ce)return;const se=ee.nativeEvent,ve=new oe({active:L.current,activeNode:ce,event:se,options:ze,context:xe,onAbort(Z){if(!w.get(Z))return;const{onDragAbort:we}=ae.current,Ie={id:Z};we?.(Ie),E({type:"onDragAbort",event:Ie})},onPending(Z,He,we,Ie){if(!w.get(Z))return;const{onDragPending:Ht}=ae.current,Ue={id:Z,constraint:He,initialCoordinates:we,offset:Ie};Ht?.(Ue),E({type:"onDragPending",event:Ue})},onStart(Z){const He=L.current;if(He==null)return;const we=w.get(He);if(!we)return;const{onDragStart:Ie}=ae.current,zt={activatorEvent:se,active:{id:He,data:we.data,rect:F}};Zt.unstable_batchedUpdates(()=>{Ie?.(zt),S(Ge.Initializing),$({type:X.DragStart,initialCoordinates:Z,active:He}),E({type:"onDragStart",event:zt}),V(ur.current),Ne(se)})},onMove(Z){$({type:X.DragMove,coordinates:Z})},onEnd:bt(X.DragEnd),onCancel:bt(X.DragCancel)});ur.current=ve;function bt(Z){return async function(){const{active:we,collisions:Ie,over:zt,scrollAdjustedTranslate:Ht}=xe.current;let Ue=null;if(we&&Ht){const{cancelDrop:Ut}=ae.current;Ue={activatorEvent:se,active:we,collisions:Ie,delta:Ht,over:zt},Z===X.DragEnd&&typeof Ut=="function"&&await Promise.resolve(Ut(Ue))&&(Z=X.DragCancel)}L.current=null,Zt.unstable_batchedUpdates(()=>{$({type:Z}),S(Ge.Uninitialized),Go(null),V(null),Ne(null),ur.current=null;const Ut=Z===X.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const pr=ae.current[Ut];pr?.(Ue),E({type:Ut,event:Ue})}})}}},[w]),Wl=M.useCallback((ee,re)=>(oe,ze)=>{const ce=oe.nativeEvent,se=w.get(ze);if(L.current!==null||!se||ce.dndKit||ce.defaultPrevented)return;const ve={active:se};ee(oe,re.options,ve)===!0&&(ce.dndKit={capturedBy:re.sensor},L.current=ze,Vo(oe,re))},[w,Vo]),qo=gm(h,Wl);jm(h),je(()=>{W&&I===Ge.Initializing&&S(Ge.Initialized)},[W,I]),M.useEffect(()=>{const{onDragMove:ee}=ae.current,{active:re,activatorEvent:oe,collisions:ze,over:ce}=xe.current;if(!re||!oe)return;const se={active:re,activatorEvent:oe,collisions:ze,delta:{x:gt.x,y:gt.y},over:ce};Zt.unstable_batchedUpdates(()=>{ee?.(se),E({type:"onDragMove",event:se})})},[gt.x,gt.y]),M.useEffect(()=>{const{active:ee,activatorEvent:re,collisions:oe,droppableContainers:ze,scrollAdjustedTranslate:ce}=xe.current;if(!ee||L.current==null||!re||!ce)return;const{onDragOver:se}=ae.current,ve=ze.get(Ko),bt=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,Z={active:ee,activatorEvent:re,collisions:oe,delta:{x:ce.x,y:ce.y},over:bt};Zt.unstable_batchedUpdates(()=>{Go(bt),se?.(Z),E({type:"onDragOver",event:Z})})},[Ko]),je(()=>{xe.current={activatorEvent:G,active:_,activeNode:le,collisionRect:mt,collisions:Ot,droppableRects:te,draggableNodes:w,draggingNode:ht,draggingNodeRect:ft,droppableContainers:A,over:Oe,scrollableAncestors:Le,scrollAdjustedTranslate:gt},F.current={initial:ft,translated:mt}},[_,le,Ot,mt,w,ht,ft,te,A,Oe,Le,gt]),um({...Pe,delta:B,draggingRect:mt,pointerCoordinates:Uo,scrollableAncestors:Le,scrollableAncestorRects:wn});const Kl=M.useMemo(()=>({active:_,activeNode:le,activeNodeRect:W,activatorEvent:G,collisions:Ot,containerNodeRect:Lt,dragOverlay:Be,draggableNodes:w,droppableContainers:A,droppableRects:te,over:Oe,measureDroppableContainers:ie,scrollableAncestors:Le,scrollableAncestorRects:wn,measuringConfiguration:q,measuringScheduled:ut,windowRect:dr}),[_,le,W,G,Ot,Lt,Be,w,A,te,Oe,ie,Le,wn,q,ut,dr]),Gl=M.useMemo(()=>({activatorEvent:G,activators:qo,active:_,activeNodeRect:W,ariaDescribedById:{draggable:Se},dispatch:$,draggableNodes:w,over:Oe,measureDroppableContainers:ie}),[G,qo,_,W,$,Se,w,Oe,ie]);return k.default.createElement(ji.Provider,{value:C},k.default.createElement(rr.Provider,{value:Gl},k.default.createElement(_i.Provider,{value:Kl},k.default.createElement(Ni.Provider,{value:Ul},u)),k.default.createElement(Dm,{disabled:l?.restoreFocus===!1})),k.default.createElement(Dg,{...l,hiddenTextDescribedById:Se}));function Vl(){const ee=H?.autoScrollEnabled===!1,re=typeof c=="object"?c.enabled===!1:c===!1,oe=T&&!ee&&!re;return typeof c=="object"?{...c,enabled:oe}:{enabled:oe}}}),Lm=M.createContext(null),As="button",Om="Draggable";function zm(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const a=gn(Om),{activators:i,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:h,draggableNodes:f,over:g}=M.useContext(rr),{role:m=As,roleDescription:x="draggable",tabIndex:y=0}=s??{},v=c?.id===t,$=M.useContext(v?Ni:Lm),[E,C]=On(),[I,S]=On(),T=$m(i,t),j=an(n);je(()=>(f.set(t,{id:t,key:a,node:E,activatorNode:I,data:j}),()=>{const B=f.get(t);B&&B.key===a&&f.delete(t)}),[f,t]);const w=M.useMemo(()=>({role:m,tabIndex:y,"aria-disabled":r,"aria-pressed":v&&m===As?!0:void 0,"aria-roledescription":x,"aria-describedby":h.draggable}),[r,m,y,v,x,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:w,isDragging:v,listeners:r?void 0:T,node:E,over:g,setNodeRef:C,setActivatorNodeRef:S,transform:$}}function Hm(){return M.useContext(_i)}const Um="Droppable",Wm={timeout:25};function Km(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const a=gn(Um),{active:i,dispatch:l,over:c,measureDroppableContainers:u}=M.useContext(rr),h=M.useRef({disabled:n}),f=M.useRef(!1),g=M.useRef(null),m=M.useRef(null),{disabled:x,updateMeasurementsFor:y,timeout:v}={...Wm,...s},$=an(y??r),E=M.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray($.current)?$.current:[$.current]),m.current=null},v)},[v]),C=nr({callback:E,disabled:x||!i}),I=M.useCallback((w,B)=>{C&&(B&&(C.unobserve(B),f.current=!1),w&&C.observe(w))},[C]),[S,T]=On(I),j=an(t);return M.useEffect(()=>{!C||!S.current||(C.disconnect(),f.current=!1,C.observe(S.current))},[S,C]),M.useEffect(()=>(l({type:X.RegisterDroppable,element:{id:r,key:a,disabled:n,node:S,rect:g,data:j}}),()=>l({type:X.UnregisterDroppable,key:a,id:r})),[r]),M.useEffect(()=>{n!==h.current.disabled&&(l({type:X.SetDroppableDisabled,id:r,key:a,disabled:n}),h.current.disabled=n)},[r,a,n,l]),{active:i,rect:g,isOver:c?.id===r,node:S,over:c,setNodeRef:T}}function Pi(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Gm(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function Mn(e){return e!==null&&e>=0}function Vm(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function qm(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Li=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=Pi(t,r,n),i=t[s],l=a[s];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},Bn={scaleX:1,scaleY:1},Xm=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:i}=e;const l=(t=a[n])!=null?t:r;if(!l)return null;if(s===n){const u=a[i];return u?{x:0,y:n<i?u.top+u.height-(l.top+l.height):u.top-l.top,...Bn}:null}const c=Ym(a,s,n);return s>n&&s<=i?{x:0,y:-l.height-c,...Bn}:s<n&&s>=i?{x:0,y:l.height+c,...Bn}:{x:0,y:0,...Bn}};function Ym(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Oi="Sortable",zi=k.default.createContext({activeIndex:-1,containerId:Oi,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Li,disabled:{draggable:!1,droppable:!1}});function Zm(e){let{children:t,id:n,items:r,strategy:s=Li,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:h}=Hm(),f=gn(Oi,n),g=l.rect!==null,m=M.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),x=i!=null,y=i?m.indexOf(i.id):-1,v=u?m.indexOf(u.id):-1,$=M.useRef(m),E=!Vm(m,$.current),C=v!==-1&&y===-1||E,I=qm(a);je(()=>{E&&x&&h(m)},[E,m,x,h]),M.useEffect(()=>{$.current=m},[m]);const S=M.useMemo(()=>({activeIndex:y,containerId:f,disabled:I,disableTransforms:C,items:m,overIndex:v,useDragOverlay:g,sortedRects:Gm(m,c),strategy:s}),[y,f,I.draggable,I.droppable,C,m,v,c,g,s]);return k.default.createElement(zi.Provider,{value:S},t)}const Jm=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return Pi(n,r,s).indexOf(t)},Qm=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:i,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&s===i?!1:n?!0:i!==s&&t===c},eb={duration:200,easing:"ease"},Hi="transform",tb=ln.Transition.toString({property:Hi,duration:0,easing:"linear"}),nb={roleDescription:"sortable"};function rb(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,i]=M.useState(null),l=M.useRef(n);return je(()=>{if(!t&&n!==l.current&&r.current){const c=s.current;if(c){const u=It(r.current,{ignoreTransform:!0}),h={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(h.x||h.y)&&i(h)}}n!==l.current&&(l.current=n)},[t,n,r,s]),M.useEffect(()=>{a&&i(null)},[a]),a}function ob(e){let{animateLayoutChanges:t=Qm,attributes:n,disabled:r,data:s,getNewIndex:a=Jm,id:i,strategy:l,resizeObserverConfig:c,transition:u=eb}=e;const{items:h,containerId:f,activeIndex:g,disabled:m,disableTransforms:x,sortedRects:y,overIndex:v,useDragOverlay:$,strategy:E}=M.useContext(zi),C=sb(r,m),I=h.indexOf(i),S=M.useMemo(()=>({sortable:{containerId:f,index:I,items:h},...s}),[f,s,I,h]),T=M.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:j,node:w,isOver:B,setNodeRef:A}=Km({id:i,data:S,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:N,activatorEvent:F,activeNodeRect:_,attributes:L,setNodeRef:H,listeners:V,isDragging:G,over:Ne,setActivatorNodeRef:ae,transform:Se}=zm({id:i,data:S,attributes:{...nb,...n},disabled:C.draggable}),Te=wg(A,H),q=!!N,te=q&&!x&&Mn(g)&&Mn(v),ie=!$&&G,ut=ie&&te?Se:null,vn=te?ut??(l??E)({rects:y,activeNodeRect:_,activeIndex:g,overIndex:v,index:I}):null,Pe=Mn(g)&&Mn(v)?a({id:i,items:h,activeIndex:g,overIndex:v}):I,Me=N?.id,W=M.useRef({activeId:Me,items:h,newIndex:Pe,containerId:f}),Lt=h!==W.current.items,xe=t({active:N,containerId:f,isDragging:G,isSorting:q,id:i,index:I,items:h,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:u,wasDragging:W.current.activeId!=null}),pt=rb({disabled:!xe,index:I,node:w,rect:j});return M.useEffect(()=>{q&&W.current.newIndex!==Pe&&(W.current.newIndex=Pe),f!==W.current.containerId&&(W.current.containerId=f),h!==W.current.items&&(W.current.items=h)},[q,Pe,f,h]),M.useEffect(()=>{if(Me===W.current.activeId)return;if(Me!=null&&W.current.activeId==null){W.current.activeId=Me;return}const ht=setTimeout(()=>{W.current.activeId=Me},50);return()=>clearTimeout(ht)},[Me]),{active:N,activeIndex:g,attributes:L,data:S,rect:j,index:I,newIndex:Pe,items:h,isOver:B,isSorting:q,isDragging:G,listeners:V,node:w,overIndex:v,over:Ne,setNodeRef:Te,setActivatorNodeRef:ae,setDroppableNodeRef:A,setDraggableNodeRef:H,transform:pt??vn,transition:Be()};function Be(){if(pt||Lt&&W.current.newIndex===I)return tb;if(!(ie&&!Co(F)||!u)&&(q||xe))return ln.Transition.toString({...u,property:Hi})}}function sb(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}U.Down,U.Right,U.Up,U.Left;var In=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const Wn={UPWARD:"upward",DOWNWARD:"downward"},ab=b.createGlobalStyle`
1450
1450
  [data-radix-menu-content] {
1451
1451
  scrollbar-width: auto !important;
1452
1452
  overflow-y: scroll !important;
@@ -1472,9 +1472,9 @@
1472
1472
  [data-radix-menu-content]::-webkit-scrollbar-thumb:hover {
1473
1473
  background-color: ${({theme:e})=>e.colors.neutral600};
1474
1474
  }
1475
- `,Fs=10,Zt=10,Cr=50,eb=b.styled.div`
1475
+ `,_s=10,Jt=10,Tr=50,ib=b.styled.div`
1476
1476
  display: grid;
1477
- grid-template-columns: repeat(${Zt}, 1.6rem);
1477
+ grid-template-columns: repeat(${Jt}, 1.6rem);
1478
1478
  grid-auto-rows: 1.6rem;
1479
1479
  gap: 2px;
1480
1480
  outline: none;
@@ -1484,20 +1484,20 @@
1484
1484
  outline-offset: 4px;
1485
1485
  border-radius: ${({theme:e})=>e.borderRadius};
1486
1486
  }
1487
- `,tb=b.styled.div`
1487
+ `,lb=b.styled.div`
1488
1488
  border: 1px solid
1489
1489
  ${({theme:e,$selected:t})=>t?e.colors.primary600:e.colors.neutral300};
1490
1490
  background: ${({theme:e,$selected:t})=>t?e.colors.primary200:e.colors.neutral0};
1491
1491
  border-radius: 2px;
1492
1492
  cursor: pointer;
1493
- `,nb=({onSelect:e})=>{const{formatMessage:t}=O.useIntl(),[n,r]=k.useState({rows:0,cols:0}),[s,a]=k.useState("3"),[i,l]=k.useState("3"),c=k.useRef(null);k.useEffect(()=>{c.current?.focus()},[]);const u=g=>Math.min(Math.max(g,1),Cr)||1,h=g=>{const{rows:m,cols:w}=n;switch(g.key){case"ArrowUp":g.preventDefault(),r({rows:Math.max(m-1,1),cols:Math.max(w,1)});return;case"ArrowDown":g.preventDefault(),r({rows:Math.min(m+1,Fs),cols:Math.max(w,1)});return;case"ArrowLeft":g.preventDefault(),r({rows:Math.max(m,1),cols:Math.max(w-1,1)});return;case"ArrowRight":g.preventDefault(),r({rows:Math.max(m,1),cols:Math.min(w+1,Zt)});return;case"Enter":case" ":m>0&&w>0&&(g.preventDefault(),e(m,w));return}},f=n.rows>0?`${n.rows} × ${n.cols}`:t({id:"components.Blocks.table.pickSize",defaultMessage:"Pick a size"});return o.jsxs(p.Flex,{direction:"column",alignItems:"stretch",gap:3,padding:3,children:[o.jsx(eb,{ref:c,role:"grid",tabIndex:0,"aria-label":t({id:"components.Blocks.table.gridPicker",defaultMessage:"Table size picker. Use the arrow keys to choose rows and columns, then press Enter."}),onKeyDown:h,onMouseLeave:()=>r({rows:0,cols:0}),children:Array.from({length:Fs*Zt},(g,m)=>{const w=Math.floor(m/Zt)+1,x=m%Zt+1;return o.jsx(tb,{role:"gridcell","aria-selected":w<=n.rows&&x<=n.cols,$selected:w<=n.rows&&x<=n.cols,onMouseEnter:()=>r({rows:w,cols:x}),onMouseDown:y=>{y.preventDefault(),e(w,x)}},m)})}),o.jsx(p.Box,{"aria-live":"polite",children:o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:f})}),o.jsxs(p.Flex,{gap:2,alignItems:"flex-end",children:[o.jsxs(p.Field.Root,{width:"7rem",children:[o.jsx(p.Field.Label,{children:t({id:"components.Blocks.table.rows",defaultMessage:"Rows"})}),o.jsx(p.Field.Input,{type:"number",min:1,max:Cr,value:s,onChange:g=>a(g.target.value)})]}),o.jsxs(p.Field.Root,{width:"7rem",children:[o.jsx(p.Field.Label,{children:t({id:"components.Blocks.table.columns",defaultMessage:"Columns"})}),o.jsx(p.Field.Input,{type:"number",min:1,max:Cr,value:i,onChange:g=>l(g.target.value)})]}),o.jsx(p.Button,{variant:"secondary",onClick:()=>e(u(Number(s)),u(Number(i))),children:t({id:"components.Blocks.insert",defaultMessage:"Insert"})})]})]})},zi={paragraph:"Digit0","heading-one":"Digit1","heading-two":"Digit2","heading-three":"Digit3","heading-four":"Digit4","heading-five":"Digit5","heading-six":"Digit6",quote:"KeyQ"},rb=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Ds=e=>e.replace(/^Digit/,"").replace(/^Key/,""),ob=e=>{const t=zi[e];return t?rb()?`⌘⌥${Ds(t)}`:`Ctrl+Alt+${Ds(t)}`:null},sb=e=>{if(!e.altKey||!(e.metaKey||e.ctrlKey)||e.shiftKey)return null;const t=Object.entries(zi).find(([,n])=>n===e.code);return t?t[0]:null},As=[{emoji:"😀",keywords:"grinning happy smile face"},{emoji:"😃",keywords:"smile happy joy face"},{emoji:"😄",keywords:"smile happy joy face eyes"},{emoji:"😁",keywords:"beaming grin happy face"},{emoji:"😆",keywords:"laugh happy face"},{emoji:"😅",keywords:"sweat laugh relief face"},{emoji:"🤣",keywords:"rofl laugh rolling floor"},{emoji:"😂",keywords:"joy tears laugh cry"},{emoji:"🙂",keywords:"slight smile face"},{emoji:"😉",keywords:"wink face"},{emoji:"😊",keywords:"blush smile happy face"},{emoji:"😇",keywords:"halo angel innocent face"},{emoji:"🥰",keywords:"love hearts smile face"},{emoji:"😍",keywords:"love heart eyes face"},{emoji:"🤩",keywords:"star struck excited face"},{emoji:"😘",keywords:"kiss face love"},{emoji:"😗",keywords:"kiss face"},{emoji:"😚",keywords:"kiss closed eyes face"},{emoji:"😋",keywords:"yum tongue tasty face"},{emoji:"😛",keywords:"tongue face"},{emoji:"😜",keywords:"wink tongue face"},{emoji:"🤪",keywords:"zany crazy face"},{emoji:"😝",keywords:"tongue squinting face"},{emoji:"🤑",keywords:"money dollar face rich"},{emoji:"🤗",keywords:"hug hands face"},{emoji:"🤭",keywords:"oops hand mouth face"},{emoji:"🤫",keywords:"shush quiet silence face"},{emoji:"🤔",keywords:"thinking think face"},{emoji:"🤐",keywords:"zipper mouth silence face"},{emoji:"🤨",keywords:"raised eyebrow suspicious face"},{emoji:"😐",keywords:"neutral face"},{emoji:"😑",keywords:"expressionless face"},{emoji:"😶",keywords:"no mouth face speechless"},{emoji:"😏",keywords:"smirk face"},{emoji:"😒",keywords:"unamused face"},{emoji:"🙄",keywords:"eye roll face"},{emoji:"😬",keywords:"grimace face"},{emoji:"😮",keywords:"open mouth face surprise"},{emoji:"😯",keywords:"hushed face surprise"},{emoji:"😲",keywords:"astonished face surprise"},{emoji:"😳",keywords:"flushed blush face"},{emoji:"🥺",keywords:"pleading puppy eyes face"},{emoji:"😢",keywords:"cry tear face sad"},{emoji:"😭",keywords:"sob cry loud face sad"},{emoji:"😤",keywords:"triumph huff face angry"},{emoji:"😠",keywords:"angry mad face"},{emoji:"😡",keywords:"rage angry mad face pouting"},{emoji:"🤬",keywords:"swear curse face angry"},{emoji:"😈",keywords:"devil imp face evil"},{emoji:"👿",keywords:"angry devil face evil"},{emoji:"👍",keywords:"thumbs up yes good ok"},{emoji:"👎",keywords:"thumbs down no bad"},{emoji:"👌",keywords:"ok hand perfect"},{emoji:"✌️",keywords:"peace victory"},{emoji:"🤞",keywords:"crossed fingers luck"},{emoji:"🤟",keywords:"love you hand"},{emoji:"🤘",keywords:"rock horns metal"},{emoji:"👊",keywords:"fist punch bump"},{emoji:"✊",keywords:"raised fist power"},{emoji:"🤛",keywords:"left fist punch bump"},{emoji:"👏",keywords:"clap hands applause"},{emoji:"🙌",keywords:"raising hands celebrate"},{emoji:"👐",keywords:"open hands"},{emoji:"🤲",keywords:"palms up hands"},{emoji:"🤝",keywords:"handshake agreement deal"},{emoji:"🙏",keywords:"pray thanks please hands"},{emoji:"💪",keywords:"muscle strong flex"},{emoji:"🦾",keywords:"mechanical arm muscle"},{emoji:"🖐️",keywords:"hand fingers splayed"},{emoji:"✋",keywords:"hand stop raised"},{emoji:"❤️",keywords:"red heart love"},{emoji:"🧡",keywords:"orange heart love"},{emoji:"💛",keywords:"yellow heart love"},{emoji:"💚",keywords:"green heart love"},{emoji:"💙",keywords:"blue heart love"},{emoji:"💜",keywords:"purple heart love"},{emoji:"🖤",keywords:"black heart love"},{emoji:"🤍",keywords:"white heart love"},{emoji:"💔",keywords:"broken heart sad"},{emoji:"💕",keywords:"two hearts love"},{emoji:"⭐",keywords:"star"},{emoji:"🌟",keywords:"glowing star sparkle"},{emoji:"✨",keywords:"sparkles stars"},{emoji:"⚡",keywords:"lightning zap electric"},{emoji:"🔥",keywords:"fire flame hot"},{emoji:"💯",keywords:"100 hundred perfect"},{emoji:"✅",keywords:"check mark done yes"},{emoji:"❌",keywords:"cross x no wrong"},{emoji:"⚠️",keywords:"warning alert caution"},{emoji:"💡",keywords:"idea bulb light"},{emoji:"🎉",keywords:"party popper celebrate"},{emoji:"🎊",keywords:"confetti celebrate"},{emoji:"🏆",keywords:"trophy win award"},{emoji:"🥇",keywords:"gold medal first win"},{emoji:"🎯",keywords:"target bullseye dart"},{emoji:"📌",keywords:"pin pushpin"},{emoji:"📎",keywords:"paperclip attachment"},{emoji:"🔗",keywords:"link chain"},{emoji:"📝",keywords:"note memo write"},{emoji:"📅",keywords:"calendar date"},{emoji:"🌈",keywords:"rainbow colors"},{emoji:"☀️",keywords:"sun sunny bright"},{emoji:"🌙",keywords:"moon night"},{emoji:"⛅",keywords:"sun cloud weather"},{emoji:"🌧️",keywords:"rain cloud weather"},{emoji:"❄️",keywords:"snowflake snow cold winter"},{emoji:"🌸",keywords:"cherry blossom flower"},{emoji:"🌺",keywords:"hibiscus flower"},{emoji:"🌻",keywords:"sunflower flower"},{emoji:"🍀",keywords:"clover luck four leaf"},{emoji:"☕",keywords:"coffee hot drink"},{emoji:"🍕",keywords:"pizza food"},{emoji:"🍔",keywords:"burger hamburger food"},{emoji:"🍟",keywords:"fries french food"},{emoji:"🍰",keywords:"cake slice dessert"},{emoji:"🎂",keywords:"birthday cake"},{emoji:"🍺",keywords:"beer drink"},{emoji:"🥂",keywords:"clink toast champagne"},{emoji:"🍷",keywords:"wine glass drink"},{emoji:"🧃",keywords:"juice box drink"},{emoji:"⬆️",keywords:"up arrow"},{emoji:"⬇️",keywords:"down arrow"},{emoji:"⬅️",keywords:"left arrow"},{emoji:"➡️",keywords:"right arrow"},{emoji:"↗️",keywords:"up right arrow"},{emoji:"↘️",keywords:"down right arrow"},{emoji:"↙️",keywords:"down left arrow"},{emoji:"↖️",keywords:"up left arrow"},{emoji:"↕️",keywords:"up down arrow"},{emoji:"↔️",keywords:"left right arrow"}],ab=b.styled.div`
1493
+ `,cb=({onSelect:e})=>{const{formatMessage:t}=O.useIntl(),[n,r]=k.useState({rows:0,cols:0}),[s,a]=k.useState("3"),[i,l]=k.useState("3"),c=k.useRef(null);k.useEffect(()=>{c.current?.focus()},[]);const u=g=>Math.min(Math.max(g,1),Tr)||1,h=g=>{const{rows:m,cols:x}=n;switch(g.key){case"ArrowUp":g.preventDefault(),r({rows:Math.max(m-1,1),cols:Math.max(x,1)});return;case"ArrowDown":g.preventDefault(),r({rows:Math.min(m+1,_s),cols:Math.max(x,1)});return;case"ArrowLeft":g.preventDefault(),r({rows:Math.max(m,1),cols:Math.max(x-1,1)});return;case"ArrowRight":g.preventDefault(),r({rows:Math.max(m,1),cols:Math.min(x+1,Jt)});return;case"Enter":case" ":m>0&&x>0&&(g.preventDefault(),e(m,x));return}},f=n.rows>0?`${n.rows} × ${n.cols}`:t({id:"components.Blocks.table.pickSize",defaultMessage:"Pick a size"});return o.jsxs(p.Flex,{direction:"column",alignItems:"stretch",gap:3,padding:3,children:[o.jsx(ib,{ref:c,role:"grid",tabIndex:0,"aria-label":t({id:"components.Blocks.table.gridPicker",defaultMessage:"Table size picker. Use the arrow keys to choose rows and columns, then press Enter."}),onKeyDown:h,onMouseLeave:()=>r({rows:0,cols:0}),children:Array.from({length:_s*Jt},(g,m)=>{const x=Math.floor(m/Jt)+1,y=m%Jt+1;return o.jsx(lb,{role:"gridcell","aria-selected":x<=n.rows&&y<=n.cols,$selected:x<=n.rows&&y<=n.cols,onMouseEnter:()=>r({rows:x,cols:y}),onMouseDown:v=>{v.preventDefault(),e(x,y)}},m)})}),o.jsx(p.Box,{"aria-live":"polite",children:o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:f})}),o.jsxs(p.Flex,{gap:2,alignItems:"flex-end",children:[o.jsxs(p.Field.Root,{width:"7rem",children:[o.jsx(p.Field.Label,{children:t({id:"components.Blocks.table.rows",defaultMessage:"Rows"})}),o.jsx(p.Field.Input,{type:"number",min:1,max:Tr,value:s,onChange:g=>a(g.target.value)})]}),o.jsxs(p.Field.Root,{width:"7rem",children:[o.jsx(p.Field.Label,{children:t({id:"components.Blocks.table.columns",defaultMessage:"Columns"})}),o.jsx(p.Field.Input,{type:"number",min:1,max:Tr,value:i,onChange:g=>l(g.target.value)})]}),o.jsx(p.Button,{variant:"secondary",onClick:()=>e(u(Number(s)),u(Number(i))),children:t({id:"components.Blocks.insert",defaultMessage:"Insert"})})]})]})},Wi={paragraph:"Digit0","heading-one":"Digit1","heading-two":"Digit2","heading-three":"Digit3","heading-four":"Digit4","heading-five":"Digit5","heading-six":"Digit6",quote:"KeyQ"},db=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Ns=e=>e.replace(/^Digit/,"").replace(/^Key/,""),ub=e=>{const t=Wi[e];return t?db()?`⌘⌥${Ns(t)}`:`Ctrl+Alt+${Ns(t)}`:null},pb=e=>{if(!e.altKey||!(e.metaKey||e.ctrlKey)||e.shiftKey)return null;const t=Object.entries(Wi).find(([,n])=>n===e.code);return t?t[0]:null},Ps=[{emoji:"😀",keywords:"grinning happy smile face"},{emoji:"😃",keywords:"smile happy joy face"},{emoji:"😄",keywords:"smile happy joy face eyes"},{emoji:"😁",keywords:"beaming grin happy face"},{emoji:"😆",keywords:"laugh happy face"},{emoji:"😅",keywords:"sweat laugh relief face"},{emoji:"🤣",keywords:"rofl laugh rolling floor"},{emoji:"😂",keywords:"joy tears laugh cry"},{emoji:"🙂",keywords:"slight smile face"},{emoji:"😉",keywords:"wink face"},{emoji:"😊",keywords:"blush smile happy face"},{emoji:"😇",keywords:"halo angel innocent face"},{emoji:"🥰",keywords:"love hearts smile face"},{emoji:"😍",keywords:"love heart eyes face"},{emoji:"🤩",keywords:"star struck excited face"},{emoji:"😘",keywords:"kiss face love"},{emoji:"😗",keywords:"kiss face"},{emoji:"😚",keywords:"kiss closed eyes face"},{emoji:"😋",keywords:"yum tongue tasty face"},{emoji:"😛",keywords:"tongue face"},{emoji:"😜",keywords:"wink tongue face"},{emoji:"🤪",keywords:"zany crazy face"},{emoji:"😝",keywords:"tongue squinting face"},{emoji:"🤑",keywords:"money dollar face rich"},{emoji:"🤗",keywords:"hug hands face"},{emoji:"🤭",keywords:"oops hand mouth face"},{emoji:"🤫",keywords:"shush quiet silence face"},{emoji:"🤔",keywords:"thinking think face"},{emoji:"🤐",keywords:"zipper mouth silence face"},{emoji:"🤨",keywords:"raised eyebrow suspicious face"},{emoji:"😐",keywords:"neutral face"},{emoji:"😑",keywords:"expressionless face"},{emoji:"😶",keywords:"no mouth face speechless"},{emoji:"😏",keywords:"smirk face"},{emoji:"😒",keywords:"unamused face"},{emoji:"🙄",keywords:"eye roll face"},{emoji:"😬",keywords:"grimace face"},{emoji:"😮",keywords:"open mouth face surprise"},{emoji:"😯",keywords:"hushed face surprise"},{emoji:"😲",keywords:"astonished face surprise"},{emoji:"😳",keywords:"flushed blush face"},{emoji:"🥺",keywords:"pleading puppy eyes face"},{emoji:"😢",keywords:"cry tear face sad"},{emoji:"😭",keywords:"sob cry loud face sad"},{emoji:"😤",keywords:"triumph huff face angry"},{emoji:"😠",keywords:"angry mad face"},{emoji:"😡",keywords:"rage angry mad face pouting"},{emoji:"🤬",keywords:"swear curse face angry"},{emoji:"😈",keywords:"devil imp face evil"},{emoji:"👿",keywords:"angry devil face evil"},{emoji:"👍",keywords:"thumbs up yes good ok"},{emoji:"👎",keywords:"thumbs down no bad"},{emoji:"👌",keywords:"ok hand perfect"},{emoji:"✌️",keywords:"peace victory"},{emoji:"🤞",keywords:"crossed fingers luck"},{emoji:"🤟",keywords:"love you hand"},{emoji:"🤘",keywords:"rock horns metal"},{emoji:"👊",keywords:"fist punch bump"},{emoji:"✊",keywords:"raised fist power"},{emoji:"🤛",keywords:"left fist punch bump"},{emoji:"👏",keywords:"clap hands applause"},{emoji:"🙌",keywords:"raising hands celebrate"},{emoji:"👐",keywords:"open hands"},{emoji:"🤲",keywords:"palms up hands"},{emoji:"🤝",keywords:"handshake agreement deal"},{emoji:"🙏",keywords:"pray thanks please hands"},{emoji:"💪",keywords:"muscle strong flex"},{emoji:"🦾",keywords:"mechanical arm muscle"},{emoji:"🖐️",keywords:"hand fingers splayed"},{emoji:"✋",keywords:"hand stop raised"},{emoji:"❤️",keywords:"red heart love"},{emoji:"🧡",keywords:"orange heart love"},{emoji:"💛",keywords:"yellow heart love"},{emoji:"💚",keywords:"green heart love"},{emoji:"💙",keywords:"blue heart love"},{emoji:"💜",keywords:"purple heart love"},{emoji:"🖤",keywords:"black heart love"},{emoji:"🤍",keywords:"white heart love"},{emoji:"💔",keywords:"broken heart sad"},{emoji:"💕",keywords:"two hearts love"},{emoji:"⭐",keywords:"star"},{emoji:"🌟",keywords:"glowing star sparkle"},{emoji:"✨",keywords:"sparkles stars"},{emoji:"⚡",keywords:"lightning zap electric"},{emoji:"🔥",keywords:"fire flame hot"},{emoji:"💯",keywords:"100 hundred perfect"},{emoji:"✅",keywords:"check mark done yes"},{emoji:"❌",keywords:"cross x no wrong"},{emoji:"⚠️",keywords:"warning alert caution"},{emoji:"💡",keywords:"idea bulb light"},{emoji:"🎉",keywords:"party popper celebrate"},{emoji:"🎊",keywords:"confetti celebrate"},{emoji:"🏆",keywords:"trophy win award"},{emoji:"🥇",keywords:"gold medal first win"},{emoji:"🎯",keywords:"target bullseye dart"},{emoji:"📌",keywords:"pin pushpin"},{emoji:"📎",keywords:"paperclip attachment"},{emoji:"🔗",keywords:"link chain"},{emoji:"📝",keywords:"note memo write"},{emoji:"📅",keywords:"calendar date"},{emoji:"🌈",keywords:"rainbow colors"},{emoji:"☀️",keywords:"sun sunny bright"},{emoji:"🌙",keywords:"moon night"},{emoji:"⛅",keywords:"sun cloud weather"},{emoji:"🌧️",keywords:"rain cloud weather"},{emoji:"❄️",keywords:"snowflake snow cold winter"},{emoji:"🌸",keywords:"cherry blossom flower"},{emoji:"🌺",keywords:"hibiscus flower"},{emoji:"🌻",keywords:"sunflower flower"},{emoji:"🍀",keywords:"clover luck four leaf"},{emoji:"☕",keywords:"coffee hot drink"},{emoji:"🍕",keywords:"pizza food"},{emoji:"🍔",keywords:"burger hamburger food"},{emoji:"🍟",keywords:"fries french food"},{emoji:"🍰",keywords:"cake slice dessert"},{emoji:"🎂",keywords:"birthday cake"},{emoji:"🍺",keywords:"beer drink"},{emoji:"🥂",keywords:"clink toast champagne"},{emoji:"🍷",keywords:"wine glass drink"},{emoji:"🧃",keywords:"juice box drink"},{emoji:"⬆️",keywords:"up arrow"},{emoji:"⬇️",keywords:"down arrow"},{emoji:"⬅️",keywords:"left arrow"},{emoji:"➡️",keywords:"right arrow"},{emoji:"↗️",keywords:"up right arrow"},{emoji:"↘️",keywords:"down right arrow"},{emoji:"↙️",keywords:"down left arrow"},{emoji:"↖️",keywords:"up left arrow"},{emoji:"↕️",keywords:"up down arrow"},{emoji:"↔️",keywords:"left right arrow"}],hb=b.styled.div`
1494
1494
  display: grid;
1495
1495
  grid-template-columns: repeat(8, 1fr);
1496
1496
  gap: 2px;
1497
1497
  max-height: 220px;
1498
1498
  overflow-y: auto;
1499
1499
  overflow-x: hidden;
1500
- `,ib=b.styled.button`
1500
+ `,fb=b.styled.button`
1501
1501
  background: none;
1502
1502
  border: none;
1503
1503
  font-size: 18px;
@@ -1514,13 +1514,13 @@
1514
1514
  &:hover {
1515
1515
  background: ${({theme:e})=>e.colors.primary100};
1516
1516
  }
1517
- `,lb=({disabled:e})=>{const{editor:t}=P("EmojiPicker"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),l=a.trim().toLowerCase(),c=l?As.filter(f=>f.keywords.includes(l)):As,u=f=>{d.Transforms.insertText(t,f),s(!1),i(""),B.ReactEditor.focus(t)},h=n({id:"components.Blocks.emoji",defaultMessage:"Emoji"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":h,title:h,"aria-disabled":e,padding:1,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",fontSize:"18px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:f=>{f.preventDefault(),f.stopPropagation(),e||s(g=>!g)},children:"😀"})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:2,padding:2,style:{width:"290px"},children:[o.jsx(p.Field.Root,{children:o.jsx(p.Field.Input,{name:"emojiSearch",placeholder:n({id:"components.Blocks.emoji.search",defaultMessage:"Search emoji..."}),value:a,onChange:f=>i(f.target.value)})}),o.jsx(ab,{children:c.map(({emoji:f},g)=>o.jsx(ib,{onMouseDown:m=>{m.preventDefault(),u(f)},children:f},`${f}-${g}`))})]})})]})},cb=({fill:e,...t})=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:[o.jsx("circle",{cx:"11",cy:"11",r:"6",stroke:e||"#666687",strokeWidth:"2"}),o.jsx("path",{d:"M15.5 15.5L20 20",stroke:e||"#666687",strokeWidth:"2",strokeLinecap:"round"})]}),db=b.styled.span`
1517
+ `,gb=({disabled:e})=>{const{editor:t}=P("EmojiPicker"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),l=a.trim().toLowerCase(),c=l?Ps.filter(f=>f.keywords.includes(l)):Ps,u=f=>{d.Transforms.insertText(t,f),s(!1),i(""),R.ReactEditor.focus(t)},h=n({id:"components.Blocks.emoji",defaultMessage:"Emoji"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":h,title:h,"aria-disabled":e,padding:1,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",fontSize:"18px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:f=>{f.preventDefault(),f.stopPropagation(),e||s(g=>!g)},children:"😀"})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:2,padding:2,style:{width:"290px"},children:[o.jsx(p.Field.Root,{children:o.jsx(p.Field.Input,{name:"emojiSearch",placeholder:n({id:"components.Blocks.emoji.search",defaultMessage:"Search emoji..."}),value:a,onChange:f=>i(f.target.value)})}),o.jsx(hb,{children:c.map(({emoji:f},g)=>o.jsx(fb,{onMouseDown:m=>{m.preventDefault(),u(f)},children:f},`${f}-${g}`))})]})})]})},mb=({fill:e,...t})=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",...t,fill:"none",children:[o.jsx("circle",{cx:"11",cy:"11",r:"6",stroke:e||"#666687",strokeWidth:"2"}),o.jsx("path",{d:"M15.5 15.5L20 20",stroke:e||"#666687",strokeWidth:"2",strokeLinecap:"round"})]}),bb=b.styled.span`
1518
1518
  font-size: 12px;
1519
1519
  color: ${({theme:e})=>e.colors.neutral600};
1520
1520
  white-space: nowrap;
1521
1521
  min-width: 32px;
1522
1522
  text-align: right;
1523
- `,_s=b.styled.button`
1523
+ `,Ls=b.styled.button`
1524
1524
  background: ${({theme:e})=>e.colors.neutral100};
1525
1525
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
1526
1526
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -1544,14 +1544,14 @@
1544
1544
  opacity: 0.4;
1545
1545
  cursor: not-allowed;
1546
1546
  }
1547
- `,ub=e=>e.__findReplaceSearch||"",pb=e=>{const t=ub(e);if(!t)return()=>[];const n=t.toLowerCase(),r=e.__findReplaceActiveIndex??0;let s=0;return([a,i])=>{if(!d.Text.isText(a))return[];const l=[],c=a.text.toLowerCase();let u=0;for(;;){const h=c.indexOf(n,u);if(h===-1)break;const f=s===r;l.push({anchor:{path:i,offset:h},focus:{path:i,offset:h+t.length},searchHighlight:!0,searchHighlightActive:f}),s++,u=h+1}return l}},hb=({disabled:e})=>{const{editor:t}=P("FindReplace"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),[l,c]=k.useState(""),[u,h]=k.useState(0),[f,g]=k.useState(0),m=k.useRef(null),w=k.useCallback(()=>{if(!a)return[];const C=[],M=a.toLowerCase();for(const[j,v]of d.Node.texts(t)){const I=j.text.toLowerCase();let A=0;for(;;){const N=I.indexOf(M,A);if(N===-1)break;C.push({path:v,offset:N}),A=N+1}}return C},[t,a]);k.useEffect(()=>{t.__findReplaceSearch=r?a:"",t.__findReplaceActiveIndex=f,t.onChange()},[t,a,r,f]),k.useEffect(()=>{const C=w();h(C.length),C.length>0&&f>=C.length&&g(0)},[a,w,f]),k.useEffect(()=>{r&&m.current?.focus()},[r]);const x=C=>{const M=w();if(M.length===0)return;const j=M[C%M.length],v={path:j.path,offset:j.offset},I={path:j.path,offset:j.offset+a.length};d.Transforms.select(t,{anchor:v,focus:I}),g(C%M.length)},y=()=>x(f+1),$=()=>x(f-1<0?u-1:f-1),E=()=>{const C=w();if(C.length===0)return;const M=C[f%C.length],j={path:M.path,offset:M.offset},v={path:M.path,offset:M.offset+a.length};d.Transforms.select(t,{anchor:j,focus:v}),d.Transforms.insertText(t,l)},S=()=>{const C=w();if(C.length!==0)for(let M=C.length-1;M>=0;M--){const j=C[M],v={path:j.path,offset:j.offset},I={path:j.path,offset:j.offset+a.length};d.Transforms.select(t,{anchor:v,focus:I}),d.Transforms.insertText(t,l)}},R=n({id:"components.Blocks.findReplace",defaultMessage:"Find and replace"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":R,title:R,"aria-disabled":e,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:C=>{C.preventDefault(),C.stopPropagation(),e||s(M=>!M)},children:o.jsx(cb,{fill:e?"#a5a5ba":"#666687"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,style:{width:"360px"},children:[o.jsx(p.Box,{style:{fontWeight:600,fontSize:"14px",textAlign:"center"},children:n({id:"components.Blocks.findReplace.title",defaultMessage:"Find and replace"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(p.Field.Root,{style:{flex:1},children:o.jsx(p.Field.Input,{ref:m,name:"find",placeholder:n({id:"components.Blocks.find.placeholder",defaultMessage:"Find in text..."}),value:a,onChange:C=>{i(C.target.value),g(0)},onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),C.shiftKey?$():y())}})}),o.jsx(_s,{title:"Previous",disabled:u===0,onMouseDown:C=>{C.preventDefault(),$()},children:"▲"}),o.jsx(_s,{title:"Next",disabled:u===0,onMouseDown:C=>{C.preventDefault(),y()},children:"▼"}),o.jsx(db,{children:a?`${u>0?f+1:0}/${u}`:""})]}),o.jsx(p.Field.Root,{width:"100%",children:o.jsx(p.Field.Input,{name:"replace",placeholder:n({id:"components.Blocks.replace.placeholder",defaultMessage:"Replace with..."}),value:l,onChange:C=>c(C.target.value)})}),o.jsxs(p.Flex,{justifyContent:"flex-end",gap:2,children:[o.jsx(p.Button,{variant:"tertiary",size:"S",onClick:S,disabled:u===0,children:"Replace all"}),o.jsx(p.Button,{variant:"tertiary",size:"S",onClick:E,disabled:u===0,children:"Replace"}),o.jsx(p.Button,{size:"S",onClick:y,disabled:u===0,children:"Find"})]})]})})]})},Hi=[{label:"Teal",value:"#57BAA2"},{label:"Dark",value:"#1D1D1D"},{label:"Gray",value:"#757575"},{label:"Light Gray",value:"#f5f5f5"},{label:"Silver",value:"#e0e0e0"},{label:"Medium Gray",value:"#878787"},{label:"White",value:"#FFFFFF"}],fb=[{label:"Yellow",value:"#FFE066"},{label:"Green",value:"#8CE99A"},{label:"Blue",value:"#74C0FC"},{label:"Pink",value:"#FFA8B8"},{label:"Purple",value:"#B197FC"},{label:"Orange",value:"#FFC078"},{label:"Gray",value:"#CED4DA"},{label:"Teal",value:"#63E6BE"},{label:"Red",value:"#FF8787"},{label:"Cyan",value:"#66D9E8"}];Hi[0].value;const gb=e=>e?e.split(`
1548
- `).filter(Boolean).map(t=>{const n=t.indexOf(":");if(n===-1)return{label:t,value:t};const r=t.substring(0,n).trim(),s=t.substring(n+1).trim();return{label:r,value:s}}):[],Ns=(e,t,n)=>{if(n&&t){const r=gb(t);return r.length>0?r:e}return e},Ps=({color:e})=>{const{colors:t}=b.useTheme(),n=e||t.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("text",{x:"7",y:"17",fontFamily:"Arial",fontSize:"14",fill:n,stroke:"rgba(128,128,128,0.3)",strokeWidth:"0.5",children:"A"})})},mb=()=>{const{colors:e}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"7",y:"17",fontFamily:"Arial",fontSize:"14",fill:e.neutral600,children:"A"}),o.jsx("rect",{x:"3",y:"19",width:"18",height:"3",rx:"1",fill:e.neutral600,opacity:"0.4"})]})},bb=b.styled(p.Flex)`
1547
+ `,yb=e=>e.__findReplaceSearch||"",xb=e=>{const t=yb(e);if(!t)return()=>[];const n=t.toLowerCase(),r=e.__findReplaceActiveIndex??0;let s=0;return([a,i])=>{if(!d.Text.isText(a))return[];const l=[],c=a.text.toLowerCase();let u=0;for(;;){const h=c.indexOf(n,u);if(h===-1)break;const f=s===r;l.push({anchor:{path:i,offset:h},focus:{path:i,offset:h+t.length},searchHighlight:!0,searchHighlightActive:f}),s++,u=h+1}return l}},vb=({disabled:e})=>{const{editor:t}=P("FindReplace"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),[l,c]=k.useState(""),[u,h]=k.useState(0),[f,g]=k.useState(0),m=k.useRef(null),x=k.useCallback(()=>{if(!a)return[];const S=[],T=a.toLowerCase();for(const[j,w]of d.Node.texts(t)){const B=j.text.toLowerCase();let A=0;for(;;){const N=B.indexOf(T,A);if(N===-1)break;S.push({path:w,offset:N}),A=N+1}}return S},[t,a]);k.useEffect(()=>{t.__findReplaceSearch=r?a:"",t.__findReplaceActiveIndex=f,t.onChange()},[t,a,r,f]),k.useEffect(()=>{const S=x();h(S.length),S.length>0&&f>=S.length&&g(0)},[a,x,f]),k.useEffect(()=>{r&&m.current?.focus()},[r]);const y=S=>{const T=x();if(T.length===0)return;const j=T[S%T.length],w={path:j.path,offset:j.offset},B={path:j.path,offset:j.offset+a.length};d.Transforms.select(t,{anchor:w,focus:B}),g(S%T.length)},v=()=>y(f+1),$=()=>y(f-1<0?u-1:f-1),E=()=>{const S=x();if(S.length===0)return;const T=S[f%S.length],j={path:T.path,offset:T.offset},w={path:T.path,offset:T.offset+a.length};d.Transforms.select(t,{anchor:j,focus:w}),d.Transforms.insertText(t,l)},C=()=>{const S=x();if(S.length!==0)for(let T=S.length-1;T>=0;T--){const j=S[T],w={path:j.path,offset:j.offset},B={path:j.path,offset:j.offset+a.length};d.Transforms.select(t,{anchor:w,focus:B}),d.Transforms.insertText(t,l)}},I=n({id:"components.Blocks.findReplace",defaultMessage:"Find and replace"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":I,title:I,"aria-disabled":e,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:S=>{S.preventDefault(),S.stopPropagation(),e||s(T=>!T)},children:o.jsx(mb,{fill:e?"#a5a5ba":"#666687"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:3,padding:4,style:{width:"360px"},children:[o.jsx(p.Box,{style:{fontWeight:600,fontSize:"14px",textAlign:"center"},children:n({id:"components.Blocks.findReplace.title",defaultMessage:"Find and replace"})}),o.jsxs(p.Flex,{gap:2,alignItems:"center",children:[o.jsx(p.Field.Root,{style:{flex:1},children:o.jsx(p.Field.Input,{ref:m,name:"find",placeholder:n({id:"components.Blocks.find.placeholder",defaultMessage:"Find in text..."}),value:a,onChange:S=>{i(S.target.value),g(0)},onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),S.shiftKey?$():v())}})}),o.jsx(Ls,{title:"Previous",disabled:u===0,onMouseDown:S=>{S.preventDefault(),$()},children:"▲"}),o.jsx(Ls,{title:"Next",disabled:u===0,onMouseDown:S=>{S.preventDefault(),v()},children:"▼"}),o.jsx(bb,{children:a?`${u>0?f+1:0}/${u}`:""})]}),o.jsx(p.Field.Root,{width:"100%",children:o.jsx(p.Field.Input,{name:"replace",placeholder:n({id:"components.Blocks.replace.placeholder",defaultMessage:"Replace with..."}),value:l,onChange:S=>c(S.target.value)})}),o.jsxs(p.Flex,{justifyContent:"flex-end",gap:2,children:[o.jsx(p.Button,{variant:"tertiary",size:"S",onClick:C,disabled:u===0,children:"Replace all"}),o.jsx(p.Button,{variant:"tertiary",size:"S",onClick:E,disabled:u===0,children:"Replace"}),o.jsx(p.Button,{size:"S",onClick:v,disabled:u===0,children:"Find"})]})]})})]})},Ki=[{label:"Teal",value:"#57BAA2"},{label:"Dark",value:"#1D1D1D"},{label:"Gray",value:"#757575"},{label:"Light Gray",value:"#f5f5f5"},{label:"Silver",value:"#e0e0e0"},{label:"Medium Gray",value:"#878787"},{label:"White",value:"#FFFFFF"}],wb=[{label:"Yellow",value:"#FFE066"},{label:"Green",value:"#8CE99A"},{label:"Blue",value:"#74C0FC"},{label:"Pink",value:"#FFA8B8"},{label:"Purple",value:"#B197FC"},{label:"Orange",value:"#FFC078"},{label:"Gray",value:"#CED4DA"},{label:"Teal",value:"#63E6BE"},{label:"Red",value:"#FF8787"},{label:"Cyan",value:"#66D9E8"}];Ki[0].value;const kb=e=>e?e.split(`
1548
+ `).filter(Boolean).map(t=>{const n=t.indexOf(":");if(n===-1)return{label:t,value:t};const r=t.substring(0,n).trim(),s=t.substring(n+1).trim();return{label:r,value:s}}):[],Os=(e,t,n)=>{if(n&&t){const r=kb(t);return r.length>0?r:e}return e},zs=({color:e})=>{const{colors:t}=b.useTheme(),n=e||t.neutral600;return o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("text",{x:"7",y:"17",fontFamily:"Arial",fontSize:"14",fill:n,stroke:"rgba(128,128,128,0.3)",strokeWidth:"0.5",children:"A"})})},jb=()=>{const{colors:e}=b.useTheme();return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("text",{x:"7",y:"17",fontFamily:"Arial",fontSize:"14",fill:e.neutral600,children:"A"}),o.jsx("rect",{x:"3",y:"19",width:"18",height:"3",rx:"1",fill:e.neutral600,opacity:"0.4"})]})},$b=b.styled(p.Flex)`
1549
1549
  display: grid;
1550
1550
  grid-template-columns: repeat(5, 1fr);
1551
1551
  gap: 4px;
1552
1552
  padding: 8px;
1553
1553
  max-width: 180px;
1554
- `,xb=b.styled.button`
1554
+ `,Eb=b.styled.button`
1555
1555
  width: 28px;
1556
1556
  height: 28px;
1557
1557
  border-radius: 4px;
@@ -1565,7 +1565,7 @@
1565
1565
  transform: scale(1.1);
1566
1566
  border-color: ${({theme:e})=>e.colors.primary500};
1567
1567
  }
1568
- `,yb=b.styled(p.Flex)`
1568
+ `,Cb=b.styled(p.Flex)`
1569
1569
  flex-shrink: 0;
1570
1570
  min-width: 32px;
1571
1571
 
@@ -1580,7 +1580,7 @@
1580
1580
  background: ${({theme:e})=>e.colors.primary100};
1581
1581
  }
1582
1582
  }
1583
- `,vb=b.styled.button`
1583
+ `,Sb=b.styled.button`
1584
1584
  width: 100%;
1585
1585
  padding: 6px 8px;
1586
1586
  border: none;
@@ -1594,7 +1594,7 @@
1594
1594
  &:hover {
1595
1595
  background: ${({theme:e})=>e.colors.neutral200};
1596
1596
  }
1597
- `,Ls=b.styled.button`
1597
+ `,Hs=b.styled.button`
1598
1598
  flex: 1;
1599
1599
  padding: 6px 8px;
1600
1600
  border: none;
@@ -1613,7 +1613,7 @@
1613
1613
  &:hover {
1614
1614
  color: ${({theme:e})=>e.colors.primary500};
1615
1615
  }
1616
- `,Ui=()=>{const{editor:e,disabled:t,pluginOptions:n={}}=P("InlineColorPicker"),[r,s]=k.default.useState(!1),[a,i]=k.default.useState("foreground"),l=Ns(Hi,n?.customColorsPresets,n?.disableDefaultColors),c=Ns(fb,n?.customBgColorsPresets,n?.disableDefaultBgColors),u=a==="foreground"?"color":"backgroundColor",h=a==="foreground"?l:c,f=E=>d.Editor.marks(e)?.[E]||null,g=f("color"),m=f("backgroundColor"),w=a==="foreground"?g:m,x=E=>{if(!e.selection){const S=d.Editor.end(e,[]);d.Transforms.select(e,S)}d.Editor.addMark(e,u,E),s(!1),B.ReactEditor.focus(e)},y=()=>{d.Editor.removeMark(e,u),s(!1),B.ReactEditor.focus(e)},$=()=>{if(t)return!0;if(!e.selection)return!1;const E=e.children[e.selection.anchor.path[0]];return!!(!E||["image","code","separator","horizontal-line"].includes(E.type))};return o.jsxs(p.Popover.Root,{open:r,onOpenChange:s,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(yb,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-label":"Text color","aria-disabled":$(),disabled:$(),style:{...m?{backgroundColor:m}:{}},children:o.jsx(Ps,{color:g})})}),o.jsx(p.Popover.Content,{children:o.jsxs(p.Box,{padding:2,children:[o.jsxs(p.Flex,{gap:0,style:{marginBottom:"4px"},children:[o.jsxs(Ls,{$active:a==="foreground",onClick:()=>i("foreground"),children:[o.jsx(Ps,{})," Text"]}),o.jsxs(Ls,{$active:a==="background",onClick:()=>i("background"),children:[o.jsx(mb,{})," Highlight"]})]}),o.jsx(bb,{children:h.map((E,S)=>o.jsx(xb,{$color:E.value,$isActive:w===E.value,onClick:()=>x(E.value),title:E.label},`${a}-color-${S}`))}),w&&o.jsx(vb,{onClick:y,children:a==="foreground"?"Remove color":"Remove highlight"})]})})]})},Os={Currency:["$","€","£","¥","₹","₿","¢","₽","₩","₺"],Math:["±","×","÷","≠","≈","≤","≥","∞","√","∑","π","µ","∆","∫","∂","≡","∈","∉","⊂","⊃"],Arrows:["←","→","↑","↓","↔","↕","⇐","⇒","⇑","⇓","⇔","↩","↪","➜","➤","➔"],Legal:["©","®","™","§","¶","†","‡","•","°","‰"],Punctuation:["–","—","…","«","»","‹","›","“","”","‘","’","¡","¿","‽","※"],Greek:["α","β","γ","δ","ε","ζ","η","θ","λ","μ","ξ","σ","τ","φ","ψ","ω","Ω","Σ","Δ","Π"],Fractions:["½","⅓","⅔","¼","¾","⅕","⅙","⅛"],Misc:["♠","♣","♥","♦","★","☆","♩","♪","♫","✓","✗","✠","☺","☹","⚡","☎"]},wb=b.styled.div`
1616
+ `,Gi=()=>{const{editor:e,disabled:t,pluginOptions:n={}}=P("InlineColorPicker"),[r,s]=k.default.useState(!1),[a,i]=k.default.useState("foreground"),l=Os(Ki,n?.customColorsPresets,n?.disableDefaultColors),c=Os(wb,n?.customBgColorsPresets,n?.disableDefaultBgColors),u=a==="foreground"?"color":"backgroundColor",h=a==="foreground"?l:c,f=E=>d.Editor.marks(e)?.[E]||null,g=f("color"),m=f("backgroundColor"),x=a==="foreground"?g:m,y=E=>{if(!e.selection){const C=d.Editor.end(e,[]);d.Transforms.select(e,C)}d.Editor.addMark(e,u,E),s(!1),R.ReactEditor.focus(e)},v=()=>{d.Editor.removeMark(e,u),s(!1),R.ReactEditor.focus(e)},$=()=>{if(t)return!0;if(!e.selection)return!1;const E=e.children[e.selection.anchor.path[0]];return!!(!E||["image","code","separator","horizontal-line"].includes(E.type))};return o.jsxs(p.Popover.Root,{open:r,onOpenChange:s,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Cb,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-label":"Text color","aria-disabled":$(),disabled:$(),style:{...m?{backgroundColor:m}:{}},children:o.jsx(zs,{color:g})})}),o.jsx(p.Popover.Content,{children:o.jsxs(p.Box,{padding:2,children:[o.jsxs(p.Flex,{gap:0,style:{marginBottom:"4px"},children:[o.jsxs(Hs,{$active:a==="foreground",onClick:()=>i("foreground"),children:[o.jsx(zs,{})," Text"]}),o.jsxs(Hs,{$active:a==="background",onClick:()=>i("background"),children:[o.jsx(jb,{})," Highlight"]})]}),o.jsx($b,{children:h.map((E,C)=>o.jsx(Eb,{$color:E.value,$isActive:x===E.value,onClick:()=>y(E.value),title:E.label},`${a}-color-${C}`))}),x&&o.jsx(Sb,{onClick:v,children:a==="foreground"?"Remove color":"Remove highlight"})]})})]})},Us={Currency:["$","€","£","¥","₹","₿","¢","₽","₩","₺"],Math:["±","×","÷","≠","≈","≤","≥","∞","√","∑","π","µ","∆","∫","∂","≡","∈","∉","⊂","⊃"],Arrows:["←","→","↑","↓","↔","↕","⇐","⇒","⇑","⇓","⇔","↩","↪","➜","➤","➔"],Legal:["©","®","™","§","¶","†","‡","•","°","‰"],Punctuation:["–","—","…","«","»","‹","›","“","”","‘","’","¡","¿","‽","※"],Greek:["α","β","γ","δ","ε","ζ","η","θ","λ","μ","ξ","σ","τ","φ","ψ","ω","Ω","Σ","Δ","Π"],Fractions:["½","⅓","⅔","¼","¾","⅕","⅙","⅛"],Misc:["♠","♣","♥","♦","★","☆","♩","♪","♫","✓","✗","✠","☺","☹","⚡","☎"]},Tb=b.styled.div`
1617
1617
  display: grid;
1618
1618
  grid-template-columns: repeat(7, 1fr);
1619
1619
  gap: 6px;
@@ -1626,7 +1626,7 @@
1626
1626
  display: none;
1627
1627
  }
1628
1628
  scrollbar-width: none;
1629
- `,kb=b.styled.button`
1629
+ `,Mb=b.styled.button`
1630
1630
  background: ${({theme:e})=>e.colors.neutral0};
1631
1631
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
1632
1632
  color: ${({theme:e})=>e.colors.neutral800};
@@ -1650,7 +1650,7 @@
1650
1650
  &:active {
1651
1651
  transform: scale(0.95);
1652
1652
  }
1653
- `,jb=({disabled:e})=>{const{editor:t}=P("SpecialCharPicker"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState("Currency"),l=u=>{d.Transforms.insertText(t,u),B.ReactEditor.focus(t)},c=n({id:"components.Blocks.specialChars",defaultMessage:"Special characters"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":c,title:c,"aria-disabled":e,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:u=>{u.preventDefault(),u.stopPropagation(),e||s(h=>!h)},children:o.jsx($f,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:2,padding:3,style:{width:"330px"},children:[o.jsx(p.Box,{width:"100%",children:o.jsx(p.SingleSelect,{value:a,onChange:u=>i(u),children:Object.keys(Os).map(u=>o.jsx(p.SingleSelectOption,{value:u,children:u},u))})}),o.jsx(wb,{children:(Os[a]||[]).map((u,h)=>o.jsx(kb,{title:u,onMouseDown:f=>{f.preventDefault(),l(u)},children:u},`${u}-${h}`))})]})})]})},$b=b.styled(p.Flex)`
1653
+ `,Bb=({disabled:e})=>{const{editor:t}=P("SpecialCharPicker"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState("Currency"),l=u=>{d.Transforms.insertText(t,u),R.ReactEditor.focus(t)},c=n({id:"components.Blocks.specialChars",defaultMessage:"Special characters"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(p.Box,{tag:"button","aria-label":c,title:c,"aria-disabled":e,hasRadius:!0,style:{background:"none",border:"none",cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",opacity:e?.5:1},onMouseDown:u=>{u.preventDefault(),u.stopPropagation(),e||s(h=>!h)},children:o.jsx(Tf,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{direction:"column",gap:2,padding:3,style:{width:"330px"},children:[o.jsx(p.Box,{width:"100%",children:o.jsx(p.SingleSelect,{value:a,onChange:u=>i(u),children:Object.keys(Us).map(u=>o.jsx(p.SingleSelectOption,{value:u,children:u},u))})}),o.jsx(Tb,{children:(Us[a]||[]).map((u,h)=>o.jsx(Mb,{title:u,onMouseDown:f=>{f.preventDefault(),l(u)},children:u},`${u}-${h}`))})]})})]})},Ib=b.styled(p.Flex)`
1654
1654
  flex-wrap: wrap;
1655
1655
  align-items: center;
1656
1656
  gap: ${({theme:e})=>e.spaces[1]};
@@ -1684,7 +1684,7 @@
1684
1684
  background: ${({theme:e})=>e.colors.primary100};
1685
1685
  }
1686
1686
  }
1687
- `;function To(){const[e,t]=k.useState(null);return{modalElement:e,handleConversionResult:r=>{r&&t(k.cloneElement(r(),{key:Date.now()}))}}}const Ce=({icon:e,name:t,label:n,isActive:r,disabled:s,handleClick:a})=>{const{editor:i}=P("ToolbarButton"),{formatMessage:l}=O.useIntl(),c=l(n),u=r?"primary600":"neutral600";return o.jsx(p.Tooltip,{label:c,children:o.jsx(be.ToggleItem,{value:t,"data-state":r?"on":"off",onMouseDown:h=>{h.preventDefault(),a(),B.ReactEditor.focus(i)},"aria-disabled":s,disabled:s,"aria-label":c,asChild:!0,children:o.jsx(Rt,{tag:"button",background:r?"primary100":"",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(e,{fill:s?"neutral300":u})})})})},Wi=["image","audio","video","embed","button","callout","details","diagram","math","social-embed"],zs=[...Wi,"list-ordered","list-unordered","list-todo","quote"],Eb=(e,t)=>{if(!e.selection)return null;const n=d.Editor.above(e,{match:s=>!d.Editor.isEditor(s)&&"type"in s&&s.type==="list",at:e.selection.anchor});let r;if(n)[r]=n;else try{[r]=d.Editor.parent(e,e.selection.anchor,{edge:"start",depth:2})}catch{return null}return!r||d.Editor.isEditor(r)?null:ed(t).find(s=>t[s].matchNode(r))??null},Cb=()=>{const{editor:e,blocks:t,disabled:n}=P("BlocksDropdown"),{formatMessage:r}=O.useIntl(),{modalElement:s,handleConversionResult:a}=To(),i=co(t).reduce((m,w)=>{const[x,y]=w;return y.isInBlocksSelector&&!zs.includes(x)?[...m,x]:m},[]),l=Eb(e,t),c=k.useRef("paragraph");l&&Vs(l)&&!zs.includes(l)&&(c.current=l);const u=c.current,h=m=>{if(!Vs(m))return;const w=e.children.length===1&&d.Editor.isEmpty(e,e.children[0]);!e.selection&&!w?d.Transforms.insertNodes(e,{type:"quote",children:[{type:"text",text:""}]},{select:!0}):!e.selection&&w&&d.Transforms.select(e,d.Editor.start(e,[0,0]));const x=d.Editor.above(e,{match:$=>!d.Editor.isEditor($)&&"type"in $&&$.type==="list"});if(x&&["list-ordered","list-unordered","list-todo"].includes(m)){const[$,E]=x,S=m==="list-ordered"?"ordered":m==="list-todo"?"todo":"unordered";!d.Editor.isEditor($)&&Xr($)&&$.format!==S&&d.Transforms.setNodes(e,{format:S},{at:E});return}const y=t[m].handleConvert?.(e);a(y),B.ReactEditor.focus(e)},f=m=>m.preventDefault();k.useEffect(()=>{if(!(!e.selection||d.Editor.above(e,{match:w=>!d.Editor.isEditor(w)&&"type"in w&&w.type==="list",at:e.selection.anchor})))try{const[w]=d.Editor.parent(e,e.selection.anchor,{edge:"start",depth:2});w.type==="list-item"&&d.Transforms.setNodes(e,{type:"paragraph"})}catch{}},[e.selection,e]);const g=t[u].icon;return o.jsxs(o.Fragment,{children:[o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:n,startIcon:o.jsx(g,{}),"aria-label":r({id:"components.Blocks.blocks.selectBlock",defaultMessage:"Select a block"}),children:r(t[u].label)}),o.jsx(p.Menu.Content,{onCloseAutoFocus:f,children:i.map(m=>{const w=t[m].icon,x=Ac[m],y=ob(m);return o.jsxs(Ye,{onSelect:()=>h(m),$isActive:m===u,children:[o.jsx(w,{}),o.jsx(Sb,{style:x?{fontSize:x.fontSize,fontWeight:x.fontWeight}:void 0,children:r(t[m].label)}),y&&o.jsx(Tb,{children:y})]},m)})})]}),s]})},Xr=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="list",Sr=({block:e,format:t,location:n="toolbar"})=>{const{formatMessage:r}=O.useIntl(),{editor:s,disabled:a,blocks:i}=P("ListButton"),l=()=>{if(!s.selection)return!1;const h=d.Editor.above(s,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list",at:s.selection.anchor});if(h){const[f]=h;if(!d.Editor.isEditor(f)&&Xr(f)&&f.format===t)return!0}return!1},c=()=>{if(a)return!0;if(!s.selection)return!1;const h=d.Editor.above(s,{at:s.selection.anchor,match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"}),f=d.Editor.above(s,{at:s.selection.focus,match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"});return!h||!f?!1:h[0]!==f[0]},u=h=>{let f;if(s.selection)f=d.Editor.above(s,{match:w=>!d.Editor.isEditor(w)&&"type"in w&&w.type==="list"});else{const[w,x]=d.Editor.last(s,[]);f=d.Editor.above(s,{match:y=>!d.Editor.isEditor(y)&&"type"in y&&y.type==="list",at:x})}if(!f){i[`list-${h}`].handleConvert(s);return}const[g,m]=f;if(!d.Editor.isEditor(g)&&Xr(g))if(g.format!==h)d.Transforms.setNodes(s,{format:h},{at:m});else if(d.Editor.above(s,{at:m,match:x=>!d.Editor.isEditor(x)&&"type"in x&&x.type==="list"})){const x=d.Editor.above(s,{match:y=>!d.Editor.isEditor(y)&&"type"in y&&y.type==="list-item"});if(x){const[,y]=x,$=d.Path.next(m);d.Transforms.moveNodes(s,{at:y,to:$});try{const E=d.Editor.node(s,m);if(E){const[S]=E;!d.Editor.isEditor(S)&&"children"in S&&S.children.length===0&&d.Transforms.removeNodes(s,{at:m})}}catch{}}}else i.paragraph.handleConvert(s)};if(n==="menu"){const h=e.icon;return o.jsxs(Ye,{onSelect:()=>u(t),$isActive:l(),disabled:c(),children:[o.jsx(h,{}),r(e.label)]})}return o.jsx(Ce,{icon:e.icon,name:t,label:e.label,isActive:l(),disabled:c(),handleClick:()=>u(t)})},Ki=({disabled:e,location:t="toolbar"})=>{const{editor:n}=P("LinkButton"),{formatMessage:r}=O.useIntl(),s=()=>{const{selection:c}=n;if(!c)return!1;const[u]=Array.from(d.Editor.nodes(n,{at:d.Editor.unhangRange(n,c),match:h=>d.Element.isElement(h)&&"type"in h&&h.type==="link"}));return!!u},a=()=>{if(e)return!0;if(!n.selection)return!1;const c=d.Editor.above(n,{at:n.selection.anchor,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type!=="text"}),u=d.Editor.above(n,{at:n.selection.focus,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type!=="text"});return!c||!u?!1:c[0]!==u[0]},i=()=>{n.shouldSaveLinkPath=!0,An(n,{url:""})},l={id:"components.Blocks.link",defaultMessage:"Link"};return t==="menu"?o.jsxs(Ye,{onSelect:i,$isActive:s(),disabled:a(),children:[o.jsx(D.Link,{}),r(l)]}):o.jsx(Ce,{icon:D.Link,name:"link",label:l,isActive:s(),handleClick:i,disabled:a()})},Ye=b.styled(p.Menu.Item)`
1687
+ `;function Io(){const[e,t]=k.useState(null);return{modalElement:e,handleConversionResult:r=>{r&&t(k.cloneElement(r(),{key:Date.now()}))}}}const Ce=({icon:e,name:t,label:n,isActive:r,disabled:s,handleClick:a})=>{const{editor:i}=P("ToolbarButton"),{formatMessage:l}=O.useIntl(),c=l(n),u=r?"primary600":"neutral600";return o.jsx(p.Tooltip,{label:c,children:o.jsx(be.ToggleItem,{value:t,"data-state":r?"on":"off",onMouseDown:h=>{h.preventDefault(),a(),R.ReactEditor.focus(i)},"aria-disabled":s,disabled:s,"aria-label":c,asChild:!0,children:o.jsx(Rt,{tag:"button",background:r?"primary100":"",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(e,{fill:s?"neutral300":u})})})})},Vi=["image","audio","video","embed","button","callout","details","diagram","math","social-embed"],Ws=[...Vi,"list-ordered","list-unordered","list-todo","quote"],Rb=(e,t)=>{if(!e.selection)return null;const n=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&"type"in a&&a.type==="list",at:e.selection.anchor});let r;if(n)[r]=n;else try{[r]=d.Editor.parent(e,e.selection.anchor,{edge:"start",depth:2})}catch{return null}if(!r||d.Editor.isEditor(r))return null;const s=od(t).find(a=>t[a].matchNode(r));return s===void 0?null:String(s)},Fb=()=>{const{editor:e,blocks:t,disabled:n}=P("BlocksDropdown"),{formatMessage:r}=O.useIntl(),{modalElement:s,handleConversionResult:a}=Io(),i=po(t).reduce((m,x)=>{const[y,v]=x;return v.isInBlocksSelector&&!Ws.includes(y)?[...m,y]:m},[]),l=Rb(e,t),c=k.useRef("paragraph");l&&Xs(l)&&!Ws.includes(l)&&(c.current=l);const u=c.current,h=m=>{if(!Xs(m))return;const x=e.children.length===1&&d.Editor.isEmpty(e,e.children[0]);!e.selection&&!x?d.Transforms.insertNodes(e,{type:"quote",children:[{type:"text",text:""}]},{select:!0}):!e.selection&&x&&d.Transforms.select(e,d.Editor.start(e,[0,0]));const y=d.Editor.above(e,{match:$=>!d.Editor.isEditor($)&&"type"in $&&$.type==="list"});if(y&&["list-ordered","list-unordered","list-todo"].includes(m)){const[$,E]=y,C=m==="list-ordered"?"ordered":m==="list-todo"?"todo":"unordered";!d.Editor.isEditor($)&&Zr($)&&$.format!==C&&d.Transforms.setNodes(e,{format:C},{at:E});return}const v=t[m].handleConvert?.(e);a(v),R.ReactEditor.focus(e)},f=m=>m.preventDefault();k.useEffect(()=>{if(!(!e.selection||d.Editor.above(e,{match:x=>!d.Editor.isEditor(x)&&"type"in x&&x.type==="list",at:e.selection.anchor})))try{const[x]=d.Editor.parent(e,e.selection.anchor,{edge:"start",depth:2});x.type==="list-item"&&d.Transforms.setNodes(e,{type:"paragraph"})}catch{}},[e.selection,e]);const g=t[u].icon;return o.jsxs(o.Fragment,{children:[o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:n,startIcon:o.jsx(g,{}),"aria-label":r({id:"components.Blocks.blocks.selectBlock",defaultMessage:"Select a block"}),children:r(t[u].label)}),o.jsx(p.Menu.Content,{onCloseAutoFocus:f,children:i.map(m=>{const x=t[m].icon,y=Lc[m],v=ub(m);return o.jsxs(Ye,{onSelect:()=>h(m),$isActive:m===u,children:[o.jsx(x,{}),o.jsx(Db,{style:y?{fontSize:y.fontSize,fontWeight:y.fontWeight}:void 0,children:r(t[m].label)}),v&&o.jsx(Ab,{children:v})]},m)})})]}),s]})},Zr=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&"type"in e&&e.type==="list",Mr=({block:e,format:t,location:n="toolbar"})=>{const{formatMessage:r}=O.useIntl(),{editor:s,disabled:a,blocks:i}=P("ListButton"),l=()=>{if(!s.selection)return!1;const h=d.Editor.above(s,{match:f=>!d.Editor.isEditor(f)&&"type"in f&&f.type==="list",at:s.selection.anchor});if(h){const[f]=h;if(!d.Editor.isEditor(f)&&Zr(f)&&f.format===t)return!0}return!1},c=()=>{if(a)return!0;if(!s.selection)return!1;const h=d.Editor.above(s,{at:s.selection.anchor,match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"}),f=d.Editor.above(s,{at:s.selection.focus,match:g=>!d.Editor.isEditor(g)&&"type"in g&&g.type!=="text"});return!h||!f?!1:h[0]!==f[0]},u=h=>{let f;if(s.selection)f=d.Editor.above(s,{match:x=>!d.Editor.isEditor(x)&&"type"in x&&x.type==="list"});else{const[x,y]=d.Editor.last(s,[]);f=d.Editor.above(s,{match:v=>!d.Editor.isEditor(v)&&"type"in v&&v.type==="list",at:y})}if(!f){i[`list-${h}`].handleConvert(s);return}const[g,m]=f;if(!d.Editor.isEditor(g)&&Zr(g))if(g.format!==h)d.Transforms.setNodes(s,{format:h},{at:m});else if(d.Editor.above(s,{at:m,match:y=>!d.Editor.isEditor(y)&&"type"in y&&y.type==="list"})){const y=d.Editor.above(s,{match:v=>!d.Editor.isEditor(v)&&"type"in v&&v.type==="list-item"});if(y){const[,v]=y,$=d.Path.next(m);d.Transforms.moveNodes(s,{at:v,to:$});try{const E=d.Editor.node(s,m);if(E){const[C]=E;!d.Editor.isEditor(C)&&"children"in C&&C.children.length===0&&d.Transforms.removeNodes(s,{at:m})}}catch{}}}else i.paragraph.handleConvert(s)};if(n==="menu"){const h=e.icon;return o.jsxs(Ye,{onSelect:()=>u(t),$isActive:l(),disabled:c(),children:[o.jsx(h,{}),r(e.label)]})}return o.jsx(Ce,{icon:e.icon,name:t,label:e.label,isActive:l(),disabled:c(),handleClick:()=>u(t)})},qi=({disabled:e,location:t="toolbar"})=>{const{editor:n}=P("LinkButton"),{formatMessage:r}=O.useIntl(),s=()=>{const{selection:c}=n;if(!c)return!1;const[u]=Array.from(d.Editor.nodes(n,{at:d.Editor.unhangRange(n,c),match:h=>d.Element.isElement(h)&&"type"in h&&h.type==="link"}));return!!u},a=()=>{if(e)return!0;if(!n.selection)return!1;const c=d.Editor.above(n,{at:n.selection.anchor,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type!=="text"}),u=d.Editor.above(n,{at:n.selection.focus,match:h=>!d.Editor.isEditor(h)&&"type"in h&&h.type!=="text"});return!c||!u?!1:c[0]!==u[0]},i=()=>{n.shouldSaveLinkPath=!0,_n(n,{url:""})},l={id:"components.Blocks.link",defaultMessage:"Link"};return t==="menu"?o.jsxs(Ye,{onSelect:i,$isActive:s(),disabled:a(),children:[o.jsx(D.Link,{}),r(l)]}):o.jsx(Ce,{icon:D.Link,name:"link",label:l,isActive:s(),handleClick:i,disabled:a()})},Ye=b.styled(p.Menu.Item)`
1688
1688
  &:hover {
1689
1689
  background-color: ${({theme:e})=>e.colors.primary100};
1690
1690
  }
@@ -1707,15 +1707,15 @@
1707
1707
  fill: ${({theme:e,$isActive:t})=>t?e.colors.primary600:e.colors.neutral600};
1708
1708
  flex-shrink: 0;
1709
1709
  }
1710
- `,Sb=b.styled.span`
1710
+ `,Db=b.styled.span`
1711
1711
  line-height: 1.3;
1712
- `,Tb=b.styled.span`
1712
+ `,Ab=b.styled.span`
1713
1713
  margin-left: auto;
1714
1714
  padding-left: ${({theme:e})=>e.spaces[6]};
1715
1715
  color: ${({theme:e})=>e.colors.neutral500};
1716
1716
  font-size: 1.2rem;
1717
1717
  white-space: nowrap;
1718
- `,Mb=({disabled:e})=>{const{editor:t}=P("UndoButton"),{formatMessage:n}=O.useIntl();return o.jsx(Ce,{icon:vf,name:"undo",label:{id:"components.Blocks.undo",defaultMessage:"Undo"},isActive:!1,disabled:e||t.history.undos.length===0,handleClick:()=>ao.HistoryEditor.undo(t)})},Ib=({disabled:e})=>{const{editor:t}=P("RedoButton"),{formatMessage:n}=O.useIntl();return o.jsx(Ce,{icon:wf,name:"redo",label:{id:"components.Blocks.redo",defaultMessage:"Redo"},isActive:!1,disabled:e||t.history.redos.length===0,handleClick:()=>ao.HistoryEditor.redo(t)})},Gi=({disabled:e})=>{const{editor:t}=P("RemoveFormattingButton"),n=()=>{if(!t.selection)return;const r=d.Editor.marks(t);r&&Object.keys(r).forEach(s=>{s!=="type"&&s!=="text"&&d.Editor.removeMark(t,s)}),B.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.PaintBrush,name:"removeFormatting",label:{id:"components.Blocks.removeFormatting",defaultMessage:"Remove formatting"},isActive:!1,disabled:e,handleClick:n})},Hs=[{value:"left",icon:go,label:"Align left"},{value:"center",icon:ci,label:"Align center"},{value:"right",icon:di,label:"Align right"},{value:"justify",icon:kf,label:"Justify"}],Rb=({disabled:e})=>{const{editor:t}=P("TextAlignButton"),{formatMessage:n}=O.useIntl(),s=(()=>{if(!t.selection)return"left";const[l]=d.Editor.parent(t,t.selection.anchor,{edge:"start",depth:2});return l.textAlign||"left"})(),a=Hs.find(l=>l.value===s)?.icon||go,i=l=>{if(!t.selection)return;const c=d.Editor.above(t,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&!["text","link","list-item"].includes(u.type)});if(c){const[,u]=c;d.Transforms.setNodes(t,{textAlign:l==="left"?void 0:l},{at:u})}B.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(a,{fill:e?"neutral300":"neutral600"}),"aria-label":n({id:"components.Blocks.textAlign",defaultMessage:"Text alignment"})}),o.jsx(p.Menu.Content,{children:Hs.map(l=>{const c=l.icon,u=s===l.value;return o.jsxs(Ye,{onSelect:()=>i(l.value),$isActive:u,children:[o.jsx(c,{fill:u?"primary600":"neutral600"}),l.label]},l.value)})})]})},Bb=({disabled:e})=>{const{editor:t,blocks:n}=P("InsertBlockButton"),{formatMessage:r}=O.useIntl(),{modalElement:s,handleConversionResult:a}=To(),i=l=>{const c=n[l].handleConvert?.(t);a(c),B.ReactEditor.focus(t)};return o.jsxs(o.Fragment,{children:[o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(D.Plus,{fill:e?"neutral300":"neutral600"}),"aria-label":r({id:"components.Blocks.insertBlock",defaultMessage:"Insert"})}),o.jsx(p.Menu.Content,{children:Wi.map(l=>{const c=n[l].icon;return o.jsxs(Ye,{onSelect:()=>i(l),$isActive:!1,children:[o.jsx(c,{}),r(n[l].label)]},l)})})]}),s]})},Fb=({disabled:e})=>{const{editor:t}=P("InsertTableButton"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),a=n({id:"components.Blocks.insertTable",defaultMessage:"Insert table"}),i=(l,c)=>{gi(t,l,c),s(!1),B.ReactEditor.focus(t)};return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":e,"aria-label":a,title:a,onMouseDown:l=>{l.preventDefault(),e||s(c=>!c)},children:o.jsx(D.GridNine,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsx(nb,{onSelect:i})})]})},Db=({disabled:e})=>{const{editor:t,blocks:n}=P("QuoteButton"),r=()=>{if(!t.selection)return!1;const[a]=d.Editor.nodes(t,{at:t.selection.anchor,match:i=>!d.Editor.isEditor(i)&&"type"in i&&i.type==="quote"});return!!a},s=()=>{if(r()){n.paragraph.handleConvert?.(t);return}n.quote.handleConvert?.(t)};return o.jsx(Ce,{icon:D.Quotes,name:"quote",label:n.quote.label,isActive:r(),disabled:e,handleClick:s})},Ab=()=>{const{isExpandedMode:e,onToggleExpand:t}=P("ExpandButton"),{formatMessage:n}=O.useIntl(),r=n(e?{id:ot("components.Blocks.collapse"),defaultMessage:"Collapse"}:{id:ot("components.Blocks.expand"),defaultMessage:"Expand"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(Rt,{tag:"button",type:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":!1,"aria-label":r,onClick:t,children:e?o.jsx(D.Collapse,{fill:"neutral600"}):o.jsx(D.Expand,{fill:"neutral600"})})})},_b=({disabled:e})=>{const{editor:t}=P("InsertMediaButton"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),l=k.useRef(null),c=()=>{a&&Cp(t,a)&&(i(""),s(!1),B.ReactEditor.focus(t))};k.useEffect(()=>{r&&l.current?.focus()},[r]);const u=n({id:"components.Blocks.insertMedia",defaultMessage:"Insert media"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":e,"aria-label":u,title:u,onMouseDown:h=>{h.preventDefault(),h.stopPropagation(),e||s(f=>!f)},children:o.jsx(D.Play,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{padding:3,direction:"column",gap:3,children:[o.jsx(p.Field.Root,{width:"300px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:n({id:"components.Blocks.mediaUrl",defaultMessage:"Video URL"})}),o.jsx(p.Field.Input,{ref:l,name:"mediaUrl",placeholder:"https://youtube.com/watch?v=...",value:a,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),c())}})]})}),o.jsxs(p.Flex,{justifyContent:"flex-end",gap:2,children:[o.jsx(p.Button,{variant:"tertiary",onClick:()=>s(!1),children:n({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{disabled:!a||!cp(a),onClick:c,children:n({id:"components.Blocks.insert",defaultMessage:"Insert"})})]})]})})]})},Nb=["Default","Arial","Georgia","Times New Roman","Courier New","Verdana","Trebuchet MS","Tahoma","Palatino","Garamond"],Pb=["Default","10px","12px","14px","16px","18px","20px","24px","28px","32px","36px","48px"],Lb=({disabled:e})=>{const{editor:t}=P("FontFamilySelect"),n=d.Editor.marks(t)?.fontFamily||void 0,r=s=>{s==="Default"?d.Editor.removeMark(t,"fontFamily"):d.Editor.addMark(t,"fontFamily",s),B.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S","aria-label":"Font family",children:n||"Font"}),o.jsx(p.Menu.Content,{onCloseAutoFocus:s=>s.preventDefault(),children:Nb.map(s=>o.jsx(Ye,{onSelect:()=>r(s),$isActive:n===s||!n&&s==="Default",children:s},s))})]})},Ob=({disabled:e})=>{const{editor:t}=P("FontSizeSelect"),n=d.Editor.marks(t)?.fontSize||void 0,r=s=>{s==="Default"?d.Editor.removeMark(t,"fontSize"):d.Editor.addMark(t,"fontSize",s),B.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S","aria-label":"Font size",children:n||"Size"}),o.jsx(p.Menu.Content,{onCloseAutoFocus:s=>s.preventDefault(),children:Pb.map(s=>o.jsx(Ye,{onSelect:()=>r(s),$isActive:n===s||!n&&s==="Default",children:s},s))})]})},zb=[{value:void 0,label:"Default"},{value:"1",label:"1"},{value:"1.15",label:"1.15"},{value:"1.5",label:"1.5"},{value:"2",label:"2"},{value:"2.5",label:"2.5"},{value:"3",label:"3"}],Hb=({disabled:e})=>{const{editor:t}=P("LineHeightButton"),{formatMessage:n}=O.useIntl(),s=(()=>{if(!t.selection)return;const[i]=d.Editor.parent(t,t.selection.anchor,{edge:"start",depth:2});return i.lineHeight})(),a=i=>{if(!t.selection)return;const l=d.Editor.above(t,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&!["text","link","list-item"].includes(c.type)});if(l){const[,c]=l;d.Transforms.setNodes(t,{lineHeight:i},{at:c})}B.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(jf,{fill:e?"neutral300":"neutral600"}),"aria-label":n({id:"components.Blocks.lineHeight",defaultMessage:"Line height"})}),o.jsx(p.Menu.Content,{children:zb.map(i=>o.jsx(Ye,{onSelect:()=>a(i.value),$isActive:s===i.value,children:i.label},i.label))})]})},Ub=({disabled:e})=>{const{editor:t}=P("IndentButton"),n=()=>{if(!t.selection)return;const r=d.Editor.above(t,{match:s=>!d.Editor.isEditor(s)&&"type"in s&&!["text","link"].includes(s.type)});if(r){const[s,a]=r,i=s.indent||0;i<6&&d.Transforms.setNodes(t,{indent:i+1},{at:a})}B.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.IndentIncrease,name:"indent",label:{id:"components.Blocks.indent",defaultMessage:"Increase indent"},isActive:!1,disabled:e,handleClick:n})},Wb=({disabled:e})=>{const{editor:t}=P("OutdentButton"),n=()=>{if(!t.selection)return;const r=d.Editor.above(t,{match:s=>!d.Editor.isEditor(s)&&"type"in s&&!["text","link"].includes(s.type)});if(r){const[s,a]=r,i=s.indent||0;i>0&&d.Transforms.setNodes(t,{indent:i-1||void 0},{at:a})}B.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.IndentDecrease,name:"outdent",label:{id:"components.Blocks.outdent",defaultMessage:"Decrease indent"},isActive:!1,disabled:e,handleClick:n})},Kb=({disabled:e})=>{const{editor:t}=P("HorizontalLineButton"),{formatMessage:n}=O.useIntl(),r=n({id:"components.Blocks.horizontalLine",defaultMessage:"Horizontal line"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(be.ToggleItem,{value:"horizontalLine","data-state":"off",onMouseDown:s=>{s.preventDefault(),Fa(t),B.ReactEditor.focus(t)},"aria-disabled":e,disabled:e,"aria-label":r,asChild:!0,children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(D.Minus,{fill:e?"neutral300":"neutral600"})})})})},Gb=({disabled:e})=>{const{editor:t}=P("InlineMathButton"),{formatMessage:n}=O.useIntl(),r=n({id:"components.Blocks.inlineMath",defaultMessage:"Inline math"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(be.ToggleItem,{value:"inlineMath","data-state":"off",onMouseDown:s=>{s.preventDefault(),Xa(t),B.ReactEditor.focus(t)},"aria-disabled":e,disabled:e,"aria-label":r,asChild:!0,children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(po,{fill:e?"neutral300":"neutral600"})})})})},Vb=()=>{const{editor:e,blocks:t,modifiers:n,disabled:r}=P("BlocksToolbar"),{formatMessage:s}=O.useIntl(),i=(()=>{if(r)return!0;if(!e.selection)return!1;const c=e.children[e.selection.anchor.path[0]];return!!(!c||["code","image","button","horizontal-line"].includes(c.type))})(),l=co(n).map(([c,u])=>{const h=u;return o.jsx(Ce,{name:String(c),icon:h.icon,label:h.label,isActive:h.checkIsActive(e),handleClick:()=>h.handleToggle(e),disabled:i},String(c))});return o.jsx(be.Root,{"aria-disabled":r,asChild:!0,children:o.jsxs($b,{padding:2,width:"100%",children:[o.jsx(Qm,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Mb,{disabled:r}),o.jsx(Ib,{disabled:r})]})}),o.jsx(tt,{}),o.jsx(Cb,{}),o.jsx(tt,{}),o.jsxs(et,{children:[o.jsx(Ob,{disabled:i}),o.jsx(Lb,{disabled:i}),o.jsx(Ui,{})]}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[l,o.jsx(Ki,{disabled:i,location:"toolbar"})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"single",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Sr,{block:t["list-unordered"],format:"unordered",location:"toolbar"}),o.jsx(Sr,{block:t["list-ordered"],format:"ordered",location:"toolbar"}),o.jsx(Sr,{block:t["list-todo"],format:"todo",location:"toolbar"})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Db,{disabled:i}),o.jsx(Rb,{disabled:i}),o.jsx(Hb,{disabled:i}),o.jsx(Ub,{disabled:i}),o.jsx(Wb,{disabled:i}),o.jsx(Gi,{disabled:i})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Bb,{disabled:r}),o.jsx(Fb,{disabled:r}),o.jsx(_b,{disabled:r}),o.jsx(Gb,{disabled:i}),o.jsx(Kb,{disabled:r}),o.jsx(lb,{disabled:i}),o.jsx(jb,{disabled:i})]})}),o.jsx(tt,{}),o.jsxs(et,{children:[o.jsx(hb,{disabled:r}),o.jsx(Ab,{})]})]})})},Us=[{id:"paragraph",label:"Text",icon:D.Paragraph,action:e=>{d.Transforms.setNodes(e,{type:"paragraph"})}},{id:"heading-1",label:"Heading 1",icon:D.HeadingOne,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:1})}},{id:"heading-2",label:"Heading 2",icon:D.HeadingTwo,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:2})}},{id:"heading-3",label:"Heading 3",icon:D.HeadingThree,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:3})}},{id:"bulleted-list",label:"Bulleted list",icon:D.BulletList,action:e=>{d.Transforms.setNodes(e,{type:"list-item"}),d.Transforms.wrapNodes(e,{type:"list",format:"unordered",children:[]})}},{id:"numbered-list",label:"Numbered list",icon:D.NumberList,action:e=>{d.Transforms.setNodes(e,{type:"list-item"}),d.Transforms.wrapNodes(e,{type:"list",format:"ordered",children:[]})}},{id:"todo-list",label:"To-do list",icon:D.Check,action:e=>{d.Transforms.setNodes(e,{type:"list-item",checked:!1}),d.Transforms.wrapNodes(e,{type:"list",format:"todo",children:[]})}},{id:"quote",label:"Quote",icon:D.Quotes,action:e=>{d.Transforms.setNodes(e,{type:"quote"})}},{id:"code",label:"Code block",icon:D.Code,action:e=>{d.Transforms.setNodes(e,{type:"code"})}},{id:"video",label:"Video",icon:D.Play,action:e=>{li(e)}},{id:"embed",label:"Embed (iframe / URL)",icon:D.Code,action:e=>{ei(e)}},{id:"math",label:"Math block",icon:po,action:e=>{ho(e)}},{id:"mermaid",label:"Diagram (Mermaid)",icon:qa,action:e=>{uo(e)}},...Ha.map(e=>({id:`callout-${e}`,label:`Callout: ${String(Qt[e].label.defaultMessage)}`,icon:Qt[e].icon,action:t=>{Wa(t,e)}})),{id:"details",label:"Details (collapsible)",icon:D.CaretDown,action:e=>{Ga(e)}},{id:"horizontal-line",label:"Horizontal line",icon:D.Minus,action:e=>{Fa(e)}},{id:"table",label:"Table",icon:D.GridNine,action:e=>{gi(e)}}],qb=b.styled.div`
1718
+ `,_b=({disabled:e})=>{const{editor:t}=P("UndoButton"),{formatMessage:n}=O.useIntl();return o.jsx(Ce,{icon:$f,name:"undo",label:{id:"components.Blocks.undo",defaultMessage:"Undo"},isActive:!1,disabled:e||t.history.undos.length===0,handleClick:()=>lo.HistoryEditor.undo(t)})},Nb=({disabled:e})=>{const{editor:t}=P("RedoButton"),{formatMessage:n}=O.useIntl();return o.jsx(Ce,{icon:Ef,name:"redo",label:{id:"components.Blocks.redo",defaultMessage:"Redo"},isActive:!1,disabled:e||t.history.redos.length===0,handleClick:()=>lo.HistoryEditor.redo(t)})},Xi=({disabled:e})=>{const{editor:t}=P("RemoveFormattingButton"),n=()=>{if(!t.selection)return;const r=d.Editor.marks(t);r&&Object.keys(r).forEach(s=>{s!=="type"&&s!=="text"&&d.Editor.removeMark(t,s)}),R.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.PaintBrush,name:"removeFormatting",label:{id:"components.Blocks.removeFormatting",defaultMessage:"Remove formatting"},isActive:!1,disabled:e,handleClick:n})},Ks=[{value:"left",icon:bo,label:"Align left"},{value:"center",icon:ui,label:"Align center"},{value:"right",icon:pi,label:"Align right"},{value:"justify",icon:Cf,label:"Justify"}],Pb=({disabled:e})=>{const{editor:t}=P("TextAlignButton"),{formatMessage:n}=O.useIntl(),s=(()=>{if(!t.selection)return"left";const[l]=d.Editor.parent(t,t.selection.anchor,{edge:"start",depth:2});return l.textAlign||"left"})(),a=Ks.find(l=>l.value===s)?.icon||bo,i=l=>{if(!t.selection)return;const c=d.Editor.above(t,{match:u=>!d.Editor.isEditor(u)&&"type"in u&&!["text","link","list-item"].includes(u.type)});if(c){const[,u]=c;d.Transforms.setNodes(t,{textAlign:l==="left"?void 0:l},{at:u})}R.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(a,{fill:e?"neutral300":"neutral600"}),"aria-label":n({id:"components.Blocks.textAlign",defaultMessage:"Text alignment"})}),o.jsx(p.Menu.Content,{children:Ks.map(l=>{const c=l.icon,u=s===l.value;return o.jsxs(Ye,{onSelect:()=>i(l.value),$isActive:u,children:[o.jsx(c,{fill:u?"primary600":"neutral600"}),l.label]},l.value)})})]})},Lb=({disabled:e})=>{const{editor:t,blocks:n}=P("InsertBlockButton"),{formatMessage:r}=O.useIntl(),{modalElement:s,handleConversionResult:a}=Io(),i=c=>{const u=n[c].handleConvert?.(t);a(u),R.ReactEditor.focus(t)},l=[...Vi,...Ct().filter(ko).map(c=>c.type)];return o.jsxs(o.Fragment,{children:[o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(D.Plus,{fill:e?"neutral300":"neutral600"}),"aria-label":r({id:"components.Blocks.insertBlock",defaultMessage:"Insert"})}),o.jsx(p.Menu.Content,{children:l.map(c=>{const u=n[c];if(!u?.isInBlocksSelector)return null;const h=u.icon;return o.jsxs(Ye,{onSelect:()=>i(c),$isActive:!1,children:[o.jsx(h,{}),r(u.label)]},c)})})]}),s]})},Ob=({disabled:e})=>{const{editor:t}=P("InsertTableButton"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),a=n({id:"components.Blocks.insertTable",defaultMessage:"Insert table"}),i=(l,c)=>{bi(t,l,c),s(!1),R.ReactEditor.focus(t)};return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":e,"aria-label":a,title:a,onMouseDown:l=>{l.preventDefault(),e||s(c=>!c)},children:o.jsx(D.GridNine,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsx(cb,{onSelect:i})})]})},zb=({disabled:e})=>{const{editor:t,blocks:n}=P("QuoteButton"),r=()=>{if(!t.selection)return!1;const[a]=d.Editor.nodes(t,{at:t.selection.anchor,match:i=>!d.Editor.isEditor(i)&&"type"in i&&i.type==="quote"});return!!a},s=()=>{if(r()){n.paragraph.handleConvert?.(t);return}n.quote.handleConvert?.(t)};return o.jsx(Ce,{icon:D.Quotes,name:"quote",label:n.quote.label,isActive:r(),disabled:e,handleClick:s})},Hb=()=>{const{isExpandedMode:e,onToggleExpand:t}=P("ExpandButton"),{formatMessage:n}=O.useIntl(),r=n(e?{id:ot("components.Blocks.collapse"),defaultMessage:"Collapse"}:{id:ot("components.Blocks.expand"),defaultMessage:"Expand"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(Rt,{tag:"button",type:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":!1,"aria-label":r,onClick:t,children:e?o.jsx(D.Collapse,{fill:"neutral600"}):o.jsx(D.Expand,{fill:"neutral600"})})})},Ub=({disabled:e})=>{const{editor:t}=P("InsertMediaButton"),{formatMessage:n}=O.useIntl(),[r,s]=k.useState(!1),[a,i]=k.useState(""),l=k.useRef(null),c=()=>{a&&Bp(t,a)&&(i(""),s(!1),R.ReactEditor.focus(t))};k.useEffect(()=>{r&&l.current?.focus()},[r]);const u=n({id:"components.Blocks.insertMedia",defaultMessage:"Insert media"});return o.jsxs(p.Popover.Root,{open:r,children:[o.jsx(p.Popover.Trigger,{children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,"aria-disabled":e,"aria-label":u,title:u,onMouseDown:h=>{h.preventDefault(),h.stopPropagation(),e||s(f=>!f)},children:o.jsx(D.Play,{fill:e?"neutral300":"neutral600"})})}),o.jsx(p.Popover.Content,{onPointerDownOutside:()=>s(!1),children:o.jsxs(p.Flex,{padding:3,direction:"column",gap:3,children:[o.jsx(p.Field.Root,{width:"300px",children:o.jsxs(p.Flex,{direction:"column",gap:1,alignItems:"stretch",children:[o.jsx(p.Field.Label,{children:n({id:"components.Blocks.mediaUrl",defaultMessage:"Video URL"})}),o.jsx(p.Field.Input,{ref:l,name:"mediaUrl",placeholder:"https://youtube.com/watch?v=...",value:a,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),c())}})]})}),o.jsxs(p.Flex,{justifyContent:"flex-end",gap:2,children:[o.jsx(p.Button,{variant:"tertiary",onClick:()=>s(!1),children:n({id:"global.cancel",defaultMessage:"Cancel"})}),o.jsx(p.Button,{disabled:!a||!hp(a),onClick:c,children:n({id:"components.Blocks.insert",defaultMessage:"Insert"})})]})]})})]})},Wb=["Default","Arial","Georgia","Times New Roman","Courier New","Verdana","Trebuchet MS","Tahoma","Palatino","Garamond"],Kb=["Default","10px","12px","14px","16px","18px","20px","24px","28px","32px","36px","48px"],Gb=({disabled:e})=>{const{editor:t}=P("FontFamilySelect"),n=d.Editor.marks(t)?.fontFamily||void 0,r=s=>{s==="Default"?d.Editor.removeMark(t,"fontFamily"):d.Editor.addMark(t,"fontFamily",s),R.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S","aria-label":"Font family",children:n||"Font"}),o.jsx(p.Menu.Content,{onCloseAutoFocus:s=>s.preventDefault(),children:Wb.map(s=>o.jsx(Ye,{onSelect:()=>r(s),$isActive:n===s||!n&&s==="Default",children:s},s))})]})},Vb=({disabled:e})=>{const{editor:t}=P("FontSizeSelect"),n=d.Editor.marks(t)?.fontSize||void 0,r=s=>{s==="Default"?d.Editor.removeMark(t,"fontSize"):d.Editor.addMark(t,"fontSize",s),R.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S","aria-label":"Font size",children:n||"Size"}),o.jsx(p.Menu.Content,{onCloseAutoFocus:s=>s.preventDefault(),children:Kb.map(s=>o.jsx(Ye,{onSelect:()=>r(s),$isActive:n===s||!n&&s==="Default",children:s},s))})]})},qb=[{value:void 0,label:"Default"},{value:"1",label:"1"},{value:"1.15",label:"1.15"},{value:"1.5",label:"1.5"},{value:"2",label:"2"},{value:"2.5",label:"2.5"},{value:"3",label:"3"}],Xb=({disabled:e})=>{const{editor:t}=P("LineHeightButton"),{formatMessage:n}=O.useIntl(),s=(()=>{if(!t.selection)return;const[i]=d.Editor.parent(t,t.selection.anchor,{edge:"start",depth:2});return i.lineHeight})(),a=i=>{if(!t.selection)return;const l=d.Editor.above(t,{match:c=>!d.Editor.isEditor(c)&&"type"in c&&!["text","link","list-item"].includes(c.type)});if(l){const[,c]=l;d.Transforms.setNodes(t,{lineHeight:i},{at:c})}R.ReactEditor.focus(t)};return o.jsxs(p.Menu.Root,{children:[o.jsx(p.Menu.Trigger,{disabled:e,size:"S",variant:"ghost",startIcon:o.jsx(Sf,{fill:e?"neutral300":"neutral600"}),"aria-label":n({id:"components.Blocks.lineHeight",defaultMessage:"Line height"})}),o.jsx(p.Menu.Content,{children:qb.map(i=>o.jsx(Ye,{onSelect:()=>a(i.value),$isActive:s===i.value,children:i.label},i.label))})]})},Yb=({disabled:e})=>{const{editor:t}=P("IndentButton"),n=()=>{if(!t.selection)return;const r=d.Editor.above(t,{match:s=>!d.Editor.isEditor(s)&&"type"in s&&!["text","link"].includes(s.type)});if(r){const[s,a]=r,i=s.indent||0;i<6&&d.Transforms.setNodes(t,{indent:i+1},{at:a})}R.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.IndentIncrease,name:"indent",label:{id:"components.Blocks.indent",defaultMessage:"Increase indent"},isActive:!1,disabled:e,handleClick:n})},Zb=({disabled:e})=>{const{editor:t}=P("OutdentButton"),n=()=>{if(!t.selection)return;const r=d.Editor.above(t,{match:s=>!d.Editor.isEditor(s)&&"type"in s&&!["text","link"].includes(s.type)});if(r){const[s,a]=r,i=s.indent||0;i>0&&d.Transforms.setNodes(t,{indent:i-1||void 0},{at:a})}R.ReactEditor.focus(t)};return o.jsx(Ce,{icon:D.IndentDecrease,name:"outdent",label:{id:"components.Blocks.outdent",defaultMessage:"Decrease indent"},isActive:!1,disabled:e,handleClick:n})},Jb=({disabled:e})=>{const{editor:t}=P("HorizontalLineButton"),{formatMessage:n}=O.useIntl(),r=n({id:"components.Blocks.horizontalLine",defaultMessage:"Horizontal line"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(be.ToggleItem,{value:"horizontalLine","data-state":"off",onMouseDown:s=>{s.preventDefault(),Aa(t),R.ReactEditor.focus(t)},"aria-disabled":e,disabled:e,"aria-label":r,asChild:!0,children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(D.Minus,{fill:e?"neutral300":"neutral600"})})})})},Qb=({disabled:e})=>{const{editor:t}=P("InlineMathButton"),{formatMessage:n}=O.useIntl(),r=n({id:"components.Blocks.inlineMath",defaultMessage:"Inline math"});return o.jsx(p.Tooltip,{label:r,children:o.jsx(be.ToggleItem,{value:"inlineMath","data-state":"off",onMouseDown:s=>{s.preventDefault(),Za(t),R.ReactEditor.focus(t)},"aria-disabled":e,disabled:e,"aria-label":r,asChild:!0,children:o.jsx(Rt,{tag:"button",alignItems:"center",justifyContent:"center",width:7,height:7,hasRadius:!0,children:o.jsx(fo,{fill:e?"neutral300":"neutral600"})})})})},ey=()=>{const{editor:e,blocks:t,modifiers:n,disabled:r}=P("BlocksToolbar"),{formatMessage:s}=O.useIntl(),i=(()=>{if(r)return!0;if(!e.selection)return!1;const c=e.children[e.selection.anchor.path[0]];return!!(!c||["code","image","button","horizontal-line"].includes(c.type))})(),l=po(n).map(([c,u])=>{const h=u;return o.jsx(Ce,{name:String(c),icon:h.icon,label:h.label,isActive:h.checkIsActive(e),handleClick:()=>h.handleToggle(e),disabled:i},String(c))});return o.jsx(be.Root,{"aria-disabled":r,asChild:!0,children:o.jsxs(Ib,{padding:2,width:"100%",children:[o.jsx(ab,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(_b,{disabled:r}),o.jsx(Nb,{disabled:r})]})}),o.jsx(tt,{}),o.jsx(Fb,{}),o.jsx(tt,{}),o.jsxs(et,{children:[o.jsx(Vb,{disabled:i}),o.jsx(Gb,{disabled:i}),o.jsx(Gi,{})]}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[l,o.jsx(qi,{disabled:i,location:"toolbar"})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"single",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Mr,{block:t["list-unordered"],format:"unordered",location:"toolbar"}),o.jsx(Mr,{block:t["list-ordered"],format:"ordered",location:"toolbar"}),o.jsx(Mr,{block:t["list-todo"],format:"todo",location:"toolbar"})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(zb,{disabled:i}),o.jsx(Pb,{disabled:i}),o.jsx(Xb,{disabled:i}),o.jsx(Yb,{disabled:i}),o.jsx(Zb,{disabled:i}),o.jsx(Xi,{disabled:i})]})}),o.jsx(tt,{}),o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(et,{children:[o.jsx(Lb,{disabled:r}),o.jsx(Ob,{disabled:r}),o.jsx(Ub,{disabled:r}),o.jsx(Qb,{disabled:i}),o.jsx(Jb,{disabled:r}),o.jsx(gb,{disabled:i}),o.jsx(Bb,{disabled:i})]})}),o.jsx(tt,{}),o.jsxs(et,{children:[o.jsx(vb,{disabled:r}),o.jsx(Hb,{})]})]})})},ty=[{id:"paragraph",label:"Text",icon:D.Paragraph,action:e=>{d.Transforms.setNodes(e,{type:"paragraph"})}},{id:"heading-1",label:"Heading 1",icon:D.HeadingOne,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:1})}},{id:"heading-2",label:"Heading 2",icon:D.HeadingTwo,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:2})}},{id:"heading-3",label:"Heading 3",icon:D.HeadingThree,action:e=>{d.Transforms.setNodes(e,{type:"heading",level:3})}},{id:"bulleted-list",label:"Bulleted list",icon:D.BulletList,action:e=>{d.Transforms.setNodes(e,{type:"list-item"}),d.Transforms.wrapNodes(e,{type:"list",format:"unordered",children:[]})}},{id:"numbered-list",label:"Numbered list",icon:D.NumberList,action:e=>{d.Transforms.setNodes(e,{type:"list-item"}),d.Transforms.wrapNodes(e,{type:"list",format:"ordered",children:[]})}},{id:"todo-list",label:"To-do list",icon:D.Check,action:e=>{d.Transforms.setNodes(e,{type:"list-item",checked:!1}),d.Transforms.wrapNodes(e,{type:"list",format:"todo",children:[]})}},{id:"quote",label:"Quote",icon:D.Quotes,action:e=>{d.Transforms.setNodes(e,{type:"quote"})}},{id:"code",label:"Code block",icon:D.Code,action:e=>{d.Transforms.setNodes(e,{type:"code"})}},{id:"video",label:"Video",icon:D.Play,action:e=>{di(e)}},{id:"embed",label:"Embed (iframe / URL)",icon:D.Code,action:e=>{ni(e)}},{id:"math",label:"Math block",icon:fo,action:e=>{go(e)}},{id:"mermaid",label:"Diagram (Mermaid)",icon:Ya,action:e=>{ho(e)}},...Wa.map(e=>({id:`callout-${e}`,label:`Callout: ${String(en[e].label.defaultMessage)}`,icon:en[e].icon,action:t=>{Ga(t,e)}})),{id:"details",label:"Details (collapsible)",icon:D.CaretDown,action:e=>{qa(e)}},{id:"horizontal-line",label:"Horizontal line",icon:D.Minus,action:e=>{Aa(e)}},{id:"table",label:"Table",icon:D.GridNine,action:e=>{bi(e)}}],ny=b.styled.div`
1719
1719
  position: absolute;
1720
1720
  z-index: 10;
1721
1721
  background: ${({theme:e})=>e.colors.neutral0};
@@ -1726,7 +1726,7 @@
1726
1726
  overflow-y: auto;
1727
1727
  width: 220px;
1728
1728
  padding: 4px;
1729
- `,Xb=b.styled.button`
1729
+ `,ry=b.styled.button`
1730
1730
  display: flex;
1731
1731
  align-items: center;
1732
1732
  gap: 8px;
@@ -1749,7 +1749,7 @@
1749
1749
  height: 16px;
1750
1750
  flex-shrink: 0;
1751
1751
  }
1752
- `,Yb=()=>{const e=B.useSlate();P("SlashCommandMenu");const[t,n]=k.useState(!1),[r,s]=k.useState(""),[a,i]=k.useState(0),[l,c]=k.useState({top:0,left:0}),u=k.useRef(null),h=k.useMemo(()=>r?Us.filter(g=>g.label.toLowerCase().includes(r.toLowerCase())):Us,[r]);k.useEffect(()=>{const{selection:g}=e;if(!g||!d.Range.isCollapsed(g)){n(!1);return}const[m]=d.Editor.parent(e,g.anchor),w=m.children?.length===1&&"text"in m.children[0]?m.children[0].text:"";if(w.startsWith("/")){s(w.slice(1)),n(!0),i(0);try{const y=B.ReactEditor.toDOMRange(e,g).getBoundingClientRect(),E=B.ReactEditor.toDOMNode(e,e).getBoundingClientRect();c({top:y.bottom-E.top+4,left:y.left-E.left})}catch{}}else n(!1)},[e.selection,e.children]);const f=k.useCallback(g=>{const{selection:m}=e;if(m){const[,w]=d.Editor.parent(e,m.anchor),x=d.Editor.start(e,w);d.Transforms.select(e,{anchor:x,focus:m.anchor}),d.Transforms.delete(e)}g.action(e),n(!1),B.ReactEditor.focus(e)},[e]);return k.useEffect(()=>{if(!t)return;const g=m=>{m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),i(w=>(w+1)%h.length)):m.key==="ArrowUp"?(m.preventDefault(),m.stopPropagation(),i(w=>(w-1+h.length)%h.length)):m.key==="Enter"?(m.preventDefault(),m.stopPropagation(),h[a]&&f(h[a])):m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),n(!1))};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[t,h,a,f]),!t||h.length===0?null:o.jsx(qb,{ref:u,contentEditable:!1,style:{top:l.top,left:l.left},children:h.map((g,m)=>{const w=g.icon;return o.jsxs(Xb,{$active:m===a,onMouseDown:x=>{x.preventDefault(),f(g)},onMouseEnter:()=>i(m),children:[o.jsx(w,{}),g.label]},g.id)})})},Zb=b.styled(B.Editable)`
1752
+ `,oy=()=>{const e=R.useSlate();P("SlashCommandMenu");const[t,n]=k.useState(!1),[r,s]=k.useState(""),[a,i]=k.useState(0),[l,c]=k.useState({top:0,left:0}),u=k.useRef(null),h=k.useMemo(()=>[...ty,...Ct().filter(ko).map(m=>({id:m.type,label:String(vi(m).defaultMessage??m.type),icon:m.icon,action:x=>m.insert?.(x)}))],[]),f=k.useMemo(()=>r?h.filter(m=>m.label.toLowerCase().includes(r.toLowerCase())):h,[h,r]);k.useEffect(()=>{const{selection:m}=e;if(!m||!d.Range.isCollapsed(m)){n(!1);return}const[x]=d.Editor.parent(e,m.anchor),y=x.children?.length===1&&"text"in x.children[0]?x.children[0].text:"";if(y.startsWith("/")){s(y.slice(1)),n(!0),i(0);try{const $=R.ReactEditor.toDOMRange(e,m).getBoundingClientRect(),C=R.ReactEditor.toDOMNode(e,e).getBoundingClientRect();c({top:$.bottom-C.top+4,left:$.left-C.left})}catch{}}else n(!1)},[e.selection,e.children]);const g=k.useCallback(m=>{const{selection:x}=e;if(x){const[,y]=d.Editor.parent(e,x.anchor),v=d.Editor.start(e,y);d.Transforms.select(e,{anchor:v,focus:x.anchor}),d.Transforms.delete(e)}m.action(e),n(!1),R.ReactEditor.focus(e)},[e]);return k.useEffect(()=>{if(!t)return;const m=x=>{x.key==="ArrowDown"?(x.preventDefault(),x.stopPropagation(),i(y=>(y+1)%f.length)):x.key==="ArrowUp"?(x.preventDefault(),x.stopPropagation(),i(y=>(y-1+f.length)%f.length)):x.key==="Enter"?(x.preventDefault(),x.stopPropagation(),f[a]&&g(f[a])):x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),n(!1))};return document.addEventListener("keydown",m,!0),()=>document.removeEventListener("keydown",m,!0)},[t,f,a,g]),!t||f.length===0?null:o.jsx(ny,{ref:u,contentEditable:!1,style:{top:l.top,left:l.left},children:f.map((m,x)=>{const y=m.icon;return o.jsxs(ry,{$active:x===a,onMouseDown:v=>{v.preventDefault(),g(m)},onMouseEnter:()=>i(x),children:[o.jsx(y,{}),m.label]},m.id)})})},sy=b.styled(R.Editable)`
1753
1753
  // The outline style is set on the wrapper with :focus-within
1754
1754
  outline: none;
1755
1755
  display: flex;
@@ -1768,18 +1768,18 @@
1768
1768
  white-space: nowrap !important;
1769
1769
  opacity: 0.33;
1770
1770
  }
1771
- `,Jb=b.styled(p.Box)`
1771
+ `,ay=b.styled(p.Box)`
1772
1772
  position: ${({$isOverDropTarget:e})=>e&&"relative"};
1773
- `,Qb=b.styled(p.Box)`
1773
+ `,iy=b.styled(p.Box)`
1774
1774
  position: absolute;
1775
1775
  right: 0;
1776
1776
 
1777
1777
  // Show drop placeholder 8px above or below the drop target
1778
1778
  ${({$dragDirection:e,theme:t,$placeholderMargin:n})=>b.css`
1779
- top: ${e===Hn.UPWARD&&`-${t.spaces[n]}`};
1780
- bottom: ${e===Hn.DOWNWARD&&`-${t.spaces[n]}`};
1779
+ top: ${e===Wn.UPWARD&&`-${t.spaces[n]}`};
1780
+ bottom: ${e===Wn.DOWNWARD&&`-${t.spaces[n]}`};
1781
1781
  `}
1782
- `,Vi=b.styled(p.Flex)`
1782
+ `,Yi=b.styled(p.Flex)`
1783
1783
  // Style each block rendered using renderElement()
1784
1784
  & > [data-slate-node='element'] {
1785
1785
  width: 100%;
@@ -1794,7 +1794,7 @@
1794
1794
  &[aria-disabled='true'] {
1795
1795
  user-drag: none;
1796
1796
  }
1797
- `,qi=b.styled(p.IconButton)`
1797
+ `,Zi=b.styled(p.IconButton)`
1798
1798
  user-select: none;
1799
1799
  display: flex;
1800
1800
  align-items: center;
@@ -1827,11 +1827,11 @@
1827
1827
  fill: ${({theme:e})=>e.colors.neutral500};
1828
1828
  }
1829
1829
  }
1830
- `,ex=({children:e,index:t,setDragDirection:n,dragDirection:r,dragHandleTopMargin:s})=>{const{editor:a,disabled:i}=P("drag-and-drop"),{formatMessage:l}=O.useIntl(),[c,u]=k.useState("hidden"),{attributes:h,listeners:f,setNodeRef:g,transform:m,transition:w,isDragging:x,isOver:y}=Zm({id:String(t[0]),disabled:i}),$={transform:an.Transform.toString(m),transition:w};return k.useEffect(()=>{if(y){const E=m?.y&&m.y>0?Hn.DOWNWARD:Hn.UPWARD;n(E)}},[m,y,n]),k.useEffect(()=>{u("hidden")},[a.selection]),o.jsxs(Jb,{ref:g,style:$,$isOverDropTarget:y,children:[y&&o.jsx(Qb,{borderStyle:"solid",borderColor:"secondary200",borderWidth:"2px",width:"calc(100% - 24px)",marginLeft:"auto",$dragDirection:r,$placeholderMargin:e.props.as&&e.props.as==="li"?1:2}),x?o.jsx(tx,{dragHandleTopMargin:s,children:e}):o.jsxs(Vi,{gap:2,paddingLeft:2,alignItems:"start",onMouseMove:()=>u("visible"),onSelect:()=>u("visible"),onMouseLeave:()=>u("hidden"),"aria-disabled":i,$dragVisibility:c,children:[o.jsx(qi,{tag:"div",contentEditable:!1,withTooltip:!1,label:l({id:ot("components.DragHandle-label"),defaultMessage:"Drag"}),onClick:E=>E.stopPropagation(),disabled:i,draggable:!0,$dragHandleTopMargin:s,...h,...f,children:o.jsx(D.Drag,{color:"primary500"})}),e]})]})},tx=({children:e,dragHandleTopMargin:t})=>{const{formatMessage:n}=O.useIntl();return o.jsxs(Vi,{gap:2,paddingLeft:2,alignItems:"start",$dragVisibility:"visible",children:[o.jsx(qi,{tag:"div",role:"button",withTooltip:!1,label:n({id:ot("components.DragHandle-label"),defaultMessage:"Drag"}),$dragHandleTopMargin:t,children:o.jsx(D.Drag,{color:"neutral600"})}),e]})},nx=(e,t)=>{if(!e.selection)return;const r=[d.Range.start(e.selection).path[0]];let s=0;t.key==="ArrowUp"?s=r[0]>0?r[0]-1:r[0]:s=r[0]<e.children.length-1?r[0]+1:r[0];const a=[s];return s!==r[0]?(d.Transforms.moveNodes(e,{at:r,to:a}),{currentIndex:r,newIndex:a}):null},Ws=()=>!0,rx=e=>{if(!e)return!1;const t=e.replace("#",""),n=t.length===3?t.split("").map(i=>i+i).join(""):t;if(n.length<6)return!1;const r=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return[r,s,a].some(i=>Number.isNaN(i))?!1:.299*r+.587*s+.114*a<128},ox=({placeholder:e="Start writing...",ariaLabelId:t})=>{const{editor:n,disabled:r,blocks:s,modifiers:a,setLiveText:i,isExpandedMode:l}=P("BlocksContent"),c=k.useRef(null),{formatMessage:u}=O.useIntl(),[h,f]=k.useState(null),{modalElement:g}=To(),m=b.useTheme(),w=k.useMemo(()=>rx(m?.colors?.neutral0),[m?.colors?.neutral0]),[,x]=k.useReducer(F=>F+1,0);k.useEffect(()=>yc(x),[]);const y=Tg(ws(So,{activationConstraint:{distance:5}}),ws(Ii)),$=k.useCallback(F=>{const{active:_,over:L}=F;if(!L)return;const H=Number(_.id),V=Number(L.id);H!==V&&(d.Transforms.moveNodes(n,{at:[H],to:[V]}),i(u({id:ot("components.Blocks.dnd.reorder"),defaultMessage:"{item}, moved. New position in the editor: {position}."},{item:`${H+1}`,position:`${V+1} of ${n.children.length}`})))},[n,u,i]),E=k.useCallback(F=>{const _=co(a).reduce((Te,q)=>{const[te,ie]=q;return F.leaf[te]?ie.renderLeaf(Te):Te},F.children),L=F.leaf.color,H=F.leaf.backgroundColor,V=F.leaf.fontFamily,G=F.leaf.fontSize,Ne=F.leaf.searchHighlight,ae=F.leaf.searchHighlightActive,Se={...L?{color:L}:{},...H?{backgroundColor:H}:{},...V?{fontFamily:V}:{},...G?{fontSize:G}:{},...ae?{backgroundColor:"#f97316",color:"#ffffff",borderRadius:"2px"}:Ne?{backgroundColor:"#fbbf24",color:"#1c1c1e",borderRadius:"2px"}:{}};return o.jsx("span",{...F.attributes,className:F.leaf.className,style:Se,children:_})},[a]),S=k.useCallback(F=>{const{element:_}=F,H=Object.values(s).find(q=>q.matchNode(_))||s.paragraph,V=B.ReactEditor.findPath(n,_),G=_.type,Ne=G==="math"&&_.format==="inline",Se=G==="table-row"||G==="table-cell"||G==="table-header-cell"||V.length>1&&n.children.some((q,te)=>V[0]!==te?!1:q.type==="table"),Te=V.length>1&&n.children.some((q,te)=>{if(V[0]!==te)return!1;const ie=q.type;return ie==="callout"||ie==="details"});return Aa(_)||Ne||st(_)&&V.length>1||G==="list-item"||Se||Te?H.renderElement(F):o.jsx(ex,{index:V,setDragDirection:f,dragDirection:h,dragHandleTopMargin:H.dragHandleTopMargin,children:H.renderElement(F)})},[s,n,h,f]),R=k.useCallback(F=>{if(!n.selection||!d.Range.isCollapsed(n.selection))return;const{anchor:_}=n.selection,L=d.Editor.string(n,d.Editor.before(n,_)||_);Object.values(s).forEach(H=>{H.snippets?.includes(L.trim())&&console.log("Snippet found:",L.trim())})},[n,s]),C=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));if(L){if(F.shiftKey&&_.type!=="image"){d.Transforms.insertText(n,`
1831
- `);return}L.handleEnterKey?L.handleEnterKey(n):s.paragraph.handleEnterKey&&s.paragraph.handleEnterKey(n)}},[n,s]),M=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));L&&L.handleBackspaceKey&&L.handleBackspaceKey(n,F)},[n,s]),j=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));L&&L.handleTab&&(F.preventDefault(),L.handleTab(n,F))},[n,s]),v=k.useCallback(F=>{const _=F.metaKey||F.ctrlKey,L=sb(F);if(L&&s[L]){F.preventDefault(),s[L].handleConvert?.(n);return}if(_&&(Object.values(a).forEach(H=>{const V=H;if(V.isValidEventKey(F)){V.handleToggle(n);return}}),F.shiftKey&&["ArrowUp","ArrowDown"].includes(F.key))){const H=nx(n,F);if(H){const{currentIndex:V,newIndex:G}=H;i(u({id:ot("components.Blocks.dnd.reorder"),defaultMessage:"{item}, moved. New position in the editor: {position}."},{item:`block.${V[0]+1}`,position:`${G[0]+1} of ${n.children.length}`})),F.preventDefault()}}},[n,s,a,i,u]),I=k.useCallback(F=>{switch(F.key){case"Enter":F.preventDefault(),C(F);return;case"Backspace":M(F);return;case"Tab":j(F);return;case"Escape":B.ReactEditor.blur(n);return}v(F),F.key===" "&&R(F)},[n,C,M,j,v,R]),A=k.useCallback(()=>{if(!n.selection||!c.current)return;const _=B.ReactEditor.toDOMRange(n,n.selection).getBoundingClientRect(),L=c.current.getBoundingClientRect();(_.top<L.top||_.bottom>L.bottom)&&c.current.scrollBy({top:28,behavior:"smooth"})},[n]),N=k.useMemo(()=>n.children.map((F,_)=>({id:String(_)})),[n.children.length]);return o.jsxs(p.Box,{ref:c,grow:1,width:"100%",overflow:"auto",fontSize:2,background:"neutral0",color:"neutral800",lineHeight:6,paddingRight:7,paddingTop:6,paddingBottom:3,position:"relative",children:[o.jsx(Rm,{sensors:y,collisionDetection:Fg,onDragEnd:$,children:o.jsx(Wm,{items:N,strategy:Hm,children:o.jsx(Zb,{"aria-labelledby":t,readOnly:r,placeholder:e,$isExpandedMode:l,decorate:F=>{const _=$c(n,w)(F)||[],H=pb(n)(F);return[..._,...H]},renderElement:S,renderLeaf:E,onKeyDown:I,scrollSelectionIntoView:A,onDrop:Ws,onDragStart:Ws})})}),g,o.jsx(Yb,{})]})},sx=b.styled(p.Flex)`
1830
+ `,ly=({children:e,index:t,setDragDirection:n,dragDirection:r,dragHandleTopMargin:s})=>{const{editor:a,disabled:i}=P("drag-and-drop"),{formatMessage:l}=O.useIntl(),[c,u]=k.useState("hidden"),{attributes:h,listeners:f,setNodeRef:g,transform:m,transition:x,isDragging:y,isOver:v}=ob({id:String(t[0]),disabled:i}),$={transform:ln.Transform.toString(m),transition:x};return k.useEffect(()=>{if(v){const E=m?.y&&m.y>0?Wn.DOWNWARD:Wn.UPWARD;n(E)}},[m,v,n]),k.useEffect(()=>{u("hidden")},[a.selection]),o.jsxs(ay,{ref:g,style:$,$isOverDropTarget:v,children:[v&&o.jsx(iy,{borderStyle:"solid",borderColor:"secondary200",borderWidth:"2px",width:"calc(100% - 24px)",marginLeft:"auto",$dragDirection:r,$placeholderMargin:e.props.as&&e.props.as==="li"?1:2}),y?o.jsx(cy,{dragHandleTopMargin:s,children:e}):o.jsxs(Yi,{gap:2,paddingLeft:2,alignItems:"start",onMouseMove:()=>u("visible"),onSelect:()=>u("visible"),onMouseLeave:()=>u("hidden"),"aria-disabled":i,$dragVisibility:c,children:[o.jsx(Zi,{tag:"div",contentEditable:!1,withTooltip:!1,label:l({id:ot("components.DragHandle-label"),defaultMessage:"Drag"}),onClick:E=>E.stopPropagation(),disabled:i,draggable:!0,$dragHandleTopMargin:s,...h,...f,children:o.jsx(D.Drag,{color:"primary500"})}),e]})]})},cy=({children:e,dragHandleTopMargin:t})=>{const{formatMessage:n}=O.useIntl();return o.jsxs(Yi,{gap:2,paddingLeft:2,alignItems:"start",$dragVisibility:"visible",children:[o.jsx(Zi,{tag:"div",role:"button",withTooltip:!1,label:n({id:ot("components.DragHandle-label"),defaultMessage:"Drag"}),$dragHandleTopMargin:t,children:o.jsx(D.Drag,{color:"neutral600"})}),e]})},dy=(e,t)=>{if(!e.selection)return;const r=[d.Range.start(e.selection).path[0]];let s=0;t.key==="ArrowUp"?s=r[0]>0?r[0]-1:r[0]:s=r[0]<e.children.length-1?r[0]+1:r[0];const a=[s];return s!==r[0]?(d.Transforms.moveNodes(e,{at:r,to:a}),{currentIndex:r,newIndex:a}):null},Gs=()=>!0,uy=e=>{if(!e)return!1;const t=e.replace("#",""),n=t.length===3?t.split("").map(i=>i+i).join(""):t;if(n.length<6)return!1;const r=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return[r,s,a].some(i=>Number.isNaN(i))?!1:.299*r+.587*s+.114*a<128},py=({placeholder:e="Start writing...",ariaLabelId:t})=>{const{editor:n,disabled:r,blocks:s,modifiers:a,setLiveText:i,isExpandedMode:l}=P("BlocksContent"),c=k.useRef(null),{formatMessage:u}=O.useIntl(),[h,f]=k.useState(null),{modalElement:g}=Io(),m=b.useTheme(),x=k.useMemo(()=>uy(m?.colors?.neutral0),[m?.colors?.neutral0]),[,y]=k.useReducer(F=>F+1,0);k.useEffect(()=>jc(y),[]);const v=Ag($s(Bo,{activationConstraint:{distance:5}}),$s(Fi)),$=k.useCallback(F=>{const{active:_,over:L}=F;if(!L)return;const H=Number(_.id),V=Number(L.id);H!==V&&(d.Transforms.moveNodes(n,{at:[H],to:[V]}),i(u({id:ot("components.Blocks.dnd.reorder"),defaultMessage:"{item}, moved. New position in the editor: {position}."},{item:`${H+1}`,position:`${V+1} of ${n.children.length}`})))},[n,u,i]),E=k.useCallback(F=>{const _=po(a).reduce((Te,q)=>{const[te,ie]=q;return F.leaf[te]?ie.renderLeaf(Te):Te},F.children),L=F.leaf.color,H=F.leaf.backgroundColor,V=F.leaf.fontFamily,G=F.leaf.fontSize,Ne=F.leaf.searchHighlight,ae=F.leaf.searchHighlightActive,Se={...L?{color:L}:{},...H?{backgroundColor:H}:{},...V?{fontFamily:V}:{},...G?{fontSize:G}:{},...ae?{backgroundColor:"#f97316",color:"#ffffff",borderRadius:"2px"}:Ne?{backgroundColor:"#fbbf24",color:"#1c1c1e",borderRadius:"2px"}:{}};return o.jsx("span",{...F.attributes,className:F.leaf.className,style:Se,children:_})},[a]),C=k.useCallback(F=>{const{element:_}=F,H=Object.values(s).find(q=>q.matchNode(_))||s.paragraph,V=R.ReactEditor.findPath(n,_),G=_.type,Ne=G==="math"&&_.format==="inline",Se=G==="table-row"||G==="table-cell"||G==="table-header-cell"||V.length>1&&n.children.some((q,te)=>V[0]!==te?!1:q.type==="table"),Te=V.length>1&&n.children.some((q,te)=>{if(V[0]!==te)return!1;const ie=q.type;return ie==="callout"||ie==="details"});return Na(_)||Ne||st(_)&&V.length>1||G==="list-item"||Se||Te?H.renderElement(F):o.jsx(ly,{index:V,setDragDirection:f,dragDirection:h,dragHandleTopMargin:H.dragHandleTopMargin,children:H.renderElement(F)})},[s,n,h,f]),I=k.useCallback(F=>{if(!n.selection||!d.Range.isCollapsed(n.selection))return;const{anchor:_}=n.selection,L=d.Editor.string(n,d.Editor.before(n,_)||_);Object.values(s).forEach(H=>{H.snippets?.includes(L.trim())&&console.log("Snippet found:",L.trim())})},[n,s]),S=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));if(L){if(F.shiftKey&&_.type!=="image"){d.Transforms.insertText(n,`
1831
+ `);return}L.handleEnterKey?L.handleEnterKey(n):s.paragraph.handleEnterKey&&s.paragraph.handleEnterKey(n)}},[n,s]),T=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));L&&L.handleBackspaceKey&&L.handleBackspaceKey(n,F)},[n,s]),j=k.useCallback(F=>{if(!n.selection)return;const _=n.children[n.selection.anchor.path[0]],L=Object.values(s).find(H=>H.matchNode(_));L&&L.handleTab&&(F.preventDefault(),L.handleTab(n,F))},[n,s]),w=k.useCallback(F=>{const _=F.metaKey||F.ctrlKey,L=pb(F);if(L&&s[L]){F.preventDefault(),s[L].handleConvert?.(n);return}if(_&&(Object.values(a).forEach(H=>{const V=H;if(V.isValidEventKey(F)){V.handleToggle(n);return}}),F.shiftKey&&["ArrowUp","ArrowDown"].includes(F.key))){const H=dy(n,F);if(H){const{currentIndex:V,newIndex:G}=H;i(u({id:ot("components.Blocks.dnd.reorder"),defaultMessage:"{item}, moved. New position in the editor: {position}."},{item:`block.${V[0]+1}`,position:`${G[0]+1} of ${n.children.length}`})),F.preventDefault()}}},[n,s,a,i,u]),B=k.useCallback(F=>{switch(F.key){case"Enter":F.preventDefault(),S(F);return;case"Backspace":T(F);return;case"Tab":j(F);return;case"Escape":R.ReactEditor.blur(n);return}w(F),F.key===" "&&I(F)},[n,S,T,j,w,I]),A=k.useCallback(()=>{if(!n.selection||!c.current)return;const _=R.ReactEditor.toDOMRange(n,n.selection).getBoundingClientRect(),L=c.current.getBoundingClientRect();(_.top<L.top||_.bottom>L.bottom)&&c.current.scrollBy({top:28,behavior:"smooth"})},[n]),N=k.useMemo(()=>n.children.map((F,_)=>({id:String(_)})),[n.children.length]);return o.jsxs(p.Box,{ref:c,grow:1,width:"100%",overflow:"auto",fontSize:2,background:"neutral0",color:"neutral800",lineHeight:6,paddingRight:7,paddingTop:6,paddingBottom:3,position:"relative",children:[o.jsx(Pm,{sensors:v,collisionDetection:Og,onDragEnd:$,children:o.jsx(Zm,{items:N,strategy:Xm,children:o.jsx(sy,{"aria-labelledby":t,readOnly:r,placeholder:e,$isExpandedMode:l,decorate:F=>{const _=Tc(n,x)(F)||[],H=xb(n)(F);return[..._,...H]},renderElement:C,renderLeaf:E,onKeyDown:B,scrollSelectionIntoView:A,onDrop:Gs,onDragStart:Gs})})}),g,o.jsx(oy,{})]})},hy=b.styled(p.Flex)`
1832
1832
  // Background with 20% opacity
1833
1833
  background: ${({theme:e})=>`${e.colors.neutral800}1F`};
1834
- `,ax=({children:e,error:t,disabled:n,onCollapse:r,ariaDescriptionId:s})=>{const{isExpandedMode:a}=P("editorLayout");return k.useEffect(()=>(a&&document.body.classList.add("lock-body-scroll"),()=>{document.body.classList.remove("lock-body-scroll")}),[a]),a?o.jsx(p.Portal,{role:"dialog","aria-modal":!1,children:o.jsx(p.FocusTrap,{onEscape:r,children:o.jsx(sx,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:r,children:o.jsx(p.Box,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"90%",height:"90%",onClick:i=>i.stopPropagation(),"aria-describedby":s,position:"relative",children:o.jsx(p.Flex,{height:"100%",alignItems:"flex-start",direction:"column",children:e})})})})}):o.jsx(ix,{direction:"column",alignItems:"flex-start",$disabled:n,$hasError:!!t,style:{overflowY:"auto",overflowX:"hidden"},"aria-describedby":s,position:"relative",children:e})},ix=b.styled(p.Flex)`
1834
+ `,fy=({children:e,error:t,disabled:n,onCollapse:r,ariaDescriptionId:s})=>{const{isExpandedMode:a}=P("editorLayout");return k.useEffect(()=>(a&&document.body.classList.add("lock-body-scroll"),()=>{document.body.classList.remove("lock-body-scroll")}),[a]),a?o.jsx(p.Portal,{role:"dialog","aria-modal":!1,children:o.jsx(p.FocusTrap,{onEscape:r,children:o.jsx(hy,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:r,children:o.jsx(p.Box,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"90%",height:"90%",onClick:i=>i.stopPropagation(),"aria-describedby":s,position:"relative",children:o.jsx(p.Flex,{height:"100%",alignItems:"flex-start",direction:"column",children:e})})})})}):o.jsx(gy,{direction:"column",alignItems:"flex-start",$disabled:n,$hasError:!!t,style:{overflowY:"auto",overflowX:"hidden"},"aria-describedby":s,position:"relative",children:e})},gy=b.styled(p.Flex)`
1835
1835
  border: 1px solid
1836
1836
  ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
1837
1837
  border-radius: ${({theme:e})=>e.borderRadius};
@@ -1856,7 +1856,7 @@
1856
1856
  color: ${e.colors.neutral600};
1857
1857
  background: ${e.colors.neutral150};
1858
1858
  `:void 0}
1859
- `,lx=["bold","italic","underline","strikethrough","code"],cx=["code","image","button","horizontal-line","video","audio","embed","social-embed","diagram"],qt=8,dx=b.styled(p.Flex)`
1859
+ `,my=["bold","italic","underline","strikethrough","code"],by=["code","image","button","horizontal-line","video","audio","embed","social-embed","diagram"],Xt=8,yy=b.styled(p.Flex)`
1860
1860
  position: fixed;
1861
1861
  top: -10000px;
1862
1862
  left: -10000px;
@@ -1874,30 +1874,30 @@
1874
1874
  opacity: 1;
1875
1875
  pointer-events: auto;
1876
1876
  }
1877
- `,ux=()=>{const{editor:e,disabled:t,modifiers:n}=P("FloatingSelectionToolbar"),r=k.useRef(null),[s,a]=k.useState(!1);k.useEffect(()=>{const l=()=>a(!0),c=()=>a(!1);return document.addEventListener("mousedown",l),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("mouseup",c)}},[]);const i=k.useCallback(()=>{const{selection:l}=e;if(t||!l||d.Range.isCollapsed(l)||!B.ReactEditor.isFocused(e)||d.Editor.string(e,l)==="")return!1;const c=e.children[l.anchor.path[0]];return!(c&&cx.includes(c.type))},[e,t]);return k.useEffect(()=>{const l=r.current;if(!l)return;if(s||!i()){l.dataset.visible="false";return}const c=window.getSelection();if(!c||c.rangeCount===0){l.dataset.visible="false";return}const u=c.getRangeAt(0).getBoundingClientRect();if(u.width===0&&u.height===0){l.dataset.visible="false";return}const{offsetWidth:h,offsetHeight:f}=l,m=u.top-f-qt>0?u.top-f-qt:u.bottom+qt,w=Math.min(Math.max(u.left+u.width/2-h/2,qt),window.innerWidth-h-qt);l.style.top=`${m}px`,l.style.left=`${w}px`,l.dataset.visible="true"}),o.jsx(p.Portal,{children:o.jsx(be.Root,{asChild:!0,children:o.jsx(dx,{ref:r,gap:1,alignItems:"center","data-visible":"false",role:"toolbar","aria-label":"Text formatting",onMouseDown:l=>l.preventDefault(),children:o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(p.Flex,{gap:1,alignItems:"center",children:[lx.map(l=>{const c=n[l];return c?o.jsx(Ce,{name:l,icon:c.icon,label:c.label,isActive:c.checkIsActive(e),disabled:t,handleClick:()=>c.handleToggle(e)},l):null}),o.jsx(Ki,{disabled:t,location:"toolbar"}),o.jsx(Ui,{}),o.jsx(Gi,{disabled:t})]})})})})})},ct=b.css`
1877
+ `,xy=()=>{const{editor:e,disabled:t,modifiers:n}=P("FloatingSelectionToolbar"),r=k.useRef(null),[s,a]=k.useState(!1);k.useEffect(()=>{const l=()=>a(!0),c=()=>a(!1);return document.addEventListener("mousedown",l),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("mouseup",c)}},[]);const i=k.useCallback(()=>{const{selection:l}=e;if(t||!l||d.Range.isCollapsed(l)||!R.ReactEditor.isFocused(e)||d.Editor.string(e,l)==="")return!1;const c=e.children[l.anchor.path[0]];return!(c&&by.includes(c.type))},[e,t]);return k.useEffect(()=>{const l=r.current;if(!l)return;if(s||!i()){l.dataset.visible="false";return}const c=window.getSelection();if(!c||c.rangeCount===0){l.dataset.visible="false";return}const u=c.getRangeAt(0).getBoundingClientRect();if(u.width===0&&u.height===0){l.dataset.visible="false";return}const{offsetWidth:h,offsetHeight:f}=l,m=u.top-f-Xt>0?u.top-f-Xt:u.bottom+Xt,x=Math.min(Math.max(u.left+u.width/2-h/2,Xt),window.innerWidth-h-Xt);l.style.top=`${m}px`,l.style.left=`${x}px`,l.dataset.visible="true"}),o.jsx(p.Portal,{children:o.jsx(be.Root,{asChild:!0,children:o.jsx(yy,{ref:r,gap:1,alignItems:"center","data-visible":"false",role:"toolbar","aria-label":"Text formatting",onMouseDown:l=>l.preventDefault(),children:o.jsx(be.ToggleGroup,{type:"multiple",asChild:!0,children:o.jsxs(p.Flex,{gap:1,alignItems:"center",children:[my.map(l=>{const c=n[l];return c?o.jsx(Ce,{name:l,icon:c.icon,label:c.label,isActive:c.checkIsActive(e),disabled:t,handleClick:()=>c.handleToggle(e)},l):null}),o.jsx(qi,{disabled:t,location:"toolbar"}),o.jsx(Gi,{}),o.jsx(Xi,{disabled:t})]})})})})})},ct=b.css`
1878
1878
  font-size: inherit;
1879
1879
  color: inherit;
1880
1880
  line-height: inherit;
1881
- `,px=b.styled(p.Typography).attrs({textTransform:"uppercase"})`
1881
+ `,vy=b.styled(p.Typography).attrs({textTransform:"uppercase"})`
1882
1882
  ${ct}
1883
- `,hx=b.styled(p.Typography)`
1883
+ `,wy=b.styled(p.Typography)`
1884
1884
  vertical-align: super;
1885
1885
  font-size: smaller !important;
1886
1886
  ${ct}
1887
- `,fx=b.styled(p.Typography)`
1887
+ `,ky=b.styled(p.Typography)`
1888
1888
  vertical-align: sub;
1889
1889
  font-size: smaller !important;
1890
1890
  ${ct}
1891
- `,gx=b.styled(p.Typography).attrs({fontWeight:"bold"})`
1891
+ `,jy=b.styled(p.Typography).attrs({fontWeight:"bold"})`
1892
1892
  ${ct}
1893
- `,mx=b.styled(p.Typography)`
1893
+ `,$y=b.styled(p.Typography)`
1894
1894
  font-style: italic;
1895
1895
  ${ct}
1896
- `,bx=b.styled(p.Typography).attrs({textDecoration:"underline"})`
1896
+ `,Ey=b.styled(p.Typography).attrs({textDecoration:"underline"})`
1897
1897
  ${ct}
1898
- `,xx=b.styled(p.Typography).attrs({textDecoration:"line-through"})`
1898
+ `,Cy=b.styled(p.Typography).attrs({textDecoration:"line-through"})`
1899
1899
  ${ct}
1900
- `,yx=b.styled.code`
1900
+ `,Sy=b.styled.code`
1901
1901
  background-color: ${({theme:e})=>e.colors.neutral150};
1902
1902
  border-radius: ${({theme:e})=>e.borderRadius};
1903
1903
  padding: ${({theme:e})=>`0 ${e.spaces[2]}`};
@@ -1905,22 +1905,22 @@
1905
1905
  'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo,
1906
1906
  Consolas, monospace;
1907
1907
  color: inherit;
1908
- `,We=(e,t)=>{const n=d.Editor.marks(e);return n?!!n[t]:!1},Ke=(e,t)=>{const n=d.Editor.marks(e);if(!e.selection){const r=d.Editor.end(e,[]);d.Transforms.select(e,r)}n?.[t]?d.Editor.removeMark(e,t):d.Editor.addMark(e,t,!0)},vx={uppercase:{icon:xf,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.uppercase",defaultMessage:"Uppercase"},checkIsActive:e=>We(e,"uppercase"),handleToggle:e=>Ke(e,"uppercase"),renderLeaf:e=>o.jsx(px,{children:e})},superscript:{icon:yf,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.superscript",defaultMessage:"Superscript"},checkIsActive:e=>We(e,"superscript"),handleToggle:e=>Ke(e,"superscript"),renderLeaf:e=>o.jsx(hx,{children:e})},subscript:{icon:Ef,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.subscript",defaultMessage:"Subscript"},checkIsActive:e=>We(e,"subscript"),handleToggle:e=>Ke(e,"subscript"),renderLeaf:e=>o.jsx(fx,{children:e})},bold:{icon:D.Bold,isValidEventKey:e=>e.key==="b",label:{id:"components.Blocks.modifiers.bold",defaultMessage:"Bold"},checkIsActive:e=>We(e,"bold"),handleToggle:e=>Ke(e,"bold"),renderLeaf:e=>o.jsx(gx,{children:e})},italic:{icon:D.Italic,isValidEventKey:e=>e.key==="i",label:{id:"components.Blocks.modifiers.italic",defaultMessage:"Italic"},checkIsActive:e=>We(e,"italic"),handleToggle:e=>Ke(e,"italic"),renderLeaf:e=>o.jsx(mx,{children:e})},underline:{icon:D.Underline,isValidEventKey:e=>e.key==="u",label:{id:"components.Blocks.modifiers.underline",defaultMessage:"Underline"},checkIsActive:e=>We(e,"underline"),handleToggle:e=>Ke(e,"underline"),renderLeaf:e=>o.jsx(bx,{children:e})},strikethrough:{icon:D.StrikeThrough,isValidEventKey:e=>e.key==="S"&&e.shiftKey,label:{id:"components.Blocks.modifiers.strikethrough",defaultMessage:"Strikethrough"},checkIsActive:e=>We(e,"strikethrough"),handleToggle:e=>Ke(e,"strikethrough"),renderLeaf:e=>o.jsx(xx,{children:e})},code:{icon:D.Code,isValidEventKey:e=>e.key==="e",label:{id:"components.Blocks.modifiers.code",defaultMessage:"Inline code"},checkIsActive:e=>We(e,"code"),handleToggle:e=>Ke(e,"code"),renderLeaf:e=>o.jsx(yx,{children:e})}},wx=e=>{const t=e,{isInline:n,apply:r,insertText:s}=t;t.lastInsertedLinkPath=null,t.shouldSaveLinkPath=!0,t.isInline=i=>"type"in i&&i.type==="link"?!0:n(i),t.apply=i=>{i.type==="insert_node"&&"type"in i.node&&i.node.type==="link"&&t.shouldSaveLinkPath&&(t.lastInsertedLinkPath=i.path),r(i)},t.insertText=i=>{const{selection:l}=t;if(l&&d.Range.isCollapsed(l)){const{anchor:c}=l,u=d.Editor.above(t,{match:$=>"type"in $&&!d.Editor.isEditor($)&&$.type!=="link"}),h=u?u[1]:[],f=d.Editor.start(t,h),g={anchor:c,focus:f},m=d.Editor.string(t,g),w=m.trim(),x=/https?:\/\/\S+$/,y=w.match(x);if(y){const $=y[0],E=m.lastIndexOf($),S=E+$.length,R={anchor:{path:c.path,offset:E},focus:{path:c.path,offset:S}};d.Transforms.select(t,R),t.shouldSaveLinkPath=!0,An(t,{url:$});return}}s(i)};const{insertData:a}=t;return t.insertData=i=>{const l=i.getData("text/plain");if(l&&/^https?:\/\/\S+$/.test(l)){!t.selection||d.Range.isCollapsed(t.selection)?(t.shouldSaveLinkPath=!0,An(t,{url:l})):(t.shouldSaveLinkPath=!0,An(t,{url:l}));return}a(i)},t},Ks=sc.unified().use(dc.default).use(cc.default).use(lc.default),Q=(e,t={})=>({type:"text",text:e,...t}),gn=()=>Q(""),Rn=(e=[gn()])=>({type:"paragraph",children:at(e)}),Xi=(e,t)=>({type:"math",format:t,value:e,children:[gn()]}),at=e=>e.length>0?e:[gn()],cn=e=>e.trim().replace(/\s+/g," ").toLowerCase(),kx=e=>{const t=new Map,n=r=>{r.forEach(s=>{s.type==="definition"&&t.set(cn(s.identifier),s),"children"in s&&n(s.children)})};return n(e.children),t},Yi=e=>e.trim()!==""&&!/^\s|\s$/.test(e),Zi=e=>Yi(e)?e:`$${e}$`,jx={"c++":"cpp","c#":"csharp","obj-c":"objectivec","objective-c":"objectivec",sh:"shell","shell-session":"shell",console:"shell",zsh:"shell",bat:"powershell",cmd:"powershell",ps1:"powershell",docker:"dockerfile",golang:"go",htm:"html",js:"javascript",kt:"kotlin",md:"markdown",mdx:"markdown",objc:"objectivec",py:"python",rb:"ruby",rs:"rust",text:"plaintext",txt:"plaintext",ts:"typescript",tex:"latex",vb:"vbnet",yml:"yaml"},$x=new Set(Ta.map(e=>e.value)),Ex=e=>{if(!e)return"plaintext";const t=e.trim().toLowerCase(),n=jx[t]??t;return $x.has(n)?n:"plaintext"},Gs=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)?e:/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?`mailto:${e}`:e,ke=(e=[],t,n={})=>e.flatMap(r=>Cx(r,t,n)),Cx=(e,t,n)=>{switch(e.type){case"text":return[Q(e.value,n)];case"break":return[Q(`
1909
- `,n)];case"emphasis":return ke(e.children,t,{...n,italic:!0});case"strong":return ke(e.children,t,{...n,bold:!0});case"delete":return ke(e.children,t,{...n,strikethrough:!0});case"inlineCode":return[Q(e.value,{...n,code:!0})];case"inlineMath":{const r=e.value;return Yi(r)?[Xi(r,"inline")]:[Q(Zi(r),n)]}case"link":{const r=e;return[{type:"link",url:Gs(r.url),children:at(ke(r.children,t,n))}]}case"linkReference":{const r=e,s=t.get(cn(r.identifier)),a=at(ke(r.children,t,n));return s?[{type:"link",url:Gs(s.url),children:a}]:a}case"image":{const r=e,s=r.alt||r.url;return[{type:"link",url:r.url,children:[Q(s,n)]}]}case"imageReference":{const r=e,s=t.get(cn(r.identifier)),a=r.alt||s?.title||s?.url||"";return s?[{type:"link",url:s.url,children:[Q(a,n)]}]:[Q(a,n)]}case"footnoteReference":return[Q(`[^${e.identifier}]`,n)];case"html":return[Q(e.value,n)];default:return[]}},Ji=(e=[],t)=>e.map(n=>{switch(n.type){case"text":case"inlineCode":case"html":return n.value;case"inlineMath":return Zi(n.value);case"break":return`
1910
- `;case"image":return n.alt||n.url;case"imageReference":{const r=n,s=t.get(cn(r.identifier));return r.alt||s?.url||""}case"footnoteReference":return`[^${n.identifier}]`;default:return"children"in n?Ji(n.children||[],t):""}}).join(""),mn=(e,t)=>{switch(e.type){case"paragraph":case"heading":return Ji(e.children,t);case"blockquote":return e.children.map(n=>mn(n,t)).join(`
1911
- `);case"code":case"math":case"html":return e.value;case"list":return Sx(e,t);case"footnoteDefinition":return el(e,t);case"definition":return Qi(e);case"thematicBreak":return"---";default:return""}},Sx=(e,t)=>e.children.flatMap((n,r)=>{const s=e.ordered?`${r+(e.start||1)}. `:"- ";return n.children.map(i=>mn(i,t)).map((i,l)=>l===0?`${s}${i}`:` ${i}`)}).join(`
1912
- `),Qi=e=>`[${e.identifier}]: ${e.url}`,el=(e,t)=>{const n=e.children.map(r=>mn(r,t)).join(`
1913
- `);return`[^${e.identifier}]: ${n}`},tl=e=>e.flatMap((t,n)=>n===0?t:[Q(`
1914
- `),...t]),Tx=(e,t)=>{const n=e.children.map(r=>r.type==="paragraph"?ke(r.children,t):[Q(mn(r,t))]);return{type:"quote",children:at(tl(n))}},nl=(e,t,n)=>{const r=e.children.some(i=>typeof i.checked=="boolean"),s=r?"todo":e.ordered?"ordered":"unordered",a=s==="ordered"&&typeof e.start=="number"&&e.start>1?e.start:void 0;return{type:"list",format:s,indentLevel:n,...a?{start:a}:{},children:e.children.flatMap(i=>Mx(i,t,n,r))}},Mx=(e,t,n,r)=>{const s=[],a=[];return e.children.forEach(l=>{if(l.type==="list"){a.push(nl(l,t,n+1));return}if(l.type==="paragraph"){s.push(ke(l.children,t));return}s.push([Q(mn(l,t))])}),[{type:"list-item",...r?{checked:e.checked===!0}:{},children:at(tl(s))},...a]},Ix=(e,t)=>{const n=e.children.filter(s=>!(s.type==="text"&&s.value.trim()===""));if(n.length!==1)return null;const r=n[0];if(r.type==="image")return{url:r.url,alt:r.alt||""};if(r.type==="imageReference"){const s=t.get(cn(r.identifier));return s?{url:s.url,alt:r.alt||""}:null}return null},Rx=e=>({type:"image",image:{url:e.url,alternativeText:e.alt},children:[gn()]}),Bx=e=>e==="left"||e==="center"||e==="right"?e:void 0,Fx=(e,t)=>({type:"table",children:e.children.map((n,r)=>({type:"table-row",children:n.children.map((s,a)=>{const i=Bx(e.align?.[a]??void 0);return{type:r===0?"table-header-cell":"table-cell",...i?{align:i}:{},children:at(ke(s.children,t))}})}))}),Dx=(e,t,n)=>{switch(e.type){case"paragraph":{const r=Ix(e,t);return r?[Rx(r)]:[Rn(ke(e.children,t))]}case"heading":return[{type:"heading",level:Math.min(Math.max(e.depth,1),6),children:at(ke(e.children,t))}];case"blockquote":return[Tx(e,t)];case"code":return[{type:"code",language:Ex(e.lang),children:[Q(e.value||"")]}];case"math":return[Xi(e.value,"block")];case"list":return[nl(e,t,0)];case"table":return[Fx(e,t)];case"thematicBreak":return[{type:"horizontal-line",children:[gn()]}];case"footnoteDefinition":return[Rn([Q(el(e,t))])];case"definition":return n?[Rn([Q(Qi(e))])]:[];case"html":return[Rn([Q(e.value)])];default:return[]}},Ax=e=>{if(!e||typeof e!="string")return null;try{const t=Ks.parse(e),n=Ks.runSync(t),r=kx(n),s=n.children.some(i=>i.type!=="definition"),a=n.children.flatMap(i=>Dx(i,r,!s));return a.length>0?a:null}catch(t){return console.error("[Better Blocks] Markdown parsing failed:",t),null}},_x=/^https?:\/\/\S+$/,rl=/(^#{1,6}\s)|(^\s{0,3}([-*+])\s)|(^\s{0,3}\d+[.)]\s)|(^\s{0,3}[-*+]\s+\[[ xX]\]\s)|(^\s{0,3}>\s)|(^\s{0,3}(```|~~~))|(^\s{0,3}(-{3,}|\*{3,}|_{3,})\s*$)|(^|\n)\s*\$\$[\s\S]+?\$\$\s*(?=\n|$)/m,Nx=/(^|[^\w\\])\$[^$\n]*[A-Za-z\\_^=+\-*/{}][^$\n]*\$(?!\d)|(\[[^\]]+\]\([^)]+\))|(!\[[^\]]*\]\([^)]+\))|(\*\*[^*\n]+\*\*)|(__[^_\n]+__)|(^|[^\w*])\*[^*\s][^*\n]*[^*\s]\*(?=$|[^\w*])|(^|[^\w_])_[^_\s][^_\n]*[^_\s]_(?=$|[^\w_])|(~~[^~\n]+~~)|(`[^`\n]+`)/m,ol=e=>{const t=e.split(/\r?\n/);return t.some((n,r)=>{const s=t[r+1];return!!(n.includes("|")&&s&&/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/.test(s))})},Px=e=>rl.test(e)||Nx.test(e)||ol(e),Lx=e=>rl.test(e)||ol(e),Ox=(e,t)=>{const n=e.trim();return!!n&&!_x.test(n)&&(t?Lx(e):Px(e))},zx=e=>e.selection?!!d.Editor.above(e,{match:n=>!d.Editor.isEditor(n)&&d.Element.isElement(n)&&["code","table-cell","table-header-cell"].includes(n.type)}):!1,Hx=(e,t)=>{const n=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&d.Element.isElement(a)&&d.Editor.isBlock(e,a)}),r=n?d.Editor.string(e,n[1])==="":!0,s=t.length===1&&t[0]?.type==="paragraph";if(r||s){d.Transforms.insertFragment(e,t);return}d.Transforms.insertNodes(e,t,{select:!0})},Ux=e=>{const t=e,{insertData:n}=t;return t.insertData=r=>{const s=r.getData("text/plain"),a=r.getData("text/html");if(Ox(s,a)&&!zx(t)){const i=Ax(s);if(i&&i.length>0){d.Editor.withoutNormalizing(e,()=>{Hx(t,i)});return}}n(r)},t},Wx=[["(c)","©"],["(r)","®"],["(tm)","™"],["(p)","§"],["1/2","½"],["1/3","⅓"],["2/3","⅔"],["1/4","¼"],["3/4","¾"],["1/8","⅛"],["--","—"],["->","→"],["<-","←"],["=>","⇒"],["<=>","⇔"],["...","…"],["!=","≠"],[">=","≥"],["<=","≤"],["+-","±"],["~=","≈"]],Kx=e=>{const{insertText:t}=e;return e.insertText=n=>{if(n===" "&&e.selection&&d.Range.isCollapsed(e.selection)){const{anchor:r}=e.selection,s=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&"type"in a&&a.type!=="text"});if(s){const[,a]=s,i=d.Editor.start(e,a),l={anchor:r,focus:i},c=d.Editor.string(e,l);if(c.trim()==="$$"){d.Transforms.select(e,{anchor:r,focus:i}),d.Transforms.delete(e),ho(e);return}if(c.trim()==="```mermaid"){d.Transforms.select(e,{anchor:r,focus:i}),d.Transforms.delete(e),uo(e);return}const u=c.match(/\$([^$\n]+)\$$/);if(u){const h=u[1],f={...r,offset:r.offset-u[0].length};d.Transforms.select(e,{anchor:f,focus:r}),d.Transforms.delete(e),Xa(e,h),t(" ");return}for(const[h,f]of Wx)if(c.endsWith(h)){const g={...r,offset:r.offset-h.length};d.Transforms.select(e,{anchor:g,focus:r}),d.Transforms.insertText(e,f),t(" ");return}}}t(n)},e},Gx=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&!d.Element.isElement(e),Vx=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(!d.Element.isElement(r)&&Gx(r)&&!("type"in r)){d.Transforms.setNodes(e,{type:"text"},{at:s});return}t(n)},e},qx=b.styled(p.Flex)`
1908
+ `,We=(e,t)=>{const n=d.Editor.marks(e);return n?!!n[t]:!1},Ke=(e,t)=>{const n=d.Editor.marks(e);if(!e.selection){const r=d.Editor.end(e,[]);d.Transforms.select(e,r)}n?.[t]?d.Editor.removeMark(e,t):d.Editor.addMark(e,t,!0)},Ty={uppercase:{icon:kf,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.uppercase",defaultMessage:"Uppercase"},checkIsActive:e=>We(e,"uppercase"),handleToggle:e=>Ke(e,"uppercase"),renderLeaf:e=>o.jsx(vy,{children:e})},superscript:{icon:jf,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.superscript",defaultMessage:"Superscript"},checkIsActive:e=>We(e,"superscript"),handleToggle:e=>Ke(e,"superscript"),renderLeaf:e=>o.jsx(wy,{children:e})},subscript:{icon:Mf,isValidEventKey:e=>e.key==="A",label:{id:"components.Blocks.modifiers.subscript",defaultMessage:"Subscript"},checkIsActive:e=>We(e,"subscript"),handleToggle:e=>Ke(e,"subscript"),renderLeaf:e=>o.jsx(ky,{children:e})},bold:{icon:D.Bold,isValidEventKey:e=>e.key==="b",label:{id:"components.Blocks.modifiers.bold",defaultMessage:"Bold"},checkIsActive:e=>We(e,"bold"),handleToggle:e=>Ke(e,"bold"),renderLeaf:e=>o.jsx(jy,{children:e})},italic:{icon:D.Italic,isValidEventKey:e=>e.key==="i",label:{id:"components.Blocks.modifiers.italic",defaultMessage:"Italic"},checkIsActive:e=>We(e,"italic"),handleToggle:e=>Ke(e,"italic"),renderLeaf:e=>o.jsx($y,{children:e})},underline:{icon:D.Underline,isValidEventKey:e=>e.key==="u",label:{id:"components.Blocks.modifiers.underline",defaultMessage:"Underline"},checkIsActive:e=>We(e,"underline"),handleToggle:e=>Ke(e,"underline"),renderLeaf:e=>o.jsx(Ey,{children:e})},strikethrough:{icon:D.StrikeThrough,isValidEventKey:e=>e.key==="S"&&e.shiftKey,label:{id:"components.Blocks.modifiers.strikethrough",defaultMessage:"Strikethrough"},checkIsActive:e=>We(e,"strikethrough"),handleToggle:e=>Ke(e,"strikethrough"),renderLeaf:e=>o.jsx(Cy,{children:e})},code:{icon:D.Code,isValidEventKey:e=>e.key==="e",label:{id:"components.Blocks.modifiers.code",defaultMessage:"Inline code"},checkIsActive:e=>We(e,"code"),handleToggle:e=>Ke(e,"code"),renderLeaf:e=>o.jsx(Sy,{children:e})}},My=e=>{const t=e,{isInline:n,apply:r,insertText:s}=t;t.lastInsertedLinkPath=null,t.shouldSaveLinkPath=!0,t.isInline=i=>"type"in i&&i.type==="link"?!0:n(i),t.apply=i=>{i.type==="insert_node"&&"type"in i.node&&i.node.type==="link"&&t.shouldSaveLinkPath&&(t.lastInsertedLinkPath=i.path),r(i)},t.insertText=i=>{const{selection:l}=t;if(l&&d.Range.isCollapsed(l)){const{anchor:c}=l,u=d.Editor.above(t,{match:$=>"type"in $&&!d.Editor.isEditor($)&&$.type!=="link"}),h=u?u[1]:[],f=d.Editor.start(t,h),g={anchor:c,focus:f},m=d.Editor.string(t,g),x=m.trim(),y=/https?:\/\/\S+$/,v=x.match(y);if(v){const $=v[0],E=m.lastIndexOf($),C=E+$.length,I={anchor:{path:c.path,offset:E},focus:{path:c.path,offset:C}};d.Transforms.select(t,I),t.shouldSaveLinkPath=!0,_n(t,{url:$});return}}s(i)};const{insertData:a}=t;return t.insertData=i=>{const l=i.getData("text/plain");if(l&&/^https?:\/\/\S+$/.test(l)){!t.selection||d.Range.isCollapsed(t.selection)?(t.shouldSaveLinkPath=!0,_n(t,{url:l})):(t.shouldSaveLinkPath=!0,_n(t,{url:l}));return}a(i)},t},Vs=cc.unified().use(fc.default).use(hc.default).use(pc.default),Q=(e,t={})=>({type:"text",text:e,...t}),mn=()=>Q(""),Rn=(e=[mn()])=>({type:"paragraph",children:at(e)}),Ji=(e,t)=>({type:"math",format:t,value:e,children:[mn()]}),at=e=>e.length>0?e:[mn()],dn=e=>e.trim().replace(/\s+/g," ").toLowerCase(),By=e=>{const t=new Map,n=r=>{r.forEach(s=>{s.type==="definition"&&t.set(dn(s.identifier),s),"children"in s&&n(s.children)})};return n(e.children),t},Qi=e=>e.trim()!==""&&!/^\s|\s$/.test(e),el=e=>Qi(e)?e:`$${e}$`,Iy={"c++":"cpp","c#":"csharp","obj-c":"objectivec","objective-c":"objectivec",sh:"shell","shell-session":"shell",console:"shell",zsh:"shell",bat:"powershell",cmd:"powershell",ps1:"powershell",docker:"dockerfile",golang:"go",htm:"html",js:"javascript",kt:"kotlin",md:"markdown",mdx:"markdown",objc:"objectivec",py:"python",rb:"ruby",rs:"rust",text:"plaintext",txt:"plaintext",ts:"typescript",tex:"latex",vb:"vbnet",yml:"yaml"},Ry=new Set(Ba.map(e=>e.value)),Fy=e=>{if(!e)return"plaintext";const t=e.trim().toLowerCase(),n=Iy[t]??t;return Ry.has(n)?n:"plaintext"},qs=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)?e:/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?`mailto:${e}`:e,ke=(e=[],t,n={})=>e.flatMap(r=>Dy(r,t,n)),Dy=(e,t,n)=>{switch(e.type){case"text":return[Q(e.value,n)];case"break":return[Q(`
1909
+ `,n)];case"emphasis":return ke(e.children,t,{...n,italic:!0});case"strong":return ke(e.children,t,{...n,bold:!0});case"delete":return ke(e.children,t,{...n,strikethrough:!0});case"inlineCode":return[Q(e.value,{...n,code:!0})];case"inlineMath":{const r=e.value;return Qi(r)?[Ji(r,"inline")]:[Q(el(r),n)]}case"link":{const r=e;return[{type:"link",url:qs(r.url),children:at(ke(r.children,t,n))}]}case"linkReference":{const r=e,s=t.get(dn(r.identifier)),a=at(ke(r.children,t,n));return s?[{type:"link",url:qs(s.url),children:a}]:a}case"image":{const r=e,s=r.alt||r.url;return[{type:"link",url:r.url,children:[Q(s,n)]}]}case"imageReference":{const r=e,s=t.get(dn(r.identifier)),a=r.alt||s?.title||s?.url||"";return s?[{type:"link",url:s.url,children:[Q(a,n)]}]:[Q(a,n)]}case"footnoteReference":return[Q(`[^${e.identifier}]`,n)];case"html":return[Q(e.value,n)];default:return[]}},tl=(e=[],t)=>e.map(n=>{switch(n.type){case"text":case"inlineCode":case"html":return n.value;case"inlineMath":return el(n.value);case"break":return`
1910
+ `;case"image":return n.alt||n.url;case"imageReference":{const r=n,s=t.get(dn(r.identifier));return r.alt||s?.url||""}case"footnoteReference":return`[^${n.identifier}]`;default:return"children"in n?tl(n.children||[],t):""}}).join(""),bn=(e,t)=>{switch(e.type){case"paragraph":case"heading":return tl(e.children,t);case"blockquote":return e.children.map(n=>bn(n,t)).join(`
1911
+ `);case"code":case"math":case"html":return e.value;case"list":return Ay(e,t);case"footnoteDefinition":return rl(e,t);case"definition":return nl(e);case"thematicBreak":return"---";default:return""}},Ay=(e,t)=>e.children.flatMap((n,r)=>{const s=e.ordered?`${r+(e.start||1)}. `:"- ";return n.children.map(i=>bn(i,t)).map((i,l)=>l===0?`${s}${i}`:` ${i}`)}).join(`
1912
+ `),nl=e=>`[${e.identifier}]: ${e.url}`,rl=(e,t)=>{const n=e.children.map(r=>bn(r,t)).join(`
1913
+ `);return`[^${e.identifier}]: ${n}`},ol=e=>e.flatMap((t,n)=>n===0?t:[Q(`
1914
+ `),...t]),_y=(e,t)=>{const n=e.children.map(r=>r.type==="paragraph"?ke(r.children,t):[Q(bn(r,t))]);return{type:"quote",children:at(ol(n))}},sl=(e,t,n)=>{const r=e.children.some(i=>typeof i.checked=="boolean"),s=r?"todo":e.ordered?"ordered":"unordered",a=s==="ordered"&&typeof e.start=="number"&&e.start>1?e.start:void 0;return{type:"list",format:s,indentLevel:n,...a?{start:a}:{},children:e.children.flatMap(i=>Ny(i,t,n,r))}},Ny=(e,t,n,r)=>{const s=[],a=[];return e.children.forEach(l=>{if(l.type==="list"){a.push(sl(l,t,n+1));return}if(l.type==="paragraph"){s.push(ke(l.children,t));return}s.push([Q(bn(l,t))])}),[{type:"list-item",...r?{checked:e.checked===!0}:{},children:at(ol(s))},...a]},Py=(e,t)=>{const n=e.children.filter(s=>!(s.type==="text"&&s.value.trim()===""));if(n.length!==1)return null;const r=n[0];if(r.type==="image")return{url:r.url,alt:r.alt||""};if(r.type==="imageReference"){const s=t.get(dn(r.identifier));return s?{url:s.url,alt:r.alt||""}:null}return null},Ly=e=>({type:"image",image:{url:e.url,alternativeText:e.alt},children:[mn()]}),Oy=e=>e==="left"||e==="center"||e==="right"?e:void 0,zy=(e,t)=>({type:"table",children:e.children.map((n,r)=>({type:"table-row",children:n.children.map((s,a)=>{const i=Oy(e.align?.[a]??void 0);return{type:r===0?"table-header-cell":"table-cell",...i?{align:i}:{},children:at(ke(s.children,t))}})}))}),Hy=(e,t,n)=>{switch(e.type){case"paragraph":{const r=Py(e,t);return r?[Ly(r)]:[Rn(ke(e.children,t))]}case"heading":return[{type:"heading",level:Math.min(Math.max(e.depth,1),6),children:at(ke(e.children,t))}];case"blockquote":return[_y(e,t)];case"code":return[{type:"code",language:Fy(e.lang),children:[Q(e.value||"")]}];case"math":return[Ji(e.value,"block")];case"list":return[sl(e,t,0)];case"table":return[zy(e,t)];case"thematicBreak":return[{type:"horizontal-line",children:[mn()]}];case"footnoteDefinition":return[Rn([Q(rl(e,t))])];case"definition":return n?[Rn([Q(nl(e))])]:[];case"html":return[Rn([Q(e.value)])];default:return[]}},Uy=e=>{if(!e||typeof e!="string")return null;try{const t=Vs.parse(e),n=Vs.runSync(t),r=By(n),s=n.children.some(i=>i.type!=="definition"),a=n.children.flatMap(i=>Hy(i,r,!s));return a.length>0?a:null}catch(t){return console.error("[Better Blocks] Markdown parsing failed:",t),null}},Wy=/^https?:\/\/\S+$/,al=/(^#{1,6}\s)|(^\s{0,3}([-*+])\s)|(^\s{0,3}\d+[.)]\s)|(^\s{0,3}[-*+]\s+\[[ xX]\]\s)|(^\s{0,3}>\s)|(^\s{0,3}(```|~~~))|(^\s{0,3}(-{3,}|\*{3,}|_{3,})\s*$)|(^|\n)\s*\$\$[\s\S]+?\$\$\s*(?=\n|$)/m,Ky=/(^|[^\w\\])\$[^$\n]*[A-Za-z\\_^=+\-*/{}][^$\n]*\$(?!\d)|(\[[^\]]+\]\([^)]+\))|(!\[[^\]]*\]\([^)]+\))|(\*\*[^*\n]+\*\*)|(__[^_\n]+__)|(^|[^\w*])\*[^*\s][^*\n]*[^*\s]\*(?=$|[^\w*])|(^|[^\w_])_[^_\s][^_\n]*[^_\s]_(?=$|[^\w_])|(~~[^~\n]+~~)|(`[^`\n]+`)/m,il=e=>{const t=e.split(/\r?\n/);return t.some((n,r)=>{const s=t[r+1];return!!(n.includes("|")&&s&&/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/.test(s))})},Gy=e=>al.test(e)||Ky.test(e)||il(e),Vy=e=>al.test(e)||il(e),qy=(e,t)=>{const n=e.trim();return!!n&&!Wy.test(n)&&(t?Vy(e):Gy(e))},Xy=e=>e.selection?!!d.Editor.above(e,{match:n=>!d.Editor.isEditor(n)&&d.Element.isElement(n)&&["code","table-cell","table-header-cell"].includes(n.type)}):!1,Yy=(e,t)=>{const n=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&d.Element.isElement(a)&&d.Editor.isBlock(e,a)}),r=n?d.Editor.string(e,n[1])==="":!0,s=t.length===1&&t[0]?.type==="paragraph";if(r||s){d.Transforms.insertFragment(e,t);return}d.Transforms.insertNodes(e,t,{select:!0})},Zy=e=>{const t=e,{insertData:n}=t;return t.insertData=r=>{const s=r.getData("text/plain"),a=r.getData("text/html");if(qy(s,a)&&!Xy(t)){const i=Uy(s);if(i&&i.length>0){d.Editor.withoutNormalizing(e,()=>{Yy(t,i)});return}}n(r)},t},Jy=[["(c)","©"],["(r)","®"],["(tm)","™"],["(p)","§"],["1/2","½"],["1/3","⅓"],["2/3","⅔"],["1/4","¼"],["3/4","¾"],["1/8","⅛"],["--","—"],["->","→"],["<-","←"],["=>","⇒"],["<=>","⇔"],["...","…"],["!=","≠"],[">=","≥"],["<=","≤"],["+-","±"],["~=","≈"]],Qy=e=>{const{insertText:t}=e;return e.insertText=n=>{if(n===" "&&e.selection&&d.Range.isCollapsed(e.selection)){const{anchor:r}=e.selection,s=d.Editor.above(e,{match:a=>!d.Editor.isEditor(a)&&"type"in a&&a.type!=="text"});if(s){const[,a]=s,i=d.Editor.start(e,a),l={anchor:r,focus:i},c=d.Editor.string(e,l);if(c.trim()==="$$"){d.Transforms.select(e,{anchor:r,focus:i}),d.Transforms.delete(e),go(e);return}if(c.trim()==="```mermaid"){d.Transforms.select(e,{anchor:r,focus:i}),d.Transforms.delete(e),ho(e);return}const u=c.match(/\$([^$\n]+)\$$/);if(u){const h=u[1],f={...r,offset:r.offset-u[0].length};d.Transforms.select(e,{anchor:f,focus:r}),d.Transforms.delete(e),Za(e,h),t(" ");return}for(const[h,f]of Jy)if(c.endsWith(h)){const g={...r,offset:r.offset-h.length};d.Transforms.select(e,{anchor:g,focus:r}),d.Transforms.insertText(e,f),t(" ");return}}}t(n)},e},ex=e=>d.Node.isNode(e)&&!d.Editor.isEditor(e)&&!d.Element.isElement(e),tx=e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r,s]=n;if(!d.Element.isElement(r)&&ex(r)&&!("type"in r)){d.Transforms.setNodes(e,{type:"text"},{at:s});return}t(n)},e},nx=b.styled(p.Flex)`
1915
1915
  border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
1916
1916
  background: ${({theme:e})=>e.colors.neutral100};
1917
1917
  flex-shrink: 0;
1918
- `,Xx=e=>Array.from(d.Node.texts(e)).map(([t])=>t.text).join(" "),Yx=()=>{const e=B.useSlate(),{formatMessage:t}=O.useIntl(),r=Xx(e).trim(),s=r.length,a=r===""?0:r.split(/\s+/).length;return o.jsxs(qx,{padding:2,paddingLeft:4,paddingRight:4,justifyContent:"flex-end",gap:4,width:"100%",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:t({id:"components.Blocks.wordCount",defaultMessage:"{count} {count, plural, one {word} other {words}}"},{count:a})}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:t({id:"components.Blocks.characterCount",defaultMessage:"{count} {count, plural, one {character} other {characters}}"},{count:s})})]})},Zx=["paragraph","heading-one","heading-two","heading-three","heading-four","heading-five","heading-six","list-ordered","list-unordered","list-todo","image","audio","video","embed","quote","code","math","diagram","callout","details","button","social-embed"],Vs=e=>typeof e=="string"&&Zx.includes(e),[Jx,Qx]=Xe.createContext("BlocksEditor");function P(e){const t=Qx(e,r=>r),n=B.useSlate();return{...t,editor:n}}const ey=b.styled(p.Divider)`
1918
+ `,rx=e=>Array.from(d.Node.texts(e)).map(([t])=>t.text).join(" "),ox=()=>{const e=R.useSlate(),{formatMessage:t}=O.useIntl(),r=rx(e).trim(),s=r.length,a=r===""?0:r.split(/\s+/).length;return o.jsxs(nx,{padding:2,paddingLeft:4,paddingRight:4,justifyContent:"flex-end",gap:4,width:"100%",children:[o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:t({id:"components.Blocks.wordCount",defaultMessage:"{count} {count, plural, one {word} other {words}}"},{count:a})}),o.jsx(p.Typography,{variant:"pi",textColor:"neutral600",children:t({id:"components.Blocks.characterCount",defaultMessage:"{count} {count, plural, one {character} other {characters}}"},{count:s})})]})},sx=["paragraph","heading-one","heading-two","heading-three","heading-four","heading-five","heading-six","list-ordered","list-unordered","list-todo","image","audio","video","embed","quote","code","math","diagram","callout","details","button","social-embed"],Xs=e=>typeof e=="string"&&sx.includes(e),[ax,ix]=Xe.createContext("BlocksEditor");function P(e){const t=ix(e,r=>r),n=R.useSlate();return{...t,editor:n}}const lx=b.styled(p.Divider)`
1919
1919
  background: ${({theme:e})=>e.colors.neutral200};
1920
- `;function ty(e){const t=k.useRef(0),n=k.useRef(0),[r,s]=k.useState(0);k.useEffect(()=>{n.current+=1,n.current!==t.current&&(s(i=>i+1),t.current=n.current)},[e]);const a=k.useCallback(()=>{t.current+=1},[]);return{key:r,incrementSlateUpdatesCount:a}}const ny=(...e)=>t=>e.reduce((n,r)=>r(n),t),ry=k.forwardRef(({disabled:e=!1,name:t,onChange:n,value:r,error:s,pluginOptions:a,...i},l)=>{const{formatMessage:c}=O.useIntl(),[u]=k.useState(()=>ny(ao.withHistory,Vx,B.withReact,wx,Ux,Zc,Td,ru,Nc,pg,Xp,Np,hf,Th,ap,tp,Tu,Uu,Kx)(d.createEditor()));u.pluginOptions=a;const[h,f]=k.useState(""),g=k.useId(),[m,w]=k.useState(!1),x=()=>{w(C=>!C)};k.useImperativeHandle(l,()=>({focus(){B.ReactEditor.focus(u)}}),[u]);const{key:y,incrementSlateUpdatesCount:$}=ty(r),E=k.useRef(null),S=k.useCallback(C=>{u.operations.some(j=>j.type!=="set_selection")&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{$(),n(t,C),E.current=null},300))},[u.operations,$,t,n]);k.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),k.useEffect(()=>{r&&JSON.stringify(u.children)!==JSON.stringify(r)&&d.Transforms.deselect(u)},[u,r]);const R=k.useMemo(()=>({...gf,..._c,...vu,...du,...Jc,...Md,...ou,...bf,...Tc,...ip,...np,...Mu,...Wu,...Lc,...hg,...Yp,...Pp,...ff,...Mh}),[]);return o.jsxs(o.Fragment,{children:[o.jsx(p.VisuallyHidden,{id:g,children:c({id:ot("components.Blocks.dnd.instruction"),defaultMessage:"To reorder blocks, press Command or Control along with Shift and the Up or Down arrow keys"})}),o.jsx(p.VisuallyHidden,{"aria-live":"assertive",children:h}),o.jsx(B.Slate,{editor:u,initialValue:r||[{type:"paragraph",children:[{type:"text",text:""}]}],onChange:S,children:o.jsx(Jx,{blocks:R,modifiers:vx,disabled:e,name:t,setLiveText:f,isExpandedMode:m,onToggleExpand:x,pluginOptions:a,children:o.jsxs(ax,{error:s,disabled:e,onCollapse:x,ariaDescriptionId:g,children:[o.jsx(Vb,{}),o.jsx(ey,{width:"100%"}),o.jsx(ox,{...i}),o.jsx(Yx,{}),o.jsx(ux,{})]})})},y)]})});let wt=null,Tr=null;const sl=k.forwardRef((e,t)=>{const n=()=>{try{if(e.value){const f=typeof e.value=="string"?JSON.parse(e.value):e.value;return Array.isArray(f)?f:[{type:"paragraph",children:[{text:""}]}]}}catch(f){console.error("Failed to parse value:",f)}return[{type:"paragraph",children:[{text:""}]}]},[r,s]=k.useState(n),{get:a}=Xe.useFetchClient(),[i,l]=k.useState(wt);k.useEffect(()=>{if(wt)return;Tr||(Tr=a("/better-blocks/config").then(g=>(wt=g.data??{},wt)).catch(()=>(wt={},wt)));let f=!0;return Tr.then(g=>{f&&l(g)}),()=>{f=!1}},[a]);const c=e.attribute.options,u={...c,detailsDefaultSummary:c?.detailsDefaultSummary||i?.details?.defaultSummary,detailsStyle:c?.detailsStyle||i?.details?.style,buttonDefaultBackgroundColor:c?.buttonDefaultBackgroundColor||i?.button?.defaultStyle?.backgroundColor,buttonDefaultTextColor:c?.buttonDefaultTextColor||i?.button?.defaultStyle?.textColor,buttonPresets:i?.button?.presets,socialEnabled:i?.social?.enabled,socialPlatforms:i?.social?.platforms,socialInstagramConfigured:i?.social?.instagramConfigured,socialFacebookConfigured:i?.social?.facebookConfigured},h=(f,g)=>{s(g),e.onChange({target:{name:f,type:"json",value:JSON.stringify(g)}})};return o.jsx(uc.Provider,{children:o.jsx(p.Field.Root,{id:e.name,name:e.name,required:e.required,error:e.error,hint:e?.hint,children:o.jsxs(p.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsx(p.Field.Label,{children:e.label}),o.jsx(ry,{ref:t,name:e.name,error:e.error,value:r,ariaLabelId:e.name,disabled:e.disabled,pluginOptions:u,onChange:(f,g)=>{typeof f=="string"?h(f,g):h(e.name,f.target.value)}}),o.jsx(p.Field.Hint,{}),o.jsx(p.Field.Error,{})]})})})});sl.displayName="BetterBlocksInput";var Yr;try{Yr=Map}catch{}var Zr;try{Zr=Set}catch{}function al(e,t,n){if(!e||typeof e!="object"||typeof e=="function")return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(Jr);if(Yr&&e instanceof Yr)return new Map(Array.from(e.entries()));if(Zr&&e instanceof Zr)return new Set(Array.from(e.values()));if(e instanceof Object){t.push(e);var r=Object.create(e);n.push(r);for(var s in e){var a=t.findIndex(function(i){return i===e[s]});r[s]=a>-1?n[a]:al(e[s],t,n)}return r}return e}function Jr(e){return al(e,[],[])}const oy=Object.prototype.toString,sy=Error.prototype.toString,ay=RegExp.prototype.toString,iy=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",ly=/^Symbol\((.*)\)(.*)$/;function cy(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function qs(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return cy(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return iy.call(e).replace(ly,"Symbol($1)");const r=oy.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+sy.call(e)+"]":r==="RegExp"?ay.call(e):null}function dn(e,t){let n=qs(e,t);return n!==null?n:JSON.stringify(e,function(r,s){let a=qs(this[r],t);return a!==null?a:s},2)}let nt={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{let s=r!=null&&r!==n,a=`${e} must be a \`${t}\` type, but the final value was: \`${dn(n,!0)}\``+(s?` (cast from the value \`${dn(r,!0)}\`).`:".");return n===null&&(a+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),a},defined:"${path} must be defined"},ge={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},dy={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Qr={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},uy={isValue:"${path} field must be ${value}"},py={noUnknown:"${path} field has unspecified keys: ${unknown}"},hy={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};Object.assign(Object.create(null),{mixed:nt,string:ge,number:dy,date:Qr,object:py,array:hy,boolean:uy});var fy=Object.prototype,gy=fy.hasOwnProperty;function my(e,t){return e!=null&&gy.call(e,t)}var by=my,xy=Array.isArray,Ze=xy,yy=typeof In=="object"&&In&&In.Object===Object&&In,il=yy,vy=il,wy=typeof self=="object"&&self&&self.Object===Object&&self,ky=vy||wy||Function("return this")(),_e=ky,jy=_e,$y=jy.Symbol,nr=$y,Xs=nr,ll=Object.prototype,Ey=ll.hasOwnProperty,Cy=ll.toString,Xt=Xs?Xs.toStringTag:void 0;function Sy(e){var t=Ey.call(e,Xt),n=e[Xt];try{e[Xt]=void 0;var r=!0}catch{}var s=Cy.call(e);return r&&(t?e[Xt]=n:delete e[Xt]),s}var Ty=Sy,My=Object.prototype,Iy=My.toString;function Ry(e){return Iy.call(e)}var By=Ry,Ys=nr,Fy=Ty,Dy=By,Ay="[object Null]",_y="[object Undefined]",Zs=Ys?Ys.toStringTag:void 0;function Ny(e){return e==null?e===void 0?_y:Ay:Zs&&Zs in Object(e)?Fy(e):Dy(e)}var bn=Ny;function Py(e){return e!=null&&typeof e=="object"}var xn=Py,Ly=bn,Oy=xn,zy="[object Symbol]";function Hy(e){return typeof e=="symbol"||Oy(e)&&Ly(e)==zy}var Mo=Hy,Uy=Ze,Wy=Mo,Ky=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gy=/^\w*$/;function Vy(e,t){if(Uy(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Wy(e)?!0:Gy.test(e)||!Ky.test(e)||t!=null&&e in Object(t)}var Io=Vy;function qy(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ro=qy,Xy=bn,Yy=Ro,Zy="[object AsyncFunction]",Jy="[object Function]",Qy="[object GeneratorFunction]",ev="[object Proxy]";function tv(e){if(!Yy(e))return!1;var t=Xy(e);return t==Jy||t==Qy||t==Zy||t==ev}var cl=tv,nv=_e,rv=nv["__core-js_shared__"],ov=rv,Mr=ov,Js=function(){var e=/[^.]+$/.exec(Mr&&Mr.keys&&Mr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function sv(e){return!!Js&&Js in e}var av=sv,iv=Function.prototype,lv=iv.toString;function cv(e){if(e!=null){try{return lv.call(e)}catch{}try{return e+""}catch{}}return""}var dl=cv,dv=cl,uv=av,pv=Ro,hv=dl,fv=/[\\^$.*+?()[\]{}|]/g,gv=/^\[object .+?Constructor\]$/,mv=Function.prototype,bv=Object.prototype,xv=mv.toString,yv=bv.hasOwnProperty,vv=RegExp("^"+xv.call(yv).replace(fv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wv(e){if(!pv(e)||uv(e))return!1;var t=dv(e)?vv:gv;return t.test(hv(e))}var kv=wv;function jv(e,t){return e?.[t]}var $v=jv,Ev=kv,Cv=$v;function Sv(e,t){var n=Cv(e,t);return Ev(n)?n:void 0}var dt=Sv,Tv=dt,Mv=Tv(Object,"create"),rr=Mv,Qs=rr;function Iv(){this.__data__=Qs?Qs(null):{},this.size=0}var Rv=Iv;function Bv(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Fv=Bv,Dv=rr,Av="__lodash_hash_undefined__",_v=Object.prototype,Nv=_v.hasOwnProperty;function Pv(e){var t=this.__data__;if(Dv){var n=t[e];return n===Av?void 0:n}return Nv.call(t,e)?t[e]:void 0}var Lv=Pv,Ov=rr,zv=Object.prototype,Hv=zv.hasOwnProperty;function Uv(e){var t=this.__data__;return Ov?t[e]!==void 0:Hv.call(t,e)}var Wv=Uv,Kv=rr,Gv="__lodash_hash_undefined__";function Vv(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Kv&&t===void 0?Gv:t,this}var qv=Vv,Xv=Rv,Yv=Fv,Zv=Lv,Jv=Wv,Qv=qv;function Bt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bt.prototype.clear=Xv;Bt.prototype.delete=Yv;Bt.prototype.get=Zv;Bt.prototype.has=Jv;Bt.prototype.set=Qv;var e0=Bt;function t0(){this.__data__=[],this.size=0}var n0=t0;function r0(e,t){return e===t||e!==e&&t!==t}var ul=r0,o0=ul;function s0(e,t){for(var n=e.length;n--;)if(o0(e[n][0],t))return n;return-1}var or=s0,a0=or,i0=Array.prototype,l0=i0.splice;function c0(e){var t=this.__data__,n=a0(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():l0.call(t,n,1),--this.size,!0}var d0=c0,u0=or;function p0(e){var t=this.__data__,n=u0(t,e);return n<0?void 0:t[n][1]}var h0=p0,f0=or;function g0(e){return f0(this.__data__,e)>-1}var m0=g0,b0=or;function x0(e,t){var n=this.__data__,r=b0(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var y0=x0,v0=n0,w0=d0,k0=h0,j0=m0,$0=y0;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ft.prototype.clear=v0;Ft.prototype.delete=w0;Ft.prototype.get=k0;Ft.prototype.has=j0;Ft.prototype.set=$0;var sr=Ft,E0=dt,C0=_e,S0=E0(C0,"Map"),Bo=S0,ea=e0,T0=sr,M0=Bo;function I0(){this.size=0,this.__data__={hash:new ea,map:new(M0||T0),string:new ea}}var R0=I0;function B0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var F0=B0,D0=F0;function A0(e,t){var n=e.__data__;return D0(t)?n[typeof t=="string"?"string":"hash"]:n.map}var ar=A0,_0=ar;function N0(e){var t=_0(this,e).delete(e);return this.size-=t?1:0,t}var P0=N0,L0=ar;function O0(e){return L0(this,e).get(e)}var z0=O0,H0=ar;function U0(e){return H0(this,e).has(e)}var W0=U0,K0=ar;function G0(e,t){var n=K0(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var V0=G0,q0=R0,X0=P0,Y0=z0,Z0=W0,J0=V0;function Dt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Dt.prototype.clear=q0;Dt.prototype.delete=X0;Dt.prototype.get=Y0;Dt.prototype.has=Z0;Dt.prototype.set=J0;var Fo=Dt,pl=Fo,Q0="Expected a function";function Do(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Q0);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=n.cache;if(a.has(s))return a.get(s);var i=e.apply(this,r);return n.cache=a.set(s,i)||a,i};return n.cache=new(Do.Cache||pl),n}Do.Cache=pl;var ew=Do,tw=ew,nw=500;function rw(e){var t=tw(e,function(r){return n.size===nw&&n.clear(),r}),n=t.cache;return t}var ow=rw,sw=ow,aw=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iw=/\\(\\)?/g,lw=sw(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(aw,function(n,r,s,a){t.push(s?a.replace(iw,"$1"):r||n)}),t}),cw=lw;function dw(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var uw=dw,ta=nr,pw=uw,hw=Ze,fw=Mo,na=ta?ta.prototype:void 0,ra=na?na.toString:void 0;function hl(e){if(typeof e=="string")return e;if(hw(e))return pw(e,hl)+"";if(fw(e))return ra?ra.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var gw=hl,mw=gw;function bw(e){return e==null?"":mw(e)}var xw=bw,yw=Ze,vw=Io,ww=cw,kw=xw;function jw(e,t){return yw(e)?e:vw(e,t)?[e]:ww(kw(e))}var fl=jw,$w=bn,Ew=xn,Cw="[object Arguments]";function Sw(e){return Ew(e)&&$w(e)==Cw}var Tw=Sw,oa=Tw,Mw=xn,gl=Object.prototype,Iw=gl.hasOwnProperty,Rw=gl.propertyIsEnumerable,Bw=oa(function(){return arguments}())?oa:function(e){return Mw(e)&&Iw.call(e,"callee")&&!Rw.call(e,"callee")},ml=Bw,Fw=9007199254740991,Dw=/^(?:0|[1-9]\d*)$/;function Aw(e,t){var n=typeof e;return t=t??Fw,!!t&&(n=="number"||n!="symbol"&&Dw.test(e))&&e>-1&&e%1==0&&e<t}var bl=Aw,_w=9007199254740991;function Nw(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=_w}var Ao=Nw,Pw=Mo;function Lw(e){if(typeof e=="string"||Pw(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var ir=Lw,Ow=fl,zw=ml,Hw=Ze,Uw=bl,Ww=Ao,Kw=ir;function Gw(e,t,n){t=Ow(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var i=Kw(t[r]);if(!(a=e!=null&&n(e,i)))break;e=e[i]}return a||++r!=s?a:(s=e==null?0:e.length,!!s&&Ww(s)&&Uw(i,s)&&(Hw(e)||zw(e)))}var xl=Gw,Vw=by,qw=xl;function Xw(e,t){return e!=null&&qw(e,t,Vw)}var Yw=Xw;const Zw=Oi(Yw),Jw=e=>e&&e.__isYupSchema__;class Qw{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!Zw(n,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:a}=n,i=typeof r=="function"?r:(...l)=>l.every(c=>c===r);this.fn=function(...l){let c=l.pop(),u=l.pop(),h=i(...l)?s:a;if(h)return typeof h=="function"?h(u):u.concat(h.resolve(c))}}resolve(t,n){let r=this.refs.map(a=>a.getValue(n?.value,n?.parent,n?.context)),s=this.fn.apply(t,r.concat(t,n));if(s===void 0||s===t)return t;if(!Jw(s))throw new TypeError("conditions must return a schema object");return s.resolve(n)}}function yl(e){return e==null?[]:[].concat(e)}function eo(){return eo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},eo.apply(this,arguments)}let ek=/\$\{\s*(\w+)\s*\}/g;class pe extends Error{static formatError(t,n){const r=n.label||n.path||"this";return r!==n.path&&(n=eo({},n,{path:r})),typeof t=="string"?t.replace(ek,(s,a)=>dn(n[a])):typeof t=="function"?t(n):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,n,r,s){super(),this.name="ValidationError",this.value=n,this.path=r,this.type=s,this.errors=[],this.inner=[],yl(t).forEach(a=>{pe.isError(a)?(this.errors.push(...a.errors),this.inner=this.inner.concat(a.inner.length?a.inner:a)):this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,pe)}}const tk=e=>{let t=!1;return(...n)=>{t||(t=!0,e(...n))}};function sa(e,t){let{endEarly:n,tests:r,args:s,value:a,errors:i,sort:l,path:c}=e,u=tk(t),h=r.length;const f=[];if(i=i||[],!h)return i.length?u(new pe(i,a,c)):u(null,a);for(let g=0;g<r.length;g++){const m=r[g];m(s,function(x){if(x){if(!pe.isError(x))return u(x,a);if(n)return x.value=a,u(x,a);f.push(x)}if(--h<=0){if(f.length&&(l&&f.sort(l),i.length&&f.push(...i),i=f),i.length){u(new pe(i,a,c),a);return}u(null,a)}})}}var nk=dt,rk=function(){try{var e=nk(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ok=rk,aa=ok;function sk(e,t,n){t=="__proto__"&&aa?aa(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var ak=sk;function ik(e){return function(t,n,r){for(var s=-1,a=Object(t),i=r(t),l=i.length;l--;){var c=i[e?l:++s];if(n(a[c],c,a)===!1)break}return t}}var lk=ik,ck=lk,dk=ck(),uk=dk;function pk(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var hk=pk,Un={exports:{}};function fk(){return!1}var gk=fk;Un.exports;(function(e,t){var n=_e,r=gk,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u})(Un,Un.exports);var vl=Un.exports,mk=bn,bk=Ao,xk=xn,yk="[object Arguments]",vk="[object Array]",wk="[object Boolean]",kk="[object Date]",jk="[object Error]",$k="[object Function]",Ek="[object Map]",Ck="[object Number]",Sk="[object Object]",Tk="[object RegExp]",Mk="[object Set]",Ik="[object String]",Rk="[object WeakMap]",Bk="[object ArrayBuffer]",Fk="[object DataView]",Dk="[object Float32Array]",Ak="[object Float64Array]",_k="[object Int8Array]",Nk="[object Int16Array]",Pk="[object Int32Array]",Lk="[object Uint8Array]",Ok="[object Uint8ClampedArray]",zk="[object Uint16Array]",Hk="[object Uint32Array]",K={};K[Dk]=K[Ak]=K[_k]=K[Nk]=K[Pk]=K[Lk]=K[Ok]=K[zk]=K[Hk]=!0;K[yk]=K[vk]=K[Bk]=K[wk]=K[Fk]=K[kk]=K[jk]=K[$k]=K[Ek]=K[Ck]=K[Sk]=K[Tk]=K[Mk]=K[Ik]=K[Rk]=!1;function Uk(e){return xk(e)&&bk(e.length)&&!!K[mk(e)]}var Wk=Uk;function Kk(e){return function(t){return e(t)}}var Gk=Kk,Wn={exports:{}};Wn.exports;(function(e,t){var n=il,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,a=s&&s.exports===r,i=a&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||i&&i.binding&&i.binding("util")}catch{}}();e.exports=l})(Wn,Wn.exports);var Vk=Wn.exports,qk=Wk,Xk=Gk,ia=Vk,la=ia&&ia.isTypedArray,Yk=la?Xk(la):qk,wl=Yk,Zk=hk,Jk=ml,Qk=Ze,ej=vl,tj=bl,nj=wl,rj=Object.prototype,oj=rj.hasOwnProperty;function sj(e,t){var n=Qk(e),r=!n&&Jk(e),s=!n&&!r&&ej(e),a=!n&&!r&&!s&&nj(e),i=n||r||s||a,l=i?Zk(e.length,String):[],c=l.length;for(var u in e)(t||oj.call(e,u))&&!(i&&(u=="length"||s&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||tj(u,c)))&&l.push(u);return l}var aj=sj,ij=Object.prototype;function lj(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ij;return e===n}var cj=lj;function dj(e,t){return function(n){return e(t(n))}}var uj=dj,pj=uj,hj=pj(Object.keys,Object),fj=hj,gj=cj,mj=fj,bj=Object.prototype,xj=bj.hasOwnProperty;function yj(e){if(!gj(e))return mj(e);var t=[];for(var n in Object(e))xj.call(e,n)&&n!="constructor"&&t.push(n);return t}var vj=yj,wj=cl,kj=Ao;function jj(e){return e!=null&&kj(e.length)&&!wj(e)}var $j=jj,Ej=aj,Cj=vj,Sj=$j;function Tj(e){return Sj(e)?Ej(e):Cj(e)}var _o=Tj,Mj=uk,Ij=_o;function Rj(e,t){return e&&Mj(e,t,Ij)}var Bj=Rj,Fj=sr;function Dj(){this.__data__=new Fj,this.size=0}var Aj=Dj;function _j(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var Nj=_j;function Pj(e){return this.__data__.get(e)}var Lj=Pj;function Oj(e){return this.__data__.has(e)}var zj=Oj,Hj=sr,Uj=Bo,Wj=Fo,Kj=200;function Gj(e,t){var n=this.__data__;if(n instanceof Hj){var r=n.__data__;if(!Uj||r.length<Kj-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wj(r)}return n.set(e,t),this.size=n.size,this}var Vj=Gj,qj=sr,Xj=Aj,Yj=Nj,Zj=Lj,Jj=zj,Qj=Vj;function At(e){var t=this.__data__=new qj(e);this.size=t.size}At.prototype.clear=Xj;At.prototype.delete=Yj;At.prototype.get=Zj;At.prototype.has=Jj;At.prototype.set=Qj;var kl=At,e$="__lodash_hash_undefined__";function t$(e){return this.__data__.set(e,e$),this}var n$=t$;function r$(e){return this.__data__.has(e)}var o$=r$,s$=Fo,a$=n$,i$=o$;function Kn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new s$;++t<n;)this.add(e[t])}Kn.prototype.add=Kn.prototype.push=a$;Kn.prototype.has=i$;var l$=Kn;function c$(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var d$=c$;function u$(e,t){return e.has(t)}var p$=u$,h$=l$,f$=d$,g$=p$,m$=1,b$=2;function x$(e,t,n,r,s,a){var i=n&m$,l=e.length,c=t.length;if(l!=c&&!(i&&c>l))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,g=!0,m=n&b$?new h$:void 0;for(a.set(e,t),a.set(t,e);++f<l;){var w=e[f],x=t[f];if(r)var y=i?r(x,w,f,t,e,a):r(w,x,f,e,t,a);if(y!==void 0){if(y)continue;g=!1;break}if(m){if(!f$(t,function($,E){if(!g$(m,E)&&(w===$||s(w,$,n,r,a)))return m.push(E)})){g=!1;break}}else if(!(w===x||s(w,x,n,r,a))){g=!1;break}}return a.delete(e),a.delete(t),g}var jl=x$,y$=_e,v$=y$.Uint8Array,w$=v$;function k$(e){var t=-1,n=Array(e.size);return e.forEach(function(r,s){n[++t]=[s,r]}),n}var j$=k$;function $$(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var E$=$$,ca=nr,da=w$,C$=ul,S$=jl,T$=j$,M$=E$,I$=1,R$=2,B$="[object Boolean]",F$="[object Date]",D$="[object Error]",A$="[object Map]",_$="[object Number]",N$="[object RegExp]",P$="[object Set]",L$="[object String]",O$="[object Symbol]",z$="[object ArrayBuffer]",H$="[object DataView]",ua=ca?ca.prototype:void 0,Ir=ua?ua.valueOf:void 0;function U$(e,t,n,r,s,a,i){switch(n){case H$:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case z$:return!(e.byteLength!=t.byteLength||!a(new da(e),new da(t)));case B$:case F$:case _$:return C$(+e,+t);case D$:return e.name==t.name&&e.message==t.message;case N$:case L$:return e==t+"";case A$:var l=T$;case P$:var c=r&I$;if(l||(l=M$),e.size!=t.size&&!c)return!1;var u=i.get(e);if(u)return u==t;r|=R$,i.set(e,t);var h=S$(l(e),l(t),r,s,a,i);return i.delete(e),h;case O$:if(Ir)return Ir.call(e)==Ir.call(t)}return!1}var W$=U$;function K$(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var G$=K$,V$=G$,q$=Ze;function X$(e,t,n){var r=t(e);return q$(e)?r:V$(r,n(e))}var Y$=X$;function Z$(e,t){for(var n=-1,r=e==null?0:e.length,s=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[s++]=i)}return a}var J$=Z$;function Q$(){return[]}var e1=Q$,t1=J$,n1=e1,r1=Object.prototype,o1=r1.propertyIsEnumerable,pa=Object.getOwnPropertySymbols,s1=pa?function(e){return e==null?[]:(e=Object(e),t1(pa(e),function(t){return o1.call(e,t)}))}:n1,a1=s1,i1=Y$,l1=a1,c1=_o;function d1(e){return i1(e,c1,l1)}var u1=d1,ha=u1,p1=1,h1=Object.prototype,f1=h1.hasOwnProperty;function g1(e,t,n,r,s,a){var i=n&p1,l=ha(e),c=l.length,u=ha(t),h=u.length;if(c!=h&&!i)return!1;for(var f=c;f--;){var g=l[f];if(!(i?g in t:f1.call(t,g)))return!1}var m=a.get(e),w=a.get(t);if(m&&w)return m==t&&w==e;var x=!0;a.set(e,t),a.set(t,e);for(var y=i;++f<c;){g=l[f];var $=e[g],E=t[g];if(r)var S=i?r(E,$,g,t,e,a):r($,E,g,e,t,a);if(!(S===void 0?$===E||s($,E,n,r,a):S)){x=!1;break}y||(y=g=="constructor")}if(x&&!y){var R=e.constructor,C=t.constructor;R!=C&&"constructor"in e&&"constructor"in t&&!(typeof R=="function"&&R instanceof R&&typeof C=="function"&&C instanceof C)&&(x=!1)}return a.delete(e),a.delete(t),x}var m1=g1,b1=dt,x1=_e,y1=b1(x1,"DataView"),v1=y1,w1=dt,k1=_e,j1=w1(k1,"Promise"),$1=j1,E1=dt,C1=_e,S1=E1(C1,"Set"),T1=S1,M1=dt,I1=_e,R1=M1(I1,"WeakMap"),B1=R1,to=v1,no=Bo,ro=$1,oo=T1,so=B1,$l=bn,_t=dl,fa="[object Map]",F1="[object Object]",ga="[object Promise]",ma="[object Set]",ba="[object WeakMap]",xa="[object DataView]",D1=_t(to),A1=_t(no),_1=_t(ro),N1=_t(oo),P1=_t(so),rt=$l;(to&&rt(new to(new ArrayBuffer(1)))!=xa||no&&rt(new no)!=fa||ro&&rt(ro.resolve())!=ga||oo&&rt(new oo)!=ma||so&&rt(new so)!=ba)&&(rt=function(e){var t=$l(e),n=t==F1?e.constructor:void 0,r=n?_t(n):"";if(r)switch(r){case D1:return xa;case A1:return fa;case _1:return ga;case N1:return ma;case P1:return ba}return t});var L1=rt,Rr=kl,O1=jl,z1=W$,H1=m1,ya=L1,va=Ze,wa=vl,U1=wl,W1=1,ka="[object Arguments]",ja="[object Array]",Bn="[object Object]",K1=Object.prototype,$a=K1.hasOwnProperty;function G1(e,t,n,r,s,a){var i=va(e),l=va(t),c=i?ja:ya(e),u=l?ja:ya(t);c=c==ka?Bn:c,u=u==ka?Bn:u;var h=c==Bn,f=u==Bn,g=c==u;if(g&&wa(e)){if(!wa(t))return!1;i=!0,h=!1}if(g&&!h)return a||(a=new Rr),i||U1(e)?O1(e,t,n,r,s,a):z1(e,t,c,n,r,s,a);if(!(n&W1)){var m=h&&$a.call(e,"__wrapped__"),w=f&&$a.call(t,"__wrapped__");if(m||w){var x=m?e.value():e,y=w?t.value():t;return a||(a=new Rr),s(x,y,n,r,a)}}return g?(a||(a=new Rr),H1(e,t,n,r,s,a)):!1}var V1=G1,q1=V1,Ea=xn;function El(e,t,n,r,s){return e===t?!0:e==null||t==null||!Ea(e)&&!Ea(t)?e!==e&&t!==t:q1(e,t,n,r,El,s)}var Cl=El,X1=kl,Y1=Cl,Z1=1,J1=2;function Q1(e,t,n,r){var s=n.length,a=s,i=!r;if(e==null)return!a;for(e=Object(e);s--;){var l=n[s];if(i&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<a;){l=n[s];var c=l[0],u=e[c],h=l[1];if(i&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new X1;if(r)var g=r(u,h,c,e,t,f);if(!(g===void 0?Y1(h,u,Z1|J1,r,f):g))return!1}}return!0}var eE=Q1,tE=Ro;function nE(e){return e===e&&!tE(e)}var Sl=nE,rE=Sl,oE=_o;function sE(e){for(var t=oE(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,rE(s)]}return t}var aE=sE;function iE(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Tl=iE,lE=eE,cE=aE,dE=Tl;function uE(e){var t=cE(e);return t.length==1&&t[0][2]?dE(t[0][0],t[0][1]):function(n){return n===e||lE(n,e,t)}}var pE=uE,hE=fl,fE=ir;function gE(e,t){t=hE(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[fE(t[n++])];return n&&n==r?e:void 0}var Ml=gE,mE=Ml;function bE(e,t,n){var r=e==null?void 0:mE(e,t);return r===void 0?n:r}var xE=bE;function yE(e,t){return e!=null&&t in Object(e)}var vE=yE,wE=vE,kE=xl;function jE(e,t){return e!=null&&kE(e,t,wE)}var $E=jE,EE=Cl,CE=xE,SE=$E,TE=Io,ME=Sl,IE=Tl,RE=ir,BE=1,FE=2;function DE(e,t){return TE(e)&&ME(t)?IE(RE(e),t):function(n){var r=CE(n,e);return r===void 0&&r===t?SE(n,e):EE(t,r,BE|FE)}}var AE=DE;function _E(e){return e}var NE=_E;function PE(e){return function(t){return t?.[e]}}var LE=PE,OE=Ml;function zE(e){return function(t){return OE(t,e)}}var HE=zE,UE=LE,WE=HE,KE=Io,GE=ir;function VE(e){return KE(e)?UE(GE(e)):WE(e)}var qE=VE,XE=pE,YE=AE,ZE=NE,JE=Ze,QE=qE;function eC(e){return typeof e=="function"?e:e==null?ZE:typeof e=="object"?JE(e)?YE(e[0],e[1]):XE(e):QE(e)}var tC=eC,nC=ak,rC=Bj,oC=tC;function sC(e,t){var n={};return t=oC(t),rC(e,function(r,s,a){nC(n,s,t(r,s,a))}),n}var aC=sC;const iC=Oi(aC);function Nt(e){this._maxSize=e,this.clear()}Nt.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Nt.prototype.get=function(e){return this._values[e]};Nt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var lC=/[^.^\]^[]+|(?=\[\]|\.\.)/g,cC=/^\d+$/,dC=/^\d/,uC=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,pC=/^\s*(['"]?)(.*?)(\1)\s*$/,No=512,Ca=new Nt(No);new Nt(No);var Sa=new Nt(No),Il={getter:function(e,t){var n=hC(e);return Sa.get(e)||Sa.set(e,function(s){for(var a=0,i=n.length;a<i;)if(s!=null||!t)s=s[n[a++]];else return;return s})},forEach:function(e,t,n){fC(Array.isArray(e)?e:Rl(e),t,n)}};function hC(e){return Ca.get(e)||Ca.set(e,Rl(e).map(function(t){return t.replace(pC,"$2")}))}function Rl(e){return e.match(lC)||[""]}function fC(e,t,n){var r=e.length,s,a,i,l;for(a=0;a<r;a++)s=e[a],s&&(bC(s)&&(s='"'+s+'"'),l=Bl(s),i=!l&&/^\d+$/.test(s),t.call(n,s,l,i,a,e))}function Bl(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function gC(e){return e.match(dC)&&!e.match(cC)}function mC(e){return uC.test(e)}function bC(e){return!Bl(e)&&(gC(e)||mC(e))}const Fn={context:"$",value:"."};class Ct{constructor(t,n={}){if(typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Fn.context,this.isValue=this.key[0]===Fn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Fn.context:this.isValue?Fn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Il.getter(this.path,!0),this.map=n.map}getValue(t,n,r){let s=this.isContext?r:this.isValue?t:n;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(t,n){return this.getValue(t,n?.parent,n?.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ct.prototype.__isYupRef=!0;function Gn(){return Gn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function xC(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,a;for(a=0;a<r.length;a++)s=r[a],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function Dn(e){function t(n,r){let{value:s,path:a="",label:i,options:l,originalValue:c,sync:u}=n,h=xC(n,["value","path","label","options","originalValue","sync"]);const{name:f,test:g,params:m,message:w}=e;let{parent:x,context:y}=l;function $(M){return Ct.isRef(M)?M.getValue(s,x,y):M}function E(M={}){const j=iC(Gn({value:s,originalValue:c,label:i,path:M.path||a},m,M.params),$),v=new pe(pe.formatError(M.message||w,j),s,j.path,M.type||f);return v.params=j,v}let S=Gn({path:a,parent:x,type:f,createError:E,resolve:$,options:l,originalValue:c},h);if(!u){try{Promise.resolve(g.call(S,s,S)).then(M=>{pe.isError(M)?r(M):M?r(null,M):r(E())})}catch(M){r(M)}return}let R;try{var C;if(R=g.call(S,s,S),typeof((C=R)==null?void 0:C.then)=="function")throw new Error(`Validation test of type: "${S.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(M){r(M);return}pe.isError(R)?r(R):R?r(null,R):r(E())}return t.OPTIONS=e,t}let yC=e=>e.substr(0,e.length-1).substr(1);function vC(e,t,n,r=n){let s,a,i;return t?(Il.forEach(t,(l,c,u)=>{let h=c?yC(l):l;if(e=e.resolve({context:r,parent:s,value:n}),e.innerType){let f=u?parseInt(h,10):0;if(n&&f>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);s=n,n=n&&n[f],e=e.innerType}if(!u){if(!e.fields||!e.fields[h])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e._type}")`);s=n,n=n&&n[h],e=e.fields[h]}a=h,i=c?"["+l+"]":"."+l}),{schema:e,parent:s,parentPath:a}):{parent:s,parentPath:t,schema:e}}class Vn{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const t=[];for(const n of this.list)t.push(n);for(const[,n]of this.refs)t.push(n.describe());return t}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(t){Ct.isRef(t)?this.refs.set(t.key,t):this.list.add(t)}delete(t){Ct.isRef(t)?this.refs.delete(t.key):this.list.delete(t)}has(t,n){if(this.list.has(t))return!0;let r,s=this.refs.values();for(;r=s.next(),!r.done;)if(n(r.value)===t)return!0;return!1}clone(){const t=new Vn;return t.list=new Set(this.list),t.refs=new Map(this.refs),t}merge(t,n){const r=this.clone();return t.list.forEach(s=>r.add(s)),t.refs.forEach(s=>r.add(s)),n.list.forEach(s=>r.delete(s)),n.refs.forEach(s=>r.delete(s)),r}}function de(){return de=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(this,arguments)}class $e{constructor(t){this.deps=[],this.conditions=[],this._whitelist=new Vn,this._blacklist=new Vn,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(nt.notType)}),this.type=t?.type||"mixed",this.spec=de({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},t?.spec)}get _type(){return this.type}_typeCheck(t){return!0}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeError=this._typeError,n._whitelistError=this._whitelistError,n._blacklistError=this._blacklistError,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.exclusiveTests=de({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Jr(de({},this.spec,t)),n}label(t){var n=this.clone();return n.spec.label=t,n}meta(...t){if(t.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},t[0]),n}withMutation(t){let n=this._mutate;this._mutate=!0;let r=t(this);return this._mutate=n,r}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let n=this,r=t.clone();const s=de({},n.spec,r.spec);return r.spec=s,r._typeError||(r._typeError=n._typeError),r._whitelistError||(r._whitelistError=n._whitelistError),r._blacklistError||(r._blacklistError=n._blacklistError),r._whitelist=n._whitelist.merge(t._whitelist,t._blacklist),r._blacklist=n._blacklist.merge(t._blacklist,t._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(a=>{t.tests.forEach(i=>{a.test(i.OPTIONS)})}),r}isType(t){return this.spec.nullable&&t===null?!0:this._typeCheck(t)}resolve(t){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((s,a)=>a.resolve(s,t),n),n=n.resolve(t)}return n}cast(t,n={}){let r=this.resolve(de({value:t},n)),s=r._cast(t,n);if(t!==void 0&&n.assert!==!1&&r.isType(s)!==!0){let a=dn(t),i=dn(s);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r._type}".
1920
+ `;function cx(e){const t=k.useRef(0),n=k.useRef(0),[r,s]=k.useState(0);k.useEffect(()=>{n.current+=1,n.current!==t.current&&(s(i=>i+1),t.current=n.current)},[e]);const a=k.useCallback(()=>{t.current+=1},[]);return{key:r,incrementSlateUpdatesCount:a}}const dx=(...e)=>t=>e.reduce((n,r)=>r(n),t),ux=k.forwardRef(({disabled:e=!1,name:t,onChange:n,value:r,error:s,pluginOptions:a,...i},l)=>{const{formatMessage:c}=O.useIntl(),[u]=k.useState(()=>dx(lo.withHistory,tx,R.withReact,My,Zy,td,Rd,iu,zc,mg,Qp,zp,bf,Rh,dp,sp,Ru,Vu,vg,Qy)(d.createEditor()));u.pluginOptions=a;const[h,f]=k.useState(""),g=k.useId(),[m,x]=k.useState(!1),y=()=>{x(T=>!T)};k.useImperativeHandle(l,()=>({focus(){R.ReactEditor.focus(u)}}),[u]);const{key:v,incrementSlateUpdatesCount:$}=cx(r),E=k.useRef(null),C=k.useCallback(T=>{u.operations.some(w=>w.type!=="set_selection")&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{$(),n(t,T),E.current=null},300))},[u.operations,$,t,n]);k.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),k.useEffect(()=>{r&&JSON.stringify(u.children)!==JSON.stringify(r)&&d.Transforms.deselect(u)},[u,r]);const I=k.useMemo(()=>Object.fromEntries(Ct().map(T=>{const j={renderElement:T.renderElement,matchNode:w=>w.type===T.type,snippets:T.snippets,dragHandleTopMargin:T.dragHandleTopMargin,...T.insert?{handleConvert:w=>{T.insert?.(w)}}:{}};return[T.type,ko(T)?{...j,isInBlocksSelector:!0,icon:T.icon,label:vi(T)}:{...j,isInBlocksSelector:!1}]})),[]),S=k.useMemo(()=>({...xf,...Oc,...$u,...fu,...nd,...Fd,...lu,...wf,...Rc,...up,...ap,...Fu,...qu,...Uc,...bg,...eh,...Hp,...yf,...Fh,...I}),[I]);return o.jsxs(o.Fragment,{children:[o.jsx(p.VisuallyHidden,{id:g,children:c({id:ot("components.Blocks.dnd.instruction"),defaultMessage:"To reorder blocks, press Command or Control along with Shift and the Up or Down arrow keys"})}),o.jsx(p.VisuallyHidden,{"aria-live":"assertive",children:h}),o.jsx(R.Slate,{editor:u,initialValue:r||[{type:"paragraph",children:[{type:"text",text:""}]}],onChange:C,children:o.jsx(ax,{blocks:S,modifiers:Ty,disabled:e,name:t,setLiveText:f,isExpandedMode:m,onToggleExpand:y,pluginOptions:a,children:o.jsxs(fy,{error:s,disabled:e,onCollapse:y,ariaDescriptionId:g,children:[o.jsx(ey,{}),o.jsx(lx,{width:"100%"}),o.jsx(py,{...i}),o.jsx(ox,{}),o.jsx(xy,{})]})})},v)]})});let wt=null,Br=null;const ll=k.forwardRef((e,t)=>{const n=()=>{try{if(e.value){const f=typeof e.value=="string"?JSON.parse(e.value):e.value;return Array.isArray(f)?f:[{type:"paragraph",children:[{text:""}]}]}}catch(f){console.error("Failed to parse value:",f)}return[{type:"paragraph",children:[{text:""}]}]},[r,s]=k.useState(n),{get:a}=Xe.useFetchClient(),[i,l]=k.useState(wt);k.useEffect(()=>{if(wt)return;Br||(Br=a("/better-blocks/config").then(g=>(wt=g.data??{},wt)).catch(()=>(wt={},wt)));let f=!0;return Br.then(g=>{f&&l(g)}),()=>{f=!1}},[a]);const c=e.attribute.options,u={...c,detailsDefaultSummary:c?.detailsDefaultSummary||i?.details?.defaultSummary,detailsStyle:c?.detailsStyle||i?.details?.style,buttonDefaultBackgroundColor:c?.buttonDefaultBackgroundColor||i?.button?.defaultStyle?.backgroundColor,buttonDefaultTextColor:c?.buttonDefaultTextColor||i?.button?.defaultStyle?.textColor,buttonPresets:i?.button?.presets,socialEnabled:i?.social?.enabled,socialPlatforms:i?.social?.platforms,socialInstagramConfigured:i?.social?.instagramConfigured,socialFacebookConfigured:i?.social?.facebookConfigured},h=(f,g)=>{s(g),e.onChange({target:{name:f,type:"json",value:JSON.stringify(g)}})};return o.jsx(gc.Provider,{children:o.jsx(p.Field.Root,{id:e.name,name:e.name,required:e.required,error:e.error,hint:e?.hint,children:o.jsxs(p.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsx(p.Field.Label,{children:e.label}),o.jsx(ux,{ref:t,name:e.name,error:e.error,value:r,ariaLabelId:e.name,disabled:e.disabled,pluginOptions:u,onChange:(f,g)=>{typeof f=="string"?h(f,g):h(e.name,f.target.value)}}),o.jsx(p.Field.Hint,{}),o.jsx(p.Field.Error,{})]})})})});ll.displayName="BetterBlocksInput";var Jr;try{Jr=Map}catch{}var Qr;try{Qr=Set}catch{}function cl(e,t,n){if(!e||typeof e!="object"||typeof e=="function")return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(eo);if(Jr&&e instanceof Jr)return new Map(Array.from(e.entries()));if(Qr&&e instanceof Qr)return new Set(Array.from(e.values()));if(e instanceof Object){t.push(e);var r=Object.create(e);n.push(r);for(var s in e){var a=t.findIndex(function(i){return i===e[s]});r[s]=a>-1?n[a]:cl(e[s],t,n)}return r}return e}function eo(e){return cl(e,[],[])}const px=Object.prototype.toString,hx=Error.prototype.toString,fx=RegExp.prototype.toString,gx=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",mx=/^Symbol\((.*)\)(.*)$/;function bx(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Ys(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return bx(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return gx.call(e).replace(mx,"Symbol($1)");const r=px.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+hx.call(e)+"]":r==="RegExp"?fx.call(e):null}function un(e,t){let n=Ys(e,t);return n!==null?n:JSON.stringify(e,function(r,s){let a=Ys(this[r],t);return a!==null?a:s},2)}let nt={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{let s=r!=null&&r!==n,a=`${e} must be a \`${t}\` type, but the final value was: \`${un(n,!0)}\``+(s?` (cast from the value \`${un(r,!0)}\`).`:".");return n===null&&(a+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),a},defined:"${path} must be defined"},ge={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},yx={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},to={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},xx={isValue:"${path} field must be ${value}"},vx={noUnknown:"${path} field has unspecified keys: ${unknown}"},wx={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};Object.assign(Object.create(null),{mixed:nt,string:ge,number:yx,date:to,object:vx,array:wx,boolean:xx});var kx=Object.prototype,jx=kx.hasOwnProperty;function $x(e,t){return e!=null&&jx.call(e,t)}var Ex=$x,Cx=Array.isArray,Ze=Cx,Sx=typeof In=="object"&&In&&In.Object===Object&&In,dl=Sx,Tx=dl,Mx=typeof self=="object"&&self&&self.Object===Object&&self,Bx=Tx||Mx||Function("return this")(),_e=Bx,Ix=_e,Rx=Ix.Symbol,or=Rx,Zs=or,ul=Object.prototype,Fx=ul.hasOwnProperty,Dx=ul.toString,Yt=Zs?Zs.toStringTag:void 0;function Ax(e){var t=Fx.call(e,Yt),n=e[Yt];try{e[Yt]=void 0;var r=!0}catch{}var s=Dx.call(e);return r&&(t?e[Yt]=n:delete e[Yt]),s}var _x=Ax,Nx=Object.prototype,Px=Nx.toString;function Lx(e){return Px.call(e)}var Ox=Lx,Js=or,zx=_x,Hx=Ox,Ux="[object Null]",Wx="[object Undefined]",Qs=Js?Js.toStringTag:void 0;function Kx(e){return e==null?e===void 0?Wx:Ux:Qs&&Qs in Object(e)?zx(e):Hx(e)}var yn=Kx;function Gx(e){return e!=null&&typeof e=="object"}var xn=Gx,Vx=yn,qx=xn,Xx="[object Symbol]";function Yx(e){return typeof e=="symbol"||qx(e)&&Vx(e)==Xx}var Ro=Yx,Zx=Ze,Jx=Ro,Qx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ev=/^\w*$/;function tv(e,t){if(Zx(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Jx(e)?!0:ev.test(e)||!Qx.test(e)||t!=null&&e in Object(t)}var Fo=tv;function nv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Do=nv,rv=yn,ov=Do,sv="[object AsyncFunction]",av="[object Function]",iv="[object GeneratorFunction]",lv="[object Proxy]";function cv(e){if(!ov(e))return!1;var t=rv(e);return t==av||t==iv||t==sv||t==lv}var pl=cv,dv=_e,uv=dv["__core-js_shared__"],pv=uv,Ir=pv,ea=function(){var e=/[^.]+$/.exec(Ir&&Ir.keys&&Ir.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function hv(e){return!!ea&&ea in e}var fv=hv,gv=Function.prototype,mv=gv.toString;function bv(e){if(e!=null){try{return mv.call(e)}catch{}try{return e+""}catch{}}return""}var hl=bv,yv=pl,xv=fv,vv=Do,wv=hl,kv=/[\\^$.*+?()[\]{}|]/g,jv=/^\[object .+?Constructor\]$/,$v=Function.prototype,Ev=Object.prototype,Cv=$v.toString,Sv=Ev.hasOwnProperty,Tv=RegExp("^"+Cv.call(Sv).replace(kv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mv(e){if(!vv(e)||xv(e))return!1;var t=yv(e)?Tv:jv;return t.test(wv(e))}var Bv=Mv;function Iv(e,t){return e?.[t]}var Rv=Iv,Fv=Bv,Dv=Rv;function Av(e,t){var n=Dv(e,t);return Fv(n)?n:void 0}var dt=Av,_v=dt,Nv=_v(Object,"create"),sr=Nv,ta=sr;function Pv(){this.__data__=ta?ta(null):{},this.size=0}var Lv=Pv;function Ov(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var zv=Ov,Hv=sr,Uv="__lodash_hash_undefined__",Wv=Object.prototype,Kv=Wv.hasOwnProperty;function Gv(e){var t=this.__data__;if(Hv){var n=t[e];return n===Uv?void 0:n}return Kv.call(t,e)?t[e]:void 0}var Vv=Gv,qv=sr,Xv=Object.prototype,Yv=Xv.hasOwnProperty;function Zv(e){var t=this.__data__;return qv?t[e]!==void 0:Yv.call(t,e)}var Jv=Zv,Qv=sr,e0="__lodash_hash_undefined__";function t0(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qv&&t===void 0?e0:t,this}var n0=t0,r0=Lv,o0=zv,s0=Vv,a0=Jv,i0=n0;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ft.prototype.clear=r0;Ft.prototype.delete=o0;Ft.prototype.get=s0;Ft.prototype.has=a0;Ft.prototype.set=i0;var l0=Ft;function c0(){this.__data__=[],this.size=0}var d0=c0;function u0(e,t){return e===t||e!==e&&t!==t}var fl=u0,p0=fl;function h0(e,t){for(var n=e.length;n--;)if(p0(e[n][0],t))return n;return-1}var ar=h0,f0=ar,g0=Array.prototype,m0=g0.splice;function b0(e){var t=this.__data__,n=f0(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():m0.call(t,n,1),--this.size,!0}var y0=b0,x0=ar;function v0(e){var t=this.__data__,n=x0(t,e);return n<0?void 0:t[n][1]}var w0=v0,k0=ar;function j0(e){return k0(this.__data__,e)>-1}var $0=j0,E0=ar;function C0(e,t){var n=this.__data__,r=E0(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var S0=C0,T0=d0,M0=y0,B0=w0,I0=$0,R0=S0;function Dt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Dt.prototype.clear=T0;Dt.prototype.delete=M0;Dt.prototype.get=B0;Dt.prototype.has=I0;Dt.prototype.set=R0;var ir=Dt,F0=dt,D0=_e,A0=F0(D0,"Map"),Ao=A0,na=l0,_0=ir,N0=Ao;function P0(){this.size=0,this.__data__={hash:new na,map:new(N0||_0),string:new na}}var L0=P0;function O0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var z0=O0,H0=z0;function U0(e,t){var n=e.__data__;return H0(t)?n[typeof t=="string"?"string":"hash"]:n.map}var lr=U0,W0=lr;function K0(e){var t=W0(this,e).delete(e);return this.size-=t?1:0,t}var G0=K0,V0=lr;function q0(e){return V0(this,e).get(e)}var X0=q0,Y0=lr;function Z0(e){return Y0(this,e).has(e)}var J0=Z0,Q0=lr;function ew(e,t){var n=Q0(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var tw=ew,nw=L0,rw=G0,ow=X0,sw=J0,aw=tw;function At(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}At.prototype.clear=nw;At.prototype.delete=rw;At.prototype.get=ow;At.prototype.has=sw;At.prototype.set=aw;var _o=At,gl=_o,iw="Expected a function";function No(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(iw);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=n.cache;if(a.has(s))return a.get(s);var i=e.apply(this,r);return n.cache=a.set(s,i)||a,i};return n.cache=new(No.Cache||gl),n}No.Cache=gl;var lw=No,cw=lw,dw=500;function uw(e){var t=cw(e,function(r){return n.size===dw&&n.clear(),r}),n=t.cache;return t}var pw=uw,hw=pw,fw=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gw=/\\(\\)?/g,mw=hw(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(fw,function(n,r,s,a){t.push(s?a.replace(gw,"$1"):r||n)}),t}),bw=mw;function yw(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var xw=yw,ra=or,vw=xw,ww=Ze,kw=Ro,oa=ra?ra.prototype:void 0,sa=oa?oa.toString:void 0;function ml(e){if(typeof e=="string")return e;if(ww(e))return vw(e,ml)+"";if(kw(e))return sa?sa.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var jw=ml,$w=jw;function Ew(e){return e==null?"":$w(e)}var Cw=Ew,Sw=Ze,Tw=Fo,Mw=bw,Bw=Cw;function Iw(e,t){return Sw(e)?e:Tw(e,t)?[e]:Mw(Bw(e))}var bl=Iw,Rw=yn,Fw=xn,Dw="[object Arguments]";function Aw(e){return Fw(e)&&Rw(e)==Dw}var _w=Aw,aa=_w,Nw=xn,yl=Object.prototype,Pw=yl.hasOwnProperty,Lw=yl.propertyIsEnumerable,Ow=aa(function(){return arguments}())?aa:function(e){return Nw(e)&&Pw.call(e,"callee")&&!Lw.call(e,"callee")},xl=Ow,zw=9007199254740991,Hw=/^(?:0|[1-9]\d*)$/;function Uw(e,t){var n=typeof e;return t=t??zw,!!t&&(n=="number"||n!="symbol"&&Hw.test(e))&&e>-1&&e%1==0&&e<t}var vl=Uw,Ww=9007199254740991;function Kw(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ww}var Po=Kw,Gw=Ro;function Vw(e){if(typeof e=="string"||Gw(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var cr=Vw,qw=bl,Xw=xl,Yw=Ze,Zw=vl,Jw=Po,Qw=cr;function ek(e,t,n){t=qw(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var i=Qw(t[r]);if(!(a=e!=null&&n(e,i)))break;e=e[i]}return a||++r!=s?a:(s=e==null?0:e.length,!!s&&Jw(s)&&Zw(i,s)&&(Yw(e)||Xw(e)))}var wl=ek,tk=Ex,nk=wl;function rk(e,t){return e!=null&&nk(e,t,tk)}var ok=rk;const sk=Ui(ok),ak=e=>e&&e.__isYupSchema__;class ik{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!sk(n,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:a}=n,i=typeof r=="function"?r:(...l)=>l.every(c=>c===r);this.fn=function(...l){let c=l.pop(),u=l.pop(),h=i(...l)?s:a;if(h)return typeof h=="function"?h(u):u.concat(h.resolve(c))}}resolve(t,n){let r=this.refs.map(a=>a.getValue(n?.value,n?.parent,n?.context)),s=this.fn.apply(t,r.concat(t,n));if(s===void 0||s===t)return t;if(!ak(s))throw new TypeError("conditions must return a schema object");return s.resolve(n)}}function kl(e){return e==null?[]:[].concat(e)}function no(){return no=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},no.apply(this,arguments)}let lk=/\$\{\s*(\w+)\s*\}/g;class pe extends Error{static formatError(t,n){const r=n.label||n.path||"this";return r!==n.path&&(n=no({},n,{path:r})),typeof t=="string"?t.replace(lk,(s,a)=>un(n[a])):typeof t=="function"?t(n):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,n,r,s){super(),this.name="ValidationError",this.value=n,this.path=r,this.type=s,this.errors=[],this.inner=[],kl(t).forEach(a=>{pe.isError(a)?(this.errors.push(...a.errors),this.inner=this.inner.concat(a.inner.length?a.inner:a)):this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,pe)}}const ck=e=>{let t=!1;return(...n)=>{t||(t=!0,e(...n))}};function ia(e,t){let{endEarly:n,tests:r,args:s,value:a,errors:i,sort:l,path:c}=e,u=ck(t),h=r.length;const f=[];if(i=i||[],!h)return i.length?u(new pe(i,a,c)):u(null,a);for(let g=0;g<r.length;g++){const m=r[g];m(s,function(y){if(y){if(!pe.isError(y))return u(y,a);if(n)return y.value=a,u(y,a);f.push(y)}if(--h<=0){if(f.length&&(l&&f.sort(l),i.length&&f.push(...i),i=f),i.length){u(new pe(i,a,c),a);return}u(null,a)}})}}var dk=dt,uk=function(){try{var e=dk(Object,"defineProperty");return e({},"",{}),e}catch{}}(),pk=uk,la=pk;function hk(e,t,n){t=="__proto__"&&la?la(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var fk=hk;function gk(e){return function(t,n,r){for(var s=-1,a=Object(t),i=r(t),l=i.length;l--;){var c=i[e?l:++s];if(n(a[c],c,a)===!1)break}return t}}var mk=gk,bk=mk,yk=bk(),xk=yk;function vk(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var wk=vk,Kn={exports:{}};function kk(){return!1}var jk=kk;Kn.exports;(function(e,t){var n=_e,r=jk,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u})(Kn,Kn.exports);var jl=Kn.exports,$k=yn,Ek=Po,Ck=xn,Sk="[object Arguments]",Tk="[object Array]",Mk="[object Boolean]",Bk="[object Date]",Ik="[object Error]",Rk="[object Function]",Fk="[object Map]",Dk="[object Number]",Ak="[object Object]",_k="[object RegExp]",Nk="[object Set]",Pk="[object String]",Lk="[object WeakMap]",Ok="[object ArrayBuffer]",zk="[object DataView]",Hk="[object Float32Array]",Uk="[object Float64Array]",Wk="[object Int8Array]",Kk="[object Int16Array]",Gk="[object Int32Array]",Vk="[object Uint8Array]",qk="[object Uint8ClampedArray]",Xk="[object Uint16Array]",Yk="[object Uint32Array]",K={};K[Hk]=K[Uk]=K[Wk]=K[Kk]=K[Gk]=K[Vk]=K[qk]=K[Xk]=K[Yk]=!0;K[Sk]=K[Tk]=K[Ok]=K[Mk]=K[zk]=K[Bk]=K[Ik]=K[Rk]=K[Fk]=K[Dk]=K[Ak]=K[_k]=K[Nk]=K[Pk]=K[Lk]=!1;function Zk(e){return Ck(e)&&Ek(e.length)&&!!K[$k(e)]}var Jk=Zk;function Qk(e){return function(t){return e(t)}}var ej=Qk,Gn={exports:{}};Gn.exports;(function(e,t){var n=dl,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,a=s&&s.exports===r,i=a&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||i&&i.binding&&i.binding("util")}catch{}}();e.exports=l})(Gn,Gn.exports);var tj=Gn.exports,nj=Jk,rj=ej,ca=tj,da=ca&&ca.isTypedArray,oj=da?rj(da):nj,$l=oj,sj=wk,aj=xl,ij=Ze,lj=jl,cj=vl,dj=$l,uj=Object.prototype,pj=uj.hasOwnProperty;function hj(e,t){var n=ij(e),r=!n&&aj(e),s=!n&&!r&&lj(e),a=!n&&!r&&!s&&dj(e),i=n||r||s||a,l=i?sj(e.length,String):[],c=l.length;for(var u in e)(t||pj.call(e,u))&&!(i&&(u=="length"||s&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||cj(u,c)))&&l.push(u);return l}var fj=hj,gj=Object.prototype;function mj(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||gj;return e===n}var bj=mj;function yj(e,t){return function(n){return e(t(n))}}var xj=yj,vj=xj,wj=vj(Object.keys,Object),kj=wj,jj=bj,$j=kj,Ej=Object.prototype,Cj=Ej.hasOwnProperty;function Sj(e){if(!jj(e))return $j(e);var t=[];for(var n in Object(e))Cj.call(e,n)&&n!="constructor"&&t.push(n);return t}var Tj=Sj,Mj=pl,Bj=Po;function Ij(e){return e!=null&&Bj(e.length)&&!Mj(e)}var Rj=Ij,Fj=fj,Dj=Tj,Aj=Rj;function _j(e){return Aj(e)?Fj(e):Dj(e)}var Lo=_j,Nj=xk,Pj=Lo;function Lj(e,t){return e&&Nj(e,t,Pj)}var Oj=Lj,zj=ir;function Hj(){this.__data__=new zj,this.size=0}var Uj=Hj;function Wj(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var Kj=Wj;function Gj(e){return this.__data__.get(e)}var Vj=Gj;function qj(e){return this.__data__.has(e)}var Xj=qj,Yj=ir,Zj=Ao,Jj=_o,Qj=200;function e$(e,t){var n=this.__data__;if(n instanceof Yj){var r=n.__data__;if(!Zj||r.length<Qj-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Jj(r)}return n.set(e,t),this.size=n.size,this}var t$=e$,n$=ir,r$=Uj,o$=Kj,s$=Vj,a$=Xj,i$=t$;function _t(e){var t=this.__data__=new n$(e);this.size=t.size}_t.prototype.clear=r$;_t.prototype.delete=o$;_t.prototype.get=s$;_t.prototype.has=a$;_t.prototype.set=i$;var El=_t,l$="__lodash_hash_undefined__";function c$(e){return this.__data__.set(e,l$),this}var d$=c$;function u$(e){return this.__data__.has(e)}var p$=u$,h$=_o,f$=d$,g$=p$;function Vn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new h$;++t<n;)this.add(e[t])}Vn.prototype.add=Vn.prototype.push=f$;Vn.prototype.has=g$;var m$=Vn;function b$(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var y$=b$;function x$(e,t){return e.has(t)}var v$=x$,w$=m$,k$=y$,j$=v$,$$=1,E$=2;function C$(e,t,n,r,s,a){var i=n&$$,l=e.length,c=t.length;if(l!=c&&!(i&&c>l))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,g=!0,m=n&E$?new w$:void 0;for(a.set(e,t),a.set(t,e);++f<l;){var x=e[f],y=t[f];if(r)var v=i?r(y,x,f,t,e,a):r(x,y,f,e,t,a);if(v!==void 0){if(v)continue;g=!1;break}if(m){if(!k$(t,function($,E){if(!j$(m,E)&&(x===$||s(x,$,n,r,a)))return m.push(E)})){g=!1;break}}else if(!(x===y||s(x,y,n,r,a))){g=!1;break}}return a.delete(e),a.delete(t),g}var Cl=C$,S$=_e,T$=S$.Uint8Array,M$=T$;function B$(e){var t=-1,n=Array(e.size);return e.forEach(function(r,s){n[++t]=[s,r]}),n}var I$=B$;function R$(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var F$=R$,ua=or,pa=M$,D$=fl,A$=Cl,_$=I$,N$=F$,P$=1,L$=2,O$="[object Boolean]",z$="[object Date]",H$="[object Error]",U$="[object Map]",W$="[object Number]",K$="[object RegExp]",G$="[object Set]",V$="[object String]",q$="[object Symbol]",X$="[object ArrayBuffer]",Y$="[object DataView]",ha=ua?ua.prototype:void 0,Rr=ha?ha.valueOf:void 0;function Z$(e,t,n,r,s,a,i){switch(n){case Y$:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case X$:return!(e.byteLength!=t.byteLength||!a(new pa(e),new pa(t)));case O$:case z$:case W$:return D$(+e,+t);case H$:return e.name==t.name&&e.message==t.message;case K$:case V$:return e==t+"";case U$:var l=_$;case G$:var c=r&P$;if(l||(l=N$),e.size!=t.size&&!c)return!1;var u=i.get(e);if(u)return u==t;r|=L$,i.set(e,t);var h=A$(l(e),l(t),r,s,a,i);return i.delete(e),h;case q$:if(Rr)return Rr.call(e)==Rr.call(t)}return!1}var J$=Z$;function Q$(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var e1=Q$,t1=e1,n1=Ze;function r1(e,t,n){var r=t(e);return n1(e)?r:t1(r,n(e))}var o1=r1;function s1(e,t){for(var n=-1,r=e==null?0:e.length,s=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[s++]=i)}return a}var a1=s1;function i1(){return[]}var l1=i1,c1=a1,d1=l1,u1=Object.prototype,p1=u1.propertyIsEnumerable,fa=Object.getOwnPropertySymbols,h1=fa?function(e){return e==null?[]:(e=Object(e),c1(fa(e),function(t){return p1.call(e,t)}))}:d1,f1=h1,g1=o1,m1=f1,b1=Lo;function y1(e){return g1(e,b1,m1)}var x1=y1,ga=x1,v1=1,w1=Object.prototype,k1=w1.hasOwnProperty;function j1(e,t,n,r,s,a){var i=n&v1,l=ga(e),c=l.length,u=ga(t),h=u.length;if(c!=h&&!i)return!1;for(var f=c;f--;){var g=l[f];if(!(i?g in t:k1.call(t,g)))return!1}var m=a.get(e),x=a.get(t);if(m&&x)return m==t&&x==e;var y=!0;a.set(e,t),a.set(t,e);for(var v=i;++f<c;){g=l[f];var $=e[g],E=t[g];if(r)var C=i?r(E,$,g,t,e,a):r($,E,g,e,t,a);if(!(C===void 0?$===E||s($,E,n,r,a):C)){y=!1;break}v||(v=g=="constructor")}if(y&&!v){var I=e.constructor,S=t.constructor;I!=S&&"constructor"in e&&"constructor"in t&&!(typeof I=="function"&&I instanceof I&&typeof S=="function"&&S instanceof S)&&(y=!1)}return a.delete(e),a.delete(t),y}var $1=j1,E1=dt,C1=_e,S1=E1(C1,"DataView"),T1=S1,M1=dt,B1=_e,I1=M1(B1,"Promise"),R1=I1,F1=dt,D1=_e,A1=F1(D1,"Set"),_1=A1,N1=dt,P1=_e,L1=N1(P1,"WeakMap"),O1=L1,ro=T1,oo=Ao,so=R1,ao=_1,io=O1,Sl=yn,Nt=hl,ma="[object Map]",z1="[object Object]",ba="[object Promise]",ya="[object Set]",xa="[object WeakMap]",va="[object DataView]",H1=Nt(ro),U1=Nt(oo),W1=Nt(so),K1=Nt(ao),G1=Nt(io),rt=Sl;(ro&&rt(new ro(new ArrayBuffer(1)))!=va||oo&&rt(new oo)!=ma||so&&rt(so.resolve())!=ba||ao&&rt(new ao)!=ya||io&&rt(new io)!=xa)&&(rt=function(e){var t=Sl(e),n=t==z1?e.constructor:void 0,r=n?Nt(n):"";if(r)switch(r){case H1:return va;case U1:return ma;case W1:return ba;case K1:return ya;case G1:return xa}return t});var V1=rt,Fr=El,q1=Cl,X1=J$,Y1=$1,wa=V1,ka=Ze,ja=jl,Z1=$l,J1=1,$a="[object Arguments]",Ea="[object Array]",Fn="[object Object]",Q1=Object.prototype,Ca=Q1.hasOwnProperty;function eE(e,t,n,r,s,a){var i=ka(e),l=ka(t),c=i?Ea:wa(e),u=l?Ea:wa(t);c=c==$a?Fn:c,u=u==$a?Fn:u;var h=c==Fn,f=u==Fn,g=c==u;if(g&&ja(e)){if(!ja(t))return!1;i=!0,h=!1}if(g&&!h)return a||(a=new Fr),i||Z1(e)?q1(e,t,n,r,s,a):X1(e,t,c,n,r,s,a);if(!(n&J1)){var m=h&&Ca.call(e,"__wrapped__"),x=f&&Ca.call(t,"__wrapped__");if(m||x){var y=m?e.value():e,v=x?t.value():t;return a||(a=new Fr),s(y,v,n,r,a)}}return g?(a||(a=new Fr),Y1(e,t,n,r,s,a)):!1}var tE=eE,nE=tE,Sa=xn;function Tl(e,t,n,r,s){return e===t?!0:e==null||t==null||!Sa(e)&&!Sa(t)?e!==e&&t!==t:nE(e,t,n,r,Tl,s)}var Ml=Tl,rE=El,oE=Ml,sE=1,aE=2;function iE(e,t,n,r){var s=n.length,a=s,i=!r;if(e==null)return!a;for(e=Object(e);s--;){var l=n[s];if(i&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<a;){l=n[s];var c=l[0],u=e[c],h=l[1];if(i&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new rE;if(r)var g=r(u,h,c,e,t,f);if(!(g===void 0?oE(h,u,sE|aE,r,f):g))return!1}}return!0}var lE=iE,cE=Do;function dE(e){return e===e&&!cE(e)}var Bl=dE,uE=Bl,pE=Lo;function hE(e){for(var t=pE(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,uE(s)]}return t}var fE=hE;function gE(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Il=gE,mE=lE,bE=fE,yE=Il;function xE(e){var t=bE(e);return t.length==1&&t[0][2]?yE(t[0][0],t[0][1]):function(n){return n===e||mE(n,e,t)}}var vE=xE,wE=bl,kE=cr;function jE(e,t){t=wE(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[kE(t[n++])];return n&&n==r?e:void 0}var Rl=jE,$E=Rl;function EE(e,t,n){var r=e==null?void 0:$E(e,t);return r===void 0?n:r}var CE=EE;function SE(e,t){return e!=null&&t in Object(e)}var TE=SE,ME=TE,BE=wl;function IE(e,t){return e!=null&&BE(e,t,ME)}var RE=IE,FE=Ml,DE=CE,AE=RE,_E=Fo,NE=Bl,PE=Il,LE=cr,OE=1,zE=2;function HE(e,t){return _E(e)&&NE(t)?PE(LE(e),t):function(n){var r=DE(n,e);return r===void 0&&r===t?AE(n,e):FE(t,r,OE|zE)}}var UE=HE;function WE(e){return e}var KE=WE;function GE(e){return function(t){return t?.[e]}}var VE=GE,qE=Rl;function XE(e){return function(t){return qE(t,e)}}var YE=XE,ZE=VE,JE=YE,QE=Fo,eC=cr;function tC(e){return QE(e)?ZE(eC(e)):JE(e)}var nC=tC,rC=vE,oC=UE,sC=KE,aC=Ze,iC=nC;function lC(e){return typeof e=="function"?e:e==null?sC:typeof e=="object"?aC(e)?oC(e[0],e[1]):rC(e):iC(e)}var cC=lC,dC=fk,uC=Oj,pC=cC;function hC(e,t){var n={};return t=pC(t),uC(e,function(r,s,a){dC(n,s,t(r,s,a))}),n}var fC=hC;const gC=Ui(fC);function Pt(e){this._maxSize=e,this.clear()}Pt.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Pt.prototype.get=function(e){return this._values[e]};Pt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var mC=/[^.^\]^[]+|(?=\[\]|\.\.)/g,bC=/^\d+$/,yC=/^\d/,xC=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,vC=/^\s*(['"]?)(.*?)(\1)\s*$/,Oo=512,Ta=new Pt(Oo);new Pt(Oo);var Ma=new Pt(Oo),Fl={getter:function(e,t){var n=wC(e);return Ma.get(e)||Ma.set(e,function(s){for(var a=0,i=n.length;a<i;)if(s!=null||!t)s=s[n[a++]];else return;return s})},forEach:function(e,t,n){kC(Array.isArray(e)?e:Dl(e),t,n)}};function wC(e){return Ta.get(e)||Ta.set(e,Dl(e).map(function(t){return t.replace(vC,"$2")}))}function Dl(e){return e.match(mC)||[""]}function kC(e,t,n){var r=e.length,s,a,i,l;for(a=0;a<r;a++)s=e[a],s&&(EC(s)&&(s='"'+s+'"'),l=Al(s),i=!l&&/^\d+$/.test(s),t.call(n,s,l,i,a,e))}function Al(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function jC(e){return e.match(yC)&&!e.match(bC)}function $C(e){return xC.test(e)}function EC(e){return!Al(e)&&(jC(e)||$C(e))}const Dn={context:"$",value:"."};class St{constructor(t,n={}){if(typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Dn.context,this.isValue=this.key[0]===Dn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Dn.context:this.isValue?Dn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Fl.getter(this.path,!0),this.map=n.map}getValue(t,n,r){let s=this.isContext?r:this.isValue?t:n;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(t,n){return this.getValue(t,n?.parent,n?.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}St.prototype.__isYupRef=!0;function qn(){return qn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qn.apply(this,arguments)}function CC(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,a;for(a=0;a<r.length;a++)s=r[a],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function An(e){function t(n,r){let{value:s,path:a="",label:i,options:l,originalValue:c,sync:u}=n,h=CC(n,["value","path","label","options","originalValue","sync"]);const{name:f,test:g,params:m,message:x}=e;let{parent:y,context:v}=l;function $(T){return St.isRef(T)?T.getValue(s,y,v):T}function E(T={}){const j=gC(qn({value:s,originalValue:c,label:i,path:T.path||a},m,T.params),$),w=new pe(pe.formatError(T.message||x,j),s,j.path,T.type||f);return w.params=j,w}let C=qn({path:a,parent:y,type:f,createError:E,resolve:$,options:l,originalValue:c},h);if(!u){try{Promise.resolve(g.call(C,s,C)).then(T=>{pe.isError(T)?r(T):T?r(null,T):r(E())})}catch(T){r(T)}return}let I;try{var S;if(I=g.call(C,s,C),typeof((S=I)==null?void 0:S.then)=="function")throw new Error(`Validation test of type: "${C.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(T){r(T);return}pe.isError(I)?r(I):I?r(null,I):r(E())}return t.OPTIONS=e,t}let SC=e=>e.substr(0,e.length-1).substr(1);function TC(e,t,n,r=n){let s,a,i;return t?(Fl.forEach(t,(l,c,u)=>{let h=c?SC(l):l;if(e=e.resolve({context:r,parent:s,value:n}),e.innerType){let f=u?parseInt(h,10):0;if(n&&f>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);s=n,n=n&&n[f],e=e.innerType}if(!u){if(!e.fields||!e.fields[h])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e._type}")`);s=n,n=n&&n[h],e=e.fields[h]}a=h,i=c?"["+l+"]":"."+l}),{schema:e,parent:s,parentPath:a}):{parent:s,parentPath:t,schema:e}}class Xn{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const t=[];for(const n of this.list)t.push(n);for(const[,n]of this.refs)t.push(n.describe());return t}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(t){St.isRef(t)?this.refs.set(t.key,t):this.list.add(t)}delete(t){St.isRef(t)?this.refs.delete(t.key):this.list.delete(t)}has(t,n){if(this.list.has(t))return!0;let r,s=this.refs.values();for(;r=s.next(),!r.done;)if(n(r.value)===t)return!0;return!1}clone(){const t=new Xn;return t.list=new Set(this.list),t.refs=new Map(this.refs),t}merge(t,n){const r=this.clone();return t.list.forEach(s=>r.add(s)),t.refs.forEach(s=>r.add(s)),n.list.forEach(s=>r.delete(s)),n.refs.forEach(s=>r.delete(s)),r}}function de(){return de=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(this,arguments)}class $e{constructor(t){this.deps=[],this.conditions=[],this._whitelist=new Xn,this._blacklist=new Xn,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(nt.notType)}),this.type=t?.type||"mixed",this.spec=de({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},t?.spec)}get _type(){return this.type}_typeCheck(t){return!0}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeError=this._typeError,n._whitelistError=this._whitelistError,n._blacklistError=this._blacklistError,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.exclusiveTests=de({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=eo(de({},this.spec,t)),n}label(t){var n=this.clone();return n.spec.label=t,n}meta(...t){if(t.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},t[0]),n}withMutation(t){let n=this._mutate;this._mutate=!0;let r=t(this);return this._mutate=n,r}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let n=this,r=t.clone();const s=de({},n.spec,r.spec);return r.spec=s,r._typeError||(r._typeError=n._typeError),r._whitelistError||(r._whitelistError=n._whitelistError),r._blacklistError||(r._blacklistError=n._blacklistError),r._whitelist=n._whitelist.merge(t._whitelist,t._blacklist),r._blacklist=n._blacklist.merge(t._blacklist,t._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(a=>{t.tests.forEach(i=>{a.test(i.OPTIONS)})}),r}isType(t){return this.spec.nullable&&t===null?!0:this._typeCheck(t)}resolve(t){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((s,a)=>a.resolve(s,t),n),n=n.resolve(t)}return n}cast(t,n={}){let r=this.resolve(de({value:t},n)),s=r._cast(t,n);if(t!==void 0&&n.assert!==!1&&r.isType(s)!==!0){let a=un(t),i=un(s);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r._type}".
1921
1921
 
1922
1922
  attempted value: ${a}
1923
- `+(i!==a?`result of cast: ${i}`:""))}return s}_cast(t,n){let r=t===void 0?t:this.transforms.reduce((s,a)=>a.call(this,s,t,this),t);return r===void 0&&(r=this.getDefault()),r}_validate(t,n={},r){let{sync:s,path:a,from:i=[],originalValue:l=t,strict:c=this.spec.strict,abortEarly:u=this.spec.abortEarly}=n,h=t;c||(h=this._cast(h,de({assert:!1},n)));let f={value:h,path:a,options:n,originalValue:l,schema:this,label:this.spec.label,sync:s,from:i},g=[];this._typeError&&g.push(this._typeError),this._whitelistError&&g.push(this._whitelistError),this._blacklistError&&g.push(this._blacklistError),sa({args:f,value:h,path:a,tests:g,endEarly:u},m=>{if(m)return void r(m,h);sa({tests:this.tests,args:f,path:a,sync:s,value:h,endEarly:u},r)})}validate(t,n,r){let s=this.resolve(de({},n,{value:t}));return typeof r=="function"?s._validate(t,n,r):new Promise((a,i)=>s._validate(t,n,(l,c)=>{l?i(l):a(c)}))}validateSync(t,n){let r=this.resolve(de({},n,{value:t})),s;return r._validate(t,de({},n,{sync:!0}),(a,i)=>{if(a)throw a;s=i}),s}isValid(t,n){return this.validate(t,n).then(()=>!0,r=>{if(pe.isError(r))return!1;throw r})}isValidSync(t,n){try{return this.validateSync(t,n),!0}catch(r){if(pe.isError(r))return!1;throw r}}_getDefault(){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this):Jr(t)}getDefault(t){return this.resolve(t||{})._getDefault()}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){var n=this.clone();return n.spec.strict=t,n}_isPresent(t){return t!=null}defined(t=nt.defined){return this.test({message:t,name:"defined",exclusive:!0,test(n){return n!==void 0}})}required(t=nt.required){return this.clone({presence:"required"}).withMutation(n=>n.test({message:t,name:"required",exclusive:!0,test(r){return this.schema._isPresent(r)}}))}notRequired(){var t=this.clone({presence:"optional"});return t.tests=t.tests.filter(n=>n.OPTIONS.name!=="required"),t}nullable(t=!0){var n=this.clone({nullable:t!==!1});return n}transform(t){var n=this.clone();return n.transforms.push(t),n}test(...t){let n;if(t.length===1?typeof t[0]=="function"?n={test:t[0]}:n=t[0]:t.length===2?n={name:t[0],test:t[1]}:n={name:t[0],message:t[1],test:t[2]},n.message===void 0&&(n.message=nt.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=Dn(n),a=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(i=>!(i.OPTIONS.name===n.name&&(a||i.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(t,n){!Array.isArray(t)&&typeof t!="string"&&(n=t,t=".");let r=this.clone(),s=yl(t).map(a=>new Ct(a));return s.forEach(a=>{a.isSibling&&r.deps.push(a.key)}),r.conditions.push(new Qw(s,n)),r}typeError(t){var n=this.clone();return n._typeError=Dn({message:t,name:"typeError",test(r){return r!==void 0&&!this.schema.isType(r)?this.createError({params:{type:this.schema._type}}):!0}}),n}oneOf(t,n=nt.oneOf){var r=this.clone();return t.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r._whitelistError=Dn({message:n,name:"oneOf",test(s){if(s===void 0)return!0;let a=this.schema._whitelist;return a.has(s,this.resolve)?!0:this.createError({params:{values:a.toArray().join(", ")}})}}),r}notOneOf(t,n=nt.notOneOf){var r=this.clone();return t.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r._blacklistError=Dn({message:n,name:"notOneOf",test(s){let a=this.schema._blacklist;return a.has(s,this.resolve)?this.createError({params:{values:a.toArray().join(", ")}}):!0}}),r}strip(t=!0){let n=this.clone();return n.spec.strip=t,n}describe(){const t=this.clone(),{label:n,meta:r}=t.spec;return{meta:r,label:n,type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(a=>({name:a.OPTIONS.name,params:a.OPTIONS.params})).filter((a,i,l)=>l.findIndex(c=>c.name===a.name)===i)}}}$e.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])$e.prototype[`${e}At`]=function(t,n,r={}){const{parent:s,parentPath:a,schema:i}=vC(this,t,n,r.context);return i[e](s&&s[a],de({},r,{parent:s,path:t}))};for(const e of["equals","is"])$e.prototype[e]=$e.prototype.oneOf;for(const e of["not","nope"])$e.prototype[e]=$e.prototype.notOneOf;$e.prototype.optional=$e.prototype.notRequired;const me=e=>e==null;let wC=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,kC=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,jC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,$C=e=>me(e)||e===e.trim(),EC={}.toString();function Jt(){return new Fl}class Fl extends $e{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(t){if(this.isType(t)||Array.isArray(t))return t;const n=t!=null&&t.toString?t.toString():t;return n===EC?t:n})})}_typeCheck(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}_isPresent(t){return super._isPresent(t)&&!!t.length}length(t,n=ge.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:t},test(r){return me(r)||r.length===this.resolve(t)}})}min(t,n=ge.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:t},test(r){return me(r)||r.length>=this.resolve(t)}})}max(t,n=ge.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:t},test(r){return me(r)||r.length<=this.resolve(t)}})}matches(t,n){let r=!1,s,a;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:s,name:a}=n:s=n),this.test({name:a||"matches",message:s||ge.matches,params:{regex:t},test:i=>me(i)||i===""&&r||i.search(t)!==-1})}email(t=ge.email){return this.matches(wC,{name:"email",message:t,excludeEmptyString:!0})}url(t=ge.url){return this.matches(kC,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=ge.uuid){return this.matches(jC,{name:"uuid",message:t,excludeEmptyString:!1})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=ge.trim){return this.transform(n=>n!=null?n.trim():n).test({message:t,name:"trim",test:$C})}lowercase(t=ge.lowercase){return this.transform(n=>me(n)?n:n.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,test:n=>me(n)||n===n.toLowerCase()})}uppercase(t=ge.uppercase){return this.transform(n=>me(n)?n:n.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,test:n=>me(n)||n===n.toUpperCase()})}}Jt.prototype=Fl.prototype;var CC=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function SC(e){var t=[1,4,5,6,7,10,11],n=0,r,s;if(s=CC.exec(e)){for(var a=0,i;i=t[a];++a)s[i]=+s[i]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,s[7]=s[7]?String(s[7]).substr(0,3):0,(s[8]===void 0||s[8]==="")&&(s[9]===void 0||s[9]==="")?r=+new Date(s[1],s[2],s[3],s[4],s[5],s[6],s[7]):(s[8]!=="Z"&&s[9]!==void 0&&(n=s[10]*60+s[11],s[9]==="+"&&(n=0-n)),r=Date.UTC(s[1],s[2],s[3],s[4],s[5]+n,s[6],s[7]))}else r=Date.parse?Date.parse(e):NaN;return r}let Dl=new Date(""),TC=e=>Object.prototype.toString.call(e)==="[object Date]";class MC extends $e{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(t){return this.isType(t)?t:(t=SC(t),isNaN(t)?Dl:new Date(t))})})}_typeCheck(t){return TC(t)&&!isNaN(t.getTime())}prepareParam(t,n){let r;if(Ct.isRef(t))r=t;else{let s=this.cast(t);if(!this._typeCheck(s))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(t,n=Qr.min){let r=this.prepareParam(t,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:t},test(s){return me(s)||s>=this.resolve(r)}})}max(t,n=Qr.max){var r=this.prepareParam(t,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:t},test(s){return me(s)||s<=this.resolve(r)}})}}MC.INVALID_DATE=Dl;var Al={exports:{}};Al.exports=function(e){return _l(IC(e),e)};Al.exports.array=_l;function _l(e,t){var n=e.length,r=new Array(n),s={},a=n,i=RC(t),l=BC(e);for(t.forEach(function(u){if(!l.has(u[0])||!l.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)s[a]||c(e[a],a,new Set);return r;function c(u,h,f){if(f.has(u)){var g;try{g=", node was:"+JSON.stringify(u)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!l.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!s[h]){s[h]=!0;var m=i.get(u)||new Set;if(m=Array.from(m),h=m.length){f.add(u);do{var w=m[--h];c(w,l.get(w),f)}while(h);f.delete(u)}r[--n]=u}}}function IC(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var s=e[n];t.add(s[0]),t.add(s[1])}return Array.from(t)}function RC(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var s=e[n];t.has(s[0])||t.set(s[0],new Set),t.has(s[1])||t.set(s[1],new Set),t.get(s[0]).add(s[1])}return t}function BC(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}const FC={register(e){e.registerPlugin({id:z,name:z,initializer:hc,isReady:!1}),e.customFields.register({name:z,pluginId:z,type:"json",icon:fc,required:!0,intlLabel:{id:`${z}.field.label`,defaultMessage:"Better Blocks"},intlDescription:{id:`${z}.field.description`,defaultMessage:"An enhanced Rich Text (Blocks) field with inline color picker and more"},components:{Input:async()=>({default:sl})},options:{base:[{sectionTitle:{id:`${z}.section.color-settings`,defaultMessage:"Text Color Settings (Label:#HEX)"},items:[{name:"options.disableDefaultColors",type:"checkbox",intlLabel:{id:`${z}.disableDefaultColors`,defaultMessage:"Disable default text colors?"},description:{id:`${z}.disableDefaultColors.description`,defaultMessage:"If enabled, custom text color presets will be used"}},{name:"options.customColorsPresets",type:"textarea",placeholder:{id:`${z}.customColorsPresets.placeholder`,defaultMessage:`Black:#000000
1923
+ `+(i!==a?`result of cast: ${i}`:""))}return s}_cast(t,n){let r=t===void 0?t:this.transforms.reduce((s,a)=>a.call(this,s,t,this),t);return r===void 0&&(r=this.getDefault()),r}_validate(t,n={},r){let{sync:s,path:a,from:i=[],originalValue:l=t,strict:c=this.spec.strict,abortEarly:u=this.spec.abortEarly}=n,h=t;c||(h=this._cast(h,de({assert:!1},n)));let f={value:h,path:a,options:n,originalValue:l,schema:this,label:this.spec.label,sync:s,from:i},g=[];this._typeError&&g.push(this._typeError),this._whitelistError&&g.push(this._whitelistError),this._blacklistError&&g.push(this._blacklistError),ia({args:f,value:h,path:a,tests:g,endEarly:u},m=>{if(m)return void r(m,h);ia({tests:this.tests,args:f,path:a,sync:s,value:h,endEarly:u},r)})}validate(t,n,r){let s=this.resolve(de({},n,{value:t}));return typeof r=="function"?s._validate(t,n,r):new Promise((a,i)=>s._validate(t,n,(l,c)=>{l?i(l):a(c)}))}validateSync(t,n){let r=this.resolve(de({},n,{value:t})),s;return r._validate(t,de({},n,{sync:!0}),(a,i)=>{if(a)throw a;s=i}),s}isValid(t,n){return this.validate(t,n).then(()=>!0,r=>{if(pe.isError(r))return!1;throw r})}isValidSync(t,n){try{return this.validateSync(t,n),!0}catch(r){if(pe.isError(r))return!1;throw r}}_getDefault(){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this):eo(t)}getDefault(t){return this.resolve(t||{})._getDefault()}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){var n=this.clone();return n.spec.strict=t,n}_isPresent(t){return t!=null}defined(t=nt.defined){return this.test({message:t,name:"defined",exclusive:!0,test(n){return n!==void 0}})}required(t=nt.required){return this.clone({presence:"required"}).withMutation(n=>n.test({message:t,name:"required",exclusive:!0,test(r){return this.schema._isPresent(r)}}))}notRequired(){var t=this.clone({presence:"optional"});return t.tests=t.tests.filter(n=>n.OPTIONS.name!=="required"),t}nullable(t=!0){var n=this.clone({nullable:t!==!1});return n}transform(t){var n=this.clone();return n.transforms.push(t),n}test(...t){let n;if(t.length===1?typeof t[0]=="function"?n={test:t[0]}:n=t[0]:t.length===2?n={name:t[0],test:t[1]}:n={name:t[0],message:t[1],test:t[2]},n.message===void 0&&(n.message=nt.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=An(n),a=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(i=>!(i.OPTIONS.name===n.name&&(a||i.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(t,n){!Array.isArray(t)&&typeof t!="string"&&(n=t,t=".");let r=this.clone(),s=kl(t).map(a=>new St(a));return s.forEach(a=>{a.isSibling&&r.deps.push(a.key)}),r.conditions.push(new ik(s,n)),r}typeError(t){var n=this.clone();return n._typeError=An({message:t,name:"typeError",test(r){return r!==void 0&&!this.schema.isType(r)?this.createError({params:{type:this.schema._type}}):!0}}),n}oneOf(t,n=nt.oneOf){var r=this.clone();return t.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r._whitelistError=An({message:n,name:"oneOf",test(s){if(s===void 0)return!0;let a=this.schema._whitelist;return a.has(s,this.resolve)?!0:this.createError({params:{values:a.toArray().join(", ")}})}}),r}notOneOf(t,n=nt.notOneOf){var r=this.clone();return t.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r._blacklistError=An({message:n,name:"notOneOf",test(s){let a=this.schema._blacklist;return a.has(s,this.resolve)?this.createError({params:{values:a.toArray().join(", ")}}):!0}}),r}strip(t=!0){let n=this.clone();return n.spec.strip=t,n}describe(){const t=this.clone(),{label:n,meta:r}=t.spec;return{meta:r,label:n,type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(a=>({name:a.OPTIONS.name,params:a.OPTIONS.params})).filter((a,i,l)=>l.findIndex(c=>c.name===a.name)===i)}}}$e.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])$e.prototype[`${e}At`]=function(t,n,r={}){const{parent:s,parentPath:a,schema:i}=TC(this,t,n,r.context);return i[e](s&&s[a],de({},r,{parent:s,path:t}))};for(const e of["equals","is"])$e.prototype[e]=$e.prototype.oneOf;for(const e of["not","nope"])$e.prototype[e]=$e.prototype.notOneOf;$e.prototype.optional=$e.prototype.notRequired;const me=e=>e==null;let MC=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,BC=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,IC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,RC=e=>me(e)||e===e.trim(),FC={}.toString();function Qt(){return new _l}class _l extends $e{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(t){if(this.isType(t)||Array.isArray(t))return t;const n=t!=null&&t.toString?t.toString():t;return n===FC?t:n})})}_typeCheck(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}_isPresent(t){return super._isPresent(t)&&!!t.length}length(t,n=ge.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:t},test(r){return me(r)||r.length===this.resolve(t)}})}min(t,n=ge.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:t},test(r){return me(r)||r.length>=this.resolve(t)}})}max(t,n=ge.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:t},test(r){return me(r)||r.length<=this.resolve(t)}})}matches(t,n){let r=!1,s,a;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:s,name:a}=n:s=n),this.test({name:a||"matches",message:s||ge.matches,params:{regex:t},test:i=>me(i)||i===""&&r||i.search(t)!==-1})}email(t=ge.email){return this.matches(MC,{name:"email",message:t,excludeEmptyString:!0})}url(t=ge.url){return this.matches(BC,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=ge.uuid){return this.matches(IC,{name:"uuid",message:t,excludeEmptyString:!1})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=ge.trim){return this.transform(n=>n!=null?n.trim():n).test({message:t,name:"trim",test:RC})}lowercase(t=ge.lowercase){return this.transform(n=>me(n)?n:n.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,test:n=>me(n)||n===n.toLowerCase()})}uppercase(t=ge.uppercase){return this.transform(n=>me(n)?n:n.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,test:n=>me(n)||n===n.toUpperCase()})}}Qt.prototype=_l.prototype;var DC=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function AC(e){var t=[1,4,5,6,7,10,11],n=0,r,s;if(s=DC.exec(e)){for(var a=0,i;i=t[a];++a)s[i]=+s[i]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,s[7]=s[7]?String(s[7]).substr(0,3):0,(s[8]===void 0||s[8]==="")&&(s[9]===void 0||s[9]==="")?r=+new Date(s[1],s[2],s[3],s[4],s[5],s[6],s[7]):(s[8]!=="Z"&&s[9]!==void 0&&(n=s[10]*60+s[11],s[9]==="+"&&(n=0-n)),r=Date.UTC(s[1],s[2],s[3],s[4],s[5]+n,s[6],s[7]))}else r=Date.parse?Date.parse(e):NaN;return r}let Nl=new Date(""),_C=e=>Object.prototype.toString.call(e)==="[object Date]";class NC extends $e{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(t){return this.isType(t)?t:(t=AC(t),isNaN(t)?Nl:new Date(t))})})}_typeCheck(t){return _C(t)&&!isNaN(t.getTime())}prepareParam(t,n){let r;if(St.isRef(t))r=t;else{let s=this.cast(t);if(!this._typeCheck(s))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(t,n=to.min){let r=this.prepareParam(t,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:t},test(s){return me(s)||s>=this.resolve(r)}})}max(t,n=to.max){var r=this.prepareParam(t,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:t},test(s){return me(s)||s<=this.resolve(r)}})}}NC.INVALID_DATE=Nl;var Pl={exports:{}};Pl.exports=function(e){return Ll(PC(e),e)};Pl.exports.array=Ll;function Ll(e,t){var n=e.length,r=new Array(n),s={},a=n,i=LC(t),l=OC(e);for(t.forEach(function(u){if(!l.has(u[0])||!l.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)s[a]||c(e[a],a,new Set);return r;function c(u,h,f){if(f.has(u)){var g;try{g=", node was:"+JSON.stringify(u)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!l.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!s[h]){s[h]=!0;var m=i.get(u)||new Set;if(m=Array.from(m),h=m.length){f.add(u);do{var x=m[--h];c(x,l.get(x),f)}while(h);f.delete(u)}r[--n]=u}}}function PC(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var s=e[n];t.add(s[0]),t.add(s[1])}return Array.from(t)}function LC(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var s=e[n];t.has(s[0])||t.set(s[0],new Set),t.has(s[1])||t.set(s[1],new Set),t.get(s[0]).add(s[1])}return t}function OC(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}const zC={register(e){e.registerPlugin({id:z,name:z,initializer:bc,isReady:!1}),e.customFields.register({name:z,pluginId:z,type:"json",icon:yc,required:!0,intlLabel:{id:`${z}.field.label`,defaultMessage:"Better Blocks"},intlDescription:{id:`${z}.field.description`,defaultMessage:"An enhanced Rich Text (Blocks) field with inline color picker and more"},components:{Input:async()=>({default:ll})},options:{base:[{sectionTitle:{id:`${z}.section.color-settings`,defaultMessage:"Text Color Settings (Label:#HEX)"},items:[{name:"options.disableDefaultColors",type:"checkbox",intlLabel:{id:`${z}.disableDefaultColors`,defaultMessage:"Disable default text colors?"},description:{id:`${z}.disableDefaultColors.description`,defaultMessage:"If enabled, custom text color presets will be used"}},{name:"options.customColorsPresets",type:"textarea",placeholder:{id:`${z}.customColorsPresets.placeholder`,defaultMessage:`Black:#000000
1924
1924
  White:#FFFFFF
1925
1925
  Gray:#808080
1926
1926
  Red:#FF0000
@@ -1930,4 +1930,4 @@ Green:#D3F9D8
1930
1930
  Blue:#D0EBFF
1931
1931
  Pink:#FFE0E6
1932
1932
  Purple:#E5DBFF`},intlLabel:{id:`${z}.customBgColorsPresets`,defaultMessage:"Custom background color presets"},description:{id:`${z}.customBgColorsPresets.description`,defaultMessage:"These values will override default background color options. One per line."}}]},{sectionTitle:{id:`${z}.section.details-settings`,defaultMessage:"Details / Collapsible Settings"},items:[{name:"options.detailsDefaultSummary",type:"text",placeholder:{id:`${z}.detailsDefaultSummary.placeholder`,defaultMessage:"Click to expand"},intlLabel:{id:`${z}.detailsDefaultSummary`,defaultMessage:"Default summary text"},description:{id:`${z}.detailsDefaultSummary.description`,defaultMessage:"Summary label used when a new collapsible Details block is inserted."}},{name:"options.detailsStyle",type:"select",defaultValue:"github",intlLabel:{id:`${z}.detailsStyle`,defaultMessage:"Details style"},description:{id:`${z}.detailsStyle.description`,defaultMessage:"GitHub-style (minimal) or Custom (bordered container with a tinted header background) for Details blocks."},options:[{key:"github",value:"github",metadatas:{intlLabel:{id:`${z}.detailsStyle.github`,defaultMessage:"GitHub (minimal)"}}},{key:"custom",value:"custom",metadatas:{intlLabel:{id:`${z}.detailsStyle.custom`,defaultMessage:"Custom (bordered + background)"}}}]}]},{sectionTitle:{id:`${z}.section.button-settings`,defaultMessage:"Button Settings"},items:[{name:"options.buttonDefaultBackgroundColor",type:"text",placeholder:{id:`${z}.buttonDefaultBackgroundColor.placeholder`,defaultMessage:"#4945ff"},intlLabel:{id:`${z}.buttonDefaultBackgroundColor`,defaultMessage:"Default button background color"},description:{id:`${z}.buttonDefaultBackgroundColor.description`,defaultMessage:"Background color applied to newly inserted buttons (hex, e.g. #4945ff)."}},{name:"options.buttonDefaultTextColor",type:"text",placeholder:{id:`${z}.buttonDefaultTextColor.placeholder`,defaultMessage:"#ffffff"},intlLabel:{id:`${z}.buttonDefaultTextColor`,defaultMessage:"Default button text color"},description:{id:`${z}.buttonDefaultTextColor.description`,defaultMessage:"Text color applied to newly inserted buttons (hex, e.g. #ffffff)."}}]}],validator:t=>{const{disableDefaultColors:n=!1,disableDefaultBgColors:r=!1}=t[2].modifiedData.options||{},s=u=>{const h=new Set(u);return u.length!==h.size},a=u=>{if(!u)return!0;const h=u.split(`
1933
- `),f=/^[a-zA-Z]+(?:\s+[a-zA-Z]+)*:(?:[a-zA-Z][-a-zA-Z0-9]*|#[0-9A-Fa-f]+)$/;return!(h.some(g=>!g||g.trim()==="")||!h.every(g=>f.test(g))||s(h))},i={required:"This field is required",badStringFormat:'Each line must be in format "Label:#HEX" (no duplicates allowed)'},l=n?Jt().required(i.required):Jt().optional(),c=r?Jt().required(i.required):Jt().optional();return{customColorsPresets:l.test("customColorsPresets",{id:"error.customColorsPresets",defaultMessage:i.badStringFormat},a),customBgColorsPresets:c.test("customBgColorsPresets",{id:"error.customBgColorsPresets",defaultMessage:i.badStringFormat},a)}}}})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>{try{const{default:n}=await pc(Object.assign({"./translations/en.json":()=>Promise.resolve().then(()=>require("../_chunks/en-BcPniuRQ.js"))}),`./translations/${t}.json`,3);return{data:n,locale:t}}catch{return{data:{},locale:t}}}))}};module.exports=FC;
1933
+ `),f=/^[a-zA-Z]+(?:\s+[a-zA-Z]+)*:(?:[a-zA-Z][-a-zA-Z0-9]*|#[0-9A-Fa-f]+)$/;return!(h.some(g=>!g||g.trim()==="")||!h.every(g=>f.test(g))||s(h))},i={required:"This field is required",badStringFormat:'Each line must be in format "Label:#HEX" (no duplicates allowed)'},l=n?Qt().required(i.required):Qt().optional(),c=r?Qt().required(i.required):Qt().optional();return{customColorsPresets:l.test("customColorsPresets",{id:"error.customColorsPresets",defaultMessage:i.badStringFormat},a),customBgColorsPresets:c.test("customBgColorsPresets",{id:"error.customBgColorsPresets",defaultMessage:i.badStringFormat},a)}}}})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>{try{const{default:n}=await mc(Object.assign({"./translations/en.json":()=>Promise.resolve().then(()=>require("../_chunks/en-BcPniuRQ.js"))}),`./translations/${t}.json`,3);return{data:n,locale:t}}catch{return{data:{},locale:t}}}))}};exports.clearRegisteredBlocks=xg;exports.default=zC;exports.getRegisteredBlocks=Ct;exports.registerBlock=yg;