(()=>{"use strict";const e=window.wp.blocks,a=window.React,t=window.wp.i18n,l=window.wp.blockEditor,c=window.wp.components,n=JSON.parse('{"UU":"ucla-wordpress-plugin/callout"}');(0,e.registerBlockType)(n.UU,{edit:({attributes:e,setAttributes:n})=>{let{calloutBody:o,calloutNumber:r,calloutVariant:i,calloutCitation:u}=e;const s=(0,l.useBlockProps)();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,t.__)("Settings","ucla-wordpress-plugin"),initialOpen:!0},(0,a.createElement)(c.SelectControl,{label:(0,t.__)("Select variant","ucla-wordpress-plugin"),value:i,onChange:e=>{n({calloutVariant:e})},help:(0,t.__)("Change the variant of the callout.","ucla-wordpress-plugin"),options:[{value:"default",label:(0,t.__)("Factoid","ucla-wordpess-plugin")},{value:"ranking",label:(0,t.__)("Ranking","ucla-wordpess-plugin")},{value:"statistics",label:(0,t.__)("Statistic","ucla-wordpess-plugin")}]}))),(0,a.createElement)("div",{...s},(0,a.createElement)("aside",{className:"ucla-callout"+("default"!==i?` ucla-callout__${i}`:"")},"default"!==i&&(0,a.createElement)(l.RichText,{value:r,onChange:e=>{n({calloutNumber:e})},tagName:"span",placeholder:"ranking"===i?"#9":"31,000",className:"ucla-callout__number",preserveWhiteSpace:!1}),"default"!==i?(0,a.createElement)("div",{className:"ucla-callout__body"},(0,a.createElement)(l.RichText,{value:o,placeholder:"ranking"===i?"Lorem ipsum dolor sit amet":"Lorem ipsum dolor sit amet, consectetur adipiscing elit",onChange:e=>{n({calloutBody:e})},preserveWhiteSpace:!0,tagName:"span"}),"ranking"===i&&(0,a.createElement)(l.RichText,{value:u,placeholder:(0,t.__)("Lorem ipsum","ucla-wordpress-plugin"),onChange:e=>{n({calloutCitation:e})},preserveWhiteSpace:!0,tagName:"cite"})):(0,a.createElement)(l.RichText,{value:o,placeholder:(0,t.__)("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","ucla-wordpress-plugin"),onChange:e=>{n({calloutBody:e})},preserveWhiteSpace:!0,tagName:"span"}))))},save:({attributes:e})=>{let{calloutBody:t,calloutVariant:c,calloutNumber:n,calloutCitation:o}=e;const r=l.useBlockProps.save();return(0,a.createElement)("div",{...r},(0,a.createElement)("aside",{class:"ucla-callout"+("default"!==c?` ucla-callout__${c}`:"")},"default"!==c&&(0,a.createElement)(l.RichText.Content,{tagName:"span",value:n,className:"ucla-callout__number",preserveWhiteSpace:!0}),(0,a.createElement)((({condition:e,wrapper:a,children:t})=>e?a(t):t),{condition:"default"!==c,wrapper:e=>(0,a.createElement)("div",{className:"ucla-callout__body"},e)},(0,a.createElement)(l.RichText.Content,{value:t,preserveWhiteSpace:!0}),"ranking"===c&&(0,a.createElement)(l.RichText.Content,{tagName:"cite",value:o,preserveWhiteSpace:!0}))))}})})();