@qkix/strapi-plugin-better-blocks 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +795 -0
  3. package/dist/_chunks/en-BcPniuRQ.js +1 -0
  4. package/dist/_chunks/en-DYxpcVy9.mjs +4 -0
  5. package/dist/admin/index.js +1933 -0
  6. package/dist/admin/index.mjs +17091 -0
  7. package/dist/admin/src/components/BlocksInput/Blocks/Audio.d.ts +6 -0
  8. package/dist/admin/src/components/BlocksInput/Blocks/AudioEditorModal.d.ts +21 -0
  9. package/dist/admin/src/components/BlocksInput/Blocks/Button.d.ts +11 -0
  10. package/dist/admin/src/components/BlocksInput/Blocks/ButtonEditorModal.d.ts +17 -0
  11. package/dist/admin/src/components/BlocksInput/Blocks/Callout.d.ts +21 -0
  12. package/dist/admin/src/components/BlocksInput/Blocks/Code.d.ts +18 -0
  13. package/dist/admin/src/components/BlocksInput/Blocks/Details.d.ts +12 -0
  14. package/dist/admin/src/components/BlocksInput/Blocks/Diagram.d.ts +15 -0
  15. package/dist/admin/src/components/BlocksInput/Blocks/Embed.d.ts +22 -0
  16. package/dist/admin/src/components/BlocksInput/Blocks/EmbedEditorModal.d.ts +27 -0
  17. package/dist/admin/src/components/BlocksInput/Blocks/Heading.d.ts +14 -0
  18. package/dist/admin/src/components/BlocksInput/Blocks/HorizontalLine.d.ts +10 -0
  19. package/dist/admin/src/components/BlocksInput/Blocks/Image.d.ts +5 -0
  20. package/dist/admin/src/components/BlocksInput/Blocks/Link.d.ts +3 -0
  21. package/dist/admin/src/components/BlocksInput/Blocks/List.d.ts +3 -0
  22. package/dist/admin/src/components/BlocksInput/Blocks/Math.d.ts +17 -0
  23. package/dist/admin/src/components/BlocksInput/Blocks/MediaEmbed.d.ts +7 -0
  24. package/dist/admin/src/components/BlocksInput/Blocks/Paragraph.d.ts +3 -0
  25. package/dist/admin/src/components/BlocksInput/Blocks/Quote.d.ts +3 -0
  26. package/dist/admin/src/components/BlocksInput/Blocks/SocialEmbed.d.ts +8 -0
  27. package/dist/admin/src/components/BlocksInput/Blocks/SocialEmbedEditorModal.d.ts +41 -0
  28. package/dist/admin/src/components/BlocksInput/Blocks/SourceEditorModal.d.ts +19 -0
  29. package/dist/admin/src/components/BlocksInput/Blocks/Table.d.ts +14 -0
  30. package/dist/admin/src/components/BlocksInput/Blocks/TableGridPicker.d.ts +20 -0
  31. package/dist/admin/src/components/BlocksInput/Blocks/TableIcons.d.ts +31 -0
  32. package/dist/admin/src/components/BlocksInput/Blocks/TableToolbar.d.ts +14 -0
  33. package/dist/admin/src/components/BlocksInput/Blocks/Video.d.ts +6 -0
  34. package/dist/admin/src/components/BlocksInput/Blocks/VideoEditorModal.d.ts +29 -0
  35. package/dist/admin/src/components/BlocksInput/Blocks/embedProviders.d.ts +43 -0
  36. package/dist/admin/src/components/BlocksInput/Blocks/muxClient.d.ts +40 -0
  37. package/dist/admin/src/components/BlocksInput/Blocks/socialFrame.d.ts +13 -0
  38. package/dist/admin/src/components/BlocksInput/Blocks/tableGrid.d.ts +90 -0
  39. package/dist/admin/src/components/BlocksInput/Blocks/tableOperations.d.ts +124 -0
  40. package/dist/admin/src/components/BlocksInput/Blocks/videoProviders.d.ts +37 -0
  41. package/dist/admin/src/components/BlocksInput/BlocksContent.d.ts +7 -0
  42. package/dist/admin/src/components/BlocksInput/BlocksEditor.d.ts +71 -0
  43. package/dist/admin/src/components/BlocksInput/BlocksToolbar.d.ts +27 -0
  44. package/dist/admin/src/components/BlocksInput/EditorLayout.d.ts +10 -0
  45. package/dist/admin/src/components/BlocksInput/EmojiPicker.d.ts +5 -0
  46. package/dist/admin/src/components/BlocksInput/FindReplace.d.ts +11 -0
  47. package/dist/admin/src/components/BlocksInput/FloatingSelectionToolbar.d.ts +11 -0
  48. package/dist/admin/src/components/BlocksInput/FontModifiersIcons.d.ts +32 -0
  49. package/dist/admin/src/components/BlocksInput/InlineColorPicker.d.ts +3 -0
  50. package/dist/admin/src/components/BlocksInput/MenuScrollbar.d.ts +30 -0
  51. package/dist/admin/src/components/BlocksInput/Modifiers.d.ts +16 -0
  52. package/dist/admin/src/components/BlocksInput/SlashCommands.d.ts +3 -0
  53. package/dist/admin/src/components/BlocksInput/SpecialCharPicker.d.ts +5 -0
  54. package/dist/admin/src/components/BlocksInput/WordCount.d.ts +3 -0
  55. package/dist/admin/src/components/BlocksInput/plugins/withAutoTransform.d.ts +3 -0
  56. package/dist/admin/src/components/BlocksInput/plugins/withLinks.d.ts +8 -0
  57. package/dist/admin/src/components/BlocksInput/plugins/withMarkdownPaste.d.ts +3 -0
  58. package/dist/admin/src/components/BlocksInput/plugins/withStrapiSchema.d.ts +6 -0
  59. package/dist/admin/src/components/BlocksInput/utils/constants.d.ts +13 -0
  60. package/dist/admin/src/components/BlocksInput/utils/conversions.d.ts +14 -0
  61. package/dist/admin/src/components/BlocksInput/utils/enterKey.d.ts +6 -0
  62. package/dist/admin/src/components/BlocksInput/utils/links.d.ts +12 -0
  63. package/dist/admin/src/components/BlocksInput/utils/optionsDefaults.d.ts +28 -0
  64. package/dist/admin/src/components/BlocksInput/utils/optionsParser.d.ts +34 -0
  65. package/dist/admin/src/components/BlocksInput/utils/parseMarkdownToSlate.d.ts +2 -0
  66. package/dist/admin/src/components/BlocksInput/utils/prefixFileUrlWithBackendUrl.d.ts +8 -0
  67. package/dist/admin/src/components/BlocksInput/utils/shiki.d.ts +29 -0
  68. package/dist/admin/src/components/BlocksInput/utils/shortcuts.d.ts +25 -0
  69. package/dist/admin/src/components/BlocksInput/utils/types.d.ts +404 -0
  70. package/dist/admin/src/components/Initializer.d.ts +5 -0
  71. package/dist/admin/src/components/Input.d.ts +45 -0
  72. package/dist/admin/src/components/PluginIcon.d.ts +3 -0
  73. package/dist/admin/src/hooks/useDragAndDrop.d.ts +51 -0
  74. package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +14 -0
  75. package/dist/admin/src/index.d.ts +10 -0
  76. package/dist/admin/src/pages/App.d.ts +3 -0
  77. package/dist/admin/src/pages/HomePage.d.ts +3 -0
  78. package/dist/admin/src/pluginId.d.ts +1 -0
  79. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  80. package/dist/server/index.js +1 -0
  81. package/dist/server/index.mjs +393 -0
  82. package/dist/server/src/bootstrap.d.ts +5 -0
  83. package/dist/server/src/config/index.d.ts +94 -0
  84. package/dist/server/src/content-types/index.d.ts +2 -0
  85. package/dist/server/src/controllers/controller.d.ts +12 -0
  86. package/dist/server/src/controllers/index.d.ts +14 -0
  87. package/dist/server/src/controllers/oembed.d.ts +12 -0
  88. package/dist/server/src/destroy.d.ts +5 -0
  89. package/dist/server/src/index.d.ts +125 -0
  90. package/dist/server/src/middlewares/index.d.ts +2 -0
  91. package/dist/server/src/policies/index.d.ts +2 -0
  92. package/dist/server/src/register.d.ts +5 -0
  93. package/dist/server/src/routes/admin.d.ts +9 -0
  94. package/dist/server/src/routes/content-api.d.ts +9 -0
  95. package/dist/server/src/routes/index.d.ts +25 -0
  96. package/dist/server/src/services/index.d.ts +14 -0
  97. package/dist/server/src/services/oembed.d.ts +27 -0
  98. package/dist/server/src/services/service.d.ts +7 -0
  99. package/package.json +131 -0
