!function(){"use strict";var e={87:function(e){e.exports=window.wp.element},427:function(e){e.exports=window.wp.components},715:function(e){e.exports=window.wp.blockEditor},723:function(e){e.exports=window.wp.i18n},790:function(e){e.exports=window.ReactJSXRuntime}},t={};function o(n){var l=t[n];if(void 0!==l)return l.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var n=o(723),l=o(715),r=o(427),a=(o(87),o(790));const{registerBlockType:i}=wp.blocks;i("blynex/announcement-widget",{title:(0,n.__)("Announcement Widget","blynex"),description:(0,n.__)("A customizable announcement widget with badge, text, and icon.","blynex"),category:"widgets",icon:"megaphone",keywords:["announcement","widget","badge","cta","notification"],supports:{html:!0,align:["wide","full"],spacing:{margin:!0,padding:!0},color:{text:!0,background:!0},style:{color:{background:!0,text:!0,border:!0}}},attributes:{badgeText:{type:"string",default:"NEW"},mainText:{type:"string",default:"The Financial Brighter Application"},badgeColor:{type:"string",default:""},badgeTextColor:{type:"string",default:""},textColor:{type:"string",default:""},backgroundColor:{type:"string",default:""},borderColor:{type:"string",default:""},borderRadius:{type:"number",default:10},borderWidth:{type:"number",default:1},padding:{type:"object",default:{top:"6px",right:"6px",bottom:"6px",left:"6px"}},margin:{type:"object",default:{top:"0px",right:"0px",bottom:"0px",left:"0px"}},width:{type:"number",default:325},height:{type:"number",default:41},gap:{type:"number",default:12},showIcon:{type:"boolean",default:!0},iconColor:{type:"string",default:""},iconBackgroundColor:{type:"string",default:""},align:{type:"string",default:"left"},fontSize:{type:"number",default:12},badgeFontSize:{type:"number",default:10},fontWeight:{type:"string",default:"500"},badgeFontWeight:{type:"string",default:"600"}},edit:({attributes:e,setAttributes:t,isSelected:o})=>{try{const{badgeText:o,mainText:i,badgeColor:s,badgeTextColor:d,textColor:c,backgroundColor:x,borderColor:g,borderRadius:p,borderWidth:b,padding:u,margin:h,gap:m,showIcon:y,iconColor:C,iconBackgroundColor:f,align:j,fontSize:v,badgeFontSize:_,fontWeight:w,badgeFontWeight:B}=e,k=(0,l.useSetting)("color.palette")||[],W={};k.forEach((e=>{W[e.slug]=e.color}));const F={base:"var(--wp--preset--color--base, #FFFFFF)",contrast:"var(--wp--preset--color--contrast, #193E39)",accent1:"var(--wp--preset--color--accent-1, #1E322D)",accent2:"var(--wp--preset--color--accent-2, #DBFE7A)",accent5:"var(--wp--preset--color--accent-5, #0A0915)",accent6:"var(--wp--preset--color--accent-6, #FAF8F4)"},S=(0,l.useBlockProps)({className:`blynex-announcement-widget align-${j}`,style:{backgroundColor:x||F.accent6,border:`${b}px solid ${g||F.accent1}`,borderRadius:`${p}px`,padding:`${u.top} ${u.right} ${u.bottom} ${u.left}`,margin:`${h.top} ${h.right} ${h.bottom} ${h.left}`,display:"inline-flex",alignItems:"center",justifyContent:"space-between",gap:`${m}px`,minHeight:"auto",width:"auto",maxWidth:"none"}}),T={backgroundColor:s||F.accent2,color:d||F.base,fontSize:`${_}px`,fontWeight:B,padding:"4px 12px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.5px",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"40px",height:"24px"},$={color:c||F.base,fontSize:`${v}px`,fontWeight:w,flex:1,margin:0,lineHeight:"1.4"},R={backgroundColor:f||F.accent1,color:C||F.base,width:"32px",height:"32px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.BlockControls,{children:(0,a.jsx)(l.AlignmentToolbar,{value:j,onChange:e=>t({align:e})})}),(0,a.jsxs)(l.InspectorControls,{children:[(0,a.jsxs)(r.PanelBody,{title:(0,n.__)("Content Settings","blynex"),initialOpen:!0,children:[(0,a.jsx)(r.TextControl,{label:(0,n.__)("Badge Text","blynex"),value:o,onChange:e=>t({badgeText:e})}),(0,a.jsx)(r.TextControl,{label:(0,n.__)("Main Text","blynex"),value:i,onChange:e=>t({mainText:e})}),(0,a.jsx)(r.ToggleControl,{label:(0,n.__)("Show Icon","blynex"),checked:y,onChange:e=>t({showIcon:e})})]}),(0,a.jsxs)(r.PanelBody,{title:(0,n.__)("Badge Styling","blynex"),initialOpen:!1,children:[(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Badge Background Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:s,onChange:e=>t({badgeColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Badge Text Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:d,onChange:e=>t({badgeTextColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsx)(r.RangeControl,{label:(0,n.__)("Badge Font Size","blynex"),value:_,onChange:e=>t({badgeFontSize:e}),min:8,max:24,step:1}),(0,a.jsx)(r.SelectControl,{label:(0,n.__)("Badge Font Weight","blynex"),value:B,options:[{label:(0,n.__)("Normal","blynex"),value:"400"},{label:(0,n.__)("Medium","blynex"),value:"500"},{label:(0,n.__)("Semi Bold","blynex"),value:"600"},{label:(0,n.__)("Bold","blynex"),value:"700"}],onChange:e=>t({badgeFontWeight:e})})]}),(0,a.jsxs)(r.PanelBody,{title:(0,n.__)("Text Styling","blynex"),initialOpen:!1,children:[(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Text Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:c,onChange:e=>t({textColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsx)(r.RangeControl,{label:(0,n.__)("Font Size","blynex"),value:v,onChange:e=>t({fontSize:e}),min:12,max:32,step:1}),(0,a.jsx)(r.SelectControl,{label:(0,n.__)("Font Weight","blynex"),value:w,options:[{label:(0,n.__)("Normal","blynex"),value:"400"},{label:(0,n.__)("Medium","blynex"),value:"500"},{label:(0,n.__)("Semi Bold","blynex"),value:"600"},{label:(0,n.__)("Bold","blynex"),value:"700"}],onChange:e=>t({fontWeight:e})})]}),(0,a.jsxs)(r.PanelBody,{title:(0,n.__)("Background & Border","blynex"),initialOpen:!1,children:[(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Background Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:x,onChange:e=>t({backgroundColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Border Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:g,onChange:e=>t({borderColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsx)(r.RangeControl,{label:(0,n.__)("Border Radius","blynex"),value:p,onChange:e=>t({borderRadius:e}),min:0,max:50,step:1}),(0,a.jsx)(r.RangeControl,{label:(0,n.__)("Border Width","blynex"),value:b,onChange:e=>t({borderWidth:e}),min:0,max:10,step:1})]}),(0,a.jsx)(r.PanelBody,{title:(0,n.__)("Dimensions & Spacing","blynex"),initialOpen:!1,children:(0,a.jsx)(r.RangeControl,{label:(0,n.__)("Gap (px)","blynex"),value:m,onChange:e=>t({gap:e}),min:4,max:32,step:1})}),(0,a.jsxs)(r.PanelBody,{title:(0,n.__)("Icon Styling","blynex"),initialOpen:!1,children:[(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Icon Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:C,onChange:e=>t({iconColor:e}),colors:k,disableCustomColors:!1})]}),(0,a.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,a.jsx)("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:(0,n.__)("Icon Background Color","blynex")}),(0,a.jsx)(l.ColorPalette,{value:f,onChange:e=>t({iconBackgroundColor:e}),colors:k,disableCustomColors:!1})]})]})]}),(0,a.jsxs)("div",{...S,children:[(0,a.jsx)("div",{style:T,children:(0,a.jsx)(l.RichText,{tagName:"span",value:o,onChange:e=>t({badgeText:e}),placeholder:(0,n.__)("Badge text...","blynex"),className:"blynex-announcement-badge-text"})}),(0,a.jsx)(l.RichText,{tagName:"p",value:i,onChange:e=>t({mainText:e}),placeholder:(0,n.__)("Main announcement text...","blynex"),className:"blynex-announcement-text",style:$}),y?(0,a.jsx)("div",{style:R,children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):(0,a.jsx)("div",{style:{...R,opacity:.3},children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})}catch(e){return console.error("Announcement Widget Edit Error:",e),(0,a.jsxs)("div",{style:{padding:"20px",border:"2px dashed #ff0000",backgroundColor:"#fff5f5",color:"#ff0000",textAlign:"center"},children:[(0,a.jsx)("p",{children:(0,a.jsx)("strong",{children:"Announcement Widget Error"})}),(0,a.jsx)("p",{children:"There was an error rendering this widget."}),(0,a.jsxs)("p",{children:["Error: ",e.message]})]})}},save:({attributes:e})=>{const{badgeText:t,mainText:o,badgeColor:n,badgeTextColor:r,textColor:i,backgroundColor:s,borderColor:d,borderRadius:c,borderWidth:x,padding:g,margin:p,gap:b,showIcon:u,iconColor:h,iconBackgroundColor:m,align:y,fontSize:C,badgeFontSize:f,fontWeight:j,badgeFontWeight:v}=e,_="var(--wp--preset--color--base, #FFFFFF)",w="var(--wp--preset--color--accent-1, #1E322D)",B=l.useBlockProps.save({className:`blynex-announcement-widget align-${y}`,style:{backgroundColor:s||"var(--wp--preset--color--accent-6, #FAF8F4)",border:`${x}px solid ${d||w}`,borderRadius:`${c}px`,padding:`${g.top} ${g.right} ${g.bottom} ${g.left}`,margin:`${p.top} ${p.right} ${p.bottom} ${p.left}`,display:"inline-flex",alignItems:"center",justifyContent:"space-between",gap:`${b}px`,minHeight:"auto",width:"auto",maxWidth:"none"}}),k={backgroundColor:n||"var(--wp--preset--color--accent-2, #DBFE7A)",color:r||_,fontSize:`${f}px`,fontWeight:v,padding:"4px 12px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.5px",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"40px",height:"24px"},W={color:i||_,fontSize:`${C}px`,fontWeight:j,flex:1,margin:0,lineHeight:"1.4"},F={backgroundColor:m||w,color:h||_,width:"32px",height:"32px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return(0,a.jsxs)("div",{...B,children:[(0,a.jsx)("div",{style:k,children:(0,a.jsx)(l.RichText.Content,{tagName:"span",value:t,className:"blynex-announcement-badge-text"})}),(0,a.jsx)(l.RichText.Content,{tagName:"p",value:o,className:"blynex-announcement-text",style:W}),u&&(0,a.jsx)("div",{style:F,children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}})}();