@one-million-lines/email-builder 0.6.1 β†’ 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,5 +78,5 @@ ${a}
78
78
  To pick up a draggable item, press the space bar.
79
79
  While dragging, use the arrow keys to move the item.
80
80
  Press space again to drop the item in its new position, or press escape to cancel.
81
- `},Xt={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Zt(e){let{announcements:t=Xt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Yt}=e,{announce:a,announcement:o}=Gt(),s=jt(`DndLiveRegion`),[c,u]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{u(!0)},[]),qt((0,l.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let d=l.default.createElement(l.default.Fragment,null,l.default.createElement(Ut,{id:r,value:i.draggable}),l.default.createElement(Wt,{id:s,announcement:o}));return n?(0,m.createPortal)(d,n):d}var J;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(J||={});function Qt(){}function $t(e,t){return(0,l.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function en(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,l.useMemo)(()=>[...t].filter(e=>e!=null),[...t])}var tn=Object.freeze({x:0,y:0});function nn(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function rn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function an(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function on(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function sn(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function cn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ln=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=cn(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=nn(cn(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(rn)},un=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=on(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=on(r),o=i.reduce((e,t,r)=>e+nn(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(rn)};function dn(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var fn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=dn(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(an)};function pn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:tn}function hn(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var gn=hn(1);function _n(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vn(e,t,n){let r=_n(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var yn={ignoreTransform:!1};function bn(e,t){t===void 0&&(t=yn);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=q(e).getComputedStyle(e);t&&(n=vn(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function xn(e){return bn(e,{ignoreTransform:!0})}function Sn(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cn(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position===`fixed`}function wn(e,t){t===void 0&&(t=q(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Tn(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yt(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!bt(i)||xt(i)||n.includes(i))return n;let a=q(e).getComputedStyle(i);return i!==e&&wn(i,a)&&n.push(i),Cn(i,a)?n:r(i.parentNode)}return e?r(e):n}function En(e){let[t]=Tn(e,1);return t??null}function Dn(e){return!gt||!e?null:_t(e)?e:vt(e)?yt(e)||e===St(e).scrollingElement?window:bt(e)?e:null:null}function On(e){return _t(e)?e.scrollX:e.scrollLeft}function kn(e){return _t(e)?e.scrollY:e.scrollTop}function An(e){return{x:On(e),y:kn(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function jn(e){return!gt||!e?!1:e===document.scrollingElement}function Mn(e){let t={x:0,y:0},n=jn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Nn={x:.2,y:.2};function Pn(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Nn);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Mn(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Fn(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function In(e){return e.reduce((e,t)=>Nt(e,An(t)),tn)}function Ln(e){return e.reduce((e,t)=>e+On(t),0)}function Rn(e){return e.reduce((e,t)=>e+kn(t),0)}function zn(e,t){if(t===void 0&&(t=bn),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);En(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Bn=[[`x`,[`left`,`right`],Ln],[`y`,[`top`,`bottom`],Rn]],Vn=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Tn(t),r=In(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Bn)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Hn=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Un(e){let{EventTarget:t}=q(e);return e instanceof t?e:St(e)}function Wn(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Gn;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Gn||={});function Kn(e){e.preventDefault()}function qn(e){e.stopPropagation()}var X;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(X||={});var Jn={start:[X.Space,X.Enter],cancel:[X.Esc],end:[X.Space,X.Enter,X.Tab]},Yn=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case X.Right:return{...n,x:n.x+25};case X.Left:return{...n,x:n.x-25};case X.Down:return{...n,y:n.y+25};case X.Up:return{...n,y:n.y-25}}},Xn=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Hn(St(t)),this.windowListeners=new Hn(q(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&zn(n),t(tn)}handleKeyDown(e){if(It(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Jn,coordinateGetter:a=Yn,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:tn;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Pt(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Mn(n),p=Fn(n),m={x:Math.min(i===X.Right?p.right-p.width/2:p.right,Math.max(i===X.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===X.Down?p.bottom-p.height/2:p.bottom,Math.max(i===X.Down?p.top:p.top+p.height/2,u.y))},h=i===X.Right&&!s||i===X.Left&&!c,g=i===X.Down&&!l||i===X.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===X.Right&&e<=d.x||i===X.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===X.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===X.Down&&e<=d.y||i===X.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===X.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Nt(Pt(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Xn.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Jn,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Zn(e){return!!(e&&`distance`in e)}function Qn(e){return!!(e&&`delay`in e)}var $n=class{constructor(e,t,n){n===void 0&&(n=Un(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=St(i),this.documentListeners=new Hn(this.document),this.listeners=new Hn(n),this.windowListeners=new Hn(q(i)),this.initialCoordinates=Rt(r)??tn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.DragStart,Kn),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),this.windowListeners.add(Gn.ContextMenu,Kn),this.documentListeners.add(Gn.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Qn(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Zn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Gn.Click,qn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gn.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Rt(e)??tn,s=Pt(n,o);if(!t&&a){if(Zn(a)){if(a.tolerance!=null&&Wn(s,a.tolerance))return this.handleCancel();if(Wn(s,a.distance))return this.handleStart()}if(Qn(a)&&Wn(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===X.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},er={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},tr=class extends $n{constructor(e){let{event:t}=e,n=St(t.target);super(e,er,n)}};tr.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var nr={move:{name:`mousemove`},end:{name:`mouseup`}},rr;(function(e){e[e.RightClick=2]=`RightClick`})(rr||={});var ir=class extends $n{constructor(e){super(e,nr,St(e.event.target))}};ir.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===rr.RightClick?!1:(r?.({event:n}),!0)}}];var ar={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},or=class extends $n{constructor(e){super(e,ar)}static setup(){return window.addEventListener(ar.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ar.move.name,e)};function e(){}}};or.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var sr;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(sr||={});var cr;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(cr||={});function lr(e){let{acceleration:t,activator:n=sr.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=cr.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=dr({delta:f,disabled:!a}),[h,g]=Tt(),_=(0,l.useRef)({x:0,y:0}),v=(0,l.useRef)({x:0,y:0}),y=(0,l.useMemo)(()=>{switch(n){case sr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case sr.DraggableRect:return i}},[n,i,c]),b=(0,l.useRef)(null),x=(0,l.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,l.useMemo)(()=>s===cr.TreeOrder?[...u].reverse():u,[s,u]);(0,l.useEffect)(()=>{if(!a||!u.length||!y){g();return}for(let e of S){if(r?.(e)===!1)continue;let n=u.indexOf(e),i=d[n];if(!i)continue;let{direction:a,speed:s}=Pn(e,i,y,t,p);for(let e of[`x`,`y`])m[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){g(),b.current=e,h(x,o),_.current=s,v.current=a;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var ur={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function dr(e){let{delta:t,disabled:n}=e,r=kt(t);return Dt(e=>{if(n||!r||!e)return ur;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function fr(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Dt(e=>t==null?null:r??e??null,[r,t])}function pr(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var mr;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(mr||={});var hr;(function(e){e.Optimized=`optimized`})(hr||={});var gr=new Map;function _r(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,l.useState)(null),{frequency:s,measure:c,strategy:u}=i,d=(0,l.useRef)(e),f=_(),p=Et(f),m=(0,l.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,l.useRef)(null),g=Dt(t=>{if(f&&!n)return gr;if(!t||t===gr||d.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Vn(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,f,c]);return(0,l.useEffect)(()=>{d.current=e},[e]),(0,l.useEffect)(()=>{f||m()},[n,f]),(0,l.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,l.useEffect)(()=>{f||typeof s!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function _(){switch(u){case mr.Always:return!1;case mr.BeforeDragging:return n;default:return!n}}}function vr(e,t){return Dt(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function yr(e,t){return vr(e,t)}function br(e){let{callback:t,disabled:n}=e,r=wt(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function xr(e){let{callback:t,disabled:n}=e,r=wt(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Sr(e){return new Vn(bn(e),e)}function Cr(e,t,n){t===void 0&&(t=Sr);let[r,i]=(0,l.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=br({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=xr({callback:a});return Ct(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function wr(e){return mn(e,vr(e))}var Tr=[];function Er(e){let t=(0,l.useRef)(e),n=Dt(n=>e?n&&n!==Tr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tn(e):Tr,[e]);return(0,l.useEffect)(()=>{t.current=e},[e]),n}function Dr(e){let[t,n]=(0,l.useState)(null),r=(0,l.useRef)(e),i=(0,l.useCallback)(e=>{let t=Dn(e.target);t&&n(e=>e?(e.set(t,An(t)),new Map(e)):null)},[]);return(0,l.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Dn(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,An(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Dn(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,l.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Nt(e,t),tn):In(e):tn,[e,t])}function Or(e,t){t===void 0&&(t=[]);let n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{n.current=null},t),(0,l.useEffect)(()=>{let t=e!==tn;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Pt(e,n.current):tn}function kr(e){(0,l.useEffect)(()=>{if(!gt)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Ar(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function jr(e){return(0,l.useMemo)(()=>e?Sn(e):null,[e])}var Mr=[];function Nr(e,t){t===void 0&&(t=bn);let[n]=e,r=jr(n?q(n):null),[i,a]=(0,l.useState)(Mr);function o(){a(()=>e.length?e.map(e=>jn(e)?r:new Vn(t(e),e)):Mr)}let s=xr({callback:o});return Ct(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Pr(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return bt(t)?t:e}function Fr(e){let{measure:t}=e,[n,r]=(0,l.useState)(null),i=xr({callback:(0,l.useCallback)(e=>{for(let{target:n}of e)if(bt(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ot((0,l.useCallback)(e=>{let n=Pr(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,l.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ir=[{sensor:tr,options:{}},{sensor:Xn,options:{}}],Lr={current:{}},Rr={draggable:{measure:xn},droppable:{measure:xn,strategy:mr.WhileDragging,frequency:hr.Optimized},dragOverlay:{measure:bn}},zr=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Br={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Rr,measureDroppableContainers:Qt,windowRect:null,measuringScheduled:!1},Vr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Qt,draggableNodes:new Map,over:null,measureDroppableContainers:Qt},Hr=(0,l.createContext)(Vr),Ur=(0,l.createContext)(Br);function Wr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zr}}}function Gr(e,t){switch(t.type){case J.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case J.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case J.DragEnd:case J.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case J.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new zr(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case J.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new zr(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case J.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new zr(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Kr(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,l.useContext)(Hr),a=kt(r),o=kt(n?.id);return(0,l.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!It(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Vt(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function qr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Jr(e){return(0,l.useMemo)(()=>({draggable:{...Rr.draggable,...e?.draggable},droppable:{...Rr.droppable,...e?.droppable},dragOverlay:{...Rr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Yr(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,l.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Ct(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=mn(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=En(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Xr=(0,l.createContext)({...tn,scaleX:1,scaleY:1}),Zr;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Zr||={});var Qr=(0,l.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ir,collisionDetection:o=fn,measuring:s,modifiers:c,...u}=e,[d,f]=(0,l.useReducer)(Gr,void 0,Wr),[p,h]=Jt(),[g,_]=(0,l.useState)(Zr.Uninitialized),v=g===Zr.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=d,C=y==null?null:b.get(y),w=(0,l.useRef)({initial:null,translated:null}),T=(0,l.useMemo)(()=>y==null?null:{id:y,data:C?.data??Lr,rect:w},[y,C]),ee=(0,l.useRef)(null),[te,E]=(0,l.useState)(null),[D,ne]=(0,l.useState)(null),re=Et(u,Object.values(u)),ie=jt(`DndDescribedBy`,t),ae=(0,l.useMemo)(()=>S.getEnabled(),[S]),oe=Jr(s),{droppableRects:se,measureDroppableContainers:ce,measuringScheduled:le}=_r(ae,{dragging:v,dependencies:[x.x,x.y],config:oe.droppable}),O=fr(b,y),ue=(0,l.useMemo)(()=>D?Rt(D):null,[D]),de=we(),fe=yr(O,oe.draggable.measure);Yr({activeNode:y==null?null:b.get(y),config:de.layoutShiftCompensation,initialRect:fe,measure:oe.draggable.measure});let k=Cr(O,oe.draggable.measure,fe),pe=Cr(O?O.parentElement:null),A=(0,l.useRef)({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),j=S.getNodeFor(A.current.over?.id),me=Fr({measure:oe.dragOverlay.measure}),he=me.nodeRef.current??O,ge=v?me.rect??k:null,_e=!!(me.nodeRef.current&&me.rect),ve=wr(_e?null:k),M=jr(he?q(he):null),N=Er(v?j??O:null),ye=Nr(N),be=qr(c,{transform:{x:x.x-ve.x,y:x.y-ve.y,scaleX:1,scaleY:1},activatorEvent:D,active:T,activeNodeRect:k,containerNodeRect:pe,draggingNodeRect:ge,over:A.current.over,overlayNodeRect:me.rect,scrollableAncestors:N,scrollableAncestorRects:ye,windowRect:M}),P=ue?Nt(ue,x):null,F=Dr(N),I=Or(F),L=Or(F,[k]),R=Nt(be,I),z=ge?gn(ge,be):null,B=T&&z?o({active:T,collisionRect:z,droppableRects:se,droppableContainers:ae,pointerCoordinates:P}):null,V=sn(B,`id`),[H,xe]=(0,l.useState)(null),U=pn(_e?be:Nt(be,L),H?.rect??null,k),Se=(0,l.useRef)(null),W=(0,l.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(ee.current==null)return;let i=b.get(ee.current);if(!i)return;let a=e.nativeEvent,o=new n({active:ee.current,activeNode:i,event:a,options:r,context:A,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=re.current,n={id:e};t?.(n),p({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=re.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),p({type:`onDragPending`,event:a})},onStart(e){let t=ee.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=re.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,m.unstable_batchedUpdates)(()=>{r?.(i),_(Zr.Initializing),f({type:J.DragStart,initialCoordinates:e,active:t}),p({type:`onDragStart`,event:i}),E(Se.current),ne(a)})},onMove(e){f({type:J.DragMove,coordinates:e})},onEnd:s(J.DragEnd),onCancel:s(J.DragCancel)});Se.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=A.current,o=null;if(t&&i){let{cancelDrop:s}=re.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===J.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=J.DragCancel)}ee.current=null,(0,m.unstable_batchedUpdates)(()=>{f({type:e}),_(Zr.Uninitialized),xe(null),E(null),ne(null),Se.current=null;let t=e===J.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=re.current[t];e?.(o),p({type:t,event:o})}})}}},[b]),G=pr(a,(0,l.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(ee.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},ee.current=r,W(n,t))},[b,W]));kr(a),Ct(()=>{k&&g===Zr.Initializing&&_(Zr.Initialized)},[k,g]),(0,l.useEffect)(()=>{let{onDragMove:e}=re.current,{active:t,activatorEvent:n,collisions:r,over:i}=A.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:R.x,y:R.y},over:i};(0,m.unstable_batchedUpdates)(()=>{e?.(a),p({type:`onDragMove`,event:a})})},[R.x,R.y]),(0,l.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=A.current;if(!e||ee.current==null||!t||!i)return;let{onDragOver:a}=re.current,o=r.get(V),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,m.unstable_batchedUpdates)(()=>{xe(s),a?.(c),p({type:`onDragOver`,event:c})})},[V]),Ct(()=>{A.current={activatorEvent:D,active:T,activeNode:O,collisionRect:z,collisions:B,droppableRects:se,draggableNodes:b,draggingNode:he,draggingNodeRect:ge,droppableContainers:S,over:H,scrollableAncestors:N,scrollAdjustedTranslate:R},w.current={initial:ge,translated:z}},[T,O,B,z,b,he,ge,se,S,H,N,R]),lr({...de,delta:x,draggingRect:z,pointerCoordinates:P,scrollableAncestors:N,scrollableAncestorRects:ye});let K=(0,l.useMemo)(()=>({active:T,activeNode:O,activeNodeRect:k,activatorEvent:D,collisions:B,containerNodeRect:pe,dragOverlay:me,draggableNodes:b,droppableContainers:S,droppableRects:se,over:H,measureDroppableContainers:ce,scrollableAncestors:N,scrollableAncestorRects:ye,measuringConfiguration:oe,measuringScheduled:le,windowRect:M}),[T,O,k,D,B,pe,me,b,S,se,H,ce,N,ye,oe,le,M]),Ce=(0,l.useMemo)(()=>({activatorEvent:D,activators:G,active:T,activeNodeRect:k,ariaDescribedById:{draggable:ie},dispatch:f,draggableNodes:b,over:H,measureDroppableContainers:ce}),[D,G,T,k,f,ie,b,H,ce]);return l.default.createElement(Kt.Provider,{value:h},l.default.createElement(Hr.Provider,{value:Ce},l.default.createElement(Ur.Provider,{value:K},l.default.createElement(Xr.Provider,{value:U},i)),l.default.createElement(Kr,{disabled:n?.restoreFocus===!1})),l.default.createElement(Zt,{...n,hiddenTextDescribedById:ie}));function we(){let e=te?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=v&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),$r=(0,l.createContext)(null),ei=`button`,ti=`Draggable`;function ni(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=jt(ti),{activators:o,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,l.useContext)(Hr),{role:m=ei,roleDescription:h=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,l.useContext)(_?Xr:$r),[y,b]=Ot(),[x,S]=Ot(),C=Ar(o,t),w=Et(n);return Ct(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=f.get(t);e&&e.key===a&&f.delete(t)}),[f,t]),{active:c,activatorEvent:s,activeNodeRect:u,attributes:(0,l.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&m===ei?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[r,m,g,_,h,d.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function ri(){return(0,l.useContext)(Ur)}var ii=`Droppable`,ai={timeout:25};function oi(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=jt(ii),{active:o,dispatch:s,over:c,measureDroppableContainers:u}=(0,l.useContext)(Hr),d=(0,l.useRef)({disabled:n}),f=(0,l.useRef)(!1),p=(0,l.useRef)(null),m=(0,l.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...ai,...i},v=Et(g??r),y=xr({callback:(0,l.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!o}),[b,x]=Ot((0,l.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=Et(t);return(0,l.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,l.useEffect)(()=>(s({type:J.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:p,data:S}}),()=>s({type:J.UnregisterDroppable,key:a,id:r})),[r]),(0,l.useEffect)(()=>{n!==d.current.disabled&&(s({type:J.SetDroppableDisabled,id:r,key:a,disabled:n}),d.current.disabled=n)},[r,a,n,s]),{active:o,rect:p,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function si(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ci(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function li(e){return e!==null&&e>=0}function ui(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function di(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var fi=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=si(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pi={scaleX:1,scaleY:1},mi=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pi}:null}let s=hi(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pi}:r<t&&r>=a?{x:0,y:o.height+s,...pi}:{x:0,y:0,...pi}};function hi(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gi=`Sortable`,_i=l.default.createContext({activeIndex:-1,containerId:gi,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fi,disabled:{draggable:!1,droppable:!1}});function vi(e){let{children:t,id:n,items:r,strategy:i=fi,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:u,measureDroppableContainers:d}=ri(),f=jt(gi,n),p=s.rect!==null,m=(0,l.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),h=o!=null,g=o?m.indexOf(o.id):-1,_=u?m.indexOf(u.id):-1,v=(0,l.useRef)(m),y=!ui(m,v.current),b=_!==-1&&g===-1||y,x=di(a);Ct(()=>{y&&h&&d(m)},[y,m,h,d]),(0,l.useEffect)(()=>{v.current=m},[m]);let S=(0,l.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:ci(m,c),strategy:i}),[g,f,x.draggable,x.droppable,b,m,_,c,p,i]);return l.default.createElement(_i.Provider,{value:S},t)}var yi=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return si(n,r,i).indexOf(t)},bi=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xi={duration:200,easing:`ease`},Si=`transform`,Ci=zt.Transition.toString({property:Si,duration:0,easing:`linear`}),wi={roleDescription:`sortable`};function Ti(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,l.useState)(null),s=(0,l.useRef)(n);return Ct(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=bn(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,l.useEffect)(()=>{a&&o(null)},[a]),a}function Ei(e){let{animateLayoutChanges:t=bi,attributes:n,disabled:r,data:i,getNewIndex:a=yi,id:o,strategy:s,resizeObserverConfig:c,transition:u=xi}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,l.useContext)(_i),b=Di(r,m),x=d.indexOf(o),S=(0,l.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...i}),[f,i,x,d]),C=(0,l.useMemo)(()=>d.slice(d.indexOf(o)),[d,o]),{rect:w,node:T,isOver:ee,setNodeRef:te}=oi({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:E,activatorEvent:D,activeNodeRect:ne,attributes:re,setNodeRef:ie,listeners:ae,isDragging:oe,over:se,setActivatorNodeRef:ce,transform:le}=ni({id:o,data:S,attributes:{...wi,...n},disabled:b.draggable}),O=ht(te,ie),ue=!!E,de=ue&&!h&&li(p)&&li(_),fe=!v&&oe,k=de?(fe&&de?le:null)??(s??y)({rects:g,activeNodeRect:ne,activeIndex:p,overIndex:_,index:x}):null,pe=li(p)&&li(_)?a({id:o,items:d,activeIndex:p,overIndex:_}):x,A=E?.id,j=(0,l.useRef)({activeId:A,items:d,newIndex:pe,containerId:f}),me=d!==j.current.items,he=t({active:E,containerId:f,isDragging:oe,isSorting:ue,id:o,index:x,items:d,newIndex:j.current.newIndex,previousItems:j.current.items,previousContainerId:j.current.containerId,transition:u,wasDragging:j.current.activeId!=null}),ge=Ti({disabled:!he,index:x,node:T,rect:w});return(0,l.useEffect)(()=>{ue&&j.current.newIndex!==pe&&(j.current.newIndex=pe),f!==j.current.containerId&&(j.current.containerId=f),d!==j.current.items&&(j.current.items=d)},[ue,pe,f,d]),(0,l.useEffect)(()=>{if(A===j.current.activeId)return;if(A!=null&&j.current.activeId==null){j.current.activeId=A;return}let e=setTimeout(()=>{j.current.activeId=A},50);return()=>clearTimeout(e)},[A]),{active:E,activeIndex:p,attributes:re,data:S,rect:w,index:x,newIndex:pe,items:d,isOver:ee,isSorting:ue,isDragging:oe,listeners:ae,node:T,overIndex:_,over:se,setNodeRef:O,setActivatorNodeRef:ce,setDroppableNodeRef:te,setDraggableNodeRef:ie,transform:ge??k,transition:_e()};function _e(){if(ge||me&&j.current.newIndex===x)return Ci;if(!(fe&&!It(D)||!u)&&(ue||he))return zt.Transition.toString({...u,property:Si})}}function Di(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Oi(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var ki=[X.Down,X.Right,X.Up,X.Left],Ai=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(ki.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case X.Down:r.top<a.top&&t.push(n);break;case X.Up:r.top>a.top&&t.push(n);break;case X.Left:r.left>a.left&&t.push(n);break;case X.Right:r.left<a.left&&t.push(n);break}});let c=un({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=sn(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Tn(c).some((e,t)=>s[t]!==e),i=ji(e,t),a=Mi(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Pt(u,l)}}}};function ji(e,t){return!Oi(e)||!Oi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mi(e,t){return!Oi(e)||!Oi(t)||!ji(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Ni=(0,d.create)(e=>({activeEl:null,setActiveEl:t=>e({activeEl:t})})),Pi=(0,d.create)(e=>({mergeTags:[],setMergeTags:t=>e({mergeTags:t})}));function Fi(e){Pi.getState().setMergeTags(e)}var Ii=[{label:`Default`,value:``},{label:`Arial`,value:`Arial, Helvetica, sans-serif`},{label:`Georgia`,value:`Georgia, 'Times New Roman', serif`},{label:`Tahoma`,value:`Tahoma, Geneva, sans-serif`},{label:`Trebuchet MS`,value:`'Trebuchet MS', Helvetica, sans-serif`},{label:`Verdana`,value:`Verdana, Geneva, sans-serif`},{label:`Courier New`,value:`'Courier New', Courier, monospace`},{label:`Times New Roman`,value:`'Times New Roman', Times, serif`}],Li=[`10`,`11`,`12`,`13`,`14`,`15`,`16`,`18`,`20`,`22`,`24`,`28`,`32`,`36`,`48`],Ri=[`#111827`,`#374151`,`#6B7280`,`#9CA3AF`,`#D1D5DB`,`#F3F4F6`,`#FFFFFF`,`#DC2626`,`#F97316`,`#EAB308`,`#22C55E`,`#3B82F6`,`#8B5CF6`,`#EC4899`,`#B91C1C`,`#C2410C`,`#A16207`,`#15803D`,`#1D4ED8`,`#6D28D9`,`#BE185D`],zi=`πŸ˜€.😊.😍.πŸ₯°.😎.🀩.πŸ‘‹.πŸ™Œ.πŸ‘.πŸ’ͺ.❀️.πŸ’™.πŸ’š.πŸ’›.🧑.πŸ’œ.πŸŽ‰.πŸ”₯.✨.⭐.πŸ†.πŸ₯‡.🎁.🎯.πŸš€.πŸ’‘.πŸ“§.πŸ’Œ.πŸ“±.πŸ’».βœ….❌.⚠️.πŸ””.πŸ“Š.πŸ“ˆ.πŸ’°.πŸ’³.πŸ›’.🏷️.πŸ“.πŸ—“οΈ.⚑.🌟`.split(`.`),Bi={unsubscribe:`Unsubscribe`,view_in_browser:`View in browser`,manage_preferences:`Manage preferences`,user_profile:`User profile`};function Vi(){let e=window.getSelection();if(!e||e.isCollapsed||e.rangeCount===0)return``;let t=e.getRangeAt(0).cloneContents(),n=document.createElement(`div`);return n.appendChild(t),n.innerHTML}function Hi(e,t){document.execCommand(e,!1,t)}function Ui(e){document.execCommand(`insertHTML`,!1,e)}function Wi(e,t){let n=Vi();n&&Ui(`<span style="${e}:${t}">${n}</span>`)}function Gi(){let e=window.getSelection();return!e||e.rangeCount===0?null:e.getRangeAt(0).cloneRange()}function Ki(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function qi({title:e,active:t,disabled:n,onMouseDown:r,children:i}){return(0,p.jsx)(`button`,{title:e,disabled:n,onMouseDown:r,className:`flex items-center justify-center w-7 h-7 rounded text-xs transition-colors leading-none ${t?`bg-blue-600 text-white`:`text-gray-700 hover:bg-gray-100 disabled:opacity-30`}`,children:i})}function Ji(){return(0,p.jsx)(`div`,{className:`w-px h-5 bg-gray-200 mx-0.5 shrink-0`})}function Yi({savedRange:e,onClose:t}){let[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(``),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{setTimeout(()=>o.current?.focus(),30)},[]);let s=()=>{if(!n&&!i){t();return}let r=i?be[i]:n;if(!r){t();return}if(e){let t=e.commonAncestorContainer,n=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(`[data-email-text]`);n&&n.focus(),Ki(e)}let a=e?(()=>{let t=document.createElement(`div`);return t.appendChild(e.cloneContents()),t.innerHTML||t.textContent||r})():r;Ui(`<a href="${r}"${i?` data-link-type="${i}"`:``} style="color:inherit;text-decoration:underline">${a}</a>`),t()};return(0,p.jsxs)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl p-3 w-80`,onMouseDown:e=>e.stopPropagation(),children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsx)(`span`,{className:`text-xs font-semibold text-gray-700`,children:`Insert link`}),(0,p.jsx)(`button`,{onClick:t,className:`text-gray-400 hover:text-gray-600 p-0.5 rounded`,children:(0,p.jsx)(f.X,{size:13})})]}),(0,p.jsx)(`input`,{ref:o,type:`url`,placeholder:`https://example.com`,value:n,onChange:e=>{r(e.target.value),e.target.value&&a(``)},className:`w-full px-2 py-1.5 text-xs border border-gray-200 rounded mb-2 focus:border-blue-500 focus:outline-none`,onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&t()}}),(0,p.jsxs)(`div`,{className:`mb-2`,children:[(0,p.jsx)(`div`,{className:`text-[10px] text-gray-500 mb-1`,children:`Or use a special link`}),(0,p.jsxs)(`select`,{value:i,onChange:e=>{a(e.target.value),e.target.value&&r(``)},className:`w-full px-2 py-1.5 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white`,children:[(0,p.jsx)(`option`,{value:``,children:`β€” none β€”`}),Object.keys(Bi).map(e=>(0,p.jsx)(`option`,{value:e,children:Bi[e]},e))]})]}),i&&(0,p.jsxs)(`p`,{className:`text-[10px] text-blue-600 mb-2`,children:[`Placeholder: `,(0,p.jsx)(`code`,{children:be[i]})]}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsx)(`button`,{onClick:s,className:`flex-1 px-3 py-1.5 bg-blue-600 text-white text-xs rounded hover:bg-blue-700`,children:`Apply`}),(0,p.jsx)(`button`,{onClick:t,className:`px-3 py-1.5 text-xs border border-gray-200 rounded hover:bg-gray-50`,children:`Cancel`})]})]})}function Xi({onClose:e}){let[t,n]=(0,l.useState)(``),r=t=>{document.execCommand(`styleWithCSS`,!1,`true`),document.execCommand(`foreColor`,!1,t),e()};return(0,p.jsxs)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl p-3`,style:{width:196},onMouseDown:e=>e.stopPropagation(),children:[(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:Ri.map(e=>(0,p.jsx)(`button`,{title:e,onClick:()=>r(e),className:`w-6 h-6 rounded border border-gray-200 hover:scale-110 transition-transform shrink-0`,style:{background:e}},e))}),(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(`input`,{type:`text`,placeholder:`#hex or color`,value:t,onChange:e=>n(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t&&r(t),n.key===`Escape`&&e()},className:`flex-1 px-2 py-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`}),(0,p.jsx)(`button`,{onClick:()=>t&&r(t),className:`px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700`,children:`βœ“`})]})]})}function Zi({onClose:e}){let t=t=>{Ui(t),e()};return(0,p.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl p-2`,style:{width:260},onMouseDown:e=>e.stopPropagation(),children:(0,p.jsx)(`div`,{className:`flex flex-wrap gap-0.5`,children:zi.map(e=>(0,p.jsx)(`button`,{onClick:()=>t(e),className:`w-8 h-8 text-lg hover:bg-gray-100 rounded flex items-center justify-center`,children:e},e))})})}function Qi({onClose:e}){let t=Pi(e=>e.mergeTags),n=t=>{Ui(`{${t}}`),e()};return t.length===0?null:(0,p.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl py-1`,style:{minWidth:200},onMouseDown:e=>e.stopPropagation(),children:t.map(e=>(0,p.jsxs)(`button`,{onClick:()=>n(e.attribute),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-blue-50 flex items-center justify-between gap-2`,children:[(0,p.jsx)(`span`,{children:e.title}),(0,p.jsx)(`code`,{className:`text-[10px] text-gray-400`,children:`{${e.attribute}}`})]},e.attribute))})}function $i(){let e=Ni(e=>e.activeEl),t=Pi(e=>e.mergeTags),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)({top:0,left:0}),[o,s]=(0,l.useState)({bold:!1,italic:!1,underline:!1}),[c,u]=(0,l.useState)(null),[d,m]=(0,l.useState)(null),h=(0,l.useRef)(null),g=(0,l.useRef)(null),_=(0,l.useCallback)(()=>u(null),[]),v=(0,l.useCallback)(()=>{let t=window.getSelection();if(!t)return;let n=null;if(!t.isCollapsed&&t.rangeCount>0?n=t.getRangeAt(0).getBoundingClientRect():e&&(n=e.getBoundingClientRect()),!n||n.width===0&&n.height===0)return;let r=h.current?.offsetHeight??40,i=h.current?.offsetWidth??440,o=n.top-r-6;o<8&&(o=n.bottom+6),o=Math.min(o,window.innerHeight-r-8),o=Math.max(o,8);let s=n.left+n.width/2-i/2;s=Math.max(8,Math.min(s,window.innerWidth-i-8)),a({top:o,left:s})},[e]),y=(0,l.useCallback)(()=>{s({bold:document.queryCommandState(`bold`),italic:document.queryCommandState(`italic`),underline:document.queryCommandState(`underline`)})},[]);if((0,l.useEffect)(()=>{if(!e){g.current&&clearTimeout(g.current),g.current=setTimeout(()=>r(!1),150);return}g.current&&clearTimeout(g.current),r(!0),v(),y()},[e,v,y]),(0,l.useEffect)(()=>{let t=()=>{e&&(v(),y())};return document.addEventListener(`selectionchange`,t),()=>document.removeEventListener(`selectionchange`,t)},[e,v,y]),(0,l.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&_()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[_]),!n||!e)return null;let b=e=>t=>{t.preventDefault(),e()},x=e=>{u(t=>t===e?null:e),e===`link`&&m(Gi())},S=()=>{let e=window.getSelection();return e&&!e.isCollapsed};return(0,p.jsxs)(`div`,{ref:h,"data-rich-toolbar":`true`,className:`fixed z-[9999] flex items-center gap-0.5 bg-white border border-gray-200 rounded-lg shadow-lg px-1.5 py-1 select-none`,style:{top:i.top,left:i.left},onMouseDown:e=>e.preventDefault(),children:[(0,p.jsx)(qi,{title:`Bold (Ctrl+B)`,active:o.bold,onMouseDown:b(()=>Hi(`bold`)),children:(0,p.jsx)(`b`,{style:{fontSize:13,fontFamily:`inherit`},children:`B`})}),(0,p.jsx)(qi,{title:`Italic (Ctrl+I)`,active:o.italic,onMouseDown:b(()=>Hi(`italic`)),children:(0,p.jsx)(`i`,{style:{fontSize:13,fontFamily:`Georgia, serif`},children:`I`})}),(0,p.jsx)(qi,{title:`Underline (Ctrl+U)`,active:o.underline,onMouseDown:b(()=>Hi(`underline`)),children:(0,p.jsx)(`u`,{style:{fontSize:13},children:`U`})}),(0,p.jsx)(Ji,{}),(0,p.jsx)(`select`,{title:`Font family`,className:`h-7 px-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white max-w-[110px]`,defaultValue:``,onMouseDown:e=>e.stopPropagation(),onChange:t=>{let n=t.target.value;if(n){if(!S()){e?.focus();return}Wi(`font-family`,n),e?.focus()}},children:Ii.map(e=>(0,p.jsx)(`option`,{value:e.value,children:e.label},e.label))}),(0,p.jsxs)(`select`,{title:`Font size`,className:`h-7 px-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white w-14`,defaultValue:``,onMouseDown:e=>e.stopPropagation(),onChange:t=>{let n=t.target.value;if(n){if(!S()){e?.focus();return}Wi(`font-size`,`${n}px`),e?.focus()}},children:[(0,p.jsx)(`option`,{value:``,children:`Size`}),Li.map(e=>(0,p.jsx)(`option`,{value:e,children:e},e))]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Text color`,onMouseDown:b(()=>x(`color`)),children:(0,p.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5`,children:[(0,p.jsx)(`span`,{className:`text-xs font-bold leading-none`,style:{fontFamily:`serif`},children:`A`}),(0,p.jsx)(`span`,{className:`w-4 h-1 rounded-sm bg-current`})]})}),c===`color`&&(0,p.jsx)(Xi,{onClose:_})]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert link`,onMouseDown:b(()=>x(`link`)),children:(0,p.jsx)(f.Link2,{size:13})}),c===`link`&&(0,p.jsx)(Yi,{savedRange:d,onClose:_})]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert emoji`,onMouseDown:b(()=>x(`emoji`)),children:(0,p.jsx)(f.Smile,{size:13})}),c===`emoji`&&(0,p.jsx)(Zi,{onClose:_})]}),t.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert merge tag`,onMouseDown:b(()=>x(`mergeTag`)),children:(0,p.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] font-mono`,children:[(0,p.jsx)(f.Tag,{size:11}),(0,p.jsx)(f.ChevronDown,{size:10})]})}),c===`mergeTag`&&(0,p.jsx)(Qi,{onClose:_})]})]})]})}var ea=375;function ta(e){let t=e.replace(`#`,``);if(t.length!==3&&t.length!==6)return e===`white`||e===`#fff`||e===`#ffffff`;let n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255;return .2126*r+.7152*i+.0722*a>.82}function na(e,t){let n=e??{};if(t!==`mobile`)return n;let r=n.mobile??{};return{...n,...r}}function ra(){let{doc:e,selection:t,setSelection:n,reorderModules:r,deleteModule:i,duplicateModule:a,deleteElement:o,moveElement:s,viewMode:c}=M(),u=en($t(tr,{activationConstraint:{distance:5}}),$t(Xn,{coordinateGetter:Ai})),d=t=>{let{active:n,over:i}=t;if(!i||n.id===i.id)return;let a=e.modules.findIndex(e=>e.id===n.id),o=e.modules.findIndex(e=>e.id===i.id);a===-1||o===-1||r(a,o)};(0,l.useEffect)(()=>{let e=e=>{if(e.key!==`Delete`&&e.key!==`Backspace`)return;let n=e.target;n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable||(t?.kind===`module`?i(t.moduleId):t?.kind===`element`&&o(t.moduleId,t.elementId))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,i,o]);let f=x(e.settings.backgroundColor,e.theme),m=x(e.settings.contentBackgroundColor,e.theme),h=e.modules.map(e=>e.id),g=c===`mobile`?ea:e.settings.width;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)($i,{}),(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto`,style:{background:f},onClick:()=>n({kind:`email`}),children:(0,p.jsx)(`div`,{className:`py-8 flex justify-center`,children:(0,p.jsxs)(`div`,{className:`shadow-lg transition-all duration-200 ${c===`mobile`?`rounded-[28px] border-[10px] border-gray-800`:``}`,style:{width:g,background:m,minHeight:300},onClick:e=>e.stopPropagation(),children:[e.modules.length===0&&(0,p.jsx)(`div`,{className:`p-12 text-center text-gray-400 text-sm`,children:`Add modules from the left sidebar to start building your email.`}),(0,p.jsx)(Qr,{sensors:u,collisionDetection:ln,onDragEnd:d,children:(0,p.jsx)(vi,{items:h,strategy:mi,children:e.modules.map((r,o)=>(0,p.jsx)(ia,{mod:r,index:o,viewMode:c,selected:t?.kind===`module`&&t.moduleId===r.id,selectionEl:t?.kind===`element`&&t.moduleId===r.id?t.elementId:null,theme:e.theme,onSelectModule:()=>n({kind:`module`,moduleId:r.id}),onSelectElement:e=>n({kind:`element`,moduleId:r.id,elementId:e}),onDuplicate:()=>a(r.id),onDelete:()=>i(r.id)},r.id))})})]})})})]})}function ia(e){let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=Ei({id:e.mod.id});return(0,p.jsx)(`div`,{ref:r,style:{transform:zt.Transform.toString(i),transition:a,opacity:o?.5:1,position:`relative`,zIndex:e.selected?10:`auto`},children:(0,p.jsx)(aa,{mod:e.mod,viewMode:e.viewMode,selected:e.selected,selectionEl:e.selectionEl,theme:e.theme,onSelectModule:e.onSelectModule,onSelectElement:e.onSelectElement,onDuplicate:e.onDuplicate,onDelete:e.onDelete,dragHandle:(0,p.jsx)(`button`,{...t,...n,className:`bg-blue-600 text-white p-1 rounded cursor-grab active:cursor-grabbing`,title:`Drag to reorder`,onClick:e=>e.stopPropagation(),children:(0,p.jsx)(f.GripVertical,{size:14})})})})}function aa({mod:e,viewMode:t,selected:n,selectionEl:r,theme:i,onSelectModule:a,onSelectElement:o,onDuplicate:s,onDelete:c,dragHandle:u}){let d=e.style??{};if(d.hideOn===t)return null;let m=S(na(d,t),i),[h,g]=(0,l.useState)(!1);return(0,p.jsxs)(`div`,{style:{backgroundColor:m.backgroundColor,paddingTop:m.paddingTop??0,paddingBottom:m.paddingBottom??0,paddingLeft:m.paddingLeft??0,paddingRight:m.paddingRight??0,borderRadius:m.borderRadius,position:`relative`,outline:n?`2px solid #2563eb`:h?`1px dashed #93c5fd`:`1px dashed transparent`,outlineOffset:-2,cursor:`pointer`},onClick:e=>{e.stopPropagation(),a()},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[!n&&h&&(0,p.jsxs)(`div`,{className:`absolute top-0 right-0 z-10 bg-blue-600 text-white text-[10px] px-1.5 py-0.5 rounded-bl pointer-events-none`,children:[`Click to select: `,e.name]}),n&&(0,p.jsxs)(`div`,{className:`absolute top-0 left-0 z-20 flex items-center gap-1 p-1 rounded-br bg-blue-600 shadow-md`,onClick:e=>e.stopPropagation(),children:[u,(0,p.jsx)(`button`,{onClick:e=>{e.stopPropagation(),s()},className:`text-white p-1 rounded hover:bg-blue-700`,title:`Duplicate`,children:(0,p.jsx)(f.Copy,{size:14})}),(0,p.jsx)(`button`,{onClick:e=>{e.stopPropagation(),c()},className:`text-white p-1 rounded hover:bg-red-600`,title:`Delete`,children:(0,p.jsx)(f.Trash2,{size:14})}),(0,p.jsx)(`span`,{className:`text-white text-[10px] font-medium px-1.5 py-0.5`,children:e.name})]}),e.children.map((s,c)=>(0,p.jsx)(oa,{el:s,index:c,totalElements:e.children.length,viewMode:t,theme:i,moduleId:e.id,moduleSelected:n,selected:r===s.id,onSelect:()=>o(s.id),onSelectModule:a},s.id))]})}function oa({el:e,index:t,totalElements:n,viewMode:r,theme:i,moduleId:a,moduleSelected:o,selected:s,onSelect:c,onSelectModule:l}){let u=M(e=>e.moveElement),d=M(e=>e.deleteElement);if(e.style?.hideOn===r)return null;let m={outline:s?`2px solid #f59e0b`:`1px dashed rgba(0,0,0,0.08)`,outlineOffset:-1,position:`relative`},h=e=>{if(e.stopPropagation(),!o&&!s){l();return}c()},g=s&&(0,p.jsxs)(`div`,{className:`absolute top-0 right-0 z-20 flex items-center gap-1 p-1 rounded-bl bg-amber-500 shadow-md`,onClick:e=>e.stopPropagation(),children:[(0,p.jsx)(`button`,{onClick:()=>l(),className:`text-white p-1 rounded hover:bg-amber-600`,title:`Select parent block`,children:(0,p.jsx)(f.MousePointer2,{size:12})}),(0,p.jsx)(`button`,{disabled:t===0,onClick:()=>u(a,e.id,-1),className:`text-white p-1 rounded disabled:opacity-40 hover:bg-amber-600`,title:`Move up`,children:(0,p.jsx)(f.ArrowUp,{size:12})}),(0,p.jsx)(`button`,{disabled:t===n-1,onClick:()=>u(a,e.id,1),className:`text-white p-1 rounded disabled:opacity-40 hover:bg-amber-600`,title:`Move down`,children:(0,p.jsx)(f.ArrowDown,{size:12})}),(0,p.jsx)(`button`,{onClick:()=>d(a,e.id),className:`text-white p-1 rounded hover:bg-red-600`,title:`Delete element`,children:(0,p.jsx)(f.Trash2,{size:12})}),(0,p.jsx)(`span`,{className:`text-white text-[10px] font-medium px-1 py-0.5`,children:e.type})]}),_=e=>(0,p.jsxs)(`div`,{style:m,onClick:h,children:[g,e]});switch(e.type){case`text`:return _((0,p.jsx)(sa,{el:e,viewMode:r,theme:i,moduleId:a}));case`image`:return _((0,p.jsx)(ca,{el:e,viewMode:r,theme:i}));case`button`:return _((0,p.jsx)(la,{el:e,viewMode:r,theme:i}));case`spacer`:return _((0,p.jsx)(ua,{el:e}));case`divider`:return _((0,p.jsx)(da,{el:e,viewMode:r,theme:i}));case`productGrid`:return _((0,p.jsx)(fa,{el:e,viewMode:r,theme:i}))}}function sa({el:e,viewMode:t,theme:n,moduleId:r}){let i=M(e=>e.updateElement),a=Ni(e=>e.setActiveEl),o=(0,l.useRef)(null),s=(0,l.useRef)(!1),c=(0,l.useRef)(!1),u=(0,l.useRef)(e.content);u.current=e.content,(0,l.useEffect)(()=>{let t=o.current;!t||s.current||t.innerHTML!==e.content&&(t.innerHTML=e.content)});let d=S(na(e.style,t),n),f=d.color??`#000000`,m=ta(f);return(0,p.jsx)(`div`,{ref:o,"data-email-text":`true`,style:{fontFamily:d.fontFamily,fontSize:d.fontSize,lineHeight:d.lineHeight,letterSpacing:d.letterSpacing,fontWeight:d.fontWeight,color:f,textAlign:d.align,paddingTop:d.paddingTop??8,paddingBottom:d.paddingBottom??8,paddingLeft:d.paddingLeft??16,paddingRight:d.paddingRight??16,margin:0,minHeight:`1.5em`,outline:`none`,...m?{textShadow:`0 0 8px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.45)`}:void 0},contentEditable:!0,suppressContentEditableWarning:!0,onFocus:e=>{s.current=!0,c.current=!0,a(e.currentTarget)},onBlur:t=>{s.current=!1,c.current=!1,t.relatedTarget?.closest(`[data-rich-toolbar]`)||a(null);let n=t.currentTarget.innerHTML;n!==u.current&&i(r,e.id,{content:n})},onClick:e=>{c.current&&e.stopPropagation()}})}function ca({el:e,viewMode:t,theme:n}){let r=S(na(e.style,t),n),i={textAlign:r.align??`center`,paddingTop:r.paddingTop??0,paddingBottom:r.paddingBottom??0,paddingLeft:r.paddingLeft??0,paddingRight:r.paddingRight??0},a={display:`inline-block`,maxWidth:`100%`,width:r.width,height:r.height||`auto`,borderRadius:r.borderRadius};return(0,p.jsx)(`div`,{style:i,children:(0,p.jsx)(`img`,{src:e.src,alt:e.alt??``,style:a})})}function la({el:e,viewMode:t,theme:n}){let r=S(na(e.style,t),n);return(0,p.jsx)(`div`,{style:{textAlign:r.align??`center`,paddingTop:r.paddingTop??12,paddingBottom:r.paddingBottom??12,paddingLeft:r.paddingLeft??16,paddingRight:r.paddingRight??16},children:(0,p.jsx)(`span`,{style:{display:`inline-block`,backgroundColor:r.backgroundColor??`#3A7D52`,color:r.color??`#fff`,fontFamily:r.fontFamily,fontSize:r.fontSize??16,fontWeight:r.fontWeight??`bold`,borderRadius:r.borderRadius??6,padding:`12px 24px`,textDecoration:`none`},children:e.label})})}function ua({el:e}){return(0,p.jsx)(`div`,{style:{height:e.height,background:`rgba(0,0,0,0.02)`}})}function da({el:e,viewMode:t,theme:n}){let r=S(na(e.style,t),n);return(0,p.jsx)(`div`,{style:{paddingTop:r.paddingTop??8,paddingBottom:r.paddingBottom??8},children:(0,p.jsx)(`hr`,{style:{border:0,borderTop:`${r.thickness??1}px solid ${r.color??`#E5E7EB`}`,margin:0}})})}function fa({el:e,viewMode:t,theme:n}){let r=S(na(e.style,t),n),i=t===`mobile`,a=e.columns,o=r.cardBackgroundColor??r.backgroundColor??`transparent`,s=r.nameColor??`#111827`,c=r.finalPriceColor??`#3A7D52`,l=r.oldPriceColor??`#9CA3AF`,u=r.buttonBackgroundColor??`#3A7D52`,d=r.buttonColor??`#FFFFFF`,f=r.borderRadius??0;return(0,p.jsx)(`div`,{style:{paddingTop:r.paddingTop??16,paddingBottom:r.paddingBottom??16,paddingLeft:r.paddingLeft??16,paddingRight:r.paddingRight??16,display:`flex`,flexWrap:`wrap`,gap:8},children:e.products.map(t=>(0,p.jsxs)(`div`,{style:{width:i?`100%`:`calc(${100/a}% - 8px)`,background:o,borderRadius:f,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(`img`,{src:t.image,alt:t.imageAlt??t.name,style:{display:`block`,width:`100%`,height:`auto`,borderRadius:f}}),(0,p.jsx)(`div`,{style:{padding:`12px 12px 4px 12px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:15,fontWeight:`bold`,color:s,lineHeight:1.3},children:t.name}),e.showStars&&t.stars!=null&&(0,p.jsx)(`div`,{className:`stars`,style:{padding:`0 12px 4px 12px`,color:`#F5A623`,fontSize:15,letterSpacing:1},"aria-label":`${t.stars} out of 5 stars`,children:te(t.stars)}),(0,p.jsxs)(`div`,{style:{padding:`0 12px 8px 12px`,fontFamily:`Arial, Helvetica, sans-serif`},children:[e.showOldPrice&&t.oldPrice&&(0,p.jsx)(`span`,{className:`old_price`,style:{color:l,textDecoration:`line-through`,fontSize:14,marginRight:8},children:t.oldPrice}),(0,p.jsx)(`span`,{className:`final_price`,style:{color:c,fontWeight:`bold`,fontSize:18},children:t.finalPrice})]}),e.showDescription&&t.description&&(0,p.jsx)(`div`,{style:{padding:`0 12px 8px 12px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:13,color:`#6B7280`,lineHeight:1.5},children:t.description}),e.showButton&&(0,p.jsx)(`div`,{style:{padding:`4px 12px 12px 12px`,textAlign:`center`,marginTop:`auto`},children:(0,p.jsx)(`span`,{style:{display:`inline-block`,padding:`10px 18px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:13,fontWeight:`bold`,color:d,backgroundColor:u,borderRadius:6},children:t.buttonLabel??e.buttonLabel??`Shop now`})})]},t.id))})}var pa=null,ma=new Set,ha=0;function ga(){ha+=1;for(let e of ma)e()}function _a(e){pa!==e&&(pa=e,ga())}function va(){return pa}var ya=e=>(ma.add(e),()=>{ma.delete(e)}),ba=()=>ha,xa=null,Sa={status:`idle`,vouchers:[]},Ca=null,wa=new Set,Ta=0;function Ea(){Ta+=1;for(let e of wa)e()}function Da(e){xa!==e&&(xa=e,Sa={status:`idle`,vouchers:[]},Ca=null,Ea())}function Oa(){return xa}function ka(){return Sa}function Aa(e=!1){if(!xa)return Promise.resolve([]);if(!e&&Sa.status===`loaded`)return Promise.resolve(Sa.vouchers);if(Ca)return Ca;Sa={status:`loading`,vouchers:Sa.vouchers},Ea();let t=xa.list().then(e=>(Sa={status:`loaded`,vouchers:Array.isArray(e)?e:[]},Ca=null,Ea(),Sa.vouchers)).catch(e=>(Sa={status:`error`,vouchers:[],error:e instanceof Error?e.message:String(e)},Ca=null,Ea(),[]));return Ca=t,t}var ja=e=>(wa.add(e),()=>{wa.delete(e)}),Ma=()=>Ta,Na=(0,d.create)(e=>({enabled:!1,setEnabled:t=>e({enabled:t})}));function Pa(){Na.getState().setEnabled(!0)}var Fa=[],Ia=null,La={registerModule:e=>Ue.register(e),registerTheme:e=>Fa.push(e),registerAssetProvider:e=>{Ia=e},registerProductProvider:e=>{_a(e)},registerVoucherProvider:e=>{Da(e)},setAIProvider:e=>{Ye(e)},registerMergeTags:e=>Fi(e),registerRecommendationsPlugin:()=>Pa()};function Ra(e){e.setup(La)}function za(){return Ia}var Ba={key:`days`,label:`Time window`,type:`select`,default:7,options:[{value:7,label:`Last 7 days`},{value:14,label:`Last 14 days`},{value:30,label:`Last 30 days`}]},Va=[{id:`abandoned-cart`,label:`Abandoned basket products`,group:`behavioral`},{id:`bestseller-conversion`,label:`Best seller by Conversion`,group:`catalog`,params:[Ba]},{id:`bestseller-units`,label:`Best seller by Units`,group:`catalog`,params:[Ba]},{id:`new-products`,label:`New items added`,group:`catalog`,params:[Ba]},{id:`cross-sell`,label:`Products Cross-Sell`,group:`contextual`},{id:`upsell`,label:`Products Upsell`,group:`contextual`},{id:`viewed-categories`,label:`Items from viewed categories`,group:`behavioral`},{id:`viewed-items`,label:`Items viewed`,group:`behavioral`},{id:`similar-basket`,label:`Similar to basket items`,group:`behavioral`},{id:`bought-together`,label:`Items bought together`,group:`contextual`},{id:`best-discount`,label:`Items with the best discount`,group:`catalog`},{id:`match-data`,label:`Items matching specific attributes`,group:`catalog`},{id:`last-purchased`,label:`Last purchased items`,group:`personal`},{id:`similar-to-purchased`,label:`Similar to last purchase`,group:`personal`},{id:`cross-sell-purchased`,label:`Cross-sell to last purchase`,group:`personal`},{id:`similar-items`,label:`Similar items`,group:`contextual`}],Ha=Object.fromEntries(Va.map(e=>[e.id,e])),Ua=[{value:`smart-reccs`,label:`Smart Recommendations`,description:`Best generic algorithm β€” recommended default.`},{value:`random`,label:`Random items (strict filters)`,description:`Random items that still pass include/exclude filters.`},{value:`ignore`,label:`Ignore position`,description:`Skip the slot if no items found.`},{value:`stop`,label:`Don't display`,description:`Don't render the email if the slot can't be filled.`}];function Wa(e=2){return{mode:`recommender`,noProducts:e,sourceFeed:``,manualProducts:[],stack:[{algorithm:`abandoned-cart`}],fallback:`smart-reccs`,filters:{includeProducts:[],excludeProducts:[],includeCategories:[],excludeCategories:[],minStock:0,minPrice:0,mainOnly:!1,higherPrice:!1,salesPrice:!1,sameCategory:!1,matchTitle:!1,sameField:``}}}function Ga(e){if(!e)return null;let t=e.recommendations;return!t||typeof t!=`object`?null:t}function Ka(e){return e?.children?e.children.some(e=>e.type===`productGrid`):!1}function qa(e){if(!e?.children)return 0;let t=0;for(let n of e.children)n.type===`productGrid`&&(t+=n.products.length);return t}function Ja(e){return{params:{selection:e.mode===`manual`?`manual`:`recommender`,include:{item:e.filters.includeProducts,category:e.filters.includeCategories},exclude:{item:e.filters.excludeProducts,category:e.filters.excludeCategories},higherPrice:e.filters.higherPrice??!1,salesPrice:e.filters.salesPrice??!1,sameCategory:e.filters.sameCategory??!1,matchTitle:e.filters.matchTitle??!1,sameField:e.filters.sameField??``,mainOnly:e.filters.mainOnly??!1},noProducts:String(e.noProducts),fallback:e.fallback,stack:e.mode===`manual`?[]:e.stack,minStock:String(e.filters.minStock??0),minPrice:String(e.filters.minPrice??0),sourceFeed:e.sourceFeed??``,manualProducts:e.manualProducts}}function Ya({mod:e}){let t=M(e=>e.updateModule),n=qa(e)||2,r=Ga(e.data)??Wa(n),i=n=>{let i={...r,...n};t(e.id,{data:{...e.data??{},recommendations:i}})};return(0,p.jsxs)(`div`,{className:`border border-blue-200 rounded-lg bg-blue-50/40 mt-4 overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 border-b border-blue-200 bg-blue-50`,children:[(0,p.jsx)(f.Sparkles,{size:14,className:`text-blue-700`}),(0,p.jsx)(`div`,{className:`text-xs font-semibold text-blue-900 uppercase tracking-wide`,children:`Products Source`})]}),(0,p.jsx)(`div`,{className:`p-3 bg-white border-b border-blue-100`,children:(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)($a,{active:r.mode===`manual`,title:`Select Items`,subtitle:`Hand-pick from a feed`,onClick:()=>i({mode:`manual`})}),(0,p.jsx)($a,{active:r.mode===`recommender`,title:`Recommender`,subtitle:`Algorithms + filters`,onClick:()=>i({mode:`recommender`})})]})}),(0,p.jsxs)(`div`,{className:`p-3 bg-white space-y-3`,children:[(0,p.jsxs)(to,{label:`Number of products`,children:[(0,p.jsx)(`input`,{type:`number`,min:1,max:20,value:r.noProducts,onChange:e=>i({noProducts:Number(e.target.value)||1}),className:Qa}),(0,p.jsxs)(`div`,{className:`text-[11px] text-gray-500 mt-1`,children:[`Block has `,n,` slot`,n===1?``:`s`,` in the design.`]})]}),r.mode===`manual`?(0,p.jsx)(Xa,{logic:r,update:i}):(0,p.jsx)(Za,{logic:r,update:i,updateFilters:e=>i({filters:{...r.filters,...e}})}),(0,p.jsxs)(`details`,{className:`border border-gray-200 rounded`,children:[(0,p.jsx)(`summary`,{className:`px-2 py-1.5 text-[11px] font-medium text-gray-600 cursor-pointer select-none`,children:`View saved JSON`}),(0,p.jsx)(`pre`,{className:`text-[10px] bg-gray-900 text-gray-100 p-2 overflow-auto max-h-60 leading-tight`,children:JSON.stringify(r,null,2)})]})]})]})}function Xa({logic:e,update:t}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(to,{label:`Source feed`,children:(0,p.jsx)(`input`,{type:`text`,placeholder:`e.g. main-catalog`,value:e.sourceFeed??``,onChange:e=>t({sourceFeed:e.target.value}),className:Qa})}),(0,p.jsx)(to,{label:`Items to include (product IDs / SKUs)`,children:(0,p.jsx)(oo,{value:e.manualProducts,onChange:e=>t({manualProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(`div`,{className:`text-[11px] text-gray-500`,children:`Items are sent to the renderer as-is in the order shown.`})]})}function Za({logic:e,update:t,updateFilters:n}){let[r,i]=(0,l.useState)(!1);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,p.jsxs)(`label`,{className:`text-xs font-medium text-gray-700`,children:[`Algorithms (max `,3,`)`]}),(0,p.jsx)(ao,{disabled:e.stack.length>=3,existing:e.stack.map(e=>e.algorithm),onPick:n=>t({stack:[...e.stack,{algorithm:n}]})})]}),(0,p.jsx)(io,{stack:e.stack,onChange:e=>t({stack:e})})]}),(0,p.jsxs)(to,{label:`Fallback`,children:[(0,p.jsx)(`select`,{value:e.fallback,onChange:e=>t({fallback:e.target.value}),className:Qa,children:Ua.map(e=>(0,p.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,p.jsx)(`div`,{className:`text-[11px] text-gray-500 mt-1`,children:Ua.find(t=>t.value===e.fallback)?.description})]}),(0,p.jsx)(eo,{title:`Include & Exclude filters`,right:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(no,{active:!r,onClick:()=>i(!1),children:`Basic`}),(0,p.jsx)(no,{active:r,onClick:()=>i(!0),children:`Advanced`})]})}),(0,p.jsx)(to,{label:`Exclude products`,children:(0,p.jsx)(oo,{value:e.filters.excludeProducts,onChange:e=>n({excludeProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(to,{label:`Include products`,children:(0,p.jsx)(oo,{value:e.filters.includeProducts,onChange:e=>n({includeProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(to,{label:`Exclude categories`,children:(0,p.jsx)(oo,{value:e.filters.excludeCategories,onChange:e=>n({excludeCategories:e}),placeholder:`Add category`})}),(0,p.jsx)(to,{label:`Include categories`,children:(0,p.jsx)(oo,{value:e.filters.includeCategories,onChange:e=>n({includeCategories:e}),placeholder:`Add category`})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(to,{label:`Minimum stock`,children:(0,p.jsx)(`input`,{type:`number`,min:0,value:e.filters.minStock??0,onChange:e=>n({minStock:Number(e.target.value)||0}),className:Qa})}),(0,p.jsx)(to,{label:`Minimum price`,children:(0,p.jsx)(`input`,{type:`number`,min:0,value:e.filters.minPrice??0,onChange:e=>n({minPrice:Number(e.target.value)||0}),className:Qa})})]}),(0,p.jsx)(ro,{label:`Only main items`,checked:!!e.filters.mainOnly,onChange:e=>n({mainOnly:e})}),(0,p.jsx)(ro,{label:`Higher price than current item (upsell)`,checked:!!e.filters.higherPrice,onChange:e=>n({higherPrice:e})}),(0,p.jsx)(ro,{label:`On sale only`,checked:!!e.filters.salesPrice,onChange:e=>n({salesPrice:e})}),(0,p.jsx)(ro,{label:`Same category as current`,checked:!!e.filters.sameCategory,onChange:e=>n({sameCategory:e})}),(0,p.jsx)(ro,{label:`Match title keywords`,checked:!!e.filters.matchTitle,onChange:e=>n({matchTitle:e})}),(0,p.jsx)(to,{label:`Match same fields (comma-separated)`,children:(0,p.jsx)(`input`,{type:`text`,placeholder:`brand, color`,value:e.filters.sameField??``,onChange:e=>n({sameField:e.target.value}),className:Qa})}),r&&(0,p.jsx)(to,{label:`Advanced JSON overrides`,children:(0,p.jsx)(so,{value:e.filters.advanced??{},onChange:e=>n({advanced:e})})})]})}var Qa=`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white`;function $a({active:e,icon:t,title:n,subtitle:r,onClick:i}){return(0,p.jsxs)(`button`,{onClick:i,className:`flex flex-col items-start gap-0.5 p-2.5 rounded border text-left transition `+(e?`border-teal-600 bg-teal-50 ring-1 ring-teal-600`:`border-gray-200 bg-white hover:border-gray-300`),children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 `+(e?`text-teal-700`:`text-gray-700`),children:[t,(0,p.jsx)(`span`,{className:`text-xs font-semibold`,children:n})]}),(0,p.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:r})]})}function eo({title:e,right:t}){return(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-200 pt-3 mt-3`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-gray-600`,children:e}),t]})}function to({label:e,children:t}){return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-gray-700 mb-1`,children:e}),t]})}function no({active:e,onClick:t,children:n}){return(0,p.jsx)(`button`,{onClick:t,className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide `+(e?`bg-teal-600 text-white`:`bg-gray-100 text-gray-600 hover:bg-gray-200`),children:n})}function ro({label:e,checked:t,onChange:n}){return(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-2 text-xs text-gray-700 py-1`,children:[(0,p.jsx)(`span`,{children:e}),(0,p.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`h-4 w-4 accent-teal-600`})]})}function io({stack:e,onChange:t}){if(e.length===0)return(0,p.jsxs)(`div`,{className:`text-[11px] text-gray-500 italic border border-dashed border-gray-300 rounded px-2 py-3 text-center`,children:[`No algorithms yet. Click `,(0,p.jsx)(`b`,{children:`Add algorithm`}),` to start.`]});let n=(n,r)=>{let i=n+r;if(i<0||i>=e.length)return;let a=e.slice();[a[n],a[i]]=[a[i],a[n]],t(a)},r=n=>t(e.filter((e,t)=>t!==n)),i=(n,r,i)=>{let a=e.slice();a[n]={...a[n],params:{...a[n].params??{},[r]:i}},t(a)};return(0,p.jsx)(`div`,{className:`space-y-1.5`,children:e.map((t,a)=>{let o=Ha[t.algorithm];return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded px-2 py-1.5 bg-white flex flex-col gap-1`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`span`,{className:`flex-1 text-xs text-gray-800 truncate`,children:o?.label??t.algorithm}),(0,p.jsx)(`button`,{title:`Move up`,onClick:()=>n(a,-1),disabled:a===0,className:`p-1 text-gray-400 hover:text-gray-700 disabled:opacity-30`,children:(0,p.jsx)(f.ChevronUp,{size:13})}),(0,p.jsx)(`button`,{title:`Move down`,onClick:()=>n(a,1),disabled:a===e.length-1,className:`p-1 text-gray-400 hover:text-gray-700 disabled:opacity-30`,children:(0,p.jsx)(f.ChevronDown,{size:13})}),(0,p.jsx)(`button`,{title:`Remove`,onClick:()=>r(a),className:`p-1 text-gray-400 hover:text-red-600`,children:(0,p.jsx)(f.Trash2,{size:13})})]}),o?.params?.map(e=>(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-gray-500 w-20 shrink-0`,children:e.label}),e.type===`select`?(0,p.jsx)(`select`,{value:String(t.params?.[e.key]??e.default??``),onChange:t=>i(a,e.key,t.target.value),className:`flex-1 text-xs border border-gray-200 rounded px-1.5 py-1 bg-white`,children:e.options?.map(e=>(0,p.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))}):(0,p.jsx)(`input`,{type:e.type===`number`?`number`:`text`,value:String(t.params?.[e.key]??e.default??``),onChange:t=>i(a,e.key,e.type===`number`?Number(t.target.value):t.target.value),className:`flex-1 text-xs border border-gray-200 rounded px-1.5 py-1`})]},e.key))]},a)})})}function ao({disabled:e,existing:t,onPick:n}){let[r,i]=(0,l.useState)(!1);return(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsxs)(`button`,{disabled:e,onClick:()=>i(e=>!e),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-semibold uppercase `+(e?`bg-gray-200 text-gray-400 cursor-not-allowed`:`bg-teal-600 text-white hover:bg-teal-700`),children:[(0,p.jsx)(f.Plus,{size:12}),` Add`]}),r&&!e&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>i(!1)}),(0,p.jsx)(`div`,{className:`absolute right-0 top-full mt-1 w-64 max-h-80 overflow-auto bg-white border border-gray-200 rounded shadow-lg z-20`,children:Va.map(e=>{let r=t.includes(e.id);return(0,p.jsxs)(`button`,{disabled:r,onClick:()=>{n(e.id),i(!1)},className:`block w-full text-left px-2.5 py-1.5 text-xs `+(r?`text-gray-400 cursor-not-allowed`:`text-gray-700 hover:bg-teal-50 hover:text-teal-700`),children:[e.label,r&&(0,p.jsx)(`span`,{className:`ml-1 text-[10px]`,children:`Β· added`})]},e.id)})})]})]})}function oo({value:e,onChange:t,placeholder:n}){let[r,i]=(0,l.useState)(``),a=()=>{let n=r.trim();n&&(e.includes(n)||(t([...e,n]),i(``)))};return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded bg-white p-1 flex flex-wrap items-center gap-1 focus-within:border-blue-500`,children:[e.map(n=>(0,p.jsxs)(`span`,{className:`inline-flex items-center gap-1 bg-gray-100 text-gray-800 text-[11px] rounded px-1.5 py-0.5`,children:[n,(0,p.jsx)(`button`,{onClick:()=>t(e.filter(e=>e!==n)),className:`text-gray-500 hover:text-red-600`,children:(0,p.jsx)(f.X,{size:10})})]},n)),(0,p.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`||n.key===`,`?(n.preventDefault(),a()):n.key===`Backspace`&&!r&&e.length&&t(e.slice(0,-1))},onBlur:a,placeholder:e.length===0?n:``,className:`flex-1 min-w-20 outline-none text-xs bg-transparent px-1 py-0.5`})]})}function so({value:e,onChange:t}){let[n,r]=(0,l.useState)(()=>JSON.stringify(e,null,2)),[i,a]=(0,l.useState)(null);return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`textarea`,{value:n,onChange:e=>{let n=e.target.value;r(n);try{let e=JSON.parse(n||`{}`);a(null),t(e)}catch(e){a(String(e.message))}},rows:6,spellCheck:!1,className:`w-full font-mono text-[11px] border border-gray-200 rounded p-2 bg-gray-50 focus:border-blue-500 focus:outline-none`}),i&&(0,p.jsx)(`div`,{className:`text-[10px] text-red-600 mt-1`,children:i})]})}function co(){(0,l.useSyncExternalStore)(ja,Ma,Ma);let e=Oa()!==null,t=ka();return(0,l.useEffect)(()=>{e&&t.status===`idle`&&Aa()},[e,t.status]),{available:e,status:t.status,vouchers:t.vouchers,error:t.error,reload:()=>void Aa(!0)}}function lo(e){return e?.children?.find(e=>e.type===`text`&&e.role===`voucherCode`)}function uo(e){return!!lo(e)}function fo(e){let t=e?.data?.voucher;return t&&typeof t==`object`&&`code`in t?t:null}function po(e){return{id:e.id,title:e.title,code:e.code}}function mo({mod:e}){let t=M(e=>e.updateElement),n=M(e=>e.updateModule),{available:r,status:i,vouchers:a,error:o,reload:s}=co(),c=lo(e),l=fo(e),u=l&&a.some(e=>e.id===l.id)?l.id:``,d=r=>{if(!r){n(e.id,{data:{...e.data??{},voucher:void 0}});return}c&&t(e.id,c.id,{content:r.code}),n(e.id,{data:{...e.data??{},voucher:po(r)}})};return(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500`,children:[(0,p.jsx)(f.Ticket,{size:13,className:`text-blue-600`}),` Voucher`]}),r&&(0,p.jsxs)(`button`,{type:`button`,onClick:s,disabled:i===`loading`,className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded disabled:opacity-50`,title:`Reload vouchers`,children:[i===`loading`?(0,p.jsx)(f.Loader2,{size:12,className:`animate-spin`}):(0,p.jsx)(f.RefreshCw,{size:12}),`Reload`]})]}),r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`label`,{className:`block mb-2`,children:[(0,p.jsx)(`span`,{className:`block text-xs text-gray-600 mb-1`,children:`Select voucher`}),(0,p.jsxs)(`select`,{value:u,disabled:i===`loading`&&a.length===0,onChange:e=>{let t=a.find(t=>t.id===e.target.value)??null;d(t)},className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded bg-white focus:border-blue-500 focus:outline-none disabled:bg-gray-50`,children:[(0,p.jsx)(`option`,{value:``,children:i===`loading`&&a.length===0?`Loading vouchers…`:`Please select a voucher…`}),a.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),i===`error`&&(0,p.jsxs)(`p`,{className:`flex items-start gap-1 text-[11px] text-red-600 mb-2`,children:[(0,p.jsx)(f.AlertTriangle,{size:12,className:`mt-0.5 shrink-0`}),o??`Failed to load vouchers.`]}),i===`loaded`&&a.length===0&&(0,p.jsx)(`p`,{className:`text-[11px] text-gray-400 mb-2`,children:`No vouchers found.`}),l&&(0,p.jsxs)(`div`,{className:`rounded border border-green-200 bg-green-50 px-2.5 py-2 text-[12px] text-green-800`,children:[`Voucher code: `,(0,p.jsx)(`span`,{className:`font-semibold`,children:l.code})]})]}):(0,p.jsxs)(`p`,{className:`text-[11px] text-gray-400`,children:[`Register a voucher provider (`,(0,p.jsx)(`code`,{children:`voucherPlugin`}),`) to pick codes from your catalog. You can still edit the code text directly.`]})]})}function ho({open:e,onClose:t,onSave:n,initialQuery:r,title:i}){let[a,o]=(0,l.useState)(r??``),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1),v=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!e)return;o(r??``),h(null),d(null),_(!1);let n=setTimeout(()=>v.current?.focus(),40),i=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,i),()=>{clearTimeout(n),window.removeEventListener(`keydown`,i)}},[e,r,t]),!e)return null;let y=async()=>{let e=va(),t=a.trim();if(!(!e||!t||s)){c(!0),d(null),h(null),_(!0);try{let n=await e.search(t);h(n)}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,p.jsx)(`div`,{className:`fixed inset-0 z-50 flex bg-black/60 backdrop-blur-sm p-4`,children:(0,p.jsxs)(`div`,{className:`m-auto flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-2xl bg-white shadow-2xl`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-200 px-5 py-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(f.PackageSearch,{size:18,className:`text-blue-600`}),(0,p.jsx)(`h2`,{className:`text-base font-semibold text-neutral-900`,children:i??`Find a product`})]}),(0,p.jsx)(`button`,{onClick:t,className:`rounded-lg p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900`,"aria-label":`Close`,children:(0,p.jsx)(f.X,{size:18})})]}),(0,p.jsx)(`div`,{className:`border-b border-neutral-100 px-5 py-3`,children:(0,p.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,p.jsxs)(`div`,{className:`relative flex-1`,children:[(0,p.jsx)(f.Search,{size:15,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-400`}),(0,p.jsx)(`input`,{ref:v,value:a,onChange:e=>o(e.target.value),placeholder:`Search your catalog by name or SKU…`,className:`w-full rounded-lg border border-neutral-200 bg-white py-2 pl-9 pr-3 text-sm outline-none focus:border-blue-500`})]}),(0,p.jsxs)(`button`,{type:`submit`,disabled:s||!a.trim(),className:`flex shrink-0 items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:bg-neutral-300`,children:[s?(0,p.jsx)(f.Loader2,{size:15,className:`animate-spin`}):(0,p.jsx)(f.Search,{size:15}),`Search`]})]})}),(0,p.jsxs)(`div`,{className:`min-h-[220px] flex-1 overflow-y-auto p-5`,children:[s&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-sm text-neutral-500`,children:[(0,p.jsx)(f.Loader2,{size:22,className:`animate-spin`}),`Searching…`]}),!s&&u&&(0,p.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700`,children:u}),!s&&!u&&g&&!m&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-center text-sm text-neutral-500`,children:[(0,p.jsx)(f.PackageSearch,{size:22,className:`text-neutral-300`}),`No product matched β€œ`,a.trim(),`”. Try another name or SKU.`]}),!s&&!u&&!g&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-center text-sm text-neutral-400`,children:[(0,p.jsx)(f.PackageSearch,{size:22,className:`text-neutral-300`}),`Search your catalog, then preview and save the product.`]}),!s&&m&&(0,p.jsx)(go,{result:m})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-neutral-200 px-5 py-3`,children:[(0,p.jsx)(`button`,{onClick:t,className:`rounded-lg px-4 py-2 text-sm font-medium text-neutral-600 hover:bg-neutral-100`,children:`Cancel`}),(0,p.jsxs)(`button`,{onClick:()=>{m&&(n(m),t())},disabled:!m,className:`flex items-center gap-1.5 rounded-lg bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 disabled:bg-neutral-300`,children:[(0,p.jsx)(f.Check,{size:15}),` Save product`]})]})]})})}function go({result:e}){return(0,p.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-neutral-200`,children:[(0,p.jsx)(`div`,{className:`aspect-video w-full overflow-hidden bg-neutral-100`,children:e.image?(0,p.jsx)(`img`,{src:e.image,alt:e.imageAlt??e.name,className:`h-full w-full object-contain`}):(0,p.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-neutral-400`,children:`No image`})}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,p.jsx)(`div`,{className:`text-sm font-semibold text-neutral-900`,children:e.name}),e.stars!=null&&(0,p.jsxs)(`div`,{className:`flex items-center gap-0.5`,"aria-label":`${e.stars} out of 5`,children:[Array.from({length:5}).map((t,n)=>(0,p.jsx)(f.Star,{size:14,className:n<Math.round(e.stars??0)?`fill-amber-400 text-amber-400`:`text-neutral-300`},n)),(0,p.jsx)(`span`,{className:`ml-1 text-xs text-neutral-500`,children:e.stars})]}),(0,p.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[e.oldPrice&&(0,p.jsx)(`span`,{className:`text-sm text-neutral-400 line-through`,children:e.oldPrice}),(0,p.jsx)(`span`,{className:`text-lg font-bold text-blue-600`,children:e.finalPrice})]}),e.description&&(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-neutral-600`,children:e.description}),e.link&&(0,p.jsxs)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs text-blue-600 hover:underline`,children:[(0,p.jsx)(f.ExternalLink,{size:12}),` View source`]})]})]})}function _o(){return(0,l.useSyncExternalStore)(ya,ba,ba),va()!==null}function vo(){let{selection:e,doc:t,viewMode:n}=M(),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(!1);return r?(0,p.jsxs)(`div`,{className:`${a?`w-[576px]`:`w-72`} bg-white border-l border-gray-200 shrink-0 overflow-y-auto flex flex-col transition-all duration-200`,children:[(0,p.jsxs)(`div`,{className:`px-3 py-2 text-[11px] flex items-center gap-1.5 border-b shrink-0 ${n===`mobile`?`bg-amber-50 text-amber-800 border-amber-200`:`bg-blue-50 text-blue-800 border-blue-100`}`,children:[n===`mobile`?(0,p.jsx)(f.Smartphone,{size:12}):(0,p.jsx)(f.Monitor,{size:12}),(0,p.jsxs)(`span`,{className:`flex-1`,children:[`Editing `,n,` styles`]}),(0,p.jsx)(`button`,{onClick:()=>o(!a),title:a?`Narrow panel`:`Expand panel`,className:`p-0.5 rounded hover:bg-black/10 transition-colors ${n===`mobile`?`text-amber-700 hover:text-amber-900`:`text-blue-700 hover:text-blue-900`}`,children:a?(0,p.jsx)(f.ChevronsRight,{size:13}):(0,p.jsx)(f.ChevronsLeft,{size:13})}),(0,p.jsx)(`button`,{onClick:()=>i(!1),title:`Hide properties`,className:`p-0.5 rounded hover:bg-black/10 transition-colors ${n===`mobile`?`text-amber-700 hover:text-amber-900`:`text-blue-700 hover:text-blue-900`}`,children:(0,p.jsx)(f.PanelRightClose,{size:13})})]}),(0,p.jsx)(`div`,{className:`p-4 flex-1`,children:!e||e.kind===`email`?(0,p.jsx)(ko,{}):e.kind===`module`?(()=>{let n=t.modules.find(t=>t.id===e.moduleId);return n?(0,p.jsx)(Mo,{mod:n}):(0,p.jsx)(yo,{})})():(()=>{let n=t.modules.find(t=>t.id===e.moduleId),r=n?.children.find(t=>t.id===e.elementId);return n&&r?(0,p.jsx)(No,{mod:n,el:r}):(0,p.jsx)(yo,{})})()})]}):(0,p.jsx)(`div`,{className:`flex flex-col items-center w-6 bg-white border-l border-gray-200 shrink-0`,children:(0,p.jsx)(`button`,{onClick:()=>i(!0),title:`Show properties`,className:`flex items-center justify-center w-full py-3 text-gray-400 hover:text-gray-600 hover:bg-gray-50 transition-colors`,children:(0,p.jsx)(f.PanelRightOpen,{size:14})})})}function yo(){return(0,p.jsx)(`div`,{className:`text-xs text-gray-400`,children:`Nothing selected.`})}function bo(e,t){if(t!==`mobile`)return e;let n=e.mobile??{};return{...e,...n}}function xo(e,t,n){if(n!==`mobile`)return{...e,...t};let r=e.mobile??{};return{...e,mobile:{...r,...t}}}function So({overridden:e}){return e?(0,p.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wide bg-amber-100 text-amber-800 px-1 rounded`,children:`mobile`}):null}function Co({hideOn:e,onChange:t}){return(0,p.jsx)(Z,{label:`Visibility`,children:(0,p.jsxs)(Do,{value:e??``,onChange:e=>{let n=e.target.value;t(n===``?void 0:n)},children:[(0,p.jsx)(`option`,{value:``,children:`Show on all`}),(0,p.jsx)(`option`,{value:`mobile`,children:`Hide on mobile`}),(0,p.jsx)(`option`,{value:`desktop`,children:`Hide on desktop`})]})})}function wo({children:e}){return(0,p.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 mb-3`,children:e})}function Z({label:e,children:t}){return(0,p.jsxs)(`label`,{className:`block mb-3`,children:[(0,p.jsx)(`span`,{className:`flex items-center text-xs text-gray-600 mb-1`,children:e}),t]})}function Q(e){return(0,p.jsx)(`input`,{...e,className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none`})}function $(e){return(0,p.jsx)(Q,{type:`number`,...e})}function To({value:e,onChange:t,onAlt:n}){let r=za(),i=(0,l.useRef)(null),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),u=async e=>{if(r){o(!0),c(null);try{let i=await r.upload(e);t(i.url),i.alt&&n&&n(i.alt)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1),i.current&&(i.current.value=``)}}};return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(Q,{value:e??``,onChange:e=>t(e.target.value)}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&u(t)}}),(0,p.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i.current?.click(),className:`shrink-0 px-2 py-1.5 text-xs border border-gray-200 rounded hover:bg-gray-50 disabled:opacity-50 flex items-center gap-1`,title:`Upload image`,children:a?(0,p.jsx)(f.Loader2,{size:12,className:`animate-spin`}):(0,p.jsx)(f.Upload,{size:12})})]})]}),s&&(0,p.jsx)(`p`,{className:`text-[10px] text-red-600 mt-1`,children:s}),!r&&(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mt-1`,children:`Tip: register an image uploader plugin to enable file uploads.`})]})}function Eo({value:e,onChange:t,defaultValue:n}){let r=M(e=>e.doc.theme),i=typeof e==`string`&&e.startsWith(`{`),a=(0,l.useRef)(n&&n.startsWith(`{`)?n:i?e:void 0);(0,l.useEffect)(()=>{i?a.current=e:n&&n.startsWith(`{`)&&(a.current=n)},[e,i,n]);let o=(()=>{let t=x(e,r);return typeof t==`string`&&/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)?t.length===4?`#`+t.slice(1).split(``).map(e=>e+e).join(``):t:`#000000`})(),s=n??a.current,c=!!s&&s!==e,u=i?o:e??``,[d,m]=(0,l.useState)(u),h=(0,l.useRef)(u);return(0,l.useEffect)(()=>{let t=i?o:e??``;h.current=t,m(t)},[e,i,o]),(0,p.jsxs)(`div`,{className:`flex gap-1 items-center`,children:[(0,p.jsxs)(`label`,{className:`relative w-9 h-8 border border-gray-200 rounded cursor-pointer overflow-hidden shrink-0`,title:i?`Theme token (${e}) β†’ click to override`:`Pick color`,style:{background:o},children:[(0,p.jsx)(`input`,{type:`color`,value:o,onChange:e=>t(e.target.value),className:`absolute inset-0 opacity-0 cursor-pointer`}),i&&(0,p.jsx)(`span`,{className:`absolute inset-0 pointer-events-none border-2 border-dashed rounded`,style:{borderColor:`rgba(255,255,255,0.6)`}})]}),(0,p.jsx)(`input`,{value:d,onChange:e=>m(e.target.value),onBlur:()=>{d!==h.current&&(t(d),h.current=d)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`}),c&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>t(s),className:`shrink-0 p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded`,title:`Reset to theme token (${s})`,children:(0,p.jsx)(f.RotateCcw,{size:12})})]})}function Do(e){return(0,p.jsx)(`select`,{...e,className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white`})}function Oo({linkType:e,onChangeLinkType:t,onChangeLink:n}){return(0,p.jsxs)(Z,{label:`Link role`,children:[(0,p.jsxs)(Do,{value:e??``,onChange:e=>{let r=e.target.value;r===``?t(void 0):(t(r),n(be[r]))},children:[(0,p.jsx)(`option`,{value:``,children:`β€” None β€”`}),(0,p.jsx)(`option`,{value:`unsubscribe`,children:`Unsubscribe`}),(0,p.jsx)(`option`,{value:`view_in_browser`,children:`View in browser`}),(0,p.jsx)(`option`,{value:`manage_preferences`,children:`Manage preferences`}),(0,p.jsx)(`option`,{value:`user_profile`,children:`User profile`})]}),e&&(0,p.jsxs)(`p`,{className:`text-[10px] text-blue-600 mt-1 flex items-center gap-1`,children:[(0,p.jsx)(f.Tag,{size:10}),`Placeholder: `,(0,p.jsx)(`code`,{className:`font-mono`,children:be[e]})]})]})}function ko(){let{doc:e,updateMeta:t,updateSettings:n}=M();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Email`}),(0,p.jsx)(Z,{label:`Name`,children:(0,p.jsx)(Q,{value:e.meta.name,onChange:e=>t({name:e.target.value})})}),(0,p.jsx)(Z,{label:`Preview text`,children:(0,p.jsx)(Q,{value:e.meta.previewText,onChange:e=>t({previewText:e.target.value})})}),(0,p.jsx)(Z,{label:`Width (px)`,children:(0,p.jsx)($,{value:e.settings.width,onChange:e=>n({width:Number(e.target.value)||600})})}),(0,p.jsx)(Z,{label:`Background color`,children:(0,p.jsx)(Eo,{value:e.settings.backgroundColor,onChange:e=>n({backgroundColor:e})})}),(0,p.jsx)(Z,{label:`Content background color`,children:(0,p.jsx)(Eo,{value:e.settings.contentBackgroundColor,onChange:e=>n({contentBackgroundColor:e})})}),(0,p.jsx)(`div`,{className:`mt-6 pt-4 border-t border-gray-100`,children:(0,p.jsx)(Ao,{})})]})}function Ao(){let{doc:e,themes:t,applyTheme:n}=M(),r=e.theme,i=t.find(e=>e.id===r.id),a=i!=null&&Object.entries(r.tokens.colors).some(([e,t])=>i.tokens.colors[e]!==t),o=(e,t)=>{n({...r,tokens:{...r.tokens,colors:{...r.tokens.colors,[e]:t}}})};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsx)(wo,{children:`Theme`}),a&&(0,p.jsx)(`button`,{onClick:()=>i&&n(i),className:`text-[10px] text-blue-600 hover:underline mb-3`,title:`Discard color changes and restore the preset`,children:`Reset to preset`})]}),(0,p.jsx)(`div`,{className:`flex flex-col gap-1.5 mb-4`,children:t.map(e=>{let t=e.id===r.id;return(0,p.jsxs)(`button`,{onClick:()=>n(e),title:e.name,className:`flex items-center gap-2 px-2.5 py-2 rounded border text-xs transition-colors ${t?`border-blue-500 bg-blue-50 text-blue-700`:`border-gray-200 bg-white hover:border-gray-300 text-gray-700`}`,children:[(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.primary}}),(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.background}}),(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.text}}),(0,p.jsx)(`span`,{className:`flex-1 text-left`,children:e.name}),t&&(0,p.jsx)(f.Check,{size:12,className:`text-blue-600 shrink-0`})]},e.id)})}),(0,p.jsxs)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2`,children:[`Colors`,a&&(0,p.jsx)(`span`,{className:`ml-2 normal-case font-normal text-[10px] bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded`,children:`customised`})]}),(0,p.jsx)(`div`,{className:`flex flex-col gap-2`,children:Object.entries(r.tokens.colors).map(([e,t])=>(0,p.jsx)(jo,{label:e,value:t,onChange:t=>o(e,t)},e))})]})}function jo({label:e,value:t,onChange:n}){let[r,i]=(0,l.useState)(t);(0,l.useEffect)(()=>i(t),[t]);let a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)?t.length===4?`#`+t.slice(1).split(``).map(e=>e+e).join(``):t:`#000000`,o=e=>{let t=e.trim();t&&n(t)};return(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-xs text-gray-500 w-28 shrink-0 truncate`,title:e,children:e}),(0,p.jsx)(`label`,{className:`relative w-7 h-7 rounded border border-gray-200 cursor-pointer overflow-hidden shrink-0`,style:{background:a},title:`Pick ${e} color`,children:(0,p.jsx)(`input`,{type:`color`,value:a,onChange:e=>n(e.target.value),className:`absolute inset-0 opacity-0 cursor-pointer w-full h-full`})}),(0,p.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onBlur:()=>o(r),onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},className:`flex-1 min-w-0 px-2 py-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`,spellCheck:!1})]})}function Mo({mod:e}){let t=M(e=>e.updateModule),n=M(e=>e.viewMode),r=Na(e=>e.enabled),i=e.style??{},a=bo(i,n),o=new Set(Object.keys(i.mobile??{})),s=r=>t(e.id,{style:xo(i,r,n)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:e.name}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Background color`,(0,p.jsx)(So,{overridden:o.has(`backgroundColor`)})]}),children:(0,p.jsx)(Eo,{value:a.backgroundColor??``,onChange:e=>s({backgroundColor:e})})}),(0,p.jsx)(Po,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Border radius`,(0,p.jsx)(So,{overridden:o.has(`borderRadius`)})]}),children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>s({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(Co,{hideOn:i.hideOn,onChange:n=>t(e.id,{style:{...i,hideOn:n}})}),r&&Ka(e)&&(0,p.jsx)(Ya,{mod:e}),uo(e)&&(0,p.jsx)(mo,{mod:e})]})}function No({mod:e,el:t}){switch(t.type){case`text`:return(0,p.jsx)(Io,{mod:e,el:t});case`image`:return(0,p.jsx)(Lo,{mod:e,el:t});case`button`:return(0,p.jsx)(Ro,{mod:e,el:t});case`spacer`:return(0,p.jsx)(zo,{mod:e,el:t});case`divider`:return(0,p.jsx)(Bo,{mod:e,el:t});case`productGrid`:return(0,p.jsx)(Ho,{mod:e,el:t})}}function Po({style:e,mobileKeys:t,onSet:n}){return(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-2 mb-3`,children:[`paddingTop`,`paddingBottom`,`paddingLeft`,`paddingRight`].map(r=>(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[r.replace(`padding`,`Pad `),(0,p.jsx)(So,{overridden:!!t?.has(r)})]}),children:(0,p.jsx)($,{value:e[r]??0,onChange:e=>n({[r]:Number(e.target.value)})})},r))})}function Fo(e,t){let n=M(e=>e.updateElement);return r=>n(e.id,t.id,r)}function Io({mod:e,el:t}){let n=Fo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=bo(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:xo(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Text block`}),(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mb-3 leading-relaxed`,children:`Click the text in the canvas to edit it inline. Select words to apply bold, italic, colour, links and more using the floating toolbar.`}),(0,p.jsx)(Z,{label:`Default align`,children:(0,p.jsxs)(Do,{value:a.align??`left`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Line height`,children:(0,p.jsx)($,{step:.1,value:a.lineHeight??1.5,onChange:e=>s({lineHeight:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Letter spacing`,children:(0,p.jsx)($,{value:a.letterSpacing??0,onChange:e=>s({letterSpacing:Number(e.target.value)})})})]}),(0,p.jsx)(Po,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Co,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Lo({mod:e,el:t}){let n=Fo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=bo(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:xo(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Image`}),(0,p.jsx)(Z,{label:`Image URL`,children:(0,p.jsx)(To,{value:t.src,onChange:e=>n({src:e}),onAlt:e=>n({alt:e})})}),(0,p.jsx)(Z,{label:`Alt text`,children:(0,p.jsx)(Q,{value:t.alt??``,onChange:e=>n({alt:e.target.value})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link??``,onChange:e=>n({link:e.target.value})})}),(0,p.jsx)(Oo,{linkType:t.linkType,onChangeLinkType:e=>n({linkType:e}),onChangeLink:e=>n({link:e})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Width`,(0,p.jsx)(So,{overridden:o.has(`width`)})]}),children:(0,p.jsx)($,{value:a.width??0,onChange:e=>s({width:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Height`,(0,p.jsx)(So,{overridden:o.has(`height`)})]}),children:(0,p.jsx)($,{value:a.height??0,onChange:e=>s({height:Number(e.target.value)||void 0})})})]}),(0,p.jsx)(Z,{label:`Border radius`,children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>s({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Align`,children:(0,p.jsxs)(Do,{value:a.align??`center`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsx)(Po,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Co,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Ro({mod:e,el:t}){let n=Fo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=bo(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:xo(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Button`}),(0,p.jsx)(Z,{label:`Label`,children:(0,p.jsx)(Q,{value:t.label,onChange:e=>n({label:e.target.value})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link,onChange:e=>n({link:e.target.value})})}),(0,p.jsx)(Oo,{linkType:t.linkType,onChangeLinkType:e=>n({linkType:e}),onChangeLink:e=>n({link:e})}),(0,p.jsx)(Z,{label:`Background color`,children:(0,p.jsx)(Eo,{value:a.backgroundColor??``,onChange:e=>s({backgroundColor:e})})}),(0,p.jsx)(Z,{label:`Text color`,children:(0,p.jsx)(Eo,{value:a.color??`#FFFFFF`,onChange:e=>s({color:e})})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Font size`,children:(0,p.jsx)($,{value:a.fontSize??16,onChange:e=>s({fontSize:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Border radius`,children:(0,p.jsx)($,{value:a.borderRadius??6,onChange:e=>s({borderRadius:Number(e.target.value)})})})]}),(0,p.jsx)(Z,{label:`Align`,children:(0,p.jsxs)(Do,{value:a.align??`center`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsx)(Po,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Co,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function zo({mod:e,el:t}){let n=Fo(e,t);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Spacer`}),(0,p.jsx)(Z,{label:`Height (px)`,children:(0,p.jsx)($,{value:t.height,onChange:e=>n({height:Number(e.target.value)||0})})})]})}function Bo({mod:e,el:t}){let n=Fo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=bo(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:xo(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Divider`}),(0,p.jsx)(Z,{label:`Color`,children:(0,p.jsx)(Eo,{value:a.color??`#E5E7EB`,onChange:e=>s({color:e})})}),(0,p.jsx)(Z,{label:`Thickness`,children:(0,p.jsx)($,{value:a.thickness??1,onChange:e=>s({thickness:Number(e.target.value)})})}),(0,p.jsx)(Po,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Co,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Vo(e=0){let t=e+1;return{id:`p_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,image:`https://placehold.co/400x400?text=Product+${t}`,imageAlt:`Product ${t}`,name:`Product ${t}`,oldPrice:`$59`,finalPrice:`$39`,description:`Short product description.`,link:`#`}}function Ho({mod:e,el:t}){let n=Fo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=bo(i,r),o=e=>n({style:xo(i,e,r)}),s=e=>n({products:e}),c=e=>{let r=e,i=t.products.slice();if(i.length<r)for(;i.length<r;)i.push(Vo(i.length));n({columns:e,products:i})},u=_o(),[d,m]=(0,l.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{children:`Product Grid`}),(0,p.jsxs)(Z,{label:`Columns (desktop)`,children:[(0,p.jsx)(`div`,{className:`inline-flex bg-gray-100 rounded p-0.5 w-full`,children:[1,2,3].map(e=>(0,p.jsxs)(`button`,{onClick:()=>c(e),className:`flex-1 px-2 py-1 text-xs rounded ${t.columns===e?`bg-white shadow text-gray-900`:`text-gray-500 hover:text-gray-700`}`,children:[e,` `,e===1?`col`:`cols`]},e))}),(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mt-1`,children:`Always stacks to 1 column on mobile.`})]}),(0,p.jsx)(Wo,{label:`Show old price`,checked:t.showOldPrice,onChange:e=>n({showOldPrice:e})}),(0,p.jsx)(Wo,{label:`Show description`,checked:t.showDescription,onChange:e=>n({showDescription:e})}),(0,p.jsx)(Wo,{label:`Show stars`,checked:t.showStars??!1,onChange:e=>n({showStars:e})}),(0,p.jsx)(Wo,{label:`Show button`,checked:t.showButton,onChange:e=>n({showButton:e})}),(0,p.jsx)(Z,{label:`Default button label`,children:(0,p.jsx)(Q,{value:t.buttonLabel??``,placeholder:`Shop now`,onChange:e=>n({buttonLabel:e.target.value})})}),(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(wo,{children:[`Products (`,t.products.length,`)`]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u&&(0,p.jsxs)(`button`,{onClick:()=>m({index:null,query:``}),className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded`,title:`Find a product from your catalog`,children:[(0,p.jsx)(f.Search,{size:12}),` Find`]}),(0,p.jsxs)(`button`,{onClick:()=>s([...t.products,Vo(t.products.length)]),className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded`,title:`Add product`,children:[(0,p.jsx)(f.Plus,{size:12}),` Add`]})]})]}),t.products.map((e,n)=>(0,p.jsx)(Go,{index:n,product:e,canSearch:u,onSearch:()=>m({index:n,query:e.name}),onChange:e=>{let r=[...t.products];r[n]=e,s(r)},onDelete:()=>s(t.products.filter((e,t)=>t!==n))},e.id))]}),(0,p.jsx)(ho,{open:d!==null,initialQuery:d?.query,title:d?.index==null?`Add product from search`:`Replace product`,onClose:()=>m(null),onSave:e=>{let r=W({name:e.name,finalPrice:e.finalPrice,oldPrice:e.oldPrice,description:e.description,link:e.link,image:e.image,imageAlt:e.imageAlt,stars:e.stars}),i={};e.oldPrice&&!t.showOldPrice&&(i.showOldPrice=!0),e.description&&!t.showDescription&&(i.showDescription=!0),e.stars!=null&&!t.showStars&&(i.showStars=!0);let a=t.products.slice();if(d?.index!=null){let e=a[d.index];a[d.index]={...r,id:e.id,buttonLabel:e.buttonLabel}}else a.push(r);n({products:a,...i})}}),(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsx)(wo,{children:`Style`}),(0,p.jsx)(Z,{label:`Card background`,children:(0,p.jsx)(Eo,{value:a.cardBackgroundColor??``,onChange:e=>o({cardBackgroundColor:e})})}),(0,p.jsx)(Z,{label:`Name color`,children:(0,p.jsx)(Eo,{value:a.nameColor??``,onChange:e=>o({nameColor:e})})}),(0,p.jsx)(Z,{label:`Final price color`,children:(0,p.jsx)(Eo,{value:a.finalPriceColor??``,onChange:e=>o({finalPriceColor:e})})}),(0,p.jsx)(Z,{label:`Old price color`,children:(0,p.jsx)(Eo,{value:a.oldPriceColor??``,onChange:e=>o({oldPriceColor:e})})}),(0,p.jsx)(Z,{label:`Button background`,children:(0,p.jsx)(Eo,{value:a.buttonBackgroundColor??``,onChange:e=>o({buttonBackgroundColor:e})})}),(0,p.jsx)(Z,{label:`Button text color`,children:(0,p.jsx)(Eo,{value:a.buttonColor??``,onChange:e=>o({buttonColor:e})})}),(0,p.jsx)(Z,{label:`Card radius`,children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>o({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(Po,{style:a,onSet:o})]})]})}function Uo({checked:e,onChange:t}){return(0,p.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:n=>{n.preventDefault(),n.stopPropagation(),t(!e)},className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${e?`bg-blue-600`:`bg-gray-300`}`,children:(0,p.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?`translate-x-4`:`translate-x-0.5`}`})})}function Wo({label:e,checked:t,onChange:n}){return(0,p.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,p.jsx)(`span`,{className:`text-xs text-gray-600`,children:e}),(0,p.jsx)(Uo,{checked:t,onChange:n})]})}function Go({index:e,product:t,canSearch:n,onSearch:r,onChange:i,onDelete:a}){let o=e=>i({...t,...e});return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded p-2 mb-2 bg-gray-50`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(`span`,{className:`text-[11px] font-semibold text-gray-600`,children:[`#`,e+1]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(0,p.jsx)(`button`,{type:`button`,onClick:r,className:`text-gray-400 hover:text-blue-600`,title:`Replace from product search`,children:(0,p.jsx)(f.Search,{size:12})}),(0,p.jsx)(`button`,{type:`button`,onClick:a,className:`text-gray-400 hover:text-red-600`,title:`Remove product`,children:(0,p.jsx)(f.Trash2,{size:12})})]})]}),(0,p.jsx)(Z,{label:`Name`,children:(0,p.jsx)(Q,{value:t.name,onChange:e=>o({name:e.target.value})})}),(0,p.jsx)(Z,{label:`Image URL`,children:(0,p.jsx)(To,{value:t.image,onChange:e=>o({image:e}),onAlt:e=>o({imageAlt:e})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link??``,onChange:e=>o({link:e.target.value})})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Final price`,children:(0,p.jsx)(Q,{value:t.finalPrice,onChange:e=>o({finalPrice:e.target.value})})}),(0,p.jsx)(Z,{label:`Old price`,children:(0,p.jsx)(Q,{value:t.oldPrice??``,placeholder:`Optional`,onChange:e=>o({oldPrice:e.target.value||void 0})})})]}),(0,p.jsx)(Z,{label:`Description`,children:(0,p.jsx)(Q,{value:t.description??``,onChange:e=>o({description:e.target.value||void 0})})}),(0,p.jsx)(Z,{label:`Stars (0–5, optional)`,children:(0,p.jsx)($,{value:t.stars??``,min:0,max:5,step:.5,placeholder:`e.g. 4.5`,onChange:e=>o({stars:e.target.value===``?void 0:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Button label (override)`,children:(0,p.jsx)(Q,{value:t.buttonLabel??``,placeholder:`Inherit default`,onChange:e=>o({buttonLabel:e.target.value||void 0})})})]})}var Ko=[{type:`basic.text`,category:`basic`,name:`Text Block`,description:`Single editable paragraph of body copy. Use for short notes, intros, or filler text between sections.`,tags:[`text`,`paragraph`,`body`],create:()=>z(`basic.text`,`Text Block`,[P(`Write your text here.`,{role:`body`})])},{type:`basic.heading`,category:`basic`,name:`Heading`,description:`Bold standalone heading using the theme heading font. Use to introduce a section without other elements.`,tags:[`heading`,`title`,`section`],create:()=>z(`basic.heading`,`Heading`,[P(`A clear section heading`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingTop:16,paddingBottom:8,lineHeight:1.25})])},{type:`basic.image`,category:`basic`,name:`Image`,description:`Single full-width image, centered. Use for hero photography, illustrations, or screenshots.`,tags:[`image`,`media`,`photo`],create:()=>z(`basic.image`,`Image`,[F(U(600,300),`Placeholder`)])},{type:`basic.image_caption`,category:`basic`,name:`Image with Caption`,description:`Image followed by a small italicized caption underneath. Editorial style for newsletters.`,tags:[`image`,`caption`,`editorial`],create:()=>z(`basic.image_caption`,`Image + Caption`,[F(U(600,360),`Photo`),P(`Photo: caption goes here.`,{color:`{colors.muted}`,fontSize:13,align:`center`,paddingTop:4,paddingBottom:16})])},{type:`basic.spacer`,category:`basic`,name:`Spacer`,description:`Empty vertical space. Use to separate modules with breathing room.`,tags:[`spacer`,`spacing`,`gap`],create:()=>z(`basic.spacer`,`Spacer`,[L(32)])},{type:`basic.divider`,category:`basic`,name:`Divider`,description:`Thin horizontal rule across the email. Use to visually separate sections.`,tags:[`divider`,`separator`,`rule`],create:()=>z(`basic.divider`,`Divider`,[R()])}],qo=[{type:`header.logo`,category:`header`,name:`Logo Centered`,description:`Centered brand logo. The simplest header used at the top of almost every newsletter.`,tags:[`logo`,`brand`,`centered`],create:()=>z(`header.logo`,`Logo Header`,[F(U(180,56,`LOGO`),`Logo`,{width:180,paddingTop:24,paddingBottom:24})])},{type:`header.logo_left_date_right`,category:`header`,name:`Logo Left + Date Right`,description:`Two-column header with logo on the left and a date or issue label on the right. Common for periodical newsletters and digests.`,tags:[`logo`,`date`,`issue`,`publication`,`newsletter`],create:()=>z(`header.logo_left_date_right`,`Logo + Date`,[F(U(140,36,`LOGO`),`Logo`,{width:140,align:`left`,paddingTop:16,paddingBottom:16}),P(`Issue #128 Β· April 29, 2026`,{color:`{colors.muted}`,fontSize:13,align:`right`,paddingTop:0,paddingBottom:16}),R({paddingTop:0,paddingBottom:0})])},{type:`header.publication`,category:`header`,name:`Publication Masthead`,description:`Editorial masthead with publication name in serif type, tagline, and a divider. Mimics print magazine and newspaper newsletters.`,tags:[`masthead`,`publication`,`editorial`,`serif`,`newspaper`,`magazine`],create:()=>z(`header.publication`,`Masthead`,[P(`THE WEEKLY`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,letterSpacing:6,paddingTop:32,paddingBottom:4}),P(`Curated reading for thoughtful people`,{color:`{colors.muted}`,align:`center`,fontSize:13,paddingBottom:16}),R({paddingTop:0,paddingBottom:0})])},{type:`header.hero`,category:`header`,name:`Hero with Headline & Image`,description:`Big headline, subtitle and a wide hero image. Use for the lead story or campaign announcement.`,tags:[`hero`,`headline`,`image`,`lead`,`feature`],create:()=>z(`header.hero`,`Hero`,[P(`Steps Towards a Greener World`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,paddingTop:32,lineHeight:1.2}),P(`Small actions, big impact.`,{color:`{colors.muted}`,align:`center`,paddingBottom:16}),F(U(560,280,`Hero`),`Hero`,{width:560})])},{type:`header.hero_text_only`,category:`header`,name:`Hero Text Only`,description:`Centered eyebrow + large headline + supporting paragraph, no image. Editorial intro for opinion or essay newsletters.`,tags:[`hero`,`text`,`essay`,`editorial`,`minimal`],create:()=>z(`header.hero_text_only`,`Hero Text`,[P(`ESSAY Β· ISSUE 42`,{fontSize:12,fontWeight:`bold`,color:`{colors.primary}`,letterSpacing:3,align:`center`,paddingTop:32,paddingBottom:8}),P(`On building things slowly`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:40,fontWeight:`bold`,align:`center`,lineHeight:1.15,paddingBottom:8}),P(`Why patience and craft still win in a world of shortcuts.`,{color:`{colors.muted}`,align:`center`,fontSize:16,paddingBottom:32})])},{type:`header.announcement`,category:`header`,name:`Announcement Bar`,description:`Thin colored top bar with a single line of promotional text. Use for free shipping, sales, or alerts.`,tags:[`announcement`,`bar`,`promo`,`alert`],create:()=>z(`header.announcement`,`Announcement`,[P(`✨ Free shipping on orders over $50`,{color:`{colors.buttonText}`,align:`center`,fontSize:14,paddingTop:12,paddingBottom:12})],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`header.logo_with_view_browser`,category:`header`,name:`Logo + View in Browser`,description:`Logo with a small 'View in browser' link above it. Standard for marketing newsletters that may render poorly.`,tags:[`logo`,`view-in-browser`,`marketing`,`preheader`],create:()=>z(`header.logo_with_view_browser`,`Logo + Browser Link`,[P(`View in browser`,{color:`{colors.muted}`,fontSize:11,align:`right`,paddingTop:8,paddingBottom:0,link:`#`}),F(U(160,48,`LOGO`),`Logo`,{width:160,paddingTop:8,paddingBottom:16})])},{type:`header.welcome`,category:`header`,name:`Welcome Header`,description:`Friendly greeting with first name placeholder, used at the top of welcome and onboarding emails.`,tags:[`welcome`,`onboarding`,`greeting`,`personalized`],create:()=>z(`header.welcome`,`Welcome`,[P(`πŸ‘‹ Welcome aboard, {{first_name}}`,{fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,align:`center`,paddingTop:32,paddingBottom:8}),P(`We're glad you're here. Here's what to do next.`,{color:`{colors.muted}`,align:`center`,paddingBottom:16})])},{type:`header.logo_with_tagline`,category:`header`,name:`Logo + Tagline`,description:`Centered logo above a one-line tagline. Friendly brand-forward header.`,tags:[`logo`,`tagline`,`brand`],create:()=>z(`header.logo_with_tagline`,`Logo + Tagline`,[F(U(160,48,`LOGO`),`Logo`,{width:160,paddingTop:24,paddingBottom:4}),P(`Newsletters that respect your time.`,{align:`center`,color:`{colors.muted}`,fontSize:14,paddingBottom:24})])},{type:`header.story_label`,category:`header`,name:`Story Label Header`,description:`Small category label (e.g. 'Top story', 'Deep dive') above the masthead. Used by The Hustle, Morning Brew style newsletters.`,tags:[`label`,`category`,`story`,`newsletter`,`topic`],create:()=>z(`header.story_label`,`Story Label`,[P(`TODAY'S TOP STORY`,{color:`{colors.primary}`,fontSize:12,fontWeight:`bold`,letterSpacing:3,align:`center`,paddingTop:24,paddingBottom:4}),P(`AI editing tools come for the inbox`,{fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,align:`center`,paddingBottom:16,lineHeight:1.2})])}],Jo=[{type:`menu.horizontal`,category:`menu`,name:`Horizontal Nav`,description:`Horizontal menu with 3-5 inline links separated by dots. Common publication navigation under the masthead.`,tags:[`menu`,`nav`,`horizontal`,`publication`],create:()=>z(`menu.horizontal`,`Horizontal Menu`,[P(`Home Β· Articles Β· Podcast Β· About Β· Subscribe`,{align:`center`,color:`{colors.text}`,fontSize:13,paddingTop:12,paddingBottom:12})])},{type:`menu.sections`,category:`menu`,name:`Section Tabs`,description:`Linked section labels representing the contents of today's issue (e.g. News Β· Markets Β· Tech Β· Culture). Used by daily digests.`,tags:[`menu`,`sections`,`tabs`,`digest`,`daily`],create:()=>z(`menu.sections`,`Section Tabs`,[R({paddingTop:0,paddingBottom:8}),P(`NEWS Β· MARKETS Β· TECH Β· CULTURE Β· WEEKEND`,{align:`center`,color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,paddingTop:0,paddingBottom:8}),R({paddingTop:0,paddingBottom:8})])},{type:`menu.in_this_issue`,category:`menu`,name:`In This Issue`,description:`Table-of-contents box listing the items in this newsletter issue with anchor links. Helps readers scan long emails.`,tags:[`toc`,`menu`,`issue`,`summary`,`table of contents`],create:()=>z(`menu.in_this_issue`,`In This Issue`,[P(`IN THIS ISSUE`,{fontSize:11,fontWeight:`bold`,color:`{colors.muted}`,letterSpacing:2,paddingTop:16,paddingBottom:8}),P(`β†’ Lead story: AI in the inbox`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#lead`}),P(`β†’ 3 things worth your time`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#picks`}),P(`β†’ Reader question of the week`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#qa`}),P(`β†’ Upcoming events`,{fontSize:14,paddingTop:2,paddingBottom:16,link:`#events`})],{backgroundColor:`{colors.background}`,paddingTop:8,paddingBottom:8,paddingLeft:16,paddingRight:16})},{type:`menu.cta_strip`,category:`menu`,name:`Linked Action Strip`,description:`Three short text actions in a row (e.g. 'Read Β· Share Β· Reply'). Light alternative to a button bar.`,tags:[`menu`,`actions`,`links`,`strip`],create:()=>z(`menu.cta_strip`,`Action Strip`,[P(`Read online Β· Share Β· Reply with feedback`,{align:`center`,color:`{colors.primary}`,fontSize:13,paddingTop:12,paddingBottom:12})])}],Yo=[{type:`content.headline_body`,category:`content`,name:`Headline + Body`,description:`Section title with one paragraph of body text. The most generic written content block.`,tags:[`headline`,`body`,`paragraph`,`article`],create:()=>z(`content.headline_body`,`Headline + Body`,[B(`A compelling headline`,{paddingTop:24}),P(`Tell your story with a clear, concise paragraph. Keep readers engaged with short sentences and meaningful detail.`,{paddingBottom:24})])},{type:`content.lead_story`,category:`content`,name:`Lead Story`,description:`Top story of the issue: eyebrow label, big headline, hero image, lead paragraph and a 'Continue reading' link. Used by news and editorial newsletters.`,tags:[`lead`,`story`,`feature`,`news`,`editorial`,`long-form`],create:()=>z(`content.lead_story`,`Lead Story`,[V(`Lead story`),B(`Inside the new wave of indie publishers`,{level:1,paddingBottom:4}),H(`By Jane Doe Β· 6 min read`,{fontSize:13}),F(U(560,320,`Lead`),`Lead`,{width:560,paddingTop:12}),P(`A growing group of writers are leaving big media to build their own readerships, betting that quality and a direct relationship beat scale.`,{paddingTop:16}),P(`Continue reading β†’`,{color:`{colors.primary}`,fontWeight:`bold`,paddingTop:4,paddingBottom:24,link:`#`})])},{type:`content.article_summary`,category:`content`,name:`Article Summary Card`,description:`Compact link-out card: image on top, category label, title, one-line summary, and 'Read more'. Use repeatedly to list secondary articles.`,tags:[`article`,`summary`,`card`,`link-out`,`newsletter`],create:()=>z(`content.article_summary`,`Article Card`,[F(U(560,280,`Article`),`Article`,{width:560}),P(`CULTURE`,{color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,paddingTop:12,paddingBottom:4}),B(`How long-form writing made a comeback`,{paddingTop:0,paddingBottom:4}),P(`Why subscribers are paying for slower, deeper coverage β€” and what it means for publishers.`,{paddingBottom:8}),P(`Read more β†’`,{color:`{colors.primary}`,fontWeight:`bold`,paddingBottom:24,link:`#`})])},{type:`content.image_text`,category:`content`,name:`Image + Text Beside`,description:`Image with article title and short summary stacked below. Standard editorial card.`,tags:[`image`,`text`,`article`,`stacked`],create:()=>z(`content.image_text`,`Image + Text`,[F(U(560,300,`Article`),`Article`,{width:560}),B(`Article title`,{paddingTop:16,paddingBottom:4}),P(`A short summary of the article goes here, two or three lines is plenty.`)])},{type:`content.two_column_articles`,category:`content`,name:`Two Column Stories`,description:`Two short article previews shown side-by-side as stacked blocks (renders as full-width on mobile). Use to tease two related stories.`,tags:[`two-column`,`articles`,`side-by-side`,`preview`],create:()=>z(`content.two_column_articles`,`Two Stories`,[V(`More to read`),F(U(272,180,`Story A`),`Story A`,{width:272}),P(`Story A title`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),P(`One sentence about story A.`,{fontSize:14,paddingBottom:16}),F(U(272,180,`Story B`),`Story B`,{width:272}),P(`Story B title`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),P(`One sentence about story B.`,{fontSize:14,paddingBottom:16})])},{type:`content.three_picks`,category:`content`,name:`Three Picks (Numbered)`,description:`Numbered list of three short recommendations or links. Used by curators ('3 things to read this week').`,tags:[`list`,`picks`,`curated`,`links`,`recommendations`],create:()=>z(`content.three_picks`,`Three Picks`,[V(`Three picks`),P(`01 / How to stay focused in 2026`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`Notes on attention, deep work, and the slow internet.`,{fontSize:14}),R({paddingTop:12,paddingBottom:8}),P(`02 / The case for boring software`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`Why teams are returning to simpler, predictable tools.`,{fontSize:14}),R({paddingTop:12,paddingBottom:8}),P(`03 / A short history of the inbox`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`From memos to MIME, and what comes next.`,{fontSize:14,paddingBottom:24})])},{type:`content.quote`,category:`content`,name:`Pull Quote`,description:`Centered serif pull quote with attribution. Adds rhythm to long editorial newsletters.`,tags:[`quote`,`pull-quote`,`editorial`,`attribution`],create:()=>z(`content.quote`,`Pull Quote`,[P(`β€œThe best way to predict the future is to create it.”`,{fontFamily:`{fonts.heading}`,fontSize:22,align:`center`,paddingTop:24,lineHeight:1.4}),P(`β€” Peter Drucker`,{color:`{colors.muted}`,align:`center`,paddingBottom:24})])},{type:`content.author_byline`,category:`content`,name:`Author Byline`,description:`Round avatar + author name + role on one line. Drop above or below an article body for personal newsletters.`,tags:[`author`,`byline`,`avatar`,`personal`],create:()=>z(`content.author_byline`,`Byline`,[F(U(64,64,`πŸ‘€`),`Author`,{width:64,borderRadius:32,paddingTop:16,paddingBottom:0}),P(`Jane Doe`,{align:`center`,fontWeight:`bold`,paddingTop:8,paddingBottom:0}),H(`Editor, The Weekly`,{align:`center`,fontSize:13}),L(16)])},{type:`content.editor_note`,category:`content`,name:`Editor's Note`,description:`Personal letter-style block: 'Hi {{first_name}}', a few paragraphs and a sign-off. Ideal for newsletters with a strong author voice.`,tags:[`editor`,`note`,`letter`,`personal`,`voice`],create:()=>z(`content.editor_note`,`Editor's Note`,[P(`Hi {{first_name}},`,{paddingTop:24,paddingBottom:8}),P(`This week I've been thinking about what makes a newsletter feel like a letter rather than a broadcast. Spoiler: it's not the format, it's the tone.`,{paddingBottom:8,lineHeight:1.7}),P(`Let me know what you think β€” just hit reply.`,{paddingBottom:8,lineHeight:1.7}),P(`β€” Jane`,{fontFamily:`{fonts.heading}`,paddingBottom:24})])},{type:`content.tip_box`,category:`content`,name:`Tip / Callout Box`,description:`Highlighted background box with an icon, short title and one-paragraph tip. Use for 'pro tips', notes, and warnings.`,tags:[`tip`,`callout`,`box`,`highlight`,`note`],create:()=>z(`content.tip_box`,`Tip Box`,[P(`πŸ’‘ PRO TIP`,{color:`{colors.primary}`,fontSize:12,fontWeight:`bold`,letterSpacing:2,paddingTop:16,paddingBottom:4}),P(`Always preview your email on mobile before sending β€” most opens happen there.`,{paddingBottom:16})],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:16})},{type:`content.numbered_list`,category:`content`,name:`Numbered List`,description:`Vertical numbered list of 4-5 short items with optional sub-text. Use for tutorials, checklists and 'how-to' newsletters.`,tags:[`list`,`numbered`,`tutorial`,`checklist`,`how-to`],create:()=>z(`content.numbered_list`,`Numbered List`,[B(`How to do it in 4 steps`,{paddingTop:16,paddingBottom:12}),P(`1. Define the goal`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),H(`Write down the outcome in one sentence.`),P(`2. List constraints`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Time, budget, scope. Be specific.`),P(`3. Plan the smallest version`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`What can you ship this week?`),P(`4. Ship it`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Refine after real feedback.`,{fontSize:14}),L(16)])},{type:`content.bullet_list`,category:`content`,name:`Bullet List`,description:`Simple unordered list of takeaways or facts. Concise summary block.`,tags:[`list`,`bullets`,`takeaways`,`summary`],create:()=>z(`content.bullet_list`,`Bullets`,[B(`Key takeaways`,{paddingTop:16,paddingBottom:8}),P(`β€’ Newsletters are growing 20% YoY`,{paddingTop:2,paddingBottom:2}),P(`β€’ Mobile opens crossed 70%`,{paddingTop:2,paddingBottom:2}),P(`β€’ Plain-text emails outperform image-heavy ones in B2B`,{paddingTop:2,paddingBottom:2}),P(`β€’ Personalization drives 2x click-through`,{paddingTop:2,paddingBottom:16})])},{type:`content.qa`,category:`content`,name:`Q&A Block`,description:`Question in bold followed by an answer paragraph. Use for FAQ, reader mailbags, or AMAs.`,tags:[`qa`,`faq`,`ama`,`mailbag`,`reader-questions`],create:()=>z(`content.qa`,`Q&A`,[V(`Reader question`),P(`Q: How do I get my first 100 subscribers?`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:4,paddingBottom:8,lineHeight:1.3}),P(`A: Tell ten people who already know you. Then ask each of them to forward to one friend. The first 100 don't come from algorithms β€” they come from your network.`,{paddingBottom:24,lineHeight:1.7})])},{type:`content.stats_row`,category:`content`,name:`Stat Row`,description:`Big numbers with short labels (e.g. '12k readers Β· 4.8β˜… rating Β· 96% open rate'). Used for impact summaries and social proof.`,tags:[`stats`,`numbers`,`metrics`,`social-proof`],create:()=>z(`content.stats_row`,`Stat Row`,[V(`By the numbers`,{align:`center`}),P(`12,400`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,color:`{colors.primary}`,paddingTop:4,paddingBottom:0}),H(`active readers this month`,{align:`center`,fontSize:13}),L(8),P(`96% Β· 4.8β˜… Β· 32 issues shipped`,{align:`center`,color:`{colors.text}`,fontSize:14,paddingBottom:24})])},{type:`content.timeline`,category:`content`,name:`Timeline / What Happened`,description:`Chronological list of recent events with dates. Used by news roundups and changelog newsletters.`,tags:[`timeline`,`changelog`,`news`,`events`,`what-happened`],create:()=>z(`content.timeline`,`Timeline`,[V(`This week`),P(`Mon Β· Acme launches plan B`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`After 6 months of beta testing.`,{fontSize:14}),P(`Wed Β· New funding round announced`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`$24M Series A led by Foundry.`,{fontSize:14}),P(`Fri Β· Industry report drops`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Open rates up across the board.`,{fontSize:14,paddingBottom:24})])},{type:`content.podcast_episode`,category:`content`,name:`Podcast Episode`,description:`Episode artwork, episode number, title, short description and a 'Listen' button. For shows that announce episodes by email.`,tags:[`podcast`,`episode`,`audio`,`listen`,`show`],create:()=>z(`content.podcast_episode`,`Podcast Episode`,[F(U(220,220,`Cover`),`Cover`,{width:220,borderRadius:12}),P(`EPISODE 042`,{color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,align:`center`,paddingTop:12,paddingBottom:4}),B(`Why publishers are betting on email`,{align:`center`,paddingTop:0,paddingBottom:4}),H(`With Jane Doe Β· 38 min`,{align:`center`,fontSize:13}),I(`Listen now`,`https://example.com`),L(16)])},{type:`content.video_thumbnail`,category:`content`,name:`Video Thumbnail`,description:`Video thumbnail with overlay-feeling play button (image only, links to a hosted player). Title and duration below.`,tags:[`video`,`thumbnail`,`watch`,`play`,`media`],create:()=>z(`content.video_thumbnail`,`Video`,[F(U(560,315,`β–Ά Watch`),`Video`,{width:560,link:`#`,borderRadius:8}),B(`Watch: a guided tour of our 2026 launches`,{paddingTop:12,paddingBottom:4}),H(`4 min watch`,{fontSize:13,paddingBottom:16})])},{type:`content.event_card`,category:`content`,name:`Event Card`,description:`Date badge with event title, location, time and an RSVP button. For event-driven newsletters and community digests.`,tags:[`event`,`rsvp`,`community`,`date`,`card`],create:()=>z(`content.event_card`,`Event`,[P(`MAY`,{align:`center`,color:`{colors.buttonText}`,fontSize:12,fontWeight:`bold`,letterSpacing:2,paddingTop:12,paddingBottom:0}),P(`12`,{align:`center`,color:`{colors.buttonText}`,fontSize:36,fontWeight:`bold`,paddingTop:0,paddingBottom:12})],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`content.code_block`,category:`content`,name:`Code Snippet`,description:`Monospaced code block on a tinted background. For developer newsletters and changelog excerpts.`,tags:[`code`,`snippet`,`developer`,`monospace`,`changelog`],create:()=>z(`content.code_block`,`Code`,[P(`npm install @one-million-lines/email-builder`,{fontFamily:`Menlo, Consolas, monospace`,fontSize:13,color:`{colors.text}`,paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16})],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:16})}],Xo=[{type:`feature.list`,category:`feature`,name:`Checkmark Feature List`,description:`Centered title with 3-4 short checkmarked benefits. Good for product newsletters and onboarding emails.`,tags:[`features`,`benefits`,`checkmarks`,`list`],create:()=>z(`feature.list`,`Feature List`,[B(`Why people love it`,{align:`center`,paddingTop:24}),P(`βœ“ Fast and reliable`,{align:`center`}),P(`βœ“ Beautiful out of the box`,{align:`center`}),P(`βœ“ Backed by humans, not bots`,{align:`center`,paddingBottom:24})])},{type:`feature.icon_three`,category:`feature`,name:`Three Icon Features`,description:`Three stacked feature blocks with an emoji/icon, short title and one-line description. Use to highlight 3 product capabilities.`,tags:[`features`,`icons`,`three-up`,`product`],create:()=>z(`feature.icon_three`,`Three Features`,[P(`⚑`,{align:`center`,fontSize:32,paddingTop:24,paddingBottom:4}),P(`Fast`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Built to render in milliseconds.`,{align:`center`,fontSize:14}),L(16),P(`🧩`,{align:`center`,fontSize:32,paddingBottom:4}),P(`Modular`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Compose any layout from blocks.`,{align:`center`,fontSize:14}),L(16),P(`πŸ€–`,{align:`center`,fontSize:32,paddingBottom:4}),P(`AI-ready`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Edit emails as JSON, not HTML.`,{align:`center`,fontSize:14,paddingBottom:24})])},{type:`feature.before_after`,category:`feature`,name:`Before / After`,description:`Two stacked images labeled 'Before' and 'After'. For product transformations, redesigns and case studies.`,tags:[`before-after`,`comparison`,`case-study`,`transformation`],create:()=>z(`feature.before_after`,`Before / After`,[V(`Before`),F(U(560,280,`Before`),`Before`,{width:560}),L(8),V(`After`),F(U(560,280,`After`),`After`,{width:560}),L(16)])},{type:`feature.benefit_pair`,category:`feature`,name:`Image + Benefit Pair`,description:`Repeat-use block: one supporting image plus a title and benefit paragraph beside it. Stack 2-3 of these for a feature tour.`,tags:[`benefit`,`feature`,`image-text`,`pair`],create:()=>z(`feature.benefit_pair`,`Benefit Pair`,[F(U(560,240,`Feature`),`Feature`,{width:560,paddingTop:16}),B(`Send 10x faster`,{paddingTop:12,paddingBottom:4}),P(`Reusable modules and theme tokens let teams ship campaigns in minutes, not days.`,{paddingBottom:24})])},{type:`feature.testimonial`,category:`feature`,name:`Testimonial`,description:`Customer quote in large type with avatar and attribution. Social proof block.`,tags:[`testimonial`,`review`,`social-proof`,`customer`],create:()=>z(`feature.testimonial`,`Testimonial`,[P(`β€œThis cut our email production from a week to an afternoon.”`,{fontFamily:`{fonts.heading}`,fontSize:22,align:`center`,paddingTop:24,paddingBottom:12,lineHeight:1.4}),F(U(56,56,`πŸ‘€`),`Customer`,{width:56,borderRadius:28}),P(`Alex Kim Β· Head of Lifecycle, Acme`,{align:`center`,color:`{colors.muted}`,fontSize:13,paddingTop:4,paddingBottom:24})])},{type:`feature.logo_strip`,category:`feature`,name:`Customer Logo Strip`,description:`Small horizontal row implying customer logos for credibility ('Trusted by'). Logos shown as a placeholder image.`,tags:[`logos`,`trusted-by`,`social-proof`,`strip`],create:()=>z(`feature.logo_strip`,`Logo Strip`,[H(`TRUSTED BY`,{align:`center`,fontSize:11}),F(U(520,60,`LOGOS`),`Customer logos`,{width:520,paddingTop:8,paddingBottom:16})])},{type:`feature.gradient_hero`,category:`feature`,name:`Gradient Hero CTA`,description:`Bold centered hero with an eyebrow, oversized headline and a primary CTA button. Great for launch announcements and campaign openers.`,tags:[`hero`,`launch`,`cta`,`bold`,`announcement`],create:()=>z(`feature.gradient_hero`,`Gradient Hero CTA`,[V(`Introducing`,{align:`center`}),B(`Something new is here`,{level:1,align:`center`,paddingTop:4,paddingBottom:8}),P(`A fresh way to reach your audience β€” crafted for the inbox.`,{align:`center`,color:`{colors.muted}`,fontSize:16,paddingBottom:20}),I(`Explore now`,`#`,{align:`center`})],{backgroundColor:`{colors.surface}`,paddingTop:40,paddingBottom:40})},{type:`feature.pull_quote`,category:`feature`,name:`Pull Quote`,description:`Large centered quotation with an attribution line. Use to highlight a testimonial or a memorable line.`,tags:[`quote`,`testimonial`,`highlight`,`pull-quote`],create:()=>z(`feature.pull_quote`,`Pull Quote`,[P(`β€œThis is the fastest we’ve ever shipped a campaign.”`,{fontFamily:`{fonts.heading}`,fontSize:24,align:`center`,lineHeight:1.4,paddingTop:28,paddingBottom:8}),H(`β€” A very happy customer`,{align:`center`,paddingBottom:28})])},{type:`feature.stat_row`,category:`feature`,name:`Stat Row`,description:`Three short number + label pairs in a row. Use to show traction, metrics or highlights.`,tags:[`stats`,`metrics`,`numbers`,`row`,`kpi`],create:()=>z(`feature.stat_row`,`Stat Row`,[B(`By the numbers`,{align:`center`,paddingTop:24}),P(`<b>10k+</b> subscribers &nbsp;Β·&nbsp; <b>98%</b> delivery &nbsp;Β·&nbsp; <b>4.9β˜…</b> rating`,{align:`center`,color:`{colors.muted}`,paddingBottom:24})])},{type:`feature.single_product_spotlight`,category:`feature`,name:`Single Product Spotlight`,description:`One product with image, name, price and buy button. Use to feature a hero product in a feature-focused email.`,tags:[`product`,`spotlight`,`single`,`buy`,`shop`,`ecommerce`],create:()=>z(`feature.single_product_spotlight`,`Product Spotlight`,[G([W({name:`The Signature Bag`,finalPrice:`$129`,oldPrice:`$159`,description:`Handmade, built to last.`,image:U(520,520,`Product`)})],{columns:1,showDescription:!0,buttonLabel:`Buy now`})])},{type:`feature.pill_nav`,category:`feature`,name:`Pill Navigation`,description:`Centered row of navigation links with a divider below. Compact feature nav block for use inside email content sections.`,tags:[`menu`,`nav`,`links`,`pill`],create:()=>z(`feature.pill_nav`,`Pill Navigation`,[F(U(120,32,`LOGO`),`Logo`,{width:120,paddingBottom:8}),P(`<a href="#">Shop</a> &nbsp; <a href="#">New</a> &nbsp; <a href="#">Sale</a> &nbsp; <a href="#">About</a>`,{align:`center`,color:`{colors.primary}`,paddingBottom:8}),R({paddingTop:4,paddingBottom:0})])}],Zo=[{type:`cta.simple`,category:`call_to_action`,name:`Simple CTA`,description:`Centered headline + body + primary button. The default call-to-action block for any newsletter or promo.`,tags:[`cta`,`primary`,`centered`,`button`],create:()=>z(`cta.simple`,`Simple CTA`,[B(`Ready to get started?`,{align:`center`,paddingTop:24}),H(`Create better emails faster.`,{align:`center`}),I(`Start now`,`https://example.com`),L(16)])},{type:`cta.banner`,category:`call_to_action`,name:`Colored Banner CTA`,description:`Full-width colored band with eyebrow, big headline and a contrasting button. Use to draw attention to sales or launches.`,tags:[`cta`,`banner`,`colored`,`promo`,`sale`],create:()=>z(`cta.banner`,`CTA Banner`,[P(`Limited time offer`,{color:`{colors.buttonText}`,align:`center`,fontSize:14,paddingTop:24,paddingBottom:4}),P(`Save 30% this week only`,{color:`{colors.buttonText}`,align:`center`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingBottom:16}),I(`Shop the sale`),L(24)],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`cta.button_only`,category:`call_to_action`,name:`Button Only`,description:`Single primary button on a clean background. Use as a follow-up CTA after a content block.`,tags:[`cta`,`button`,`minimal`],create:()=>z(`cta.button_only`,`Button`,[I(`Click here`,`https://example.com`)])},{type:`cta.dual_button`,category:`call_to_action`,name:`Two Button Choice`,description:`Two side-by-side actions: a primary and a ghost-styled secondary. Use when offering 'Learn more' vs 'Get started'.`,tags:[`cta`,`buttons`,`two-options`,`choice`],create:()=>z(`cta.dual_button`,`Two Buttons`,[B(`Pick your path`,{align:`center`,paddingTop:24}),H(`Choose what fits your team.`,{align:`center`}),I(`Get started`,`https://example.com`),I(`Learn more`,`https://example.com`,{backgroundColor:`transparent`,color:`{colors.primary}`}),L(16)])},{type:`cta.image_overlay`,category:`call_to_action`,name:`Image + Overlay CTA`,description:`Lead image with a headline, supporting text, and a button immediately below. Strong visual call to action.`,tags:[`cta`,`image`,`visual`,`hero`],create:()=>z(`cta.image_overlay`,`Image CTA`,[F(U(560,280,`Visual`),`Visual`,{width:560,paddingTop:16}),B(`Stop guessing. Start measuring.`,{align:`center`,paddingTop:16}),H(`Free for 14 days. No credit card.`,{align:`center`}),I(`Try it free`),L(16)])},{type:`cta.subscribe`,category:`call_to_action`,name:`Subscribe / Forward`,description:`Friendly 'Was this forwarded? Subscribe' block that grows the list virally. Common at the end of newsletters.`,tags:[`cta`,`subscribe`,`forward`,`growth`,`newsletter`],create:()=>z(`cta.subscribe`,`Subscribe`,[V(`Was this forwarded?`,{align:`center`}),B(`Get the next issue in your inbox`,{align:`center`,paddingTop:0,paddingBottom:8}),I(`Subscribe free`),L(16)],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0})},{type:`cta.referral`,category:`call_to_action`,name:`Referral / Share`,description:`Encourages readers to share the newsletter with a unique referral link. Includes a 'Share' button and a personalized URL.`,tags:[`cta`,`referral`,`share`,`viral`,`growth`],create:()=>z(`cta.referral`,`Referral`,[V(`Tell a friend`,{align:`center`}),B(`Share & earn perks`,{align:`center`,paddingTop:0,paddingBottom:8}),H(`Refer 3 friends and unlock the bonus issue.`,{align:`center`}),P(`yourname.com/r/abc123`,{align:`center`,color:`{colors.primary}`,fontFamily:`Menlo, Consolas, monospace`,fontSize:14,paddingTop:8,paddingBottom:8}),I(`Share now`),L(16)])},{type:`cta.upgrade`,category:`call_to_action`,name:`Upgrade / Paid`,description:`Conversion block that promotes a paid plan or premium tier. Includes price, benefits and an upgrade button.`,tags:[`cta`,`upgrade`,`paid`,`premium`,`conversion`],create:()=>z(`cta.upgrade`,`Upgrade`,[V(`Become a member`,{align:`center`}),B(`$5 / month`,{align:`center`,level:1}),H(`Unlock the archive, weekly bonus and member chat.`,{align:`center`,fontSize:14}),I(`Upgrade`),L(16)],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0})},{type:`cta.feedback`,category:`call_to_action`,name:`Feedback Reply`,description:`Asks the reader to reply with feedback ('Hit reply and let me know'). Personal, no button.`,tags:[`cta`,`feedback`,`reply`,`personal`],create:()=>z(`cta.feedback`,`Feedback`,[P(`How did this issue land for you? Just hit reply β€” I read every message.`,{align:`center`,paddingTop:24,paddingBottom:24,lineHeight:1.6})])}],Qo=[{type:`ecom.product_single`,category:`ecommerce`,name:`Single Product`,description:`One product with image, title, price, short description and Buy button. Use to feature a hero product. Supports old/final price and per-product link.`,tags:[`product`,`single`,`buy`,`hero`],create:()=>z(`ecom.product_single`,`Single Product`,[G([W({name:`Linen Tote Bag`,image:U(560,400,`Product`),oldPrice:`$59.00`,finalPrice:`$39.00`,description:`Heavyweight natural linen, made in Portugal.`})],{columns:1,showOldPrice:!0,showDescription:!0,buttonLabel:`Buy now`})])},{type:`ecom.product_grid_2`,category:`ecommerce`,name:`Product Grid (2 up)`,description:`Two products side-by-side on desktop, stacked on mobile. Each card has image, name, old/final price, optional description and Shop button. Curated picks layout.`,tags:[`product`,`grid`,`two-up`,`curated`,`responsive`],create:()=>z(`ecom.product_grid_2`,`Product Grid 2`,[G([W({name:`Product A`,finalPrice:`$29`,oldPrice:`$39`}),W({name:`Product B`,finalPrice:`$34`,oldPrice:`$45`})],{columns:2,showOldPrice:!0})])},{type:`ecom.product_grid_3`,category:`ecommerce`,name:`Product Grid (3 up)`,description:`Three product cards in a row on desktop, stacked on mobile. Use for 'New arrivals' or 'Bestsellers' rows.`,tags:[`product`,`grid`,`three-up`,`bestsellers`,`new-arrivals`,`responsive`],create:()=>z(`ecom.product_grid_3`,`Product Grid 3`,[V(`New arrivals`,{align:`center`}),G([W({name:`Product 1`,finalPrice:`$19`}),W({name:`Product 2`,finalPrice:`$24`}),W({name:`Product 3`,finalPrice:`$32`})],{columns:3,showOldPrice:!1})])},{type:`ecom.collection_banner`,category:`ecommerce`,name:`Collection Banner`,description:`Wide collection banner with title and 'Shop the collection' button overlaying or under an image. Use for category drops.`,tags:[`collection`,`banner`,`category`,`drop`],create:()=>z(`ecom.collection_banner`,`Collection`,[F(U(560,300,`Collection`),`Collection`,{width:560}),B(`Spring Collection 2026`,{align:`center`,paddingTop:16}),H(`Lighter fabrics, brighter colors.`,{align:`center`}),I(`Shop the collection`),L(16)])},{type:`ecom.discount`,category:`ecommerce`,name:`Discount Code`,description:`Big discount code in monospaced caps with 'Your code' label and a Redeem button.`,tags:[`discount`,`promo`,`code`,`coupon`],create:()=>z(`ecom.discount`,`Discount Code`,[H(`Your code`,{align:`center`}),P(`SAVE20`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,color:`{colors.primary}`,letterSpacing:4,paddingTop:4,paddingBottom:16}),I(`Redeem`),L(24)])},{type:`ecom.voucher`,category:`ecommerce`,name:`Voucher Code`,description:`Personalized voucher block: 'Your code' label, a large voucher code and a Redeem button. With the voucher-select plugin, pick a code from your backend catalog; otherwise edit the code text directly.`,tags:[`voucher`,`coupon`,`discount`,`code`,`promo`,`redeem`],create:()=>z(`ecom.voucher`,`Voucher Code`,[H(`Your code`,{align:`center`}),xe(`SAVE20`),I(`Redeem`),L(24)])},{type:`ecom.flash_sale`,category:`ecommerce`,name:`Flash Sale Banner`,description:`Urgency-driven banner with countdown-style copy ('Ends in 24h'), discount value and a shop button.`,tags:[`flash-sale`,`urgency`,`promo`,`banner`,`countdown`],create:()=>z(`ecom.flash_sale`,`Flash Sale`,[P(`⏰ FLASH SALE β€” ENDS IN 24H`,{color:`{colors.buttonText}`,align:`center`,fontWeight:`bold`,letterSpacing:2,paddingTop:16,paddingBottom:4}),P(`Up to 50% off everything`,{color:`{colors.buttonText}`,align:`center`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingBottom:12}),I(`Shop now`,`#`,{backgroundColor:`{colors.surface}`,color:`{colors.primary}`}),L(16)],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`ecom.abandoned_cart`,category:`ecommerce`,name:`Abandoned Cart Reminder`,description:`Friendly reminder showing the items left in the cart with a return-to-cart button. For cart recovery automations.`,tags:[`abandoned-cart`,`recovery`,`automation`,`reminder`],create:()=>z(`ecom.abandoned_cart`,`Abandoned Cart`,[B(`You left something behind`,{align:`center`,paddingTop:16}),H(`Pick up where you left off.`,{align:`center`}),L(8),G([W({name:`Linen Tote Bag`,image:U(400,400,`Item`),finalPrice:`$39`,oldPrice:`$49`})],{columns:1,showOldPrice:!0,buttonLabel:`Return to cart`})])},{type:`ecom.review_request`,category:`ecommerce`,name:`Review Request`,description:`Post-purchase block asking for a 1-5 star rating with stacked star buttons. For review-collection emails.`,tags:[`review`,`rating`,`post-purchase`,`feedback`],create:()=>z(`ecom.review_request`,`Review`,[B(`How did we do?`,{align:`center`,paddingTop:24}),H(`Tap a star to leave a quick review.`,{align:`center`}),P(`β˜† β˜† β˜† β˜† β˜†`,{align:`center`,fontSize:32,color:`{colors.primary}`,paddingTop:12,paddingBottom:24,link:`#`})])},{type:`ecom.gift_guide`,category:`ecommerce`,name:`Gift Guide Pick`,description:`Editorial gift-guide pick: persona eyebrow + a single product card with full details (image, name, old/final price, description, CTA).`,tags:[`gift-guide`,`curated`,`editorial`,`holiday`],create:()=>z(`ecom.gift_guide`,`Gift Pick`,[V(`For the home cook`),G([W({name:`Cast Iron Skillet`,image:U(560,300,`Pick`),oldPrice:`$119`,finalPrice:`$89`,description:`Pre-seasoned, lifetime-guarantee. Made in USA.`})],{columns:1,showOldPrice:!0,showDescription:!0,buttonLabel:`View product`})])},{type:`ecom.bestseller_list`,category:`ecommerce`,name:`Bestseller Grid`,description:`Top products grid (3 up) with old/final prices. Used by retailers for weekly bestsellers.`,tags:[`bestsellers`,`grid`,`ranking`,`top`],create:()=>z(`ecom.bestseller_list`,`Bestsellers`,[V(`Top 3 this week`),G([W({name:`Linen Tote`,finalPrice:`$39`,oldPrice:`$49`}),W({name:`Ceramic Mug`,finalPrice:`$24`}),W({name:`Brass Lamp`,finalPrice:`$129`,oldPrice:`$149`})],{columns:3,showOldPrice:!0})])}],$o=[{type:`tx.order_summary`,category:`transactional`,name:`Order Summary`,description:`Order confirmation summary: order number, line items with thumbnails and totals row. Used in post-purchase emails.`,tags:[`order`,`summary`,`receipt`,`post-purchase`,`ecommerce`],create:()=>z(`tx.order_summary`,`Order Summary`,[V(`Order #1024`),B(`Thanks for your order`,{paddingTop:0}),H(`We'll email you again when it ships.`),R({paddingTop:16,paddingBottom:8}),P(`Linen Tote Bag Β· 1 Γ— $39.00`,{paddingTop:4,paddingBottom:4}),P(`Ceramic Mug Β· 2 Γ— $24.00`,{paddingTop:4,paddingBottom:4}),R({paddingTop:8,paddingBottom:8}),P(`Subtotal: $87.00`,{paddingTop:2,paddingBottom:2}),P(`Shipping: $5.00`,{paddingTop:2,paddingBottom:2}),P(`Total: $92.00`,{fontWeight:`bold`,paddingTop:2,paddingBottom:16})])},{type:`tx.shipping_update`,category:`transactional`,name:`Shipping Update`,description:`Shipping confirmation with tracking number, carrier, expected delivery date and a Track button.`,tags:[`shipping`,`tracking`,`delivery`,`post-purchase`],create:()=>z(`tx.shipping_update`,`Shipping Update`,[P(`πŸ“¦`,{align:`center`,fontSize:40,paddingTop:24}),B(`Your order is on the way`,{align:`center`,paddingTop:8}),H(`Carrier: USPS Β· Expected: May 4, 2026`,{align:`center`}),P(`Tracking: 9400 1108 ...`,{align:`center`,color:`{colors.muted}`,fontFamily:`Menlo, Consolas, monospace`,fontSize:13}),I(`Track package`),L(16)])},{type:`tx.invoice`,category:`transactional`,name:`Invoice`,description:`Itemized invoice with billing period, services and totals. Used by SaaS and B2B billing emails.`,tags:[`invoice`,`billing`,`saas`,`b2b`,`receipt`],create:()=>z(`tx.invoice`,`Invoice`,[V(`Invoice INV-2026-04`),B(`April 2026 invoice`),H(`Billed to: Acme Inc Β· Period: Apr 1 – Apr 30`),R({paddingTop:16,paddingBottom:8}),P(`Pro plan Β· $49.00`,{paddingTop:4,paddingBottom:4}),P(`Add-on seats (3) Β· $36.00`,{paddingTop:4,paddingBottom:4}),R({paddingTop:8,paddingBottom:8}),P(`Total due: $85.00`,{fontWeight:`bold`,paddingBottom:16}),I(`Download invoice (PDF)`),L(16)])},{type:`tx.password_reset`,category:`transactional`,name:`Password Reset`,description:`Authentication email with a reset button and a fallback link. Includes 'expires in X minutes' notice.`,tags:[`auth`,`password`,`reset`,`security`],create:()=>z(`tx.password_reset`,`Password Reset`,[B(`Reset your password`,{align:`center`,paddingTop:16}),P(`Click the button below to set a new password. This link expires in 30 minutes.`,{align:`center`,paddingBottom:16}),I(`Reset password`),H(`If the button doesn't work, paste this link in your browser:`,{align:`center`,fontSize:12}),P(`https://example.com/reset/abc123`,{align:`center`,color:`{colors.primary}`,fontSize:12,paddingBottom:24})])},{type:`tx.verify_email`,category:`transactional`,name:`Verify Email`,description:`Single-purpose 'verify your email' transactional with one centered button.`,tags:[`auth`,`verify`,`email-confirmation`],create:()=>z(`tx.verify_email`,`Verify Email`,[B(`One last step`,{align:`center`,paddingTop:16}),P(`Confirm your email address to activate your account.`,{align:`center`,paddingBottom:8}),I(`Verify email`),L(24)])},{type:`tx.appointment`,category:`transactional`,name:`Appointment Confirmation`,description:`Booking/meeting confirmation with date, time, location and add-to-calendar links.`,tags:[`appointment`,`booking`,`calendar`,`meeting`],create:()=>z(`tx.appointment`,`Appointment`,[V(`Confirmed`,{align:`center`}),B(`Your appointment is set`,{align:`center`,paddingTop:0}),P(`Tuesday, May 12 Β· 10:00 AM`,{align:`center`,fontWeight:`bold`,paddingTop:8}),H(`123 Main St, Suite 4 Β· Brooklyn, NY`,{align:`center`}),I(`Add to calendar`),L(16)])}],es=[{type:`social.icons`,category:`social`,name:`Social Icons Row`,description:`Centered 'Follow us' label with text-link icons in a row. Light footer-style social block.`,tags:[`social`,`follow`,`icons`,`row`],create:()=>z(`social.icons`,`Social Icons`,[H(`Follow us`,{align:`center`}),P(`Twitter Β· Instagram Β· LinkedIn Β· YouTube`,{align:`center`,color:`{colors.primary}`,paddingBottom:16})])},{type:`social.share`,category:`social`,name:`Share This Email`,description:`'Share this email' bar with Forward Β· Tweet Β· Share text links. Used at the end of newsletters.`,tags:[`social`,`share`,`forward`,`viral`],create:()=>z(`social.share`,`Share Bar`,[P(`Share this email`,{align:`center`,paddingTop:8}),P(`Forward Β· Tweet Β· Share`,{align:`center`,color:`{colors.primary}`,paddingBottom:8})])},{type:`social.featured_post`,category:`social`,name:`Featured Social Post`,description:`Embed-style preview of a single social post: avatar, name, post text and a link to view it on the platform.`,tags:[`social`,`post`,`embed`,`twitter`,`instagram`],create:()=>z(`social.featured_post`,`Social Post`,[V(`From the community`),F(U(48,48,`πŸ‘€`),`Avatar`,{width:48,borderRadius:24}),P(`@maker Β· 2h`,{color:`{colors.muted}`,fontSize:13,paddingTop:4,paddingBottom:4}),P(`"Just shipped my newsletter using OpenPostcards. Honestly the smoothest email build I've ever done."`,{paddingBottom:8,lineHeight:1.6}),P(`View on Twitter β†’`,{color:`{colors.primary}`,paddingBottom:16,link:`#`})])},{type:`social.instagram_grid`,category:`social`,name:`Instagram Grid`,description:`3 small square thumbnails in a row representing recent Instagram posts, with handle and link.`,tags:[`social`,`instagram`,`grid`,`thumbnails`],create:()=>z(`social.instagram_grid`,`IG Grid`,[H(`@youraccount on Instagram`,{align:`center`}),F(U(180,180,`1`),`Post 1`,{width:180}),F(U(180,180,`2`),`Post 2`,{width:180}),F(U(180,180,`3`),`Post 3`,{width:180}),P(`View profile β†’`,{align:`center`,color:`{colors.primary}`,paddingTop:8,paddingBottom:16,link:`#`})])},{type:`social.community_stats`,category:`social`,name:`Community Stats`,description:`Short '12k Twitter Β· 4k IG Β· 2k YT' style row used to show following sizes.`,tags:[`social`,`stats`,`community`,`following`],create:()=>z(`social.community_stats`,`Community Stats`,[V(`Join the community`,{align:`center`}),P(`12k Twitter Β· 4k Instagram Β· 2k YouTube`,{align:`center`,paddingBottom:16}),L(8)])}],ts={backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0},ns=[{type:`footer.simple`,category:`footer`,name:`Simple Footer`,description:`Minimal footer with copyright, address and unsubscribe links. The default for any newsletter.`,tags:[`footer`,`simple`,`copyright`,`unsubscribe`],create:()=>z(`footer.simple`,`Simple Footer`,[H(`Β© 2026 Your Company. All rights reserved.`,{align:`center`,fontSize:12}),H(`123 Main St Β· City Β· Country`,{align:`center`,fontSize:12}),K([{label:`Unsubscribe`,type:`unsubscribe`},{label:`View in browser`,type:`view_in_browser`}])],{...ts,paddingTop:24})},{type:`footer.social`,category:`footer`,name:`Footer with Social`,description:`Footer with social links row above the legal text.`,tags:[`footer`,`social`,`links`],create:()=>z(`footer.social`,`Social Footer`,[P(`Follow us`,{align:`center`,paddingTop:24}),P(`Twitter Β· Instagram Β· LinkedIn`,{align:`center`,color:`{colors.primary}`,paddingBottom:12}),R(),H(`Β© 2026 Your Company`,{align:`center`,fontSize:12}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],ts)},{type:`footer.legal`,category:`footer`,name:`Legal Footer`,description:`Long-form footer with explanation of why the user is receiving the email plus privacy/terms/unsubscribe links. Used by enterprise and finance newsletters.`,tags:[`footer`,`legal`,`compliance`,`enterprise`],create:()=>z(`footer.legal`,`Legal Footer`,[P(`You are receiving this email because you signed up for our newsletter. If you no longer wish to receive emails, you can unsubscribe at any time.`,{align:`center`,color:`{colors.muted}`,fontSize:11,lineHeight:1.6,paddingTop:24}),K([{label:`Privacy Policy`,type:`user_profile`},{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],ts)},{type:`footer.publisher`,category:`footer`,name:`Publisher Footer`,description:`Magazine-style sign-off with logo, publication name, masthead credits, address and links.`,tags:[`footer`,`publisher`,`magazine`,`masthead`,`editorial`],create:()=>z(`footer.publisher`,`Publisher Footer`,[F(U(120,36,`LOGO`),`Logo`,{width:120,paddingTop:24,paddingBottom:8}),P(`THE WEEKLY`,{align:`center`,fontFamily:`{fonts.heading}`,fontWeight:`bold`,letterSpacing:4,paddingTop:0,paddingBottom:4}),H(`Editor: Jane Doe Β· Producer: Alex Kim`,{align:`center`,fontSize:12}),R({paddingTop:12,paddingBottom:12}),H(`Β© 2026 The Weekly Β· 350 Madison Ave Β· NY 10017`,{align:`center`,fontSize:11}),K([{label:`Manage preferences`,type:`manage_preferences`},{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],ts)},{type:`footer.app_links`,category:`footer`,name:`Footer with App Store Badges`,description:`Footer including 'Get the app' app-store and play-store badge images. For consumer brand newsletters.`,tags:[`footer`,`app`,`download`,`ios`,`android`],create:()=>z(`footer.app_links`,`App Footer`,[P(`Get the app`,{align:`center`,fontWeight:`bold`,paddingTop:24,paddingBottom:8}),F(U(135,40,`App Store`),`App Store`,{width:135,align:`center`,paddingTop:0,paddingBottom:4}),F(U(135,40,`Google Play`),`Google Play`,{width:135,align:`center`,paddingTop:0,paddingBottom:16}),R(),H(`Β© 2026 Your Brand`,{align:`center`,fontSize:11}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],ts)},{type:`footer.address_only`,category:`footer`,name:`Address Only`,description:`Just a centered postal address line β€” required for CAN-SPAM compliance when other footers are minimal.`,tags:[`footer`,`address`,`compliance`,`can-spam`],create:()=>z(`footer.address_only`,`Address`,[H(`Your Company Β· 123 Main St Β· Brooklyn, NY 11201 Β· USA`,{align:`center`,fontSize:11}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:16})],{...ts,paddingTop:16})},{type:`footer.preferences`,category:`footer`,name:`Manage Preferences`,description:`Footer that emphasizes preference management ('Update your preferences', 'Send less often'). Reduces unsubscribes.`,tags:[`footer`,`preferences`,`frequency`,`retention`],create:()=>z(`footer.preferences`,`Preferences`,[P(`Getting too many emails?`,{align:`center`,paddingTop:24,paddingBottom:4}),K([{label:`Update your preferences`,type:`manage_preferences`},{label:`Unsubscribe`,type:`unsubscribe`}],{color:`{colors.primary}`,fontSize:13,paddingTop:4,paddingBottom:16}),R(),H(`Β© 2026 Your Company`,{align:`center`,fontSize:11}),P(` `,{align:`center`,paddingBottom:24})],ts)},{type:`footer.signature`,category:`footer`,name:`Signature Sign-off`,description:`Personal hand-signed style sign-off with author name and tiny legal block. For solo creator newsletters.`,tags:[`footer`,`signature`,`personal`,`creator`,`sign-off`],create:()=>z(`footer.signature`,`Signature`,[P(`Until next week,`,{paddingTop:24,paddingBottom:4}),P(`β€” Jane`,{fontFamily:`{fonts.heading}`,fontSize:22,paddingBottom:16}),R(),K([{label:`Unsubscribe`,type:`unsubscribe`}],{align:`left`,fontSize:11,paddingTop:4,paddingBottom:24,separator:` Β· `})],{...ts,paddingTop:0})}],rs=[...Ko,...qo,...Jo,...Yo,...Xo,...Zo,...Qo,...$o,...es,...ns],is=!1;function as(){if(!is){for(let e of rs)Ue.register(e);is=!0}}as();function os(){let{doc:e,addModule:t,loadFromLocalStorage:n}=M();return(0,l.useEffect)(()=>{if(n(),M.getState().doc.modules.length===0){for(let e of[`header.hero`,`content.headline_body`,`cta.simple`,`footer.simple`]){let n=Ue.get(e);n&&t(n.create())}M.setState({selection:{kind:`email`},past:[],future:[]})}},[]),(0,l.useEffect)(()=>{let e=setTimeout(()=>M.getState().saveToLocalStorage(),500);return()=>clearTimeout(e)},[e]),(0,p.jsxs)(`div`,{className:`oml-email-builder h-full w-full flex flex-col bg-gray-100`,children:[(0,p.jsx)(Re,{}),(0,p.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,p.jsx)(pt,{}),(0,p.jsx)(ra,{}),(0,p.jsx)(vo,{})]})]})}var ss=e=>{if(e&&typeof e==`object`)return e;throw Error(`AI server returned a non-object response.`)};function cs(e){let t=e.transformResponse??ss,n=e.timeoutMs??6e4;return{async generate(r){let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(e.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`,...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,body:JSON.stringify(r),signal:i.signal}),a=null,o=await n.text();try{a=o?JSON.parse(o):null}catch{}if(!n.ok){let e=(a&&typeof a==`object`&&`error`in a&&typeof a.error==`string`?a.error:null)??`AI request failed (HTTP ${n.status})`;throw Error(e)}return t(a)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`AI request timed out after ${n}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(a)}}}}function ls(e){let t=cs(e);return{name:`ai-assistant`,type:`ai-provider`,setup(e){e.setAIProvider(t)}}}function us(e){if(e==null)return null;if(Array.isArray(e))return us(e[0]);if(typeof e!=`object`)return null;let t=e;for(let e of[`product`,`item`,`data`])if(t[e]&&typeof t[e]==`object`&&!Array.isArray(t[e]))return t[e];for(let e of[`results`,`products`,`items`,`hits`])if(Array.isArray(t[e]))return us(t[e]);return t}function ds(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t;if(typeof t==`number`)return String(t)}}function fs(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()!==``&&!Number.isNaN(Number(t)))return Number(t)}}var ps=e=>{let t=us(e);if(!t)return null;let n=ds(t,[`name`,`title`,`product_name`,`productName`]),r=ds(t,[`finalPrice`,`final_price`,`price`,`sale_price`,`salePrice`]);return!n||r==null?null:{name:n,finalPrice:r,oldPrice:ds(t,[`oldPrice`,`old_price`,`compare_at_price`,`compareAtPrice`,`list_price`,`listPrice`]),description:ds(t,[`description`,`desc`,`summary`]),link:ds(t,[`link`,`url`,`product_url`,`productUrl`,`permalink`]),image:ds(t,[`image`,`image_url`,`imageUrl`,`thumbnail`,`img`]),imageAlt:ds(t,[`imageAlt`,`image_alt`,`alt`]),stars:fs(t,[`stars`,`rating`,`review_score`,`reviewScore`,`score`]),sku:ds(t,[`sku`,`id`,`product_id`,`productId`])}};function ms(e){let t=e.method??`GET`,n=e.queryParam??`q`,r=e.bodyParam??`query`,i=e.timeoutMs??15e3,a=e.transformResponse??ps;return{async search(o){let s=o.trim();if(!s)return null;let c=new AbortController,l=setTimeout(()=>c.abort(),i);try{let i=e.endpoint,o={method:t,headers:{...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,signal:c.signal};if(t===`GET`){let t=typeof location<`u`?location.href:void 0,r=new URL(e.endpoint,t);r.searchParams.set(n,s),i=r.toString()}else o.headers[`Content-Type`]=`application/json`,o.body=JSON.stringify({[r]:s});let l=await fetch(i,o),u=null,d=await l.text();try{u=d?JSON.parse(d):null}catch{}if(!l.ok){let e=(u&&typeof u==`object`&&`error`in u&&typeof u.error==`string`?u.error:null)??`Product search failed (HTTP ${l.status})`;throw Error(e)}return a(u)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`Product search timed out after ${i}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(l)}}}}function hs(e){let t=ms(e);return{name:`product-search`,type:`product-provider`,setup(e){e.registerProductProvider(t)}}}function gs(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;for(let e of[`vouchers`,`results`,`items`,`data`,`coupons`])if(Array.isArray(t[e]))return t[e]}return[]}function _s(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t;if(typeof t==`number`)return String(t)}}var vs=e=>{let t=[];for(let n of gs(e)){if(!n||typeof n!=`object`)continue;let e=n,r=_s(e,[`code`,`voucher_code`,`voucherCode`,`coupon`,`coupon_code`,`couponCode`,`value`]),i=_s(e,[`id`,`voucher_id`,`voucherId`,`uid`])??r;if(!i&&!r)continue;let a=_s(e,[`title`,`name`,`label`])??r??i??`Voucher`;t.push({id:i??a,title:a,code:r??i??a,description:_s(e,[`description`,`desc`,`summary`])})}return t};function ys(e){let t=e.method??`GET`,n=e.timeoutMs??15e3,r=e.transformResponse??vs;return{async list(){let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(e.endpoint,{method:t,headers:{...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,signal:i.signal}),a=null,o=await n.text();try{a=o?JSON.parse(o):null}catch{}if(!n.ok){let e=(a&&typeof a==`object`&&`error`in a&&typeof a.error==`string`?a.error:null)??`Voucher request failed (HTTP ${n.status})`;throw Error(e)}return r(a)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`Voucher request timed out after ${n}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(a)}}}}function bs(e){let t=ys(e);return{name:`voucher-select`,type:`voucher-provider`,setup(n){n.registerVoucherProvider(t),e.preload&&Aa()}}}var xs=e=>{if(e&&typeof e==`object`&&`url`in e&&typeof e.url==`string`){let t=e;return{url:t.url,alt:typeof t.alt==`string`?t.alt:void 0}}throw Error(`Server response missing "url" string field.`)};function Ss(e){let t=e.fieldName??`file`,n=(e.maxSizeMB??10)*1024*1024,r=e.transformResponse??xs;return{upload(i){return i.type.startsWith(`image/`)?i.size>n?Promise.reject(Error(`File too large: ${(i.size/1024/1024).toFixed(2)} MB > ${e.maxSizeMB??10} MB`)):new Promise((n,a)=>{let o=new XMLHttpRequest,s=new FormData;if(s.append(t,i,i.name),o.open(`POST`,e.endpoint,!0),o.withCredentials=!!e.withCredentials,e.headers)for(let[t,n]of Object.entries(e.headers))o.setRequestHeader(t,n);e.onProgress&&o.upload&&(o.upload.onprogress=t=>{t.lengthComputable&&e.onProgress(Math.round(t.loaded/t.total*100))}),o.onload=()=>{let e=o.status>=200&&o.status<300,t=null;try{t=o.responseText?JSON.parse(o.responseText):null}catch{}if(!e){let e=(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`?t.error:null)??`Upload failed (HTTP ${o.status})`;return a(Error(e))}try{n(r(t))}catch(e){a(e instanceof Error?e:Error(String(e)))}},o.onerror=()=>a(Error(`Network error during upload`)),o.onabort=()=>a(Error(`Upload aborted`)),o.send(s)}):Promise.reject(Error(`Not an image: ${i.type||`unknown`}`))}}}function Cs(e){return{name:`image-uploader`,type:`asset-provider`,setup(t){t.registerAssetProvider(Ss(e))}}}function ws(e){return(0,l.useEffect)(()=>{if(as(),e.modules)for(let t of e.modules)Ue.register(t);if(e.themes&&M.setState({themes:e.themes}),e.aiProvider)La.setAIProvider(e.aiProvider);else if(e.aiEndpoint){let t=typeof e.aiEndpoint==`string`?{endpoint:e.aiEndpoint}:e.aiEndpoint;La.setAIProvider(cs(t))}if(e.productProvider)La.registerProductProvider(e.productProvider);else if(e.productEndpoint){let t=typeof e.productEndpoint==`string`?{endpoint:e.productEndpoint}:e.productEndpoint;La.registerProductProvider(ms(t))}if(e.voucherProvider)La.registerVoucherProvider(e.voucherProvider);else if(e.voucherEndpoint){let t=typeof e.voucherEndpoint==`string`?{endpoint:e.voucherEndpoint}:e.voucherEndpoint;La.registerVoucherProvider(ys(t)),typeof e.voucherEndpoint!=`string`&&e.voucherEndpoint.preload&&Aa()}if(e.mergeTags&&La.registerMergeTags(e.mergeTags),e.enableRecommendations&&La.registerRecommendationsPlugin(),e.initialDocument){let t=b.safeParse(e.initialDocument);t.success&&M.getState().applyDoc(t.data,!1)}let t=M.subscribe((t,n)=>{t.doc!==n.doc&&e.onChange?.(t.doc)});return()=>t()},[]),(0,l.useEffect)(()=>{if(e.onExportHtml)return M.subscribe((t,n)=>{t.doc!==n.doc&&e.onExportHtml?.(k(t.doc))})},[e.onExportHtml]),(0,l.createElement)(os)}function Ts(e){let t=(0,c.createRoot)(e.container);return t.render((0,l.createElement)(ws,e)),{destroy:()=>t.unmount(),getDocument:()=>M.getState().doc,exportHtml:()=>M.getState().exportHtml(),exportJson:()=>M.getState().exportJson()}}var Es={name:`recommendations`,type:`recommendations`,setup:e=>e.registerRecommendationsPlugin()};exports.ALGORITHMS=Va,exports.ALGORITHM_BY_ID=Ha,exports.EmailBuilder=ws,exports.FALLBACK_OPTIONS=Ua,exports.TEMPLATE_CATEGORY_LABELS=ye,exports.aiAssistantPlugin=ls,exports.applyAIActions=et,exports.applyAIResponse=st,exports.buildCatalog=$e,exports.createEmailBuilder=Ts,exports.createHttpAIProvider=cs,exports.createProductSearchProvider=ms,exports.createVoucherProvider=ys,exports.defaultRecommendationsLogic=Wa,exports.documentSchema=b,exports.getActiveProductProvider=va,exports.getActiveVoucherProvider=Oa,exports.imageUploaderPlugin=Cs,exports.isVoucherAware=uo,exports.mockAIProvider=rt,exports.productSearchPlugin=hs,exports.readRecommendationsLogic=Ga,exports.recommendationsPlugin=Es,exports.recommendationsToLegacyShape=Ja,exports.registerPlugin=Ra,exports.renderEmailHtml=k,exports.setActiveProductProvider=_a,exports.setActiveVoucherProvider=Da,exports.templateRegistry=N,exports.useRecommendationsStore=Na,exports.validateAIDocument=nt,exports.voucherPlugin=bs;
81
+ `},Xt={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Zt(e){let{announcements:t=Xt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Yt}=e,{announce:a,announcement:o}=Gt(),s=jt(`DndLiveRegion`),[c,u]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{u(!0)},[]),qt((0,l.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let d=l.default.createElement(l.default.Fragment,null,l.default.createElement(Ut,{id:r,value:i.draggable}),l.default.createElement(Wt,{id:s,announcement:o}));return n?(0,m.createPortal)(d,n):d}var J;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(J||={});function Qt(){}function $t(e,t){return(0,l.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function en(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,l.useMemo)(()=>[...t].filter(e=>e!=null),[...t])}var tn=Object.freeze({x:0,y:0});function nn(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function rn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function an(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function on(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function sn(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function cn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ln=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=cn(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=nn(cn(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(rn)},un=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=on(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=on(r),o=i.reduce((e,t,r)=>e+nn(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(rn)};function dn(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var fn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=dn(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(an)};function pn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:tn}function hn(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var gn=hn(1);function _n(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vn(e,t,n){let r=_n(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var yn={ignoreTransform:!1};function bn(e,t){t===void 0&&(t=yn);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=q(e).getComputedStyle(e);t&&(n=vn(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function xn(e){return bn(e,{ignoreTransform:!0})}function Sn(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cn(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position===`fixed`}function wn(e,t){t===void 0&&(t=q(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Tn(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yt(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!bt(i)||xt(i)||n.includes(i))return n;let a=q(e).getComputedStyle(i);return i!==e&&wn(i,a)&&n.push(i),Cn(i,a)?n:r(i.parentNode)}return e?r(e):n}function En(e){let[t]=Tn(e,1);return t??null}function Dn(e){return!gt||!e?null:_t(e)?e:vt(e)?yt(e)||e===St(e).scrollingElement?window:bt(e)?e:null:null}function On(e){return _t(e)?e.scrollX:e.scrollLeft}function kn(e){return _t(e)?e.scrollY:e.scrollTop}function An(e){return{x:On(e),y:kn(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function jn(e){return!gt||!e?!1:e===document.scrollingElement}function Mn(e){let t={x:0,y:0},n=jn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Nn={x:.2,y:.2};function Pn(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Nn);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Mn(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Fn(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function In(e){return e.reduce((e,t)=>Nt(e,An(t)),tn)}function Ln(e){return e.reduce((e,t)=>e+On(t),0)}function Rn(e){return e.reduce((e,t)=>e+kn(t),0)}function zn(e,t){if(t===void 0&&(t=bn),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);En(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Bn=[[`x`,[`left`,`right`],Ln],[`y`,[`top`,`bottom`],Rn]],Vn=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Tn(t),r=In(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Bn)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Hn=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Un(e){let{EventTarget:t}=q(e);return e instanceof t?e:St(e)}function Wn(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Gn;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Gn||={});function Kn(e){e.preventDefault()}function qn(e){e.stopPropagation()}var X;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(X||={});var Jn={start:[X.Space,X.Enter],cancel:[X.Esc],end:[X.Space,X.Enter,X.Tab]},Yn=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case X.Right:return{...n,x:n.x+25};case X.Left:return{...n,x:n.x-25};case X.Down:return{...n,y:n.y+25};case X.Up:return{...n,y:n.y-25}}},Xn=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Hn(St(t)),this.windowListeners=new Hn(q(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&zn(n),t(tn)}handleKeyDown(e){if(It(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Jn,coordinateGetter:a=Yn,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:tn;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Pt(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Mn(n),p=Fn(n),m={x:Math.min(i===X.Right?p.right-p.width/2:p.right,Math.max(i===X.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===X.Down?p.bottom-p.height/2:p.bottom,Math.max(i===X.Down?p.top:p.top+p.height/2,u.y))},h=i===X.Right&&!s||i===X.Left&&!c,g=i===X.Down&&!l||i===X.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===X.Right&&e<=d.x||i===X.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===X.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===X.Down&&e<=d.y||i===X.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===X.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Nt(Pt(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Xn.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Jn,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Zn(e){return!!(e&&`distance`in e)}function Qn(e){return!!(e&&`delay`in e)}var $n=class{constructor(e,t,n){n===void 0&&(n=Un(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=St(i),this.documentListeners=new Hn(this.document),this.listeners=new Hn(n),this.windowListeners=new Hn(q(i)),this.initialCoordinates=Rt(r)??tn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.DragStart,Kn),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),this.windowListeners.add(Gn.ContextMenu,Kn),this.documentListeners.add(Gn.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Qn(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Zn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Gn.Click,qn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gn.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Rt(e)??tn,s=Pt(n,o);if(!t&&a){if(Zn(a)){if(a.tolerance!=null&&Wn(s,a.tolerance))return this.handleCancel();if(Wn(s,a.distance))return this.handleStart()}if(Qn(a)&&Wn(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===X.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},er={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},tr=class extends $n{constructor(e){let{event:t}=e,n=St(t.target);super(e,er,n)}};tr.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var nr={move:{name:`mousemove`},end:{name:`mouseup`}},rr;(function(e){e[e.RightClick=2]=`RightClick`})(rr||={});var ir=class extends $n{constructor(e){super(e,nr,St(e.event.target))}};ir.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===rr.RightClick?!1:(r?.({event:n}),!0)}}];var ar={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},or=class extends $n{constructor(e){super(e,ar)}static setup(){return window.addEventListener(ar.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ar.move.name,e)};function e(){}}};or.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var sr;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(sr||={});var cr;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(cr||={});function lr(e){let{acceleration:t,activator:n=sr.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=cr.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=dr({delta:f,disabled:!a}),[h,g]=Tt(),_=(0,l.useRef)({x:0,y:0}),v=(0,l.useRef)({x:0,y:0}),y=(0,l.useMemo)(()=>{switch(n){case sr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case sr.DraggableRect:return i}},[n,i,c]),b=(0,l.useRef)(null),x=(0,l.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,l.useMemo)(()=>s===cr.TreeOrder?[...u].reverse():u,[s,u]);(0,l.useEffect)(()=>{if(!a||!u.length||!y){g();return}for(let e of S){if(r?.(e)===!1)continue;let n=u.indexOf(e),i=d[n];if(!i)continue;let{direction:a,speed:s}=Pn(e,i,y,t,p);for(let e of[`x`,`y`])m[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){g(),b.current=e,h(x,o),_.current=s,v.current=a;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var ur={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function dr(e){let{delta:t,disabled:n}=e,r=kt(t);return Dt(e=>{if(n||!r||!e)return ur;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function fr(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Dt(e=>t==null?null:r??e??null,[r,t])}function pr(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var mr;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(mr||={});var hr;(function(e){e.Optimized=`optimized`})(hr||={});var gr=new Map;function _r(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,l.useState)(null),{frequency:s,measure:c,strategy:u}=i,d=(0,l.useRef)(e),f=_(),p=Et(f),m=(0,l.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,l.useRef)(null),g=Dt(t=>{if(f&&!n)return gr;if(!t||t===gr||d.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Vn(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,f,c]);return(0,l.useEffect)(()=>{d.current=e},[e]),(0,l.useEffect)(()=>{f||m()},[n,f]),(0,l.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,l.useEffect)(()=>{f||typeof s!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function _(){switch(u){case mr.Always:return!1;case mr.BeforeDragging:return n;default:return!n}}}function vr(e,t){return Dt(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function yr(e,t){return vr(e,t)}function br(e){let{callback:t,disabled:n}=e,r=wt(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function xr(e){let{callback:t,disabled:n}=e,r=wt(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Sr(e){return new Vn(bn(e),e)}function Cr(e,t,n){t===void 0&&(t=Sr);let[r,i]=(0,l.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=br({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=xr({callback:a});return Ct(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function wr(e){return mn(e,vr(e))}var Tr=[];function Er(e){let t=(0,l.useRef)(e),n=Dt(n=>e?n&&n!==Tr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tn(e):Tr,[e]);return(0,l.useEffect)(()=>{t.current=e},[e]),n}function Dr(e){let[t,n]=(0,l.useState)(null),r=(0,l.useRef)(e),i=(0,l.useCallback)(e=>{let t=Dn(e.target);t&&n(e=>e?(e.set(t,An(t)),new Map(e)):null)},[]);return(0,l.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Dn(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,An(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Dn(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,l.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Nt(e,t),tn):In(e):tn,[e,t])}function Or(e,t){t===void 0&&(t=[]);let n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{n.current=null},t),(0,l.useEffect)(()=>{let t=e!==tn;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Pt(e,n.current):tn}function kr(e){(0,l.useEffect)(()=>{if(!gt)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Ar(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function jr(e){return(0,l.useMemo)(()=>e?Sn(e):null,[e])}var Mr=[];function Nr(e,t){t===void 0&&(t=bn);let[n]=e,r=jr(n?q(n):null),[i,a]=(0,l.useState)(Mr);function o(){a(()=>e.length?e.map(e=>jn(e)?r:new Vn(t(e),e)):Mr)}let s=xr({callback:o});return Ct(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Pr(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return bt(t)?t:e}function Fr(e){let{measure:t}=e,[n,r]=(0,l.useState)(null),i=xr({callback:(0,l.useCallback)(e=>{for(let{target:n}of e)if(bt(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ot((0,l.useCallback)(e=>{let n=Pr(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,l.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ir=[{sensor:tr,options:{}},{sensor:Xn,options:{}}],Lr={current:{}},Rr={draggable:{measure:xn},droppable:{measure:xn,strategy:mr.WhileDragging,frequency:hr.Optimized},dragOverlay:{measure:bn}},zr=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Br={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Rr,measureDroppableContainers:Qt,windowRect:null,measuringScheduled:!1},Vr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Qt,draggableNodes:new Map,over:null,measureDroppableContainers:Qt},Hr=(0,l.createContext)(Vr),Ur=(0,l.createContext)(Br);function Wr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zr}}}function Gr(e,t){switch(t.type){case J.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case J.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case J.DragEnd:case J.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case J.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new zr(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case J.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new zr(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case J.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new zr(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Kr(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,l.useContext)(Hr),a=kt(r),o=kt(n?.id);return(0,l.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!It(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Vt(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function qr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Jr(e){return(0,l.useMemo)(()=>({draggable:{...Rr.draggable,...e?.draggable},droppable:{...Rr.droppable,...e?.droppable},dragOverlay:{...Rr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Yr(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,l.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Ct(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=mn(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=En(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Xr=(0,l.createContext)({...tn,scaleX:1,scaleY:1}),Zr;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Zr||={});var Qr=(0,l.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ir,collisionDetection:o=fn,measuring:s,modifiers:c,...u}=e,[d,f]=(0,l.useReducer)(Gr,void 0,Wr),[p,h]=Jt(),[g,_]=(0,l.useState)(Zr.Uninitialized),v=g===Zr.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=d,C=y==null?null:b.get(y),w=(0,l.useRef)({initial:null,translated:null}),T=(0,l.useMemo)(()=>y==null?null:{id:y,data:C?.data??Lr,rect:w},[y,C]),ee=(0,l.useRef)(null),[te,E]=(0,l.useState)(null),[D,ne]=(0,l.useState)(null),re=Et(u,Object.values(u)),ie=jt(`DndDescribedBy`,t),ae=(0,l.useMemo)(()=>S.getEnabled(),[S]),oe=Jr(s),{droppableRects:se,measureDroppableContainers:ce,measuringScheduled:le}=_r(ae,{dragging:v,dependencies:[x.x,x.y],config:oe.droppable}),O=fr(b,y),ue=(0,l.useMemo)(()=>D?Rt(D):null,[D]),de=we(),fe=yr(O,oe.draggable.measure);Yr({activeNode:y==null?null:b.get(y),config:de.layoutShiftCompensation,initialRect:fe,measure:oe.draggable.measure});let k=Cr(O,oe.draggable.measure,fe),pe=Cr(O?O.parentElement:null),A=(0,l.useRef)({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),j=S.getNodeFor(A.current.over?.id),me=Fr({measure:oe.dragOverlay.measure}),he=me.nodeRef.current??O,ge=v?me.rect??k:null,_e=!!(me.nodeRef.current&&me.rect),ve=wr(_e?null:k),M=jr(he?q(he):null),N=Er(v?j??O:null),ye=Nr(N),be=qr(c,{transform:{x:x.x-ve.x,y:x.y-ve.y,scaleX:1,scaleY:1},activatorEvent:D,active:T,activeNodeRect:k,containerNodeRect:pe,draggingNodeRect:ge,over:A.current.over,overlayNodeRect:me.rect,scrollableAncestors:N,scrollableAncestorRects:ye,windowRect:M}),P=ue?Nt(ue,x):null,F=Dr(N),I=Or(F),L=Or(F,[k]),R=Nt(be,I),z=ge?gn(ge,be):null,B=T&&z?o({active:T,collisionRect:z,droppableRects:se,droppableContainers:ae,pointerCoordinates:P}):null,V=sn(B,`id`),[H,xe]=(0,l.useState)(null),U=pn(_e?be:Nt(be,L),H?.rect??null,k),Se=(0,l.useRef)(null),W=(0,l.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(ee.current==null)return;let i=b.get(ee.current);if(!i)return;let a=e.nativeEvent,o=new n({active:ee.current,activeNode:i,event:a,options:r,context:A,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=re.current,n={id:e};t?.(n),p({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=re.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),p({type:`onDragPending`,event:a})},onStart(e){let t=ee.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=re.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,m.unstable_batchedUpdates)(()=>{r?.(i),_(Zr.Initializing),f({type:J.DragStart,initialCoordinates:e,active:t}),p({type:`onDragStart`,event:i}),E(Se.current),ne(a)})},onMove(e){f({type:J.DragMove,coordinates:e})},onEnd:s(J.DragEnd),onCancel:s(J.DragCancel)});Se.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=A.current,o=null;if(t&&i){let{cancelDrop:s}=re.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===J.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=J.DragCancel)}ee.current=null,(0,m.unstable_batchedUpdates)(()=>{f({type:e}),_(Zr.Uninitialized),xe(null),E(null),ne(null),Se.current=null;let t=e===J.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=re.current[t];e?.(o),p({type:t,event:o})}})}}},[b]),G=pr(a,(0,l.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(ee.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},ee.current=r,W(n,t))},[b,W]));kr(a),Ct(()=>{k&&g===Zr.Initializing&&_(Zr.Initialized)},[k,g]),(0,l.useEffect)(()=>{let{onDragMove:e}=re.current,{active:t,activatorEvent:n,collisions:r,over:i}=A.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:R.x,y:R.y},over:i};(0,m.unstable_batchedUpdates)(()=>{e?.(a),p({type:`onDragMove`,event:a})})},[R.x,R.y]),(0,l.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=A.current;if(!e||ee.current==null||!t||!i)return;let{onDragOver:a}=re.current,o=r.get(V),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,m.unstable_batchedUpdates)(()=>{xe(s),a?.(c),p({type:`onDragOver`,event:c})})},[V]),Ct(()=>{A.current={activatorEvent:D,active:T,activeNode:O,collisionRect:z,collisions:B,droppableRects:se,draggableNodes:b,draggingNode:he,draggingNodeRect:ge,droppableContainers:S,over:H,scrollableAncestors:N,scrollAdjustedTranslate:R},w.current={initial:ge,translated:z}},[T,O,B,z,b,he,ge,se,S,H,N,R]),lr({...de,delta:x,draggingRect:z,pointerCoordinates:P,scrollableAncestors:N,scrollableAncestorRects:ye});let K=(0,l.useMemo)(()=>({active:T,activeNode:O,activeNodeRect:k,activatorEvent:D,collisions:B,containerNodeRect:pe,dragOverlay:me,draggableNodes:b,droppableContainers:S,droppableRects:se,over:H,measureDroppableContainers:ce,scrollableAncestors:N,scrollableAncestorRects:ye,measuringConfiguration:oe,measuringScheduled:le,windowRect:M}),[T,O,k,D,B,pe,me,b,S,se,H,ce,N,ye,oe,le,M]),Ce=(0,l.useMemo)(()=>({activatorEvent:D,activators:G,active:T,activeNodeRect:k,ariaDescribedById:{draggable:ie},dispatch:f,draggableNodes:b,over:H,measureDroppableContainers:ce}),[D,G,T,k,f,ie,b,H,ce]);return l.default.createElement(Kt.Provider,{value:h},l.default.createElement(Hr.Provider,{value:Ce},l.default.createElement(Ur.Provider,{value:K},l.default.createElement(Xr.Provider,{value:U},i)),l.default.createElement(Kr,{disabled:n?.restoreFocus===!1})),l.default.createElement(Zt,{...n,hiddenTextDescribedById:ie}));function we(){let e=te?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=v&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),$r=(0,l.createContext)(null),ei=`button`,ti=`Draggable`;function ni(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=jt(ti),{activators:o,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,l.useContext)(Hr),{role:m=ei,roleDescription:h=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,l.useContext)(_?Xr:$r),[y,b]=Ot(),[x,S]=Ot(),C=Ar(o,t),w=Et(n);return Ct(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=f.get(t);e&&e.key===a&&f.delete(t)}),[f,t]),{active:c,activatorEvent:s,activeNodeRect:u,attributes:(0,l.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&m===ei?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[r,m,g,_,h,d.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function ri(){return(0,l.useContext)(Ur)}var ii=`Droppable`,ai={timeout:25};function oi(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=jt(ii),{active:o,dispatch:s,over:c,measureDroppableContainers:u}=(0,l.useContext)(Hr),d=(0,l.useRef)({disabled:n}),f=(0,l.useRef)(!1),p=(0,l.useRef)(null),m=(0,l.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...ai,...i},v=Et(g??r),y=xr({callback:(0,l.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!o}),[b,x]=Ot((0,l.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=Et(t);return(0,l.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,l.useEffect)(()=>(s({type:J.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:p,data:S}}),()=>s({type:J.UnregisterDroppable,key:a,id:r})),[r]),(0,l.useEffect)(()=>{n!==d.current.disabled&&(s({type:J.SetDroppableDisabled,id:r,key:a,disabled:n}),d.current.disabled=n)},[r,a,n,s]),{active:o,rect:p,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function si(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ci(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function li(e){return e!==null&&e>=0}function ui(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function di(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var fi=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=si(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pi={scaleX:1,scaleY:1},mi=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pi}:null}let s=hi(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pi}:r<t&&r>=a?{x:0,y:o.height+s,...pi}:{x:0,y:0,...pi}};function hi(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gi=`Sortable`,_i=l.default.createContext({activeIndex:-1,containerId:gi,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fi,disabled:{draggable:!1,droppable:!1}});function vi(e){let{children:t,id:n,items:r,strategy:i=fi,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:u,measureDroppableContainers:d}=ri(),f=jt(gi,n),p=s.rect!==null,m=(0,l.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),h=o!=null,g=o?m.indexOf(o.id):-1,_=u?m.indexOf(u.id):-1,v=(0,l.useRef)(m),y=!ui(m,v.current),b=_!==-1&&g===-1||y,x=di(a);Ct(()=>{y&&h&&d(m)},[y,m,h,d]),(0,l.useEffect)(()=>{v.current=m},[m]);let S=(0,l.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:ci(m,c),strategy:i}),[g,f,x.draggable,x.droppable,b,m,_,c,p,i]);return l.default.createElement(_i.Provider,{value:S},t)}var yi=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return si(n,r,i).indexOf(t)},bi=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xi={duration:200,easing:`ease`},Si=`transform`,Ci=zt.Transition.toString({property:Si,duration:0,easing:`linear`}),wi={roleDescription:`sortable`};function Ti(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,l.useState)(null),s=(0,l.useRef)(n);return Ct(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=bn(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,l.useEffect)(()=>{a&&o(null)},[a]),a}function Ei(e){let{animateLayoutChanges:t=bi,attributes:n,disabled:r,data:i,getNewIndex:a=yi,id:o,strategy:s,resizeObserverConfig:c,transition:u=xi}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,l.useContext)(_i),b=Di(r,m),x=d.indexOf(o),S=(0,l.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...i}),[f,i,x,d]),C=(0,l.useMemo)(()=>d.slice(d.indexOf(o)),[d,o]),{rect:w,node:T,isOver:ee,setNodeRef:te}=oi({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:E,activatorEvent:D,activeNodeRect:ne,attributes:re,setNodeRef:ie,listeners:ae,isDragging:oe,over:se,setActivatorNodeRef:ce,transform:le}=ni({id:o,data:S,attributes:{...wi,...n},disabled:b.draggable}),O=ht(te,ie),ue=!!E,de=ue&&!h&&li(p)&&li(_),fe=!v&&oe,k=de?(fe&&de?le:null)??(s??y)({rects:g,activeNodeRect:ne,activeIndex:p,overIndex:_,index:x}):null,pe=li(p)&&li(_)?a({id:o,items:d,activeIndex:p,overIndex:_}):x,A=E?.id,j=(0,l.useRef)({activeId:A,items:d,newIndex:pe,containerId:f}),me=d!==j.current.items,he=t({active:E,containerId:f,isDragging:oe,isSorting:ue,id:o,index:x,items:d,newIndex:j.current.newIndex,previousItems:j.current.items,previousContainerId:j.current.containerId,transition:u,wasDragging:j.current.activeId!=null}),ge=Ti({disabled:!he,index:x,node:T,rect:w});return(0,l.useEffect)(()=>{ue&&j.current.newIndex!==pe&&(j.current.newIndex=pe),f!==j.current.containerId&&(j.current.containerId=f),d!==j.current.items&&(j.current.items=d)},[ue,pe,f,d]),(0,l.useEffect)(()=>{if(A===j.current.activeId)return;if(A!=null&&j.current.activeId==null){j.current.activeId=A;return}let e=setTimeout(()=>{j.current.activeId=A},50);return()=>clearTimeout(e)},[A]),{active:E,activeIndex:p,attributes:re,data:S,rect:w,index:x,newIndex:pe,items:d,isOver:ee,isSorting:ue,isDragging:oe,listeners:ae,node:T,overIndex:_,over:se,setNodeRef:O,setActivatorNodeRef:ce,setDroppableNodeRef:te,setDraggableNodeRef:ie,transform:ge??k,transition:_e()};function _e(){if(ge||me&&j.current.newIndex===x)return Ci;if(!(fe&&!It(D)||!u)&&(ue||he))return zt.Transition.toString({...u,property:Si})}}function Di(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Oi(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var ki=[X.Down,X.Right,X.Up,X.Left],Ai=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(ki.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case X.Down:r.top<a.top&&t.push(n);break;case X.Up:r.top>a.top&&t.push(n);break;case X.Left:r.left>a.left&&t.push(n);break;case X.Right:r.left<a.left&&t.push(n);break}});let c=un({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=sn(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Tn(c).some((e,t)=>s[t]!==e),i=ji(e,t),a=Mi(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Pt(u,l)}}}};function ji(e,t){return!Oi(e)||!Oi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mi(e,t){return!Oi(e)||!Oi(t)||!ji(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Ni=(0,d.create)(e=>({activeEl:null,setActiveEl:t=>e({activeEl:t})})),Pi=(0,d.create)(e=>({mergeTags:[],setMergeTags:t=>e({mergeTags:t})}));function Fi(e){Pi.getState().setMergeTags(e)}var Ii=[{label:`Default`,value:``},{label:`Arial`,value:`Arial, Helvetica, sans-serif`},{label:`Georgia`,value:`Georgia, 'Times New Roman', serif`},{label:`Tahoma`,value:`Tahoma, Geneva, sans-serif`},{label:`Trebuchet MS`,value:`'Trebuchet MS', Helvetica, sans-serif`},{label:`Verdana`,value:`Verdana, Geneva, sans-serif`},{label:`Courier New`,value:`'Courier New', Courier, monospace`},{label:`Times New Roman`,value:`'Times New Roman', Times, serif`}],Li=[`10`,`11`,`12`,`13`,`14`,`15`,`16`,`18`,`20`,`22`,`24`,`28`,`32`,`36`,`48`],Ri=[`#111827`,`#374151`,`#6B7280`,`#9CA3AF`,`#D1D5DB`,`#F3F4F6`,`#FFFFFF`,`#DC2626`,`#F97316`,`#EAB308`,`#22C55E`,`#3B82F6`,`#8B5CF6`,`#EC4899`,`#B91C1C`,`#C2410C`,`#A16207`,`#15803D`,`#1D4ED8`,`#6D28D9`,`#BE185D`],zi=`πŸ˜€.😊.😍.πŸ₯°.😎.🀩.πŸ‘‹.πŸ™Œ.πŸ‘.πŸ’ͺ.❀️.πŸ’™.πŸ’š.πŸ’›.🧑.πŸ’œ.πŸŽ‰.πŸ”₯.✨.⭐.πŸ†.πŸ₯‡.🎁.🎯.πŸš€.πŸ’‘.πŸ“§.πŸ’Œ.πŸ“±.πŸ’».βœ….❌.⚠️.πŸ””.πŸ“Š.πŸ“ˆ.πŸ’°.πŸ’³.πŸ›’.🏷️.πŸ“.πŸ—“οΈ.⚑.🌟`.split(`.`),Bi={unsubscribe:`Unsubscribe`,view_in_browser:`View in browser`,manage_preferences:`Manage preferences`,user_profile:`User profile`};function Vi(){let e=window.getSelection();if(!e||e.isCollapsed||e.rangeCount===0)return``;let t=e.getRangeAt(0).cloneContents(),n=document.createElement(`div`);return n.appendChild(t),n.innerHTML}function Hi(e,t){document.execCommand(e,!1,t)}function Ui(e){document.execCommand(`insertHTML`,!1,e)}function Wi(e,t){let n=Vi();n&&Ui(`<span style="${e}:${t}">${n}</span>`)}function Gi(){let e=window.getSelection();return!e||e.rangeCount===0?null:e.getRangeAt(0).cloneRange()}function Ki(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function qi({title:e,active:t,disabled:n,onMouseDown:r,children:i}){return(0,p.jsx)(`button`,{title:e,disabled:n,onMouseDown:r,className:`flex items-center justify-center w-7 h-7 rounded text-xs transition-colors leading-none ${t?`bg-blue-600 text-white`:`text-gray-700 hover:bg-gray-100 disabled:opacity-30`}`,children:i})}function Ji(){return(0,p.jsx)(`div`,{className:`w-px h-5 bg-gray-200 mx-0.5 shrink-0`})}var Yi={selectedText:``,href:``,linkType:``,isEditing:!1};function Xi(e){return Object.entries(be).find(([,t])=>t===e)?.[0]??``}function Zi({savedRange:e,initial:t,onClose:n}){let[r,i]=(0,l.useState)(t.href),[a,o]=(0,l.useState)(t.linkType),s=(0,l.useRef)(null);(0,l.useEffect)(()=>{setTimeout(()=>s.current?.focus(),20)},[]);let c=e=>{i(e),o(Xi(e))},u=e=>{o(e),i(e?be[e]:``)},d=()=>{let t=r.trim();if(!t){n();return}if(e){let t=e.commonAncestorContainer,n=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(`[data-email-text]`);n&&(n.focus(),Ki(e))}let i=(()=>{if(!e)return t;let n=document.createElement(`div`);return n.appendChild(e.cloneContents()),n.innerHTML||n.textContent||t})();Ui(`<a href="${t}"${a?` data-link-type="${a}"`:``} style="color:inherit;text-decoration:underline">${i}</a>`),n()},m=a!==``,h=r.trim().length>0;return(0,p.jsxs)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-white border border-gray-200 rounded-xl shadow-xl`,style:{width:320},onMouseDown:e=>e.stopPropagation(),children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between px-4 pt-4 pb-2`,children:[(0,p.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:t.isEditing?`Edit link`:`Insert link`}),(0,p.jsx)(`button`,{onClick:n,className:`text-gray-400 hover:text-gray-600 rounded p-0.5`,children:(0,p.jsx)(f.X,{size:14})})]}),(0,p.jsxs)(`div`,{className:`px-4 pb-4 flex flex-col gap-3`,children:[t.selectedText&&(0,p.jsxs)(`div`,{className:`flex items-start gap-2 text-xs bg-gray-50 rounded-lg px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`text-gray-500 shrink-0 mt-0.5`,children:`Text:`}),(0,p.jsx)(`span`,{className:`text-gray-700 font-medium truncate`,children:t.selectedText})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:`URL`}),(0,p.jsx)(`input`,{ref:s,type:`text`,placeholder:`https://example.com`,value:r,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500`,onKeyDown:e=>{e.key===`Enter`&&h&&d(),e.key===`Escape`&&n()}}),m&&(0,p.jsx)(`p`,{className:`text-[11px] text-blue-600 mt-1 flex items-center gap-1`,children:(0,p.jsx)(`span`,{children:`↳ This placeholder will be replaced with the real URL at send time.`})})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:[`Link type `,(0,p.jsx)(`span`,{className:`text-gray-400 font-normal`,children:`(optional β€” for system links)`})]}),(0,p.jsxs)(`select`,{value:a,onChange:e=>u(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none bg-white`,children:[(0,p.jsx)(`option`,{value:``,children:`β€” Custom URL (no special type) β€”`}),Object.keys(Bi).map(e=>(0,p.jsxs)(`option`,{value:e,children:[Bi[e],` β€” `,be[e]]},e))]})]}),(0,p.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,p.jsx)(`button`,{onClick:d,disabled:!h,className:`flex-1 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:t.isEditing?`Update link`:`Insert link`}),(0,p.jsx)(`button`,{onClick:n,className:`px-4 py-2 text-sm text-gray-600 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors`,children:`Cancel`})]})]})]})}function Qi({onClose:e}){let[t,n]=(0,l.useState)(``),r=t=>{document.execCommand(`styleWithCSS`,!1,`true`),document.execCommand(`foreColor`,!1,t),e()};return(0,p.jsxs)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl p-3`,style:{width:196},onMouseDown:e=>e.stopPropagation(),children:[(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:Ri.map(e=>(0,p.jsx)(`button`,{title:e,onClick:()=>r(e),className:`w-6 h-6 rounded border border-gray-200 hover:scale-110 transition-transform shrink-0`,style:{background:e}},e))}),(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(`input`,{type:`text`,placeholder:`#hex or color`,value:t,onChange:e=>n(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t&&r(t),n.key===`Escape`&&e()},className:`flex-1 px-2 py-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`}),(0,p.jsx)(`button`,{onClick:()=>t&&r(t),className:`px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700`,children:`βœ“`})]})]})}function $i({onClose:e}){let t=t=>{Ui(t),e()};return(0,p.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl p-2`,style:{width:260},onMouseDown:e=>e.stopPropagation(),children:(0,p.jsx)(`div`,{className:`flex flex-wrap gap-0.5`,children:zi.map(e=>(0,p.jsx)(`button`,{onClick:()=>t(e),className:`w-8 h-8 text-lg hover:bg-gray-100 rounded flex items-center justify-center`,children:e},e))})})}function ea({onClose:e}){let t=Pi(e=>e.mergeTags),n=t=>{Ui(`{${t}}`),e()};return t.length===0?null:(0,p.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 z-50 bg-white border border-gray-200 rounded-lg shadow-xl py-1`,style:{minWidth:200},onMouseDown:e=>e.stopPropagation(),children:t.map(e=>(0,p.jsxs)(`button`,{onClick:()=>n(e.attribute),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-blue-50 flex items-center justify-between gap-2`,children:[(0,p.jsx)(`span`,{children:e.title}),(0,p.jsx)(`code`,{className:`text-[10px] text-gray-400`,children:`{${e.attribute}}`})]},e.attribute))})}function ta(){let e=Ni(e=>e.activeEl),t=Pi(e=>e.mergeTags),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)({top:0,left:0}),[o,s]=(0,l.useState)({bold:!1,italic:!1,underline:!1}),[c,u]=(0,l.useState)(null),[d,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(Yi),_=(0,l.useRef)(null),v=(0,l.useRef)(null),y=(0,l.useCallback)(()=>u(null),[]),b=(0,l.useCallback)(()=>{let t=window.getSelection();if(!t)return;let n=null;if(!t.isCollapsed&&t.rangeCount>0?n=t.getRangeAt(0).getBoundingClientRect():e&&(n=e.getBoundingClientRect()),!n||n.width===0&&n.height===0)return;let r=_.current?.offsetHeight??40,i=_.current?.offsetWidth??440,o=n.top-r-6;o<8&&(o=n.bottom+6),o=Math.min(o,window.innerHeight-r-8),o=Math.max(o,8);let s=n.left+n.width/2-i/2;s=Math.max(8,Math.min(s,window.innerWidth-i-8)),a({top:o,left:s})},[e]),x=(0,l.useCallback)(()=>{s({bold:document.queryCommandState(`bold`),italic:document.queryCommandState(`italic`),underline:document.queryCommandState(`underline`)})},[]);if((0,l.useEffect)(()=>{if(!e){v.current&&clearTimeout(v.current),v.current=setTimeout(()=>r(!1),150);return}v.current&&clearTimeout(v.current),r(!0),b(),x()},[e,b,x]),(0,l.useEffect)(()=>{let t=()=>{e&&(b(),x())};return document.addEventListener(`selectionchange`,t),()=>document.removeEventListener(`selectionchange`,t)},[e,b,x]),(0,l.useEffect)(()=>{let e=e=>{_.current&&!_.current.contains(e.target)&&y()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[y]),!n||!e)return null;let S=e=>t=>{t.preventDefault(),e()},C=e=>{if(e===`link`){let e=Gi();m(e);let t=``,n=``,r=``,i=!1;if(e){let a=document.createElement(`div`);a.appendChild(e.cloneContents()),t=(a.textContent||``).trim();let o=window.getSelection()?.focusNode,s=o?o.nodeType===Node.ELEMENT_NODE?o.closest(`a`):o.parentElement?.closest(`a`):null;if(s){i=!0,n=s.getAttribute(`href`)||``;let e=s.getAttribute(`data-link-type`)||``;r=Xi(n)||e,r&&(n=be[r])}}g({selectedText:t,href:n,linkType:r,isEditing:i}),u(e=>e===`link`?null:`link`);return}u(t=>t===e?null:e)},w=()=>{let e=window.getSelection();return e&&!e.isCollapsed};return(0,p.jsxs)(`div`,{ref:_,"data-rich-toolbar":`true`,className:`fixed z-[9999] flex items-center gap-0.5 bg-white border border-gray-200 rounded-lg shadow-lg px-1.5 py-1 select-none`,style:{top:i.top,left:i.left},onMouseDown:e=>e.preventDefault(),children:[(0,p.jsx)(qi,{title:`Bold (Ctrl+B)`,active:o.bold,onMouseDown:S(()=>Hi(`bold`)),children:(0,p.jsx)(`b`,{style:{fontSize:13,fontFamily:`inherit`},children:`B`})}),(0,p.jsx)(qi,{title:`Italic (Ctrl+I)`,active:o.italic,onMouseDown:S(()=>Hi(`italic`)),children:(0,p.jsx)(`i`,{style:{fontSize:13,fontFamily:`Georgia, serif`},children:`I`})}),(0,p.jsx)(qi,{title:`Underline (Ctrl+U)`,active:o.underline,onMouseDown:S(()=>Hi(`underline`)),children:(0,p.jsx)(`u`,{style:{fontSize:13},children:`U`})}),(0,p.jsx)(Ji,{}),(0,p.jsx)(`select`,{title:`Font family`,className:`h-7 px-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white max-w-[110px]`,defaultValue:``,onMouseDown:e=>e.stopPropagation(),onChange:t=>{let n=t.target.value;if(n){if(!w()){e?.focus();return}Wi(`font-family`,n),e?.focus()}},children:Ii.map(e=>(0,p.jsx)(`option`,{value:e.value,children:e.label},e.label))}),(0,p.jsxs)(`select`,{title:`Font size`,className:`h-7 px-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white w-14`,defaultValue:``,onMouseDown:e=>e.stopPropagation(),onChange:t=>{let n=t.target.value;if(n){if(!w()){e?.focus();return}Wi(`font-size`,`${n}px`),e?.focus()}},children:[(0,p.jsx)(`option`,{value:``,children:`Size`}),Li.map(e=>(0,p.jsx)(`option`,{value:e,children:e},e))]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Text color`,onMouseDown:S(()=>C(`color`)),children:(0,p.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5`,children:[(0,p.jsx)(`span`,{className:`text-xs font-bold leading-none`,style:{fontFamily:`serif`},children:`A`}),(0,p.jsx)(`span`,{className:`w-4 h-1 rounded-sm bg-current`})]})}),c===`color`&&(0,p.jsx)(Qi,{onClose:y})]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert link`,onMouseDown:S(()=>C(`link`)),children:(0,p.jsx)(f.Link2,{size:13})}),c===`link`&&(0,p.jsx)(Zi,{savedRange:d,initial:h,onClose:y})]}),(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert emoji`,onMouseDown:S(()=>C(`emoji`)),children:(0,p.jsx)(f.Smile,{size:13})}),c===`emoji`&&(0,p.jsx)($i,{onClose:y})]}),t.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Ji,{}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(qi,{title:`Insert merge tag`,onMouseDown:S(()=>C(`mergeTag`)),children:(0,p.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] font-mono`,children:[(0,p.jsx)(f.Tag,{size:11}),(0,p.jsx)(f.ChevronDown,{size:10})]})}),c===`mergeTag`&&(0,p.jsx)(ea,{onClose:y})]})]})]})}var na=375;function ra(e){let t=e.replace(`#`,``);if(t.length!==3&&t.length!==6)return e===`white`||e===`#fff`||e===`#ffffff`;let n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255;return .2126*r+.7152*i+.0722*a>.82}function ia(e,t){let n=e??{};if(t!==`mobile`)return n;let r=n.mobile??{};return{...n,...r}}function aa(){let{doc:e,selection:t,setSelection:n,reorderModules:r,deleteModule:i,duplicateModule:a,deleteElement:o,moveElement:s,viewMode:c}=M(),u=en($t(tr,{activationConstraint:{distance:5}}),$t(Xn,{coordinateGetter:Ai})),d=t=>{let{active:n,over:i}=t;if(!i||n.id===i.id)return;let a=e.modules.findIndex(e=>e.id===n.id),o=e.modules.findIndex(e=>e.id===i.id);a===-1||o===-1||r(a,o)};(0,l.useEffect)(()=>{let e=e=>{if(e.key!==`Delete`&&e.key!==`Backspace`)return;let n=e.target;n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable||(t?.kind===`module`?i(t.moduleId):t?.kind===`element`&&o(t.moduleId,t.elementId))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,i,o]);let f=x(e.settings.backgroundColor,e.theme),m=x(e.settings.contentBackgroundColor,e.theme),h=e.modules.map(e=>e.id),g=c===`mobile`?na:e.settings.width;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ta,{}),(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto`,style:{background:f},onClick:()=>n({kind:`email`}),children:(0,p.jsx)(`div`,{className:`py-8 flex justify-center`,children:(0,p.jsxs)(`div`,{className:`shadow-lg transition-all duration-200 ${c===`mobile`?`rounded-[28px] border-[10px] border-gray-800`:``}`,style:{width:g,background:m,minHeight:300},onClick:e=>e.stopPropagation(),children:[e.modules.length===0&&(0,p.jsx)(`div`,{className:`p-12 text-center text-gray-400 text-sm`,children:`Add modules from the left sidebar to start building your email.`}),(0,p.jsx)(Qr,{sensors:u,collisionDetection:ln,onDragEnd:d,children:(0,p.jsx)(vi,{items:h,strategy:mi,children:e.modules.map((r,o)=>(0,p.jsx)(oa,{mod:r,index:o,viewMode:c,selected:t?.kind===`module`&&t.moduleId===r.id,selectionEl:t?.kind===`element`&&t.moduleId===r.id?t.elementId:null,theme:e.theme,onSelectModule:()=>n({kind:`module`,moduleId:r.id}),onSelectElement:e=>n({kind:`element`,moduleId:r.id,elementId:e}),onDuplicate:()=>a(r.id),onDelete:()=>i(r.id)},r.id))})})]})})})]})}function oa(e){let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=Ei({id:e.mod.id});return(0,p.jsx)(`div`,{ref:r,style:{transform:zt.Transform.toString(i),transition:a,opacity:o?.5:1,position:`relative`,zIndex:e.selected?10:`auto`},children:(0,p.jsx)(sa,{mod:e.mod,viewMode:e.viewMode,selected:e.selected,selectionEl:e.selectionEl,theme:e.theme,onSelectModule:e.onSelectModule,onSelectElement:e.onSelectElement,onDuplicate:e.onDuplicate,onDelete:e.onDelete,dragHandle:(0,p.jsx)(`button`,{...t,...n,className:`bg-blue-600 text-white p-1 rounded cursor-grab active:cursor-grabbing`,title:`Drag to reorder`,onClick:e=>e.stopPropagation(),children:(0,p.jsx)(f.GripVertical,{size:14})})})})}function sa({mod:e,viewMode:t,selected:n,selectionEl:r,theme:i,onSelectModule:a,onSelectElement:o,onDuplicate:s,onDelete:c,dragHandle:u}){let d=e.style??{};if(d.hideOn===t)return null;let m=S(ia(d,t),i),[h,g]=(0,l.useState)(!1);return(0,p.jsxs)(`div`,{style:{backgroundColor:m.backgroundColor,paddingTop:m.paddingTop??0,paddingBottom:m.paddingBottom??0,paddingLeft:m.paddingLeft??0,paddingRight:m.paddingRight??0,borderRadius:m.borderRadius,position:`relative`,outline:n?`2px solid #2563eb`:h?`1px dashed #93c5fd`:`1px dashed transparent`,outlineOffset:-2,cursor:`pointer`},onClick:e=>{e.stopPropagation(),a()},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[!n&&h&&(0,p.jsxs)(`div`,{className:`absolute top-0 right-0 z-10 bg-blue-600 text-white text-[10px] px-1.5 py-0.5 rounded-bl pointer-events-none`,children:[`Click to select: `,e.name]}),n&&(0,p.jsxs)(`div`,{className:`absolute top-0 left-0 z-20 flex items-center gap-1 p-1 rounded-br bg-blue-600 shadow-md`,onClick:e=>e.stopPropagation(),children:[u,(0,p.jsx)(`button`,{onClick:e=>{e.stopPropagation(),s()},className:`text-white p-1 rounded hover:bg-blue-700`,title:`Duplicate`,children:(0,p.jsx)(f.Copy,{size:14})}),(0,p.jsx)(`button`,{onClick:e=>{e.stopPropagation(),c()},className:`text-white p-1 rounded hover:bg-red-600`,title:`Delete`,children:(0,p.jsx)(f.Trash2,{size:14})}),(0,p.jsx)(`span`,{className:`text-white text-[10px] font-medium px-1.5 py-0.5`,children:e.name})]}),e.children.map((s,c)=>(0,p.jsx)(ca,{el:s,index:c,totalElements:e.children.length,viewMode:t,theme:i,moduleId:e.id,moduleSelected:n,selected:r===s.id,onSelect:()=>o(s.id),onSelectModule:a},s.id))]})}function ca({el:e,index:t,totalElements:n,viewMode:r,theme:i,moduleId:a,moduleSelected:o,selected:s,onSelect:c,onSelectModule:l}){let u=M(e=>e.moveElement),d=M(e=>e.deleteElement);if(e.style?.hideOn===r)return null;let m={outline:s?`2px solid #f59e0b`:`1px dashed rgba(0,0,0,0.08)`,outlineOffset:-1,position:`relative`},h=e=>{if(e.stopPropagation(),!o&&!s){l();return}c()},g=s&&(0,p.jsxs)(`div`,{className:`absolute top-0 right-0 z-20 flex items-center gap-1 p-1 rounded-bl bg-amber-500 shadow-md`,onClick:e=>e.stopPropagation(),children:[(0,p.jsx)(`button`,{onClick:()=>l(),className:`text-white p-1 rounded hover:bg-amber-600`,title:`Select parent block`,children:(0,p.jsx)(f.MousePointer2,{size:12})}),(0,p.jsx)(`button`,{disabled:t===0,onClick:()=>u(a,e.id,-1),className:`text-white p-1 rounded disabled:opacity-40 hover:bg-amber-600`,title:`Move up`,children:(0,p.jsx)(f.ArrowUp,{size:12})}),(0,p.jsx)(`button`,{disabled:t===n-1,onClick:()=>u(a,e.id,1),className:`text-white p-1 rounded disabled:opacity-40 hover:bg-amber-600`,title:`Move down`,children:(0,p.jsx)(f.ArrowDown,{size:12})}),(0,p.jsx)(`button`,{onClick:()=>d(a,e.id),className:`text-white p-1 rounded hover:bg-red-600`,title:`Delete element`,children:(0,p.jsx)(f.Trash2,{size:12})}),(0,p.jsx)(`span`,{className:`text-white text-[10px] font-medium px-1 py-0.5`,children:e.type})]}),_=e=>(0,p.jsxs)(`div`,{style:m,onClick:h,children:[g,e]});switch(e.type){case`text`:return _((0,p.jsx)(la,{el:e,viewMode:r,theme:i,moduleId:a}));case`image`:return _((0,p.jsx)(ua,{el:e,viewMode:r,theme:i}));case`button`:return _((0,p.jsx)(da,{el:e,viewMode:r,theme:i}));case`spacer`:return _((0,p.jsx)(fa,{el:e}));case`divider`:return _((0,p.jsx)(pa,{el:e,viewMode:r,theme:i}));case`productGrid`:return _((0,p.jsx)(ma,{el:e,viewMode:r,theme:i}))}}function la({el:e,viewMode:t,theme:n,moduleId:r}){let i=M(e=>e.updateElement),a=Ni(e=>e.setActiveEl),o=(0,l.useRef)(null),s=(0,l.useRef)(!1),c=(0,l.useRef)(!1),u=(0,l.useRef)(e.content);u.current=e.content,(0,l.useEffect)(()=>{let t=o.current;!t||s.current||t.innerHTML!==e.content&&(t.innerHTML=e.content)});let d=S(ia(e.style,t),n),f=d.color??`#000000`,m=ra(f);return(0,p.jsx)(`div`,{ref:o,"data-email-text":`true`,style:{fontFamily:d.fontFamily,fontSize:d.fontSize,lineHeight:d.lineHeight,letterSpacing:d.letterSpacing,fontWeight:d.fontWeight,color:f,textAlign:d.align,paddingTop:d.paddingTop??8,paddingBottom:d.paddingBottom??8,paddingLeft:d.paddingLeft??16,paddingRight:d.paddingRight??16,margin:0,minHeight:`1.5em`,outline:`none`,...m?{textShadow:`0 0 8px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.45)`}:void 0},contentEditable:!0,suppressContentEditableWarning:!0,onFocus:e=>{s.current=!0,c.current=!0,a(e.currentTarget)},onBlur:t=>{s.current=!1,c.current=!1,t.relatedTarget?.closest(`[data-rich-toolbar]`)||a(null);let n=t.currentTarget.innerHTML;n!==u.current&&i(r,e.id,{content:n})},onClick:e=>{c.current&&e.stopPropagation()}})}function ua({el:e,viewMode:t,theme:n}){let r=S(ia(e.style,t),n),i={textAlign:r.align??`center`,paddingTop:r.paddingTop??0,paddingBottom:r.paddingBottom??0,paddingLeft:r.paddingLeft??0,paddingRight:r.paddingRight??0},a={display:`inline-block`,maxWidth:`100%`,width:r.width,height:r.height||`auto`,borderRadius:r.borderRadius};return(0,p.jsx)(`div`,{style:i,children:(0,p.jsx)(`img`,{src:e.src,alt:e.alt??``,style:a})})}function da({el:e,viewMode:t,theme:n}){let r=S(ia(e.style,t),n);return(0,p.jsx)(`div`,{style:{textAlign:r.align??`center`,paddingTop:r.paddingTop??12,paddingBottom:r.paddingBottom??12,paddingLeft:r.paddingLeft??16,paddingRight:r.paddingRight??16},children:(0,p.jsx)(`span`,{style:{display:`inline-block`,backgroundColor:r.backgroundColor??`#3A7D52`,color:r.color??`#fff`,fontFamily:r.fontFamily,fontSize:r.fontSize??16,fontWeight:r.fontWeight??`bold`,borderRadius:r.borderRadius??6,padding:`12px 24px`,textDecoration:`none`},children:e.label})})}function fa({el:e}){return(0,p.jsx)(`div`,{style:{height:e.height,background:`rgba(0,0,0,0.02)`}})}function pa({el:e,viewMode:t,theme:n}){let r=S(ia(e.style,t),n);return(0,p.jsx)(`div`,{style:{paddingTop:r.paddingTop??8,paddingBottom:r.paddingBottom??8},children:(0,p.jsx)(`hr`,{style:{border:0,borderTop:`${r.thickness??1}px solid ${r.color??`#E5E7EB`}`,margin:0}})})}function ma({el:e,viewMode:t,theme:n}){let r=S(ia(e.style,t),n),i=t===`mobile`,a=e.columns,o=r.cardBackgroundColor??r.backgroundColor??`transparent`,s=r.nameColor??`#111827`,c=r.finalPriceColor??`#3A7D52`,l=r.oldPriceColor??`#9CA3AF`,u=r.buttonBackgroundColor??`#3A7D52`,d=r.buttonColor??`#FFFFFF`,f=r.borderRadius??0;return(0,p.jsx)(`div`,{style:{paddingTop:r.paddingTop??16,paddingBottom:r.paddingBottom??16,paddingLeft:r.paddingLeft??16,paddingRight:r.paddingRight??16,display:`flex`,flexWrap:`wrap`,gap:8},children:e.products.map(t=>(0,p.jsxs)(`div`,{style:{width:i?`100%`:`calc(${100/a}% - 8px)`,background:o,borderRadius:f,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(`img`,{src:t.image,alt:t.imageAlt??t.name,style:{display:`block`,width:`100%`,height:`auto`,borderRadius:f}}),(0,p.jsx)(`div`,{style:{padding:`12px 12px 4px 12px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:15,fontWeight:`bold`,color:s,lineHeight:1.3},children:t.name}),e.showStars&&t.stars!=null&&(0,p.jsx)(`div`,{className:`stars`,style:{padding:`0 12px 4px 12px`,color:`#F5A623`,fontSize:15,letterSpacing:1},"aria-label":`${t.stars} out of 5 stars`,children:te(t.stars)}),(0,p.jsxs)(`div`,{style:{padding:`0 12px 8px 12px`,fontFamily:`Arial, Helvetica, sans-serif`},children:[e.showOldPrice&&t.oldPrice&&(0,p.jsx)(`span`,{className:`old_price`,style:{color:l,textDecoration:`line-through`,fontSize:14,marginRight:8},children:t.oldPrice}),(0,p.jsx)(`span`,{className:`final_price`,style:{color:c,fontWeight:`bold`,fontSize:18},children:t.finalPrice})]}),e.showDescription&&t.description&&(0,p.jsx)(`div`,{style:{padding:`0 12px 8px 12px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:13,color:`#6B7280`,lineHeight:1.5},children:t.description}),e.showButton&&(0,p.jsx)(`div`,{style:{padding:`4px 12px 12px 12px`,textAlign:`center`,marginTop:`auto`},children:(0,p.jsx)(`span`,{style:{display:`inline-block`,padding:`10px 18px`,fontFamily:`Arial, Helvetica, sans-serif`,fontSize:13,fontWeight:`bold`,color:d,backgroundColor:u,borderRadius:6},children:t.buttonLabel??e.buttonLabel??`Shop now`})})]},t.id))})}var ha=null,ga=new Set,_a=0;function va(){_a+=1;for(let e of ga)e()}function ya(e){ha!==e&&(ha=e,va())}function ba(){return ha}var xa=e=>(ga.add(e),()=>{ga.delete(e)}),Sa=()=>_a,Ca=null,wa={status:`idle`,vouchers:[]},Ta=null,Ea=new Set,Da=0;function Oa(){Da+=1;for(let e of Ea)e()}function ka(e){Ca!==e&&(Ca=e,wa={status:`idle`,vouchers:[]},Ta=null,Oa())}function Aa(){return Ca}function ja(){return wa}function Ma(e=!1){if(!Ca)return Promise.resolve([]);if(!e&&wa.status===`loaded`)return Promise.resolve(wa.vouchers);if(Ta)return Ta;wa={status:`loading`,vouchers:wa.vouchers},Oa();let t=Ca.list().then(e=>(wa={status:`loaded`,vouchers:Array.isArray(e)?e:[]},Ta=null,Oa(),wa.vouchers)).catch(e=>(wa={status:`error`,vouchers:[],error:e instanceof Error?e.message:String(e)},Ta=null,Oa(),[]));return Ta=t,t}var Na=e=>(Ea.add(e),()=>{Ea.delete(e)}),Pa=()=>Da,Fa=(0,d.create)(e=>({enabled:!1,setEnabled:t=>e({enabled:t})}));function Ia(){Fa.getState().setEnabled(!0)}var La=[],Ra=null,za={registerModule:e=>Ue.register(e),registerTheme:e=>La.push(e),registerAssetProvider:e=>{Ra=e},registerProductProvider:e=>{ya(e)},registerVoucherProvider:e=>{ka(e)},setAIProvider:e=>{Ye(e)},registerMergeTags:e=>Fi(e),registerRecommendationsPlugin:()=>Ia()};function Ba(e){e.setup(za)}function Va(){return Ra}var Ha={key:`days`,label:`Time window`,type:`select`,default:7,options:[{value:7,label:`Last 7 days`},{value:14,label:`Last 14 days`},{value:30,label:`Last 30 days`}]},Ua=[{id:`abandoned-cart`,label:`Abandoned basket products`,group:`behavioral`},{id:`bestseller-conversion`,label:`Best seller by Conversion`,group:`catalog`,params:[Ha]},{id:`bestseller-units`,label:`Best seller by Units`,group:`catalog`,params:[Ha]},{id:`new-products`,label:`New items added`,group:`catalog`,params:[Ha]},{id:`cross-sell`,label:`Products Cross-Sell`,group:`contextual`},{id:`upsell`,label:`Products Upsell`,group:`contextual`},{id:`viewed-categories`,label:`Items from viewed categories`,group:`behavioral`},{id:`viewed-items`,label:`Items viewed`,group:`behavioral`},{id:`similar-basket`,label:`Similar to basket items`,group:`behavioral`},{id:`bought-together`,label:`Items bought together`,group:`contextual`},{id:`best-discount`,label:`Items with the best discount`,group:`catalog`},{id:`match-data`,label:`Items matching specific attributes`,group:`catalog`},{id:`last-purchased`,label:`Last purchased items`,group:`personal`},{id:`similar-to-purchased`,label:`Similar to last purchase`,group:`personal`},{id:`cross-sell-purchased`,label:`Cross-sell to last purchase`,group:`personal`},{id:`similar-items`,label:`Similar items`,group:`contextual`}],Wa=Object.fromEntries(Ua.map(e=>[e.id,e])),Ga=[{value:`smart-reccs`,label:`Smart Recommendations`,description:`Best generic algorithm β€” recommended default.`},{value:`random`,label:`Random items (strict filters)`,description:`Random items that still pass include/exclude filters.`},{value:`ignore`,label:`Ignore position`,description:`Skip the slot if no items found.`},{value:`stop`,label:`Don't display`,description:`Don't render the email if the slot can't be filled.`}];function Ka(e=2){return{mode:`recommender`,noProducts:e,sourceFeed:``,manualProducts:[],stack:[{algorithm:`abandoned-cart`}],fallback:`smart-reccs`,filters:{includeProducts:[],excludeProducts:[],includeCategories:[],excludeCategories:[],minStock:0,minPrice:0,mainOnly:!1,higherPrice:!1,salesPrice:!1,sameCategory:!1,matchTitle:!1,sameField:``}}}function qa(e){if(!e)return null;let t=e.recommendations;return!t||typeof t!=`object`?null:t}function Ja(e){return e?.children?e.children.some(e=>e.type===`productGrid`):!1}function Ya(e){if(!e?.children)return 0;let t=0;for(let n of e.children)n.type===`productGrid`&&(t+=n.products.length);return t}function Xa(e){return{params:{selection:e.mode===`manual`?`manual`:`recommender`,include:{item:e.filters.includeProducts,category:e.filters.includeCategories},exclude:{item:e.filters.excludeProducts,category:e.filters.excludeCategories},higherPrice:e.filters.higherPrice??!1,salesPrice:e.filters.salesPrice??!1,sameCategory:e.filters.sameCategory??!1,matchTitle:e.filters.matchTitle??!1,sameField:e.filters.sameField??``,mainOnly:e.filters.mainOnly??!1},noProducts:String(e.noProducts),fallback:e.fallback,stack:e.mode===`manual`?[]:e.stack,minStock:String(e.filters.minStock??0),minPrice:String(e.filters.minPrice??0),sourceFeed:e.sourceFeed??``,manualProducts:e.manualProducts}}function Za({mod:e}){let t=M(e=>e.updateModule),n=Ya(e)||2,r=qa(e.data)??Ka(n),i=n=>{let i={...r,...n};t(e.id,{data:{...e.data??{},recommendations:i}})};return(0,p.jsxs)(`div`,{className:`border border-blue-200 rounded-lg bg-blue-50/40 mt-4 overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 border-b border-blue-200 bg-blue-50`,children:[(0,p.jsx)(f.Sparkles,{size:14,className:`text-blue-700`}),(0,p.jsx)(`div`,{className:`text-xs font-semibold text-blue-900 uppercase tracking-wide`,children:`Products Source`})]}),(0,p.jsx)(`div`,{className:`p-3 bg-white border-b border-blue-100`,children:(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(to,{active:r.mode===`manual`,title:`Select Items`,subtitle:`Hand-pick from a feed`,onClick:()=>i({mode:`manual`})}),(0,p.jsx)(to,{active:r.mode===`recommender`,title:`Recommender`,subtitle:`Algorithms + filters`,onClick:()=>i({mode:`recommender`})})]})}),(0,p.jsxs)(`div`,{className:`p-3 bg-white space-y-3`,children:[(0,p.jsxs)(ro,{label:`Number of products`,children:[(0,p.jsx)(`input`,{type:`number`,min:1,max:20,value:r.noProducts,onChange:e=>i({noProducts:Number(e.target.value)||1}),className:eo}),(0,p.jsxs)(`div`,{className:`text-[11px] text-gray-500 mt-1`,children:[`Block has `,n,` slot`,n===1?``:`s`,` in the design.`]})]}),r.mode===`manual`?(0,p.jsx)(Qa,{logic:r,update:i}):(0,p.jsx)($a,{logic:r,update:i,updateFilters:e=>i({filters:{...r.filters,...e}})}),(0,p.jsxs)(`details`,{className:`border border-gray-200 rounded`,children:[(0,p.jsx)(`summary`,{className:`px-2 py-1.5 text-[11px] font-medium text-gray-600 cursor-pointer select-none`,children:`View saved JSON`}),(0,p.jsx)(`pre`,{className:`text-[10px] bg-gray-900 text-gray-100 p-2 overflow-auto max-h-60 leading-tight`,children:JSON.stringify(r,null,2)})]})]})]})}function Qa({logic:e,update:t}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ro,{label:`Source feed`,children:(0,p.jsx)(`input`,{type:`text`,placeholder:`e.g. main-catalog`,value:e.sourceFeed??``,onChange:e=>t({sourceFeed:e.target.value}),className:eo})}),(0,p.jsx)(ro,{label:`Items to include (product IDs / SKUs)`,children:(0,p.jsx)(co,{value:e.manualProducts,onChange:e=>t({manualProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(`div`,{className:`text-[11px] text-gray-500`,children:`Items are sent to the renderer as-is in the order shown.`})]})}function $a({logic:e,update:t,updateFilters:n}){let[r,i]=(0,l.useState)(!1);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,p.jsxs)(`label`,{className:`text-xs font-medium text-gray-700`,children:[`Algorithms (max `,3,`)`]}),(0,p.jsx)(so,{disabled:e.stack.length>=3,existing:e.stack.map(e=>e.algorithm),onPick:n=>t({stack:[...e.stack,{algorithm:n}]})})]}),(0,p.jsx)(oo,{stack:e.stack,onChange:e=>t({stack:e})})]}),(0,p.jsxs)(ro,{label:`Fallback`,children:[(0,p.jsx)(`select`,{value:e.fallback,onChange:e=>t({fallback:e.target.value}),className:eo,children:Ga.map(e=>(0,p.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,p.jsx)(`div`,{className:`text-[11px] text-gray-500 mt-1`,children:Ga.find(t=>t.value===e.fallback)?.description})]}),(0,p.jsx)(no,{title:`Include & Exclude filters`,right:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(io,{active:!r,onClick:()=>i(!1),children:`Basic`}),(0,p.jsx)(io,{active:r,onClick:()=>i(!0),children:`Advanced`})]})}),(0,p.jsx)(ro,{label:`Exclude products`,children:(0,p.jsx)(co,{value:e.filters.excludeProducts,onChange:e=>n({excludeProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(ro,{label:`Include products`,children:(0,p.jsx)(co,{value:e.filters.includeProducts,onChange:e=>n({includeProducts:e}),placeholder:`Add product id`})}),(0,p.jsx)(ro,{label:`Exclude categories`,children:(0,p.jsx)(co,{value:e.filters.excludeCategories,onChange:e=>n({excludeCategories:e}),placeholder:`Add category`})}),(0,p.jsx)(ro,{label:`Include categories`,children:(0,p.jsx)(co,{value:e.filters.includeCategories,onChange:e=>n({includeCategories:e}),placeholder:`Add category`})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(ro,{label:`Minimum stock`,children:(0,p.jsx)(`input`,{type:`number`,min:0,value:e.filters.minStock??0,onChange:e=>n({minStock:Number(e.target.value)||0}),className:eo})}),(0,p.jsx)(ro,{label:`Minimum price`,children:(0,p.jsx)(`input`,{type:`number`,min:0,value:e.filters.minPrice??0,onChange:e=>n({minPrice:Number(e.target.value)||0}),className:eo})})]}),(0,p.jsx)(ao,{label:`Only main items`,checked:!!e.filters.mainOnly,onChange:e=>n({mainOnly:e})}),(0,p.jsx)(ao,{label:`Higher price than current item (upsell)`,checked:!!e.filters.higherPrice,onChange:e=>n({higherPrice:e})}),(0,p.jsx)(ao,{label:`On sale only`,checked:!!e.filters.salesPrice,onChange:e=>n({salesPrice:e})}),(0,p.jsx)(ao,{label:`Same category as current`,checked:!!e.filters.sameCategory,onChange:e=>n({sameCategory:e})}),(0,p.jsx)(ao,{label:`Match title keywords`,checked:!!e.filters.matchTitle,onChange:e=>n({matchTitle:e})}),(0,p.jsx)(ro,{label:`Match same fields (comma-separated)`,children:(0,p.jsx)(`input`,{type:`text`,placeholder:`brand, color`,value:e.filters.sameField??``,onChange:e=>n({sameField:e.target.value}),className:eo})}),r&&(0,p.jsx)(ro,{label:`Advanced JSON overrides`,children:(0,p.jsx)(lo,{value:e.filters.advanced??{},onChange:e=>n({advanced:e})})})]})}var eo=`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white`;function to({active:e,icon:t,title:n,subtitle:r,onClick:i}){return(0,p.jsxs)(`button`,{onClick:i,className:`flex flex-col items-start gap-0.5 p-2.5 rounded border text-left transition `+(e?`border-teal-600 bg-teal-50 ring-1 ring-teal-600`:`border-gray-200 bg-white hover:border-gray-300`),children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 `+(e?`text-teal-700`:`text-gray-700`),children:[t,(0,p.jsx)(`span`,{className:`text-xs font-semibold`,children:n})]}),(0,p.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:r})]})}function no({title:e,right:t}){return(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-200 pt-3 mt-3`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-gray-600`,children:e}),t]})}function ro({label:e,children:t}){return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-gray-700 mb-1`,children:e}),t]})}function io({active:e,onClick:t,children:n}){return(0,p.jsx)(`button`,{onClick:t,className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide `+(e?`bg-teal-600 text-white`:`bg-gray-100 text-gray-600 hover:bg-gray-200`),children:n})}function ao({label:e,checked:t,onChange:n}){return(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-2 text-xs text-gray-700 py-1`,children:[(0,p.jsx)(`span`,{children:e}),(0,p.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`h-4 w-4 accent-teal-600`})]})}function oo({stack:e,onChange:t}){if(e.length===0)return(0,p.jsxs)(`div`,{className:`text-[11px] text-gray-500 italic border border-dashed border-gray-300 rounded px-2 py-3 text-center`,children:[`No algorithms yet. Click `,(0,p.jsx)(`b`,{children:`Add algorithm`}),` to start.`]});let n=(n,r)=>{let i=n+r;if(i<0||i>=e.length)return;let a=e.slice();[a[n],a[i]]=[a[i],a[n]],t(a)},r=n=>t(e.filter((e,t)=>t!==n)),i=(n,r,i)=>{let a=e.slice();a[n]={...a[n],params:{...a[n].params??{},[r]:i}},t(a)};return(0,p.jsx)(`div`,{className:`space-y-1.5`,children:e.map((t,a)=>{let o=Wa[t.algorithm];return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded px-2 py-1.5 bg-white flex flex-col gap-1`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`span`,{className:`flex-1 text-xs text-gray-800 truncate`,children:o?.label??t.algorithm}),(0,p.jsx)(`button`,{title:`Move up`,onClick:()=>n(a,-1),disabled:a===0,className:`p-1 text-gray-400 hover:text-gray-700 disabled:opacity-30`,children:(0,p.jsx)(f.ChevronUp,{size:13})}),(0,p.jsx)(`button`,{title:`Move down`,onClick:()=>n(a,1),disabled:a===e.length-1,className:`p-1 text-gray-400 hover:text-gray-700 disabled:opacity-30`,children:(0,p.jsx)(f.ChevronDown,{size:13})}),(0,p.jsx)(`button`,{title:`Remove`,onClick:()=>r(a),className:`p-1 text-gray-400 hover:text-red-600`,children:(0,p.jsx)(f.Trash2,{size:13})})]}),o?.params?.map(e=>(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[10px] text-gray-500 w-20 shrink-0`,children:e.label}),e.type===`select`?(0,p.jsx)(`select`,{value:String(t.params?.[e.key]??e.default??``),onChange:t=>i(a,e.key,t.target.value),className:`flex-1 text-xs border border-gray-200 rounded px-1.5 py-1 bg-white`,children:e.options?.map(e=>(0,p.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))}):(0,p.jsx)(`input`,{type:e.type===`number`?`number`:`text`,value:String(t.params?.[e.key]??e.default??``),onChange:t=>i(a,e.key,e.type===`number`?Number(t.target.value):t.target.value),className:`flex-1 text-xs border border-gray-200 rounded px-1.5 py-1`})]},e.key))]},a)})})}function so({disabled:e,existing:t,onPick:n}){let[r,i]=(0,l.useState)(!1);return(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsxs)(`button`,{disabled:e,onClick:()=>i(e=>!e),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-semibold uppercase `+(e?`bg-gray-200 text-gray-400 cursor-not-allowed`:`bg-teal-600 text-white hover:bg-teal-700`),children:[(0,p.jsx)(f.Plus,{size:12}),` Add`]}),r&&!e&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>i(!1)}),(0,p.jsx)(`div`,{className:`absolute right-0 top-full mt-1 w-64 max-h-80 overflow-auto bg-white border border-gray-200 rounded shadow-lg z-20`,children:Ua.map(e=>{let r=t.includes(e.id);return(0,p.jsxs)(`button`,{disabled:r,onClick:()=>{n(e.id),i(!1)},className:`block w-full text-left px-2.5 py-1.5 text-xs `+(r?`text-gray-400 cursor-not-allowed`:`text-gray-700 hover:bg-teal-50 hover:text-teal-700`),children:[e.label,r&&(0,p.jsx)(`span`,{className:`ml-1 text-[10px]`,children:`Β· added`})]},e.id)})})]})]})}function co({value:e,onChange:t,placeholder:n}){let[r,i]=(0,l.useState)(``),a=()=>{let n=r.trim();n&&(e.includes(n)||(t([...e,n]),i(``)))};return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded bg-white p-1 flex flex-wrap items-center gap-1 focus-within:border-blue-500`,children:[e.map(n=>(0,p.jsxs)(`span`,{className:`inline-flex items-center gap-1 bg-gray-100 text-gray-800 text-[11px] rounded px-1.5 py-0.5`,children:[n,(0,p.jsx)(`button`,{onClick:()=>t(e.filter(e=>e!==n)),className:`text-gray-500 hover:text-red-600`,children:(0,p.jsx)(f.X,{size:10})})]},n)),(0,p.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`||n.key===`,`?(n.preventDefault(),a()):n.key===`Backspace`&&!r&&e.length&&t(e.slice(0,-1))},onBlur:a,placeholder:e.length===0?n:``,className:`flex-1 min-w-20 outline-none text-xs bg-transparent px-1 py-0.5`})]})}function lo({value:e,onChange:t}){let[n,r]=(0,l.useState)(()=>JSON.stringify(e,null,2)),[i,a]=(0,l.useState)(null);return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`textarea`,{value:n,onChange:e=>{let n=e.target.value;r(n);try{let e=JSON.parse(n||`{}`);a(null),t(e)}catch(e){a(String(e.message))}},rows:6,spellCheck:!1,className:`w-full font-mono text-[11px] border border-gray-200 rounded p-2 bg-gray-50 focus:border-blue-500 focus:outline-none`}),i&&(0,p.jsx)(`div`,{className:`text-[10px] text-red-600 mt-1`,children:i})]})}function uo(){(0,l.useSyncExternalStore)(Na,Pa,Pa);let e=Aa()!==null,t=ja();return(0,l.useEffect)(()=>{e&&t.status===`idle`&&Ma()},[e,t.status]),{available:e,status:t.status,vouchers:t.vouchers,error:t.error,reload:()=>void Ma(!0)}}function fo(e){return e?.children?.find(e=>e.type===`text`&&e.role===`voucherCode`)}function po(e){return!!fo(e)}function mo(e){let t=e?.data?.voucher;return t&&typeof t==`object`&&`code`in t?t:null}function ho(e){return{id:e.id,title:e.title,code:e.code}}function go({mod:e}){let t=M(e=>e.updateElement),n=M(e=>e.updateModule),{available:r,status:i,vouchers:a,error:o,reload:s}=uo(),c=fo(e),l=mo(e),u=l&&a.some(e=>e.id===l.id)?l.id:``,d=r=>{if(!r){n(e.id,{data:{...e.data??{},voucher:void 0}});return}c&&t(e.id,c.id,{content:r.code}),n(e.id,{data:{...e.data??{},voucher:ho(r)}})};return(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500`,children:[(0,p.jsx)(f.Ticket,{size:13,className:`text-blue-600`}),` Voucher`]}),r&&(0,p.jsxs)(`button`,{type:`button`,onClick:s,disabled:i===`loading`,className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded disabled:opacity-50`,title:`Reload vouchers`,children:[i===`loading`?(0,p.jsx)(f.Loader2,{size:12,className:`animate-spin`}):(0,p.jsx)(f.RefreshCw,{size:12}),`Reload`]})]}),r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`label`,{className:`block mb-2`,children:[(0,p.jsx)(`span`,{className:`block text-xs text-gray-600 mb-1`,children:`Select voucher`}),(0,p.jsxs)(`select`,{value:u,disabled:i===`loading`&&a.length===0,onChange:e=>{let t=a.find(t=>t.id===e.target.value)??null;d(t)},className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded bg-white focus:border-blue-500 focus:outline-none disabled:bg-gray-50`,children:[(0,p.jsx)(`option`,{value:``,children:i===`loading`&&a.length===0?`Loading vouchers…`:`Please select a voucher…`}),a.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),i===`error`&&(0,p.jsxs)(`p`,{className:`flex items-start gap-1 text-[11px] text-red-600 mb-2`,children:[(0,p.jsx)(f.AlertTriangle,{size:12,className:`mt-0.5 shrink-0`}),o??`Failed to load vouchers.`]}),i===`loaded`&&a.length===0&&(0,p.jsx)(`p`,{className:`text-[11px] text-gray-400 mb-2`,children:`No vouchers found.`}),l&&(0,p.jsxs)(`div`,{className:`rounded border border-green-200 bg-green-50 px-2.5 py-2 text-[12px] text-green-800`,children:[`Voucher code: `,(0,p.jsx)(`span`,{className:`font-semibold`,children:l.code})]})]}):(0,p.jsxs)(`p`,{className:`text-[11px] text-gray-400`,children:[`Register a voucher provider (`,(0,p.jsx)(`code`,{children:`voucherPlugin`}),`) to pick codes from your catalog. You can still edit the code text directly.`]})]})}function _o({open:e,onClose:t,onSave:n,initialQuery:r,title:i}){let[a,o]=(0,l.useState)(r??``),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1),v=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!e)return;o(r??``),h(null),d(null),_(!1);let n=setTimeout(()=>v.current?.focus(),40),i=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,i),()=>{clearTimeout(n),window.removeEventListener(`keydown`,i)}},[e,r,t]),!e)return null;let y=async()=>{let e=ba(),t=a.trim();if(!(!e||!t||s)){c(!0),d(null),h(null),_(!0);try{let n=await e.search(t);h(n)}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,p.jsx)(`div`,{className:`fixed inset-0 z-50 flex bg-black/60 backdrop-blur-sm p-4`,children:(0,p.jsxs)(`div`,{className:`m-auto flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-2xl bg-white shadow-2xl`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-200 px-5 py-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(f.PackageSearch,{size:18,className:`text-blue-600`}),(0,p.jsx)(`h2`,{className:`text-base font-semibold text-neutral-900`,children:i??`Find a product`})]}),(0,p.jsx)(`button`,{onClick:t,className:`rounded-lg p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900`,"aria-label":`Close`,children:(0,p.jsx)(f.X,{size:18})})]}),(0,p.jsx)(`div`,{className:`border-b border-neutral-100 px-5 py-3`,children:(0,p.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,p.jsxs)(`div`,{className:`relative flex-1`,children:[(0,p.jsx)(f.Search,{size:15,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-400`}),(0,p.jsx)(`input`,{ref:v,value:a,onChange:e=>o(e.target.value),placeholder:`Search your catalog by name or SKU…`,className:`w-full rounded-lg border border-neutral-200 bg-white py-2 pl-9 pr-3 text-sm outline-none focus:border-blue-500`})]}),(0,p.jsxs)(`button`,{type:`submit`,disabled:s||!a.trim(),className:`flex shrink-0 items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:bg-neutral-300`,children:[s?(0,p.jsx)(f.Loader2,{size:15,className:`animate-spin`}):(0,p.jsx)(f.Search,{size:15}),`Search`]})]})}),(0,p.jsxs)(`div`,{className:`min-h-[220px] flex-1 overflow-y-auto p-5`,children:[s&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-sm text-neutral-500`,children:[(0,p.jsx)(f.Loader2,{size:22,className:`animate-spin`}),`Searching…`]}),!s&&u&&(0,p.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700`,children:u}),!s&&!u&&g&&!m&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-center text-sm text-neutral-500`,children:[(0,p.jsx)(f.PackageSearch,{size:22,className:`text-neutral-300`}),`No product matched β€œ`,a.trim(),`”. Try another name or SKU.`]}),!s&&!u&&!g&&(0,p.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 py-10 text-center text-sm text-neutral-400`,children:[(0,p.jsx)(f.PackageSearch,{size:22,className:`text-neutral-300`}),`Search your catalog, then preview and save the product.`]}),!s&&m&&(0,p.jsx)(vo,{result:m})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-neutral-200 px-5 py-3`,children:[(0,p.jsx)(`button`,{onClick:t,className:`rounded-lg px-4 py-2 text-sm font-medium text-neutral-600 hover:bg-neutral-100`,children:`Cancel`}),(0,p.jsxs)(`button`,{onClick:()=>{m&&(n(m),t())},disabled:!m,className:`flex items-center gap-1.5 rounded-lg bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 disabled:bg-neutral-300`,children:[(0,p.jsx)(f.Check,{size:15}),` Save product`]})]})]})})}function vo({result:e}){return(0,p.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-neutral-200`,children:[(0,p.jsx)(`div`,{className:`aspect-video w-full overflow-hidden bg-neutral-100`,children:e.image?(0,p.jsx)(`img`,{src:e.image,alt:e.imageAlt??e.name,className:`h-full w-full object-contain`}):(0,p.jsx)(`div`,{className:`grid h-full place-items-center text-xs text-neutral-400`,children:`No image`})}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,p.jsx)(`div`,{className:`text-sm font-semibold text-neutral-900`,children:e.name}),e.stars!=null&&(0,p.jsxs)(`div`,{className:`flex items-center gap-0.5`,"aria-label":`${e.stars} out of 5`,children:[Array.from({length:5}).map((t,n)=>(0,p.jsx)(f.Star,{size:14,className:n<Math.round(e.stars??0)?`fill-amber-400 text-amber-400`:`text-neutral-300`},n)),(0,p.jsx)(`span`,{className:`ml-1 text-xs text-neutral-500`,children:e.stars})]}),(0,p.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[e.oldPrice&&(0,p.jsx)(`span`,{className:`text-sm text-neutral-400 line-through`,children:e.oldPrice}),(0,p.jsx)(`span`,{className:`text-lg font-bold text-blue-600`,children:e.finalPrice})]}),e.description&&(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-neutral-600`,children:e.description}),e.link&&(0,p.jsxs)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs text-blue-600 hover:underline`,children:[(0,p.jsx)(f.ExternalLink,{size:12}),` View source`]})]})]})}function yo(){return(0,l.useSyncExternalStore)(xa,Sa,Sa),ba()!==null}function bo(){let{selection:e,doc:t,viewMode:n}=M(),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(!1);return r?(0,p.jsxs)(`div`,{className:`${a?`w-[576px]`:`w-72`} bg-white border-l border-gray-200 shrink-0 overflow-y-auto flex flex-col transition-all duration-200`,children:[(0,p.jsxs)(`div`,{className:`px-3 py-2 text-[11px] flex items-center gap-1.5 border-b shrink-0 ${n===`mobile`?`bg-amber-50 text-amber-800 border-amber-200`:`bg-blue-50 text-blue-800 border-blue-100`}`,children:[n===`mobile`?(0,p.jsx)(f.Smartphone,{size:12}):(0,p.jsx)(f.Monitor,{size:12}),(0,p.jsxs)(`span`,{className:`flex-1`,children:[`Editing `,n,` styles`]}),(0,p.jsx)(`button`,{onClick:()=>o(!a),title:a?`Narrow panel`:`Expand panel`,className:`p-0.5 rounded hover:bg-black/10 transition-colors ${n===`mobile`?`text-amber-700 hover:text-amber-900`:`text-blue-700 hover:text-blue-900`}`,children:a?(0,p.jsx)(f.ChevronsRight,{size:13}):(0,p.jsx)(f.ChevronsLeft,{size:13})}),(0,p.jsx)(`button`,{onClick:()=>i(!1),title:`Hide properties`,className:`p-0.5 rounded hover:bg-black/10 transition-colors ${n===`mobile`?`text-amber-700 hover:text-amber-900`:`text-blue-700 hover:text-blue-900`}`,children:(0,p.jsx)(f.PanelRightClose,{size:13})})]}),(0,p.jsx)(`div`,{className:`p-4 flex-1`,children:!e||e.kind===`email`?(0,p.jsx)(jo,{}):e.kind===`module`?(()=>{let n=t.modules.find(t=>t.id===e.moduleId);return n?(0,p.jsx)(Po,{mod:n}):(0,p.jsx)(xo,{})})():(()=>{let n=t.modules.find(t=>t.id===e.moduleId),r=n?.children.find(t=>t.id===e.elementId);return n&&r?(0,p.jsx)(Fo,{mod:n,el:r}):(0,p.jsx)(xo,{})})()})]}):(0,p.jsx)(`div`,{className:`flex flex-col items-center w-6 bg-white border-l border-gray-200 shrink-0`,children:(0,p.jsx)(`button`,{onClick:()=>i(!0),title:`Show properties`,className:`flex items-center justify-center w-full py-3 text-gray-400 hover:text-gray-600 hover:bg-gray-50 transition-colors`,children:(0,p.jsx)(f.PanelRightOpen,{size:14})})})}function xo(){return(0,p.jsx)(`div`,{className:`text-xs text-gray-400`,children:`Nothing selected.`})}function So(e,t){if(t!==`mobile`)return e;let n=e.mobile??{};return{...e,...n}}function Co(e,t,n){if(n!==`mobile`)return{...e,...t};let r=e.mobile??{};return{...e,mobile:{...r,...t}}}function wo({overridden:e}){return e?(0,p.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wide bg-amber-100 text-amber-800 px-1 rounded`,children:`mobile`}):null}function To({hideOn:e,onChange:t}){return(0,p.jsx)(Z,{label:`Visibility`,children:(0,p.jsxs)(ko,{value:e??``,onChange:e=>{let n=e.target.value;t(n===``?void 0:n)},children:[(0,p.jsx)(`option`,{value:``,children:`Show on all`}),(0,p.jsx)(`option`,{value:`mobile`,children:`Hide on mobile`}),(0,p.jsx)(`option`,{value:`desktop`,children:`Hide on desktop`})]})})}function Eo({children:e}){return(0,p.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 mb-3`,children:e})}function Z({label:e,children:t}){return(0,p.jsxs)(`label`,{className:`block mb-3`,children:[(0,p.jsx)(`span`,{className:`flex items-center text-xs text-gray-600 mb-1`,children:e}),t]})}function Q(e){return(0,p.jsx)(`input`,{...e,className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none`})}function $(e){return(0,p.jsx)(Q,{type:`number`,...e})}function Do({value:e,onChange:t,onAlt:n}){let r=Va(),i=(0,l.useRef)(null),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),u=async e=>{if(r){o(!0),c(null);try{let i=await r.upload(e);t(i.url),i.alt&&n&&n(i.alt)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1),i.current&&(i.current.value=``)}}};return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(Q,{value:e??``,onChange:e=>t(e.target.value)}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&u(t)}}),(0,p.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i.current?.click(),className:`shrink-0 px-2 py-1.5 text-xs border border-gray-200 rounded hover:bg-gray-50 disabled:opacity-50 flex items-center gap-1`,title:`Upload image`,children:a?(0,p.jsx)(f.Loader2,{size:12,className:`animate-spin`}):(0,p.jsx)(f.Upload,{size:12})})]})]}),s&&(0,p.jsx)(`p`,{className:`text-[10px] text-red-600 mt-1`,children:s}),!r&&(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mt-1`,children:`Tip: register an image uploader plugin to enable file uploads.`})]})}function Oo({value:e,onChange:t,defaultValue:n}){let r=M(e=>e.doc.theme),i=typeof e==`string`&&e.startsWith(`{`),a=(0,l.useRef)(n&&n.startsWith(`{`)?n:i?e:void 0);(0,l.useEffect)(()=>{i?a.current=e:n&&n.startsWith(`{`)&&(a.current=n)},[e,i,n]);let o=(()=>{let t=x(e,r);return typeof t==`string`&&/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)?t.length===4?`#`+t.slice(1).split(``).map(e=>e+e).join(``):t:`#000000`})(),s=n??a.current,c=!!s&&s!==e,u=i?o:e??``,[d,m]=(0,l.useState)(u),h=(0,l.useRef)(u);return(0,l.useEffect)(()=>{let t=i?o:e??``;h.current=t,m(t)},[e,i,o]),(0,p.jsxs)(`div`,{className:`flex gap-1 items-center`,children:[(0,p.jsxs)(`label`,{className:`relative w-9 h-8 border border-gray-200 rounded cursor-pointer overflow-hidden shrink-0`,title:i?`Theme token (${e}) β†’ click to override`:`Pick color`,style:{background:o},children:[(0,p.jsx)(`input`,{type:`color`,value:o,onChange:e=>t(e.target.value),className:`absolute inset-0 opacity-0 cursor-pointer`}),i&&(0,p.jsx)(`span`,{className:`absolute inset-0 pointer-events-none border-2 border-dashed rounded`,style:{borderColor:`rgba(255,255,255,0.6)`}})]}),(0,p.jsx)(`input`,{value:d,onChange:e=>m(e.target.value),onBlur:()=>{d!==h.current&&(t(d),h.current=d)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`}),c&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>t(s),className:`shrink-0 p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded`,title:`Reset to theme token (${s})`,children:(0,p.jsx)(f.RotateCcw,{size:12})})]})}function ko(e){return(0,p.jsx)(`select`,{...e,className:`w-full px-2 py-1.5 text-sm border border-gray-200 rounded focus:border-blue-500 focus:outline-none bg-white`})}function Ao({linkType:e,onChangeLinkType:t,onChangeLink:n}){return(0,p.jsxs)(Z,{label:`Link role`,children:[(0,p.jsxs)(ko,{value:e??``,onChange:e=>{let r=e.target.value;r===``?t(void 0):(t(r),n(be[r]))},children:[(0,p.jsx)(`option`,{value:``,children:`β€” None β€”`}),(0,p.jsx)(`option`,{value:`unsubscribe`,children:`Unsubscribe`}),(0,p.jsx)(`option`,{value:`view_in_browser`,children:`View in browser`}),(0,p.jsx)(`option`,{value:`manage_preferences`,children:`Manage preferences`}),(0,p.jsx)(`option`,{value:`user_profile`,children:`User profile`})]}),e&&(0,p.jsxs)(`p`,{className:`text-[10px] text-blue-600 mt-1 flex items-center gap-1`,children:[(0,p.jsx)(f.Tag,{size:10}),`Placeholder: `,(0,p.jsx)(`code`,{className:`font-mono`,children:be[e]})]})]})}function jo(){let{doc:e,updateMeta:t,updateSettings:n}=M();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Email`}),(0,p.jsx)(Z,{label:`Name`,children:(0,p.jsx)(Q,{value:e.meta.name,onChange:e=>t({name:e.target.value})})}),(0,p.jsx)(Z,{label:`Preview text`,children:(0,p.jsx)(Q,{value:e.meta.previewText,onChange:e=>t({previewText:e.target.value})})}),(0,p.jsx)(Z,{label:`Width (px)`,children:(0,p.jsx)($,{value:e.settings.width,onChange:e=>n({width:Number(e.target.value)||600})})}),(0,p.jsx)(Z,{label:`Background color`,children:(0,p.jsx)(Oo,{value:e.settings.backgroundColor,onChange:e=>n({backgroundColor:e})})}),(0,p.jsx)(Z,{label:`Content background color`,children:(0,p.jsx)(Oo,{value:e.settings.contentBackgroundColor,onChange:e=>n({contentBackgroundColor:e})})}),(0,p.jsx)(`div`,{className:`mt-6 pt-4 border-t border-gray-100`,children:(0,p.jsx)(Mo,{})})]})}function Mo(){let{doc:e,themes:t,applyTheme:n}=M(),r=e.theme,i=t.find(e=>e.id===r.id),a=i!=null&&Object.entries(r.tokens.colors).some(([e,t])=>i.tokens.colors[e]!==t),o=(e,t)=>{n({...r,tokens:{...r.tokens,colors:{...r.tokens.colors,[e]:t}}})};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsx)(Eo,{children:`Theme`}),a&&(0,p.jsx)(`button`,{onClick:()=>i&&n(i),className:`text-[10px] text-blue-600 hover:underline mb-3`,title:`Discard color changes and restore the preset`,children:`Reset to preset`})]}),(0,p.jsx)(`div`,{className:`flex flex-col gap-1.5 mb-4`,children:t.map(e=>{let t=e.id===r.id;return(0,p.jsxs)(`button`,{onClick:()=>n(e),title:e.name,className:`flex items-center gap-2 px-2.5 py-2 rounded border text-xs transition-colors ${t?`border-blue-500 bg-blue-50 text-blue-700`:`border-gray-200 bg-white hover:border-gray-300 text-gray-700`}`,children:[(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.primary}}),(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.background}}),(0,p.jsx)(`span`,{className:`w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10`,style:{background:e.tokens.colors.text}}),(0,p.jsx)(`span`,{className:`flex-1 text-left`,children:e.name}),t&&(0,p.jsx)(f.Check,{size:12,className:`text-blue-600 shrink-0`})]},e.id)})}),(0,p.jsxs)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2`,children:[`Colors`,a&&(0,p.jsx)(`span`,{className:`ml-2 normal-case font-normal text-[10px] bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded`,children:`customised`})]}),(0,p.jsx)(`div`,{className:`flex flex-col gap-2`,children:Object.entries(r.tokens.colors).map(([e,t])=>(0,p.jsx)(No,{label:e,value:t,onChange:t=>o(e,t)},e))})]})}function No({label:e,value:t,onChange:n}){let[r,i]=(0,l.useState)(t);(0,l.useEffect)(()=>i(t),[t]);let a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)?t.length===4?`#`+t.slice(1).split(``).map(e=>e+e).join(``):t:`#000000`,o=e=>{let t=e.trim();t&&n(t)};return(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-xs text-gray-500 w-28 shrink-0 truncate`,title:e,children:e}),(0,p.jsx)(`label`,{className:`relative w-7 h-7 rounded border border-gray-200 cursor-pointer overflow-hidden shrink-0`,style:{background:a},title:`Pick ${e} color`,children:(0,p.jsx)(`input`,{type:`color`,value:a,onChange:e=>n(e.target.value),className:`absolute inset-0 opacity-0 cursor-pointer w-full h-full`})}),(0,p.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onBlur:()=>o(r),onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},className:`flex-1 min-w-0 px-2 py-1 text-xs border border-gray-200 rounded focus:border-blue-500 focus:outline-none font-mono`,spellCheck:!1})]})}function Po({mod:e}){let t=M(e=>e.updateModule),n=M(e=>e.viewMode),r=Fa(e=>e.enabled),i=e.style??{},a=So(i,n),o=new Set(Object.keys(i.mobile??{})),s=r=>t(e.id,{style:Co(i,r,n)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:e.name}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Background color`,(0,p.jsx)(wo,{overridden:o.has(`backgroundColor`)})]}),children:(0,p.jsx)(Oo,{value:a.backgroundColor??``,onChange:e=>s({backgroundColor:e})})}),(0,p.jsx)(Io,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Border radius`,(0,p.jsx)(wo,{overridden:o.has(`borderRadius`)})]}),children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>s({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(To,{hideOn:i.hideOn,onChange:n=>t(e.id,{style:{...i,hideOn:n}})}),r&&Ja(e)&&(0,p.jsx)(Za,{mod:e}),po(e)&&(0,p.jsx)(go,{mod:e})]})}function Fo({mod:e,el:t}){switch(t.type){case`text`:return(0,p.jsx)(Ro,{mod:e,el:t});case`image`:return(0,p.jsx)(zo,{mod:e,el:t});case`button`:return(0,p.jsx)(Bo,{mod:e,el:t});case`spacer`:return(0,p.jsx)(Vo,{mod:e,el:t});case`divider`:return(0,p.jsx)(Ho,{mod:e,el:t});case`productGrid`:return(0,p.jsx)(Wo,{mod:e,el:t})}}function Io({style:e,mobileKeys:t,onSet:n}){return(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-2 mb-3`,children:[`paddingTop`,`paddingBottom`,`paddingLeft`,`paddingRight`].map(r=>(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[r.replace(`padding`,`Pad `),(0,p.jsx)(wo,{overridden:!!t?.has(r)})]}),children:(0,p.jsx)($,{value:e[r]??0,onChange:e=>n({[r]:Number(e.target.value)})})},r))})}function Lo(e,t){let n=M(e=>e.updateElement);return r=>n(e.id,t.id,r)}function Ro({mod:e,el:t}){let n=Lo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=So(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:Co(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Text block`}),(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mb-3 leading-relaxed`,children:`Click the text in the canvas to edit it inline. Select words to apply bold, italic, colour, links and more using the floating toolbar.`}),(0,p.jsx)(Z,{label:`Default align`,children:(0,p.jsxs)(ko,{value:a.align??`left`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Line height`,children:(0,p.jsx)($,{step:.1,value:a.lineHeight??1.5,onChange:e=>s({lineHeight:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Letter spacing`,children:(0,p.jsx)($,{value:a.letterSpacing??0,onChange:e=>s({letterSpacing:Number(e.target.value)})})})]}),(0,p.jsx)(Io,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(To,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function zo({mod:e,el:t}){let n=Lo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=So(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:Co(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Image`}),(0,p.jsx)(Z,{label:`Image URL`,children:(0,p.jsx)(Do,{value:t.src,onChange:e=>n({src:e}),onAlt:e=>n({alt:e})})}),(0,p.jsx)(Z,{label:`Alt text`,children:(0,p.jsx)(Q,{value:t.alt??``,onChange:e=>n({alt:e.target.value})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link??``,onChange:e=>n({link:e.target.value})})}),(0,p.jsx)(Ao,{linkType:t.linkType,onChangeLinkType:e=>n({linkType:e}),onChangeLink:e=>n({link:e})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Width`,(0,p.jsx)(wo,{overridden:o.has(`width`)})]}),children:(0,p.jsx)($,{value:a.width??0,onChange:e=>s({width:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:(0,p.jsxs)(p.Fragment,{children:[`Height`,(0,p.jsx)(wo,{overridden:o.has(`height`)})]}),children:(0,p.jsx)($,{value:a.height??0,onChange:e=>s({height:Number(e.target.value)||void 0})})})]}),(0,p.jsx)(Z,{label:`Border radius`,children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>s({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Align`,children:(0,p.jsxs)(ko,{value:a.align??`center`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsx)(Io,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(To,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Bo({mod:e,el:t}){let n=Lo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=So(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:Co(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Button`}),(0,p.jsx)(Z,{label:`Label`,children:(0,p.jsx)(Q,{value:t.label,onChange:e=>n({label:e.target.value})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link,onChange:e=>n({link:e.target.value})})}),(0,p.jsx)(Ao,{linkType:t.linkType,onChangeLinkType:e=>n({linkType:e}),onChangeLink:e=>n({link:e})}),(0,p.jsx)(Z,{label:`Background color`,children:(0,p.jsx)(Oo,{value:a.backgroundColor??``,onChange:e=>s({backgroundColor:e})})}),(0,p.jsx)(Z,{label:`Text color`,children:(0,p.jsx)(Oo,{value:a.color??`#FFFFFF`,onChange:e=>s({color:e})})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Font size`,children:(0,p.jsx)($,{value:a.fontSize??16,onChange:e=>s({fontSize:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Border radius`,children:(0,p.jsx)($,{value:a.borderRadius??6,onChange:e=>s({borderRadius:Number(e.target.value)})})})]}),(0,p.jsx)(Z,{label:`Align`,children:(0,p.jsxs)(ko,{value:a.align??`center`,onChange:e=>s({align:e.target.value}),children:[(0,p.jsx)(`option`,{value:`left`,children:`Left`}),(0,p.jsx)(`option`,{value:`center`,children:`Center`}),(0,p.jsx)(`option`,{value:`right`,children:`Right`})]})}),(0,p.jsx)(Io,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(To,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Vo({mod:e,el:t}){let n=Lo(e,t);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Spacer`}),(0,p.jsx)(Z,{label:`Height (px)`,children:(0,p.jsx)($,{value:t.height,onChange:e=>n({height:Number(e.target.value)||0})})})]})}function Ho({mod:e,el:t}){let n=Lo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=So(i,r),o=new Set(Object.keys(i.mobile??{})),s=e=>n({style:Co(i,e,r)});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Divider`}),(0,p.jsx)(Z,{label:`Color`,children:(0,p.jsx)(Oo,{value:a.color??`#E5E7EB`,onChange:e=>s({color:e})})}),(0,p.jsx)(Z,{label:`Thickness`,children:(0,p.jsx)($,{value:a.thickness??1,onChange:e=>s({thickness:Number(e.target.value)})})}),(0,p.jsx)(Io,{style:a,mobileKeys:o,onSet:s}),(0,p.jsx)(To,{hideOn:i.hideOn,onChange:e=>n({style:{...i,hideOn:e}})})]})}function Uo(e=0){let t=e+1;return{id:`p_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,image:`https://placehold.co/400x400?text=Product+${t}`,imageAlt:`Product ${t}`,name:`Product ${t}`,oldPrice:`$59`,finalPrice:`$39`,description:`Short product description.`,link:`#`}}function Wo({mod:e,el:t}){let n=Lo(e,t),r=M(e=>e.viewMode),i=t.style??{},a=So(i,r),o=e=>n({style:Co(i,e,r)}),s=e=>n({products:e}),c=e=>{let r=e,i=t.products.slice();if(i.length<r)for(;i.length<r;)i.push(Uo(i.length));n({columns:e,products:i})},u=yo(),[d,m]=(0,l.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Eo,{children:`Product Grid`}),(0,p.jsxs)(Z,{label:`Columns (desktop)`,children:[(0,p.jsx)(`div`,{className:`inline-flex bg-gray-100 rounded p-0.5 w-full`,children:[1,2,3].map(e=>(0,p.jsxs)(`button`,{onClick:()=>c(e),className:`flex-1 px-2 py-1 text-xs rounded ${t.columns===e?`bg-white shadow text-gray-900`:`text-gray-500 hover:text-gray-700`}`,children:[e,` `,e===1?`col`:`cols`]},e))}),(0,p.jsx)(`p`,{className:`text-[10px] text-gray-400 mt-1`,children:`Always stacks to 1 column on mobile.`})]}),(0,p.jsx)(Ko,{label:`Show old price`,checked:t.showOldPrice,onChange:e=>n({showOldPrice:e})}),(0,p.jsx)(Ko,{label:`Show description`,checked:t.showDescription,onChange:e=>n({showDescription:e})}),(0,p.jsx)(Ko,{label:`Show stars`,checked:t.showStars??!1,onChange:e=>n({showStars:e})}),(0,p.jsx)(Ko,{label:`Show button`,checked:t.showButton,onChange:e=>n({showButton:e})}),(0,p.jsx)(Z,{label:`Default button label`,children:(0,p.jsx)(Q,{value:t.buttonLabel??``,placeholder:`Shop now`,onChange:e=>n({buttonLabel:e.target.value})})}),(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(Eo,{children:[`Products (`,t.products.length,`)`]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u&&(0,p.jsxs)(`button`,{onClick:()=>m({index:null,query:``}),className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded`,title:`Find a product from your catalog`,children:[(0,p.jsx)(f.Search,{size:12}),` Find`]}),(0,p.jsxs)(`button`,{onClick:()=>s([...t.products,Uo(t.products.length)]),className:`flex items-center gap-1 px-1.5 py-0.5 text-[11px] text-blue-600 hover:bg-blue-50 rounded`,title:`Add product`,children:[(0,p.jsx)(f.Plus,{size:12}),` Add`]})]})]}),t.products.map((e,n)=>(0,p.jsx)(qo,{index:n,product:e,canSearch:u,onSearch:()=>m({index:n,query:e.name}),onChange:e=>{let r=[...t.products];r[n]=e,s(r)},onDelete:()=>s(t.products.filter((e,t)=>t!==n))},e.id))]}),(0,p.jsx)(_o,{open:d!==null,initialQuery:d?.query,title:d?.index==null?`Add product from search`:`Replace product`,onClose:()=>m(null),onSave:e=>{let r=W({name:e.name,finalPrice:e.finalPrice,oldPrice:e.oldPrice,description:e.description,link:e.link,image:e.image,imageAlt:e.imageAlt,stars:e.stars}),i={};e.oldPrice&&!t.showOldPrice&&(i.showOldPrice=!0),e.description&&!t.showDescription&&(i.showDescription=!0),e.stars!=null&&!t.showStars&&(i.showStars=!0);let a=t.products.slice();if(d?.index!=null){let e=a[d.index];a[d.index]={...r,id:e.id,buttonLabel:e.buttonLabel}}else a.push(r);n({products:a,...i})}}),(0,p.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-gray-100`,children:[(0,p.jsx)(Eo,{children:`Style`}),(0,p.jsx)(Z,{label:`Card background`,children:(0,p.jsx)(Oo,{value:a.cardBackgroundColor??``,onChange:e=>o({cardBackgroundColor:e})})}),(0,p.jsx)(Z,{label:`Name color`,children:(0,p.jsx)(Oo,{value:a.nameColor??``,onChange:e=>o({nameColor:e})})}),(0,p.jsx)(Z,{label:`Final price color`,children:(0,p.jsx)(Oo,{value:a.finalPriceColor??``,onChange:e=>o({finalPriceColor:e})})}),(0,p.jsx)(Z,{label:`Old price color`,children:(0,p.jsx)(Oo,{value:a.oldPriceColor??``,onChange:e=>o({oldPriceColor:e})})}),(0,p.jsx)(Z,{label:`Button background`,children:(0,p.jsx)(Oo,{value:a.buttonBackgroundColor??``,onChange:e=>o({buttonBackgroundColor:e})})}),(0,p.jsx)(Z,{label:`Button text color`,children:(0,p.jsx)(Oo,{value:a.buttonColor??``,onChange:e=>o({buttonColor:e})})}),(0,p.jsx)(Z,{label:`Card radius`,children:(0,p.jsx)($,{value:a.borderRadius??0,onChange:e=>o({borderRadius:Number(e.target.value)})})}),(0,p.jsx)(Io,{style:a,onSet:o})]})]})}function Go({checked:e,onChange:t}){return(0,p.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:n=>{n.preventDefault(),n.stopPropagation(),t(!e)},className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${e?`bg-blue-600`:`bg-gray-300`}`,children:(0,p.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?`translate-x-4`:`translate-x-0.5`}`})})}function Ko({label:e,checked:t,onChange:n}){return(0,p.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,p.jsx)(`span`,{className:`text-xs text-gray-600`,children:e}),(0,p.jsx)(Go,{checked:t,onChange:n})]})}function qo({index:e,product:t,canSearch:n,onSearch:r,onChange:i,onDelete:a}){let o=e=>i({...t,...e});return(0,p.jsxs)(`div`,{className:`border border-gray-200 rounded p-2 mb-2 bg-gray-50`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,p.jsxs)(`span`,{className:`text-[11px] font-semibold text-gray-600`,children:[`#`,e+1]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(0,p.jsx)(`button`,{type:`button`,onClick:r,className:`text-gray-400 hover:text-blue-600`,title:`Replace from product search`,children:(0,p.jsx)(f.Search,{size:12})}),(0,p.jsx)(`button`,{type:`button`,onClick:a,className:`text-gray-400 hover:text-red-600`,title:`Remove product`,children:(0,p.jsx)(f.Trash2,{size:12})})]})]}),(0,p.jsx)(Z,{label:`Name`,children:(0,p.jsx)(Q,{value:t.name,onChange:e=>o({name:e.target.value})})}),(0,p.jsx)(Z,{label:`Image URL`,children:(0,p.jsx)(Do,{value:t.image,onChange:e=>o({image:e}),onAlt:e=>o({imageAlt:e})})}),(0,p.jsx)(Z,{label:`Link`,children:(0,p.jsx)(Q,{value:t.link??``,onChange:e=>o({link:e.target.value})})}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,p.jsx)(Z,{label:`Final price`,children:(0,p.jsx)(Q,{value:t.finalPrice,onChange:e=>o({finalPrice:e.target.value})})}),(0,p.jsx)(Z,{label:`Old price`,children:(0,p.jsx)(Q,{value:t.oldPrice??``,placeholder:`Optional`,onChange:e=>o({oldPrice:e.target.value||void 0})})})]}),(0,p.jsx)(Z,{label:`Description`,children:(0,p.jsx)(Q,{value:t.description??``,onChange:e=>o({description:e.target.value||void 0})})}),(0,p.jsx)(Z,{label:`Stars (0–5, optional)`,children:(0,p.jsx)($,{value:t.stars??``,min:0,max:5,step:.5,placeholder:`e.g. 4.5`,onChange:e=>o({stars:e.target.value===``?void 0:Number(e.target.value)})})}),(0,p.jsx)(Z,{label:`Button label (override)`,children:(0,p.jsx)(Q,{value:t.buttonLabel??``,placeholder:`Inherit default`,onChange:e=>o({buttonLabel:e.target.value||void 0})})})]})}var Jo=[{type:`basic.text`,category:`basic`,name:`Text Block`,description:`Single editable paragraph of body copy. Use for short notes, intros, or filler text between sections.`,tags:[`text`,`paragraph`,`body`],create:()=>z(`basic.text`,`Text Block`,[P(`Write your text here.`,{role:`body`})])},{type:`basic.heading`,category:`basic`,name:`Heading`,description:`Bold standalone heading using the theme heading font. Use to introduce a section without other elements.`,tags:[`heading`,`title`,`section`],create:()=>z(`basic.heading`,`Heading`,[P(`A clear section heading`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingTop:16,paddingBottom:8,lineHeight:1.25})])},{type:`basic.image`,category:`basic`,name:`Image`,description:`Single full-width image, centered. Use for hero photography, illustrations, or screenshots.`,tags:[`image`,`media`,`photo`],create:()=>z(`basic.image`,`Image`,[F(U(600,300),`Placeholder`)])},{type:`basic.image_caption`,category:`basic`,name:`Image with Caption`,description:`Image followed by a small italicized caption underneath. Editorial style for newsletters.`,tags:[`image`,`caption`,`editorial`],create:()=>z(`basic.image_caption`,`Image + Caption`,[F(U(600,360),`Photo`),P(`Photo: caption goes here.`,{color:`{colors.muted}`,fontSize:13,align:`center`,paddingTop:4,paddingBottom:16})])},{type:`basic.spacer`,category:`basic`,name:`Spacer`,description:`Empty vertical space. Use to separate modules with breathing room.`,tags:[`spacer`,`spacing`,`gap`],create:()=>z(`basic.spacer`,`Spacer`,[L(32)])},{type:`basic.divider`,category:`basic`,name:`Divider`,description:`Thin horizontal rule across the email. Use to visually separate sections.`,tags:[`divider`,`separator`,`rule`],create:()=>z(`basic.divider`,`Divider`,[R()])}],Yo=[{type:`header.logo`,category:`header`,name:`Logo Centered`,description:`Centered brand logo. The simplest header used at the top of almost every newsletter.`,tags:[`logo`,`brand`,`centered`],create:()=>z(`header.logo`,`Logo Header`,[F(U(180,56,`LOGO`),`Logo`,{width:180,paddingTop:24,paddingBottom:24})])},{type:`header.logo_left_date_right`,category:`header`,name:`Logo Left + Date Right`,description:`Two-column header with logo on the left and a date or issue label on the right. Common for periodical newsletters and digests.`,tags:[`logo`,`date`,`issue`,`publication`,`newsletter`],create:()=>z(`header.logo_left_date_right`,`Logo + Date`,[F(U(140,36,`LOGO`),`Logo`,{width:140,align:`left`,paddingTop:16,paddingBottom:16}),P(`Issue #128 Β· April 29, 2026`,{color:`{colors.muted}`,fontSize:13,align:`right`,paddingTop:0,paddingBottom:16}),R({paddingTop:0,paddingBottom:0})])},{type:`header.publication`,category:`header`,name:`Publication Masthead`,description:`Editorial masthead with publication name in serif type, tagline, and a divider. Mimics print magazine and newspaper newsletters.`,tags:[`masthead`,`publication`,`editorial`,`serif`,`newspaper`,`magazine`],create:()=>z(`header.publication`,`Masthead`,[P(`THE WEEKLY`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,letterSpacing:6,paddingTop:32,paddingBottom:4}),P(`Curated reading for thoughtful people`,{color:`{colors.muted}`,align:`center`,fontSize:13,paddingBottom:16}),R({paddingTop:0,paddingBottom:0})])},{type:`header.hero`,category:`header`,name:`Hero with Headline & Image`,description:`Big headline, subtitle and a wide hero image. Use for the lead story or campaign announcement.`,tags:[`hero`,`headline`,`image`,`lead`,`feature`],create:()=>z(`header.hero`,`Hero`,[P(`Steps Towards a Greener World`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,paddingTop:32,lineHeight:1.2}),P(`Small actions, big impact.`,{color:`{colors.muted}`,align:`center`,paddingBottom:16}),F(U(560,280,`Hero`),`Hero`,{width:560})])},{type:`header.hero_text_only`,category:`header`,name:`Hero Text Only`,description:`Centered eyebrow + large headline + supporting paragraph, no image. Editorial intro for opinion or essay newsletters.`,tags:[`hero`,`text`,`essay`,`editorial`,`minimal`],create:()=>z(`header.hero_text_only`,`Hero Text`,[P(`ESSAY Β· ISSUE 42`,{fontSize:12,fontWeight:`bold`,color:`{colors.primary}`,letterSpacing:3,align:`center`,paddingTop:32,paddingBottom:8}),P(`On building things slowly`,{role:`headline`,fontFamily:`{fonts.heading}`,fontSize:40,fontWeight:`bold`,align:`center`,lineHeight:1.15,paddingBottom:8}),P(`Why patience and craft still win in a world of shortcuts.`,{color:`{colors.muted}`,align:`center`,fontSize:16,paddingBottom:32})])},{type:`header.announcement`,category:`header`,name:`Announcement Bar`,description:`Thin colored top bar with a single line of promotional text. Use for free shipping, sales, or alerts.`,tags:[`announcement`,`bar`,`promo`,`alert`],create:()=>z(`header.announcement`,`Announcement`,[P(`✨ Free shipping on orders over $50`,{color:`{colors.buttonText}`,align:`center`,fontSize:14,paddingTop:12,paddingBottom:12})],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`header.logo_with_view_browser`,category:`header`,name:`Logo + View in Browser`,description:`Logo with a small 'View in browser' link above it. Standard for marketing newsletters that may render poorly.`,tags:[`logo`,`view-in-browser`,`marketing`,`preheader`],create:()=>z(`header.logo_with_view_browser`,`Logo + Browser Link`,[P(`View in browser`,{color:`{colors.muted}`,fontSize:11,align:`right`,paddingTop:8,paddingBottom:0,link:`#`}),F(U(160,48,`LOGO`),`Logo`,{width:160,paddingTop:8,paddingBottom:16})])},{type:`header.welcome`,category:`header`,name:`Welcome Header`,description:`Friendly greeting with first name placeholder, used at the top of welcome and onboarding emails.`,tags:[`welcome`,`onboarding`,`greeting`,`personalized`],create:()=>z(`header.welcome`,`Welcome`,[P(`πŸ‘‹ Welcome aboard, {{first_name}}`,{fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,align:`center`,paddingTop:32,paddingBottom:8}),P(`We're glad you're here. Here's what to do next.`,{color:`{colors.muted}`,align:`center`,paddingBottom:16})])},{type:`header.logo_with_tagline`,category:`header`,name:`Logo + Tagline`,description:`Centered logo above a one-line tagline. Friendly brand-forward header.`,tags:[`logo`,`tagline`,`brand`],create:()=>z(`header.logo_with_tagline`,`Logo + Tagline`,[F(U(160,48,`LOGO`),`Logo`,{width:160,paddingTop:24,paddingBottom:4}),P(`Newsletters that respect your time.`,{align:`center`,color:`{colors.muted}`,fontSize:14,paddingBottom:24})])},{type:`header.story_label`,category:`header`,name:`Story Label Header`,description:`Small category label (e.g. 'Top story', 'Deep dive') above the masthead. Used by The Hustle, Morning Brew style newsletters.`,tags:[`label`,`category`,`story`,`newsletter`,`topic`],create:()=>z(`header.story_label`,`Story Label`,[P(`TODAY'S TOP STORY`,{color:`{colors.primary}`,fontSize:12,fontWeight:`bold`,letterSpacing:3,align:`center`,paddingTop:24,paddingBottom:4}),P(`AI editing tools come for the inbox`,{fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,align:`center`,paddingBottom:16,lineHeight:1.2})])}],Xo=[{type:`menu.horizontal`,category:`menu`,name:`Horizontal Nav`,description:`Horizontal menu with 3-5 inline links separated by dots. Common publication navigation under the masthead.`,tags:[`menu`,`nav`,`horizontal`,`publication`],create:()=>z(`menu.horizontal`,`Horizontal Menu`,[P(`Home Β· Articles Β· Podcast Β· About Β· Subscribe`,{align:`center`,color:`{colors.text}`,fontSize:13,paddingTop:12,paddingBottom:12})])},{type:`menu.sections`,category:`menu`,name:`Section Tabs`,description:`Linked section labels representing the contents of today's issue (e.g. News Β· Markets Β· Tech Β· Culture). Used by daily digests.`,tags:[`menu`,`sections`,`tabs`,`digest`,`daily`],create:()=>z(`menu.sections`,`Section Tabs`,[R({paddingTop:0,paddingBottom:8}),P(`NEWS Β· MARKETS Β· TECH Β· CULTURE Β· WEEKEND`,{align:`center`,color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,paddingTop:0,paddingBottom:8}),R({paddingTop:0,paddingBottom:8})])},{type:`menu.in_this_issue`,category:`menu`,name:`In This Issue`,description:`Table-of-contents box listing the items in this newsletter issue with anchor links. Helps readers scan long emails.`,tags:[`toc`,`menu`,`issue`,`summary`,`table of contents`],create:()=>z(`menu.in_this_issue`,`In This Issue`,[P(`IN THIS ISSUE`,{fontSize:11,fontWeight:`bold`,color:`{colors.muted}`,letterSpacing:2,paddingTop:16,paddingBottom:8}),P(`β†’ Lead story: AI in the inbox`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#lead`}),P(`β†’ 3 things worth your time`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#picks`}),P(`β†’ Reader question of the week`,{fontSize:14,paddingTop:2,paddingBottom:2,link:`#qa`}),P(`β†’ Upcoming events`,{fontSize:14,paddingTop:2,paddingBottom:16,link:`#events`})],{backgroundColor:`{colors.background}`,paddingTop:8,paddingBottom:8,paddingLeft:16,paddingRight:16})},{type:`menu.cta_strip`,category:`menu`,name:`Linked Action Strip`,description:`Three short text actions in a row (e.g. 'Read Β· Share Β· Reply'). Light alternative to a button bar.`,tags:[`menu`,`actions`,`links`,`strip`],create:()=>z(`menu.cta_strip`,`Action Strip`,[P(`Read online Β· Share Β· Reply with feedback`,{align:`center`,color:`{colors.primary}`,fontSize:13,paddingTop:12,paddingBottom:12})])}],Zo=[{type:`content.headline_body`,category:`content`,name:`Headline + Body`,description:`Section title with one paragraph of body text. The most generic written content block.`,tags:[`headline`,`body`,`paragraph`,`article`],create:()=>z(`content.headline_body`,`Headline + Body`,[B(`A compelling headline`,{paddingTop:24}),P(`Tell your story with a clear, concise paragraph. Keep readers engaged with short sentences and meaningful detail.`,{paddingBottom:24})])},{type:`content.lead_story`,category:`content`,name:`Lead Story`,description:`Top story of the issue: eyebrow label, big headline, hero image, lead paragraph and a 'Continue reading' link. Used by news and editorial newsletters.`,tags:[`lead`,`story`,`feature`,`news`,`editorial`,`long-form`],create:()=>z(`content.lead_story`,`Lead Story`,[V(`Lead story`),B(`Inside the new wave of indie publishers`,{level:1,paddingBottom:4}),H(`By Jane Doe Β· 6 min read`,{fontSize:13}),F(U(560,320,`Lead`),`Lead`,{width:560,paddingTop:12}),P(`A growing group of writers are leaving big media to build their own readerships, betting that quality and a direct relationship beat scale.`,{paddingTop:16}),P(`Continue reading β†’`,{color:`{colors.primary}`,fontWeight:`bold`,paddingTop:4,paddingBottom:24,link:`#`})])},{type:`content.article_summary`,category:`content`,name:`Article Summary Card`,description:`Compact link-out card: image on top, category label, title, one-line summary, and 'Read more'. Use repeatedly to list secondary articles.`,tags:[`article`,`summary`,`card`,`link-out`,`newsletter`],create:()=>z(`content.article_summary`,`Article Card`,[F(U(560,280,`Article`),`Article`,{width:560}),P(`CULTURE`,{color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,paddingTop:12,paddingBottom:4}),B(`How long-form writing made a comeback`,{paddingTop:0,paddingBottom:4}),P(`Why subscribers are paying for slower, deeper coverage β€” and what it means for publishers.`,{paddingBottom:8}),P(`Read more β†’`,{color:`{colors.primary}`,fontWeight:`bold`,paddingBottom:24,link:`#`})])},{type:`content.image_text`,category:`content`,name:`Image + Text Beside`,description:`Image with article title and short summary stacked below. Standard editorial card.`,tags:[`image`,`text`,`article`,`stacked`],create:()=>z(`content.image_text`,`Image + Text`,[F(U(560,300,`Article`),`Article`,{width:560}),B(`Article title`,{paddingTop:16,paddingBottom:4}),P(`A short summary of the article goes here, two or three lines is plenty.`)])},{type:`content.two_column_articles`,category:`content`,name:`Two Column Stories`,description:`Two short article previews shown side-by-side as stacked blocks (renders as full-width on mobile). Use to tease two related stories.`,tags:[`two-column`,`articles`,`side-by-side`,`preview`],create:()=>z(`content.two_column_articles`,`Two Stories`,[V(`More to read`),F(U(272,180,`Story A`),`Story A`,{width:272}),P(`Story A title`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),P(`One sentence about story A.`,{fontSize:14,paddingBottom:16}),F(U(272,180,`Story B`),`Story B`,{width:272}),P(`Story B title`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),P(`One sentence about story B.`,{fontSize:14,paddingBottom:16})])},{type:`content.three_picks`,category:`content`,name:`Three Picks (Numbered)`,description:`Numbered list of three short recommendations or links. Used by curators ('3 things to read this week').`,tags:[`list`,`picks`,`curated`,`links`,`recommendations`],create:()=>z(`content.three_picks`,`Three Picks`,[V(`Three picks`),P(`01 / How to stay focused in 2026`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`Notes on attention, deep work, and the slow internet.`,{fontSize:14}),R({paddingTop:12,paddingBottom:8}),P(`02 / The case for boring software`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`Why teams are returning to simpler, predictable tools.`,{fontSize:14}),R({paddingTop:12,paddingBottom:8}),P(`03 / A short history of the inbox`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:8,paddingBottom:4,link:`#`}),H(`From memos to MIME, and what comes next.`,{fontSize:14,paddingBottom:24})])},{type:`content.quote`,category:`content`,name:`Pull Quote`,description:`Centered serif pull quote with attribution. Adds rhythm to long editorial newsletters.`,tags:[`quote`,`pull-quote`,`editorial`,`attribution`],create:()=>z(`content.quote`,`Pull Quote`,[P(`β€œThe best way to predict the future is to create it.”`,{fontFamily:`{fonts.heading}`,fontSize:22,align:`center`,paddingTop:24,lineHeight:1.4}),P(`β€” Peter Drucker`,{color:`{colors.muted}`,align:`center`,paddingBottom:24})])},{type:`content.author_byline`,category:`content`,name:`Author Byline`,description:`Round avatar + author name + role on one line. Drop above or below an article body for personal newsletters.`,tags:[`author`,`byline`,`avatar`,`personal`],create:()=>z(`content.author_byline`,`Byline`,[F(U(64,64,`πŸ‘€`),`Author`,{width:64,borderRadius:32,paddingTop:16,paddingBottom:0}),P(`Jane Doe`,{align:`center`,fontWeight:`bold`,paddingTop:8,paddingBottom:0}),H(`Editor, The Weekly`,{align:`center`,fontSize:13}),L(16)])},{type:`content.editor_note`,category:`content`,name:`Editor's Note`,description:`Personal letter-style block: 'Hi {{first_name}}', a few paragraphs and a sign-off. Ideal for newsletters with a strong author voice.`,tags:[`editor`,`note`,`letter`,`personal`,`voice`],create:()=>z(`content.editor_note`,`Editor's Note`,[P(`Hi {{first_name}},`,{paddingTop:24,paddingBottom:8}),P(`This week I've been thinking about what makes a newsletter feel like a letter rather than a broadcast. Spoiler: it's not the format, it's the tone.`,{paddingBottom:8,lineHeight:1.7}),P(`Let me know what you think β€” just hit reply.`,{paddingBottom:8,lineHeight:1.7}),P(`β€” Jane`,{fontFamily:`{fonts.heading}`,paddingBottom:24})])},{type:`content.tip_box`,category:`content`,name:`Tip / Callout Box`,description:`Highlighted background box with an icon, short title and one-paragraph tip. Use for 'pro tips', notes, and warnings.`,tags:[`tip`,`callout`,`box`,`highlight`,`note`],create:()=>z(`content.tip_box`,`Tip Box`,[P(`πŸ’‘ PRO TIP`,{color:`{colors.primary}`,fontSize:12,fontWeight:`bold`,letterSpacing:2,paddingTop:16,paddingBottom:4}),P(`Always preview your email on mobile before sending β€” most opens happen there.`,{paddingBottom:16})],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:16})},{type:`content.numbered_list`,category:`content`,name:`Numbered List`,description:`Vertical numbered list of 4-5 short items with optional sub-text. Use for tutorials, checklists and 'how-to' newsletters.`,tags:[`list`,`numbered`,`tutorial`,`checklist`,`how-to`],create:()=>z(`content.numbered_list`,`Numbered List`,[B(`How to do it in 4 steps`,{paddingTop:16,paddingBottom:12}),P(`1. Define the goal`,{fontWeight:`bold`,paddingTop:4,paddingBottom:2}),H(`Write down the outcome in one sentence.`),P(`2. List constraints`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Time, budget, scope. Be specific.`),P(`3. Plan the smallest version`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`What can you ship this week?`),P(`4. Ship it`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Refine after real feedback.`,{fontSize:14}),L(16)])},{type:`content.bullet_list`,category:`content`,name:`Bullet List`,description:`Simple unordered list of takeaways or facts. Concise summary block.`,tags:[`list`,`bullets`,`takeaways`,`summary`],create:()=>z(`content.bullet_list`,`Bullets`,[B(`Key takeaways`,{paddingTop:16,paddingBottom:8}),P(`β€’ Newsletters are growing 20% YoY`,{paddingTop:2,paddingBottom:2}),P(`β€’ Mobile opens crossed 70%`,{paddingTop:2,paddingBottom:2}),P(`β€’ Plain-text emails outperform image-heavy ones in B2B`,{paddingTop:2,paddingBottom:2}),P(`β€’ Personalization drives 2x click-through`,{paddingTop:2,paddingBottom:16})])},{type:`content.qa`,category:`content`,name:`Q&A Block`,description:`Question in bold followed by an answer paragraph. Use for FAQ, reader mailbags, or AMAs.`,tags:[`qa`,`faq`,`ama`,`mailbag`,`reader-questions`],create:()=>z(`content.qa`,`Q&A`,[V(`Reader question`),P(`Q: How do I get my first 100 subscribers?`,{fontFamily:`{fonts.heading}`,fontSize:18,fontWeight:`bold`,paddingTop:4,paddingBottom:8,lineHeight:1.3}),P(`A: Tell ten people who already know you. Then ask each of them to forward to one friend. The first 100 don't come from algorithms β€” they come from your network.`,{paddingBottom:24,lineHeight:1.7})])},{type:`content.stats_row`,category:`content`,name:`Stat Row`,description:`Big numbers with short labels (e.g. '12k readers Β· 4.8β˜… rating Β· 96% open rate'). Used for impact summaries and social proof.`,tags:[`stats`,`numbers`,`metrics`,`social-proof`],create:()=>z(`content.stats_row`,`Stat Row`,[V(`By the numbers`,{align:`center`}),P(`12,400`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,color:`{colors.primary}`,paddingTop:4,paddingBottom:0}),H(`active readers this month`,{align:`center`,fontSize:13}),L(8),P(`96% Β· 4.8β˜… Β· 32 issues shipped`,{align:`center`,color:`{colors.text}`,fontSize:14,paddingBottom:24})])},{type:`content.timeline`,category:`content`,name:`Timeline / What Happened`,description:`Chronological list of recent events with dates. Used by news roundups and changelog newsletters.`,tags:[`timeline`,`changelog`,`news`,`events`,`what-happened`],create:()=>z(`content.timeline`,`Timeline`,[V(`This week`),P(`Mon Β· Acme launches plan B`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`After 6 months of beta testing.`,{fontSize:14}),P(`Wed Β· New funding round announced`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`$24M Series A led by Foundry.`,{fontSize:14}),P(`Fri Β· Industry report drops`,{fontWeight:`bold`,paddingTop:8,paddingBottom:2}),H(`Open rates up across the board.`,{fontSize:14,paddingBottom:24})])},{type:`content.podcast_episode`,category:`content`,name:`Podcast Episode`,description:`Episode artwork, episode number, title, short description and a 'Listen' button. For shows that announce episodes by email.`,tags:[`podcast`,`episode`,`audio`,`listen`,`show`],create:()=>z(`content.podcast_episode`,`Podcast Episode`,[F(U(220,220,`Cover`),`Cover`,{width:220,borderRadius:12}),P(`EPISODE 042`,{color:`{colors.primary}`,fontSize:11,fontWeight:`bold`,letterSpacing:2,align:`center`,paddingTop:12,paddingBottom:4}),B(`Why publishers are betting on email`,{align:`center`,paddingTop:0,paddingBottom:4}),H(`With Jane Doe Β· 38 min`,{align:`center`,fontSize:13}),I(`Listen now`,`https://example.com`),L(16)])},{type:`content.video_thumbnail`,category:`content`,name:`Video Thumbnail`,description:`Video thumbnail with overlay-feeling play button (image only, links to a hosted player). Title and duration below.`,tags:[`video`,`thumbnail`,`watch`,`play`,`media`],create:()=>z(`content.video_thumbnail`,`Video`,[F(U(560,315,`β–Ά Watch`),`Video`,{width:560,link:`#`,borderRadius:8}),B(`Watch: a guided tour of our 2026 launches`,{paddingTop:12,paddingBottom:4}),H(`4 min watch`,{fontSize:13,paddingBottom:16})])},{type:`content.event_card`,category:`content`,name:`Event Card`,description:`Date badge with event title, location, time and an RSVP button. For event-driven newsletters and community digests.`,tags:[`event`,`rsvp`,`community`,`date`,`card`],create:()=>z(`content.event_card`,`Event`,[P(`MAY`,{align:`center`,color:`{colors.buttonText}`,fontSize:12,fontWeight:`bold`,letterSpacing:2,paddingTop:12,paddingBottom:0}),P(`12`,{align:`center`,color:`{colors.buttonText}`,fontSize:36,fontWeight:`bold`,paddingTop:0,paddingBottom:12})],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`content.code_block`,category:`content`,name:`Code Snippet`,description:`Monospaced code block on a tinted background. For developer newsletters and changelog excerpts.`,tags:[`code`,`snippet`,`developer`,`monospace`,`changelog`],create:()=>z(`content.code_block`,`Code`,[P(`npm install @one-million-lines/email-builder`,{fontFamily:`Menlo, Consolas, monospace`,fontSize:13,color:`{colors.text}`,paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16})],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:16})}],Qo=[{type:`feature.list`,category:`feature`,name:`Checkmark Feature List`,description:`Centered title with 3-4 short checkmarked benefits. Good for product newsletters and onboarding emails.`,tags:[`features`,`benefits`,`checkmarks`,`list`],create:()=>z(`feature.list`,`Feature List`,[B(`Why people love it`,{align:`center`,paddingTop:24}),P(`βœ“ Fast and reliable`,{align:`center`}),P(`βœ“ Beautiful out of the box`,{align:`center`}),P(`βœ“ Backed by humans, not bots`,{align:`center`,paddingBottom:24})])},{type:`feature.icon_three`,category:`feature`,name:`Three Icon Features`,description:`Three stacked feature blocks with an emoji/icon, short title and one-line description. Use to highlight 3 product capabilities.`,tags:[`features`,`icons`,`three-up`,`product`],create:()=>z(`feature.icon_three`,`Three Features`,[P(`⚑`,{align:`center`,fontSize:32,paddingTop:24,paddingBottom:4}),P(`Fast`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Built to render in milliseconds.`,{align:`center`,fontSize:14}),L(16),P(`🧩`,{align:`center`,fontSize:32,paddingBottom:4}),P(`Modular`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Compose any layout from blocks.`,{align:`center`,fontSize:14}),L(16),P(`πŸ€–`,{align:`center`,fontSize:32,paddingBottom:4}),P(`AI-ready`,{align:`center`,fontWeight:`bold`,paddingBottom:2}),H(`Edit emails as JSON, not HTML.`,{align:`center`,fontSize:14,paddingBottom:24})])},{type:`feature.before_after`,category:`feature`,name:`Before / After`,description:`Two stacked images labeled 'Before' and 'After'. For product transformations, redesigns and case studies.`,tags:[`before-after`,`comparison`,`case-study`,`transformation`],create:()=>z(`feature.before_after`,`Before / After`,[V(`Before`),F(U(560,280,`Before`),`Before`,{width:560}),L(8),V(`After`),F(U(560,280,`After`),`After`,{width:560}),L(16)])},{type:`feature.benefit_pair`,category:`feature`,name:`Image + Benefit Pair`,description:`Repeat-use block: one supporting image plus a title and benefit paragraph beside it. Stack 2-3 of these for a feature tour.`,tags:[`benefit`,`feature`,`image-text`,`pair`],create:()=>z(`feature.benefit_pair`,`Benefit Pair`,[F(U(560,240,`Feature`),`Feature`,{width:560,paddingTop:16}),B(`Send 10x faster`,{paddingTop:12,paddingBottom:4}),P(`Reusable modules and theme tokens let teams ship campaigns in minutes, not days.`,{paddingBottom:24})])},{type:`feature.testimonial`,category:`feature`,name:`Testimonial`,description:`Customer quote in large type with avatar and attribution. Social proof block.`,tags:[`testimonial`,`review`,`social-proof`,`customer`],create:()=>z(`feature.testimonial`,`Testimonial`,[P(`β€œThis cut our email production from a week to an afternoon.”`,{fontFamily:`{fonts.heading}`,fontSize:22,align:`center`,paddingTop:24,paddingBottom:12,lineHeight:1.4}),F(U(56,56,`πŸ‘€`),`Customer`,{width:56,borderRadius:28}),P(`Alex Kim Β· Head of Lifecycle, Acme`,{align:`center`,color:`{colors.muted}`,fontSize:13,paddingTop:4,paddingBottom:24})])},{type:`feature.logo_strip`,category:`feature`,name:`Customer Logo Strip`,description:`Small horizontal row implying customer logos for credibility ('Trusted by'). Logos shown as a placeholder image.`,tags:[`logos`,`trusted-by`,`social-proof`,`strip`],create:()=>z(`feature.logo_strip`,`Logo Strip`,[H(`TRUSTED BY`,{align:`center`,fontSize:11}),F(U(520,60,`LOGOS`),`Customer logos`,{width:520,paddingTop:8,paddingBottom:16})])},{type:`feature.gradient_hero`,category:`feature`,name:`Gradient Hero CTA`,description:`Bold centered hero with an eyebrow, oversized headline and a primary CTA button. Great for launch announcements and campaign openers.`,tags:[`hero`,`launch`,`cta`,`bold`,`announcement`],create:()=>z(`feature.gradient_hero`,`Gradient Hero CTA`,[V(`Introducing`,{align:`center`}),B(`Something new is here`,{level:1,align:`center`,paddingTop:4,paddingBottom:8}),P(`A fresh way to reach your audience β€” crafted for the inbox.`,{align:`center`,color:`{colors.muted}`,fontSize:16,paddingBottom:20}),I(`Explore now`,`#`,{align:`center`})],{backgroundColor:`{colors.surface}`,paddingTop:40,paddingBottom:40})},{type:`feature.pull_quote`,category:`feature`,name:`Pull Quote`,description:`Large centered quotation with an attribution line. Use to highlight a testimonial or a memorable line.`,tags:[`quote`,`testimonial`,`highlight`,`pull-quote`],create:()=>z(`feature.pull_quote`,`Pull Quote`,[P(`β€œThis is the fastest we’ve ever shipped a campaign.”`,{fontFamily:`{fonts.heading}`,fontSize:24,align:`center`,lineHeight:1.4,paddingTop:28,paddingBottom:8}),H(`β€” A very happy customer`,{align:`center`,paddingBottom:28})])},{type:`feature.stat_row`,category:`feature`,name:`Stat Row`,description:`Three short number + label pairs in a row. Use to show traction, metrics or highlights.`,tags:[`stats`,`metrics`,`numbers`,`row`,`kpi`],create:()=>z(`feature.stat_row`,`Stat Row`,[B(`By the numbers`,{align:`center`,paddingTop:24}),P(`<b>10k+</b> subscribers &nbsp;Β·&nbsp; <b>98%</b> delivery &nbsp;Β·&nbsp; <b>4.9β˜…</b> rating`,{align:`center`,color:`{colors.muted}`,paddingBottom:24})])},{type:`feature.single_product_spotlight`,category:`feature`,name:`Single Product Spotlight`,description:`One product with image, name, price and buy button. Use to feature a hero product in a feature-focused email.`,tags:[`product`,`spotlight`,`single`,`buy`,`shop`,`ecommerce`],create:()=>z(`feature.single_product_spotlight`,`Product Spotlight`,[G([W({name:`The Signature Bag`,finalPrice:`$129`,oldPrice:`$159`,description:`Handmade, built to last.`,image:U(520,520,`Product`)})],{columns:1,showDescription:!0,buttonLabel:`Buy now`})])},{type:`feature.pill_nav`,category:`feature`,name:`Pill Navigation`,description:`Centered row of navigation links with a divider below. Compact feature nav block for use inside email content sections.`,tags:[`menu`,`nav`,`links`,`pill`],create:()=>z(`feature.pill_nav`,`Pill Navigation`,[F(U(120,32,`LOGO`),`Logo`,{width:120,paddingBottom:8}),P(`<a href="#">Shop</a> &nbsp; <a href="#">New</a> &nbsp; <a href="#">Sale</a> &nbsp; <a href="#">About</a>`,{align:`center`,color:`{colors.primary}`,paddingBottom:8}),R({paddingTop:4,paddingBottom:0})])}],$o=[{type:`cta.simple`,category:`call_to_action`,name:`Simple CTA`,description:`Centered headline + body + primary button. The default call-to-action block for any newsletter or promo.`,tags:[`cta`,`primary`,`centered`,`button`],create:()=>z(`cta.simple`,`Simple CTA`,[B(`Ready to get started?`,{align:`center`,paddingTop:24}),H(`Create better emails faster.`,{align:`center`}),I(`Start now`,`https://example.com`),L(16)])},{type:`cta.banner`,category:`call_to_action`,name:`Colored Banner CTA`,description:`Full-width colored band with eyebrow, big headline and a contrasting button. Use to draw attention to sales or launches.`,tags:[`cta`,`banner`,`colored`,`promo`,`sale`],create:()=>z(`cta.banner`,`CTA Banner`,[P(`Limited time offer`,{color:`{colors.buttonText}`,align:`center`,fontSize:14,paddingTop:24,paddingBottom:4}),P(`Save 30% this week only`,{color:`{colors.buttonText}`,align:`center`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingBottom:16}),I(`Shop the sale`),L(24)],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`cta.button_only`,category:`call_to_action`,name:`Button Only`,description:`Single primary button on a clean background. Use as a follow-up CTA after a content block.`,tags:[`cta`,`button`,`minimal`],create:()=>z(`cta.button_only`,`Button`,[I(`Click here`,`https://example.com`)])},{type:`cta.dual_button`,category:`call_to_action`,name:`Two Button Choice`,description:`Two side-by-side actions: a primary and a ghost-styled secondary. Use when offering 'Learn more' vs 'Get started'.`,tags:[`cta`,`buttons`,`two-options`,`choice`],create:()=>z(`cta.dual_button`,`Two Buttons`,[B(`Pick your path`,{align:`center`,paddingTop:24}),H(`Choose what fits your team.`,{align:`center`}),I(`Get started`,`https://example.com`),I(`Learn more`,`https://example.com`,{backgroundColor:`transparent`,color:`{colors.primary}`}),L(16)])},{type:`cta.image_overlay`,category:`call_to_action`,name:`Image + Overlay CTA`,description:`Lead image with a headline, supporting text, and a button immediately below. Strong visual call to action.`,tags:[`cta`,`image`,`visual`,`hero`],create:()=>z(`cta.image_overlay`,`Image CTA`,[F(U(560,280,`Visual`),`Visual`,{width:560,paddingTop:16}),B(`Stop guessing. Start measuring.`,{align:`center`,paddingTop:16}),H(`Free for 14 days. No credit card.`,{align:`center`}),I(`Try it free`),L(16)])},{type:`cta.subscribe`,category:`call_to_action`,name:`Subscribe / Forward`,description:`Friendly 'Was this forwarded? Subscribe' block that grows the list virally. Common at the end of newsletters.`,tags:[`cta`,`subscribe`,`forward`,`growth`,`newsletter`],create:()=>z(`cta.subscribe`,`Subscribe`,[V(`Was this forwarded?`,{align:`center`}),B(`Get the next issue in your inbox`,{align:`center`,paddingTop:0,paddingBottom:8}),I(`Subscribe free`),L(16)],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0})},{type:`cta.referral`,category:`call_to_action`,name:`Referral / Share`,description:`Encourages readers to share the newsletter with a unique referral link. Includes a 'Share' button and a personalized URL.`,tags:[`cta`,`referral`,`share`,`viral`,`growth`],create:()=>z(`cta.referral`,`Referral`,[V(`Tell a friend`,{align:`center`}),B(`Share & earn perks`,{align:`center`,paddingTop:0,paddingBottom:8}),H(`Refer 3 friends and unlock the bonus issue.`,{align:`center`}),P(`yourname.com/r/abc123`,{align:`center`,color:`{colors.primary}`,fontFamily:`Menlo, Consolas, monospace`,fontSize:14,paddingTop:8,paddingBottom:8}),I(`Share now`),L(16)])},{type:`cta.upgrade`,category:`call_to_action`,name:`Upgrade / Paid`,description:`Conversion block that promotes a paid plan or premium tier. Includes price, benefits and an upgrade button.`,tags:[`cta`,`upgrade`,`paid`,`premium`,`conversion`],create:()=>z(`cta.upgrade`,`Upgrade`,[V(`Become a member`,{align:`center`}),B(`$5 / month`,{align:`center`,level:1}),H(`Unlock the archive, weekly bonus and member chat.`,{align:`center`,fontSize:14}),I(`Upgrade`),L(16)],{backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0})},{type:`cta.feedback`,category:`call_to_action`,name:`Feedback Reply`,description:`Asks the reader to reply with feedback ('Hit reply and let me know'). Personal, no button.`,tags:[`cta`,`feedback`,`reply`,`personal`],create:()=>z(`cta.feedback`,`Feedback`,[P(`How did this issue land for you? Just hit reply β€” I read every message.`,{align:`center`,paddingTop:24,paddingBottom:24,lineHeight:1.6})])}],es=[{type:`ecom.product_single`,category:`ecommerce`,name:`Single Product`,description:`One product with image, title, price, short description and Buy button. Use to feature a hero product. Supports old/final price and per-product link.`,tags:[`product`,`single`,`buy`,`hero`],create:()=>z(`ecom.product_single`,`Single Product`,[G([W({name:`Linen Tote Bag`,image:U(560,400,`Product`),oldPrice:`$59.00`,finalPrice:`$39.00`,description:`Heavyweight natural linen, made in Portugal.`})],{columns:1,showOldPrice:!0,showDescription:!0,buttonLabel:`Buy now`})])},{type:`ecom.product_grid_2`,category:`ecommerce`,name:`Product Grid (2 up)`,description:`Two products side-by-side on desktop, stacked on mobile. Each card has image, name, old/final price, optional description and Shop button. Curated picks layout.`,tags:[`product`,`grid`,`two-up`,`curated`,`responsive`],create:()=>z(`ecom.product_grid_2`,`Product Grid 2`,[G([W({name:`Product A`,finalPrice:`$29`,oldPrice:`$39`}),W({name:`Product B`,finalPrice:`$34`,oldPrice:`$45`})],{columns:2,showOldPrice:!0})])},{type:`ecom.product_grid_3`,category:`ecommerce`,name:`Product Grid (3 up)`,description:`Three product cards in a row on desktop, stacked on mobile. Use for 'New arrivals' or 'Bestsellers' rows.`,tags:[`product`,`grid`,`three-up`,`bestsellers`,`new-arrivals`,`responsive`],create:()=>z(`ecom.product_grid_3`,`Product Grid 3`,[V(`New arrivals`,{align:`center`}),G([W({name:`Product 1`,finalPrice:`$19`}),W({name:`Product 2`,finalPrice:`$24`}),W({name:`Product 3`,finalPrice:`$32`})],{columns:3,showOldPrice:!1})])},{type:`ecom.collection_banner`,category:`ecommerce`,name:`Collection Banner`,description:`Wide collection banner with title and 'Shop the collection' button overlaying or under an image. Use for category drops.`,tags:[`collection`,`banner`,`category`,`drop`],create:()=>z(`ecom.collection_banner`,`Collection`,[F(U(560,300,`Collection`),`Collection`,{width:560}),B(`Spring Collection 2026`,{align:`center`,paddingTop:16}),H(`Lighter fabrics, brighter colors.`,{align:`center`}),I(`Shop the collection`),L(16)])},{type:`ecom.discount`,category:`ecommerce`,name:`Discount Code`,description:`Big discount code in monospaced caps with 'Your code' label and a Redeem button.`,tags:[`discount`,`promo`,`code`,`coupon`],create:()=>z(`ecom.discount`,`Discount Code`,[H(`Your code`,{align:`center`}),P(`SAVE20`,{fontFamily:`{fonts.heading}`,fontSize:36,fontWeight:`bold`,align:`center`,color:`{colors.primary}`,letterSpacing:4,paddingTop:4,paddingBottom:16}),I(`Redeem`),L(24)])},{type:`ecom.voucher`,category:`ecommerce`,name:`Voucher Code`,description:`Personalized voucher block: 'Your code' label, a large voucher code and a Redeem button. With the voucher-select plugin, pick a code from your backend catalog; otherwise edit the code text directly.`,tags:[`voucher`,`coupon`,`discount`,`code`,`promo`,`redeem`],create:()=>z(`ecom.voucher`,`Voucher Code`,[H(`Your code`,{align:`center`}),xe(`SAVE20`),I(`Redeem`),L(24)])},{type:`ecom.flash_sale`,category:`ecommerce`,name:`Flash Sale Banner`,description:`Urgency-driven banner with countdown-style copy ('Ends in 24h'), discount value and a shop button.`,tags:[`flash-sale`,`urgency`,`promo`,`banner`,`countdown`],create:()=>z(`ecom.flash_sale`,`Flash Sale`,[P(`⏰ FLASH SALE β€” ENDS IN 24H`,{color:`{colors.buttonText}`,align:`center`,fontWeight:`bold`,letterSpacing:2,paddingTop:16,paddingBottom:4}),P(`Up to 50% off everything`,{color:`{colors.buttonText}`,align:`center`,fontFamily:`{fonts.heading}`,fontSize:28,fontWeight:`bold`,paddingBottom:12}),I(`Shop now`,`#`,{backgroundColor:`{colors.surface}`,color:`{colors.primary}`}),L(16)],{backgroundColor:`{colors.primary}`,paddingTop:0,paddingBottom:0})},{type:`ecom.abandoned_cart`,category:`ecommerce`,name:`Abandoned Cart Reminder`,description:`Friendly reminder showing the items left in the cart with a return-to-cart button. For cart recovery automations.`,tags:[`abandoned-cart`,`recovery`,`automation`,`reminder`],create:()=>z(`ecom.abandoned_cart`,`Abandoned Cart`,[B(`You left something behind`,{align:`center`,paddingTop:16}),H(`Pick up where you left off.`,{align:`center`}),L(8),G([W({name:`Linen Tote Bag`,image:U(400,400,`Item`),finalPrice:`$39`,oldPrice:`$49`})],{columns:1,showOldPrice:!0,buttonLabel:`Return to cart`})])},{type:`ecom.review_request`,category:`ecommerce`,name:`Review Request`,description:`Post-purchase block asking for a 1-5 star rating with stacked star buttons. For review-collection emails.`,tags:[`review`,`rating`,`post-purchase`,`feedback`],create:()=>z(`ecom.review_request`,`Review`,[B(`How did we do?`,{align:`center`,paddingTop:24}),H(`Tap a star to leave a quick review.`,{align:`center`}),P(`β˜† β˜† β˜† β˜† β˜†`,{align:`center`,fontSize:32,color:`{colors.primary}`,paddingTop:12,paddingBottom:24,link:`#`})])},{type:`ecom.gift_guide`,category:`ecommerce`,name:`Gift Guide Pick`,description:`Editorial gift-guide pick: persona eyebrow + a single product card with full details (image, name, old/final price, description, CTA).`,tags:[`gift-guide`,`curated`,`editorial`,`holiday`],create:()=>z(`ecom.gift_guide`,`Gift Pick`,[V(`For the home cook`),G([W({name:`Cast Iron Skillet`,image:U(560,300,`Pick`),oldPrice:`$119`,finalPrice:`$89`,description:`Pre-seasoned, lifetime-guarantee. Made in USA.`})],{columns:1,showOldPrice:!0,showDescription:!0,buttonLabel:`View product`})])},{type:`ecom.bestseller_list`,category:`ecommerce`,name:`Bestseller Grid`,description:`Top products grid (3 up) with old/final prices. Used by retailers for weekly bestsellers.`,tags:[`bestsellers`,`grid`,`ranking`,`top`],create:()=>z(`ecom.bestseller_list`,`Bestsellers`,[V(`Top 3 this week`),G([W({name:`Linen Tote`,finalPrice:`$39`,oldPrice:`$49`}),W({name:`Ceramic Mug`,finalPrice:`$24`}),W({name:`Brass Lamp`,finalPrice:`$129`,oldPrice:`$149`})],{columns:3,showOldPrice:!0})])}],ts=[{type:`tx.order_summary`,category:`transactional`,name:`Order Summary`,description:`Order confirmation summary: order number, line items with thumbnails and totals row. Used in post-purchase emails.`,tags:[`order`,`summary`,`receipt`,`post-purchase`,`ecommerce`],create:()=>z(`tx.order_summary`,`Order Summary`,[V(`Order #1024`),B(`Thanks for your order`,{paddingTop:0}),H(`We'll email you again when it ships.`),R({paddingTop:16,paddingBottom:8}),P(`Linen Tote Bag Β· 1 Γ— $39.00`,{paddingTop:4,paddingBottom:4}),P(`Ceramic Mug Β· 2 Γ— $24.00`,{paddingTop:4,paddingBottom:4}),R({paddingTop:8,paddingBottom:8}),P(`Subtotal: $87.00`,{paddingTop:2,paddingBottom:2}),P(`Shipping: $5.00`,{paddingTop:2,paddingBottom:2}),P(`Total: $92.00`,{fontWeight:`bold`,paddingTop:2,paddingBottom:16})])},{type:`tx.shipping_update`,category:`transactional`,name:`Shipping Update`,description:`Shipping confirmation with tracking number, carrier, expected delivery date and a Track button.`,tags:[`shipping`,`tracking`,`delivery`,`post-purchase`],create:()=>z(`tx.shipping_update`,`Shipping Update`,[P(`πŸ“¦`,{align:`center`,fontSize:40,paddingTop:24}),B(`Your order is on the way`,{align:`center`,paddingTop:8}),H(`Carrier: USPS Β· Expected: May 4, 2026`,{align:`center`}),P(`Tracking: 9400 1108 ...`,{align:`center`,color:`{colors.muted}`,fontFamily:`Menlo, Consolas, monospace`,fontSize:13}),I(`Track package`),L(16)])},{type:`tx.invoice`,category:`transactional`,name:`Invoice`,description:`Itemized invoice with billing period, services and totals. Used by SaaS and B2B billing emails.`,tags:[`invoice`,`billing`,`saas`,`b2b`,`receipt`],create:()=>z(`tx.invoice`,`Invoice`,[V(`Invoice INV-2026-04`),B(`April 2026 invoice`),H(`Billed to: Acme Inc Β· Period: Apr 1 – Apr 30`),R({paddingTop:16,paddingBottom:8}),P(`Pro plan Β· $49.00`,{paddingTop:4,paddingBottom:4}),P(`Add-on seats (3) Β· $36.00`,{paddingTop:4,paddingBottom:4}),R({paddingTop:8,paddingBottom:8}),P(`Total due: $85.00`,{fontWeight:`bold`,paddingBottom:16}),I(`Download invoice (PDF)`),L(16)])},{type:`tx.password_reset`,category:`transactional`,name:`Password Reset`,description:`Authentication email with a reset button and a fallback link. Includes 'expires in X minutes' notice.`,tags:[`auth`,`password`,`reset`,`security`],create:()=>z(`tx.password_reset`,`Password Reset`,[B(`Reset your password`,{align:`center`,paddingTop:16}),P(`Click the button below to set a new password. This link expires in 30 minutes.`,{align:`center`,paddingBottom:16}),I(`Reset password`),H(`If the button doesn't work, paste this link in your browser:`,{align:`center`,fontSize:12}),P(`https://example.com/reset/abc123`,{align:`center`,color:`{colors.primary}`,fontSize:12,paddingBottom:24})])},{type:`tx.verify_email`,category:`transactional`,name:`Verify Email`,description:`Single-purpose 'verify your email' transactional with one centered button.`,tags:[`auth`,`verify`,`email-confirmation`],create:()=>z(`tx.verify_email`,`Verify Email`,[B(`One last step`,{align:`center`,paddingTop:16}),P(`Confirm your email address to activate your account.`,{align:`center`,paddingBottom:8}),I(`Verify email`),L(24)])},{type:`tx.appointment`,category:`transactional`,name:`Appointment Confirmation`,description:`Booking/meeting confirmation with date, time, location and add-to-calendar links.`,tags:[`appointment`,`booking`,`calendar`,`meeting`],create:()=>z(`tx.appointment`,`Appointment`,[V(`Confirmed`,{align:`center`}),B(`Your appointment is set`,{align:`center`,paddingTop:0}),P(`Tuesday, May 12 Β· 10:00 AM`,{align:`center`,fontWeight:`bold`,paddingTop:8}),H(`123 Main St, Suite 4 Β· Brooklyn, NY`,{align:`center`}),I(`Add to calendar`),L(16)])}],ns=[{type:`social.icons`,category:`social`,name:`Social Icons Row`,description:`Centered 'Follow us' label with text-link icons in a row. Light footer-style social block.`,tags:[`social`,`follow`,`icons`,`row`],create:()=>z(`social.icons`,`Social Icons`,[H(`Follow us`,{align:`center`}),P(`Twitter Β· Instagram Β· LinkedIn Β· YouTube`,{align:`center`,color:`{colors.primary}`,paddingBottom:16})])},{type:`social.share`,category:`social`,name:`Share This Email`,description:`'Share this email' bar with Forward Β· Tweet Β· Share text links. Used at the end of newsletters.`,tags:[`social`,`share`,`forward`,`viral`],create:()=>z(`social.share`,`Share Bar`,[P(`Share this email`,{align:`center`,paddingTop:8}),P(`Forward Β· Tweet Β· Share`,{align:`center`,color:`{colors.primary}`,paddingBottom:8})])},{type:`social.featured_post`,category:`social`,name:`Featured Social Post`,description:`Embed-style preview of a single social post: avatar, name, post text and a link to view it on the platform.`,tags:[`social`,`post`,`embed`,`twitter`,`instagram`],create:()=>z(`social.featured_post`,`Social Post`,[V(`From the community`),F(U(48,48,`πŸ‘€`),`Avatar`,{width:48,borderRadius:24}),P(`@maker Β· 2h`,{color:`{colors.muted}`,fontSize:13,paddingTop:4,paddingBottom:4}),P(`"Just shipped my newsletter using OpenPostcards. Honestly the smoothest email build I've ever done."`,{paddingBottom:8,lineHeight:1.6}),P(`View on Twitter β†’`,{color:`{colors.primary}`,paddingBottom:16,link:`#`})])},{type:`social.instagram_grid`,category:`social`,name:`Instagram Grid`,description:`3 small square thumbnails in a row representing recent Instagram posts, with handle and link.`,tags:[`social`,`instagram`,`grid`,`thumbnails`],create:()=>z(`social.instagram_grid`,`IG Grid`,[H(`@youraccount on Instagram`,{align:`center`}),F(U(180,180,`1`),`Post 1`,{width:180}),F(U(180,180,`2`),`Post 2`,{width:180}),F(U(180,180,`3`),`Post 3`,{width:180}),P(`View profile β†’`,{align:`center`,color:`{colors.primary}`,paddingTop:8,paddingBottom:16,link:`#`})])},{type:`social.community_stats`,category:`social`,name:`Community Stats`,description:`Short '12k Twitter Β· 4k IG Β· 2k YT' style row used to show following sizes.`,tags:[`social`,`stats`,`community`,`following`],create:()=>z(`social.community_stats`,`Community Stats`,[V(`Join the community`,{align:`center`}),P(`12k Twitter Β· 4k Instagram Β· 2k YouTube`,{align:`center`,paddingBottom:16}),L(8)])}],rs={backgroundColor:`{colors.background}`,paddingTop:0,paddingBottom:0},is=[{type:`footer.simple`,category:`footer`,name:`Simple Footer`,description:`Minimal footer with copyright, address and unsubscribe links. The default for any newsletter.`,tags:[`footer`,`simple`,`copyright`,`unsubscribe`],create:()=>z(`footer.simple`,`Simple Footer`,[H(`Β© 2026 Your Company. All rights reserved.`,{align:`center`,fontSize:12}),H(`123 Main St Β· City Β· Country`,{align:`center`,fontSize:12}),K([{label:`Unsubscribe`,type:`unsubscribe`},{label:`View in browser`,type:`view_in_browser`}])],{...rs,paddingTop:24})},{type:`footer.social`,category:`footer`,name:`Footer with Social`,description:`Footer with social links row above the legal text.`,tags:[`footer`,`social`,`links`],create:()=>z(`footer.social`,`Social Footer`,[P(`Follow us`,{align:`center`,paddingTop:24}),P(`Twitter Β· Instagram Β· LinkedIn`,{align:`center`,color:`{colors.primary}`,paddingBottom:12}),R(),H(`Β© 2026 Your Company`,{align:`center`,fontSize:12}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],rs)},{type:`footer.legal`,category:`footer`,name:`Legal Footer`,description:`Long-form footer with explanation of why the user is receiving the email plus privacy/terms/unsubscribe links. Used by enterprise and finance newsletters.`,tags:[`footer`,`legal`,`compliance`,`enterprise`],create:()=>z(`footer.legal`,`Legal Footer`,[P(`You are receiving this email because you signed up for our newsletter. If you no longer wish to receive emails, you can unsubscribe at any time.`,{align:`center`,color:`{colors.muted}`,fontSize:11,lineHeight:1.6,paddingTop:24}),K([{label:`Privacy Policy`,type:`user_profile`},{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],rs)},{type:`footer.publisher`,category:`footer`,name:`Publisher Footer`,description:`Magazine-style sign-off with logo, publication name, masthead credits, address and links.`,tags:[`footer`,`publisher`,`magazine`,`masthead`,`editorial`],create:()=>z(`footer.publisher`,`Publisher Footer`,[F(U(120,36,`LOGO`),`Logo`,{width:120,paddingTop:24,paddingBottom:8}),P(`THE WEEKLY`,{align:`center`,fontFamily:`{fonts.heading}`,fontWeight:`bold`,letterSpacing:4,paddingTop:0,paddingBottom:4}),H(`Editor: Jane Doe Β· Producer: Alex Kim`,{align:`center`,fontSize:12}),R({paddingTop:12,paddingBottom:12}),H(`Β© 2026 The Weekly Β· 350 Madison Ave Β· NY 10017`,{align:`center`,fontSize:11}),K([{label:`Manage preferences`,type:`manage_preferences`},{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],rs)},{type:`footer.app_links`,category:`footer`,name:`Footer with App Store Badges`,description:`Footer including 'Get the app' app-store and play-store badge images. For consumer brand newsletters.`,tags:[`footer`,`app`,`download`,`ios`,`android`],create:()=>z(`footer.app_links`,`App Footer`,[P(`Get the app`,{align:`center`,fontWeight:`bold`,paddingTop:24,paddingBottom:8}),F(U(135,40,`App Store`),`App Store`,{width:135,align:`center`,paddingTop:0,paddingBottom:4}),F(U(135,40,`Google Play`),`Google Play`,{width:135,align:`center`,paddingTop:0,paddingBottom:16}),R(),H(`Β© 2026 Your Brand`,{align:`center`,fontSize:11}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:24})],rs)},{type:`footer.address_only`,category:`footer`,name:`Address Only`,description:`Just a centered postal address line β€” required for CAN-SPAM compliance when other footers are minimal.`,tags:[`footer`,`address`,`compliance`,`can-spam`],create:()=>z(`footer.address_only`,`Address`,[H(`Your Company Β· 123 Main St Β· Brooklyn, NY 11201 Β· USA`,{align:`center`,fontSize:11}),K([{label:`Unsubscribe`,type:`unsubscribe`}],{paddingBottom:16})],{...rs,paddingTop:16})},{type:`footer.preferences`,category:`footer`,name:`Manage Preferences`,description:`Footer that emphasizes preference management ('Update your preferences', 'Send less often'). Reduces unsubscribes.`,tags:[`footer`,`preferences`,`frequency`,`retention`],create:()=>z(`footer.preferences`,`Preferences`,[P(`Getting too many emails?`,{align:`center`,paddingTop:24,paddingBottom:4}),K([{label:`Update your preferences`,type:`manage_preferences`},{label:`Unsubscribe`,type:`unsubscribe`}],{color:`{colors.primary}`,fontSize:13,paddingTop:4,paddingBottom:16}),R(),H(`Β© 2026 Your Company`,{align:`center`,fontSize:11}),P(` `,{align:`center`,paddingBottom:24})],rs)},{type:`footer.signature`,category:`footer`,name:`Signature Sign-off`,description:`Personal hand-signed style sign-off with author name and tiny legal block. For solo creator newsletters.`,tags:[`footer`,`signature`,`personal`,`creator`,`sign-off`],create:()=>z(`footer.signature`,`Signature`,[P(`Until next week,`,{paddingTop:24,paddingBottom:4}),P(`β€” Jane`,{fontFamily:`{fonts.heading}`,fontSize:22,paddingBottom:16}),R(),K([{label:`Unsubscribe`,type:`unsubscribe`}],{align:`left`,fontSize:11,paddingTop:4,paddingBottom:24,separator:` Β· `})],{...rs,paddingTop:0})}],as=[...Jo,...Yo,...Xo,...Zo,...Qo,...$o,...es,...ts,...ns,...is],os=!1;function ss(){if(!os){for(let e of as)Ue.register(e);os=!0}}ss();function cs(){let{doc:e,addModule:t,loadFromLocalStorage:n}=M();return(0,l.useEffect)(()=>{if(n(),M.getState().doc.modules.length===0){for(let e of[`header.hero`,`content.headline_body`,`cta.simple`,`footer.simple`]){let n=Ue.get(e);n&&t(n.create())}M.setState({selection:{kind:`email`},past:[],future:[]})}},[]),(0,l.useEffect)(()=>{let e=setTimeout(()=>M.getState().saveToLocalStorage(),500);return()=>clearTimeout(e)},[e]),(0,p.jsxs)(`div`,{className:`oml-email-builder h-full w-full flex flex-col bg-gray-100`,children:[(0,p.jsx)(Re,{}),(0,p.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,p.jsx)(pt,{}),(0,p.jsx)(aa,{}),(0,p.jsx)(bo,{})]})]})}var ls=e=>{if(e&&typeof e==`object`)return e;throw Error(`AI server returned a non-object response.`)};function us(e){let t=e.transformResponse??ls,n=e.timeoutMs??6e4;return{async generate(r){let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(e.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`,...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,body:JSON.stringify(r),signal:i.signal}),a=null,o=await n.text();try{a=o?JSON.parse(o):null}catch{}if(!n.ok){let e=(a&&typeof a==`object`&&`error`in a&&typeof a.error==`string`?a.error:null)??`AI request failed (HTTP ${n.status})`;throw Error(e)}return t(a)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`AI request timed out after ${n}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(a)}}}}function ds(e){let t=us(e);return{name:`ai-assistant`,type:`ai-provider`,setup(e){e.setAIProvider(t)}}}function fs(e){if(e==null)return null;if(Array.isArray(e))return fs(e[0]);if(typeof e!=`object`)return null;let t=e;for(let e of[`product`,`item`,`data`])if(t[e]&&typeof t[e]==`object`&&!Array.isArray(t[e]))return t[e];for(let e of[`results`,`products`,`items`,`hits`])if(Array.isArray(t[e]))return fs(t[e]);return t}function ps(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t;if(typeof t==`number`)return String(t)}}function ms(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()!==``&&!Number.isNaN(Number(t)))return Number(t)}}var hs=e=>{let t=fs(e);if(!t)return null;let n=ps(t,[`name`,`title`,`product_name`,`productName`]),r=ps(t,[`finalPrice`,`final_price`,`price`,`sale_price`,`salePrice`]);return!n||r==null?null:{name:n,finalPrice:r,oldPrice:ps(t,[`oldPrice`,`old_price`,`compare_at_price`,`compareAtPrice`,`list_price`,`listPrice`]),description:ps(t,[`description`,`desc`,`summary`]),link:ps(t,[`link`,`url`,`product_url`,`productUrl`,`permalink`]),image:ps(t,[`image`,`image_url`,`imageUrl`,`thumbnail`,`img`]),imageAlt:ps(t,[`imageAlt`,`image_alt`,`alt`]),stars:ms(t,[`stars`,`rating`,`review_score`,`reviewScore`,`score`]),sku:ps(t,[`sku`,`id`,`product_id`,`productId`])}};function gs(e){let t=e.method??`GET`,n=e.queryParam??`q`,r=e.bodyParam??`query`,i=e.timeoutMs??15e3,a=e.transformResponse??hs;return{async search(o){let s=o.trim();if(!s)return null;let c=new AbortController,l=setTimeout(()=>c.abort(),i);try{let i=e.endpoint,o={method:t,headers:{...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,signal:c.signal};if(t===`GET`){let t=typeof location<`u`?location.href:void 0,r=new URL(e.endpoint,t);r.searchParams.set(n,s),i=r.toString()}else o.headers[`Content-Type`]=`application/json`,o.body=JSON.stringify({[r]:s});let l=await fetch(i,o),u=null,d=await l.text();try{u=d?JSON.parse(d):null}catch{}if(!l.ok){let e=(u&&typeof u==`object`&&`error`in u&&typeof u.error==`string`?u.error:null)??`Product search failed (HTTP ${l.status})`;throw Error(e)}return a(u)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`Product search timed out after ${i}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(l)}}}}function _s(e){let t=gs(e);return{name:`product-search`,type:`product-provider`,setup(e){e.registerProductProvider(t)}}}function vs(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;for(let e of[`vouchers`,`results`,`items`,`data`,`coupons`])if(Array.isArray(t[e]))return t[e]}return[]}function ys(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t;if(typeof t==`number`)return String(t)}}var bs=e=>{let t=[];for(let n of vs(e)){if(!n||typeof n!=`object`)continue;let e=n,r=ys(e,[`code`,`voucher_code`,`voucherCode`,`coupon`,`coupon_code`,`couponCode`,`value`]),i=ys(e,[`id`,`voucher_id`,`voucherId`,`uid`])??r;if(!i&&!r)continue;let a=ys(e,[`title`,`name`,`label`])??r??i??`Voucher`;t.push({id:i??a,title:a,code:r??i??a,description:ys(e,[`description`,`desc`,`summary`])})}return t};function xs(e){let t=e.method??`GET`,n=e.timeoutMs??15e3,r=e.transformResponse??bs;return{async list(){let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(e.endpoint,{method:t,headers:{...e.headers??{}},credentials:e.withCredentials?`include`:`same-origin`,signal:i.signal}),a=null,o=await n.text();try{a=o?JSON.parse(o):null}catch{}if(!n.ok){let e=(a&&typeof a==`object`&&`error`in a&&typeof a.error==`string`?a.error:null)??`Voucher request failed (HTTP ${n.status})`;throw Error(e)}return r(a)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`Voucher request timed out after ${n}ms`):e instanceof Error?e:Error(String(e))}finally{clearTimeout(a)}}}}function Ss(e){let t=xs(e);return{name:`voucher-select`,type:`voucher-provider`,setup(n){n.registerVoucherProvider(t),e.preload&&Ma()}}}var Cs=e=>{if(e&&typeof e==`object`&&`url`in e&&typeof e.url==`string`){let t=e;return{url:t.url,alt:typeof t.alt==`string`?t.alt:void 0}}throw Error(`Server response missing "url" string field.`)};function ws(e){let t=e.fieldName??`file`,n=(e.maxSizeMB??10)*1024*1024,r=e.transformResponse??Cs;return{upload(i){return i.type.startsWith(`image/`)?i.size>n?Promise.reject(Error(`File too large: ${(i.size/1024/1024).toFixed(2)} MB > ${e.maxSizeMB??10} MB`)):new Promise((n,a)=>{let o=new XMLHttpRequest,s=new FormData;if(s.append(t,i,i.name),o.open(`POST`,e.endpoint,!0),o.withCredentials=!!e.withCredentials,e.headers)for(let[t,n]of Object.entries(e.headers))o.setRequestHeader(t,n);e.onProgress&&o.upload&&(o.upload.onprogress=t=>{t.lengthComputable&&e.onProgress(Math.round(t.loaded/t.total*100))}),o.onload=()=>{let e=o.status>=200&&o.status<300,t=null;try{t=o.responseText?JSON.parse(o.responseText):null}catch{}if(!e){let e=(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`?t.error:null)??`Upload failed (HTTP ${o.status})`;return a(Error(e))}try{n(r(t))}catch(e){a(e instanceof Error?e:Error(String(e)))}},o.onerror=()=>a(Error(`Network error during upload`)),o.onabort=()=>a(Error(`Upload aborted`)),o.send(s)}):Promise.reject(Error(`Not an image: ${i.type||`unknown`}`))}}}function Ts(e){return{name:`image-uploader`,type:`asset-provider`,setup(t){t.registerAssetProvider(ws(e))}}}function Es(e){return(0,l.useEffect)(()=>{if(ss(),e.modules)for(let t of e.modules)Ue.register(t);if(e.themes&&M.setState({themes:e.themes}),e.aiProvider)za.setAIProvider(e.aiProvider);else if(e.aiEndpoint){let t=typeof e.aiEndpoint==`string`?{endpoint:e.aiEndpoint}:e.aiEndpoint;za.setAIProvider(us(t))}if(e.productProvider)za.registerProductProvider(e.productProvider);else if(e.productEndpoint){let t=typeof e.productEndpoint==`string`?{endpoint:e.productEndpoint}:e.productEndpoint;za.registerProductProvider(gs(t))}if(e.voucherProvider)za.registerVoucherProvider(e.voucherProvider);else if(e.voucherEndpoint){let t=typeof e.voucherEndpoint==`string`?{endpoint:e.voucherEndpoint}:e.voucherEndpoint;za.registerVoucherProvider(xs(t)),typeof e.voucherEndpoint!=`string`&&e.voucherEndpoint.preload&&Ma()}if(e.mergeTags&&za.registerMergeTags(e.mergeTags),e.enableRecommendations&&za.registerRecommendationsPlugin(),e.initialDocument){let t=b.safeParse(e.initialDocument);t.success&&M.getState().applyDoc(t.data,!1)}let t=M.subscribe((t,n)=>{t.doc!==n.doc&&e.onChange?.(t.doc)});return()=>t()},[]),(0,l.useEffect)(()=>{if(e.onExportHtml)return M.subscribe((t,n)=>{t.doc!==n.doc&&e.onExportHtml?.(k(t.doc))})},[e.onExportHtml]),(0,l.createElement)(cs)}function Ds(e){let t=(0,c.createRoot)(e.container);return t.render((0,l.createElement)(Es,e)),{destroy:()=>t.unmount(),getDocument:()=>M.getState().doc,exportHtml:()=>M.getState().exportHtml(),exportJson:()=>M.getState().exportJson()}}var Os={name:`recommendations`,type:`recommendations`,setup:e=>e.registerRecommendationsPlugin()};exports.ALGORITHMS=Ua,exports.ALGORITHM_BY_ID=Wa,exports.EmailBuilder=Es,exports.FALLBACK_OPTIONS=Ga,exports.TEMPLATE_CATEGORY_LABELS=ye,exports.aiAssistantPlugin=ds,exports.applyAIActions=et,exports.applyAIResponse=st,exports.buildCatalog=$e,exports.createEmailBuilder=Ds,exports.createHttpAIProvider=us,exports.createProductSearchProvider=gs,exports.createVoucherProvider=xs,exports.defaultRecommendationsLogic=Ka,exports.documentSchema=b,exports.getActiveProductProvider=ba,exports.getActiveVoucherProvider=Aa,exports.imageUploaderPlugin=Ts,exports.isVoucherAware=po,exports.mockAIProvider=rt,exports.productSearchPlugin=_s,exports.readRecommendationsLogic=qa,exports.recommendationsPlugin=Os,exports.recommendationsToLegacyShape=Xa,exports.registerPlugin=Ba,exports.renderEmailHtml=k,exports.setActiveProductProvider=ya,exports.setActiveVoucherProvider=ka,exports.templateRegistry=N,exports.useRecommendationsStore=Fa,exports.validateAIDocument=nt,exports.voucherPlugin=Ss;
82
82
  //# sourceMappingURL=email-builder.cjs.map