@@ -0,0 +1,1933 @@
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(`
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`
4
+ border-radius: ${({theme:e})=>e.borderRadius};
5
+ background-color: ${({theme:e})=>e.colors.neutral150};
6
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
7
+ max-width: 100%;
8
+ overflow: auto;
9
+ /* Extra top padding leaves room for the language pill in the top-right. */
10
+ padding: ${({theme:e})=>`${e.spaces[6]} ${e.spaces[4]} ${e.spaces[3]}`};
11
+ flex-shrink: 1;
12
+
13
+ & > code {
14
+ font-family:
15
+ 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo,
16
+ Consolas, monospace;
17
+ color: ${({theme:e})=>e.colors.neutral800};
18
+ overflow: auto;
19
+ max-width: 100%;
20
+ }
21
+ `,Cc=b.styled(p.Box)`
22
+ position: absolute;
23
+ top: ${({theme:e})=>e.spaces[1]};
24
+ right: ${({theme:e})=>e.spaces[1]};
25
+ z-index: 1;
26
+
27
+ /* Shrink the inner select so it reads as a compact, colored badge. */
28
+ button {
29
+ background: ${({theme:e})=>e.colors.primary100};
30
+ border-color: ${({theme:e})=>e.colors.primary200};
31
+ color: ${({theme:e})=>e.colors.primary600};
32
+ }
33
+
34
+ span,
35
+ svg {
36
+ color: ${({theme:e})=>e.colors.primary600};
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"})`
39
+ font-size: 4.2rem;
40
+ line-height: ${({theme:e})=>e.lineHeights[1]};
41
+ `,Ic=b.styled(p.Typography).attrs({tag:"h2"})`
42
+ font-size: 3.5rem;
43
+ line-height: ${({theme:e})=>e.lineHeights[1]};
44
+ `,Rc=b.styled(p.Typography).attrs({tag:"h3"})`
45
+ font-size: 2.9rem;
46
+ line-height: ${({theme:e})=>e.lineHeights[1]};
47
+ `,Bc=b.styled(p.Typography).attrs({tag:"h4"})`
48
+ font-size: 2.4rem;
49
+ line-height: ${({theme:e})=>e.lineHeights[1]};
50
+ `,Fc=b.styled(p.Typography).attrs({tag:"h5"})`
51
+ font-size: 2rem;
52
+ line-height: ${({theme:e})=>e.lineHeights[1]};
53
+ `,Dc=b.styled(p.Typography).attrs({tag:"h6"})`
54
+ font-size: 1.6rem;
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`
57
+ width: 100%;
58
+ padding: ${({theme:e})=>e.spaces[2]} 0;
59
+ cursor: pointer;
60
+ user-select: none;
61
+
62
+ hr {
63
+ border: none;
64
+ border-top: 2px solid ${({theme:e})=>e.colors.neutral200};
65
+ margin: 0;
66
+ }
67
+
68
+ &[data-selected='true'] hr {
69
+ border-top-color: ${({theme:e})=>e.colors.primary600};
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`
72
+ margin: ${({theme:e})=>e.spaces[2]} 0;
73
+ text-align: ${({$align:e})=>e};
74
+ display: flex;
75
+ flex-direction: column;
76
+ align-items: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":"center"};
77
+ `,zc=b.styled(p.Flex)`
78
+ transition-property: box-shadow;
79
+ transition-duration: 0.2s;
80
+ ${e=>e.$isFocused&&b.css`
81
+ box-shadow: ${e.theme.colors.primary600} 0px 0px 0px 3px;
82
+ `}
83
+
84
+ & > img {
85
+ height: auto;
86
+ max-height: calc(512px - 56px);
87
+ max-width: 100%;
88
+ object-fit: contain;
89
+ }
90
+ `,Hc=b.styled.figcaption`
91
+ margin-top: ${({theme:e})=>e.spaces[2]};
92
+ font-size: ${({theme:e})=>e.fontSizes[1]};
93
+ color: ${({theme:e})=>e.colors.neutral600};
94
+ text-align: center;
95
+ width: 100%;
96
+ border: none;
97
+ outline: none;
98
+ padding: ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[2]};
99
+
100
+ &:empty::before {
101
+ content: 'Add a caption...';
102
+ color: ${({theme:e})=>e.colors.neutral400};
103
+ }
104
+ `,Da=b.styled(p.Flex)`
105
+ position: absolute;
106
+ top: 4px;
107
+ right: 4px;
108
+ z-index: 1;
109
+ opacity: 0;
110
+ transition: opacity 0.2s;
111
+ `,Uc=b.styled.button`
112
+ background: ${({theme:e,$active:t})=>t?e.colors.primary600:"rgba(0,0,0,0.6)"};
113
+ border: none;
114
+ color: white;
115
+ padding: 3px 8px;
116
+ cursor: pointer;
117
+ font-size: 11px;
118
+ border-radius: 3px;
119
+
120
+ &:hover {
121
+ background: ${({theme:e})=>e.colors.primary600};
122
+ }
123
+ `,Wc=b.styled.div`
124
+ position: relative;
125
+
126
+ &:hover ${Da} {
127
+ opacity: 1;
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)`
130
+ max-width: 640px;
131
+ width: 90vw;
132
+ `,cd=b.styled.div`
133
+ display: flex;
134
+ flex-direction: column;
135
+ gap: ${({theme:e})=>e.spaces[4]};
136
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
137
+ ${({theme:e})=>e.spaces[6]};
138
+ max-height: 70vh;
139
+ overflow: auto;
140
+ `,ur=b.styled.input`
141
+ width: 100%;
142
+ box-sizing: border-box;
143
+ min-height: 40px;
144
+ padding: 0 ${({theme:e})=>e.spaces[3]};
145
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
146
+ border-radius: ${({theme:e})=>e.borderRadius};
147
+ font-size: 14px;
148
+ color: ${({theme:e})=>e.colors.neutral800};
149
+ background: ${({theme:e})=>e.colors.neutral0};
150
+ `,dd=b.styled.select`
151
+ min-height: 40px;
152
+ padding: 0 ${({theme:e})=>e.spaces[3]};
153
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
154
+ border-radius: ${({theme:e})=>e.borderRadius};
155
+ font-size: 14px;
156
+ color: ${({theme:e})=>e.colors.neutral800};
157
+ background: ${({theme:e})=>e.colors.neutral0};
158
+ `,ud=b.styled.div`
159
+ display: inline-flex;
160
+ align-self: flex-start;
161
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
162
+ border-radius: ${({theme:e})=>e.borderRadius};
163
+ overflow: hidden;
164
+ `,pd=b.styled.button`
165
+ min-width: 84px;
166
+ min-height: 34px;
167
+ padding: 0 ${({theme:e})=>e.spaces[3]};
168
+ border: none;
169
+ border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
170
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral0};
171
+ color: ${({$active:e,theme:t})=>e?t.colors.neutral0:t.colors.neutral700};
172
+ font-weight: ${({$active:e})=>e?600:400};
173
+ cursor: pointer;
174
+ text-transform: capitalize;
175
+
176
+ &:first-child {
177
+ border-left: none;
178
+ }
179
+
180
+ &:hover {
181
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral100};
182
+ }
183
+
184
+ /* Keep keyboard focus visible without the input-like ring a plain :focus
185
+ draws around each segment. */
186
+ &:focus {
187
+ outline: none;
188
+ }
189
+ &:focus-visible {
190
+ outline: 2px solid ${({theme:e})=>e.colors.primary600};
191
+ outline-offset: -2px;
192
+ }
193
+ `,pr=b.styled.label`
194
+ display: flex;
195
+ align-items: center;
196
+ gap: ${({theme:e})=>e.spaces[2]};
197
+ cursor: pointer;
198
+ user-select: none;
199
+ `,hd=b.styled.div`
200
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
201
+ border-radius: ${({theme:e})=>e.borderRadius};
202
+ background: ${({theme:e})=>e.colors.neutral100};
203
+ padding: ${({theme:e})=>e.spaces[3]};
204
+ display: flex;
205
+ flex-direction: column;
206
+ gap: ${({theme:e})=>e.spaces[2]};
207
+ `,fd=b.styled.div`
208
+ display: flex;
209
+ align-items: center;
210
+ gap: ${({theme:e})=>e.spaces[2]};
211
+ color: ${({theme:e})=>e.colors.neutral500};
212
+ font-size: 12px;
213
+ text-transform: uppercase;
214
+
215
+ &::before,
216
+ &::after {
217
+ content: '';
218
+ flex: 1;
219
+ height: 1px;
220
+ background: ${({theme:e})=>e.colors.neutral200};
221
+ }
222
+ `,gd=b.styled.audio`
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`
225
+ margin: ${({theme:e})=>e.spaces[2]} 0;
226
+ display: flex;
227
+ justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
228
+ `,wd=b.styled.div`
229
+ display: flex;
230
+ flex-direction: column;
231
+ gap: ${({theme:e})=>e.spaces[2]};
232
+ width: min(100%, 520px);
233
+ cursor: pointer;
234
+ user-select: none;
235
+ padding: ${({theme:e})=>e.spaces[3]};
236
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
237
+ border-left: 4px solid ${({theme:e})=>e.colors.primary600};
238
+ border-radius: ${({theme:e})=>e.borderRadius};
239
+ background: ${({theme:e})=>e.colors.neutral0};
240
+ box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
241
+ `,kd=b.styled(p.Flex)`
242
+ gap: ${({theme:e})=>e.spaces[2]};
243
+ `,jd=b.styled.span`
244
+ display: inline-flex;
245
+ color: ${({theme:e})=>e.colors.primary600};
246
+
247
+ svg {
248
+ width: 18px;
249
+ height: 18px;
250
+ }
251
+ `,$d=b.styled.audio`
252
+ width: 100%;
253
+ `,Ed=b.styled(p.Typography)`
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)`
256
+ width: 95vw;
257
+ height: 95vh;
258
+ max-width: none;
259
+ max-height: none;
260
+ `,Dd=b.styled.div`
261
+ display: flex;
262
+ flex-direction: column;
263
+ flex: 1;
264
+ min-height: 0;
265
+ overflow: auto;
266
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
267
+ ${({theme:e})=>e.spaces[6]};
268
+ `,Ad=b.styled(p.Modal.Footer)`
269
+ flex: 0 0 auto;
270
+ `,_d=b.styled.div`
271
+ flex: 1;
272
+ display: grid;
273
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
274
+ grid-template-rows: minmax(0, 1fr);
275
+ gap: ${({theme:e})=>e.spaces[6]};
276
+ min-height: 360px;
277
+
278
+ @media (max-width: 760px) {
279
+ grid-template-columns: minmax(0, 1fr);
280
+ grid-template-rows: auto auto;
281
+ }
282
+ `,Nd=b.styled.div`
283
+ min-height: 0;
284
+ overflow: auto;
285
+ padding-right: ${({theme:e})=>e.spaces[2]};
286
+ `,Pd=b.styled.div`
287
+ min-height: 0;
288
+ overflow: auto;
289
+ border: 1px solid ${({theme:e})=>e.colors.neutral150};
290
+ border-radius: ${({theme:e})=>e.borderRadius};
291
+ background: ${({theme:e})=>e.colors.neutral100};
292
+ padding: ${({theme:e})=>e.spaces[4]};
293
+ `,Fe=b.styled.input`
294
+ width: 100%;
295
+ box-sizing: border-box;
296
+ /* Match Strapi's SingleSelect height (40px) so inputs and dropdowns line up. */
297
+ min-height: 40px;
298
+ padding: 0 ${({theme:e})=>e.spaces[3]};
299
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
300
+ border-radius: ${({theme:e})=>e.borderRadius};
301
+ background: ${({theme:e})=>e.colors.neutral0};
302
+ color: ${({theme:e})=>e.colors.neutral800};
303
+ font-size: ${({theme:e})=>e.fontSizes[1]};
304
+
305
+ &:focus {
306
+ outline: none;
307
+ border-color: ${({theme:e})=>e.colors.primary600};
308
+ }
309
+ `,hr=b.styled.div`
310
+ display: flex;
311
+ gap: ${({theme:e})=>e.spaces[1]};
312
+ `,fr=b.styled.button`
313
+ flex: 1;
314
+ padding: ${({theme:e})=>e.spaces[2]};
315
+ cursor: pointer;
316
+ font-size: ${({theme:e})=>e.fontSizes[1]};
317
+ border: 1px solid
318
+ ${({theme:e,$active:t})=>t?e.colors.primary600:e.colors.neutral200};
319
+ border-radius: ${({theme:e})=>e.borderRadius};
320
+ background: ${({theme:e,$active:t})=>t?e.colors.primary100:e.colors.neutral0};
321
+ color: ${({theme:e,$active:t})=>t?e.colors.primary600:e.colors.neutral700};
322
+
323
+ &:hover {
324
+ border-color: ${({theme:e})=>e.colors.primary600};
325
+ }
326
+ `,Ld=b.styled.input`
327
+ width: 40px;
328
+ height: 40px;
329
+ flex-shrink: 0;
330
+ padding: 0;
331
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
332
+ border-radius: ${({theme:e})=>e.borderRadius};
333
+ background: ${({theme:e})=>e.colors.neutral0};
334
+ cursor: pointer;
335
+ `,Od=b.styled(Fe)`
336
+ flex: 1;
337
+ `,zd=b.styled.button`
338
+ border: none;
339
+ background: transparent;
340
+ color: ${({theme:e})=>e.colors.neutral500};
341
+ cursor: pointer;
342
+ font-size: ${({theme:e})=>e.fontSizes[1]};
343
+ text-decoration: underline;
344
+
345
+ &:hover {
346
+ color: ${({theme:e})=>e.colors.danger600};
347
+ }
348
+ `,Hd=b.styled(p.Flex)`
349
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
350
+ border-radius: ${({theme:e})=>e.borderRadius};
351
+ background: ${({theme:e})=>e.colors.neutral100};
352
+ padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[3]};
353
+ `,Ud=b.styled.a`
354
+ display: inline-flex;
355
+ align-items: center;
356
+ gap: 8px;
357
+ text-decoration: none;
358
+ cursor: pointer;
359
+ transition:
360
+ background-color 0.15s,
361
+ color 0.15s;
362
+ background-color: ${({$bg:e})=>e||"#4945ff"};
363
+ color: ${({$text:e})=>e||"#ffffff"};
364
+ border-radius: ${({$radius:e})=>e||"4px"};
365
+ font-size: ${({$fontSize:e})=>e||"16px"};
366
+ font-weight: ${({$fontWeight:e})=>e||"600"};
367
+ padding: ${({$padding:e})=>e||"12px 24px"};
368
+ border: ${({$border:e})=>e||"none"};
369
+
370
+ &:hover {
371
+ ${({$hoverBg:e})=>e?`background-color: ${e};`:""}
372
+ ${({$hoverText:e})=>e?`color: ${e};`:""}
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`
375
+ margin: ${({theme:e})=>e.spaces[2]} 0;
376
+ `,tu=b.styled.span`
377
+ display: inline-flex;
378
+ align-items: center;
379
+ gap: 8px;
380
+ cursor: pointer;
381
+ user-select: none;
382
+ transition:
383
+ background-color 0.15s,
384
+ color 0.15s,
385
+ box-shadow 0.15s;
386
+ background-color: ${({$bg:e})=>e||"#4945ff"};
387
+ color: ${({$text:e})=>e||"#ffffff"};
388
+ border-radius: ${({$radius:e})=>e||"4px"};
389
+ font-size: ${({$fontSize:e})=>e||"16px"};
390
+ font-weight: ${({$fontWeight:e})=>e||"600"};
391
+ padding: ${({$padding:e})=>e||"12px 24px"};
392
+ border: ${({$border:e})=>e||"none"};
393
+ box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
394
+
395
+ &:hover {
396
+ ${({$hoverBg:e})=>e?`background-color: ${e};`:""}
397
+ ${({$hoverText:e})=>e?`color: ${e};`:""}
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)`
400
+ text-decoration: none;
401
+ `,iu=b.styled(p.Button)`
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`
404
+ display: flex;
405
+ flex-direction: column;
406
+ gap: ${({theme:e})=>e.spaces[2]};
407
+ margin-inline-start: ${({theme:e})=>e.spaces[0]};
408
+ margin-inline-end: ${({theme:e})=>e.spaces[0]};
409
+ padding-inline-start: ${({theme:e})=>e.spaces[2]};
410
+
411
+ ol,
412
+ ul {
413
+ margin-block-start: ${({theme:e})=>e.spaces[0]};
414
+ margin-block-end: ${({theme:e})=>e.spaces[0]};
415
+ }
416
+
417
+ li {
418
+ margin-inline-start: ${({theme:e})=>e.spaces[3]};
419
+ }
420
+ `,uu=b.styled.ol`
421
+ list-style-type: ${e=>e.$listStyleType};
422
+ ${Oa}
423
+ `,pu=b.styled.ul`
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`
427
+ list-style-type: none;
428
+ display: flex;
429
+ flex-direction: column;
430
+ gap: ${({theme:e})=>e.spaces[2]};
431
+ margin-inline-start: ${({theme:e})=>e.spaces[0]};
432
+ margin-inline-end: ${({theme:e})=>e.spaces[0]};
433
+ padding-inline-start: ${({theme:e})=>e.spaces[2]};
434
+ `,mu=b.styled.li`
435
+ display: flex;
436
+ align-items: flex-start;
437
+ gap: ${({theme:e})=>e.spaces[2]};
438
+ list-style: none;
439
+ margin-inline-start: 0;
440
+
441
+ & > span:last-child {
442
+ flex: 1;
443
+ text-decoration: ${({$checked:e})=>e?"line-through":"none"};
444
+ opacity: ${({$checked:e})=>e?.6:1};
445
+ }
446
+ `,bu=b.styled.input.attrs({type:"checkbox"})`
447
+ margin-top: 4px;
448
+ cursor: pointer;
449
+ width: 16px;
450
+ height: 16px;
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`
453
+ margin: ${({theme:e})=>e.spaces[3]} 0;
454
+ padding: ${({theme:e})=>e.spaces[3]} ${({theme:e})=>e.spaces[4]};
455
+ border-radius: ${({theme:e})=>e.borderRadius};
456
+ border-left: 4px solid
457
+ ${({theme:e,$family:t})=>Ve(e,$t(t))};
458
+ background: ${({theme:e,$family:t})=>Ve(e,Ua(t))};
459
+ `,ju=b.styled.div`
460
+ display: inline-flex;
461
+ align-items: center;
462
+ gap: ${({theme:e})=>e.spaces[2]};
463
+ margin-bottom: ${({theme:e})=>e.spaces[2]};
464
+ cursor: pointer;
465
+ user-select: none;
466
+ color: ${({theme:e,$family:t})=>Ve(e,$t(t))};
467
+ font-weight: ${({theme:e})=>e.fontWeights.bold};
468
+
469
+ svg {
470
+ width: 16px;
471
+ height: 16px;
472
+ }
473
+ svg path {
474
+ fill: ${({theme:e,$family:t})=>Ve(e,$t(t))};
475
+ }
476
+ `,$u=b.styled.div`
477
+ & > *:first-child {
478
+ margin-top: 0;
479
+ }
480
+ & > *:last-child {
481
+ margin-bottom: 0;
482
+ }
483
+ `,Eu=b.styled.button`
484
+ display: flex;
485
+ align-items: center;
486
+ gap: ${({theme:e})=>e.spaces[2]};
487
+ width: 100%;
488
+ padding: ${({theme:e})=>e.spaces[2]};
489
+ border: 1px solid
490
+ ${({theme:e,$family:t,$active:n})=>n?Ve(e,$t(t)):e.colors.neutral200};
491
+ border-radius: ${({theme:e})=>e.borderRadius};
492
+ background: ${({theme:e,$family:t,$active:n})=>n?Ve(e,Ua(t)):e.colors.neutral0};
493
+ color: ${({theme:e})=>e.colors.neutral800};
494
+ cursor: pointer;
495
+ font-size: ${({theme:e})=>e.fontSizes[1]};
496
+
497
+ svg {
498
+ width: 16px;
499
+ height: 16px;
500
+ }
501
+ svg path {
502
+ fill: ${({theme:e,$family:t})=>Ve(e,$t(t))};
503
+ }
504
+
505
+ &:hover {
506
+ border-color: ${({theme:e,$family:t})=>Ve(e,$t(t))};
507
+ }
508
+ `,Cu=b.styled.input`
509
+ width: 100%;
510
+ padding: ${({theme:e})=>e.spaces[2]};
511
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
512
+ border-radius: ${({theme:e})=>e.borderRadius};
513
+ background: ${({theme:e})=>e.colors.neutral0};
514
+ color: ${({theme:e})=>e.colors.neutral800};
515
+ font-size: ${({theme:e})=>e.fontSizes[1]};
516
+
517
+ &:focus {
518
+ outline: none;
519
+ border-color: ${({theme:e})=>e.colors.primary600};
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`
522
+ margin: ${({theme:e})=>e.spaces[3]} 0;
523
+ ${({theme:e,$style:t})=>t==="custom"?`
524
+ border: 1px solid ${e.colors.neutral200};
525
+ border-radius: ${e.borderRadius};
526
+ overflow: hidden;
527
+ `:""}
528
+ `,Fu=b.styled.div`
529
+ display: flex;
530
+ align-items: center;
531
+ gap: ${({theme:e})=>e.spaces[1]};
532
+ cursor: pointer;
533
+ user-select: none;
534
+ font-weight: ${({theme:e})=>e.fontWeights.semiBold};
535
+ color: ${({theme:e})=>e.colors.neutral800};
536
+
537
+ ${({theme:e,$style:t,$open:n})=>t==="custom"?`
538
+ padding: ${e.spaces[2]} ${e.spaces[3]};
539
+ background: ${e.colors.neutral100};
540
+ ${n?`border-bottom: 1px solid ${e.colors.neutral200};`:""}
541
+ `:`
542
+ padding: ${e.spaces[1]} 0;
543
+ `}
544
+ `,Du=b.styled.button`
545
+ display: inline-flex;
546
+ align-items: center;
547
+ justify-content: center;
548
+ border: none;
549
+ background: transparent;
550
+ padding: 0;
551
+ cursor: pointer;
552
+ color: inherit;
553
+ flex-shrink: 0;
554
+
555
+ svg {
556
+ width: 10px;
557
+ height: 10px;
558
+ transition: transform 0.2s ease;
559
+ transform: rotate(${({$open:e})=>e?"0deg":"-90deg"});
560
+ }
561
+ svg path {
562
+ fill: ${({theme:e})=>e.colors.neutral600};
563
+ }
564
+ `,Au=b.styled.span`
565
+ flex: 1;
566
+ text-align: left;
567
+ border: none;
568
+ background: transparent;
569
+ padding: 0;
570
+ margin: 0;
571
+ font: inherit;
572
+ font-weight: inherit;
573
+ color: inherit;
574
+ cursor: pointer;
575
+ `,_u=b.styled.div`
576
+ display: grid;
577
+ grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
578
+ transition: grid-template-rows 0.2s ease;
579
+ `,Nu=b.styled.div`
580
+ overflow: hidden;
581
+ min-height: 0;
582
+ `,Pu=b.styled.div`
583
+ padding: ${({theme:e,$style:t})=>t==="custom"?`${e.spaces[3]}`:`${e.spaces[2]} 0 ${e.spaces[2]} ${e.spaces[5]}`};
584
+
585
+ & > *:first-child {
586
+ margin-top: 0;
587
+ }
588
+ & > *:last-child {
589
+ margin-bottom: 0;
590
+ }
591
+ `,Lu=b.styled.input`
592
+ width: 100%;
593
+ padding: ${({theme:e})=>e.spaces[2]};
594
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
595
+ border-radius: ${({theme:e})=>e.borderRadius};
596
+ background: ${({theme:e})=>e.colors.neutral0};
597
+ color: ${({theme:e})=>e.colors.neutral800};
598
+ font-size: ${({theme:e})=>e.fontSizes[1]};
599
+
600
+ &:focus {
601
+ outline: none;
602
+ border-color: ${({theme:e})=>e.colors.primary600};
603
+ }
604
+ `,ts=b.styled.button`
605
+ flex: 1;
606
+ padding: ${({theme:e})=>e.spaces[2]};
607
+ border: 1px solid
608
+ ${({theme:e,$active:t})=>t?e.colors.primary600:e.colors.neutral200};
609
+ border-radius: ${({theme:e})=>e.borderRadius};
610
+ background: ${({theme:e,$active:t})=>t?e.colors.primary100:e.colors.neutral0};
611
+ color: ${({theme:e,$active:t})=>t?e.colors.primary600:e.colors.neutral800};
612
+ cursor: pointer;
613
+ font-size: ${({theme:e})=>e.fontSizes[1]};
614
+
615
+ &:hover {
616
+ border-color: ${({theme:e})=>e.colors.primary600};
617
+ }
618
+ `,Ou=b.styled.button`
619
+ position: relative;
620
+ width: 40px;
621
+ height: 22px;
622
+ flex-shrink: 0;
623
+ border: none;
624
+ border-radius: 999px;
625
+ padding: 0;
626
+ cursor: pointer;
627
+ background: ${({theme:e,$on:t})=>t?e.colors.primary600:e.colors.neutral200};
628
+ transition: background 0.15s ease;
629
+ `,zu=b.styled.span`
630
+ position: absolute;
631
+ top: 2px;
632
+ left: ${({$on:e})=>e?"20px":"2px"};
633
+ width: 18px;
634
+ height: 18px;
635
+ border-radius: 50%;
636
+ background: ${({theme:e})=>e.colors.neutral0};
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)`
639
+ width: 95vw;
640
+ height: 95vh;
641
+ max-width: none;
642
+ max-height: none;
643
+ `,Gu=b.styled.div`
644
+ display: flex;
645
+ flex-direction: column;
646
+ flex: 1;
647
+ min-height: 0;
648
+ /* Scroll the whole body if the viewport is too short to hold the panes. */
649
+ overflow: auto;
650
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
651
+ ${({theme:e})=>e.spaces[6]};
652
+ `,Vu=b.styled(p.Modal.Footer)`
653
+ flex: 0 0 auto;
654
+ `,qu=b.styled.div`
655
+ flex: 1;
656
+ display: grid;
657
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
658
+ grid-template-rows: minmax(0, 1fr);
659
+ gap: ${({theme:e})=>e.spaces[4]};
660
+ min-height: 360px;
661
+
662
+ @media (max-width: 700px) {
663
+ grid-template-columns: minmax(0, 1fr);
664
+ grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
665
+ }
666
+ `,ns=b.styled(p.Flex)`
667
+ min-height: 0;
668
+ min-width: 0;
669
+ `,Xu=b.styled.textarea`
670
+ flex: 1;
671
+ width: 100%;
672
+ min-height: 200px;
673
+ resize: none;
674
+ font-family:
675
+ 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
676
+ font-size: ${({theme:e})=>e.fontSizes[1]};
677
+ line-height: 1.5;
678
+ padding: ${({theme:e})=>e.spaces[2]};
679
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
680
+ border-radius: ${({theme:e})=>e.borderRadius};
681
+ background: ${({theme:e})=>e.colors.neutral0};
682
+ color: ${({theme:e})=>e.colors.neutral800};
683
+
684
+ &:focus {
685
+ outline: none;
686
+ border-color: ${({theme:e})=>e.colors.primary600};
687
+ }
688
+ `,Yu=b.styled.div`
689
+ flex: 1;
690
+ overflow: auto;
691
+ border: 1px solid ${({theme:e})=>e.colors.neutral150};
692
+ border-radius: ${({theme:e})=>e.borderRadius};
693
+ background: ${({theme:e})=>e.colors.neutral100};
694
+ `,Zu=b.styled.div`
695
+ zoom: ${({$scale:e})=>e};
696
+ display: flex;
697
+ /* The safe keyword keeps the start edge reachable (not clipped) when content
698
+ overflows and the parent scrolls. */
699
+ align-items: safe center;
700
+ justify-content: safe center;
701
+ min-height: 100%;
702
+ padding: ${({theme:e})=>e.spaces[3]};
703
+ text-align: center;
704
+
705
+ /* The rendered output is wrapped in a single span (Mermaid SVG or KaTeX).
706
+ Let it fill the pane width so diagrams aren't tiny by default. */
707
+ > span {
708
+ width: 100%;
709
+ }
710
+
711
+ /* Size ONLY the Mermaid diagram SVG (rendered as a direct span > svg).
712
+ KaTeX renders radicals (e.g. √) as inline <svg> deep inside .katex; forcing
713
+ a size on those collapses them, so they must keep their intrinsic size. */
714
+ > span > svg {
715
+ width: 100%;
716
+ max-width: 100%;
717
+ height: auto;
718
+ }
719
+
720
+ /* Enlarge math so integrals/fractions are clearly legible in the preview.
721
+ Scoped to KaTeX so diagram SVGs are unaffected. */
722
+ .katex {
723
+ font-size: 2.4rem;
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`
726
+ margin: ${({theme:e})=>e.spaces[2]} 0;
727
+ padding: ${({theme:e})=>e.spaces[4]};
728
+ text-align: center;
729
+ cursor: pointer;
730
+ border-radius: ${({theme:e})=>e.borderRadius};
731
+ border: 1px solid
732
+ ${({theme:e,$selected:t})=>t?e.colors.primary600:e.colors.neutral200};
733
+ background: ${({theme:e})=>e.colors.neutral100};
734
+ color: ${({theme:e,$empty:t})=>t?e.colors.neutral500:e.colors.neutral800};
735
+ overflow-x: auto;
736
+
737
+ svg {
738
+ max-width: 100%;
739
+ height: auto;
740
+ }
741
+
742
+ &:hover {
743
+ border-color: ${({theme:e})=>e.colors.primary600};
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`
747
+ margin: ${({theme:e})=>e.spaces[2]} 0;
748
+ padding: ${({theme:e})=>e.spaces[4]};
749
+ text-align: center;
750
+ cursor: pointer;
751
+ border-radius: ${({theme:e})=>e.borderRadius};
752
+ border: 1px solid
753
+ ${({theme:e,$selected:t})=>t?e.colors.primary600:e.colors.neutral200};
754
+ background: ${({theme:e})=>e.colors.neutral100};
755
+ color: ${({theme:e,$empty:t})=>t?e.colors.neutral500:e.colors.neutral800};
756
+ overflow-x: auto;
757
+
758
+ &:hover {
759
+ border-color: ${({theme:e})=>e.colors.primary600};
760
+ }
761
+ `,op=b.styled.span`
762
+ display: inline-block;
763
+ vertical-align: middle;
764
+ padding: 0 ${({theme:e})=>e.spaces[1]};
765
+ margin: 0 1px;
766
+ cursor: pointer;
767
+ border-radius: ${({theme:e})=>e.borderRadius};
768
+ background: ${({theme:e,$selected:t})=>t?e.colors.primary100:e.colors.neutral100};
769
+ color: ${({theme:e,$empty:t})=>t?e.colors.neutral500:e.colors.neutral800};
770
+
771
+ &:hover {
772
+ background: ${({theme:e})=>e.colors.primary100};
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)`
775
+ max-width: 720px;
776
+ width: 92vw;
777
+ `,mp=b.styled.div`
778
+ display: flex;
779
+ flex-direction: column;
780
+ gap: ${({theme:e})=>e.spaces[4]};
781
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
782
+ ${({theme:e})=>e.spaces[6]};
783
+ max-height: 70vh;
784
+ overflow: auto;
785
+ `,$n=b.styled.input`
786
+ width: 100%;
787
+ box-sizing: border-box;
788
+ min-height: 40px;
789
+ padding: 0 ${({theme:e})=>e.spaces[3]};
790
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
791
+ border-radius: ${({theme:e})=>e.borderRadius};
792
+ font-size: 14px;
793
+ color: ${({theme:e})=>e.colors.neutral800};
794
+ background: ${({theme:e})=>e.colors.neutral0};
795
+ `,bp=b.styled.textarea`
796
+ width: 100%;
797
+ box-sizing: border-box;
798
+ min-height: 120px;
799
+ padding: ${({theme:e})=>e.spaces[3]};
800
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
801
+ border-radius: ${({theme:e})=>e.borderRadius};
802
+ font-family: monospace;
803
+ font-size: 13px;
804
+ line-height: 1.5;
805
+ resize: vertical;
806
+ color: ${({theme:e})=>e.colors.neutral800};
807
+ background: ${({theme:e})=>e.colors.neutral0};
808
+ `,xp=b.styled.select`
809
+ min-height: 40px;
810
+ padding: 0 ${({theme:e})=>e.spaces[3]};
811
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
812
+ border-radius: ${({theme:e})=>e.borderRadius};
813
+ font-size: 14px;
814
+ color: ${({theme:e})=>e.colors.neutral800};
815
+ background: ${({theme:e})=>e.colors.neutral0};
816
+ `,yp=b.styled.div`
817
+ display: inline-flex;
818
+ align-self: flex-start;
819
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
820
+ border-radius: ${({theme:e})=>e.borderRadius};
821
+ overflow: hidden;
822
+ `,vp=b.styled.button`
823
+ min-width: 84px;
824
+ min-height: 34px;
825
+ padding: 0 ${({theme:e})=>e.spaces[3]};
826
+ border: none;
827
+ border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
828
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral0};
829
+ color: ${({$active:e,theme:t})=>e?t.colors.neutral0:t.colors.neutral700};
830
+ font-weight: ${({$active:e})=>e?600:400};
831
+ cursor: pointer;
832
+ text-transform: capitalize;
833
+
834
+ &:first-child {
835
+ border-left: none;
836
+ }
837
+
838
+ &:hover {
839
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral100};
840
+ }
841
+
842
+ &:focus {
843
+ outline: none;
844
+ }
845
+ &:focus-visible {
846
+ outline: 2px solid ${({theme:e})=>e.colors.primary600};
847
+ outline-offset: -2px;
848
+ }
849
+ `,wp=b.styled.div`
850
+ display: flex;
851
+ gap: ${({theme:e})=>e.spaces[4]};
852
+ border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
853
+ `,is=b.styled.button`
854
+ padding: ${({theme:e})=>e.spaces[2]} 0;
855
+ border: none;
856
+ border-bottom: 2px solid
857
+ ${({$active:e,theme:t})=>e?t.colors.primary600:"transparent"};
858
+ background: none;
859
+ cursor: pointer;
860
+ font-size: 14px;
861
+ font-weight: ${({$active:e})=>e?600:400};
862
+ color: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral600};
863
+ `,kp=b.styled.div`
864
+ width: 100%;
865
+ aspect-ratio: ${({$ratio:e})=>e};
866
+ border-radius: ${({theme:e})=>e.borderRadius};
867
+ overflow: hidden;
868
+ background: ${({theme:e})=>e.colors.neutral800};
869
+
870
+ iframe {
871
+ width: 100%;
872
+ height: 100%;
873
+ border: 0;
874
+ display: block;
875
+ }
876
+ `,vr=b.styled(p.Typography)`
877
+ color: ${({theme:e})=>e.colors.neutral500};
878
+ `,jp=b.styled(p.Typography)`
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`
881
+ margin: ${({theme:e})=>e.spaces[2]} 0;
882
+ display: flex;
883
+ justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
884
+ `,Tp=b.styled.div`
885
+ display: flex;
886
+ flex-direction: column;
887
+ gap: ${({theme:e})=>e.spaces[2]};
888
+ width: ${({$full:e})=>e?"100%":"min(100%, 640px)"};
889
+ cursor: pointer;
890
+ user-select: none;
891
+ border-radius: ${({theme:e})=>e.borderRadius};
892
+ box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
893
+ `,Mp=b.styled.div`
894
+ position: relative;
895
+ width: 100%;
896
+ `,Ip=b.styled.div`
897
+ width: 100%;
898
+ aspect-ratio: ${({$ratio:e})=>e};
899
+ border-radius: ${({theme:e})=>e.borderRadius};
900
+ overflow: hidden;
901
+ background: ${({theme:e})=>e.colors.neutral800};
902
+
903
+ iframe {
904
+ width: 100%;
905
+ height: 100%;
906
+ border: 0;
907
+ display: block;
908
+ }
909
+ `,Rp=b.styled.div`
910
+ position: absolute;
911
+ inset: 0;
912
+ `,Bp=b.styled.div`
913
+ position: absolute;
914
+ top: 8px;
915
+ left: 8px;
916
+ background: rgba(0, 0, 0, 0.7);
917
+ color: white;
918
+ padding: 2px 8px;
919
+ border-radius: 4px;
920
+ font-size: 12px;
921
+ font-weight: 600;
922
+ pointer-events: none;
923
+ `,Fp=b.styled(p.Flex)`
924
+ width: min(100%, 640px);
925
+ padding: ${({theme:e})=>e.spaces[4]};
926
+ border: 1px dashed ${({theme:e})=>e.colors.neutral300};
927
+ border-radius: ${({theme:e})=>e.borderRadius};
928
+ background: ${({theme:e})=>e.colors.neutral100};
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)`
931
+ position: relative;
932
+ width: 100%;
933
+ aspect-ratio: 16 / 9;
934
+ margin: ${({theme:e})=>e.spaces[2]} 0;
935
+ border-radius: ${({theme:e})=>e.borderRadius};
936
+ overflow: hidden;
937
+ background: ${({theme:e})=>e.colors.neutral900};
938
+ cursor: default;
939
+ `,Hp=b.styled.img`
940
+ width: 100%;
941
+ height: 100%;
942
+ object-fit: cover;
943
+ opacity: 0.85;
944
+ `,Up=b.styled(p.Flex)`
945
+ position: absolute;
946
+ inset: 0;
947
+ align-items: center;
948
+ justify-content: center;
949
+ pointer-events: none;
950
+ `,Wp=b.styled.div`
951
+ width: 64px;
952
+ height: 64px;
953
+ border-radius: 50%;
954
+ background: rgba(0, 0, 0, 0.7);
955
+ display: flex;
956
+ align-items: center;
957
+ justify-content: center;
958
+
959
+ &::after {
960
+ content: '';
961
+ display: block;
962
+ width: 0;
963
+ height: 0;
964
+ border-style: solid;
965
+ border-width: 12px 0 12px 22px;
966
+ border-color: transparent transparent transparent white;
967
+ margin-left: 4px;
968
+ }
969
+ `,Kp=b.styled.div`
970
+ position: absolute;
971
+ top: 8px;
972
+ left: 8px;
973
+ background: rgba(0, 0, 0, 0.7);
974
+ color: white;
975
+ padding: 2px 8px;
976
+ border-radius: 4px;
977
+ font-size: 12px;
978
+ font-weight: 600;
979
+ `,Gp=b.styled.div`
980
+ position: absolute;
981
+ bottom: 8px;
982
+ left: 8px;
983
+ right: 8px;
984
+ color: rgba(255, 255, 255, 0.8);
985
+ font-size: 11px;
986
+ overflow: hidden;
987
+ text-overflow: ellipsis;
988
+ white-space: nowrap;
989
+ `,Vp=b.styled(p.Flex)`
990
+ width: 100%;
991
+ height: 100%;
992
+ background: ${({theme:e})=>e.colors.neutral200};
993
+ color: ${({theme:e})=>e.colors.neutral600};
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)`
996
+ max-width: 760px;
997
+ width: 90vw;
998
+ `,eh=b.styled.div`
999
+ display: flex;
1000
+ flex-direction: column;
1001
+ gap: ${({theme:e})=>e.spaces[4]};
1002
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
1003
+ ${({theme:e})=>e.spaces[6]};
1004
+ max-height: 70vh;
1005
+ overflow: auto;
1006
+ `,th=b.styled.div`
1007
+ display: grid;
1008
+ grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
1009
+ gap: ${({theme:e})=>e.spaces[2]};
1010
+ `,nh=b.styled.button`
1011
+ display: flex;
1012
+ flex-direction: column;
1013
+ align-items: center;
1014
+ gap: 4px;
1015
+ padding: ${({theme:e})=>e.spaces[2]};
1016
+ border-radius: ${({theme:e})=>e.borderRadius};
1017
+ border: 2px solid
1018
+ ${({$active:e,$color:t,theme:n})=>e?t:n.colors.neutral200};
1019
+ background: ${({$active:e,theme:t})=>e?t.colors.neutral100:t.colors.neutral0};
1020
+ cursor: pointer;
1021
+ font-size: 13px;
1022
+ color: ${({theme:e})=>e.colors.neutral800};
1023
+
1024
+ &:hover {
1025
+ border-color: ${({$color:e})=>e};
1026
+ }
1027
+ `,rh=b.styled.span`
1028
+ font-size: 22px;
1029
+ line-height: 1;
1030
+ `,cs=b.styled.input`
1031
+ width: 100%;
1032
+ box-sizing: border-box;
1033
+ min-height: 40px;
1034
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1035
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1036
+ border-radius: ${({theme:e})=>e.borderRadius};
1037
+ font-size: 14px;
1038
+ color: ${({theme:e})=>e.colors.neutral800};
1039
+ background: ${({theme:e})=>e.colors.neutral0};
1040
+ `,oh=b.styled.textarea`
1041
+ width: 100%;
1042
+ box-sizing: border-box;
1043
+ min-height: 80px;
1044
+ padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[3]};
1045
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1046
+ border-radius: ${({theme:e})=>e.borderRadius};
1047
+ font-size: 13px;
1048
+ font-family: monospace;
1049
+ color: ${({theme:e})=>e.colors.neutral800};
1050
+ background: ${({theme:e})=>e.colors.neutral0};
1051
+ resize: vertical;
1052
+ `,sh=b.styled.div`
1053
+ display: flex;
1054
+ gap: ${({theme:e})=>e.spaces[2]};
1055
+ `,ah=b.styled.button`
1056
+ flex: 1;
1057
+ min-height: 36px;
1058
+ border-radius: ${({theme:e})=>e.borderRadius};
1059
+ border: 1px solid
1060
+ ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral200};
1061
+ background: ${({$active:e,theme:t})=>e?t.colors.primary100:t.colors.neutral0};
1062
+ color: ${({theme:e})=>e.colors.neutral800};
1063
+ cursor: pointer;
1064
+ text-transform: capitalize;
1065
+ `,ih=b.styled.div`
1066
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1067
+ border-radius: ${({theme:e})=>e.borderRadius};
1068
+ background: ${({theme:e})=>e.colors.neutral100};
1069
+ padding: ${({theme:e})=>e.spaces[3]};
1070
+ display: flex;
1071
+ gap: ${({theme:e})=>e.spaces[3]};
1072
+ align-items: center;
1073
+ `,lh=b.styled.img`
1074
+ width: 72px;
1075
+ height: 72px;
1076
+ object-fit: cover;
1077
+ border-radius: ${({theme:e})=>e.borderRadius};
1078
+ flex: 0 0 auto;
1079
+ `,ch=b.styled.div`
1080
+ color: ${({theme:e})=>e.colors.danger600};
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`
1083
+ margin: ${({theme:e})=>e.spaces[2]} 0;
1084
+ `,xh=b.styled.div`
1085
+ display: inline-flex;
1086
+ flex-direction: column;
1087
+ gap: ${({theme:e})=>e.spaces[2]};
1088
+ width: min(100%, 460px);
1089
+ text-align: left;
1090
+ cursor: pointer;
1091
+ user-select: none;
1092
+ padding: ${({theme:e})=>e.spaces[3]};
1093
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1094
+ border-left: 4px solid ${({$accent:e})=>e};
1095
+ border-radius: ${({theme:e})=>e.borderRadius};
1096
+ background: ${({theme:e})=>e.colors.neutral0};
1097
+ box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
1098
+ `,yh=b.styled(p.Flex)`
1099
+ gap: ${({theme:e})=>e.spaces[2]};
1100
+ `,vh=b.styled.span`
1101
+ font-size: 18px;
1102
+ line-height: 1;
1103
+ `,wh=b.styled.img`
1104
+ width: 100%;
1105
+ max-height: 220px;
1106
+ object-fit: cover;
1107
+ border-radius: ${({theme:e})=>e.borderRadius};
1108
+ `,kh=b.styled.iframe`
1109
+ width: 100%;
1110
+ border: 0;
1111
+ border-radius: ${({theme:e})=>e.borderRadius};
1112
+ background: ${({theme:e})=>e.colors.neutral150};
1113
+ `,jh=b.styled.div`
1114
+ font-size: 11px;
1115
+ color: ${({theme:e})=>e.colors.neutral500};
1116
+ `,$h=b.styled.button`
1117
+ align-self: flex-start;
1118
+ padding: 2px 8px;
1119
+ border-radius: ${({theme:e})=>e.borderRadius};
1120
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1121
+ background: ${({theme:e})=>e.colors.neutral100};
1122
+ color: ${({theme:e})=>e.colors.neutral700};
1123
+ font-size: 11px;
1124
+ cursor: pointer;
1125
+
1126
+ &:hover {
1127
+ border-color: ${({theme:e})=>e.colors.primary600};
1128
+ color: ${({theme:e})=>e.colors.primary600};
1129
+ }
1130
+ `,ps=b.styled.div`
1131
+ font-size: 12px;
1132
+ color: ${({theme:e})=>e.colors.neutral500};
1133
+ overflow: hidden;
1134
+ text-overflow: ellipsis;
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)`
1137
+ max-width: 720px;
1138
+ width: 92vw;
1139
+ `,Hh=b.styled.div`
1140
+ display: flex;
1141
+ flex-direction: column;
1142
+ gap: ${({theme:e})=>e.spaces[4]};
1143
+ padding: ${({theme:e})=>e.spaces[4]} ${({theme:e})=>e.spaces[6]}
1144
+ ${({theme:e})=>e.spaces[6]};
1145
+ max-height: 70vh;
1146
+ overflow: auto;
1147
+ `,Qe=b.styled.input`
1148
+ width: 100%;
1149
+ box-sizing: border-box;
1150
+ min-height: 40px;
1151
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1152
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1153
+ border-radius: ${({theme:e})=>e.borderRadius};
1154
+ font-size: 14px;
1155
+ color: ${({theme:e})=>e.colors.neutral800};
1156
+ background: ${({theme:e})=>e.colors.neutral0};
1157
+ `,Uh=b.styled.select`
1158
+ min-height: 40px;
1159
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1160
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1161
+ border-radius: ${({theme:e})=>e.borderRadius};
1162
+ font-size: 14px;
1163
+ color: ${({theme:e})=>e.colors.neutral800};
1164
+ background: ${({theme:e})=>e.colors.neutral0};
1165
+ `,Wh=b.styled.div`
1166
+ display: inline-flex;
1167
+ align-self: flex-start;
1168
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1169
+ border-radius: ${({theme:e})=>e.borderRadius};
1170
+ overflow: hidden;
1171
+ `,Kh=b.styled.button`
1172
+ min-width: 84px;
1173
+ min-height: 34px;
1174
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1175
+ border: none;
1176
+ border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
1177
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral0};
1178
+ color: ${({$active:e,theme:t})=>e?t.colors.neutral0:t.colors.neutral700};
1179
+ font-weight: ${({$active:e})=>e?600:400};
1180
+ cursor: pointer;
1181
+ text-transform: capitalize;
1182
+
1183
+ &:first-child {
1184
+ border-left: none;
1185
+ }
1186
+
1187
+ &:hover {
1188
+ background: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral100};
1189
+ }
1190
+
1191
+ &:focus {
1192
+ outline: none;
1193
+ }
1194
+ &:focus-visible {
1195
+ outline: 2px solid ${({theme:e})=>e.colors.primary600};
1196
+ outline-offset: -2px;
1197
+ }
1198
+ `,Cn=b.styled.label`
1199
+ display: flex;
1200
+ align-items: center;
1201
+ gap: ${({theme:e})=>e.spaces[2]};
1202
+ cursor: pointer;
1203
+ user-select: none;
1204
+ `,Gh=b.styled.div`
1205
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1206
+ border-radius: ${({theme:e})=>e.borderRadius};
1207
+ background: ${({theme:e})=>e.colors.neutral100};
1208
+ padding: ${({theme:e})=>e.spaces[3]};
1209
+ display: flex;
1210
+ flex-direction: column;
1211
+ gap: ${({theme:e})=>e.spaces[2]};
1212
+ `,Vh=b.styled.div`
1213
+ display: flex;
1214
+ align-items: center;
1215
+ gap: ${({theme:e})=>e.spaces[2]};
1216
+ color: ${({theme:e})=>e.colors.neutral500};
1217
+ font-size: 12px;
1218
+ text-transform: uppercase;
1219
+
1220
+ &::before,
1221
+ &::after {
1222
+ content: '';
1223
+ flex: 1;
1224
+ height: 1px;
1225
+ background: ${({theme:e})=>e.colors.neutral200};
1226
+ }
1227
+ `,qh=b.styled.div`
1228
+ width: 100%;
1229
+ aspect-ratio: ${({$ratio:e})=>e};
1230
+ border-radius: ${({theme:e})=>e.borderRadius};
1231
+ overflow: hidden;
1232
+ background: ${({theme:e})=>e.colors.neutral800};
1233
+
1234
+ video,
1235
+ img {
1236
+ width: 100%;
1237
+ height: 100%;
1238
+ object-fit: contain;
1239
+ display: block;
1240
+ }
1241
+ `,Vt=b.styled(p.Typography)`
1242
+ color: ${({theme:e})=>e.colors.neutral500};
1243
+ `,Xh=b.styled(p.Typography)`
1244
+ color: ${({theme:e})=>e.colors.danger600};
1245
+ `,Yh=b.styled.div`
1246
+ display: grid;
1247
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
1248
+ gap: ${({theme:e})=>e.spaces[2]};
1249
+ max-height: 260px;
1250
+ overflow: auto;
1251
+ `,Zh=b.styled.button`
1252
+ display: flex;
1253
+ flex-direction: column;
1254
+ gap: ${({theme:e})=>e.spaces[1]};
1255
+ padding: 0;
1256
+ text-align: left;
1257
+ border: 2px solid
1258
+ ${({$selected:e,theme:t})=>e?t.colors.primary600:t.colors.neutral200};
1259
+ border-radius: ${({theme:e})=>e.borderRadius};
1260
+ background: ${({theme:e})=>e.colors.neutral0};
1261
+ overflow: hidden;
1262
+ cursor: pointer;
1263
+
1264
+ &:disabled {
1265
+ cursor: not-allowed;
1266
+ opacity: 0.55;
1267
+ }
1268
+
1269
+ img {
1270
+ width: 100%;
1271
+ aspect-ratio: 16 / 9;
1272
+ object-fit: cover;
1273
+ display: block;
1274
+ background: ${({theme:e})=>e.colors.neutral800};
1275
+ }
1276
+ `,Jh=b.styled.div`
1277
+ padding: ${({theme:e})=>e.spaces[2]};
1278
+ display: flex;
1279
+ flex-direction: column;
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`
1282
+ margin: ${({theme:e})=>e.spaces[2]} 0;
1283
+ display: flex;
1284
+ justify-content: ${({$align:e})=>e==="left"?"flex-start":e==="right"?"flex-end":e==="none"?"stretch":"center"};
1285
+ `,nf=b.styled.div`
1286
+ display: flex;
1287
+ flex-direction: column;
1288
+ gap: ${({theme:e})=>e.spaces[2]};
1289
+ width: ${({$full:e})=>e?"100%":"min(100%, 640px)"};
1290
+ cursor: pointer;
1291
+ user-select: none;
1292
+ border-radius: ${({theme:e})=>e.borderRadius};
1293
+ box-shadow: ${({theme:e,$selected:t})=>t?`0 0 0 3px ${e.colors.primary600}`:"none"};
1294
+ `,rf=b.styled.div`
1295
+ position: relative;
1296
+ width: 100%;
1297
+ aspect-ratio: ${({$ratio:e})=>e};
1298
+ border-radius: ${({theme:e})=>e.borderRadius};
1299
+ overflow: hidden;
1300
+ background: ${({theme:e})=>e.colors.neutral800};
1301
+
1302
+ video,
1303
+ img {
1304
+ width: 100%;
1305
+ height: 100%;
1306
+ object-fit: contain;
1307
+ display: block;
1308
+ }
1309
+ `,of=b.styled.div`
1310
+ position: absolute;
1311
+ top: 8px;
1312
+ left: 8px;
1313
+ background: rgba(0, 0, 0, 0.7);
1314
+ color: white;
1315
+ padding: 2px 8px;
1316
+ border-radius: 4px;
1317
+ font-size: 12px;
1318
+ font-weight: 600;
1319
+ pointer-events: none;
1320
+ `,sf=b.styled(p.Flex)`
1321
+ position: absolute;
1322
+ inset: 0;
1323
+ align-items: center;
1324
+ justify-content: center;
1325
+ pointer-events: none;
1326
+ `,af=b.styled.div`
1327
+ width: 64px;
1328
+ height: 64px;
1329
+ border-radius: 50%;
1330
+ background: rgba(0, 0, 0, 0.7);
1331
+ display: flex;
1332
+ align-items: center;
1333
+ justify-content: center;
1334
+
1335
+ &::after {
1336
+ content: '';
1337
+ display: block;
1338
+ width: 0;
1339
+ height: 0;
1340
+ border-style: solid;
1341
+ border-width: 12px 0 12px 22px;
1342
+ border-color: transparent transparent transparent white;
1343
+ margin-left: 4px;
1344
+ }
1345
+ `,lf=b.styled(p.Flex)`
1346
+ width: 100%;
1347
+ height: 100%;
1348
+ color: ${({theme:e})=>e.colors.neutral200};
1349
+ font-size: 14px;
1350
+ `,cf=b.styled(p.Flex)`
1351
+ width: min(100%, 640px);
1352
+ padding: ${({theme:e})=>e.spaces[4]};
1353
+ border: 1px dashed ${({theme:e})=>e.colors.neutral300};
1354
+ border-radius: ${({theme:e})=>e.borderRadius};
1355
+ background: ${({theme:e})=>e.colors.neutral100};
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"})`
1358
+ font-weight: ${({theme:e})=>e.fontWeights.regular};
1359
+ border-left: ${({theme:e})=>`${e.spaces[1]} solid ${e.colors.neutral200}`};
1360
+ padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[4]};
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)`
1363
+ position: absolute;
1364
+ top: 0;
1365
+ left: 0;
1366
+ z-index: 2;
1367
+ background: ${({theme:e})=>e.colors.neutral0};
1368
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1369
+ border-radius: ${({theme:e})=>e.borderRadius};
1370
+ box-shadow: ${({theme:e})=>e.shadows.filterShadow};
1371
+ padding: 2px;
1372
+ `,Sn=b.styled.span`
1373
+ width: 1px;
1374
+ align-self: stretch;
1375
+ margin: 2px 2px;
1376
+ background: ${({theme:e})=>e.colors.neutral200};
1377
+ `,Qf=b.styled.button`
1378
+ display: flex;
1379
+ align-items: center;
1380
+ justify-content: center;
1381
+ width: 2.8rem;
1382
+ height: 2.8rem;
1383
+ border: none;
1384
+ border-radius: ${({theme:e})=>e.borderRadius};
1385
+ cursor: pointer;
1386
+ background: ${({theme:e,$active:t})=>t?e.colors.primary100:"transparent"};
1387
+
1388
+ &:hover {
1389
+ background: ${({theme:e,$danger:t})=>t?e.colors.danger100:e.colors.primary100};
1390
+ }
1391
+
1392
+ &:disabled {
1393
+ cursor: not-allowed;
1394
+ opacity: 0.4;
1395
+ }
1396
+
1397
+ &:focus-visible {
1398
+ outline: 2px solid ${({theme:e})=>e.colors.primary600};
1399
+ outline-offset: -2px;
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`
1404
+ overflow-x: auto;
1405
+ max-width: 100%;
1406
+ `,sg=b.styled.table`
1407
+ width: 100%;
1408
+ border-collapse: collapse;
1409
+ margin: ${({theme:e})=>e.spaces[2]} 0;
1410
+
1411
+ th,
1412
+ td {
1413
+ /* 2px against a mid-grey: the 1px hairline was effectively invisible on
1414
+ high-DPI screens, which made large tables hard to navigate. */
1415
+ border: 2px solid ${({theme:e})=>e.colors.neutral400};
1416
+ padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[3]};
1417
+ min-width: 80px;
1418
+ vertical-align: top;
1419
+ position: relative;
1420
+ }
1421
+
1422
+ th {
1423
+ background: ${({theme:e})=>e.colors.neutral100};
1424
+ font-weight: ${({theme:e})=>e.fontWeights.bold};
1425
+ text-align: inherit;
1426
+ }
1427
+
1428
+ /* Cells carry their own highlight — with colSpan/rowSpan in play, a cell's
1429
+ index within its row is no longer its visual column, so nth-child rules
1430
+ can't identify a column any more. */
1431
+ th[data-highlight='active'],
1432
+ td[data-highlight='active'] {
1433
+ background: ${({theme:e})=>e.colors.primary100};
1434
+ }
1435
+
1436
+ th[data-highlight='range'],
1437
+ td[data-highlight='range'] {
1438
+ background: ${({theme:e})=>e.colors.primary200};
1439
+ }
1440
+
1441
+ /* While a range of cells is selected, the browser's own text highlight would
1442
+ paint across the range tint and read as two competing selections. */
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:`
1446
+ To pick up a draggable item, press the space bar.
1447
+ While dragging, use the arrow keys to move the item.
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`
1450
+ [data-radix-menu-content] {
1451
+ scrollbar-width: auto !important;
1452
+ overflow-y: scroll !important;
1453
+ }
1454
+
1455
+ [data-radix-menu-content]::-webkit-scrollbar {
1456
+ display: block !important;
1457
+ width: 10px;
1458
+ height: 10px;
1459
+ }
1460
+
1461
+ [data-radix-menu-content]::-webkit-scrollbar-track {
1462
+ background-color: ${({theme:e})=>e.colors.neutral200};
1463
+ border-radius: 10px;
1464
+ }
1465
+
1466
+ [data-radix-menu-content]::-webkit-scrollbar-thumb {
1467
+ background-color: ${({theme:e})=>e.colors.neutral500};
1468
+ border-radius: 10px;
1469
+ border: 2px solid ${({theme:e})=>e.colors.neutral200};
1470
+ }
1471
+
1472
+ [data-radix-menu-content]::-webkit-scrollbar-thumb:hover {
1473
+ background-color: ${({theme:e})=>e.colors.neutral600};
1474
+ }
1475
+ `,Fs=10,Zt=10,Cr=50,eb=b.styled.div`
1476
+ display: grid;
1477
+ grid-template-columns: repeat(${Zt}, 1.6rem);
1478
+ grid-auto-rows: 1.6rem;
1479
+ gap: 2px;
1480
+ outline: none;
1481
+
1482
+ &:focus-visible {
1483
+ outline: 2px solid ${({theme:e})=>e.colors.primary600};
1484
+ outline-offset: 4px;
1485
+ border-radius: ${({theme:e})=>e.borderRadius};
1486
+ }
1487
+ `,tb=b.styled.div`
1488
+ border: 1px solid
1489
+ ${({theme:e,$selected:t})=>t?e.colors.primary600:e.colors.neutral300};
1490
+ background: ${({theme:e,$selected:t})=>t?e.colors.primary200:e.colors.neutral0};
1491
+ border-radius: 2px;
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`
1494
+ display: grid;
1495
+ grid-template-columns: repeat(8, 1fr);
1496
+ gap: 2px;
1497
+ max-height: 220px;
1498
+ overflow-y: auto;
1499
+ overflow-x: hidden;
1500
+ `,ib=b.styled.button`
1501
+ background: none;
1502
+ border: none;
1503
+ font-size: 18px;
1504
+ padding: 4px;
1505
+ cursor: pointer;
1506
+ border-radius: 4px;
1507
+ line-height: 1;
1508
+ width: 32px;
1509
+ height: 32px;
1510
+ display: flex;
1511
+ align-items: center;
1512
+ justify-content: center;
1513
+
1514
+ &:hover {
1515
+ background: ${({theme:e})=>e.colors.primary100};
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`
1518
+ font-size: 12px;
1519
+ color: ${({theme:e})=>e.colors.neutral600};
1520
+ white-space: nowrap;
1521
+ min-width: 32px;
1522
+ text-align: right;
1523
+ `,_s=b.styled.button`
1524
+ background: ${({theme:e})=>e.colors.neutral100};
1525
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1526
+ border-radius: ${({theme:e})=>e.borderRadius};
1527
+ width: 28px;
1528
+ height: 28px;
1529
+ display: flex;
1530
+ align-items: center;
1531
+ justify-content: center;
1532
+ cursor: pointer;
1533
+ font-size: 10px;
1534
+ color: ${({theme:e})=>e.colors.neutral600};
1535
+ flex-shrink: 0;
1536
+
1537
+ &:hover:not(:disabled) {
1538
+ background: ${({theme:e})=>e.colors.primary100};
1539
+ color: ${({theme:e})=>e.colors.primary600};
1540
+ border-color: ${({theme:e})=>e.colors.primary200};
1541
+ }
1542
+
1543
+ &:disabled {
1544
+ opacity: 0.4;
1545
+ cursor: not-allowed;
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)`
1549
+ display: grid;
1550
+ grid-template-columns: repeat(5, 1fr);
1551
+ gap: 4px;
1552
+ padding: 8px;
1553
+ max-width: 180px;
1554
+ `,xb=b.styled.button`
1555
+ width: 28px;
1556
+ height: 28px;
1557
+ border-radius: 4px;
1558
+ border: 2px solid
1559
+ ${({$isActive:e,theme:t})=>e?t.colors.primary600:"transparent"};
1560
+ background-color: ${({$color:e})=>e};
1561
+ cursor: pointer;
1562
+ transition: transform 0.1s ease;
1563
+
1564
+ &:hover {
1565
+ transform: scale(1.1);
1566
+ border-color: ${({theme:e})=>e.colors.primary500};
1567
+ }
1568
+ `,yb=b.styled(p.Flex)`
1569
+ flex-shrink: 0;
1570
+ min-width: 32px;
1571
+
1572
+ &[aria-disabled] {
1573
+ cursor: not-allowed;
1574
+ }
1575
+
1576
+ &[aria-disabled='false'] {
1577
+ cursor: pointer;
1578
+
1579
+ &:hover {
1580
+ background: ${({theme:e})=>e.colors.primary100};
1581
+ }
1582
+ }
1583
+ `,vb=b.styled.button`
1584
+ width: 100%;
1585
+ padding: 6px 8px;
1586
+ border: none;
1587
+ background: ${({theme:e})=>e.colors.neutral100};
1588
+ color: ${({theme:e})=>e.colors.neutral800};
1589
+ cursor: pointer;
1590
+ font-size: 12px;
1591
+ border-radius: 4px;
1592
+ margin-top: 4px;
1593
+
1594
+ &:hover {
1595
+ background: ${({theme:e})=>e.colors.neutral200};
1596
+ }
1597
+ `,Ls=b.styled.button`
1598
+ flex: 1;
1599
+ padding: 6px 8px;
1600
+ border: none;
1601
+ border-bottom: 2px solid
1602
+ ${({$active:e,theme:t})=>e?t.colors.primary600:"transparent"};
1603
+ background: transparent;
1604
+ color: ${({$active:e,theme:t})=>e?t.colors.primary600:t.colors.neutral600};
1605
+ cursor: pointer;
1606
+ font-size: 12px;
1607
+ font-weight: ${({$active:e})=>e?600:400};
1608
+ display: flex;
1609
+ align-items: center;
1610
+ justify-content: center;
1611
+ gap: 4px;
1612
+
1613
+ &:hover {
1614
+ color: ${({theme:e})=>e.colors.primary500};
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`
1617
+ display: grid;
1618
+ grid-template-columns: repeat(7, 1fr);
1619
+ gap: 6px;
1620
+ max-height: 220px;
1621
+ overflow-y: auto;
1622
+ overflow-x: hidden;
1623
+ padding: 4px;
1624
+
1625
+ &::-webkit-scrollbar {
1626
+ display: none;
1627
+ }
1628
+ scrollbar-width: none;
1629
+ `,kb=b.styled.button`
1630
+ background: ${({theme:e})=>e.colors.neutral0};
1631
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1632
+ color: ${({theme:e})=>e.colors.neutral800};
1633
+ font-size: 18px;
1634
+ cursor: pointer;
1635
+ border-radius: ${({theme:e})=>e.borderRadius};
1636
+ width: 36px;
1637
+ height: 36px;
1638
+ display: flex;
1639
+ align-items: center;
1640
+ justify-content: center;
1641
+ transition: all 0.15s;
1642
+
1643
+ &:hover {
1644
+ background: ${({theme:e})=>e.colors.primary100};
1645
+ border-color: ${({theme:e})=>e.colors.primary600};
1646
+ color: ${({theme:e})=>e.colors.primary600};
1647
+ transform: scale(1.1);
1648
+ }
1649
+
1650
+ &:active {
1651
+ transform: scale(0.95);
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)`
1654
+ flex-wrap: wrap;
1655
+ align-items: center;
1656
+ gap: ${({theme:e})=>e.spaces[1]};
1657
+
1658
+ &[aria-disabled='true'] {
1659
+ cursor: not-allowed;
1660
+ background: ${({theme:e})=>e.colors.neutral150};
1661
+ }
1662
+ `,et=b.styled.div`
1663
+ display: contents;
1664
+ `,tt=b.styled.span`
1665
+ width: 1px;
1666
+ align-self: stretch;
1667
+ min-height: 2.4rem;
1668
+ flex-shrink: 0;
1669
+ margin: 0 ${({theme:e})=>e.spaces[1]};
1670
+ background: ${({theme:e})=>e.colors.neutral200};
1671
+ `,Rt=b.styled(p.Flex)`
1672
+ user-select: none;
1673
+
1674
+ // Inherit the not-allowed cursor from ToolbarWrapper when disabled
1675
+ &[aria-disabled] {
1676
+ cursor: not-allowed;
1677
+ }
1678
+
1679
+ &[aria-disabled='false'] {
1680
+ cursor: pointer;
1681
+
1682
+ // Only apply hover styles if the button is enabled
1683
+ &:hover {
1684
+ background: ${({theme:e})=>e.colors.primary100};
1685
+ }
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)`
1688
+ &:hover {
1689
+ background-color: ${({theme:e})=>e.colors.primary100};
1690
+ }
1691
+
1692
+ ${e=>e.$isActive&&b.css`
1693
+ font-weight: bold;
1694
+ background-color: ${({theme:t})=>t.colors.primary100};
1695
+ color: ${({theme:t})=>t.colors.primary600};
1696
+ font-weight: bold;
1697
+ `}
1698
+
1699
+ > span {
1700
+ display: inline-flex;
1701
+ gap: ${({theme:e})=>e.spaces[2]};
1702
+ align-items: center;
1703
+ width: 100%;
1704
+ }
1705
+
1706
+ svg {
1707
+ fill: ${({theme:e,$isActive:t})=>t?e.colors.primary600:e.colors.neutral600};
1708
+ flex-shrink: 0;
1709
+ }
1710
+ `,Sb=b.styled.span`
1711
+ line-height: 1.3;
1712
+ `,Tb=b.styled.span`
1713
+ margin-left: auto;
1714
+ padding-left: ${({theme:e})=>e.spaces[6]};
1715
+ color: ${({theme:e})=>e.colors.neutral500};
1716
+ font-size: 1.2rem;
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`
1719
+ position: absolute;
1720
+ z-index: 10;
1721
+ background: ${({theme:e})=>e.colors.neutral0};
1722
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1723
+ border-radius: ${({theme:e})=>e.borderRadius};
1724
+ box-shadow: ${({theme:e})=>e.shadows.filterShadow};
1725
+ max-height: 260px;
1726
+ overflow-y: auto;
1727
+ width: 220px;
1728
+ padding: 4px;
1729
+ `,Xb=b.styled.button`
1730
+ display: flex;
1731
+ align-items: center;
1732
+ gap: 8px;
1733
+ width: 100%;
1734
+ padding: 8px 10px;
1735
+ border: none;
1736
+ border-radius: 4px;
1737
+ cursor: pointer;
1738
+ font-size: 13px;
1739
+ background: ${({theme:e,$active:t})=>t?e.colors.primary100:"transparent"};
1740
+ color: ${({theme:e,$active:t})=>t?e.colors.primary600:e.colors.neutral800};
1741
+
1742
+ &:hover {
1743
+ background: ${({theme:e})=>e.colors.primary100};
1744
+ color: ${({theme:e})=>e.colors.primary600};
1745
+ }
1746
+
1747
+ svg {
1748
+ width: 16px;
1749
+ height: 16px;
1750
+ flex-shrink: 0;
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)`
1753
+ // The outline style is set on the wrapper with :focus-within
1754
+ outline: none;
1755
+ display: flex;
1756
+ flex-direction: column;
1757
+ gap: ${({theme:e})=>e.spaces[3]};
1758
+ height: 100%;
1759
+ // Always use full width
1760
+ width: 100%;
1761
+
1762
+ > *:last-child {
1763
+ padding-bottom: ${({theme:e})=>e.spaces[3]};
1764
+ }
1765
+
1766
+ // Slate renders placeholder as a span with inline styles
1767
+ [data-slate-placeholder] {
1768
+ white-space: nowrap !important;
1769
+ opacity: 0.33;
1770
+ }
1771
+ `,Jb=b.styled(p.Box)`
1772
+ position: ${({$isOverDropTarget:e})=>e&&"relative"};
1773
+ `,Qb=b.styled(p.Box)`
1774
+ position: absolute;
1775
+ right: 0;
1776
+
1777
+ // Show drop placeholder 8px above or below the drop target
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]}`};
1781
+ `}
1782
+ `,Vi=b.styled(p.Flex)`
1783
+ // Style each block rendered using renderElement()
1784
+ & > [data-slate-node='element'] {
1785
+ width: 100%;
1786
+ opacity: inherit;
1787
+ }
1788
+
1789
+ // Set the visibility of drag button
1790
+ [role='button'] {
1791
+ visibility: ${e=>e.$dragVisibility};
1792
+ opacity: inherit;
1793
+ }
1794
+ &[aria-disabled='true'] {
1795
+ user-drag: none;
1796
+ }
1797
+ `,qi=b.styled(p.IconButton)`
1798
+ user-select: none;
1799
+ display: flex;
1800
+ align-items: center;
1801
+ justify-content: center;
1802
+ border: none;
1803
+ border-radius: ${({theme:e})=>e.borderRadius};
1804
+ padding-left: ${({theme:e})=>e.spaces[0]};
1805
+ padding-right: ${({theme:e})=>e.spaces[0]};
1806
+ padding-top: ${({theme:e})=>e.spaces[1]};
1807
+ padding-bottom: ${({theme:e})=>e.spaces[1]};
1808
+ visibility: hidden;
1809
+ cursor: grab;
1810
+ opacity: inherit;
1811
+ margin-top: ${e=>e.$dragHandleTopMargin??0};
1812
+
1813
+ &:hover {
1814
+ background: ${({theme:e})=>e.colors.neutral100};
1815
+ }
1816
+ &:active {
1817
+ cursor: grabbing;
1818
+ background: ${({theme:e})=>e.colors.neutral150};
1819
+ }
1820
+ &[aria-disabled='true'] {
1821
+ visibility: hidden;
1822
+ }
1823
+ svg {
1824
+ min-width: ${({theme:e})=>e.spaces[3]};
1825
+
1826
+ path {
1827
+ fill: ${({theme:e})=>e.colors.neutral500};
1828
+ }
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)`
1832
+ // Background with 20% opacity
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)`
1835
+ border: 1px solid
1836
+ ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
1837
+ border-radius: ${({theme:e})=>e.borderRadius};
1838
+ resize: vertical;
1839
+ background: ${({theme:e})=>e.colors.neutral0};
1840
+
1841
+ ${({theme:e,$hasError:t=!1})=>b.css`
1842
+ outline: none;
1843
+ box-shadow: 0;
1844
+ transition-property: border-color, box-shadow, fill;
1845
+ transition-duration: 0.2s;
1846
+
1847
+ &:focus-within {
1848
+ border: 1px solid
1849
+ ${t?e.colors.danger600:e.colors.primary600};
1850
+ box-shadow: ${t?e.colors.danger600:e.colors.primary600}
1851
+ 0px 0px 0px 2px;
1852
+ }
1853
+ `}
1854
+
1855
+ ${({theme:e,$disabled:t})=>t?b.css`
1856
+ color: ${e.colors.neutral600};
1857
+ background: ${e.colors.neutral150};
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)`
1860
+ position: fixed;
1861
+ top: -10000px;
1862
+ left: -10000px;
1863
+ z-index: 10;
1864
+ opacity: 0;
1865
+ pointer-events: none;
1866
+ transition: opacity 120ms ease;
1867
+ background: ${({theme:e})=>e.colors.neutral0};
1868
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1869
+ border-radius: ${({theme:e})=>e.borderRadius};
1870
+ box-shadow: ${({theme:e})=>e.shadows.popupShadow};
1871
+ padding: ${({theme:e})=>e.spaces[1]};
1872
+
1873
+ &[data-visible='true'] {
1874
+ opacity: 1;
1875
+ pointer-events: auto;
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`
1878
+ font-size: inherit;
1879
+ color: inherit;
1880
+ line-height: inherit;
1881
+ `,px=b.styled(p.Typography).attrs({textTransform:"uppercase"})`
1882
+ ${ct}
1883
+ `,hx=b.styled(p.Typography)`
1884
+ vertical-align: super;
1885
+ font-size: smaller !important;
1886
+ ${ct}
1887
+ `,fx=b.styled(p.Typography)`
1888
+ vertical-align: sub;
1889
+ font-size: smaller !important;
1890
+ ${ct}
1891
+ `,gx=b.styled(p.Typography).attrs({fontWeight:"bold"})`
1892
+ ${ct}
1893
+ `,mx=b.styled(p.Typography)`
1894
+ font-style: italic;
1895
+ ${ct}
1896
+ `,bx=b.styled(p.Typography).attrs({textDecoration:"underline"})`
1897
+ ${ct}
1898
+ `,xx=b.styled(p.Typography).attrs({textDecoration:"line-through"})`
1899
+ ${ct}
1900
+ `,yx=b.styled.code`
1901
+ background-color: ${({theme:e})=>e.colors.neutral150};
1902
+ border-radius: ${({theme:e})=>e.borderRadius};
1903
+ padding: ${({theme:e})=>`0 ${e.spaces[2]}`};
1904
+ font-family:
1905
+ 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo,
1906
+ Consolas, monospace;
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)`
1915
+ border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
1916
+ background: ${({theme:e})=>e.colors.neutral100};
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)`
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}".
1921
+
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
1924
+ White:#FFFFFF
1925
+ Gray:#808080
1926
+ Red:#FF0000
1927
+ Blue:#0000FF
1928
+ Green:#00FF00`},intlLabel:{id:`${z}.customColorsPresets`,defaultMessage:"Custom text color presets"},description:{id:`${z}.customColorsPresets.description`,defaultMessage:"These values will override default text color options. One per line."}}]},{sectionTitle:{id:`${z}.section.bg-color-settings`,defaultMessage:"Background Color Settings (Label:#HEX)"},items:[{name:"options.disableDefaultBgColors",type:"checkbox",intlLabel:{id:`${z}.disableDefaultBgColors`,defaultMessage:"Disable default background colors?"},description:{id:`${z}.disableDefaultBgColors.description`,defaultMessage:"If enabled, custom background color presets will be used"}},{name:"options.customBgColorsPresets",type:"textarea",placeholder:{id:`${z}.customBgColorsPresets.placeholder`,defaultMessage:`Yellow:#FFF3BF
1929
+ Green:#D3F9D8
1930
+ Blue:#D0EBFF
1931
+ Pink:#FFE0E6
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;