better-react-email-editor 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1000 -954
- package/dist/index.js.map +1 -1
- package/dist/types/core/fonts.d.ts +9 -2
- package/dist/types/core/spellcheck.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ const { html, text } = await ref.current.exportEmail(); // ready-to-send email
|
|
|
103
103
|
| `palette` | `PaletteItem[]` | `defaultPalette` | Tiles of the **Content** tab. |
|
|
104
104
|
| `paletteGroups` | `PaletteGroup[]` | Layout, Content | Groups of tiles. |
|
|
105
105
|
| `templates` | `TemplateItem[]` | `defaultTemplates` | Prebuilt rows of the **Blocks** tab. |
|
|
106
|
-
| `fonts` | `FontOption[]` | `defaultFonts` | Fonts of the font pickers (`{ label, value }`, `value` being a CSS `font-family` stack). Defaults to Arial, Verdana, Tahoma, Georgia and Times New Roman
|
|
106
|
+
| `fonts` | `FontOption[]` | `defaultFonts` | Fonts of the font pickers (`{ label, value }`, `value` being a CSS `font-family` stack). Defaults to Inter, Arial, Verdana, Tahoma, Georgia and Times New Roman. A font with an `href` (stylesheet URL) is a web font: loaded in the editor and linked in the exported email when used. Only some clients (Apple Mail, iOS) load web fonts, the others fall back (Inter → Arial). |
|
|
107
107
|
| `starterDocument` | `(i18n) => JSONContent` | demo email | Loaded by the top bar's **Template** button. |
|
|
108
108
|
| `extensions` | `Extensions` | | Extra Tiptap extensions, read on mount. |
|
|
109
109
|
| `theme` | `EditorThemeInput` | `defaultTheme` | Email theme for new documents, read on mount. |
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let l=require("react"),u=require("@tiptap/extension-placeholder"),d=require("@tiptap/react"),f=require("@react-email/editor/core"),p=require("@react-email/editor/extensions"),m=require("@react-email/editor/plugins"),h=require("@tiptap/pm/model"),g=require("@tiptap/pm/state"),_=require("@tiptap/html"),v=require("@tiptap/core"),y=require("@tiptap/pm/transform"),b=require("@react-email/editor/ui"),x=require("react/jsx-runtime"),S=require("@radix-ui/react-popover");S=c(S,1);let C=require("react-colorful"),w=require("react-email"),T=require("react-dom");function E(...e){return e.filter(Boolean).join(` `)}var D=new Set([`container`,`section`,`columnsColumn`]),O=new Set([`twoColumns`,`threeColumns`,`fourColumns`]),ee=`application/x-email-block`;function te(e,t){let n=e.nodeDOM(t);return n instanceof HTMLElement?n.getBoundingClientRect():null}function ne(e,t,n){let r=[];return t.forEach((t,i)=>{let a=n+1+i,o=te(e,a);o&&r.push({node:t,pos:a,rect:o})}),r}function k(e){return e.type.name===`paragraph`&&e.childCount===0}function A(e){let t=null;return e.forEach((e,n)=>{!t&&e.type.name===`container`&&(t={node:e,pos:n})}),t}function re(e,t,n,r,i){let a=A(e.state.doc);if(!a)return null;let o=e=>!!i&&e>=i.from&&e<i.to,s=(i,a)=>{let c=ne(e,i,a),l=te(e,a);if(!l)return null;for(let r of c){let{rect:i}=r,a=Math.min(12,i.height/4),c=n>i.top+a&&n<i.bottom-a,l=t>=i.left&&t<=i.right;if(!c||!l||o(r.pos))continue;let u=r.node.type.name;if(D.has(u)){let e=s(r.node,r.pos);if(e)return e}else if(O.has(u)){let n=ne(e,r.node,r.pos),i=n.find(e=>t>=e.rect.left&&t<=e.rect.right)??(t<n[0]?.rect.left?n[0]:n[n.length-1]);if(i&&!o(i.pos)){let e=s(i.node,i.pos);if(e)return e}}}if(c.length===1&&k(c[0].node)&&!o(c[0].pos)){let e=c[0];return i.type.validContent(r)?{pos:e.pos,replaceTo:e.pos+e.node.nodeSize,line:{top:e.rect.top,left:l.left,width:l.width},emptyZone:{top:l.top,left:l.left,width:l.width,height:Math.max(l.height,40)}}:null}let u=c.length;for(let e=0;e<c.length;e++){let{rect:t}=c[e];if(n<t.top+t.height/2){u=e;break}}let d=u,f=u<c.length?(e=>{let t=0,n=-1;return i.forEach((r,i)=>{a+1+i===e&&(n=t),t++}),n})(c[u].pos):i.childCount;if(!i.canReplace(f,f,r))return null;let p=d<c.length?c[d].pos:a+i.nodeSize-1,m;return m=c.length===0?l.top+4:d===0?c[0].rect.top:d===c.length?c[c.length-1].rect.bottom:(c[d-1].rect.bottom+c[d].rect.top)/2,{pos:p,line:{top:m,left:l.left,width:l.width}}};return s(a.node,a.pos)}function ie(e,t){let{schema:n,doc:r}=e.state;if(t.kind===`new`)try{return h.Fragment.fromArray(t.content().map(e=>n.nodeFromJSON(e)))}catch(e){return console.error(`Invalid block content`,e),null}let i=r.nodeAt(t.pos);return i?h.Fragment.from(i):null}function ae(e,t){let n=e.doc.nodeAt(t);n&&(n.isAtom||n.type.name===`horizontalRule`?e.setSelection(g.NodeSelection.create(e.doc,t)):e.setSelection(g.TextSelection.near(e.doc.resolve(t+1))))}function j(e){let{selection:t,doc:n}=e.state;t instanceof g.NodeSelection&&e.dispatch(e.state.tr.setSelection(g.Selection.near(n.resolve(t.from))))}function oe(e,t){if(t.replaceTo!==void 0)return t;let n=e.resolve(t.pos),r=n.parent,i=r.lastChild;return n.index()!==r.childCount||!i||r.childCount<2||!k(i)?t:{...t,pos:t.pos-i.nodeSize}}function M(e,t,n){let{view:r}=e;j(r);let i=ie(r,t);if(!i)return!1;let a=oe(r.state.doc,n),o=r.state.tr;if(t.kind===`new`)a.replaceTo===void 0?o.insert(a.pos,i):o.replaceWith(a.pos,a.replaceTo,i),ae(o,a.pos);else{let e=r.state.doc.nodeAt(t.pos);if(!e)return!1;let n=t.pos,i=n+e.nodeSize;if(a.replaceTo===void 0&&(a.pos===n||a.pos===i))return!1;se(o,n,i);let s=o.mapping.map(a.pos,-1);if(a.replaceTo!==void 0){let t=o.mapping.map(a.replaceTo,1);o.replaceWith(s,t,e)}else o.insert(s,e);ae(o,s)}return r.dispatch(o.scrollIntoView()),r.focus(),!0}function se(e,t,n){let r=e.doc.resolve(t).parent;r.childCount===1&&D.has(r.type.name)?e.replaceWith(t,n,e.doc.type.schema.nodes.paragraph.create()):e.delete(t,n)}function N(e,t,n=!0){if(t<0||t>e.content.size)return null;let r=[],i=e.nodeAt(t);n&&i&&r.push({pos:t,node:i});let a=e.resolve(t);for(let e=a.depth;e>0;e--)r.push({pos:a.before(e),node:a.node(e)});for(let t of r){let n=e.resolve(t.pos).parent.type.name;if(D.has(n)||O.has(n))return t}return null}function ce(e){return e.node.type.name===`columnsColumn`}function le(e,t){let n=e.resolve(t.pos);for(let r=n.depth;r>0;r--){let i=N(e,n.before(r));if(i&&i.pos!==t.pos)return i}return null}function P(e){let{selection:t,doc:n}=e.state;return t instanceof g.NodeSelection?N(n,t.from)??{pos:t.from,node:t.node}:N(n,t.from,!1)}function F(e,t){let{view:n}=e,r=n.state.tr.setSelection(g.NodeSelection.create(n.state.doc,t.pos));n.dispatch(r),n.focus()}function ue(e,t){let{view:n}=e;j(n);let r=n.state.doc.nodeAt(t.pos);if(!r)return;let i=t.pos+r.nodeSize,a=n.state.tr.insert(i,r.copy(r.content));a.setSelection(g.NodeSelection.create(a.doc,i)),n.dispatch(a.scrollIntoView()),n.focus()}function de(e,t){let{view:n}=e,r=n.state.doc.nodeAt(t.pos);if(!r)return;let i=n.state.tr;se(i,t.pos,t.pos+r.nodeSize),n.dispatch(i)}function fe(e,t){let n=A(e.state.doc);if(!n)return;let r=n.node.lastChild,i=n.pos+n.node.nodeSize-1;M(e,{kind:`new`,label:``,content:()=>t},r&&k(r)&&n.node.childCount>1?{pos:i-r.nodeSize,replaceTo:i,line:{top:0,left:0,width:0}}:{pos:i,line:{top:0,left:0,width:0}})}var pe=p.Button.extend({parseHTML(){return[{tag:`a[data-id="react-email-button"]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e,n=t.parentElement?.className.match(/align-(left|center|right)/)?.[1],r=t.className.replace(/\bnode-button\b/g,``).trim();return{href:t.getAttribute(`href`)??t.dataset.href??`#`,alignment:n??`left`,class:r||`button`,style:t.getAttribute(`style`)}}}]}});function me(e,t){let n=t.clipboardData?.getData(`text/html`)??``,r=n.includes(`data-pm-slice`);if((t.clipboardData?.files?.length??0)>0)return!1;let{view:i}=e,{state:a}=i,{selection:o}=a;if(o instanceof g.NodeSelection&&o.node.isBlock){let e=o.node,t=e.type.name===`columnsColumn`?o.from+e.nodeSize-1:o.from+e.nodeSize,n=a.doc.resolve(t),r=a.schema.nodes.paragraph;if(O.has(n.parent.type.name)||!n.parent.canReplaceWith(n.index(),n.index(),r))return!1;i.dispatch(a.tr.setSelection(g.TextSelection.near(n)));let s=i.state.tr.insert(t,r.create());s.setSelection(g.TextSelection.create(s.doc,t+1)),i.dispatch(s)}return r?(t.preventDefault(),t.stopPropagation(),i.pasteHTML(n),!0):!1}var he=/class="[^"]*node-/,I=[`script`,`iframe`,`object`,`embed`,`meta`,`base`],ge=[`href`,`src`],_e={a:[`href`,`target`,`rel`],img:[`src`,`alt`,`width`,`height`],td:[`colspan`,`rowspan`],th:[`colspan`,`rowspan`,`scope`],table:[`border`,`cellpadding`,`cellspacing`],"*":[`id`]};function L(e,t){let n=e.trim().toLowerCase();return n.startsWith(`javascript:`)||n.startsWith(`vbscript:`)?!1:!n.startsWith(`data:`)||t&&n.startsWith(`data:image/`)}function ve(e){let t=new Set([..._e[e.tagName.toLowerCase()]??[],..._e[`*`]]);for(let n of Array.from(e.attributes))(n.name.startsWith(`data-`)||!t.has(n.name))&&e.removeAttribute(n.name)}function ye(e){e.nodeType===Node.ELEMENT_NODE&&ve(e);for(let t of Array.from(e.childNodes))ye(t)}function be(e){let t=new DOMParser().parseFromString(e,`text/html`);for(let e of I)for(let n of Array.from(t.body.getElementsByTagName(e)))n.remove();for(let e of Array.from(t.body.querySelectorAll(`[href], [src]`))){let t=e.tagName.toLowerCase()===`img`;for(let n of ge){let r=e.getAttribute(n);r!==null&&!L(r,t)&&e.removeAttribute(n)}}return he.test(e)||ye(t.body),t.body.innerHTML}function xe(e){return(t,n,r)=>{if(r.content.childCount===1)return!1;let i=n.clipboardData?.getData?.(`text/html`);if(!i)return!1;n.preventDefault();let a=(0,_.generateJSON)(be(i),e),o=t.state.schema.nodeFromJSON(a);return t.dispatch(t.state.tr.replaceSelectionWith(o,!1)),!0}}var Se=new Set([`columnsColumn`,`codeBlock`]),Ce=v.Extension.create({name:`selectAllFix`,priority:101,addKeyboardShortcuts(){return{"Mod-a":({editor:e})=>{let{state:t}=e,{$from:n}=t.selection;for(let e=n.depth;e>0;e--)if(Se.has(n.node(e).type.name)&&(t.selection.from!==n.start(e)||t.selection.to!==n.end(e)))return!1;let r=-1;t.doc.forEach((e,t)=>{r<0&&e.type.name===`container`&&(r=t)});let i=r<0?null:t.doc.nodeAt(r);if(!i)return!1;let a=r+1,o=r+i.nodeSize-1;return(t.selection.from!==a||t.selection.to!==o)&&e.view.dispatch(t.tr.setSelection(g.TextSelection.create(t.doc,a,o))),!0}}},addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey(`selectAllFix`),appendTransaction(e,t,n){let r=t.selection;if(!(r instanceof g.TextSelection)||r.$from.parent.inlineContent&&r.$to.parent.inlineContent||!e.some(e=>e.steps.some(e=>e instanceof y.ReplaceStep&&e.from===r.from&&e.to===r.to)))return null;let i=r.from,a=r.to;for(let t of e)i=t.mapping.map(i,-1),a=t.mapping.map(a,1);let{selection:o}=n;if(o instanceof g.TextSelection&&o.from>=i&&o.to<=a)return null;let s=n.doc.resolve(i);return n.tr.setSelection(g.Selection.findFrom(s,1,!0)??g.Selection.near(s))}})]}}),we=[{label:`Arial`,value:`Arial, Helvetica, sans-serif`},{label:`Verdana`,value:`Verdana, Geneva, sans-serif`},{label:`Tahoma`,value:`Tahoma, Verdana, Segoe, sans-serif`},{label:`Georgia`,value:`Georgia, 'Times New Roman', Times, serif`},{label:`Times New Roman`,value:`'Times New Roman', Times, serif`}];function Te(e){return e.split(`,`)[0].trim().replace(/^['"]|['"]$/g,``).toLowerCase()}function Ee(e,t){if(!t)return;let n=Te(t);return e.find(e=>Te(e.value)===n)}function De(){let e=null;return{get:()=>e,start:t=>{e=t},end:()=>{e=null}}}function Oe(){let e=null,t=new Set;return{get:()=>e,set:n=>{if(n!==e){e=n;for(let e of t)e()}},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var ke={topBar:{layers:`Layers`,toggleLayers:`Show / hide layers`,undo:`Undo (Ctrl+Z)`,redo:`Redo (Ctrl+Y)`,canvasWidth:`Canvas width`,desktop:`Desktop`,mobile:`Mobile`,template:`Template`,confirmTemplate:`Replace the content with the starter template?`,import:`Import`,exportJson:`Save JSON`,preview:`Preview`,exportHtml:`Export HTML`,invalidFile:e=>`Invalid file: ${e}`},preview:{dialogLabel:`Preview and export`,desktop:`Desktop`,mobile:`Mobile`,html:`HTML`,text:`Plain text`,copy:`Copy`,copied:`Copied ✓`,download:`Download .html`,close:`Close`,rendering:`Rendering the email…`,renderError:e=>`Render error: ${e}`,iframeTitle:`Email preview`},sidebar:{label:`Side panel`,tabContent:`Content`,tabBlocks:`Blocks`,tabBody:`Body`,layoutTitle:`Layout`,contentTitle:`Content`,dragHint:`Drag an item into the email. A click adds it at the end.`,tileTitle:e=>`Drag “${e}” into the email (or click to add it at the end)`,propertiesEyebrow:`Properties`,closeProperties:`Close (back to content)`,breadcrumb:`Hierarchy`,selectedText:`Selected text`},emailHeader:{subject:`Subject`,subjectPlaceholder:`Subject line`,previewText:`Preview`,previewTextPlaceholder:`Shown after the subject line in the inbox`},body:{general:`General`,previewText:`Preview text`,previewTextPlaceholder:`Shown after the subject line in the inbox`,background:`Background`,backgroundColor:`Background color`,outerPadding:`Outer padding`,content:`Content`,width:`Width`,contentColor:`Content color`,innerPadding:`Inner padding`,radius:`Corner radius`,defaultStyles:`Default styles`,font:`Font`,fontDefault:`Default (system font)`,text:`Text`,headings:`Headings`,links:`Links`,buttonBackground:`Button background`,buttonText:`Button text`},inspector:{typography:`Typography`,font:`Font`,fontDefault:`Default (email font)`,color:`Color`,size:`Size`,weight:`Weight`,weightLight:`Light`,weightNormal:`Normal`,weightSemibold:`Semibold`,weightBold:`Bold`,weightExtrabold:`Extra bold`,lineHeight:`Line height`,alignment:`Alignment`,spacing:`Spacing`,padding:`Padding`,box:`Background & border`,backgroundColor:`Background color`,radius:`Corner radius`,border:`Border`,borderColor:`Border color`,image:`Image`,uploadImage:`Upload an image…`,imageUrl:`Image URL`,altText:`Alt text`,altPlaceholder:`Describe the image`,layout:`Layout`,autoWidth:`Auto width`,width:`Width`,action:`Action`,clickLink:`Link on click`,linkUrl:`Link URL`,button:`Button`,textColor:`Text color`,textSize:`Text size`,buttonPadding:`Button padding`,networks:`Networks`,removeNetwork:`Remove`,addNetwork:`+ Add a network`,appearance:`Appearance`,iconSize:`Icon size`,gap:`Spacing`,columns:`Columns`,distribution:`Distribution`,equal:`Equal`,columnGap:`Gap between columns`,columnsHint:`Click inside a column to set its background and padding.`,spacer:`Spacer`,height:`Height`,htmlCode:`HTML code`,htmlHint:`The HTML is inserted as is in the exported email.`,line:`Line`,thickness:`Thickness`,lineStyle:`Style`,heading:`Heading`,level:`Level`,formatting:`Formatting`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strike:`Strikethrough`,link:`Link`,url:`URL`,linkColor:`Link color`},fields:{colorDefault:`Default`,chooseColor:e=>`Pick a color (${e})`,hexCode:`Hex code`,eyedropper:`Eyedropper: pick a color on screen`,documentColors:`Document colors`,palette:`Palette`,resetColor:`Reset to default`,alignLeft:`Left`,alignCenter:`Center`,alignRight:`Right`,top:`Top`,right:`Right`,bottom:`Bottom`,left:`Left`,moreOptions:`More options`,auto:`auto`},layers:{title:`Layers`,expandAll:`Expand all`,collapseAll:`Collapse all`,close:`Close layers`,tree:`Email structure`,emptyEmail:`The email is empty.`,emptyZone:`Empty — drop content here`,column:e=>`Column ${e}`,fixedHint:`Columns stay in their row`,itemHint:`Click to select, drag to move`,expand:`Expand`,collapse:`Collapse`,uploadedImage:`uploaded image`,empty:`empty`},canvas:{dropHere:`Drop here`,dropLabel:e=>e?`Drop “${e}” here`:`Drop here`,emptyZone:`Drag content here`,move:`Drag to move`,moveLabel:e=>`Move: ${e}`,selectParent:e=>`Select: ${e}`,duplicate:`Duplicate`,delete:`Delete`},placeholder:{heading:`Heading`,paragraph:`Write, or type “/” for commands`},nodes:{body:`Body`,paragraph:`Text`,heading:`Heading`,image:`Image`,button:`Button`,horizontalRule:`Divider`,spacer:`Spacer`,socialLinks:`Social links`,htmlBlock:`HTML`,section:`Section`,twoColumns:`Row · 2 columns`,threeColumns:`Row · 3 columns`,fourColumns:`Row · 4 columns`,columnsColumn:`Column`,bulletList:`List`,orderedList:`Numbered list`,listItem:`List item`,blockquote:`Quote`,codeBlock:`Code`,table:`Table`,container:`Email`},palette:{oneColumn:`1 column`,twoColumns:`2 columns`,threeColumns:`3 columns`,fourColumns:`4 columns`,heading:`Heading`,text:`Text`,button:`Button`,image:`Image`,divider:`Divider`,spacer:`Spacer`,social:`Social`,menu:`Menu`,list:`List`,quote:`Quote`,html:`HTML`,card:`Card`},templates:{header:`Header`,headerDescription:`Logo on the left, menu on the right`,hero:`Hero`,heroDescription:`Big heading, tagline and button`,products:`Products`,productsDescription:`Two product cards side by side`,features:`Features`,featuresDescription:`Three columns with heading + text`,testimonial:`Testimonial`,testimonialDescription:`Highlighted customer quote`,footer:`Footer`,footerDescription:`Social links, address and unsubscribe`},content:{heading:`Your heading here`,text:`This is a new text block. Click it to edit the content, select text to format it.`,button:`Click here`,image:`Image`,menuHome:`Home`,menuShop:`Shop`,menuBlog:`Blog`,menuContact:`Contact`,listItems:[`First item`,`Second item`,`Third item`],quote:`“A quote that highlights your message.”`,html:`<p style="margin:0;text-align:center;font-family:sans-serif">Your custom <strong>HTML</strong></p>`,cardTitle:`Did you know?`,cardText:`A card draws attention to an important piece of information.`,logo:`LOGO`,heroTitle:`What’s new this season`,heroText:`Discover our selection made for you, available today.`,heroButton:`Discover`,productA:`Product A`,productB:`Product B`,productText:`A short description of the product.`,productButton:`Buy`,features:[`Free shipping`,`Free returns`,`24/7 support`],featureText:`A clear and concise argument.`,testimonialQuote:`“Flawless service, I recommend it with my eyes closed.”`,testimonialAuthor:`— Camille, customer since 2021`,footerAddress:`Acme Inc. · 10 Main Street, Springfield`,unsubscribe:`Unsubscribe`,starterTitle:`Our favourites`},slashCommands:{}},Ae={topBar:{layers:`Calques`,toggleLayers:`Afficher / masquer les calques`,undo:`Annuler (Ctrl+Z)`,redo:`Rétablir (Ctrl+Y)`,canvasWidth:`Largeur du canvas`,desktop:`Bureau`,mobile:`Mobile`,template:`Modèle`,confirmTemplate:`Remplacer le contenu par le modèle de départ ?`,import:`Importer`,exportJson:`Enregistrer JSON`,preview:`Aperçu`,exportHtml:`Exporter HTML`,invalidFile:e=>`Fichier invalide : ${e}`},preview:{dialogLabel:`Aperçu et export`,desktop:`Bureau`,mobile:`Mobile`,html:`HTML`,text:`Texte brut`,copy:`Copier`,copied:`Copié ✓`,download:`Télécharger .html`,close:`Fermer`,rendering:`Rendu de l’email…`,renderError:e=>`Erreur de rendu : ${e}`,iframeTitle:`Aperçu de l’email`},sidebar:{label:`Panneau latéral`,tabContent:`Contenu`,tabBlocks:`Blocs`,tabBody:`Corps`,layoutTitle:`Mise en page`,contentTitle:`Contenus`,dragHint:`Glissez un élément dans l’email. Un clic l’ajoute à la fin.`,tileTitle:e=>`Glissez « ${e} » dans l’email (ou cliquez pour l’ajouter à la fin)`,propertiesEyebrow:`Propriétés`,closeProperties:`Fermer (retour aux contenus)`,breadcrumb:`Hiérarchie`,selectedText:`Texte sélectionné`},emailHeader:{subject:`Objet`,subjectPlaceholder:`Objet de l’email`,previewText:`Aperçu`,previewTextPlaceholder:`Affiché après l’objet dans la boîte de réception`},body:{general:`Général`,previewText:`Texte d’aperçu`,previewTextPlaceholder:`Affiché après l’objet dans la boîte de réception`,background:`Arrière-plan`,backgroundColor:`Couleur de fond`,outerPadding:`Marge extérieure`,content:`Contenu`,width:`Largeur`,contentColor:`Couleur du contenu`,innerPadding:`Marge intérieure`,radius:`Arrondi`,defaultStyles:`Styles par défaut`,font:`Police`,fontDefault:`Par défaut (police système)`,text:`Texte`,headings:`Titres`,links:`Liens`,buttonBackground:`Fond des boutons`,buttonText:`Texte des boutons`},inspector:{typography:`Typographie`,font:`Police`,fontDefault:`Par défaut (police de l’email)`,color:`Couleur`,size:`Taille`,weight:`Graisse`,weightLight:`Fin`,weightNormal:`Normal`,weightSemibold:`Semi-gras`,weightBold:`Gras`,weightExtrabold:`Extra-gras`,lineHeight:`Interligne`,alignment:`Alignement`,spacing:`Espacement`,padding:`Marge intérieure`,box:`Fond et bordure`,backgroundColor:`Couleur de fond`,radius:`Arrondi`,border:`Bordure`,borderColor:`Couleur de bordure`,image:`Image`,uploadImage:`Importer une image…`,imageUrl:`URL de l’image`,altText:`Texte alternatif`,altPlaceholder:`Décrivez l’image`,layout:`Disposition`,autoWidth:`Largeur auto`,width:`Largeur`,action:`Action`,clickLink:`Lien au clic`,linkUrl:`URL du lien`,button:`Bouton`,textColor:`Couleur du texte`,textSize:`Taille du texte`,buttonPadding:`Marges du bouton`,networks:`Réseaux`,removeNetwork:`Retirer`,addNetwork:`+ Ajouter un réseau`,appearance:`Apparence`,iconSize:`Taille des icônes`,gap:`Espacement`,columns:`Colonnes`,distribution:`Répartition`,equal:`Égales`,columnGap:`Espace entre colonnes`,columnsHint:`Cliquez dans une colonne pour régler son fond et ses marges.`,spacer:`Espacement`,height:`Hauteur`,htmlCode:`Code HTML`,htmlHint:`Le HTML est inséré tel quel dans l’email exporté.`,line:`Ligne`,thickness:`Épaisseur`,lineStyle:`Style`,heading:`Titre`,level:`Niveau`,formatting:`Mise en forme`,bold:`Gras`,italic:`Italique`,underline:`Souligné`,strike:`Barré`,link:`Lien`,url:`URL`,linkColor:`Couleur du lien`},fields:{colorDefault:`Par défaut`,chooseColor:e=>`Choisir une couleur (${e})`,hexCode:`Code hexadécimal`,eyedropper:`Pipette : prendre une couleur à l’écran`,documentColors:`Couleurs du document`,palette:`Palette`,resetColor:`Revenir à la valeur par défaut`,alignLeft:`Gauche`,alignCenter:`Centre`,alignRight:`Droite`,top:`Haut`,right:`Droite`,bottom:`Bas`,left:`Gauche`,moreOptions:`Plus d’options`,auto:`auto`},layers:{title:`Calques`,expandAll:`Tout déplier`,collapseAll:`Tout replier`,close:`Fermer les calques`,tree:`Structure de l’email`,emptyEmail:`L’email est vide.`,emptyZone:`Vide — déposez du contenu ici`,column:e=>`Colonne ${e}`,fixedHint:`Les colonnes restent dans leur ligne`,itemHint:`Cliquer pour sélectionner, glisser pour déplacer`,expand:`Déplier`,collapse:`Replier`,uploadedImage:`image importée`,empty:`vide`},canvas:{dropHere:`Déposer ici`,dropLabel:e=>e?`Déposer « ${e} » ici`:`Déposer ici`,emptyZone:`Glissez du contenu ici`,move:`Glisser pour déplacer`,moveLabel:e=>`Déplacer : ${e}`,selectParent:e=>`Sélectionner : ${e}`,duplicate:`Dupliquer`,delete:`Supprimer`},placeholder:{heading:`Titre`,paragraph:`Écrivez, ou tapez « / » pour les commandes`},nodes:{body:`Corps`,paragraph:`Texte`,heading:`Titre`,image:`Image`,button:`Bouton`,horizontalRule:`Séparateur`,spacer:`Espacement`,socialLinks:`Réseaux sociaux`,htmlBlock:`HTML`,section:`Section`,twoColumns:`Ligne · 2 colonnes`,threeColumns:`Ligne · 3 colonnes`,fourColumns:`Ligne · 4 colonnes`,columnsColumn:`Colonne`,bulletList:`Liste`,orderedList:`Liste numérotée`,listItem:`Élément de liste`,blockquote:`Citation`,codeBlock:`Code`,table:`Tableau`,container:`Email`},palette:{oneColumn:`1 colonne`,twoColumns:`2 colonnes`,threeColumns:`3 colonnes`,fourColumns:`4 colonnes`,heading:`Titre`,text:`Texte`,button:`Bouton`,image:`Image`,divider:`Séparateur`,spacer:`Espacement`,social:`Réseaux`,menu:`Menu`,list:`Liste`,quote:`Citation`,html:`HTML`,card:`Encadré`},templates:{header:`En-tête`,headerDescription:`Logo à gauche, menu à droite`,hero:`Hero`,heroDescription:`Grand titre, accroche et bouton`,products:`Produits`,productsDescription:`Deux cartes produit côte à côte`,features:`Avantages`,featuresDescription:`Trois colonnes titre + texte`,testimonial:`Témoignage`,testimonialDescription:`Citation client mise en avant`,footer:`Pied de page`,footerDescription:`Réseaux sociaux, adresse et désinscription`},content:{heading:`Votre titre ici`,text:`Ceci est un nouveau bloc de texte. Cliquez dessus pour modifier le contenu, sélectionnez du texte pour le mettre en forme.`,button:`Cliquez ici`,image:`Image`,menuHome:`Accueil`,menuShop:`Boutique`,menuBlog:`Blog`,menuContact:`Contact`,listItems:[`Premier point`,`Deuxième point`,`Troisième point`],quote:`« Une citation qui met en valeur votre message. »`,html:`<p style="margin:0;text-align:center;font-family:sans-serif">Votre <strong>HTML</strong> personnalisé</p>`,cardTitle:`Le saviez-vous ?`,cardText:`Un encadré attire l’œil sur une information importante.`,logo:`LOGO`,heroTitle:`Les nouveautés de la saison`,heroText:`Découvrez notre sélection pensée pour vous, disponible dès aujourd’hui.`,heroButton:`Découvrir`,productA:`Produit A`,productB:`Produit B`,productText:`Une courte description du produit.`,productButton:`Acheter`,features:[`Livraison offerte`,`Retours gratuits`,`Support 7j/7`],featureText:`Un argument clair et concis.`,testimonialQuote:`« Service impeccable, je recommande les yeux fermés. »`,testimonialAuthor:`— Camille, cliente depuis 2021`,footerAddress:`Acme SAS · 10 rue de la Paix, 75002 Paris`,unsubscribe:`Se désinscrire`,starterTitle:`Nos coups de cœur`},slashCommands:{Text:{title:`Texte`,description:`Paragraphe simple`},Title:{title:`Titre`,description:`Grand titre`},Subtitle:{title:`Sous-titre`,description:`Titre moyen`},Heading:{title:`Intertitre`,description:`Petit titre`},"Bullet list":{title:`Liste à puces`,description:`Liste non ordonnée`},"Numbered list":{title:`Liste numérotée`,description:`Liste ordonnée`},Quote:{title:`Citation`,description:`Bloc de citation`},"Code block":{title:`Bloc de code`,description:`Extrait de code`},Button:{title:`Bouton`,description:`Bouton cliquable`},Divider:{title:`Séparateur`,description:`Ligne horizontale`},Section:{title:`Section`,description:`Section de contenu`},"2 columns":{title:`2 colonnes`,description:`Mise en page sur deux colonnes`},"3 columns":{title:`3 colonnes`,description:`Mise en page sur trois colonnes`},"4 columns":{title:`4 colonnes`,description:`Mise en page sur quatre colonnes`}}},je={en:ke,fr:Ae};function R(e,t){return typeof e==`function`?e(t):e}function Me(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ne(e,t){if(!Me(t)||!Me(e))return t??e;let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=Me(r)&&Me(n[e])?Ne(n[e],r):r);return n}function Pe(e,t){let n=je[e]??ke;return t?Ne(n,t):n}var Fe=o({CopyIcon:()=>Le,DesktopIcon:()=>He,GripIcon:()=>Ie,LayersIcon:()=>We,MobileIcon:()=>Ue,OneColumnIcon:()=>Ye,ParentIcon:()=>ze,PipetteIcon:()=>Ge,RedoIcon:()=>Ve,SocialIcon:()=>Je,SpacerIcon:()=>Ke,SpacerTileIcon:()=>qe,TrashIcon:()=>Re,UndoIcon:()=>Be}),z=(e,t=2)=>({viewBox:`0 0 24 24`,width:e,height:e,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0}),Ie=({size:e=14})=>(0,x.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":!0,children:[6,12,18].map(e=>(0,x.jsxs)(`g`,{children:[(0,x.jsx)(`circle`,{cx:`9`,cy:e,r:`1.6`}),(0,x.jsx)(`circle`,{cx:`15`,cy:e,r:`1.6`})]},e))}),Le=({size:e=14})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,x.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]}),Re=({size:e=14})=>(0,x.jsx)(`svg`,{...z(e),children:(0,x.jsx)(`path`,{d:`M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3`})}),ze=({size:e=14})=>(0,x.jsx)(`svg`,{...z(e),children:(0,x.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})}),Be=({size:e=16})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`path`,{d:`M9 14 4 9l5-5`}),(0,x.jsx)(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),Ve=({size:e=16})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`path`,{d:`m15 14 5-5-5-5`}),(0,x.jsx)(`path`,{d:`M20 9H9.5a5.5 5.5 0 0 0 0 11H13`})]}),He=({size:e=16})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,x.jsx)(`path`,{d:`M8 20h8M12 16v4`})]}),Ue=({size:e=16})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`rect`,{x:`7`,y:`2`,width:`10`,height:`20`,rx:`2`}),(0,x.jsx)(`path`,{d:`M11 18h2`})]}),We=({size:e=16})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`path`,{d:`m12 3 9 5-9 5-9-5 9-5Z`}),(0,x.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),Ge=({size:e=15})=>(0,x.jsxs)(`svg`,{...z(e),children:[(0,x.jsx)(`path`,{d:`m2 22 1-1h3l9-9`}),(0,x.jsx)(`path`,{d:`M3 21v-3l9-9`}),(0,x.jsx)(`path`,{d:`m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z`})]}),Ke=({size:e=14})=>(0,x.jsx)(`svg`,{...z(e),children:(0,x.jsx)(`path`,{d:`M4 4h16M4 20h16M12 8v8`})}),qe=({size:e=22})=>(0,x.jsx)(`svg`,{...z(e,1.8),children:(0,x.jsx)(`path`,{d:`M4 4h16M4 20h16M12 7v10M9 9.5 12 7l3 2.5M9 14.5l3 2.5 3-2.5`})}),Je=({size:e=22})=>(0,x.jsxs)(`svg`,{...z(e,1.8),children:[(0,x.jsx)(`circle`,{cx:`6`,cy:`12`,r:`2.5`}),(0,x.jsx)(`circle`,{cx:`18`,cy:`6`,r:`2.5`}),(0,x.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2.5`}),(0,x.jsx)(`path`,{d:`m8.2 10.8 7.6-3.6M8.2 13.2l7.6 3.6`})]}),Ye=({size:e=22})=>(0,x.jsx)(`svg`,{...z(e,1.8),children:(0,x.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})});function B({title:e,children:t,defaultOpen:n=!0,className:r,style:i}){let[a,o]=(0,l.useState)(n);return(0,x.jsxs)(`section`,{className:E(`bree-group`,r),style:i,children:[(0,x.jsxs)(`button`,{type:`button`,className:`bree-group-header`,onClick:()=>o(!a),"aria-expanded":a,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`span`,{className:E(`bree-chevron`,a&&`bree-open`),"aria-hidden":!0,children:`›`})]}),a&&(0,x.jsx)(`div`,{className:`bree-group-body`,children:t})]})}function V({label:e,children:t,stacked:n,className:r,style:i}){return(0,x.jsxs)(`label`,{className:E(`bree-field`,n&&`bree-stacked`,r),style:i,children:[(0,x.jsx)(`span`,{className:`bree-field-label`,children:e}),(0,x.jsx)(`span`,{className:`bree-field-control`,children:t})]})}function Xe(e){let[t,n]=(0,l.useState)(e),[r,i]=(0,l.useState)(e);return Object.is(e,r)||(i(e),n(e)),[t,n]}function H({value:e,onChange:t,placeholder:n,type:r=`text`,className:i,style:a}){let[o,s]=Xe(e);return(0,x.jsx)(`input`,{className:E(`bree-input`,i),style:a,type:r,value:o,placeholder:n,onChange:e=>s(e.target.value),onBlur:()=>o!==e&&t(o),onKeyDown:e=>{e.key===`Enter`&&t(o)}})}function Ze({value:e,onChange:t,rows:n=8,className:r,style:i}){let[a,o]=Xe(e);return(0,x.jsx)(`textarea`,{className:E(`bree-input bree-textarea`,r),style:i,rows:n,value:a,spellCheck:!1,onChange:e=>o(e.target.value),onBlur:()=>a!==e&&t(a)})}function Qe(e){if(e==null||e===``||e===`auto`)return``;let t=Number.parseFloat(String(e));return Number.isFinite(t)?t:``}function U({value:e,onChange:t,unit:n=`px`,min:r=0,max:i,step:a=1,placeholder:o,className:s,style:c}){let l=$(),[u,d]=Xe(String(Qe(e))),f=e=>{if(e.trim()===``)return t(``);let n=Number.parseFloat(e);Number.isFinite(n)&&t(Math.max(r,i===void 0?n:Math.min(i,n)))};return(0,x.jsxs)(`span`,{className:E(`bree-number`,s),style:c,children:[(0,x.jsx)(`input`,{className:`bree-input`,inputMode:`decimal`,value:u,placeholder:o??l.fields.auto,onChange:e=>d(e.target.value),onBlur:()=>f(u),onKeyDown:e=>{if(e.key===`Enter`&&f(u),e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=(Qe(u)||0)+(e.key===`ArrowUp`?a:-a)*(e.shiftKey?10:1);d(String(t)),f(String(t))}}}),n&&(0,x.jsx)(`span`,{className:`bree-unit`,children:n})]})}function $e({value:e,onChange:t,min:n,max:r,unit:i=`px`,className:a,style:o}){let s=Qe(e)||n;return(0,x.jsxs)(`span`,{className:E(`bree-range`,a),style:o,children:[(0,x.jsx)(`input`,{type:`range`,min:n,max:r,value:s,onChange:e=>t(Number(e.target.value))}),(0,x.jsxs)(`span`,{className:`bree-range-value`,children:[s,i]})]})}var et=[`#111827`,`#374151`,`#6b7280`,`#d1d5db`,`#f3f4f6`,`#ffffff`,`#ef4444`,`#f97316`,`#f59e0b`,`#10b981`,`#0ea5e9`,`#2563eb`,`#4f46e5`,`#7c3aed`,`#db2777`,`#eef2ff`,`#ecfdf5`,`#fef3c7`];function tt(e){let t=e.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return`#${[...t.slice(1)].map(e=>e+e).join(``)}`;let n=t.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/);return n?`#${n.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`:null}function W({value:e,onChange:t,presets:n=[],swatches:r=et,placeholder:i,className:a,style:o,popoverClassName:s}){let c=$(),u=i??c.fields.colorDefault,d=typeof e==`string`?e:``,f=tt(d),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(f??`#ffffff`),_=(0,l.useRef)(t);(0,l.useEffect)(()=>{_.current=t});let v=(0,l.useRef)(null),y=(0,l.useRef)(0),w=()=>{window.clearTimeout(y.current),y.current=0,v.current&&_.current(v.current),v.current=null},T=e=>{g(e),v.current=e,y.current||=window.setTimeout(w,60)},D=e=>{v.current=null,window.clearTimeout(y.current),y.current=0,g(tt(e)??h),_.current(e)},O=typeof window<`u`?window.EyeDropper:void 0,ee=[...new Set(n.map(e=>tt(e)).filter(e=>!!e))].slice(0,9);return(0,x.jsxs)(S.Root,{open:p,onOpenChange:e=>{e?g(f??`#ffffff`):w(),m(e)},children:[(0,x.jsxs)(`span`,{className:E(`bree-color-field`,a),style:o,children:[(0,x.jsx)(S.Trigger,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:E(`bree-color-trigger`,!f&&`bree-empty`),style:f?{background:f}:void 0,"aria-label":c.fields.chooseColor(d||u)})}),(0,x.jsx)(H,{value:d,onChange:t,placeholder:u})]}),(0,x.jsx)(S.Portal,{children:(0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsxs)(S.Content,{className:E(`bree bree-color-popover`,s),side:`left`,align:`start`,sideOffset:10,collisionPadding:12,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,x.jsx)(C.HexColorPicker,{color:h,onChange:T}),(0,x.jsxs)(`div`,{className:`bree-color-popover-row`,children:[(0,x.jsx)(`span`,{className:`bree-color-preview`,style:{background:h}}),(0,x.jsxs)(`label`,{className:`bree-hex-field`,children:[(0,x.jsx)(`span`,{children:`#`}),(0,x.jsx)(C.HexColorInput,{color:h,onChange:D,"aria-label":c.fields.hexCode})]}),O&&(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:c.fields.eyedropper,onClick:()=>new O().open().then(e=>D(e.sRGBHex)).catch(()=>{}),children:(0,x.jsx)(Ge,{})})]}),ee.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`bree-color-popover-title`,children:c.fields.documentColors}),(0,x.jsx)(`div`,{className:`bree-swatches`,children:ee.map(e=>(0,x.jsx)(`button`,{type:`button`,className:`bree-swatch`,style:{background:e},title:e,onClick:()=>D(e)},e))})]}),(0,x.jsx)(`span`,{className:`bree-color-popover-title`,children:c.fields.palette}),(0,x.jsx)(`div`,{className:`bree-swatches`,children:r.map(e=>(0,x.jsx)(`button`,{type:`button`,className:E(`bree-swatch`,e===h&&`bree-active`),style:{background:e},title:e,onClick:()=>D(e)},e))}),(0,x.jsx)(`button`,{type:`button`,className:`bree-color-reset`,onClick:()=>{v.current=null,_.current(``),m(!1)},children:c.fields.resetColor})]})})})]})}function nt({value:e,onChange:t,options:n,className:r,style:i}){return(0,x.jsx)(`select`,{className:E(`bree-input bree-select`,r),style:i,value:e,onChange:e=>t(e.target.value),children:n.map(([e,t])=>(0,x.jsx)(`option`,{value:e,children:t},e))})}function rt({value:e,onChange:t,emptyLabel:n,className:r,style:i}){let a=Jt()?.fonts??we,o=Ee(a,e),s=e&&!o?{label:e.split(`,`)[0].replace(/['"]/g,``).trim(),value:e}:null,c=s?[...a,s]:a;return(0,x.jsxs)(`select`,{className:E(`bree-input bree-select`,r),style:{fontFamily:e||void 0,...i},value:o?.value??e??``,onChange:e=>t(e.target.value),children:[(n!==void 0||!e)&&(0,x.jsx)(`option`,{value:``,children:n??``}),c.map(e=>(0,x.jsx)(`option`,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))]})}function it({value:e,onChange:t,options:n,ariaLabel:r,className:i,style:a}){return(0,x.jsx)(`span`,{className:E(`bree-segmented`,i),style:a,role:`radiogroup`,"aria-label":r,children:n.map(n=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n.value,title:n.title,className:E(e===n.value&&`bree-active`),onClick:()=>t(n.value),children:n.label},n.value))})}function at({value:e,onChange:t,className:n,style:r}){let i=$();return(0,x.jsx)(it,{className:n,style:r,value:e||`left`,onChange:t,options:[{value:`left`,label:(0,x.jsx)(b.AlignLeftIcon,{size:14}),title:i.fields.alignLeft},{value:`center`,label:(0,x.jsx)(b.AlignCenterIcon,{size:14}),title:i.fields.alignCenter},{value:`right`,label:(0,x.jsx)(b.AlignRightIcon,{size:14}),title:i.fields.alignRight}]})}function ot({get:e,set:t,className:n,style:r}){let i=$(),a=[`Top`,`Right`,`Bottom`,`Left`],o=a.map(t=>Qe(e(t))),s=o.every(e=>e===o[0]),[c,u]=(0,l.useState)(!s),d={Top:i.fields.top,Right:i.fields.right,Bottom:i.fields.bottom,Left:i.fields.left};return(0,x.jsxs)(`div`,{className:E(`bree-padding`,n),style:r,children:[c?(0,x.jsx)(`div`,{className:`bree-padding-grid`,children:a.map((e,n)=>(0,x.jsxs)(`label`,{className:`bree-padding-side`,children:[(0,x.jsx)(`span`,{children:d[e]}),(0,x.jsx)(U,{value:o[n],onChange:n=>t([[e,n]])})]},e))}):(0,x.jsx)(U,{value:o[0],onChange:e=>t(a.map(t=>[t,e]))}),(0,x.jsxs)(`label`,{className:`bree-checkbox`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>u(e.target.checked)}),i.fields.moreOptions]})]})}var G=e=>e;function st({ctx:e,alignment:t,setAlignment:n,className:r,style:i}){let a=$().inspector;return(0,x.jsxs)(B,{title:a.typography,className:r,style:i,children:[(0,x.jsx)(V,{label:a.font,children:(0,x.jsx)(rt,{value:e.getStyle(G(`fontFamily`)),emptyLabel:a.fontDefault,onChange:t=>e.setStyle(G(`fontFamily`),t)})}),(0,x.jsx)(V,{label:a.color,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`color`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`color`),t)})}),(0,x.jsx)(V,{label:a.size,children:(0,x.jsx)(U,{value:e.getStyle(G(`fontSize`)),onChange:t=>e.setStyle(G(`fontSize`),t),min:8,max:96})}),(0,x.jsx)(V,{label:a.weight,children:(0,x.jsx)(nt,{value:String(e.getStyle(G(`fontWeight`))??`400`),onChange:t=>e.setStyle(G(`fontWeight`),t),options:[[`300`,a.weightLight],[`400`,a.weightNormal],[`600`,a.weightSemibold],[`700`,a.weightBold],[`800`,a.weightExtrabold]]})}),(0,x.jsx)(V,{label:a.lineHeight,children:(0,x.jsx)(U,{value:e.getStyle(G(`lineHeight`)),unit:`%`,onChange:t=>e.setStyle(G(`lineHeight`),t),min:80,max:300,step:5})}),n&&(0,x.jsx)(V,{label:a.alignment,children:(0,x.jsx)(at,{value:t??`left`,onChange:n})})]})}function K({ctx:e,title:t,className:n,style:r}){let i=$();return(0,x.jsx)(B,{title:t??i.inspector.spacing,className:n,style:r,children:(0,x.jsx)(V,{label:i.inspector.padding,stacked:!0,children:(0,x.jsx)(ot,{get:t=>e.getStyle(G(`padding${t}`))??e.getStyle(G(`padding`)),set:t=>e.batchSetStyle([{prop:G(`padding`),value:``},...t.map(([e,t])=>({prop:G(`padding${e}`),value:t}))])})})})}function ct({ctx:e,className:t,style:n}){let r=$().inspector;return(0,x.jsxs)(B,{title:r.box,className:t,style:n,children:[(0,x.jsx)(V,{label:r.backgroundColor,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`backgroundColor`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`backgroundColor`),t)})}),(0,x.jsx)(V,{label:r.radius,children:(0,x.jsx)(U,{value:e.getStyle(G(`borderRadius`)),onChange:t=>e.setStyle(G(`borderRadius`),t)})}),(0,x.jsx)(V,{label:r.border,children:(0,x.jsx)(U,{value:e.getStyle(G(`borderWidth`)),onChange:t=>e.batchSetStyle([{prop:G(`borderWidth`),value:t},{prop:G(`borderStyle`),value:t?`solid`:``}])})}),(0,x.jsx)(V,{label:r.borderColor,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`borderColor`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`borderColor`),t)})})]})}function lt({ctx:e,className:t,style:n}){let r=$().inspector;return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsx)(B,{title:r.action,children:(0,x.jsx)(V,{label:r.linkUrl,stacked:!0,children:(0,x.jsx)(H,{value:String(e.getAttr(`href`)??``),onChange:t=>e.setAttr(`href`,t),placeholder:`https://`})})}),(0,x.jsxs)(B,{title:r.button,children:[(0,x.jsx)(V,{label:r.alignment,children:(0,x.jsx)(at,{value:String(e.getAttr(`alignment`)??`left`),onChange:t=>e.setAttr(`alignment`,t)})}),(0,x.jsx)(V,{label:r.backgroundColor,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`backgroundColor`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`backgroundColor`),t)})}),(0,x.jsx)(V,{label:r.textColor,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`color`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`color`),t)})}),(0,x.jsx)(V,{label:r.textSize,children:(0,x.jsx)(U,{value:e.getStyle(G(`fontSize`)),onChange:t=>e.setStyle(G(`fontSize`),t),min:8,max:48})}),(0,x.jsx)(V,{label:r.radius,children:(0,x.jsx)(U,{value:e.getStyle(G(`borderRadius`)),onChange:t=>e.setStyle(G(`borderRadius`),t)})})]}),(0,x.jsx)(K,{ctx:e,title:r.buttonPadding})]})}function ut({ctx:e,className:t,style:n}){let{editor:r,t:i}=Q(),a=i.inspector,o={twoColumns:2,threeColumns:3,fourColumns:4}[e.nodeType]??2,s=o===2?[[`50 / 50`,[50,50]],[`33 / 67`,[33,67]],[`67 / 33`,[67,33]],[`25 / 75`,[25,75]]]:o===3?[[a.equal,[33.33,33.33,33.34]],[`25 / 50 / 25`,[25,50,25]]]:[[a.equal,[25,25,25,25]]],c=t=>{let{state:n}=r,i=n.doc.nodeAt(e.nodePos.pos);if(!i)return;let a=n.tr;i.forEach((n,r,i)=>{let o=e.nodePos.pos+1+r,s=String(n.attrs.style??``).split(`;`).filter(e=>e.trim()&&!e.trim().startsWith(`width`)).join(`;`);a.setNodeMarkup(o,void 0,{...n.attrs,style:`${s?`${s};`:``}width:${t[i]}%`})}),n.selection instanceof g.NodeSelection&&a.setSelection(g.NodeSelection.create(a.doc,e.nodePos.pos)),r.view.dispatch(a)};return(0,x.jsx)(`div`,{className:E(`bree-inspector`,t),style:n,children:(0,x.jsxs)(B,{title:a.columns,children:[(0,x.jsx)(V,{label:a.distribution,stacked:!0,children:(0,x.jsx)(`div`,{className:`bree-ratio-grid`,children:s.map(([e,t])=>(0,x.jsxs)(`button`,{type:`button`,className:`bree-ratio`,onClick:()=>c(t),children:[(0,x.jsx)(`span`,{className:`bree-ratio-bars`,children:t.map((e,t)=>(0,x.jsx)(`i`,{style:{flex:e}},t))}),e]},e))})}),(0,x.jsx)(V,{label:a.columnGap,children:(0,x.jsx)(U,{value:e.getAttr(`cellspacing`)??0,onChange:t=>e.setAttr(`cellspacing`,t===``?null:t)})}),(0,x.jsx)(`p`,{className:`bree-hint`,children:a.columnsHint})]})})}function dt({ctx:e,className:t,style:n}){let r=$();return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsx)(B,{title:r.inspector.heading,children:(0,x.jsx)(V,{label:r.inspector.level,children:(0,x.jsx)(it,{value:String(e.getAttr(`level`)??1),onChange:t=>e.setAttr(`level`,Number(t)),options:[{value:`1`,label:`H1`},{value:`2`,label:`H2`},{value:`3`,label:`H3`}]})})}),(0,x.jsx)(st,{ctx:e,alignment:String(e.getAttr(`alignment`)??`left`),setAlignment:t=>e.setAttr(`alignment`,t)}),(0,x.jsx)(K,{ctx:e}),(0,x.jsx)(ct,{ctx:e})]})}function ft({ctx:e,className:t,style:n}){let{t:r,uploadImage:i}=Q(),a=r.inspector,o=String(e.getAttr(`width`)??`auto`);return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsxs)(B,{title:a.image,children:[(0,x.jsx)(`div`,{className:`bree-image-preview`,children:e.getAttr(`src`)?(0,x.jsx)(`img`,{src:String(e.getAttr(`src`)),alt:``}):null}),(0,x.jsxs)(`label`,{className:`bree-button-like`,children:[a.uploadImage,(0,x.jsx)(`input`,{type:`file`,accept:`image/*`,hidden:!0,onChange:async t=>{let n=t.target.files?.[0];n&&e.setAttr(`src`,(await i(n)).url),t.target.value=``}})]}),(0,x.jsx)(V,{label:a.imageUrl,stacked:!0,children:(0,x.jsx)(H,{value:String(e.getAttr(`src`)??``),onChange:t=>e.setAttr(`src`,t)})}),(0,x.jsx)(V,{label:a.altText,stacked:!0,children:(0,x.jsx)(H,{value:String(e.getAttr(`alt`)??``),onChange:t=>e.setAttr(`alt`,t),placeholder:a.altPlaceholder})})]}),(0,x.jsxs)(B,{title:a.layout,children:[(0,x.jsx)(V,{label:a.autoWidth,children:(0,x.jsx)(`input`,{type:`checkbox`,checked:o===`auto`,onChange:t=>e.setAttr(`width`,t.target.checked?`auto`:`300`)})}),o!==`auto`&&(0,x.jsx)(V,{label:a.width,children:(0,x.jsx)($e,{value:o,min:20,max:900,onChange:t=>e.setAttr(`width`,String(t))})}),(0,x.jsx)(V,{label:a.alignment,children:(0,x.jsx)(at,{value:String(e.getAttr(`alignment`)??`center`),onChange:t=>e.setAttr(`alignment`,t)})}),(0,x.jsx)(V,{label:a.radius,children:(0,x.jsx)(U,{value:e.getStyle(G(`borderRadius`)),onChange:t=>e.setStyle(G(`borderRadius`),t)})})]}),(0,x.jsx)(B,{title:a.action,children:(0,x.jsx)(V,{label:a.clickLink,stacked:!0,children:(0,x.jsx)(H,{value:String(e.getAttr(`href`)??``),onChange:t=>e.setAttr(`href`,t||null),placeholder:`https://`})})}),(0,x.jsx)(K,{ctx:e})]})}function pt({ctx:e,className:t,style:n}){let r=$();return(0,x.jsx)(`div`,{className:E(`bree-inspector`,t),style:n,children:(0,x.jsx)(B,{title:r.inspector.spacer,children:(0,x.jsx)(V,{label:r.inspector.height,children:(0,x.jsx)($e,{value:e.getAttr(`height`),min:4,max:160,onChange:t=>e.setAttr(`height`,t)})})})})}function mt({ctx:e,className:t,style:n}){let r=$();return(0,x.jsx)(`div`,{className:E(`bree-inspector`,t),style:n,children:(0,x.jsxs)(B,{title:r.inspector.htmlCode,children:[(0,x.jsx)(Ze,{value:String(e.getAttr(`html`)??``),onChange:t=>e.setAttr(`html`,t),rows:14}),(0,x.jsx)(`p`,{className:`bree-hint`,children:r.inspector.htmlHint})]})})}function ht({ctx:e,className:t,style:n}){let r=$().inspector;return(0,x.jsx)(`div`,{className:E(`bree-inspector`,t),style:n,children:(0,x.jsxs)(B,{title:r.line,children:[(0,x.jsx)(V,{label:r.color,stacked:!0,children:(0,x.jsx)(W,{value:e.getStyle(G(`borderTopColor`)),presets:e.presetColors,onChange:t=>e.setStyle(G(`borderTopColor`),t)})}),(0,x.jsx)(V,{label:r.thickness,children:(0,x.jsx)(U,{value:e.getStyle(G(`borderTopWidth`))??1,onChange:t=>e.batchSetStyle([{prop:G(`borderTopWidth`),value:t},{prop:G(`borderTopStyle`),value:`solid`}]),min:1,max:12})}),(0,x.jsx)(V,{label:r.lineStyle,children:(0,x.jsx)(it,{value:String(e.getStyle(G(`borderTopStyle`))??`solid`),onChange:t=>e.setStyle(G(`borderTopStyle`),t),options:[{value:`solid`,label:`———`},{value:`dashed`,label:`- - -`},{value:`dotted`,label:`· · ·`}]})})]})})}function gt({ctx:e,className:t,style:n}){return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsx)(ct,{ctx:e}),(0,x.jsx)(K,{ctx:e})]})}function _t(e){if(typeof e!=`string`||!e.trim())return{};let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]=i)}return t}var vt={style:{default:null,parseHTML:e=>e.getAttribute(`style`),renderHTML:e=>e.style?{style:e.style}:{}}},yt=f.EmailNode.create({name:`spacer`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{...vt,height:{default:32,parseHTML:e=>Number(e.dataset.height)||32,renderHTML:e=>({"data-height":e.height})}}},parseHTML(){return[{tag:`div[data-type="spacer"]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,(0,v.mergeAttributes)(t,{"data-type":`spacer`,class:`node-spacer`,style:`height:${Number(e.attrs.height)}px`})]},renderToReactEmail({node:e}){let t=Number(e.attrs?.height??32);return(0,x.jsx)(w.Section,{style:{height:t,lineHeight:`${t}px`,fontSize:`1px`,..._t(e.attrs?.style)},children:`\xA0`})}}),bt={facebook:{label:`Facebook`,slug:`facebook`,color:`1877F2`},instagram:{label:`Instagram`,slug:`instagram`,color:`E4405F`},x:{label:`X`,slug:`x`,color:`000000`},linkedin:{label:`LinkedIn`,slug:`linkedin`,color:`0A66C2`},youtube:{label:`YouTube`,slug:`youtube`,color:`FF0000`},tiktok:{label:`TikTok`,slug:`tiktok`,color:`000000`},github:{label:`GitHub`,slug:`github`,color:`181717`}},xt={linkedin:`https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/linkedin.svg`};function St(e){if(xt[e])return xt[e];let t=bt[e]??bt.facebook;return`https://cdn.simpleicons.org/${t.slug}/${t.color}`}function Ct(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}var wt=f.EmailNode.create({name:`socialLinks`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{...vt,links:{default:[{network:`facebook`,url:`https://facebook.com/`},{network:`instagram`,url:`https://instagram.com/`},{network:`x`,url:`https://x.com/`},{network:`linkedin`,url:`https://linkedin.com/`}],parseHTML:e=>Ct(e.dataset.links),renderHTML:e=>({"data-links":JSON.stringify(e.links??[])})},size:{default:28},gap:{default:12},alignment:{default:`center`}}},parseHTML(){return[{tag:`div[data-type="social-links"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=Number(e.attrs.size),r=Number(e.attrs.gap),i=Ct(e.attrs.links);return[`div`,(0,v.mergeAttributes)(t,{"data-type":`social-links`,class:`node-socialLinks`,alignment:e.attrs.alignment}),...i.map((e,t)=>[`span`,{class:`node-socialLinks-item`,style:`margin-left:${t===0?0:r}px`},[`img`,{src:St(e.network),width:String(n),height:String(n),alt:bt[e.network]?.label??e.network}]])]},renderToReactEmail({node:e}){let t=Number(e.attrs?.size??28),n=Number(e.attrs?.gap??12),r=Ct(e.attrs?.links),i=e.attrs?.alignment??`center`;return(0,x.jsx)(w.Section,{style:_t(e.attrs?.style),children:(0,x.jsx)(w.Row,{children:(0,x.jsx)(w.Column,{align:i,children:r.map((e,r)=>(0,x.jsx)(w.Link,{href:e.url,style:{display:`inline-block`,marginLeft:r===0?0:n},children:(0,x.jsx)(w.Img,{src:St(e.network),width:t,height:t,alt:bt[e.network]?.label??e.network})},`${e.network}-${r}`))})})})}}),Tt=f.EmailNode.create({name:`htmlBlock`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{html:{default:`<p style="margin:0;text-align:center;font-family:sans-serif">Your custom <strong>HTML</strong></p>`,parseHTML:e=>e.dataset.html??e.innerHTML,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="html-block"]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,(0,v.mergeAttributes)(t,{"data-type":`html-block`,class:`node-htmlBlock`,"data-html":e.attrs.html})]},addNodeView(){return({node:e})=>{let t=document.createElement(`div`);return t.className=`node-htmlBlock`,t.dataset.type=`html-block`,t.innerHTML=e.attrs.html,{dom:t,update(n){return n.type===e.type&&(t.innerHTML=n.attrs.html,!0)},ignoreMutation:()=>!0}}},renderToReactEmail({node:e}){return(0,x.jsx)(`div`,{dangerouslySetInnerHTML:{__html:e.attrs?.html??``}})}});function Et({ctx:e,className:t,style:n}){let r=$().inspector,i=e.getAttr(`links`),a=Array.isArray(i)?i:[],o=t=>e.setAttr(`links`,t);return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsxs)(B,{title:r.networks,children:[(0,x.jsx)(`div`,{className:`bree-social-list`,children:a.map((e,t)=>(0,x.jsxs)(`div`,{className:`bree-social-row`,children:[(0,x.jsx)(nt,{value:e.network,onChange:e=>o(a.map((n,r)=>r===t?{...n,network:e}:n)),options:Object.entries(bt).map(([e,t])=>[e,t.label])}),(0,x.jsx)(H,{value:e.url,onChange:e=>o(a.map((n,r)=>r===t?{...n,url:e}:n))}),(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.removeNetwork,onClick:()=>o(a.filter((e,n)=>n!==t)),children:(0,x.jsx)(b.XIcon,{size:14})})]},t))}),(0,x.jsx)(`button`,{type:`button`,className:`bree-button-like`,onClick:()=>o([...a,{network:`youtube`,url:`https://youtube.com/`}]),children:r.addNetwork})]}),(0,x.jsxs)(B,{title:r.appearance,children:[(0,x.jsx)(V,{label:r.iconSize,children:(0,x.jsx)($e,{value:e.getAttr(`size`),min:16,max:64,onChange:t=>e.setAttr(`size`,t)})}),(0,x.jsx)(V,{label:r.gap,children:(0,x.jsx)($e,{value:e.getAttr(`gap`),min:0,max:40,onChange:t=>e.setAttr(`gap`,t)})}),(0,x.jsx)(V,{label:r.alignment,children:(0,x.jsx)(at,{value:String(e.getAttr(`alignment`)??`center`),onChange:t=>e.setAttr(`alignment`,t)})})]}),(0,x.jsx)(K,{ctx:e})]})}function Dt(e,t=36){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t)}…`:n}var Ot=(e,{t})=>Dt(e.textContent)||t.layers.empty,kt=()=>``,At=[{type:`paragraph`,icon:b.TypeIcon},{type:`heading`,icon:b.Heading1Icon,inspector:dt},{type:`image`,icon:b.ImageIcon,inspector:ft,preview:(e,{t})=>{let{attrs:n}=e;if(n.alt)return Dt(n.alt);let r=String(n.src??``);if(r.startsWith(`data:`))return t.layers.uploadedImage;try{let e=new URL(r);return Dt(e.searchParams.get(`text`)??decodeURIComponent(e.pathname.split(`/`).pop()??``))}catch{return``}}},{type:`button`,icon:b.MousePointerClickIcon,inspector:lt},{type:`horizontalRule`,icon:b.MinusIcon,inspector:ht,preview:kt},{type:`spacer`,icon:Ke,inspector:pt,preview:e=>`${e.attrs.height}px`,extensions:[yt]},{type:`socialLinks`,icon:b.LinkIcon,inspector:Et,preview:e=>Array.isArray(e.attrs.links)?e.attrs.links.map(e=>e.network).join(`, `):``,extensions:[wt]},{type:`htmlBlock`,icon:b.SquareCodeIcon,inspector:mt,preview:e=>Dt(String(e.attrs.html??``).replace(/<[^>]+>/g,` `)),extensions:[Tt]},{type:`section`,icon:b.LayoutIcon,inspector:gt,preview:kt},{type:`columnsColumn`,icon:b.PanelLeftIcon,inspector:gt,preview:kt},{type:`twoColumns`,icon:b.Columns2Icon,inspector:ut,preview:kt},{type:`threeColumns`,icon:b.Columns3Icon,inspector:ut,preview:kt},{type:`fourColumns`,icon:b.Columns4Icon,inspector:ut,preview:kt},{type:`bulletList`,icon:b.ListIcon},{type:`orderedList`,icon:b.ListOrderedIcon},{type:`blockquote`,icon:b.TextQuoteIcon},{type:`codeBlock`,icon:b.CodeIcon},{type:`table`,icon:b.TableIcon}],jt=o({button:()=>Mt,column:()=>Pt,columns:()=>X,doc:()=>Bt,heading:()=>Y,image:()=>Nt,link:()=>Rt,padding:()=>Lt,paragraph:()=>J,placeholderImage:()=>zt,section:()=>It,sized:()=>Ft,text:()=>q}),q=(e,t)=>({type:`text`,text:e,...t?{marks:t}:{}}),J=(e=``,t={})=>({type:`paragraph`,attrs:t,content:typeof e==`string`?e?[q(e)]:[]:e}),Y=(e,t,n={})=>({type:`heading`,attrs:{level:e,...n},content:[q(t)]}),Mt=(e,t={})=>({type:`button`,attrs:{href:`https://example.com`,alignment:`center`,...t},content:[q(e)]}),Nt=(e,t={})=>({type:`image`,attrs:{src:e,alt:``,alignment:`center`,...t}}),Pt=(...e)=>({type:`columnsColumn`,content:e.length?e:[J()]}),Ft=(e,t)=>({...e,attrs:{...e.attrs,style:`width:${t}%`}}),X=(e,t,n)=>({type:{2:`twoColumns`,3:`threeColumns`,4:`fourColumns`}[e],...n?{attrs:n}:{},content:t??Array.from({length:e},()=>Pt())}),It=(e,...t)=>({type:`section`,attrs:{style:e},content:t}),Lt=(e,t=e)=>`padding-top:${e}px;padding-right:${t}px;padding-bottom:${e}px;padding-left:${t}px`,Rt=e=>[{type:`link`,attrs:{href:e}}],zt=(e,t,n=`Image`)=>`https://placehold.co/${e}x${t}/e2e8f0/64748b/png?text=${encodeURIComponent(n)}`,Bt=(...e)=>({type:`doc`,content:e}),Vt=({t:e},t=`center`)=>J([q(e.content.menuHome,Rt(`https://example.com`)),q(` · `),q(e.content.menuShop,Rt(`https://example.com/shop`)),q(` · `),q(e.content.menuBlog,Rt(`https://example.com/blog`)),q(` · `),q(e.content.menuContact,Rt(`https://example.com/contact`))],{alignment:t}),Ht=[{id:`layout`,title:({t:e})=>e.sidebar.layoutTitle},{id:`content`,title:({t:e})=>e.sidebar.contentTitle}],Ut=[{id:`section`,group:`layout`,label:({t:e})=>e.palette.oneColumn,icon:(0,x.jsx)(Ye,{}),content:()=>[It(Lt(16),J())]},{id:`columns-2`,group:`layout`,label:({t:e})=>e.palette.twoColumns,icon:(0,x.jsx)(b.Columns2Icon,{size:22}),content:()=>[X(2)]},{id:`columns-3`,group:`layout`,label:({t:e})=>e.palette.threeColumns,icon:(0,x.jsx)(b.Columns3Icon,{size:22}),content:()=>[X(3)]},{id:`columns-4`,group:`layout`,label:({t:e})=>e.palette.fourColumns,icon:(0,x.jsx)(b.Columns4Icon,{size:22}),content:()=>[X(4)]},{id:`heading`,group:`content`,label:({t:e})=>e.palette.heading,icon:(0,x.jsx)(b.Heading1Icon,{size:22}),content:({t:e})=>[Y(2,e.content.heading)]},{id:`text`,group:`content`,label:({t:e})=>e.palette.text,icon:(0,x.jsx)(b.TypeIcon,{size:22}),content:({t:e})=>[J(e.content.text)]},{id:`button`,group:`content`,label:({t:e})=>e.palette.button,icon:(0,x.jsx)(b.MousePointerClickIcon,{size:22}),content:({t:e})=>[Mt(e.content.button)]},{id:`image`,group:`content`,label:({t:e})=>e.palette.image,icon:(0,x.jsx)(b.ImageIcon,{size:22}),content:({t:e})=>[Nt(zt(600,300,e.content.image))]},{id:`divider`,group:`content`,label:({t:e})=>e.palette.divider,icon:(0,x.jsx)(b.MinusIcon,{size:22}),content:()=>[{type:`horizontalRule`}]},{id:`spacer`,group:`content`,label:({t:e})=>e.palette.spacer,icon:(0,x.jsx)(qe,{}),content:()=>[{type:`spacer`,attrs:{height:32}}]},{id:`social`,group:`content`,label:({t:e})=>e.palette.social,icon:(0,x.jsx)(Je,{}),content:()=>[{type:`socialLinks`}]},{id:`menu`,group:`content`,label:({t:e})=>e.palette.menu,icon:(0,x.jsx)(b.PanelTopIcon,{size:22}),content:e=>[Vt(e)]},{id:`list`,group:`content`,label:({t:e})=>e.palette.list,icon:(0,x.jsx)(b.ListIcon,{size:22}),content:({t:e})=>[{type:`bulletList`,content:e.content.listItems.map(e=>({type:`listItem`,content:[J(e)]}))}]},{id:`quote`,group:`content`,label:({t:e})=>e.palette.quote,icon:(0,x.jsx)(b.TextQuoteIcon,{size:22}),content:({t:e})=>[{type:`blockquote`,content:[J(e.content.quote)]}]},{id:`html`,group:`content`,label:({t:e})=>e.palette.html,icon:(0,x.jsx)(b.SquareCodeIcon,{size:22}),content:({t:e})=>[{type:`htmlBlock`,attrs:{html:e.content.html}}]},{id:`card`,group:`content`,label:({t:e})=>e.palette.card,icon:(0,x.jsx)(b.LayoutIcon,{size:22}),content:({t:e})=>[It(`${Lt(24)};background-color:#f1f5f9;border-radius:12px`,Y(3,e.content.cardTitle),J(e.content.cardText))]}];function Z({variant:e}){return(0,x.jsxs)(`span`,{className:`bree-block-thumb bree-thumb-${e}`,"aria-hidden":!0,children:[(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{})]})}var Wt=[{id:`header`,label:({t:e})=>e.templates.header,description:({t:e})=>e.templates.headerDescription,thumbnail:(0,x.jsx)(Z,{variant:`header`}),content:e=>[X(2,[Ft(Pt(Nt(zt(140,40,e.t.content.logo),{alignment:`left`,width:`140`})),33),Ft(Pt(Vt(e,`right`)),67)])]},{id:`hero`,label:({t:e})=>e.templates.hero,description:({t:e})=>e.templates.heroDescription,thumbnail:(0,x.jsx)(Z,{variant:`hero`}),content:({t:e})=>[It(`${Lt(40,24)};background-color:#eef2ff;border-radius:12px`,Y(1,e.content.heroTitle,{alignment:`center`}),J(e.content.heroText,{alignment:`center`}),Mt(e.content.heroButton,{style:`background-color:#4f46e5;color:#ffffff;${Lt(12,24)};border-radius:8px`}))]},{id:`products`,label:({t:e})=>e.templates.products,description:({t:e})=>e.templates.productsDescription,thumbnail:(0,x.jsx)(Z,{variant:`products`}),content:({t:e})=>[X(2,[e.content.productA,e.content.productB].map(t=>Pt(Nt(zt(280,200,t)),Y(3,t,{alignment:`center`}),J(e.content.productText,{alignment:`center`}),Mt(e.content.productButton))),{cellspacing:16})]},{id:`features`,label:({t:e})=>e.templates.features,description:({t:e})=>e.templates.featuresDescription,thumbnail:(0,x.jsx)(Z,{variant:`features`}),content:({t:e})=>[X(3,e.content.features.map(t=>Pt(Y(3,t,{alignment:`center`}),J(e.content.featureText,{alignment:`center`}))))]},{id:`testimonial`,label:({t:e})=>e.templates.testimonial,description:({t:e})=>e.templates.testimonialDescription,thumbnail:(0,x.jsx)(Z,{variant:`testimonial`}),content:({t:e})=>[It(`${Lt(24)};background-color:#f8fafc;border-radius:12px`,{type:`blockquote`,content:[J(e.content.testimonialQuote)]},J(e.content.testimonialAuthor,{alignment:`right`,style:`color:#64748b`}))]},{id:`footer`,label:({t:e})=>e.templates.footer,description:({t:e})=>e.templates.footerDescription,thumbnail:(0,x.jsx)(Z,{variant:`footer`}),content:({t:e})=>[{type:`horizontalRule`},{type:`socialLinks`},J(e.content.footerAddress,{alignment:`center`,style:`color:#94a3b8;font-size:12px`}),J([q(e.content.unsubscribe,Rt(`https://example.com/unsubscribe`))],{alignment:`center`,style:`font-size:12px`})]}],Gt=(e,t)=>Wt.find(t=>t.id===e)?.content(t)??[];function Kt(e){let t={type:`spacer`,attrs:{height:16}};return{type:`doc`,content:[...Gt(`header`,e),t,...Gt(`hero`,e),t,Y(2,e.t.content.starterTitle,{alignment:`center`}),...Gt(`products`,e),t,...Gt(`footer`,e)]}}var qt=(0,l.createContext)(null);function Q(){let e=(0,l.useContext)(qt);if(!e)throw Error(`useEmailEditor must be used inside <EditorRoot> or <BetterEmailEditor>.`);return e}function Jt(){return(0,l.useContext)(qt)}function $(){return(0,l.useContext)(qt)?.t??ke}function Yt(){let{locale:e,t}=Q();return(0,l.useMemo)(()=>({locale:e,t}),[e,t])}var Xt=(0,m.extendTheme)(`basic`,{body:{backgroundColor:`#eef1f5`,padding:`32px 16px`},container:{backgroundColor:`#ffffff`,padding:`24px`,borderRadius:`12px`}}),Zt=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t({url:String(r.result)}),r.onerror=n,r.readAsDataURL(e)}),Qt={type:`doc`,content:[{type:`paragraph`}]};function $t(e){return typeof e==`object`&&!!e&&`doc`in e}function en(e){let t={subject:``,previewText:``};return e?$t(e)?{doc:e.doc,settings:{...t,...e.settings,previewText:e.settings?.previewText??``}}:{doc:e,settings:t}:{doc:Qt,settings:t}}function tn(e,t,n){let[r,i]=(0,l.useState)(t);return[e===void 0?r:e,(0,l.useCallback)(t=>{e===void 0&&i(t),n?.(t)},[e,n])]}var nn=(0,l.forwardRef)(function({defaultValue:e,onChange:t,onReady:n,locale:r=`en`,messages:i,nodes:a=At,palette:o=Ut,paletteGroups:s=Ht,templates:c=Wt,fonts:h=we,starterDocument:g=Kt,extensions:_,theme:v=Xt,uploadImage:y=Zt,editable:b=!0,device:S,defaultDevice:C=`desktop`,onDeviceChange:w,layersOpen:T,defaultLayersOpen:D=!0,onLayersOpenChange:O,className:ee,style:te,children:ne},k){let A=(0,l.useMemo)(()=>Pe(r,i),[r,i]),[re]=(0,l.useState)(()=>en(e)),[ie,ae]=(0,l.useState)(re.settings),j=(0,l.useRef)(ie),oe=(0,l.useRef)(A),M=(0,l.useRef)(t),se=(0,l.useRef)(n),N=(0,l.useRef)(y);(0,l.useLayoutEffect)(()=>{oe.current=A,M.current=t,se.current=n,N.current=y});let[ce,le]=tn(S,C,w),[P,F]=tn(T,D,O),[ue]=(0,l.useState)(()=>({dragSession:De(),hoverStore:Oe()})),de=(0,l.useCallback)(e=>N.current(e),[]),me=(0,m.useEditorImage)({uploadImage:de}),[he]=(0,l.useState)(()=>[p.StarterKit.configure({TiptapStarterKit:{dropcursor:!1},Button:!1}),pe,Ce,u.Placeholder.configure({placeholder:({node:e})=>e.type.name===`heading`?oe.current.placeholder.heading:oe.current.placeholder.paragraph,includeChildren:!0}),m.EmailTheming.configure({theme:v}),...a.flatMap(e=>e.extensions??[]),..._??[],me]),I=(0,d.useEditor)({extensions:he,content:re.doc,editable:b,immediatelyRender:!1,editorProps:{handlePaste:xe(he)}},[]);(0,l.useEffect)(()=>{I?.setEditable(b)},[I,b]);let ge=(0,l.useCallback)(()=>({doc:I?.getJSON()??Qt,settings:j.current}),[I]),_e=(0,l.useCallback)(e=>{let t={...j.current,...e};j.current=t,ae(t),I&&M.current?.({doc:I.getJSON(),settings:t})},[I]),L=(0,l.useMemo)(()=>{let e=async()=>I?(0,f.composeReactEmail)({editor:I,preview:j.current.previewText||void 0}):{html:``,text:``,unformattedHtml:``};return{editor:I,getValue:ge,getJSON:()=>I?.getJSON()??Qt,setValue:e=>{let t=en(e);j.current=t.settings,ae(t.settings),I?.commands.setContent(t.doc,{emitUpdate:!0})},exportEmail:e,getHtml:async()=>(await e()).html,getText:async()=>(await e()).text,insertBlocks:e=>{I&&fe(I,e)}}},[I,ge]);(0,l.useImperativeHandle)(k,()=>L,[L]),(0,l.useEffect)(()=>{if(!I)return;se.current?.(L);let e=()=>M.current?.(ge());return I.on(`update`,e),()=>{I.off(`update`,e)}},[I,L,ge]);let ve=(0,l.useMemo)(()=>new Map(a.map(e=>[e.type,e])),[a]),ye=(0,l.useMemo)(()=>{if(!I)return null;let e={locale:r,t:A};return{...e,editor:I,handle:L,nodes:ve,nodeLabel:t=>{let n=ve.get(t)?.label;return n?R(n,e):A.nodes[t]??t},palette:o,paletteGroups:s,templates:c,fonts:h,starterDocument:g,uploadImage:de,...ue,device:ce,setDevice:le,layersOpen:P,setLayersOpen:F,settings:ie,updateSettings:_e}},[I,r,A,L,ve,o,s,c,h,g,de,ue,ce,le,P,F,ie,_e]),be=(0,l.useMemo)(()=>({editor:I}),[I]),Se={"--bree-empty-zone-label":JSON.stringify(A.canvas.emptyZone),...te};return(0,x.jsx)(`div`,{className:E(`bree bree-root`,ee),style:Se,lang:r,children:ye&&(0,x.jsx)(d.EditorContext.Provider,{value:be,children:(0,x.jsx)(qt.Provider,{value:ye,children:ne})})})});function rn(e,t){let n=e.getBoundingClientRect();return{top:t.top-n.top+e.scrollTop,left:t.left-n.left+e.scrollLeft,width:t.width,height:t.height??0}}function an(e,t,n){if(!n)return null;let r=e.view.nodeDOM(n.pos);return r instanceof HTMLElement?rn(t,r.getBoundingClientRect()):null}function on(e,t,n){let r=e.view.posAtCoords({left:t,top:n});return r&&r.inside>=0?N(e.state.doc,r.inside):null}function sn(e){let t=e.node.type.name;return D.has(t)||O.has(t)}function cn({editor:e,host:t}){let{dragSession:n,hoverStore:r,nodeLabel:i,t:a}=Q(),o=(0,l.useRef)(i);(0,l.useLayoutEffect)(()=>{o.current=i});let s=(0,l.useSyncExternalStore)(r.subscribe,r.get),c=s===null?null:e.state.doc.nodeAt(s),u=s!==null&&c?{pos:s,node:c}:null,[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[,_]=(0,l.useState)(0),v=(0,l.useCallback)(()=>_(e=>e+1),[]),y=(0,d.useEditorState)({editor:e,selector:({editor:e})=>{if(!e?.isFocused)return null;let t=P(e);return t?`${t.pos}:${t.node.type.name}:${e.state.doc.content.size}`:null}})?P(e):null;(0,l.useEffect)(()=>{let n=()=>v(),i=()=>{r.set(null),v()};e.on(`update`,i);let a=new ResizeObserver(n);return a.observe(e.view.dom),t.addEventListener(`load`,n,!0),window.addEventListener(`resize`,n),()=>{e.off(`update`,i),a.disconnect(),t.removeEventListener(`load`,n,!0),window.removeEventListener(`resize`,n)}},[e,t,v,r]),(0,l.useEffect)(()=>{let i=0,a=t=>{n.get()||t.target.closest(`.bree-ov-toolbar, .bree-ov-handle, .bree-ov-tag`)||(cancelAnimationFrame(i),i=requestAnimationFrame(()=>{r.set(on(e,t.clientX,t.clientY)?.pos??null)}))},o=()=>r.set(null);return t.addEventListener(`mousemove`,a),t.addEventListener(`mouseleave`,o),()=>{cancelAnimationFrame(i),t.removeEventListener(`mousemove`,a),t.removeEventListener(`mouseleave`,o)}},[e,t,n,r]),(0,l.useEffect)(()=>{let n=n=>{if(n.button!==0||n.shiftKey||n.metaKey||n.ctrlKey||n.target.closest(`.bree-ov-layer, .bree-canvas-header`))return;if([t,e.view.dom,e.view.dom.parentElement].includes(n.target)){n.preventDefault();let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur();return}let r=on(e,n.clientX,n.clientY);if(r&&sn(r)){n.preventDefault(),F(e,r);return}!e.isFocused&&e.state.selection instanceof g.NodeSelection&&e.view.focus()},r=t=>{e.view.dom.contains(t.target)&&me(e,t)};return t.addEventListener(`mousedown`,n,!0),t.addEventListener(`paste`,r,!0),()=>{t.removeEventListener(`mousedown`,n,!0),t.removeEventListener(`paste`,r,!0)}},[e,t]),(0,l.useEffect)(()=>{let i=0,a=null,s=null,c=t=>{let r=n.get();if(!r||(a!==r&&(a=r,s=ie(e.view,r)),!s))return null;let i=r.kind===`move`?{from:r.pos,to:r.pos+(e.state.doc.nodeAt(r.pos)?.nodeSize??0)}:void 0;return re(e.view,t.clientX,t.clientY,s,i)},l=e=>{let t=n.get();t&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=t.kind===`move`?`move`:`copy`),cancelAnimationFrame(i),i=requestAnimationFrame(()=>p(c(e))))},u=t=>{let a=n.get();if(!a)return;t.preventDefault(),t.stopPropagation(),cancelAnimationFrame(i);let o=c(t);o&&M(e,a,o),e.view.dragging=null,n.end(),p(null),h(null),r.set(null)},d=e=>{n.get()&&(t.contains(e.relatedTarget)||(cancelAnimationFrame(i),p(null)))},f=()=>{cancelAnimationFrame(i),n.end(),p(null),h(null),r.set(null)},m=t=>{let r=t.target;if(n.get()||r.tagName!==`IMG`||!e.view.dom.contains(r))return;let i=e.view.posAtDOM(r,0),a=N(e.state.doc,i);a&&!ce(a)&&(n.start({kind:`move`,pos:a.pos,label:o.current(a.node.type.name)}),requestAnimationFrame(()=>h(a.pos)))},g=t=>{if(t.key!==`Escape`||!e.isFocused)return;let n=P(e),r=n?le(e.state.doc,n):null;if(t.preventDefault(),r)F(e,r);else{let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur()}};return t.addEventListener(`dragstart`,m,!0),t.addEventListener(`keydown`,g,!0),t.addEventListener(`dragover`,l,!0),t.addEventListener(`drop`,u,!0),t.addEventListener(`dragleave`,d,!0),document.addEventListener(`dragend`,f),()=>{cancelAnimationFrame(i),t.removeEventListener(`dragstart`,m,!0),t.removeEventListener(`keydown`,g,!0),t.removeEventListener(`dragover`,l,!0),t.removeEventListener(`drop`,u,!0),t.removeEventListener(`dragleave`,d,!0),document.removeEventListener(`dragend`,f)}},[e,t,n,r]);let S=(t,r)=>{let a=e.view.nodeDOM(r.pos);if(n.start({kind:`move`,pos:r.pos,label:i(r.node.type.name)}),t.dataTransfer.setData(ee,`move`),t.dataTransfer.effectAllowed=`move`,a instanceof HTMLElement){let e=a.getBoundingClientRect();t.dataTransfer.setDragImage(a,Math.min(24,e.width/2),Math.min(24,e.height/2))}requestAnimationFrame(()=>h(r.pos))},C=m!==null,w=u&&u.pos!==y?.pos?an(e,t,u):null,T=an(e,t,y),D=C?an(e,t,N(e.state.doc,m)):null,O=y?le(e.state.doc,y):null;return(0,x.jsxs)(`div`,{className:`bree-ov-layer`,children:[w&&u&&(0,x.jsx)(`div`,{className:E(`bree-ov-frame bree-ov-hover`,C&&`bree-ov-ghost`),style:w,children:(0,x.jsx)(`button`,{type:`button`,className:`bree-ov-tag`,onMouseDown:t=>{t.preventDefault(),F(e,u)},children:i(u.node.type.name)})}),T&&y&&(0,x.jsxs)(`div`,{className:E(`bree-ov-frame bree-ov-selected`,C&&`bree-ov-ghost`),style:T,children:[(0,x.jsx)(`span`,{className:`bree-ov-tag bree-ov-tag-selected`,children:i(y.node.type.name)}),!ce(y)&&(0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsx)(`span`,{className:`bree-ov-handle`,role:`button`,tabIndex:-1,draggable:!0,title:a.canvas.move,"aria-label":a.canvas.moveLabel(i(y.node.type.name)),onDragStart:e=>S(e,y),children:(0,x.jsx)(Ie,{})})}),(0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsxs)(`div`,{className:`bree-ov-toolbar`,onMouseDown:e=>e.preventDefault(),children:[O&&(0,x.jsx)(`button`,{type:`button`,className:`bree-ov-tool`,title:a.canvas.selectParent(i(O.node.type.name)),onClick:()=>F(e,O),children:(0,x.jsx)(ze,{})}),!ce(y)&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`bree-ov-tool`,title:a.canvas.duplicate,onClick:()=>ue(e,y),children:(0,x.jsx)(Le,{})}),(0,x.jsx)(`button`,{type:`button`,className:`bree-ov-tool bree-ov-danger`,title:a.canvas.delete,onClick:()=>de(e,y),children:(0,x.jsx)(Re,{})})]})]})})]}),D&&(0,x.jsx)(`div`,{className:`bree-ov-frame bree-ov-source`,style:D}),f&&(0,x.jsx)(ln,{host:t,target:f,label:n.get()?.label??``,messages:a})]})}function ln({host:e,target:t,label:n,messages:r}){if(t.emptyZone){let i=rn(e,t.emptyZone);return(0,x.jsx)(`div`,{className:`bree-ov-dropzone`,style:i,children:(0,x.jsxs)(`span`,{children:[(0,x.jsx)(b.PlusIcon,{size:14}),` `,r.canvas.dropLabel(n)]})})}if(!t.line)return null;let i=rn(e,{...t.line,height:0});return(0,x.jsx)(`div`,{className:`bree-ov-dropline`,style:{top:i.top,left:i.left,width:i.width},children:(0,x.jsx)(`span`,{className:`bree-ov-dropline-label`,children:r.canvas.dropHere})})}function un({className:e,style:t}){let{settings:n,updateSettings:r,t:i}=Q(),a=i.emailHeader,o=(0,l.useId)();return(0,x.jsxs)(`div`,{className:E(`bree-email-header`,e),style:t,children:[(0,x.jsxs)(`div`,{className:`bree-email-header-row`,children:[(0,x.jsx)(`label`,{htmlFor:`${o}-subject`,children:a.subject}),(0,x.jsx)(`input`,{id:`${o}-subject`,className:`bree-email-header-subject`,value:n.subject??``,placeholder:a.subjectPlaceholder,onChange:e=>r({subject:e.target.value})})]}),(0,x.jsxs)(`div`,{className:`bree-email-header-row`,children:[(0,x.jsx)(`label`,{htmlFor:`${o}-preview`,children:a.previewText}),(0,x.jsx)(`input`,{id:`${o}-preview`,value:n.previewText,placeholder:a.previewTextPlaceholder,onChange:e=>r({previewText:e.target.value})})]})]})}function dn(e,t,n){let[r,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!t||!n)return;let r=0,a=null,o=()=>{t.style.setProperty(`--bree-email-header-height`,`${n.offsetHeight}px`);let r=e.view.dom.querySelector(`:scope > .node-container`);if(r!==a&&(a&&c.unobserve(a),r&&c.observe(r),a=r),!(r instanceof HTMLElement)){i(null);return}let o=t.getBoundingClientRect(),s=r.getBoundingClientRect(),l={top:s.top-o.top+t.scrollTop-n.offsetHeight,left:s.left-o.left+t.scrollLeft,width:s.width,radius:getComputedStyle(r).borderBottomLeftRadius};i(e=>e&&e.top===l.top&&e.left===l.left&&e.width===l.width&&e.radius===l.radius?e:l)},s=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(o)},c=new ResizeObserver(s);return c.observe(t),c.observe(n),o(),e.on(`update`,s),()=>{cancelAnimationFrame(r),c.disconnect(),e.off(`update`,s),t.style.removeProperty(`--bree-email-header-height`)}},[e,t,n]),n?r:null}function fn({overlay:e=!0,bubbleMenu:t=!0,slashCommands:n=!0,header:r=!1,className:i,style:a,children:o}){let{editor:s,device:c,t:u}=Q(),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),g=dn(s,f,r?m:null),_=(0,l.useMemo)(()=>Array.isArray(n)?n:b.defaultSlashCommands.map(e=>({...e,...u.slashCommands[e.title]})),[n,u]);return(0,x.jsxs)(`div`,{ref:p,className:E(`bree-canvas`,i),style:a,"data-device":c,"data-email-header":r||void 0,children:[r&&(0,x.jsx)(`div`,{ref:h,className:`bree-canvas-header`,"data-placed":g?``:void 0,style:g?{position:`absolute`,top:g.top,left:g.left,width:g.width,"--bree-email-header-radius":g.radius}:void 0,children:(0,x.jsx)(un,{})}),(0,x.jsx)(d.EditorContent,{editor:s,className:`bree-canvas-content`}),t&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b.BubbleMenu,{hideWhenActiveNodes:[`button`,`horizontalRule`],hideWhenActiveMarks:[`link`]}),(0,x.jsx)(b.BubbleMenu.LinkDefault,{}),(0,x.jsx)(b.BubbleMenu.ButtonDefault,{}),(0,x.jsx)(b.BubbleMenu.ImageDefault,{})]}),n!==!1&&(0,x.jsx)(b.SlashCommand,{items:_}),e&&f&&(0,x.jsx)(cn,{editor:s,host:f}),o]})}function pn(e,t){let n=e.child(t);return t===e.childCount-1&&e.childCount>1&&k(n)&&e.child(t-1).type.name!==`paragraph`}function mn(e,t,n,r){let i=[];return e.forEach((a,o,s)=>{if(pn(e,s))return;let c=t+1+o,l=a.type.name,u=`${r}${s}`,d=D.has(l),f=d&&a.childCount===1&&k(a.firstChild),p=d||O.has(l);i.push({key:u,pos:c,node:a,depth:n,index:s+1,children:p&&!f?mn(a,c,n+1,`${u}.`):[],accepts:d,fixed:l===`columnsColumn`,empty:f})}),i}function hn(e){let t=A(e);return t?mn(t.node,t.pos,0,``):[]}function gn(e,t){return e.fixed?`inside`:e.accepts?t<.25?`before`:t>.75?`after`:`inside`:t<.5?`before`:`after`}function _n(e,t,n,r,i){let a,o;if(n===`inside`){if(!t.accepts)return null;t.empty?(a=t.pos+1,o=a+t.node.firstChild.nodeSize):a=t.pos+t.node.nodeSize-1}else{if(t.fixed)return null;a=n===`before`?t.pos:t.pos+t.node.nodeSize}if(i&&a>=i.from&&a<=i.to)return null;let s=e.resolve(a),c=s.index();return s.parent.canReplace(c,o===void 0?c:c+1,r)?{pos:a,replaceTo:o}:null}function vn({onClose:e,title:t,expandCollapseButtons:n=!0,className:r,style:i}){let{editor:a,t:o,locale:s,nodes:c,nodeLabel:u,dragSession:f,hoverStore:p}=Q(),m=e=>e.node.type.name===`columnsColumn`?o.layers.column(e.index):u(e.node.type.name),h=e=>(c.get(e.node.type.name)?.preview??Ot)(e.node,{locale:s,t:o}),g=(0,d.useEditorState)({editor:a,selector:({editor:e})=>e?.state.doc??null,equalityFn:(e,t)=>e===t}),_=(0,d.useEditorState)({editor:a,selector:({editor:e})=>e?.isFocused?P(e)?.pos??null:null}),v=(0,l.useSyncExternalStore)(p.subscribe,p.get),y=(0,l.useMemo)(()=>g?hn(g):[],[g]),[S,C]=(0,l.useState)(()=>new Set),[w,T]=(0,l.useState)(null),D=(0,l.useRef)(null);(0,l.useEffect)(()=>{_!==null&&D.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})},[_]);let O=e=>C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),te=e=>{F(a,{pos:e.pos,node:e.node});let t=a.view.nodeDOM(e.pos);t instanceof HTMLElement&&t.scrollIntoView({block:`nearest`,behavior:`smooth`})},ne=(e,t)=>{let n=f.get();if(!n)return null;let r=ie(a.view,n);if(!r)return null;let i=e.currentTarget.getBoundingClientRect(),o=gn(t,(e.clientY-i.top)/i.height),s=n.kind===`move`?a.state.doc.nodeAt(n.pos):null,c=n.kind===`move`&&s?{from:n.pos,to:n.pos+s.nodeSize}:void 0,l=_n(a.state.doc,t,o,r,c);return l?{zone:o,target:l,payload:n}:null},k=()=>{f.end(),T(null)},A=e=>e.map(e=>{let t=c.get(e.node.type.name)?.icon??b.LayoutIcon,n=e.children.length>0,r=S.has(e.key),i=h(e),s=w?.key===e.key?w.zone:null;return(0,x.jsxs)(`div`,{role:`none`,children:[(0,x.jsxs)(`div`,{role:`treeitem`,tabIndex:_===e.pos||_===null&&e.key===`0`?0:-1,"aria-level":e.depth+1,"aria-selected":_===e.pos,"aria-expanded":n?!r:void 0,className:E(`bree-layer`,_===e.pos&&`bree-selected`,v===e.pos&&`bree-hovered`,s&&`bree-drop-${s}`,e.fixed&&`bree-fixed`),style:{paddingLeft:6+e.depth*16},draggable:!e.fixed,title:e.fixed?o.layers.fixedHint:o.layers.itemHint,onClick:()=>te(e),onKeyDown:t=>{if(t.key===`Enter`||t.key===` `)t.preventDefault(),te(e);else if(t.key===`ArrowLeft`&&n&&!r||t.key===`ArrowRight`&&r)O(e.key);else if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault();let e=[...D.current?.querySelectorAll(`[role="treeitem"]`)??[]];e[e.indexOf(t.currentTarget)+(t.key===`ArrowDown`?1:-1)]?.focus()}},onMouseEnter:()=>p.set(e.pos),onMouseLeave:()=>p.set(null),onDragStart:t=>{t.stopPropagation(),f.start({kind:`move`,pos:e.pos,label:m(e)}),t.dataTransfer.setData(ee,`move`),t.dataTransfer.effectAllowed=`move`},onDragEnd:k,onDragOver:t=>{let n=ne(t,e);if(!n){w?.key===e.key&&T(null);return}t.preventDefault(),t.dataTransfer.dropEffect=n.payload.kind===`move`?`move`:`copy`,(w?.key!==e.key||w.zone!==n.zone)&&T({key:e.key,zone:n.zone})},onDrop:t=>{let n=ne(t,e);t.preventDefault(),n&&M(a,n.payload,n.target),k()},children:[n?(0,x.jsx)(`button`,{type:`button`,className:E(`bree-layer-caret`,!r&&`bree-open`),"aria-label":r?o.layers.expand:o.layers.collapse,tabIndex:-1,onClick:t=>{t.stopPropagation(),O(e.key)},children:`›`}):(0,x.jsx)(`span`,{className:`bree-layer-caret-spacer`}),(0,x.jsx)(`span`,{className:`bree-layer-icon`,children:(0,x.jsx)(t,{size:14})}),(0,x.jsx)(`span`,{className:`bree-layer-label`,children:m(e)}),i&&(0,x.jsx)(`span`,{className:`bree-layer-preview`,children:i})]}),e.empty&&(0,x.jsx)(`div`,{className:`bree-layer-empty`,style:{paddingLeft:6+(e.depth+1)*16+18},children:o.layers.emptyZone}),n&&!r&&(0,x.jsx)(`div`,{role:`group`,children:A(e.children)})]},e.key)});return(0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsxs)(`aside`,{className:E(`bree-layers`,r),style:i,"aria-label":t??o.layers.title,tabIndex:-1,onDragLeave:e=>!e.currentTarget.contains(e.relatedTarget)&&T(null),children:[(0,x.jsxs)(`header`,{className:`bree-layers-header`,children:[(0,x.jsx)(`h2`,{children:t??o.layers.title}),(0,x.jsxs)(`div`,{className:`bree-layers-actions`,children:[n&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.expandAll,onClick:()=>C(new Set),children:`⊞`}),(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.collapseAll,onClick:()=>{let e=new Set,t=n=>n.forEach(n=>{n.children.length&&e.add(n.key),t(n.children)});t(y),C(e)},children:`⊟`})]}),e&&(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.close,onClick:e,children:(0,x.jsx)(b.XIcon,{size:14})})]})]}),(0,x.jsx)(`div`,{className:`bree-layers-list`,role:`tree`,"aria-label":o.layers.tree,ref:D,children:y.length?A(y):(0,x.jsx)(`p`,{className:`bree-hint`,children:o.layers.emptyEmail})})]})})}function yn({ctx:e,className:t,style:n}){return(0,x.jsxs)(`div`,{className:E(`bree-inspector`,t),style:n,children:[(0,x.jsx)(st,{ctx:e,alignment:String(e.getAttr(`alignment`)??`left`),setAlignment:t=>e.setAttr(`alignment`,t)}),(0,x.jsx)(K,{ctx:e}),(0,x.jsx)(ct,{ctx:e})]})}function bn(){let{editor:e}=Q();return()=>{let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur()}}function xn({title:e,children:t,breadcrumb:n=!0,className:r,style:i}){let{t:a,nodeLabel:o}=Q(),s=bn();return(0,x.jsxs)(`div`,{className:E(`bree-properties`,r),style:i,children:[(0,x.jsxs)(`header`,{className:`bree-properties-header`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`bree-eyebrow`,children:a.sidebar.propertiesEyebrow}),(0,x.jsx)(`h2`,{children:e})]}),(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:a.sidebar.closeProperties,onClick:s,children:(0,x.jsx)(b.XIcon,{size:16})})]}),n&&(0,x.jsx)(b.Inspector.Breadcrumb,{children:e=>e.length>1&&(0,x.jsx)(`nav`,{className:`bree-breadcrumb`,"aria-label":a.sidebar.breadcrumb,children:e.map((t,n)=>(0,x.jsxs)(`span`,{className:`bree-crumb`,children:[n>0&&(0,x.jsx)(`span`,{className:`bree-crumb-sep`,children:`/`}),(0,x.jsx)(`button`,{type:`button`,disabled:n===e.length-1,onClick:t.focus,children:o(t.node.nodeType)})]},`${t.node.nodeType}-${t.node.nodePos.pos}`))})}),(0,x.jsx)(`div`,{className:`bree-panel-scroll`,children:t})]})}function Sn({ctx:e,className:t,style:n}){let{nodes:r,nodeLabel:i}=Q(),a=r.get(e.nodeType)?.inspector??yn;return(0,x.jsx)(xn,{title:i(e.nodeType),className:t,style:n,children:(0,x.jsx)(a,{ctx:e},`${e.nodeType}-${e.nodePos.pos}`)})}function Cn(e,t){let{editor:n,dragSession:r}=Q();return{draggable:!0,onDragStart:n=>{r.start({kind:`new`,label:e,content:t}),n.dataTransfer.setData(ee,e),n.dataTransfer.effectAllowed=`copy`},onDragEnd:()=>r.end(),onClick:()=>fe(n,t())}}function wn({template:e,className:t,style:n}){let r=Yt(),i=R(e.label,r),a=Cn(i,()=>e.content(r));return(0,x.jsxs)(`button`,{type:`button`,className:E(`bree-block-card`,t),style:n,...a,children:[e.thumbnail??(0,x.jsx)(Z,{variant:`default`}),(0,x.jsxs)(`span`,{className:`bree-block-text`,children:[(0,x.jsx)(`strong`,{children:i}),e.description&&(0,x.jsx)(`span`,{children:R(e.description,r)})]})]})}function Tn({templates:e,className:t,style:n}){let r=Q();return(0,x.jsx)(`div`,{className:E(`bree-block-list`,t),style:n,children:(e??r.templates).map(e=>(0,x.jsx)(wn,{template:e},e.id))})}var En=[`body`,`blockquote`];function Dn(e){let{styles:t}=(0,m.getEmailTheming)(e),n=t.flatMap(e=>e.inputs).find(e=>e.prop===`fontFamily`&&e.classReference===`body`);return String(n?.value??``)}function On(e,t){let{styles:n}=(0,m.getEmailTheming)(e),r=e=>e.prop===`fontFamily`&&En.includes(e.classReference??``),i=Math.max(0,n.findIndex(e=>e.id===`body`)),a=n.map((e,n)=>{let a=e.inputs.filter(e=>!r(e));if(n!==i||!t)return{...e,inputs:a};let o=En.map(e=>({label:`Font`,type:`text`,prop:`fontFamily`,classReference:e,value:t}));return{...e,inputs:[...a,...o]}});(0,m.setGlobalStyles)(e,a)}function kn({ctx:e,className:t,style:n}){let{editor:r,settings:i,updateSettings:a,t:o}=Q(),s=o.body,{findStyleValue:c,setGlobalStyle:l}=e;return(0,x.jsxs)(`div`,{className:E(`bree-body-tab`,t),style:n,children:[(0,x.jsx)(B,{title:s.general,children:(0,x.jsx)(V,{label:s.previewText,stacked:!0,children:(0,x.jsx)(H,{value:i.previewText,onChange:e=>a({previewText:e}),placeholder:s.previewTextPlaceholder})})}),(0,x.jsxs)(B,{title:s.background,children:[(0,x.jsx)(V,{label:s.backgroundColor,stacked:!0,children:(0,x.jsx)(W,{value:c(`body`,`backgroundColor`),onChange:e=>l(`body`,`backgroundColor`,e)})}),(0,x.jsx)(V,{label:s.outerPadding,children:(0,x.jsx)(U,{value:c(`body`,`padding`),onChange:e=>l(`body`,`padding`,e)})})]}),(0,x.jsxs)(B,{title:s.content,children:[(0,x.jsx)(V,{label:s.width,children:(0,x.jsx)(U,{value:c(`container`,`width`),onChange:e=>l(`container`,`width`,e),min:320,max:900})}),(0,x.jsx)(V,{label:s.contentColor,stacked:!0,children:(0,x.jsx)(W,{value:c(`container`,`backgroundColor`),onChange:e=>l(`container`,`backgroundColor`,e)})}),(0,x.jsx)(V,{label:s.innerPadding,children:(0,x.jsx)(U,{value:c(`container`,`padding`),onChange:e=>l(`container`,`padding`,e)})}),(0,x.jsx)(V,{label:s.radius,children:(0,x.jsx)(U,{value:c(`container`,`borderRadius`),onChange:e=>l(`container`,`borderRadius`,e)})})]}),(0,x.jsxs)(B,{title:s.defaultStyles,children:[(0,x.jsx)(V,{label:s.font,children:(0,x.jsx)(rt,{value:Dn(r),emptyLabel:s.fontDefault,onChange:e=>On(r,e)})}),(0,x.jsx)(V,{label:s.text,stacked:!0,children:(0,x.jsx)(W,{value:c(`paragraph`,`color`),onChange:e=>l(`paragraph`,`color`,e)})}),(0,x.jsx)(V,{label:s.headings,stacked:!0,children:(0,x.jsx)(W,{value:c(`h1`,`color`),onChange:t=>e.batchSetGlobalStyle([`h1`,`h2`,`h3`].map(e=>({classReference:e,property:`color`,value:t})))})}),(0,x.jsx)(V,{label:s.links,stacked:!0,children:(0,x.jsx)(W,{value:c(`link`,`color`),onChange:e=>l(`link`,`color`,e)})}),(0,x.jsx)(V,{label:s.buttonBackground,stacked:!0,children:(0,x.jsx)(W,{value:c(`button`,`backgroundColor`),onChange:e=>l(`button`,`backgroundColor`,e)})}),(0,x.jsx)(V,{label:s.buttonText,stacked:!0,children:(0,x.jsx)(W,{value:c(`button`,`color`),onChange:e=>l(`button`,`color`,e)})})]})]})}function An({item:e,className:t,style:n}){let r=Yt(),i=R(e.label,r),a=Cn(i,()=>e.content(r));return(0,x.jsxs)(`button`,{type:`button`,className:E(`bree-tile`,t),style:n,title:r.t.sidebar.tileTitle(i),...a,children:[(0,x.jsx)(`span`,{className:`bree-tile-icon`,children:e.icon}),(0,x.jsx)(`span`,{className:`bree-tile-label`,children:i})]})}function jn({items:e,groups:t,hint:n,className:r,style:i}){let a=Q(),o=e??a.palette,s=t??a.paletteGroups,c=[...s,...[...new Set(o.map(e=>e.group))].filter(e=>!s.some(t=>t.id===e)).map(e=>({id:e,title:e}))];return(0,x.jsxs)(`div`,{className:E(`bree-content-tab`,r),style:i,children:[c.map(e=>{let t=o.filter(t=>t.group===e.id);return t.length?(0,x.jsxs)(`section`,{children:[(0,x.jsx)(`h3`,{className:`bree-panel-title`,children:R(e.title,a)}),(0,x.jsx)(`div`,{className:`bree-tiles`,children:t.map(e=>(0,x.jsx)(An,{item:e},e.id))})]},e.id):null}),n!==null&&(0,x.jsx)(`p`,{className:`bree-hint`,children:n??a.t.sidebar.dragHint})]})}function Mn({ctx:e,tabs:t=[`content`,`blocks`,`body`],defaultTab:n,className:r,style:i}){let{t:a}=Q(),o={content:{id:`content`,label:a.sidebar.tabContent,render:()=>(0,x.jsx)(jn,{})},blocks:{id:`blocks`,label:a.sidebar.tabBlocks,render:()=>(0,x.jsx)(Tn,{})},body:{id:`body`,label:a.sidebar.tabBody,render:e=>(0,x.jsx)(kn,{ctx:e})}},s=t.map(e=>typeof e==`string`?o[e]:e),[c,u]=(0,l.useState)(n??s[0]?.id),d=s.find(e=>e.id===c)??s[0];return(0,x.jsxs)(`div`,{className:E(`bree-content-panel`,r),style:i,children:[s.length>1&&(0,x.jsx)(`nav`,{className:`bree-tabs`,role:`tablist`,children:s.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===d?.id,className:E(e.id===d?.id&&`bree-active`),onClick:()=>u(e.id),children:e.label},e.id))}),(0,x.jsx)(`div`,{className:`bree-panel-scroll`,children:d?.render(e)})]})}function Nn({ctx:e,className:t,style:n}){let r=$(),i=r.inspector,a=[{mark:`bold`,Icon:b.BoldIcon,title:i.bold},{mark:`italic`,Icon:b.ItalicIcon,title:i.italic},{mark:`underline`,Icon:b.UnderlineIcon,title:i.underline},{mark:`strike`,Icon:b.StrikethroughIcon,title:i.strike}];return(0,x.jsxs)(xn,{title:r.sidebar.selectedText,className:t,style:n,children:[(0,x.jsx)(B,{title:i.formatting,children:(0,x.jsx)(`div`,{className:`bree-mark-row`,children:a.map(({mark:t,Icon:n,title:r})=>(0,x.jsx)(`button`,{type:`button`,title:r,"aria-pressed":!!e.marks[t],className:E(`bree-mark`,e.marks[t]&&`bree-active`),onClick:()=>e.toggleMark(t),children:(0,x.jsx)(n,{size:14})},t))})}),(0,x.jsx)(st,{ctx:e,alignment:e.alignment,setAlignment:e.setAlignment}),e.isLinkActive&&(0,x.jsxs)(B,{title:i.link,children:[(0,x.jsx)(V,{label:i.url,stacked:!0,children:(0,x.jsx)(`span`,{className:`bree-readonly`,children:e.linkHref})}),(0,x.jsx)(V,{label:i.linkColor,stacked:!0,children:(0,x.jsx)(W,{value:e.linkColor,presets:e.presetColors,onChange:e.setLinkColor})})]})]})}function Pn({renderDocument:e=e=>(0,x.jsx)(Mn,{ctx:e}),renderNode:t=e=>(0,x.jsx)(Sn,{ctx:e}),renderText:n=e=>(0,x.jsx)(Nn,{ctx:e}),className:r,style:i}){let{t:a}=Q();return(0,x.jsxs)(b.Inspector.Root,{className:E(`bree-sidebar`,r),style:i,"aria-label":a.sidebar.label,children:[(0,x.jsx)(b.Inspector.Document,{children:e}),(0,x.jsx)(b.Inspector.Node,{children:t}),(0,x.jsx)(b.Inspector.Text,{children:n})]})}function Fn(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function In({onClose:e,defaultView:t=`desktop`,views:n=[`desktop`,`mobile`,`html`,`text`],filename:r=`email.html`,className:i,style:a}){let{handle:o,settings:s,t:c}=Q(),[u,d]=(0,l.useState)(t),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!1;return o.exportEmail().then(t=>!e&&p(t)).catch(t=>!e&&h(t instanceof Error?t.message:String(t))),()=>{e=!0}},[o,s.previewText]),(0,l.useEffect)(()=>{let t=t=>t.key===`Escape`&&e();return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let v=async()=>{f&&(await navigator.clipboard.writeText(u===`text`?f.text:f.html),_(!0),setTimeout(()=>_(!1),1500))},y=c.preview;return(0,T.createPortal)((0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsx)(`div`,{className:`bree bree-modal-backdrop`,onMouseDown:t=>t.target===t.currentTarget&&e(),children:(0,x.jsxs)(`div`,{className:E(`bree-modal`,i),style:a,role:`dialog`,"aria-modal":`true`,"aria-label":y.dialogLabel,children:[(0,x.jsxs)(`header`,{className:`bree-modal-header`,children:[(0,x.jsx)(`nav`,{className:`bree-tabs bree-compact`,role:`tablist`,children:n.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":u===e,className:E(u===e&&`bree-active`),onClick:()=>d(e),children:y[e]},e))}),(0,x.jsxs)(`div`,{className:`bree-modal-actions`,children:[f&&(u===`html`||u===`text`)&&(0,x.jsx)(`button`,{type:`button`,className:`bree-btn`,onClick:v,children:g?y.copied:y.copy}),f&&(0,x.jsx)(`button`,{type:`button`,className:`bree-btn bree-primary`,onClick:()=>Fn(r,f.unformattedHtml,`text/html`),children:y.download}),(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,onClick:e,title:y.close,children:(0,x.jsx)(b.XIcon,{size:18})})]})]}),(0,x.jsxs)(`div`,{className:`bree-modal-body`,children:[m&&(0,x.jsx)(`p`,{className:`bree-error`,children:y.renderError(m)}),!f&&!m&&(0,x.jsx)(`p`,{className:`bree-loading`,children:y.rendering}),f&&(u===`desktop`||u===`mobile`)&&(0,x.jsx)(`div`,{className:E(`bree-preview-frame`,`bree-preview-${u}`),children:(0,x.jsx)(`iframe`,{title:y.iframeTitle,srcDoc:f.html,sandbox:`allow-same-origin allow-popups`})}),f&&u===`html`&&(0,x.jsx)(`pre`,{className:`bree-code`,children:f.html}),f&&u===`text`&&(0,x.jsx)(`pre`,{className:`bree-code`,children:f.text})]})]})})}),document.body)}function Ln({className:e,style:t}){let{layersOpen:n,setLayersOpen:r,t:i}=Q();return(0,x.jsxs)(`button`,{type:`button`,className:E(`bree-btn bree-ghost bree-layers-toggle`,n&&`bree-active`,e),style:t,"aria-pressed":n,onClick:()=>r(!n),title:i.topBar.toggleLayers,children:[(0,x.jsx)(We,{}),` `,i.topBar.layers]})}function Rn({className:e,style:t}){let{editor:n,t:r}=Q(),i=(0,d.useEditorState)({editor:n,selector:({editor:e})=>({undo:!!e?.can().undo(),redo:!!e?.can().redo()})});return(0,x.jsxs)(`div`,{className:E(`bree-btn-group`,e),style:t,children:[(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.topBar.undo,disabled:!i?.undo,onClick:()=>n.chain().focus().undo().run(),children:(0,x.jsx)(Be,{})}),(0,x.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.topBar.redo,disabled:!i?.redo,onClick:()=>n.chain().focus().redo().run(),children:(0,x.jsx)(Ve,{})})]})}function zn({className:e,style:t}){let{device:n,setDevice:r,t:i}=Q(),a=[{id:`desktop`,label:i.topBar.desktop,Icon:He},{id:`mobile`,label:i.topBar.mobile,Icon:Ue}];return(0,x.jsx)(`div`,{className:E(`bree-segmented bree-device-toggle`,e),style:t,role:`radiogroup`,"aria-label":i.topBar.canvasWidth,children:a.map(({id:e,label:t,Icon:i})=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:E(n===e&&`bree-active`),onClick:()=>r(e),title:t,children:(0,x.jsx)(i,{})},e))})}function Bn({className:e,style:t}){let{editor:n,starterDocument:r,locale:i,t:a}=Q();return(0,x.jsx)(`button`,{type:`button`,className:E(`bree-btn bree-ghost`,e),style:t,onClick:()=>{confirm(a.topBar.confirmTemplate)&&n.commands.setContent(r({locale:i,t:a}))},children:a.topBar.template})}function Vn({className:e,style:t}){let{handle:n,t:r}=Q(),i=(0,l.useRef)(null),a=async e=>{try{n.setValue(JSON.parse(await e.text()))}catch(e){alert(r.topBar.invalidFile(e instanceof Error?e.message:String(e)))}};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:E(`bree-btn bree-ghost`,e),style:t,onClick:()=>i.current?.click(),children:r.topBar.import}),(0,x.jsx)(`input`,{ref:i,type:`file`,accept:`application/json,.json`,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&a(t),e.target.value=``}})]})}function Hn({className:e,style:t,filename:n=`email.json`}){let{handle:r,t:i}=Q();return(0,x.jsx)(`button`,{type:`button`,className:E(`bree-btn bree-ghost`,e),style:t,onClick:()=>Fn(n,JSON.stringify(r.getValue(),null,2),`application/json`),children:i.topBar.exportJson})}function Un({view:e=`desktop`,variant:t=`default`,children:n,className:r,style:i}){let{t:a}=Q(),[o,s]=(0,l.useState)(!1);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:E(`bree-btn`,t!=="default"&&`bree-${t}`,r),style:i,onClick:()=>s(!0),children:n??a.topBar.preview}),o&&(0,x.jsx)(In,{defaultView:e,onClose:()=>s(!1)})]})}function Wn(e){let{t}=Q();return(0,x.jsx)(Un,{view:`html`,variant:`primary`,...e,children:t.topBar.exportHtml})}function Gn({brand:e,actions:t,children:n,className:r,style:i}){return(0,x.jsx)(b.EditorFocusScope,{children:(0,x.jsxs)(`header`,{className:E(`bree-topbar`,r),style:i,children:[(0,x.jsx)(`div`,{className:`bree-topbar-start`,children:e}),n??(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`bree-topbar-center`,children:(0,x.jsx)(zn,{})}),(0,x.jsxs)(`div`,{className:`bree-topbar-actions`,children:[t,(0,x.jsx)(Wn,{})]})]})]})})}function Kn({showTopBar:e=!0,showLayers:t=!0,showSidebar:n=!0,showEmailHeader:r=!1,components:i={},slotProps:a={}}){let{layersOpen:o}=Q(),{TopBar:s=Gn,LayersPanel:c=vn,Canvas:l=fn,Sidebar:u=Pn}=i,d=t&&o;return(0,x.jsxs)(`div`,{className:E(`bree-layout`,e&&`bree-with-topbar`,d&&`bree-with-layers`,n&&`bree-with-sidebar`),children:[e&&(0,x.jsx)(s,{...a.topBar}),d&&(0,x.jsx)(c,{...a.layersPanel}),(0,x.jsx)(l,{header:r,...a.canvas}),n&&(0,x.jsx)(u,{...a.sidebar})]})}var qn=(0,l.forwardRef)(function({showTopBar:e,showLayers:t,showSidebar:n,showEmailHeader:r,components:i,slotProps:a,...o},s){return(0,x.jsx)(nn,{ref:s,...o,children:(0,x.jsx)(Kn,{showTopBar:e,showLayers:t,showSidebar:n,showEmailHeader:r,components:i,slotProps:a})})});exports.AlignInput=at,exports.BLOCK_CONTAINERS=D,exports.BetterEmailEditor=qn,exports.BlockProperties=Sn,exports.BlocksTab=Tn,exports.BodyTab=kn,exports.BoxGroup=ct,exports.ButtonInspector=lt,exports.COLUMN_PARENTS=O,exports.Canvas=fn,exports.CanvasOverlay=cn,exports.ColorInput=W,exports.ColumnsInspector=ut,exports.ContainerInspector=gt,exports.ContentPanel=Mn,exports.ContentTab=jn,exports.DEFAULT_SWATCHES=et,exports.DefaultInspector=yn,exports.DeviceToggle=zn,exports.DividerInspector=ht,exports.EditorRoot=nn,exports.EmailButton=pe,exports.EmailHeader=un,exports.ExportHtmlButton=Wn,exports.ExportJsonButton=Hn,exports.Field=V,exports.FontInput=rt,exports.Group=B,exports.HeadingInspector=dt,exports.HtmlBlock=Tt,exports.HtmlInspector=mt,exports.ImageInspector=ft,exports.ImportButton=Vn,exports.LayersPanel=vn,exports.LayersToggle=Ln,exports.NumberInput=U,exports.PaddingInput=ot,exports.PaletteTile=An,exports.PreviewButton=Un,exports.PreviewDialog=In,exports.PropertiesPanel=xn,exports.RangeInput=$e,exports.SOCIAL_NETWORKS=bt,exports.Segmented=it,exports.Select=nt,exports.Sidebar=Pn,exports.SocialLinks=wt,exports.SocialLinksInspector=Et,exports.Spacer=yt,exports.SpacerInspector=pt,exports.SpacingGroup=K,exports.TemplateButton=Bn,exports.TemplateCard=wn,exports.TemplateThumbnail=Z,exports.TextArea=Ze,exports.TextInput=H,exports.TextProperties=Nn,exports.TopBar=Gn,exports.TypographyGroup=st,exports.UndoRedo=Rn,exports.appendBlocks=fe,exports.applyDrop=M,Object.defineProperty(exports,"content",{enumerable:!0,get:function(){return jt}}),exports.createStarterDocument=Kt,exports.css=G,exports.cx=E,exports.defaultFonts=we,exports.defaultNodes=At,exports.defaultPalette=Ut,exports.defaultPaletteGroups=Ht,exports.defaultTemplates=Wt,exports.defaultTheme=Xt,exports.deleteUnit=de,exports.download=Fn,exports.duplicateUnit=ue,exports.en=ke,exports.findDropTarget=re,exports.findFont=Ee,exports.fr=Ae,exports.iconUrl=St,Object.defineProperty(exports,"icons",{enumerable:!0,get:function(){return Fe}}),exports.inlineStyleToObject=_t,exports.locales=je,exports.menuParagraph=Vt,exports.parentUnit=le,exports.readFileAsDataUrl=Zt,exports.resolveLabel=R,exports.resolveMessages=Pe,exports.selectUnit=F,exports.selectedUnit=P,exports.textPreview=Ot,exports.toHex=tt,exports.truncate=Dt,exports.unitAt=N,exports.useDeselect=bn,exports.useDraggableBlock=Cn,exports.useEmailEditor=Q,exports.useI18n=Yt,exports.useMessages=$,exports.useOptionalEmailEditor=Jt;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let l=require("react"),u=require("@tiptap/extension-placeholder"),d=require("@tiptap/react"),f=require("@react-email/editor/core"),p=require("@react-email/editor/extensions"),m=require("@react-email/editor/plugins"),h=require("@tiptap/pm/model"),g=require("@tiptap/pm/state"),_=require("@tiptap/html"),v=require("@tiptap/core"),y=require("@tiptap/pm/transform"),b=require("@tiptap/pm/view"),x=require("@react-email/editor/ui"),S=require("react/jsx-runtime"),C=require("@radix-ui/react-popover");C=c(C,1);let w=require("react-colorful"),T=require("react-email"),E=require("react-dom");function D(...e){return e.filter(Boolean).join(` `)}var O=new Set([`container`,`section`,`columnsColumn`]),k=new Set([`twoColumns`,`threeColumns`,`fourColumns`]),ee=`application/x-email-block`;function te(e,t){let n=e.nodeDOM(t);return n instanceof HTMLElement?n.getBoundingClientRect():null}function ne(e,t,n){let r=[];return t.forEach((t,i)=>{let a=n+1+i,o=te(e,a);o&&r.push({node:t,pos:a,rect:o})}),r}function A(e){return e.type.name===`paragraph`&&e.childCount===0}function re(e){let t=null;return e.forEach((e,n)=>{!t&&e.type.name===`container`&&(t={node:e,pos:n})}),t}function ie(e,t,n,r,i){let a=re(e.state.doc);if(!a)return null;let o=e=>!!i&&e>=i.from&&e<i.to,s=(i,a)=>{let c=ne(e,i,a),l=te(e,a);if(!l)return null;for(let r of c){let{rect:i}=r,a=Math.min(12,i.height/4),c=n>i.top+a&&n<i.bottom-a,l=t>=i.left&&t<=i.right;if(!c||!l||o(r.pos))continue;let u=r.node.type.name;if(O.has(u)){let e=s(r.node,r.pos);if(e)return e}else if(k.has(u)){let n=ne(e,r.node,r.pos),i=n.find(e=>t>=e.rect.left&&t<=e.rect.right)??(t<n[0]?.rect.left?n[0]:n[n.length-1]);if(i&&!o(i.pos)){let e=s(i.node,i.pos);if(e)return e}}}if(c.length===1&&A(c[0].node)&&!o(c[0].pos)){let e=c[0];return i.type.validContent(r)?{pos:e.pos,replaceTo:e.pos+e.node.nodeSize,line:{top:e.rect.top,left:l.left,width:l.width},emptyZone:{top:l.top,left:l.left,width:l.width,height:Math.max(l.height,40)}}:null}let u=c.length;for(let e=0;e<c.length;e++){let{rect:t}=c[e];if(n<t.top+t.height/2){u=e;break}}let d=u,f=u<c.length?(e=>{let t=0,n=-1;return i.forEach((r,i)=>{a+1+i===e&&(n=t),t++}),n})(c[u].pos):i.childCount;if(!i.canReplace(f,f,r))return null;let p=d<c.length?c[d].pos:a+i.nodeSize-1,m;return m=c.length===0?l.top+4:d===0?c[0].rect.top:d===c.length?c[c.length-1].rect.bottom:(c[d-1].rect.bottom+c[d].rect.top)/2,{pos:p,line:{top:m,left:l.left,width:l.width}}};return s(a.node,a.pos)}function ae(e,t){let{schema:n,doc:r}=e.state;if(t.kind===`new`)try{return h.Fragment.fromArray(t.content().map(e=>n.nodeFromJSON(e)))}catch(e){return console.error(`Invalid block content`,e),null}let i=r.nodeAt(t.pos);return i?h.Fragment.from(i):null}function j(e,t){let n=e.doc.nodeAt(t);n&&(n.isAtom||n.type.name===`horizontalRule`?e.setSelection(g.NodeSelection.create(e.doc,t)):e.setSelection(g.TextSelection.near(e.doc.resolve(t+1))))}function oe(e){let{selection:t,doc:n}=e.state;t instanceof g.NodeSelection&&e.dispatch(e.state.tr.setSelection(g.Selection.near(n.resolve(t.from))))}function se(e,t){if(t.replaceTo!==void 0)return t;let n=e.resolve(t.pos),r=n.parent,i=r.lastChild;return n.index()!==r.childCount||!i||r.childCount<2||!A(i)?t:{...t,pos:t.pos-i.nodeSize}}function ce(e,t,n){let{view:r}=e;oe(r);let i=ae(r,t);if(!i)return!1;let a=se(r.state.doc,n),o=r.state.tr;if(t.kind===`new`)a.replaceTo===void 0?o.insert(a.pos,i):o.replaceWith(a.pos,a.replaceTo,i),j(o,a.pos);else{let e=r.state.doc.nodeAt(t.pos);if(!e)return!1;let n=t.pos,i=n+e.nodeSize;if(a.replaceTo===void 0&&(a.pos===n||a.pos===i))return!1;le(o,n,i);let s=o.mapping.map(a.pos,-1);if(a.replaceTo!==void 0){let t=o.mapping.map(a.replaceTo,1);o.replaceWith(s,t,e)}else o.insert(s,e);j(o,s)}return r.dispatch(o.scrollIntoView()),r.focus(),!0}function le(e,t,n){let r=e.doc.resolve(t).parent;r.childCount===1&&O.has(r.type.name)?e.replaceWith(t,n,e.doc.type.schema.nodes.paragraph.create()):e.delete(t,n)}function M(e,t,n=!0){if(t<0||t>e.content.size)return null;let r=[],i=e.nodeAt(t);n&&i&&r.push({pos:t,node:i});let a=e.resolve(t);for(let e=a.depth;e>0;e--)r.push({pos:a.before(e),node:a.node(e)});for(let t of r){let n=e.resolve(t.pos).parent.type.name;if(O.has(n)||k.has(n))return t}return null}function ue(e){return e.node.type.name===`columnsColumn`}function de(e,t){let n=e.resolve(t.pos);for(let r=n.depth;r>0;r--){let i=M(e,n.before(r));if(i&&i.pos!==t.pos)return i}return null}function N(e){let{selection:t,doc:n}=e.state;return t instanceof g.NodeSelection?M(n,t.from)??{pos:t.from,node:t.node}:M(n,t.from,!1)}function P(e,t){let{view:n}=e,r=n.state.tr.setSelection(g.NodeSelection.create(n.state.doc,t.pos));n.dispatch(r),n.focus()}function fe(e,t){let{view:n}=e;oe(n);let r=n.state.doc.nodeAt(t.pos);if(!r)return;let i=t.pos+r.nodeSize,a=n.state.tr.insert(i,r.copy(r.content));a.setSelection(g.NodeSelection.create(a.doc,i)),n.dispatch(a.scrollIntoView()),n.focus()}function pe(e,t){let{view:n}=e,r=n.state.doc.nodeAt(t.pos);if(!r)return;let i=n.state.tr;le(i,t.pos,t.pos+r.nodeSize),n.dispatch(i)}function me(e,t){let n=re(e.state.doc);if(!n)return;let r=n.node.lastChild,i=n.pos+n.node.nodeSize-1;ce(e,{kind:`new`,label:``,content:()=>t},r&&A(r)&&n.node.childCount>1?{pos:i-r.nodeSize,replaceTo:i,line:{top:0,left:0,width:0}}:{pos:i,line:{top:0,left:0,width:0}})}var he=p.Button.extend({parseHTML(){return[{tag:`a[data-id="react-email-button"]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e,n=t.parentElement?.className.match(/align-(left|center|right)/)?.[1],r=t.className.replace(/\bnode-button\b/g,``).trim();return{href:t.getAttribute(`href`)??t.dataset.href??`#`,alignment:n??`left`,class:r||`button`,style:t.getAttribute(`style`)}}}]}});function ge(e,t){let n=t.clipboardData?.getData(`text/html`)??``,r=n.includes(`data-pm-slice`);if((t.clipboardData?.files?.length??0)>0)return!1;let{view:i}=e,{state:a}=i,{selection:o}=a;if(o instanceof g.NodeSelection&&o.node.isBlock){let e=o.node,t=e.type.name===`columnsColumn`?o.from+e.nodeSize-1:o.from+e.nodeSize,n=a.doc.resolve(t),r=a.schema.nodes.paragraph;if(k.has(n.parent.type.name)||!n.parent.canReplaceWith(n.index(),n.index(),r))return!1;i.dispatch(a.tr.setSelection(g.TextSelection.near(n)));let s=i.state.tr.insert(t,r.create());s.setSelection(g.TextSelection.create(s.doc,t+1)),i.dispatch(s)}return r?(t.preventDefault(),t.stopPropagation(),i.pasteHTML(n),!0):!1}var _e=/class="[^"]*node-/,F=[`script`,`iframe`,`object`,`embed`,`meta`,`base`],ve=[`href`,`src`],ye={a:[`href`,`target`,`rel`],img:[`src`,`alt`,`width`,`height`],td:[`colspan`,`rowspan`],th:[`colspan`,`rowspan`,`scope`],table:[`border`,`cellpadding`,`cellspacing`],"*":[`id`]};function I(e,t){let n=e.trim().toLowerCase();return n.startsWith(`javascript:`)||n.startsWith(`vbscript:`)?!1:!n.startsWith(`data:`)||t&&n.startsWith(`data:image/`)}function be(e){let t=new Set([...ye[e.tagName.toLowerCase()]??[],...ye[`*`]]);for(let n of Array.from(e.attributes))(n.name.startsWith(`data-`)||!t.has(n.name))&&e.removeAttribute(n.name)}function xe(e){e.nodeType===Node.ELEMENT_NODE&&be(e);for(let t of Array.from(e.childNodes))xe(t)}function Se(e){let t=new DOMParser().parseFromString(e,`text/html`);for(let e of F)for(let n of Array.from(t.body.getElementsByTagName(e)))n.remove();for(let e of Array.from(t.body.querySelectorAll(`[href], [src]`))){let t=e.tagName.toLowerCase()===`img`;for(let n of ve){let r=e.getAttribute(n);r!==null&&!I(r,t)&&e.removeAttribute(n)}}return _e.test(e)||xe(t.body),t.body.innerHTML}function Ce(e){return(t,n,r)=>{if(r.content.childCount===1)return!1;let i=n.clipboardData?.getData?.(`text/html`);if(!i)return!1;n.preventDefault();let a=(0,_.generateJSON)(Se(i),e),o=t.state.schema.nodeFromJSON(a);return t.dispatch(t.state.tr.replaceSelectionWith(o,!1)),!0}}var we=new Set([`columnsColumn`,`codeBlock`]),Te=v.Extension.create({name:`selectAllFix`,priority:101,addKeyboardShortcuts(){return{"Mod-a":({editor:e})=>{let{state:t}=e,{$from:n}=t.selection;for(let e=n.depth;e>0;e--)if(we.has(n.node(e).type.name)&&(t.selection.from!==n.start(e)||t.selection.to!==n.end(e)))return!1;let r=-1;t.doc.forEach((e,t)=>{r<0&&e.type.name===`container`&&(r=t)});let i=r<0?null:t.doc.nodeAt(r);if(!i)return!1;let a=r+1,o=r+i.nodeSize-1;return(t.selection.from!==a||t.selection.to!==o)&&e.view.dispatch(t.tr.setSelection(g.TextSelection.create(t.doc,a,o))),!0}}},addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey(`selectAllFix`),appendTransaction(e,t,n){let r=t.selection;if(!(r instanceof g.TextSelection)||r.$from.parent.inlineContent&&r.$to.parent.inlineContent||!e.some(e=>e.steps.some(e=>e instanceof y.ReplaceStep&&e.from===r.from&&e.to===r.to)))return null;let i=r.from,a=r.to;for(let t of e)i=t.mapping.map(i,-1),a=t.mapping.map(a,1);let{selection:o}=n;if(o instanceof g.TextSelection&&o.from>=i&&o.to<=a)return null;let s=n.doc.resolve(i);return n.tr.setSelection(g.Selection.findFrom(s,1,!0)??g.Selection.near(s))}})]}}),Ee=v.Extension.create({name:`focusedSpellcheck`,addProseMirrorPlugins(){let{editor:e}=this;return[new g.Plugin({key:new g.PluginKey(`focusedSpellcheck`),props:{attributes:{spellcheck:`false`},decorations:t=>{if(!e.isFocused)return b.DecorationSet.empty;let{from:n,to:r,$from:i}=t.selection,a=[];return t.doc.nodesBetween(n,r,(e,t)=>!e.isTextblock||(a.push(b.Decoration.node(t,t+e.nodeSize,{spellcheck:`true`})),!1)),!a.length&&i.parent.isTextblock&&i.depth>0&&a.push(b.Decoration.node(i.before(),i.after(),{spellcheck:`true`})),b.DecorationSet.create(t.doc,a)}}})]}}),De=[{label:`Inter`,value:`Inter, Arial, Helvetica, sans-serif`,href:`https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap`},{label:`Arial`,value:`Arial, Helvetica, sans-serif`},{label:`Verdana`,value:`Verdana, Geneva, sans-serif`},{label:`Tahoma`,value:`Tahoma, Verdana, Segoe, sans-serif`},{label:`Georgia`,value:`Georgia, 'Times New Roman', Times, serif`},{label:`Times New Roman`,value:`'Times New Roman', Times, serif`}];function Oe(e){return e.split(`,`)[0].trim().replace(/^['"]|['"]$/g,``).toLowerCase()}function ke(e,t){if(!t)return;let n=Oe(t);return e.find(e=>Oe(e.value)===n)}function Ae(e,t){let n=new Set;for(let t of e.matchAll(/font-family:\s*([^;"]+)/gi))n.add(Oe(t[1].replace(/'|"/g,`'`)));return t.filter(e=>e.href&&n.has(Oe(e.value)))}function je(e,t){let n=Ae(e,t).map(e=>`<link href="${e.href.replace(/&/g,`&`)}" rel="stylesheet" />`).join(``);return n?e.replace(`</head>`,`${n}</head>`):e}function Me(){let e=null;return{get:()=>e,start:t=>{e=t},end:()=>{e=null}}}function Ne(){let e=null,t=new Set;return{get:()=>e,set:n=>{if(n!==e){e=n;for(let e of t)e()}},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var Pe={topBar:{layers:`Layers`,toggleLayers:`Show / hide layers`,undo:`Undo (Ctrl+Z)`,redo:`Redo (Ctrl+Y)`,canvasWidth:`Canvas width`,desktop:`Desktop`,mobile:`Mobile`,template:`Template`,confirmTemplate:`Replace the content with the starter template?`,import:`Import`,exportJson:`Save JSON`,preview:`Preview`,exportHtml:`Export HTML`,invalidFile:e=>`Invalid file: ${e}`},preview:{dialogLabel:`Preview and export`,desktop:`Desktop`,mobile:`Mobile`,html:`HTML`,text:`Plain text`,copy:`Copy`,copied:`Copied ✓`,download:`Download .html`,close:`Close`,rendering:`Rendering the email…`,renderError:e=>`Render error: ${e}`,iframeTitle:`Email preview`},sidebar:{label:`Side panel`,tabContent:`Content`,tabBlocks:`Blocks`,tabBody:`Body`,layoutTitle:`Layout`,contentTitle:`Content`,dragHint:`Drag an item into the email. A click adds it at the end.`,tileTitle:e=>`Drag “${e}” into the email (or click to add it at the end)`,propertiesEyebrow:`Properties`,closeProperties:`Close (back to content)`,breadcrumb:`Hierarchy`,selectedText:`Selected text`},emailHeader:{subject:`Subject`,subjectPlaceholder:`Subject line`,previewText:`Preview`,previewTextPlaceholder:`Shown after the subject line in the inbox`},body:{general:`General`,previewText:`Preview text`,previewTextPlaceholder:`Shown after the subject line in the inbox`,background:`Background`,backgroundColor:`Background color`,outerPadding:`Outer padding`,content:`Content`,width:`Width`,contentColor:`Content color`,innerPadding:`Inner padding`,radius:`Corner radius`,defaultStyles:`Default styles`,font:`Font`,fontDefault:`Default (system font)`,text:`Text`,headings:`Headings`,links:`Links`,buttonBackground:`Button background`,buttonText:`Button text`},inspector:{typography:`Typography`,font:`Font`,fontDefault:`Default (email font)`,color:`Color`,size:`Size`,weight:`Weight`,weightLight:`Light`,weightNormal:`Normal`,weightSemibold:`Semibold`,weightBold:`Bold`,weightExtrabold:`Extra bold`,lineHeight:`Line height`,alignment:`Alignment`,spacing:`Spacing`,padding:`Padding`,box:`Background & border`,backgroundColor:`Background color`,radius:`Corner radius`,border:`Border`,borderColor:`Border color`,image:`Image`,uploadImage:`Upload an image…`,imageUrl:`Image URL`,altText:`Alt text`,altPlaceholder:`Describe the image`,layout:`Layout`,autoWidth:`Auto width`,width:`Width`,action:`Action`,clickLink:`Link on click`,linkUrl:`Link URL`,button:`Button`,textColor:`Text color`,textSize:`Text size`,buttonPadding:`Button padding`,networks:`Networks`,removeNetwork:`Remove`,addNetwork:`+ Add a network`,appearance:`Appearance`,iconSize:`Icon size`,gap:`Spacing`,columns:`Columns`,distribution:`Distribution`,equal:`Equal`,columnGap:`Gap between columns`,columnsHint:`Click inside a column to set its background and padding.`,spacer:`Spacer`,height:`Height`,htmlCode:`HTML code`,htmlHint:`The HTML is inserted as is in the exported email.`,line:`Line`,thickness:`Thickness`,lineStyle:`Style`,heading:`Heading`,level:`Level`,formatting:`Formatting`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strike:`Strikethrough`,link:`Link`,url:`URL`,linkColor:`Link color`},fields:{colorDefault:`Default`,chooseColor:e=>`Pick a color (${e})`,hexCode:`Hex code`,eyedropper:`Eyedropper: pick a color on screen`,documentColors:`Document colors`,palette:`Palette`,resetColor:`Reset to default`,alignLeft:`Left`,alignCenter:`Center`,alignRight:`Right`,top:`Top`,right:`Right`,bottom:`Bottom`,left:`Left`,moreOptions:`More options`,auto:`auto`},layers:{title:`Layers`,expandAll:`Expand all`,collapseAll:`Collapse all`,close:`Close layers`,tree:`Email structure`,emptyEmail:`The email is empty.`,emptyZone:`Empty — drop content here`,column:e=>`Column ${e}`,fixedHint:`Columns stay in their row`,itemHint:`Click to select, drag to move`,expand:`Expand`,collapse:`Collapse`,uploadedImage:`uploaded image`,empty:`empty`},canvas:{dropHere:`Drop here`,dropLabel:e=>e?`Drop “${e}” here`:`Drop here`,emptyZone:`Drag content here`,move:`Drag to move`,moveLabel:e=>`Move: ${e}`,selectParent:e=>`Select: ${e}`,duplicate:`Duplicate`,delete:`Delete`},placeholder:{heading:`Heading`,paragraph:`Write, or type “/” for commands`},nodes:{body:`Body`,paragraph:`Text`,heading:`Heading`,image:`Image`,button:`Button`,horizontalRule:`Divider`,spacer:`Spacer`,socialLinks:`Social links`,htmlBlock:`HTML`,section:`Section`,twoColumns:`Row · 2 columns`,threeColumns:`Row · 3 columns`,fourColumns:`Row · 4 columns`,columnsColumn:`Column`,bulletList:`List`,orderedList:`Numbered list`,listItem:`List item`,blockquote:`Quote`,codeBlock:`Code`,table:`Table`,container:`Email`},palette:{oneColumn:`1 column`,twoColumns:`2 columns`,threeColumns:`3 columns`,fourColumns:`4 columns`,heading:`Heading`,text:`Text`,button:`Button`,image:`Image`,divider:`Divider`,spacer:`Spacer`,social:`Social`,menu:`Menu`,list:`List`,quote:`Quote`,html:`HTML`,card:`Card`},templates:{header:`Header`,headerDescription:`Logo on the left, menu on the right`,hero:`Hero`,heroDescription:`Big heading, tagline and button`,products:`Products`,productsDescription:`Two product cards side by side`,features:`Features`,featuresDescription:`Three columns with heading + text`,testimonial:`Testimonial`,testimonialDescription:`Highlighted customer quote`,footer:`Footer`,footerDescription:`Social links, address and unsubscribe`},content:{heading:`Your heading here`,text:`This is a new text block. Click it to edit the content, select text to format it.`,button:`Click here`,image:`Image`,menuHome:`Home`,menuShop:`Shop`,menuBlog:`Blog`,menuContact:`Contact`,listItems:[`First item`,`Second item`,`Third item`],quote:`“A quote that highlights your message.”`,html:`<p style="margin:0;text-align:center;font-family:sans-serif">Your custom <strong>HTML</strong></p>`,cardTitle:`Did you know?`,cardText:`A card draws attention to an important piece of information.`,logo:`LOGO`,heroTitle:`What’s new this season`,heroText:`Discover our selection made for you, available today.`,heroButton:`Discover`,productA:`Product A`,productB:`Product B`,productText:`A short description of the product.`,productButton:`Buy`,features:[`Free shipping`,`Free returns`,`24/7 support`],featureText:`A clear and concise argument.`,testimonialQuote:`“Flawless service, I recommend it with my eyes closed.”`,testimonialAuthor:`— Camille, customer since 2021`,footerAddress:`Acme Inc. · 10 Main Street, Springfield`,unsubscribe:`Unsubscribe`,starterTitle:`Our favourites`},slashCommands:{}},Fe={topBar:{layers:`Calques`,toggleLayers:`Afficher / masquer les calques`,undo:`Annuler (Ctrl+Z)`,redo:`Rétablir (Ctrl+Y)`,canvasWidth:`Largeur du canvas`,desktop:`Bureau`,mobile:`Mobile`,template:`Modèle`,confirmTemplate:`Remplacer le contenu par le modèle de départ ?`,import:`Importer`,exportJson:`Enregistrer JSON`,preview:`Aperçu`,exportHtml:`Exporter HTML`,invalidFile:e=>`Fichier invalide : ${e}`},preview:{dialogLabel:`Aperçu et export`,desktop:`Bureau`,mobile:`Mobile`,html:`HTML`,text:`Texte brut`,copy:`Copier`,copied:`Copié ✓`,download:`Télécharger .html`,close:`Fermer`,rendering:`Rendu de l’email…`,renderError:e=>`Erreur de rendu : ${e}`,iframeTitle:`Aperçu de l’email`},sidebar:{label:`Panneau latéral`,tabContent:`Contenu`,tabBlocks:`Blocs`,tabBody:`Corps`,layoutTitle:`Mise en page`,contentTitle:`Contenus`,dragHint:`Glissez un élément dans l’email. Un clic l’ajoute à la fin.`,tileTitle:e=>`Glissez « ${e} » dans l’email (ou cliquez pour l’ajouter à la fin)`,propertiesEyebrow:`Propriétés`,closeProperties:`Fermer (retour aux contenus)`,breadcrumb:`Hiérarchie`,selectedText:`Texte sélectionné`},emailHeader:{subject:`Objet`,subjectPlaceholder:`Objet de l’email`,previewText:`Aperçu`,previewTextPlaceholder:`Affiché après l’objet dans la boîte de réception`},body:{general:`Général`,previewText:`Texte d’aperçu`,previewTextPlaceholder:`Affiché après l’objet dans la boîte de réception`,background:`Arrière-plan`,backgroundColor:`Couleur de fond`,outerPadding:`Marge extérieure`,content:`Contenu`,width:`Largeur`,contentColor:`Couleur du contenu`,innerPadding:`Marge intérieure`,radius:`Arrondi`,defaultStyles:`Styles par défaut`,font:`Police`,fontDefault:`Par défaut (police système)`,text:`Texte`,headings:`Titres`,links:`Liens`,buttonBackground:`Fond des boutons`,buttonText:`Texte des boutons`},inspector:{typography:`Typographie`,font:`Police`,fontDefault:`Par défaut (police de l’email)`,color:`Couleur`,size:`Taille`,weight:`Graisse`,weightLight:`Fin`,weightNormal:`Normal`,weightSemibold:`Semi-gras`,weightBold:`Gras`,weightExtrabold:`Extra-gras`,lineHeight:`Interligne`,alignment:`Alignement`,spacing:`Espacement`,padding:`Marge intérieure`,box:`Fond et bordure`,backgroundColor:`Couleur de fond`,radius:`Arrondi`,border:`Bordure`,borderColor:`Couleur de bordure`,image:`Image`,uploadImage:`Importer une image…`,imageUrl:`URL de l’image`,altText:`Texte alternatif`,altPlaceholder:`Décrivez l’image`,layout:`Disposition`,autoWidth:`Largeur auto`,width:`Largeur`,action:`Action`,clickLink:`Lien au clic`,linkUrl:`URL du lien`,button:`Bouton`,textColor:`Couleur du texte`,textSize:`Taille du texte`,buttonPadding:`Marges du bouton`,networks:`Réseaux`,removeNetwork:`Retirer`,addNetwork:`+ Ajouter un réseau`,appearance:`Apparence`,iconSize:`Taille des icônes`,gap:`Espacement`,columns:`Colonnes`,distribution:`Répartition`,equal:`Égales`,columnGap:`Espace entre colonnes`,columnsHint:`Cliquez dans une colonne pour régler son fond et ses marges.`,spacer:`Espacement`,height:`Hauteur`,htmlCode:`Code HTML`,htmlHint:`Le HTML est inséré tel quel dans l’email exporté.`,line:`Ligne`,thickness:`Épaisseur`,lineStyle:`Style`,heading:`Titre`,level:`Niveau`,formatting:`Mise en forme`,bold:`Gras`,italic:`Italique`,underline:`Souligné`,strike:`Barré`,link:`Lien`,url:`URL`,linkColor:`Couleur du lien`},fields:{colorDefault:`Par défaut`,chooseColor:e=>`Choisir une couleur (${e})`,hexCode:`Code hexadécimal`,eyedropper:`Pipette : prendre une couleur à l’écran`,documentColors:`Couleurs du document`,palette:`Palette`,resetColor:`Revenir à la valeur par défaut`,alignLeft:`Gauche`,alignCenter:`Centre`,alignRight:`Droite`,top:`Haut`,right:`Droite`,bottom:`Bas`,left:`Gauche`,moreOptions:`Plus d’options`,auto:`auto`},layers:{title:`Calques`,expandAll:`Tout déplier`,collapseAll:`Tout replier`,close:`Fermer les calques`,tree:`Structure de l’email`,emptyEmail:`L’email est vide.`,emptyZone:`Vide — déposez du contenu ici`,column:e=>`Colonne ${e}`,fixedHint:`Les colonnes restent dans leur ligne`,itemHint:`Cliquer pour sélectionner, glisser pour déplacer`,expand:`Déplier`,collapse:`Replier`,uploadedImage:`image importée`,empty:`vide`},canvas:{dropHere:`Déposer ici`,dropLabel:e=>e?`Déposer « ${e} » ici`:`Déposer ici`,emptyZone:`Glissez du contenu ici`,move:`Glisser pour déplacer`,moveLabel:e=>`Déplacer : ${e}`,selectParent:e=>`Sélectionner : ${e}`,duplicate:`Dupliquer`,delete:`Supprimer`},placeholder:{heading:`Titre`,paragraph:`Écrivez, ou tapez « / » pour les commandes`},nodes:{body:`Corps`,paragraph:`Texte`,heading:`Titre`,image:`Image`,button:`Bouton`,horizontalRule:`Séparateur`,spacer:`Espacement`,socialLinks:`Réseaux sociaux`,htmlBlock:`HTML`,section:`Section`,twoColumns:`Ligne · 2 colonnes`,threeColumns:`Ligne · 3 colonnes`,fourColumns:`Ligne · 4 colonnes`,columnsColumn:`Colonne`,bulletList:`Liste`,orderedList:`Liste numérotée`,listItem:`Élément de liste`,blockquote:`Citation`,codeBlock:`Code`,table:`Tableau`,container:`Email`},palette:{oneColumn:`1 colonne`,twoColumns:`2 colonnes`,threeColumns:`3 colonnes`,fourColumns:`4 colonnes`,heading:`Titre`,text:`Texte`,button:`Bouton`,image:`Image`,divider:`Séparateur`,spacer:`Espacement`,social:`Réseaux`,menu:`Menu`,list:`Liste`,quote:`Citation`,html:`HTML`,card:`Encadré`},templates:{header:`En-tête`,headerDescription:`Logo à gauche, menu à droite`,hero:`Hero`,heroDescription:`Grand titre, accroche et bouton`,products:`Produits`,productsDescription:`Deux cartes produit côte à côte`,features:`Avantages`,featuresDescription:`Trois colonnes titre + texte`,testimonial:`Témoignage`,testimonialDescription:`Citation client mise en avant`,footer:`Pied de page`,footerDescription:`Réseaux sociaux, adresse et désinscription`},content:{heading:`Votre titre ici`,text:`Ceci est un nouveau bloc de texte. Cliquez dessus pour modifier le contenu, sélectionnez du texte pour le mettre en forme.`,button:`Cliquez ici`,image:`Image`,menuHome:`Accueil`,menuShop:`Boutique`,menuBlog:`Blog`,menuContact:`Contact`,listItems:[`Premier point`,`Deuxième point`,`Troisième point`],quote:`« Une citation qui met en valeur votre message. »`,html:`<p style="margin:0;text-align:center;font-family:sans-serif">Votre <strong>HTML</strong> personnalisé</p>`,cardTitle:`Le saviez-vous ?`,cardText:`Un encadré attire l’œil sur une information importante.`,logo:`LOGO`,heroTitle:`Les nouveautés de la saison`,heroText:`Découvrez notre sélection pensée pour vous, disponible dès aujourd’hui.`,heroButton:`Découvrir`,productA:`Produit A`,productB:`Produit B`,productText:`Une courte description du produit.`,productButton:`Acheter`,features:[`Livraison offerte`,`Retours gratuits`,`Support 7j/7`],featureText:`Un argument clair et concis.`,testimonialQuote:`« Service impeccable, je recommande les yeux fermés. »`,testimonialAuthor:`— Camille, cliente depuis 2021`,footerAddress:`Acme SAS · 10 rue de la Paix, 75002 Paris`,unsubscribe:`Se désinscrire`,starterTitle:`Nos coups de cœur`},slashCommands:{Text:{title:`Texte`,description:`Paragraphe simple`},Title:{title:`Titre`,description:`Grand titre`},Subtitle:{title:`Sous-titre`,description:`Titre moyen`},Heading:{title:`Intertitre`,description:`Petit titre`},"Bullet list":{title:`Liste à puces`,description:`Liste non ordonnée`},"Numbered list":{title:`Liste numérotée`,description:`Liste ordonnée`},Quote:{title:`Citation`,description:`Bloc de citation`},"Code block":{title:`Bloc de code`,description:`Extrait de code`},Button:{title:`Bouton`,description:`Bouton cliquable`},Divider:{title:`Séparateur`,description:`Ligne horizontale`},Section:{title:`Section`,description:`Section de contenu`},"2 columns":{title:`2 colonnes`,description:`Mise en page sur deux colonnes`},"3 columns":{title:`3 colonnes`,description:`Mise en page sur trois colonnes`},"4 columns":{title:`4 colonnes`,description:`Mise en page sur quatre colonnes`}}},Ie={en:Pe,fr:Fe};function Le(e,t){return typeof e==`function`?e(t):e}function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ze(e,t){if(!Re(t)||!Re(e))return t??e;let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=Re(r)&&Re(n[e])?ze(n[e],r):r);return n}function Be(e,t){let n=Ie[e]??Pe;return t?ze(n,t):n}var Ve=o({CopyIcon:()=>Ue,DesktopIcon:()=>Je,GripIcon:()=>He,LayersIcon:()=>Xe,MobileIcon:()=>Ye,OneColumnIcon:()=>tt,ParentIcon:()=>Ge,PipetteIcon:()=>Ze,RedoIcon:()=>qe,SocialIcon:()=>et,SpacerIcon:()=>Qe,SpacerTileIcon:()=>$e,TrashIcon:()=>We,UndoIcon:()=>Ke}),L=(e,t=2)=>({viewBox:`0 0 24 24`,width:e,height:e,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0}),He=({size:e=14})=>(0,S.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":!0,children:[6,12,18].map(e=>(0,S.jsxs)(`g`,{children:[(0,S.jsx)(`circle`,{cx:`9`,cy:e,r:`1.6`}),(0,S.jsx)(`circle`,{cx:`15`,cy:e,r:`1.6`})]},e))}),Ue=({size:e=14})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,S.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]}),We=({size:e=14})=>(0,S.jsx)(`svg`,{...L(e),children:(0,S.jsx)(`path`,{d:`M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3`})}),Ge=({size:e=14})=>(0,S.jsx)(`svg`,{...L(e),children:(0,S.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})}),Ke=({size:e=16})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`path`,{d:`M9 14 4 9l5-5`}),(0,S.jsx)(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),qe=({size:e=16})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`path`,{d:`m15 14 5-5-5-5`}),(0,S.jsx)(`path`,{d:`M20 9H9.5a5.5 5.5 0 0 0 0 11H13`})]}),Je=({size:e=16})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,S.jsx)(`path`,{d:`M8 20h8M12 16v4`})]}),Ye=({size:e=16})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`rect`,{x:`7`,y:`2`,width:`10`,height:`20`,rx:`2`}),(0,S.jsx)(`path`,{d:`M11 18h2`})]}),Xe=({size:e=16})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`path`,{d:`m12 3 9 5-9 5-9-5 9-5Z`}),(0,S.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),Ze=({size:e=15})=>(0,S.jsxs)(`svg`,{...L(e),children:[(0,S.jsx)(`path`,{d:`m2 22 1-1h3l9-9`}),(0,S.jsx)(`path`,{d:`M3 21v-3l9-9`}),(0,S.jsx)(`path`,{d:`m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z`})]}),Qe=({size:e=14})=>(0,S.jsx)(`svg`,{...L(e),children:(0,S.jsx)(`path`,{d:`M4 4h16M4 20h16M12 8v8`})}),$e=({size:e=22})=>(0,S.jsx)(`svg`,{...L(e,1.8),children:(0,S.jsx)(`path`,{d:`M4 4h16M4 20h16M12 7v10M9 9.5 12 7l3 2.5M9 14.5l3 2.5 3-2.5`})}),et=({size:e=22})=>(0,S.jsxs)(`svg`,{...L(e,1.8),children:[(0,S.jsx)(`circle`,{cx:`6`,cy:`12`,r:`2.5`}),(0,S.jsx)(`circle`,{cx:`18`,cy:`6`,r:`2.5`}),(0,S.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2.5`}),(0,S.jsx)(`path`,{d:`m8.2 10.8 7.6-3.6M8.2 13.2l7.6 3.6`})]}),tt=({size:e=22})=>(0,S.jsx)(`svg`,{...L(e,1.8),children:(0,S.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})});function R({title:e,children:t,defaultOpen:n=!0,className:r,style:i}){let[a,o]=(0,l.useState)(n);return(0,S.jsxs)(`section`,{className:D(`bree-group`,r),style:i,children:[(0,S.jsxs)(`button`,{type:`button`,className:`bree-group-header`,onClick:()=>o(!a),"aria-expanded":a,children:[(0,S.jsx)(`span`,{children:e}),(0,S.jsx)(`span`,{className:D(`bree-chevron`,a&&`bree-open`),"aria-hidden":!0,children:`›`})]}),a&&(0,S.jsx)(`div`,{className:`bree-group-body`,children:t})]})}function z({label:e,children:t,stacked:n,className:r,style:i}){return(0,S.jsxs)(`label`,{className:D(`bree-field`,n&&`bree-stacked`,r),style:i,children:[(0,S.jsx)(`span`,{className:`bree-field-label`,children:e}),(0,S.jsx)(`span`,{className:`bree-field-control`,children:t})]})}function nt(e){let[t,n]=(0,l.useState)(e),[r,i]=(0,l.useState)(e);return Object.is(e,r)||(i(e),n(e)),[t,n]}function B({value:e,onChange:t,placeholder:n,type:r=`text`,className:i,style:a}){let[o,s]=nt(e);return(0,S.jsx)(`input`,{className:D(`bree-input`,i),style:a,type:r,value:o,placeholder:n,onChange:e=>s(e.target.value),onBlur:()=>o!==e&&t(o),onKeyDown:e=>{e.key===`Enter`&&t(o)}})}function rt({value:e,onChange:t,rows:n=8,className:r,style:i}){let[a,o]=nt(e);return(0,S.jsx)(`textarea`,{className:D(`bree-input bree-textarea`,r),style:i,rows:n,value:a,spellCheck:!1,onChange:e=>o(e.target.value),onBlur:()=>a!==e&&t(a)})}function it(e){if(e==null||e===``||e===`auto`)return``;let t=Number.parseFloat(String(e));return Number.isFinite(t)?t:``}function V({value:e,onChange:t,unit:n=`px`,min:r=0,max:i,step:a=1,placeholder:o,className:s,style:c}){let l=$(),[u,d]=nt(String(it(e))),f=e=>{if(e.trim()===``)return t(``);let n=Number.parseFloat(e);Number.isFinite(n)&&t(Math.max(r,i===void 0?n:Math.min(i,n)))};return(0,S.jsxs)(`span`,{className:D(`bree-number`,s),style:c,children:[(0,S.jsx)(`input`,{className:`bree-input`,inputMode:`decimal`,value:u,placeholder:o??l.fields.auto,onChange:e=>d(e.target.value),onBlur:()=>f(u),onKeyDown:e=>{if(e.key===`Enter`&&f(u),e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=(it(u)||0)+(e.key===`ArrowUp`?a:-a)*(e.shiftKey?10:1);d(String(t)),f(String(t))}}}),n&&(0,S.jsx)(`span`,{className:`bree-unit`,children:n})]})}function at({value:e,onChange:t,min:n,max:r,unit:i=`px`,className:a,style:o}){let s=it(e)||n;return(0,S.jsxs)(`span`,{className:D(`bree-range`,a),style:o,children:[(0,S.jsx)(`input`,{type:`range`,min:n,max:r,value:s,onChange:e=>t(Number(e.target.value))}),(0,S.jsxs)(`span`,{className:`bree-range-value`,children:[s,i]})]})}var ot=[`#111827`,`#374151`,`#6b7280`,`#d1d5db`,`#f3f4f6`,`#ffffff`,`#ef4444`,`#f97316`,`#f59e0b`,`#10b981`,`#0ea5e9`,`#2563eb`,`#4f46e5`,`#7c3aed`,`#db2777`,`#eef2ff`,`#ecfdf5`,`#fef3c7`];function st(e){let t=e.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return`#${[...t.slice(1)].map(e=>e+e).join(``)}`;let n=t.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/);return n?`#${n.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`:null}function H({value:e,onChange:t,presets:n=[],swatches:r=ot,placeholder:i,className:a,style:o,popoverClassName:s}){let c=$(),u=i??c.fields.colorDefault,d=typeof e==`string`?e:``,f=st(d),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(f??`#ffffff`),_=(0,l.useRef)(t);(0,l.useEffect)(()=>{_.current=t});let v=(0,l.useRef)(null),y=(0,l.useRef)(0),b=()=>{window.clearTimeout(y.current),y.current=0,v.current&&_.current(v.current),v.current=null},T=e=>{g(e),v.current=e,y.current||=window.setTimeout(b,60)},E=e=>{v.current=null,window.clearTimeout(y.current),y.current=0,g(st(e)??h),_.current(e)},O=typeof window<`u`?window.EyeDropper:void 0,k=[...new Set(n.map(e=>st(e)).filter(e=>!!e))].slice(0,9);return(0,S.jsxs)(C.Root,{open:p,onOpenChange:e=>{e?g(f??`#ffffff`):b(),m(e)},children:[(0,S.jsxs)(`span`,{className:D(`bree-color-field`,a),style:o,children:[(0,S.jsx)(C.Trigger,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:D(`bree-color-trigger`,!f&&`bree-empty`),style:f?{background:f}:void 0,"aria-label":c.fields.chooseColor(d||u)})}),(0,S.jsx)(B,{value:d,onChange:t,placeholder:u})]}),(0,S.jsx)(C.Portal,{children:(0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsxs)(C.Content,{className:D(`bree bree-color-popover`,s),side:`left`,align:`start`,sideOffset:10,collisionPadding:12,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,S.jsx)(w.HexColorPicker,{color:h,onChange:T}),(0,S.jsxs)(`div`,{className:`bree-color-popover-row`,children:[(0,S.jsx)(`span`,{className:`bree-color-preview`,style:{background:h}}),(0,S.jsxs)(`label`,{className:`bree-hex-field`,children:[(0,S.jsx)(`span`,{children:`#`}),(0,S.jsx)(w.HexColorInput,{color:h,onChange:E,"aria-label":c.fields.hexCode})]}),O&&(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:c.fields.eyedropper,onClick:()=>new O().open().then(e=>E(e.sRGBHex)).catch(()=>{}),children:(0,S.jsx)(Ze,{})})]}),k.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`bree-color-popover-title`,children:c.fields.documentColors}),(0,S.jsx)(`div`,{className:`bree-swatches`,children:k.map(e=>(0,S.jsx)(`button`,{type:`button`,className:`bree-swatch`,style:{background:e},title:e,onClick:()=>E(e)},e))})]}),(0,S.jsx)(`span`,{className:`bree-color-popover-title`,children:c.fields.palette}),(0,S.jsx)(`div`,{className:`bree-swatches`,children:r.map(e=>(0,S.jsx)(`button`,{type:`button`,className:D(`bree-swatch`,e===h&&`bree-active`),style:{background:e},title:e,onClick:()=>E(e)},e))}),(0,S.jsx)(`button`,{type:`button`,className:`bree-color-reset`,onClick:()=>{v.current=null,_.current(``),m(!1)},children:c.fields.resetColor})]})})})]})}function ct({value:e,onChange:t,options:n,className:r,style:i}){return(0,S.jsx)(`select`,{className:D(`bree-input bree-select`,r),style:i,value:e,onChange:e=>t(e.target.value),children:n.map(([e,t])=>(0,S.jsx)(`option`,{value:e,children:t},e))})}function lt({value:e,onChange:t,emptyLabel:n,className:r,style:i}){let a=Qt()?.fonts??De,o=ke(a,e),s=e&&!o?{label:e.split(`,`)[0].replace(/['"]/g,``).trim(),value:e}:null,c=s?[...a,s]:a;return(0,S.jsxs)(`select`,{className:D(`bree-input bree-select`,r),style:{fontFamily:e||void 0,...i},value:o?.value??e??``,onChange:e=>t(e.target.value),children:[(n!==void 0||!e)&&(0,S.jsx)(`option`,{value:``,children:n??``}),c.map(e=>(0,S.jsx)(`option`,{value:e.value,style:{fontFamily:e.value},children:e.label},e.value))]})}function ut({value:e,onChange:t,options:n,ariaLabel:r,className:i,style:a}){return(0,S.jsx)(`span`,{className:D(`bree-segmented`,i),style:a,role:`radiogroup`,"aria-label":r,children:n.map(n=>(0,S.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n.value,title:n.title,className:D(e===n.value&&`bree-active`),onClick:()=>t(n.value),children:n.label},n.value))})}function dt({value:e,onChange:t,className:n,style:r}){let i=$();return(0,S.jsx)(ut,{className:n,style:r,value:e||`left`,onChange:t,options:[{value:`left`,label:(0,S.jsx)(x.AlignLeftIcon,{size:14}),title:i.fields.alignLeft},{value:`center`,label:(0,S.jsx)(x.AlignCenterIcon,{size:14}),title:i.fields.alignCenter},{value:`right`,label:(0,S.jsx)(x.AlignRightIcon,{size:14}),title:i.fields.alignRight}]})}function ft({get:e,set:t,className:n,style:r}){let i=$(),a=[`Top`,`Right`,`Bottom`,`Left`],o=a.map(t=>it(e(t))),s=o.every(e=>e===o[0]),[c,u]=(0,l.useState)(!s),d={Top:i.fields.top,Right:i.fields.right,Bottom:i.fields.bottom,Left:i.fields.left};return(0,S.jsxs)(`div`,{className:D(`bree-padding`,n),style:r,children:[c?(0,S.jsx)(`div`,{className:`bree-padding-grid`,children:a.map((e,n)=>(0,S.jsxs)(`label`,{className:`bree-padding-side`,children:[(0,S.jsx)(`span`,{children:d[e]}),(0,S.jsx)(V,{value:o[n],onChange:n=>t([[e,n]])})]},e))}):(0,S.jsx)(V,{value:o[0],onChange:e=>t(a.map(t=>[t,e]))}),(0,S.jsxs)(`label`,{className:`bree-checkbox`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>u(e.target.checked)}),i.fields.moreOptions]})]})}var U=e=>e;function pt({ctx:e,alignment:t,setAlignment:n,className:r,style:i}){let a=$().inspector;return(0,S.jsxs)(R,{title:a.typography,className:r,style:i,children:[(0,S.jsx)(z,{label:a.font,children:(0,S.jsx)(lt,{value:e.getStyle(U(`fontFamily`)),emptyLabel:a.fontDefault,onChange:t=>e.setStyle(U(`fontFamily`),t)})}),(0,S.jsx)(z,{label:a.color,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`color`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`color`),t)})}),(0,S.jsx)(z,{label:a.size,children:(0,S.jsx)(V,{value:e.getStyle(U(`fontSize`)),onChange:t=>e.setStyle(U(`fontSize`),t),min:8,max:96})}),(0,S.jsx)(z,{label:a.weight,children:(0,S.jsx)(ct,{value:String(e.getStyle(U(`fontWeight`))??`400`),onChange:t=>e.setStyle(U(`fontWeight`),t),options:[[`300`,a.weightLight],[`400`,a.weightNormal],[`600`,a.weightSemibold],[`700`,a.weightBold],[`800`,a.weightExtrabold]]})}),(0,S.jsx)(z,{label:a.lineHeight,children:(0,S.jsx)(V,{value:e.getStyle(U(`lineHeight`)),unit:`%`,onChange:t=>e.setStyle(U(`lineHeight`),t),min:80,max:300,step:5})}),n&&(0,S.jsx)(z,{label:a.alignment,children:(0,S.jsx)(dt,{value:t??`left`,onChange:n})})]})}function W({ctx:e,title:t,className:n,style:r}){let i=$();return(0,S.jsx)(R,{title:t??i.inspector.spacing,className:n,style:r,children:(0,S.jsx)(z,{label:i.inspector.padding,stacked:!0,children:(0,S.jsx)(ft,{get:t=>e.getStyle(U(`padding${t}`))??e.getStyle(U(`padding`)),set:t=>e.batchSetStyle([{prop:U(`padding`),value:``},...t.map(([e,t])=>({prop:U(`padding${e}`),value:t}))])})})})}function mt({ctx:e,className:t,style:n}){let r=$().inspector;return(0,S.jsxs)(R,{title:r.box,className:t,style:n,children:[(0,S.jsx)(z,{label:r.backgroundColor,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`backgroundColor`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`backgroundColor`),t)})}),(0,S.jsx)(z,{label:r.radius,children:(0,S.jsx)(V,{value:e.getStyle(U(`borderRadius`)),onChange:t=>e.setStyle(U(`borderRadius`),t)})}),(0,S.jsx)(z,{label:r.border,children:(0,S.jsx)(V,{value:e.getStyle(U(`borderWidth`)),onChange:t=>e.batchSetStyle([{prop:U(`borderWidth`),value:t},{prop:U(`borderStyle`),value:t?`solid`:``}])})}),(0,S.jsx)(z,{label:r.borderColor,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`borderColor`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`borderColor`),t)})})]})}function ht({ctx:e,className:t,style:n}){let r=$().inspector;return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsx)(R,{title:r.action,children:(0,S.jsx)(z,{label:r.linkUrl,stacked:!0,children:(0,S.jsx)(B,{value:String(e.getAttr(`href`)??``),onChange:t=>e.setAttr(`href`,t),placeholder:`https://`})})}),(0,S.jsxs)(R,{title:r.button,children:[(0,S.jsx)(z,{label:r.alignment,children:(0,S.jsx)(dt,{value:String(e.getAttr(`alignment`)??`left`),onChange:t=>e.setAttr(`alignment`,t)})}),(0,S.jsx)(z,{label:r.backgroundColor,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`backgroundColor`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`backgroundColor`),t)})}),(0,S.jsx)(z,{label:r.textColor,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`color`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`color`),t)})}),(0,S.jsx)(z,{label:r.textSize,children:(0,S.jsx)(V,{value:e.getStyle(U(`fontSize`)),onChange:t=>e.setStyle(U(`fontSize`),t),min:8,max:48})}),(0,S.jsx)(z,{label:r.radius,children:(0,S.jsx)(V,{value:e.getStyle(U(`borderRadius`)),onChange:t=>e.setStyle(U(`borderRadius`),t)})})]}),(0,S.jsx)(W,{ctx:e,title:r.buttonPadding})]})}function gt({ctx:e,className:t,style:n}){let{editor:r,t:i}=Q(),a=i.inspector,o={twoColumns:2,threeColumns:3,fourColumns:4}[e.nodeType]??2,s=o===2?[[`50 / 50`,[50,50]],[`33 / 67`,[33,67]],[`67 / 33`,[67,33]],[`25 / 75`,[25,75]]]:o===3?[[a.equal,[33.33,33.33,33.34]],[`25 / 50 / 25`,[25,50,25]]]:[[a.equal,[25,25,25,25]]],c=t=>{let{state:n}=r,i=n.doc.nodeAt(e.nodePos.pos);if(!i)return;let a=n.tr;i.forEach((n,r,i)=>{let o=e.nodePos.pos+1+r,s=String(n.attrs.style??``).split(`;`).filter(e=>e.trim()&&!e.trim().startsWith(`width`)).join(`;`);a.setNodeMarkup(o,void 0,{...n.attrs,style:`${s?`${s};`:``}width:${t[i]}%`})}),n.selection instanceof g.NodeSelection&&a.setSelection(g.NodeSelection.create(a.doc,e.nodePos.pos)),r.view.dispatch(a)};return(0,S.jsx)(`div`,{className:D(`bree-inspector`,t),style:n,children:(0,S.jsxs)(R,{title:a.columns,children:[(0,S.jsx)(z,{label:a.distribution,stacked:!0,children:(0,S.jsx)(`div`,{className:`bree-ratio-grid`,children:s.map(([e,t])=>(0,S.jsxs)(`button`,{type:`button`,className:`bree-ratio`,onClick:()=>c(t),children:[(0,S.jsx)(`span`,{className:`bree-ratio-bars`,children:t.map((e,t)=>(0,S.jsx)(`i`,{style:{flex:e}},t))}),e]},e))})}),(0,S.jsx)(z,{label:a.columnGap,children:(0,S.jsx)(V,{value:e.getAttr(`cellspacing`)??0,onChange:t=>e.setAttr(`cellspacing`,t===``?null:t)})}),(0,S.jsx)(`p`,{className:`bree-hint`,children:a.columnsHint})]})})}function _t({ctx:e,className:t,style:n}){let r=$();return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsx)(R,{title:r.inspector.heading,children:(0,S.jsx)(z,{label:r.inspector.level,children:(0,S.jsx)(ut,{value:String(e.getAttr(`level`)??1),onChange:t=>e.setAttr(`level`,Number(t)),options:[{value:`1`,label:`H1`},{value:`2`,label:`H2`},{value:`3`,label:`H3`}]})})}),(0,S.jsx)(pt,{ctx:e,alignment:String(e.getAttr(`alignment`)??`left`),setAlignment:t=>e.setAttr(`alignment`,t)}),(0,S.jsx)(W,{ctx:e}),(0,S.jsx)(mt,{ctx:e})]})}function vt({ctx:e,className:t,style:n}){let{t:r,uploadImage:i}=Q(),a=r.inspector,o=String(e.getAttr(`width`)??`auto`);return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsxs)(R,{title:a.image,children:[(0,S.jsx)(`div`,{className:`bree-image-preview`,children:e.getAttr(`src`)?(0,S.jsx)(`img`,{src:String(e.getAttr(`src`)),alt:``}):null}),(0,S.jsxs)(`label`,{className:`bree-button-like`,children:[a.uploadImage,(0,S.jsx)(`input`,{type:`file`,accept:`image/*`,hidden:!0,onChange:async t=>{let n=t.target.files?.[0];n&&e.setAttr(`src`,(await i(n)).url),t.target.value=``}})]}),(0,S.jsx)(z,{label:a.imageUrl,stacked:!0,children:(0,S.jsx)(B,{value:String(e.getAttr(`src`)??``),onChange:t=>e.setAttr(`src`,t)})}),(0,S.jsx)(z,{label:a.altText,stacked:!0,children:(0,S.jsx)(B,{value:String(e.getAttr(`alt`)??``),onChange:t=>e.setAttr(`alt`,t),placeholder:a.altPlaceholder})})]}),(0,S.jsxs)(R,{title:a.layout,children:[(0,S.jsx)(z,{label:a.autoWidth,children:(0,S.jsx)(`input`,{type:`checkbox`,checked:o===`auto`,onChange:t=>e.setAttr(`width`,t.target.checked?`auto`:`300`)})}),o!==`auto`&&(0,S.jsx)(z,{label:a.width,children:(0,S.jsx)(at,{value:o,min:20,max:900,onChange:t=>e.setAttr(`width`,String(t))})}),(0,S.jsx)(z,{label:a.alignment,children:(0,S.jsx)(dt,{value:String(e.getAttr(`alignment`)??`center`),onChange:t=>e.setAttr(`alignment`,t)})}),(0,S.jsx)(z,{label:a.radius,children:(0,S.jsx)(V,{value:e.getStyle(U(`borderRadius`)),onChange:t=>e.setStyle(U(`borderRadius`),t)})})]}),(0,S.jsx)(R,{title:a.action,children:(0,S.jsx)(z,{label:a.clickLink,stacked:!0,children:(0,S.jsx)(B,{value:String(e.getAttr(`href`)??``),onChange:t=>e.setAttr(`href`,t||null),placeholder:`https://`})})}),(0,S.jsx)(W,{ctx:e})]})}function yt({ctx:e,className:t,style:n}){let r=$();return(0,S.jsx)(`div`,{className:D(`bree-inspector`,t),style:n,children:(0,S.jsx)(R,{title:r.inspector.spacer,children:(0,S.jsx)(z,{label:r.inspector.height,children:(0,S.jsx)(at,{value:e.getAttr(`height`),min:4,max:160,onChange:t=>e.setAttr(`height`,t)})})})})}function bt({ctx:e,className:t,style:n}){let r=$();return(0,S.jsx)(`div`,{className:D(`bree-inspector`,t),style:n,children:(0,S.jsxs)(R,{title:r.inspector.htmlCode,children:[(0,S.jsx)(rt,{value:String(e.getAttr(`html`)??``),onChange:t=>e.setAttr(`html`,t),rows:14}),(0,S.jsx)(`p`,{className:`bree-hint`,children:r.inspector.htmlHint})]})})}function xt({ctx:e,className:t,style:n}){let r=$().inspector;return(0,S.jsx)(`div`,{className:D(`bree-inspector`,t),style:n,children:(0,S.jsxs)(R,{title:r.line,children:[(0,S.jsx)(z,{label:r.color,stacked:!0,children:(0,S.jsx)(H,{value:e.getStyle(U(`borderTopColor`)),presets:e.presetColors,onChange:t=>e.setStyle(U(`borderTopColor`),t)})}),(0,S.jsx)(z,{label:r.thickness,children:(0,S.jsx)(V,{value:e.getStyle(U(`borderTopWidth`))??1,onChange:t=>e.batchSetStyle([{prop:U(`borderTopWidth`),value:t},{prop:U(`borderTopStyle`),value:`solid`}]),min:1,max:12})}),(0,S.jsx)(z,{label:r.lineStyle,children:(0,S.jsx)(ut,{value:String(e.getStyle(U(`borderTopStyle`))??`solid`),onChange:t=>e.setStyle(U(`borderTopStyle`),t),options:[{value:`solid`,label:`———`},{value:`dashed`,label:`- - -`},{value:`dotted`,label:`· · ·`}]})})]})})}function St({ctx:e,className:t,style:n}){return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsx)(mt,{ctx:e}),(0,S.jsx)(W,{ctx:e})]})}function Ct(e){if(typeof e!=`string`||!e.trim())return{};let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]=i)}return t}var wt={style:{default:null,parseHTML:e=>e.getAttribute(`style`),renderHTML:e=>e.style?{style:e.style}:{}}},Tt=f.EmailNode.create({name:`spacer`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{...wt,height:{default:32,parseHTML:e=>Number(e.dataset.height)||32,renderHTML:e=>({"data-height":e.height})}}},parseHTML(){return[{tag:`div[data-type="spacer"]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,(0,v.mergeAttributes)(t,{"data-type":`spacer`,class:`node-spacer`,style:`height:${Number(e.attrs.height)}px`})]},renderToReactEmail({node:e}){let t=Number(e.attrs?.height??32);return(0,S.jsx)(T.Section,{style:{height:t,lineHeight:`${t}px`,fontSize:`1px`,...Ct(e.attrs?.style)},children:`\xA0`})}}),G={facebook:{label:`Facebook`,slug:`facebook`,color:`1877F2`},instagram:{label:`Instagram`,slug:`instagram`,color:`E4405F`},x:{label:`X`,slug:`x`,color:`000000`},linkedin:{label:`LinkedIn`,slug:`linkedin`,color:`0A66C2`},youtube:{label:`YouTube`,slug:`youtube`,color:`FF0000`},tiktok:{label:`TikTok`,slug:`tiktok`,color:`000000`},github:{label:`GitHub`,slug:`github`,color:`181717`}},Et={linkedin:`https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/linkedin.svg`};function Dt(e){if(Et[e])return Et[e];let t=G[e]??G.facebook;return`https://cdn.simpleicons.org/${t.slug}/${t.color}`}function Ot(e){if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]}var kt=f.EmailNode.create({name:`socialLinks`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{...wt,links:{default:[{network:`facebook`,url:`https://facebook.com/`},{network:`instagram`,url:`https://instagram.com/`},{network:`x`,url:`https://x.com/`},{network:`linkedin`,url:`https://linkedin.com/`}],parseHTML:e=>Ot(e.dataset.links),renderHTML:e=>({"data-links":JSON.stringify(e.links??[])})},size:{default:28},gap:{default:12},alignment:{default:`center`}}},parseHTML(){return[{tag:`div[data-type="social-links"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=Number(e.attrs.size),r=Number(e.attrs.gap),i=Ot(e.attrs.links);return[`div`,(0,v.mergeAttributes)(t,{"data-type":`social-links`,class:`node-socialLinks`,alignment:e.attrs.alignment}),...i.map((e,t)=>[`span`,{class:`node-socialLinks-item`,style:`margin-left:${t===0?0:r}px`},[`img`,{src:Dt(e.network),width:String(n),height:String(n),alt:G[e.network]?.label??e.network}]])]},renderToReactEmail({node:e}){let t=Number(e.attrs?.size??28),n=Number(e.attrs?.gap??12),r=Ot(e.attrs?.links),i=e.attrs?.alignment??`center`;return(0,S.jsx)(T.Section,{style:Ct(e.attrs?.style),children:(0,S.jsx)(T.Row,{children:(0,S.jsx)(T.Column,{align:i,children:r.map((e,r)=>(0,S.jsx)(T.Link,{href:e.url,style:{display:`inline-block`,marginLeft:r===0?0:n},children:(0,S.jsx)(T.Img,{src:Dt(e.network),width:t,height:t,alt:G[e.network]?.label??e.network})},`${e.network}-${r}`))})})})}}),At=f.EmailNode.create({name:`htmlBlock`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{html:{default:`<p style="margin:0;text-align:center;font-family:sans-serif">Your custom <strong>HTML</strong></p>`,parseHTML:e=>e.dataset.html??e.innerHTML,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="html-block"]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,(0,v.mergeAttributes)(t,{"data-type":`html-block`,class:`node-htmlBlock`,"data-html":e.attrs.html})]},addNodeView(){return({node:e})=>{let t=document.createElement(`div`);return t.className=`node-htmlBlock`,t.dataset.type=`html-block`,t.innerHTML=e.attrs.html,{dom:t,update(n){return n.type===e.type&&(t.innerHTML=n.attrs.html,!0)},ignoreMutation:()=>!0}}},renderToReactEmail({node:e}){return(0,S.jsx)(`div`,{dangerouslySetInnerHTML:{__html:e.attrs?.html??``}})}});function jt({ctx:e,className:t,style:n}){let r=$().inspector,i=e.getAttr(`links`),a=Array.isArray(i)?i:[],o=t=>e.setAttr(`links`,t);return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsxs)(R,{title:r.networks,children:[(0,S.jsx)(`div`,{className:`bree-social-list`,children:a.map((e,t)=>(0,S.jsxs)(`div`,{className:`bree-social-row`,children:[(0,S.jsx)(ct,{value:e.network,onChange:e=>o(a.map((n,r)=>r===t?{...n,network:e}:n)),options:Object.entries(G).map(([e,t])=>[e,t.label])}),(0,S.jsx)(B,{value:e.url,onChange:e=>o(a.map((n,r)=>r===t?{...n,url:e}:n))}),(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.removeNetwork,onClick:()=>o(a.filter((e,n)=>n!==t)),children:(0,S.jsx)(x.XIcon,{size:14})})]},t))}),(0,S.jsx)(`button`,{type:`button`,className:`bree-button-like`,onClick:()=>o([...a,{network:`youtube`,url:`https://youtube.com/`}]),children:r.addNetwork})]}),(0,S.jsxs)(R,{title:r.appearance,children:[(0,S.jsx)(z,{label:r.iconSize,children:(0,S.jsx)(at,{value:e.getAttr(`size`),min:16,max:64,onChange:t=>e.setAttr(`size`,t)})}),(0,S.jsx)(z,{label:r.gap,children:(0,S.jsx)(at,{value:e.getAttr(`gap`),min:0,max:40,onChange:t=>e.setAttr(`gap`,t)})}),(0,S.jsx)(z,{label:r.alignment,children:(0,S.jsx)(dt,{value:String(e.getAttr(`alignment`)??`center`),onChange:t=>e.setAttr(`alignment`,t)})})]}),(0,S.jsx)(W,{ctx:e})]})}function Mt(e,t=36){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t)}…`:n}var Nt=(e,{t})=>Mt(e.textContent)||t.layers.empty,Pt=()=>``,Ft=[{type:`paragraph`,icon:x.TypeIcon},{type:`heading`,icon:x.Heading1Icon,inspector:_t},{type:`image`,icon:x.ImageIcon,inspector:vt,preview:(e,{t})=>{let{attrs:n}=e;if(n.alt)return Mt(n.alt);let r=String(n.src??``);if(r.startsWith(`data:`))return t.layers.uploadedImage;try{let e=new URL(r);return Mt(e.searchParams.get(`text`)??decodeURIComponent(e.pathname.split(`/`).pop()??``))}catch{return``}}},{type:`button`,icon:x.MousePointerClickIcon,inspector:ht},{type:`horizontalRule`,icon:x.MinusIcon,inspector:xt,preview:Pt},{type:`spacer`,icon:Qe,inspector:yt,preview:e=>`${e.attrs.height}px`,extensions:[Tt]},{type:`socialLinks`,icon:x.LinkIcon,inspector:jt,preview:e=>Array.isArray(e.attrs.links)?e.attrs.links.map(e=>e.network).join(`, `):``,extensions:[kt]},{type:`htmlBlock`,icon:x.SquareCodeIcon,inspector:bt,preview:e=>Mt(String(e.attrs.html??``).replace(/<[^>]+>/g,` `)),extensions:[At]},{type:`section`,icon:x.LayoutIcon,inspector:St,preview:Pt},{type:`columnsColumn`,icon:x.PanelLeftIcon,inspector:St,preview:Pt},{type:`twoColumns`,icon:x.Columns2Icon,inspector:gt,preview:Pt},{type:`threeColumns`,icon:x.Columns3Icon,inspector:gt,preview:Pt},{type:`fourColumns`,icon:x.Columns4Icon,inspector:gt,preview:Pt},{type:`bulletList`,icon:x.ListIcon},{type:`orderedList`,icon:x.ListOrderedIcon},{type:`blockquote`,icon:x.TextQuoteIcon},{type:`codeBlock`,icon:x.CodeIcon},{type:`table`,icon:x.TableIcon}],It=o({button:()=>Lt,column:()=>zt,columns:()=>Y,doc:()=>Wt,heading:()=>J,image:()=>Rt,link:()=>X,padding:()=>Ht,paragraph:()=>q,placeholderImage:()=>Ut,section:()=>Vt,sized:()=>Bt,text:()=>K}),K=(e,t)=>({type:`text`,text:e,...t?{marks:t}:{}}),q=(e=``,t={})=>({type:`paragraph`,attrs:t,content:typeof e==`string`?e?[K(e)]:[]:e}),J=(e,t,n={})=>({type:`heading`,attrs:{level:e,...n},content:[K(t)]}),Lt=(e,t={})=>({type:`button`,attrs:{href:`https://example.com`,alignment:`center`,...t},content:[K(e)]}),Rt=(e,t={})=>({type:`image`,attrs:{src:e,alt:``,alignment:`center`,...t}}),zt=(...e)=>({type:`columnsColumn`,content:e.length?e:[q()]}),Bt=(e,t)=>({...e,attrs:{...e.attrs,style:`width:${t}%`}}),Y=(e,t,n)=>({type:{2:`twoColumns`,3:`threeColumns`,4:`fourColumns`}[e],...n?{attrs:n}:{},content:t??Array.from({length:e},()=>zt())}),Vt=(e,...t)=>({type:`section`,attrs:{style:e},content:t}),Ht=(e,t=e)=>`padding-top:${e}px;padding-right:${t}px;padding-bottom:${e}px;padding-left:${t}px`,X=e=>[{type:`link`,attrs:{href:e}}],Ut=(e,t,n=`Image`)=>`https://placehold.co/${e}x${t}/e2e8f0/64748b/png?text=${encodeURIComponent(n)}`,Wt=(...e)=>({type:`doc`,content:e}),Gt=({t:e},t=`center`)=>q([K(e.content.menuHome,X(`https://example.com`)),K(` · `),K(e.content.menuShop,X(`https://example.com/shop`)),K(` · `),K(e.content.menuBlog,X(`https://example.com/blog`)),K(` · `),K(e.content.menuContact,X(`https://example.com/contact`))],{alignment:t}),Kt=[{id:`layout`,title:({t:e})=>e.sidebar.layoutTitle},{id:`content`,title:({t:e})=>e.sidebar.contentTitle}],qt=[{id:`section`,group:`layout`,label:({t:e})=>e.palette.oneColumn,icon:(0,S.jsx)(tt,{}),content:()=>[Vt(Ht(16),q())]},{id:`columns-2`,group:`layout`,label:({t:e})=>e.palette.twoColumns,icon:(0,S.jsx)(x.Columns2Icon,{size:22}),content:()=>[Y(2)]},{id:`columns-3`,group:`layout`,label:({t:e})=>e.palette.threeColumns,icon:(0,S.jsx)(x.Columns3Icon,{size:22}),content:()=>[Y(3)]},{id:`columns-4`,group:`layout`,label:({t:e})=>e.palette.fourColumns,icon:(0,S.jsx)(x.Columns4Icon,{size:22}),content:()=>[Y(4)]},{id:`heading`,group:`content`,label:({t:e})=>e.palette.heading,icon:(0,S.jsx)(x.Heading1Icon,{size:22}),content:({t:e})=>[J(2,e.content.heading)]},{id:`text`,group:`content`,label:({t:e})=>e.palette.text,icon:(0,S.jsx)(x.TypeIcon,{size:22}),content:({t:e})=>[q(e.content.text)]},{id:`button`,group:`content`,label:({t:e})=>e.palette.button,icon:(0,S.jsx)(x.MousePointerClickIcon,{size:22}),content:({t:e})=>[Lt(e.content.button)]},{id:`image`,group:`content`,label:({t:e})=>e.palette.image,icon:(0,S.jsx)(x.ImageIcon,{size:22}),content:({t:e})=>[Rt(Ut(600,300,e.content.image))]},{id:`divider`,group:`content`,label:({t:e})=>e.palette.divider,icon:(0,S.jsx)(x.MinusIcon,{size:22}),content:()=>[{type:`horizontalRule`}]},{id:`spacer`,group:`content`,label:({t:e})=>e.palette.spacer,icon:(0,S.jsx)($e,{}),content:()=>[{type:`spacer`,attrs:{height:32}}]},{id:`social`,group:`content`,label:({t:e})=>e.palette.social,icon:(0,S.jsx)(et,{}),content:()=>[{type:`socialLinks`}]},{id:`menu`,group:`content`,label:({t:e})=>e.palette.menu,icon:(0,S.jsx)(x.PanelTopIcon,{size:22}),content:e=>[Gt(e)]},{id:`list`,group:`content`,label:({t:e})=>e.palette.list,icon:(0,S.jsx)(x.ListIcon,{size:22}),content:({t:e})=>[{type:`bulletList`,content:e.content.listItems.map(e=>({type:`listItem`,content:[q(e)]}))}]},{id:`quote`,group:`content`,label:({t:e})=>e.palette.quote,icon:(0,S.jsx)(x.TextQuoteIcon,{size:22}),content:({t:e})=>[{type:`blockquote`,content:[q(e.content.quote)]}]},{id:`html`,group:`content`,label:({t:e})=>e.palette.html,icon:(0,S.jsx)(x.SquareCodeIcon,{size:22}),content:({t:e})=>[{type:`htmlBlock`,attrs:{html:e.content.html}}]},{id:`card`,group:`content`,label:({t:e})=>e.palette.card,icon:(0,S.jsx)(x.LayoutIcon,{size:22}),content:({t:e})=>[Vt(`${Ht(24)};background-color:#f1f5f9;border-radius:12px`,J(3,e.content.cardTitle),q(e.content.cardText))]}];function Z({variant:e}){return(0,S.jsxs)(`span`,{className:`bree-block-thumb bree-thumb-${e}`,"aria-hidden":!0,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]})}var Jt=[{id:`header`,label:({t:e})=>e.templates.header,description:({t:e})=>e.templates.headerDescription,thumbnail:(0,S.jsx)(Z,{variant:`header`}),content:e=>[Y(2,[Bt(zt(Rt(Ut(140,40,e.t.content.logo),{alignment:`left`,width:`140`})),33),Bt(zt(Gt(e,`right`)),67)])]},{id:`hero`,label:({t:e})=>e.templates.hero,description:({t:e})=>e.templates.heroDescription,thumbnail:(0,S.jsx)(Z,{variant:`hero`}),content:({t:e})=>[Vt(`${Ht(40,24)};background-color:#eef2ff;border-radius:12px`,J(1,e.content.heroTitle,{alignment:`center`}),q(e.content.heroText,{alignment:`center`}),Lt(e.content.heroButton,{style:`background-color:#4f46e5;color:#ffffff;${Ht(12,24)};border-radius:8px`}))]},{id:`products`,label:({t:e})=>e.templates.products,description:({t:e})=>e.templates.productsDescription,thumbnail:(0,S.jsx)(Z,{variant:`products`}),content:({t:e})=>[Y(2,[e.content.productA,e.content.productB].map(t=>zt(Rt(Ut(280,200,t)),J(3,t,{alignment:`center`}),q(e.content.productText,{alignment:`center`}),Lt(e.content.productButton))),{cellspacing:16})]},{id:`features`,label:({t:e})=>e.templates.features,description:({t:e})=>e.templates.featuresDescription,thumbnail:(0,S.jsx)(Z,{variant:`features`}),content:({t:e})=>[Y(3,e.content.features.map(t=>zt(J(3,t,{alignment:`center`}),q(e.content.featureText,{alignment:`center`}))))]},{id:`testimonial`,label:({t:e})=>e.templates.testimonial,description:({t:e})=>e.templates.testimonialDescription,thumbnail:(0,S.jsx)(Z,{variant:`testimonial`}),content:({t:e})=>[Vt(`${Ht(24)};background-color:#f8fafc;border-radius:12px`,{type:`blockquote`,content:[q(e.content.testimonialQuote)]},q(e.content.testimonialAuthor,{alignment:`right`,style:`color:#64748b`}))]},{id:`footer`,label:({t:e})=>e.templates.footer,description:({t:e})=>e.templates.footerDescription,thumbnail:(0,S.jsx)(Z,{variant:`footer`}),content:({t:e})=>[{type:`horizontalRule`},{type:`socialLinks`},q(e.content.footerAddress,{alignment:`center`,style:`color:#94a3b8;font-size:12px`}),q([K(e.content.unsubscribe,X(`https://example.com/unsubscribe`))],{alignment:`center`,style:`font-size:12px`})]}],Yt=(e,t)=>Jt.find(t=>t.id===e)?.content(t)??[];function Xt(e){let t={type:`spacer`,attrs:{height:16}};return{type:`doc`,content:[...Yt(`header`,e),t,...Yt(`hero`,e),t,J(2,e.t.content.starterTitle,{alignment:`center`}),...Yt(`products`,e),t,...Yt(`footer`,e)]}}var Zt=(0,l.createContext)(null);function Q(){let e=(0,l.useContext)(Zt);if(!e)throw Error(`useEmailEditor must be used inside <EditorRoot> or <BetterEmailEditor>.`);return e}function Qt(){return(0,l.useContext)(Zt)}function $(){return(0,l.useContext)(Zt)?.t??Pe}function $t(){let{locale:e,t}=Q();return(0,l.useMemo)(()=>({locale:e,t}),[e,t])}var en=(0,m.extendTheme)(`basic`,{body:{backgroundColor:`#eef1f5`,padding:`32px 16px`},container:{backgroundColor:`#ffffff`,padding:`24px`,borderRadius:`12px`}}),tn=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t({url:String(r.result)}),r.onerror=n,r.readAsDataURL(e)}),nn={type:`doc`,content:[{type:`paragraph`}]};function rn(e){return typeof e==`object`&&!!e&&`doc`in e}function an(e){let t={subject:``,previewText:``};return e?rn(e)?{doc:e.doc,settings:{...t,...e.settings,previewText:e.settings?.previewText??``}}:{doc:e,settings:t}:{doc:nn,settings:t}}function on(e,t,n){let[r,i]=(0,l.useState)(t);return[e===void 0?r:e,(0,l.useCallback)(t=>{e===void 0&&i(t),n?.(t)},[e,n])]}var sn=(0,l.forwardRef)(function({defaultValue:e,onChange:t,onReady:n,locale:r=`en`,messages:i,nodes:a=Ft,palette:o=qt,paletteGroups:s=Kt,templates:c=Jt,fonts:h=De,starterDocument:g=Xt,extensions:_,theme:v=en,uploadImage:y=tn,editable:b=!0,device:x,defaultDevice:C=`desktop`,onDeviceChange:w,layersOpen:T,defaultLayersOpen:E=!0,onLayersOpenChange:O,className:k,style:ee,children:te},ne){let A=(0,l.useMemo)(()=>Be(r,i),[r,i]),[re]=(0,l.useState)(()=>an(e)),[ie,ae]=(0,l.useState)(re.settings),j=(0,l.useRef)(ie),oe=(0,l.useRef)(A),se=(0,l.useRef)(t),ce=(0,l.useRef)(n),le=(0,l.useRef)(y),M=(0,l.useRef)(h);(0,l.useLayoutEffect)(()=>{oe.current=A,se.current=t,ce.current=n,le.current=y,M.current=h});let[ue,de]=on(x,C,w),[N,P]=on(T,E,O),[fe]=(0,l.useState)(()=>({dragSession:Me(),hoverStore:Ne()})),pe=(0,l.useCallback)(e=>le.current(e),[]),ge=(0,m.useEditorImage)({uploadImage:pe}),[_e]=(0,l.useState)(()=>[p.StarterKit.configure({TiptapStarterKit:{dropcursor:!1},Button:!1}),he,Te,Ee,u.Placeholder.configure({placeholder:({node:e})=>e.type.name===`heading`?oe.current.placeholder.heading:oe.current.placeholder.paragraph,includeChildren:!0}),m.EmailTheming.configure({theme:v}),...a.flatMap(e=>e.extensions??[]),..._??[],ge]),F=(0,d.useEditor)({extensions:_e,content:re.doc,editable:b,immediatelyRender:!1,editorProps:{handlePaste:Ce(_e)}},[]);(0,l.useEffect)(()=>{F?.setEditable(b)},[F,b]);let ve=(0,l.useCallback)(()=>({doc:F?.getJSON()??nn,settings:j.current}),[F]),ye=(0,l.useCallback)(e=>{let t={...j.current,...e};j.current=t,ae(t),F&&se.current?.({doc:F.getJSON(),settings:t})},[F]),I=(0,l.useMemo)(()=>{let e=async()=>{if(!F)return{html:``,text:``,unformattedHtml:``};let e=await(0,f.composeReactEmail)({editor:F,preview:j.current.previewText||void 0});return{...e,html:je(e.html,M.current),unformattedHtml:je(e.unformattedHtml,M.current)}};return{editor:F,getValue:ve,getJSON:()=>F?.getJSON()??nn,setValue:e=>{let t=an(e);j.current=t.settings,ae(t.settings),F?.commands.setContent(t.doc,{emitUpdate:!0})},exportEmail:e,getHtml:async()=>(await e()).html,getText:async()=>(await e()).text,insertBlocks:e=>{F&&me(F,e)}}},[F,ve]);(0,l.useImperativeHandle)(ne,()=>I,[I]),(0,l.useEffect)(()=>{if(!F)return;ce.current?.(I);let e=()=>se.current?.(ve());return F.on(`update`,e),()=>{F.off(`update`,e)}},[F,I,ve]),(0,l.useEffect)(()=>{for(let{href:e}of h){if(!e||document.querySelector(`link[data-bree-font="${CSS.escape(e)}"]`))continue;let t=document.createElement(`link`);t.rel=`stylesheet`,t.href=e,t.dataset.breeFont=e,document.head.appendChild(t)}},[h]);let be=(0,l.useMemo)(()=>new Map(a.map(e=>[e.type,e])),[a]),xe=(0,l.useMemo)(()=>{if(!F)return null;let e={locale:r,t:A};return{...e,editor:F,handle:I,nodes:be,nodeLabel:t=>{let n=be.get(t)?.label;return n?Le(n,e):A.nodes[t]??t},palette:o,paletteGroups:s,templates:c,fonts:h,starterDocument:g,uploadImage:pe,...fe,device:ue,setDevice:de,layersOpen:N,setLayersOpen:P,settings:ie,updateSettings:ye}},[F,r,A,I,be,o,s,c,h,g,pe,fe,ue,de,N,P,ie,ye]),Se=(0,l.useMemo)(()=>({editor:F}),[F]),we={"--bree-empty-zone-label":JSON.stringify(A.canvas.emptyZone),...ee};return(0,S.jsx)(`div`,{className:D(`bree bree-root`,k),style:we,lang:r,children:xe&&(0,S.jsx)(d.EditorContext.Provider,{value:Se,children:(0,S.jsx)(Zt.Provider,{value:xe,children:te})})})});function cn(e,t){let n=e.getBoundingClientRect();return{top:t.top-n.top+e.scrollTop,left:t.left-n.left+e.scrollLeft,width:t.width,height:t.height??0}}function ln(e,t,n){if(!n)return null;let r=e.view.nodeDOM(n.pos);return r instanceof HTMLElement?cn(t,r.getBoundingClientRect()):null}function un(e,t,n){let r=e.view.posAtCoords({left:t,top:n});return r&&r.inside>=0?M(e.state.doc,r.inside):null}function dn(e){let t=e.node.type.name;return O.has(t)||k.has(t)}function fn({editor:e,host:t}){let{dragSession:n,hoverStore:r,nodeLabel:i,t:a}=Q(),o=(0,l.useRef)(i);(0,l.useLayoutEffect)(()=>{o.current=i});let s=(0,l.useSyncExternalStore)(r.subscribe,r.get),c=s===null?null:e.state.doc.nodeAt(s),u=s!==null&&c?{pos:s,node:c}:null,[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[,_]=(0,l.useState)(0),v=(0,l.useCallback)(()=>_(e=>e+1),[]),y=(0,d.useEditorState)({editor:e,selector:({editor:e})=>{if(!e?.isFocused)return null;let t=N(e);return t?`${t.pos}:${t.node.type.name}:${e.state.doc.content.size}`:null}})?N(e):null;(0,l.useEffect)(()=>{let n=()=>v(),i=()=>{r.set(null),v()};e.on(`update`,i);let a=new ResizeObserver(n);return a.observe(e.view.dom),t.addEventListener(`load`,n,!0),window.addEventListener(`resize`,n),()=>{e.off(`update`,i),a.disconnect(),t.removeEventListener(`load`,n,!0),window.removeEventListener(`resize`,n)}},[e,t,v,r]),(0,l.useEffect)(()=>{let i=0,a=t=>{n.get()||t.target.closest(`.bree-ov-toolbar, .bree-ov-handle, .bree-ov-tag`)||(cancelAnimationFrame(i),i=requestAnimationFrame(()=>{r.set(un(e,t.clientX,t.clientY)?.pos??null)}))},o=()=>r.set(null);return t.addEventListener(`mousemove`,a),t.addEventListener(`mouseleave`,o),()=>{cancelAnimationFrame(i),t.removeEventListener(`mousemove`,a),t.removeEventListener(`mouseleave`,o)}},[e,t,n,r]),(0,l.useEffect)(()=>{let n=n=>{if(n.button!==0||n.shiftKey||n.metaKey||n.ctrlKey||n.target.closest(`.bree-ov-layer, .bree-canvas-header`))return;if([t,e.view.dom,e.view.dom.parentElement].includes(n.target)){n.preventDefault();let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur();return}let r=un(e,n.clientX,n.clientY);if(r&&dn(r)){n.preventDefault(),P(e,r);return}!e.isFocused&&e.state.selection instanceof g.NodeSelection&&e.view.focus()},r=t=>{e.view.dom.contains(t.target)&&ge(e,t)};return t.addEventListener(`mousedown`,n,!0),t.addEventListener(`paste`,r,!0),()=>{t.removeEventListener(`mousedown`,n,!0),t.removeEventListener(`paste`,r,!0)}},[e,t]),(0,l.useEffect)(()=>{let i=0,a=null,s=null,c=t=>{let r=n.get();if(!r||(a!==r&&(a=r,s=ae(e.view,r)),!s))return null;let i=r.kind===`move`?{from:r.pos,to:r.pos+(e.state.doc.nodeAt(r.pos)?.nodeSize??0)}:void 0;return ie(e.view,t.clientX,t.clientY,s,i)},l=e=>{let t=n.get();t&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=t.kind===`move`?`move`:`copy`),cancelAnimationFrame(i),i=requestAnimationFrame(()=>p(c(e))))},u=t=>{let a=n.get();if(!a)return;t.preventDefault(),t.stopPropagation(),cancelAnimationFrame(i);let o=c(t);o&&ce(e,a,o),e.view.dragging=null,n.end(),p(null),h(null),r.set(null)},d=e=>{n.get()&&(t.contains(e.relatedTarget)||(cancelAnimationFrame(i),p(null)))},f=()=>{cancelAnimationFrame(i),n.end(),p(null),h(null),r.set(null)},m=t=>{let r=t.target;if(n.get()||r.tagName!==`IMG`||!e.view.dom.contains(r))return;let i=e.view.posAtDOM(r,0),a=M(e.state.doc,i);a&&!ue(a)&&(n.start({kind:`move`,pos:a.pos,label:o.current(a.node.type.name)}),requestAnimationFrame(()=>h(a.pos)))},g=t=>{if(t.key!==`Escape`||!e.isFocused)return;let n=N(e),r=n?de(e.state.doc,n):null;if(t.preventDefault(),r)P(e,r);else{let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur()}};return t.addEventListener(`dragstart`,m,!0),t.addEventListener(`keydown`,g,!0),t.addEventListener(`dragover`,l,!0),t.addEventListener(`drop`,u,!0),t.addEventListener(`dragleave`,d,!0),document.addEventListener(`dragend`,f),()=>{cancelAnimationFrame(i),t.removeEventListener(`dragstart`,m,!0),t.removeEventListener(`keydown`,g,!0),t.removeEventListener(`dragover`,l,!0),t.removeEventListener(`drop`,u,!0),t.removeEventListener(`dragleave`,d,!0),document.removeEventListener(`dragend`,f)}},[e,t,n,r]);let b=(t,r)=>{let a=e.view.nodeDOM(r.pos);if(n.start({kind:`move`,pos:r.pos,label:i(r.node.type.name)}),t.dataTransfer.setData(ee,`move`),t.dataTransfer.effectAllowed=`move`,a instanceof HTMLElement){let e=a.getBoundingClientRect();t.dataTransfer.setDragImage(a,Math.min(24,e.width/2),Math.min(24,e.height/2))}requestAnimationFrame(()=>h(r.pos))},C=m!==null,w=u&&u.pos!==y?.pos?ln(e,t,u):null,T=ln(e,t,y),E=C?ln(e,t,M(e.state.doc,m)):null,O=y?de(e.state.doc,y):null;return(0,S.jsxs)(`div`,{className:`bree-ov-layer`,children:[w&&u&&(0,S.jsx)(`div`,{className:D(`bree-ov-frame bree-ov-hover`,C&&`bree-ov-ghost`),style:w,children:(0,S.jsx)(`button`,{type:`button`,className:`bree-ov-tag`,onMouseDown:t=>{t.preventDefault(),P(e,u)},children:i(u.node.type.name)})}),T&&y&&(0,S.jsxs)(`div`,{className:D(`bree-ov-frame bree-ov-selected`,C&&`bree-ov-ghost`),style:T,children:[(0,S.jsx)(`span`,{className:`bree-ov-tag bree-ov-tag-selected`,children:i(y.node.type.name)}),!ue(y)&&(0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsx)(`span`,{className:`bree-ov-handle`,role:`button`,tabIndex:-1,draggable:!0,title:a.canvas.move,"aria-label":a.canvas.moveLabel(i(y.node.type.name)),onDragStart:e=>b(e,y),children:(0,S.jsx)(He,{})})}),(0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsxs)(`div`,{className:`bree-ov-toolbar`,onMouseDown:e=>e.preventDefault(),children:[O&&(0,S.jsx)(`button`,{type:`button`,className:`bree-ov-tool`,title:a.canvas.selectParent(i(O.node.type.name)),onClick:()=>P(e,O),children:(0,S.jsx)(Ge,{})}),!ue(y)&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:`bree-ov-tool`,title:a.canvas.duplicate,onClick:()=>fe(e,y),children:(0,S.jsx)(Ue,{})}),(0,S.jsx)(`button`,{type:`button`,className:`bree-ov-tool bree-ov-danger`,title:a.canvas.delete,onClick:()=>pe(e,y),children:(0,S.jsx)(We,{})})]})]})})]}),E&&(0,S.jsx)(`div`,{className:`bree-ov-frame bree-ov-source`,style:E}),f&&(0,S.jsx)(pn,{host:t,target:f,label:n.get()?.label??``,messages:a})]})}function pn({host:e,target:t,label:n,messages:r}){if(t.emptyZone){let i=cn(e,t.emptyZone);return(0,S.jsx)(`div`,{className:`bree-ov-dropzone`,style:i,children:(0,S.jsxs)(`span`,{children:[(0,S.jsx)(x.PlusIcon,{size:14}),` `,r.canvas.dropLabel(n)]})})}if(!t.line)return null;let i=cn(e,{...t.line,height:0});return(0,S.jsx)(`div`,{className:`bree-ov-dropline`,style:{top:i.top,left:i.left,width:i.width},children:(0,S.jsx)(`span`,{className:`bree-ov-dropline-label`,children:r.canvas.dropHere})})}function mn({className:e,style:t}){let{settings:n,updateSettings:r,t:i}=Q(),a=i.emailHeader,o=(0,l.useId)();return(0,S.jsxs)(`div`,{className:D(`bree-email-header`,e),style:t,children:[(0,S.jsxs)(`div`,{className:`bree-email-header-row`,children:[(0,S.jsx)(`label`,{htmlFor:`${o}-subject`,children:a.subject}),(0,S.jsx)(`input`,{id:`${o}-subject`,className:`bree-email-header-subject`,value:n.subject??``,placeholder:a.subjectPlaceholder,onChange:e=>r({subject:e.target.value})})]}),(0,S.jsxs)(`div`,{className:`bree-email-header-row`,children:[(0,S.jsx)(`label`,{htmlFor:`${o}-preview`,children:a.previewText}),(0,S.jsx)(`input`,{id:`${o}-preview`,value:n.previewText,placeholder:a.previewTextPlaceholder,onChange:e=>r({previewText:e.target.value})})]})]})}function hn(e,t,n){let[r,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!t||!n)return;let r=0,a=null,o=()=>{t.style.setProperty(`--bree-email-header-height`,`${n.offsetHeight}px`);let r=e.view.dom.querySelector(`:scope > .node-container`);if(r!==a&&(a&&c.unobserve(a),r&&c.observe(r),a=r),!(r instanceof HTMLElement)){i(null);return}let o=t.getBoundingClientRect(),s=r.getBoundingClientRect(),l={top:s.top-o.top+t.scrollTop-n.offsetHeight,left:s.left-o.left+t.scrollLeft,width:s.width,radius:getComputedStyle(r).borderBottomLeftRadius};i(e=>e&&e.top===l.top&&e.left===l.left&&e.width===l.width&&e.radius===l.radius?e:l)},s=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(o)},c=new ResizeObserver(s);return c.observe(t),c.observe(n),o(),e.on(`update`,s),()=>{cancelAnimationFrame(r),c.disconnect(),e.off(`update`,s),t.style.removeProperty(`--bree-email-header-height`)}},[e,t,n]),n?r:null}function gn({overlay:e=!0,bubbleMenu:t=!0,slashCommands:n=!0,header:r=!1,className:i,style:a,children:o}){let{editor:s,device:c,t:u}=Q(),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),g=hn(s,f,r?m:null),_=(0,l.useMemo)(()=>Array.isArray(n)?n:x.defaultSlashCommands.map(e=>({...e,...u.slashCommands[e.title]})),[n,u]);return(0,S.jsxs)(`div`,{ref:p,className:D(`bree-canvas`,i),style:a,"data-device":c,"data-email-header":r||void 0,children:[r&&(0,S.jsx)(`div`,{ref:h,className:`bree-canvas-header`,"data-placed":g?``:void 0,style:g?{position:`absolute`,top:g.top,left:g.left,width:g.width,"--bree-email-header-radius":g.radius}:void 0,children:(0,S.jsx)(mn,{})}),(0,S.jsx)(d.EditorContent,{editor:s,className:`bree-canvas-content`}),t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.BubbleMenu,{hideWhenActiveNodes:[`button`,`horizontalRule`],hideWhenActiveMarks:[`link`]}),(0,S.jsx)(x.BubbleMenu.LinkDefault,{}),(0,S.jsx)(x.BubbleMenu.ButtonDefault,{}),(0,S.jsx)(x.BubbleMenu.ImageDefault,{})]}),n!==!1&&(0,S.jsx)(x.SlashCommand,{items:_}),e&&f&&(0,S.jsx)(fn,{editor:s,host:f}),o]})}function _n(e,t){let n=e.child(t);return t===e.childCount-1&&e.childCount>1&&A(n)&&e.child(t-1).type.name!==`paragraph`}function vn(e,t,n,r){let i=[];return e.forEach((a,o,s)=>{if(_n(e,s))return;let c=t+1+o,l=a.type.name,u=`${r}${s}`,d=O.has(l),f=d&&a.childCount===1&&A(a.firstChild),p=d||k.has(l);i.push({key:u,pos:c,node:a,depth:n,index:s+1,children:p&&!f?vn(a,c,n+1,`${u}.`):[],accepts:d,fixed:l===`columnsColumn`,empty:f})}),i}function yn(e){let t=re(e);return t?vn(t.node,t.pos,0,``):[]}function bn(e,t){return e.fixed?`inside`:e.accepts?t<.25?`before`:t>.75?`after`:`inside`:t<.5?`before`:`after`}function xn(e,t,n,r,i){let a,o;if(n===`inside`){if(!t.accepts)return null;t.empty?(a=t.pos+1,o=a+t.node.firstChild.nodeSize):a=t.pos+t.node.nodeSize-1}else{if(t.fixed)return null;a=n===`before`?t.pos:t.pos+t.node.nodeSize}if(i&&a>=i.from&&a<=i.to)return null;let s=e.resolve(a),c=s.index();return s.parent.canReplace(c,o===void 0?c:c+1,r)?{pos:a,replaceTo:o}:null}function Sn({onClose:e,title:t,expandCollapseButtons:n=!0,className:r,style:i}){let{editor:a,t:o,locale:s,nodes:c,nodeLabel:u,dragSession:f,hoverStore:p}=Q(),m=e=>e.node.type.name===`columnsColumn`?o.layers.column(e.index):u(e.node.type.name),h=e=>(c.get(e.node.type.name)?.preview??Nt)(e.node,{locale:s,t:o}),g=(0,d.useEditorState)({editor:a,selector:({editor:e})=>e?.state.doc??null,equalityFn:(e,t)=>e===t}),_=(0,d.useEditorState)({editor:a,selector:({editor:e})=>e?.isFocused?N(e)?.pos??null:null}),v=(0,l.useSyncExternalStore)(p.subscribe,p.get),y=(0,l.useMemo)(()=>g?yn(g):[],[g]),[b,C]=(0,l.useState)(()=>new Set),[w,T]=(0,l.useState)(null),E=(0,l.useRef)(null);(0,l.useEffect)(()=>{_!==null&&E.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})},[_]);let O=e=>C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),k=e=>{P(a,{pos:e.pos,node:e.node});let t=a.view.nodeDOM(e.pos);t instanceof HTMLElement&&t.scrollIntoView({block:`nearest`,behavior:`smooth`})},te=(e,t)=>{let n=f.get();if(!n)return null;let r=ae(a.view,n);if(!r)return null;let i=e.currentTarget.getBoundingClientRect(),o=bn(t,(e.clientY-i.top)/i.height),s=n.kind===`move`?a.state.doc.nodeAt(n.pos):null,c=n.kind===`move`&&s?{from:n.pos,to:n.pos+s.nodeSize}:void 0,l=xn(a.state.doc,t,o,r,c);return l?{zone:o,target:l,payload:n}:null},ne=()=>{f.end(),T(null)},A=e=>e.map(e=>{let t=c.get(e.node.type.name)?.icon??x.LayoutIcon,n=e.children.length>0,r=b.has(e.key),i=h(e),s=w?.key===e.key?w.zone:null;return(0,S.jsxs)(`div`,{role:`none`,children:[(0,S.jsxs)(`div`,{role:`treeitem`,tabIndex:_===e.pos||_===null&&e.key===`0`?0:-1,"aria-level":e.depth+1,"aria-selected":_===e.pos,"aria-expanded":n?!r:void 0,className:D(`bree-layer`,_===e.pos&&`bree-selected`,v===e.pos&&`bree-hovered`,s&&`bree-drop-${s}`,e.fixed&&`bree-fixed`),style:{paddingLeft:6+e.depth*16},draggable:!e.fixed,title:e.fixed?o.layers.fixedHint:o.layers.itemHint,onClick:()=>k(e),onKeyDown:t=>{if(t.key===`Enter`||t.key===` `)t.preventDefault(),k(e);else if(t.key===`ArrowLeft`&&n&&!r||t.key===`ArrowRight`&&r)O(e.key);else if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault();let e=[...E.current?.querySelectorAll(`[role="treeitem"]`)??[]];e[e.indexOf(t.currentTarget)+(t.key===`ArrowDown`?1:-1)]?.focus()}},onMouseEnter:()=>p.set(e.pos),onMouseLeave:()=>p.set(null),onDragStart:t=>{t.stopPropagation(),f.start({kind:`move`,pos:e.pos,label:m(e)}),t.dataTransfer.setData(ee,`move`),t.dataTransfer.effectAllowed=`move`},onDragEnd:ne,onDragOver:t=>{let n=te(t,e);if(!n){w?.key===e.key&&T(null);return}t.preventDefault(),t.dataTransfer.dropEffect=n.payload.kind===`move`?`move`:`copy`,(w?.key!==e.key||w.zone!==n.zone)&&T({key:e.key,zone:n.zone})},onDrop:t=>{let n=te(t,e);t.preventDefault(),n&&ce(a,n.payload,n.target),ne()},children:[n?(0,S.jsx)(`button`,{type:`button`,className:D(`bree-layer-caret`,!r&&`bree-open`),"aria-label":r?o.layers.expand:o.layers.collapse,tabIndex:-1,onClick:t=>{t.stopPropagation(),O(e.key)},children:`›`}):(0,S.jsx)(`span`,{className:`bree-layer-caret-spacer`}),(0,S.jsx)(`span`,{className:`bree-layer-icon`,children:(0,S.jsx)(t,{size:14})}),(0,S.jsx)(`span`,{className:`bree-layer-label`,children:m(e)}),i&&(0,S.jsx)(`span`,{className:`bree-layer-preview`,children:i})]}),e.empty&&(0,S.jsx)(`div`,{className:`bree-layer-empty`,style:{paddingLeft:6+(e.depth+1)*16+18},children:o.layers.emptyZone}),n&&!r&&(0,S.jsx)(`div`,{role:`group`,children:A(e.children)})]},e.key)});return(0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsxs)(`aside`,{className:D(`bree-layers`,r),style:i,"aria-label":t??o.layers.title,tabIndex:-1,onDragLeave:e=>!e.currentTarget.contains(e.relatedTarget)&&T(null),children:[(0,S.jsxs)(`header`,{className:`bree-layers-header`,children:[(0,S.jsx)(`h2`,{children:t??o.layers.title}),(0,S.jsxs)(`div`,{className:`bree-layers-actions`,children:[n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.expandAll,onClick:()=>C(new Set),children:`⊞`}),(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.collapseAll,onClick:()=>{let e=new Set,t=n=>n.forEach(n=>{n.children.length&&e.add(n.key),t(n.children)});t(y),C(e)},children:`⊟`})]}),e&&(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button bree-small`,title:o.layers.close,onClick:e,children:(0,S.jsx)(x.XIcon,{size:14})})]})]}),(0,S.jsx)(`div`,{className:`bree-layers-list`,role:`tree`,"aria-label":o.layers.tree,ref:E,children:y.length?A(y):(0,S.jsx)(`p`,{className:`bree-hint`,children:o.layers.emptyEmail})})]})})}function Cn({ctx:e,className:t,style:n}){return(0,S.jsxs)(`div`,{className:D(`bree-inspector`,t),style:n,children:[(0,S.jsx)(pt,{ctx:e,alignment:String(e.getAttr(`alignment`)??`left`),setAlignment:t=>e.setAttr(`alignment`,t)}),(0,S.jsx)(W,{ctx:e}),(0,S.jsx)(mt,{ctx:e})]})}function wn(){let{editor:e}=Q();return()=>{let t=document.activeElement;t instanceof HTMLElement&&t.blur(),e.commands.blur()}}function Tn({title:e,children:t,breadcrumb:n=!0,className:r,style:i}){let{t:a,nodeLabel:o}=Q(),s=wn();return(0,S.jsxs)(`div`,{className:D(`bree-properties`,r),style:i,children:[(0,S.jsxs)(`header`,{className:`bree-properties-header`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`bree-eyebrow`,children:a.sidebar.propertiesEyebrow}),(0,S.jsx)(`h2`,{children:e})]}),(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:a.sidebar.closeProperties,onClick:s,children:(0,S.jsx)(x.XIcon,{size:16})})]}),n&&(0,S.jsx)(x.Inspector.Breadcrumb,{children:e=>e.length>1&&(0,S.jsx)(`nav`,{className:`bree-breadcrumb`,"aria-label":a.sidebar.breadcrumb,children:e.map((t,n)=>(0,S.jsxs)(`span`,{className:`bree-crumb`,children:[n>0&&(0,S.jsx)(`span`,{className:`bree-crumb-sep`,children:`/`}),(0,S.jsx)(`button`,{type:`button`,disabled:n===e.length-1,onClick:t.focus,children:o(t.node.nodeType)})]},`${t.node.nodeType}-${t.node.nodePos.pos}`))})}),(0,S.jsx)(`div`,{className:`bree-panel-scroll`,children:t})]})}function En({ctx:e,className:t,style:n}){let{nodes:r,nodeLabel:i}=Q(),a=r.get(e.nodeType)?.inspector??Cn;return(0,S.jsx)(Tn,{title:i(e.nodeType),className:t,style:n,children:(0,S.jsx)(a,{ctx:e},`${e.nodeType}-${e.nodePos.pos}`)})}function Dn(e,t){let{editor:n,dragSession:r}=Q();return{draggable:!0,onDragStart:n=>{r.start({kind:`new`,label:e,content:t}),n.dataTransfer.setData(ee,e),n.dataTransfer.effectAllowed=`copy`},onDragEnd:()=>r.end(),onClick:()=>me(n,t())}}function On({template:e,className:t,style:n}){let r=$t(),i=Le(e.label,r),a=Dn(i,()=>e.content(r));return(0,S.jsxs)(`button`,{type:`button`,className:D(`bree-block-card`,t),style:n,...a,children:[e.thumbnail??(0,S.jsx)(Z,{variant:`default`}),(0,S.jsxs)(`span`,{className:`bree-block-text`,children:[(0,S.jsx)(`strong`,{children:i}),e.description&&(0,S.jsx)(`span`,{children:Le(e.description,r)})]})]})}function kn({templates:e,className:t,style:n}){let r=Q();return(0,S.jsx)(`div`,{className:D(`bree-block-list`,t),style:n,children:(e??r.templates).map(e=>(0,S.jsx)(On,{template:e},e.id))})}var An=[`body`,`blockquote`];function jn(e){let{styles:t}=(0,m.getEmailTheming)(e),n=t.flatMap(e=>e.inputs).find(e=>e.prop===`fontFamily`&&e.classReference===`body`);return String(n?.value??``)}function Mn(e,t){let{styles:n}=(0,m.getEmailTheming)(e),r=e=>e.prop===`fontFamily`&&An.includes(e.classReference??``),i=Math.max(0,n.findIndex(e=>e.id===`body`)),a=n.map((e,n)=>{let a=e.inputs.filter(e=>!r(e));if(n!==i||!t)return{...e,inputs:a};let o=An.map(e=>({label:`Font`,type:`text`,prop:`fontFamily`,classReference:e,value:t}));return{...e,inputs:[...a,...o]}});(0,m.setGlobalStyles)(e,a)}function Nn({ctx:e,className:t,style:n}){let{editor:r,settings:i,updateSettings:a,t:o}=Q(),s=o.body,{findStyleValue:c,setGlobalStyle:l}=e;return(0,S.jsxs)(`div`,{className:D(`bree-body-tab`,t),style:n,children:[(0,S.jsx)(R,{title:s.general,children:(0,S.jsx)(z,{label:s.previewText,stacked:!0,children:(0,S.jsx)(B,{value:i.previewText,onChange:e=>a({previewText:e}),placeholder:s.previewTextPlaceholder})})}),(0,S.jsxs)(R,{title:s.background,children:[(0,S.jsx)(z,{label:s.backgroundColor,stacked:!0,children:(0,S.jsx)(H,{value:c(`body`,`backgroundColor`),onChange:e=>l(`body`,`backgroundColor`,e)})}),(0,S.jsx)(z,{label:s.outerPadding,children:(0,S.jsx)(V,{value:c(`body`,`padding`),onChange:e=>l(`body`,`padding`,e)})})]}),(0,S.jsxs)(R,{title:s.content,children:[(0,S.jsx)(z,{label:s.width,children:(0,S.jsx)(V,{value:c(`container`,`width`),onChange:e=>l(`container`,`width`,e),min:320,max:900})}),(0,S.jsx)(z,{label:s.contentColor,stacked:!0,children:(0,S.jsx)(H,{value:c(`container`,`backgroundColor`),onChange:e=>l(`container`,`backgroundColor`,e)})}),(0,S.jsx)(z,{label:s.innerPadding,children:(0,S.jsx)(V,{value:c(`container`,`padding`),onChange:e=>l(`container`,`padding`,e)})}),(0,S.jsx)(z,{label:s.radius,children:(0,S.jsx)(V,{value:c(`container`,`borderRadius`),onChange:e=>l(`container`,`borderRadius`,e)})})]}),(0,S.jsxs)(R,{title:s.defaultStyles,children:[(0,S.jsx)(z,{label:s.font,children:(0,S.jsx)(lt,{value:jn(r),emptyLabel:s.fontDefault,onChange:e=>Mn(r,e)})}),(0,S.jsx)(z,{label:s.text,stacked:!0,children:(0,S.jsx)(H,{value:c(`paragraph`,`color`),onChange:e=>l(`paragraph`,`color`,e)})}),(0,S.jsx)(z,{label:s.headings,stacked:!0,children:(0,S.jsx)(H,{value:c(`h1`,`color`),onChange:t=>e.batchSetGlobalStyle([`h1`,`h2`,`h3`].map(e=>({classReference:e,property:`color`,value:t})))})}),(0,S.jsx)(z,{label:s.links,stacked:!0,children:(0,S.jsx)(H,{value:c(`link`,`color`),onChange:e=>l(`link`,`color`,e)})}),(0,S.jsx)(z,{label:s.buttonBackground,stacked:!0,children:(0,S.jsx)(H,{value:c(`button`,`backgroundColor`),onChange:e=>l(`button`,`backgroundColor`,e)})}),(0,S.jsx)(z,{label:s.buttonText,stacked:!0,children:(0,S.jsx)(H,{value:c(`button`,`color`),onChange:e=>l(`button`,`color`,e)})})]})]})}function Pn({item:e,className:t,style:n}){let r=$t(),i=Le(e.label,r),a=Dn(i,()=>e.content(r));return(0,S.jsxs)(`button`,{type:`button`,className:D(`bree-tile`,t),style:n,title:r.t.sidebar.tileTitle(i),...a,children:[(0,S.jsx)(`span`,{className:`bree-tile-icon`,children:e.icon}),(0,S.jsx)(`span`,{className:`bree-tile-label`,children:i})]})}function Fn({items:e,groups:t,hint:n,className:r,style:i}){let a=Q(),o=e??a.palette,s=t??a.paletteGroups,c=[...s,...[...new Set(o.map(e=>e.group))].filter(e=>!s.some(t=>t.id===e)).map(e=>({id:e,title:e}))];return(0,S.jsxs)(`div`,{className:D(`bree-content-tab`,r),style:i,children:[c.map(e=>{let t=o.filter(t=>t.group===e.id);return t.length?(0,S.jsxs)(`section`,{children:[(0,S.jsx)(`h3`,{className:`bree-panel-title`,children:Le(e.title,a)}),(0,S.jsx)(`div`,{className:`bree-tiles`,children:t.map(e=>(0,S.jsx)(Pn,{item:e},e.id))})]},e.id):null}),n!==null&&(0,S.jsx)(`p`,{className:`bree-hint`,children:n??a.t.sidebar.dragHint})]})}function In({ctx:e,tabs:t=[`content`,`blocks`,`body`],defaultTab:n,className:r,style:i}){let{t:a}=Q(),o={content:{id:`content`,label:a.sidebar.tabContent,render:()=>(0,S.jsx)(Fn,{})},blocks:{id:`blocks`,label:a.sidebar.tabBlocks,render:()=>(0,S.jsx)(kn,{})},body:{id:`body`,label:a.sidebar.tabBody,render:e=>(0,S.jsx)(Nn,{ctx:e})}},s=t.map(e=>typeof e==`string`?o[e]:e),[c,u]=(0,l.useState)(n??s[0]?.id),d=s.find(e=>e.id===c)??s[0];return(0,S.jsxs)(`div`,{className:D(`bree-content-panel`,r),style:i,children:[s.length>1&&(0,S.jsx)(`nav`,{className:`bree-tabs`,role:`tablist`,children:s.map(e=>(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===d?.id,className:D(e.id===d?.id&&`bree-active`),onClick:()=>u(e.id),children:e.label},e.id))}),(0,S.jsx)(`div`,{className:`bree-panel-scroll`,children:d?.render(e)})]})}function Ln({ctx:e,className:t,style:n}){let r=$(),i=r.inspector,a=[{mark:`bold`,Icon:x.BoldIcon,title:i.bold},{mark:`italic`,Icon:x.ItalicIcon,title:i.italic},{mark:`underline`,Icon:x.UnderlineIcon,title:i.underline},{mark:`strike`,Icon:x.StrikethroughIcon,title:i.strike}];return(0,S.jsxs)(Tn,{title:r.sidebar.selectedText,className:t,style:n,children:[(0,S.jsx)(R,{title:i.formatting,children:(0,S.jsx)(`div`,{className:`bree-mark-row`,children:a.map(({mark:t,Icon:n,title:r})=>(0,S.jsx)(`button`,{type:`button`,title:r,"aria-pressed":!!e.marks[t],className:D(`bree-mark`,e.marks[t]&&`bree-active`),onClick:()=>e.toggleMark(t),children:(0,S.jsx)(n,{size:14})},t))})}),(0,S.jsx)(pt,{ctx:e,alignment:e.alignment,setAlignment:e.setAlignment}),e.isLinkActive&&(0,S.jsxs)(R,{title:i.link,children:[(0,S.jsx)(z,{label:i.url,stacked:!0,children:(0,S.jsx)(`span`,{className:`bree-readonly`,children:e.linkHref})}),(0,S.jsx)(z,{label:i.linkColor,stacked:!0,children:(0,S.jsx)(H,{value:e.linkColor,presets:e.presetColors,onChange:e.setLinkColor})})]})]})}function Rn({renderDocument:e=e=>(0,S.jsx)(In,{ctx:e}),renderNode:t=e=>(0,S.jsx)(En,{ctx:e}),renderText:n=e=>(0,S.jsx)(Ln,{ctx:e}),className:r,style:i}){let{t:a}=Q();return(0,S.jsxs)(x.Inspector.Root,{className:D(`bree-sidebar`,r),style:i,"aria-label":a.sidebar.label,children:[(0,S.jsx)(x.Inspector.Document,{children:e}),(0,S.jsx)(x.Inspector.Node,{children:t}),(0,S.jsx)(x.Inspector.Text,{children:n})]})}function zn(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function Bn({onClose:e,defaultView:t=`desktop`,views:n=[`desktop`,`mobile`,`html`,`text`],filename:r=`email.html`,className:i,style:a}){let{handle:o,settings:s,t:c}=Q(),[u,d]=(0,l.useState)(t),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!1;return o.exportEmail().then(t=>!e&&p(t)).catch(t=>!e&&h(t instanceof Error?t.message:String(t))),()=>{e=!0}},[o,s.previewText]),(0,l.useEffect)(()=>{let t=t=>t.key===`Escape`&&e();return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let v=async()=>{f&&(await navigator.clipboard.writeText(u===`text`?f.text:f.html),_(!0),setTimeout(()=>_(!1),1500))},y=c.preview;return(0,E.createPortal)((0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsx)(`div`,{className:`bree bree-modal-backdrop`,onMouseDown:t=>t.target===t.currentTarget&&e(),children:(0,S.jsxs)(`div`,{className:D(`bree-modal`,i),style:a,role:`dialog`,"aria-modal":`true`,"aria-label":y.dialogLabel,children:[(0,S.jsxs)(`header`,{className:`bree-modal-header`,children:[(0,S.jsx)(`nav`,{className:`bree-tabs bree-compact`,role:`tablist`,children:n.map(e=>(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":u===e,className:D(u===e&&`bree-active`),onClick:()=>d(e),children:y[e]},e))}),(0,S.jsxs)(`div`,{className:`bree-modal-actions`,children:[f&&(u===`html`||u===`text`)&&(0,S.jsx)(`button`,{type:`button`,className:`bree-btn`,onClick:v,children:g?y.copied:y.copy}),f&&(0,S.jsx)(`button`,{type:`button`,className:`bree-btn bree-primary`,onClick:()=>zn(r,f.unformattedHtml,`text/html`),children:y.download}),(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,onClick:e,title:y.close,children:(0,S.jsx)(x.XIcon,{size:18})})]})]}),(0,S.jsxs)(`div`,{className:`bree-modal-body`,children:[m&&(0,S.jsx)(`p`,{className:`bree-error`,children:y.renderError(m)}),!f&&!m&&(0,S.jsx)(`p`,{className:`bree-loading`,children:y.rendering}),f&&(u===`desktop`||u===`mobile`)&&(0,S.jsx)(`div`,{className:D(`bree-preview-frame`,`bree-preview-${u}`),children:(0,S.jsx)(`iframe`,{title:y.iframeTitle,srcDoc:f.html,sandbox:`allow-same-origin allow-popups`})}),f&&u===`html`&&(0,S.jsx)(`pre`,{className:`bree-code`,children:f.html}),f&&u===`text`&&(0,S.jsx)(`pre`,{className:`bree-code`,children:f.text})]})]})})}),document.body)}function Vn({className:e,style:t}){let{layersOpen:n,setLayersOpen:r,t:i}=Q();return(0,S.jsxs)(`button`,{type:`button`,className:D(`bree-btn bree-ghost bree-layers-toggle`,n&&`bree-active`,e),style:t,"aria-pressed":n,onClick:()=>r(!n),title:i.topBar.toggleLayers,children:[(0,S.jsx)(Xe,{}),` `,i.topBar.layers]})}function Hn({className:e,style:t}){let{editor:n,t:r}=Q(),i=(0,d.useEditorState)({editor:n,selector:({editor:e})=>({undo:!!e?.can().undo(),redo:!!e?.can().redo()})});return(0,S.jsxs)(`div`,{className:D(`bree-btn-group`,e),style:t,children:[(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.topBar.undo,disabled:!i?.undo,onClick:()=>n.chain().focus().undo().run(),children:(0,S.jsx)(Ke,{})}),(0,S.jsx)(`button`,{type:`button`,className:`bree-icon-button`,title:r.topBar.redo,disabled:!i?.redo,onClick:()=>n.chain().focus().redo().run(),children:(0,S.jsx)(qe,{})})]})}function Un({className:e,style:t}){let{device:n,setDevice:r,t:i}=Q(),a=[{id:`desktop`,label:i.topBar.desktop,Icon:Je},{id:`mobile`,label:i.topBar.mobile,Icon:Ye}];return(0,S.jsx)(`div`,{className:D(`bree-segmented bree-device-toggle`,e),style:t,role:`radiogroup`,"aria-label":i.topBar.canvasWidth,children:a.map(({id:e,label:t,Icon:i})=>(0,S.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:D(n===e&&`bree-active`),onClick:()=>r(e),title:t,children:(0,S.jsx)(i,{})},e))})}function Wn({className:e,style:t}){let{editor:n,starterDocument:r,locale:i,t:a}=Q();return(0,S.jsx)(`button`,{type:`button`,className:D(`bree-btn bree-ghost`,e),style:t,onClick:()=>{confirm(a.topBar.confirmTemplate)&&n.commands.setContent(r({locale:i,t:a}))},children:a.topBar.template})}function Gn({className:e,style:t}){let{handle:n,t:r}=Q(),i=(0,l.useRef)(null),a=async e=>{try{n.setValue(JSON.parse(await e.text()))}catch(e){alert(r.topBar.invalidFile(e instanceof Error?e.message:String(e)))}};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:D(`bree-btn bree-ghost`,e),style:t,onClick:()=>i.current?.click(),children:r.topBar.import}),(0,S.jsx)(`input`,{ref:i,type:`file`,accept:`application/json,.json`,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&a(t),e.target.value=``}})]})}function Kn({className:e,style:t,filename:n=`email.json`}){let{handle:r,t:i}=Q();return(0,S.jsx)(`button`,{type:`button`,className:D(`bree-btn bree-ghost`,e),style:t,onClick:()=>zn(n,JSON.stringify(r.getValue(),null,2),`application/json`),children:i.topBar.exportJson})}function qn({view:e=`desktop`,variant:t=`default`,children:n,className:r,style:i}){let{t:a}=Q(),[o,s]=(0,l.useState)(!1);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:D(`bree-btn`,t!=="default"&&`bree-${t}`,r),style:i,onClick:()=>s(!0),children:n??a.topBar.preview}),o&&(0,S.jsx)(Bn,{defaultView:e,onClose:()=>s(!1)})]})}function Jn(e){let{t}=Q();return(0,S.jsx)(qn,{view:`html`,variant:`primary`,...e,children:t.topBar.exportHtml})}function Yn({brand:e,actions:t,children:n,className:r,style:i}){return(0,S.jsx)(x.EditorFocusScope,{children:(0,S.jsxs)(`header`,{className:D(`bree-topbar`,r),style:i,children:[(0,S.jsx)(`div`,{className:`bree-topbar-start`,children:e}),n??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`bree-topbar-center`,children:(0,S.jsx)(Un,{})}),(0,S.jsxs)(`div`,{className:`bree-topbar-actions`,children:[t,(0,S.jsx)(Jn,{})]})]})]})})}function Xn({showTopBar:e=!0,showLayers:t=!0,showSidebar:n=!0,showEmailHeader:r=!1,components:i={},slotProps:a={}}){let{layersOpen:o}=Q(),{TopBar:s=Yn,LayersPanel:c=Sn,Canvas:l=gn,Sidebar:u=Rn}=i,d=t&&o;return(0,S.jsxs)(`div`,{className:D(`bree-layout`,e&&`bree-with-topbar`,d&&`bree-with-layers`,n&&`bree-with-sidebar`),children:[e&&(0,S.jsx)(s,{...a.topBar}),d&&(0,S.jsx)(c,{...a.layersPanel}),(0,S.jsx)(l,{header:r,...a.canvas}),n&&(0,S.jsx)(u,{...a.sidebar})]})}var Zn=(0,l.forwardRef)(function({showTopBar:e,showLayers:t,showSidebar:n,showEmailHeader:r,components:i,slotProps:a,...o},s){return(0,S.jsx)(sn,{ref:s,...o,children:(0,S.jsx)(Xn,{showTopBar:e,showLayers:t,showSidebar:n,showEmailHeader:r,components:i,slotProps:a})})});exports.AlignInput=dt,exports.BLOCK_CONTAINERS=O,exports.BetterEmailEditor=Zn,exports.BlockProperties=En,exports.BlocksTab=kn,exports.BodyTab=Nn,exports.BoxGroup=mt,exports.ButtonInspector=ht,exports.COLUMN_PARENTS=k,exports.Canvas=gn,exports.CanvasOverlay=fn,exports.ColorInput=H,exports.ColumnsInspector=gt,exports.ContainerInspector=St,exports.ContentPanel=In,exports.ContentTab=Fn,exports.DEFAULT_SWATCHES=ot,exports.DefaultInspector=Cn,exports.DeviceToggle=Un,exports.DividerInspector=xt,exports.EditorRoot=sn,exports.EmailButton=he,exports.EmailHeader=mn,exports.ExportHtmlButton=Jn,exports.ExportJsonButton=Kn,exports.Field=z,exports.FontInput=lt,exports.Group=R,exports.HeadingInspector=_t,exports.HtmlBlock=At,exports.HtmlInspector=bt,exports.ImageInspector=vt,exports.ImportButton=Gn,exports.LayersPanel=Sn,exports.LayersToggle=Vn,exports.NumberInput=V,exports.PaddingInput=ft,exports.PaletteTile=Pn,exports.PreviewButton=qn,exports.PreviewDialog=Bn,exports.PropertiesPanel=Tn,exports.RangeInput=at,exports.SOCIAL_NETWORKS=G,exports.Segmented=ut,exports.Select=ct,exports.Sidebar=Rn,exports.SocialLinks=kt,exports.SocialLinksInspector=jt,exports.Spacer=Tt,exports.SpacerInspector=yt,exports.SpacingGroup=W,exports.TemplateButton=Wn,exports.TemplateCard=On,exports.TemplateThumbnail=Z,exports.TextArea=rt,exports.TextInput=B,exports.TextProperties=Ln,exports.TopBar=Yn,exports.TypographyGroup=pt,exports.UndoRedo=Hn,exports.appendBlocks=me,exports.applyDrop=ce,Object.defineProperty(exports,"content",{enumerable:!0,get:function(){return It}}),exports.createStarterDocument=Xt,exports.css=U,exports.cx=D,exports.defaultFonts=De,exports.defaultNodes=Ft,exports.defaultPalette=qt,exports.defaultPaletteGroups=Kt,exports.defaultTemplates=Jt,exports.defaultTheme=en,exports.deleteUnit=pe,exports.download=zn,exports.duplicateUnit=fe,exports.en=Pe,exports.findDropTarget=ie,exports.findFont=ke,exports.fr=Fe,exports.iconUrl=Dt,Object.defineProperty(exports,"icons",{enumerable:!0,get:function(){return Ve}}),exports.inlineStyleToObject=Ct,exports.linkWebFonts=je,exports.locales=Ie,exports.menuParagraph=Gt,exports.parentUnit=de,exports.readFileAsDataUrl=tn,exports.resolveLabel=Le,exports.resolveMessages=Be,exports.selectUnit=P,exports.selectedUnit=N,exports.textPreview=Nt,exports.toHex=st,exports.truncate=Mt,exports.unitAt=M,exports.useDeselect=wn,exports.useDraggableBlock=Dn,exports.useEmailEditor=Q,exports.useI18n=$t,exports.useMessages=$,exports.useOptionalEmailEditor=Qt,exports.usedWebFonts=Ae;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|