(()=>{"use strict";const e=window.wp.blocks,o=JSON.parse('{"apiVersion":3,"name":"jobus/shortcode-job-archive","title":"Job Archive Shortcode (Jobus)","category":"jobus-blocks","icon":"dashicons dashicons-shortcode","description":"Display the Job Archive job posts on the website frontend","supports":{"html":false,"anchor":true},"attributes":{"job_layout":{"type":"string","default":"1"},"preview":{"type":"boolean","default":false}},"example":{"attributes":{"preview":true}},"keywords":["jobus","Shortcode","job Archive"],"textdomain":"jobus","editorScript":"file:./index.js","editorStyle":"file:./editor.css"}'),s=window.wp.i18n,t=window.wp.blockEditor,i=window.wp.components,l=window.React,r=window.wp.element,a=window.ReactJSXRuntime,n=()=>(0,a.jsxs)("h3",{children:["Here is a set of ",(0,a.jsx)("strong",{children:"job archive layout"})," shortcodes for your block widgets. These shortcodes are designed specifically to display job archive layouts"]});(0,e.registerBlockType)(o,{edit:function({attributes:e,setAttributes:o}){const{job_layout:u,preview:c}=e,d=(0,t.useBlockProps)(),b=jobus_block_params.jobus_is_premium,[p,j]=(0,l.useState)(null),[h,m]=(0,l.useState)({top:0,left:0}),_=(0,l.useRef)({}),y=[{label:(0,s.__)("Sidebar Filter Layout","jobus"),value:"1",img:jobus_block_params.jobus_image_dir+"/layout/job/archive-layout-1.png",pro:!1},{label:(0,s.__)("List Layout","jobus"),value:"2",img:jobus_block_params.jobus_image_dir+"/layout/job/archive-layout-2.png",pro:!0},{label:(0,s.__)("Grid Layout","jobus"),value:"3",img:jobus_block_params.jobus_image_dir+"/layout/job/archive-layout-3.png",pro:!0}];return c?(0,a.jsx)("div",{className:"block-preview",children:(0,a.jsx)(n,{})}):(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)(t.InspectorControls,{children:(0,a.jsx)(i.PanelBody,{title:(0,s.__)("Filters","jobus"),initialOpen:!0,children:(0,a.jsx)(i.BaseControl,{label:(0,s.__)("Select Layout","jobus"),children:(0,a.jsx)("div",{className:"jbs-layout-options",style:{display:"flex",gap:"1rem",position:"relative"},children:y.map((e=>(0,a.jsxs)("div",{ref:o=>_.current[e.value]=o,className:`layout-option ${u===e.value?"active":""} ${e.pro&&!b?"locked":""}`,onClick:()=>(e=>{if(!e.pro||b)o({job_layout:e.value}),j(null);else if(_.current[e.value]){const o=_.current[e.value].getBoundingClientRect();m({top:o.top,left:o.left-280}),j(e.value)}})(e),style:{position:"relative",cursor:e.pro&&!b?"not-allowed":"pointer"},children:[(0,a.jsx)("img",{src:e.img,alt:e.label}),(0,a.jsx)("span",{className:"layout-label",children:e.label})]},e.value)))})})})}),(0,a.jsx)("div",{...d,children:"[jobus_job_archive]"}),p&&_.current[p]&&(0,r.createPortal)((0,a.jsx)("div",{style:{position:"fixed",top:h.top+"px",left:h.left+"px",width:"280px",zIndex:99999},children:(0,a.jsxs)(i.Notice,{status:"info",isDismissible:!0,onRemove:()=>j(null),className:"jbs-pro-notice",children:[(0,a.jsxs)("h4",{style:{margin:"0 0 0.5rem 0",fontWeight:"bold"},children:[(0,s.__)("Pro Feature","jobus"),(0,a.jsx)("span",{className:"pro-lock",style:{marginLeft:"0.25rem"},children:"🔒"})]}),(0,a.jsx)("p",{style:{marginBottom:"0.5rem"},children:(0,s.__)("This layout is a Pro feature. Upgrade to Jobus Pro to unlock advanced layouts and premium styling options!","jobus")}),(0,a.jsx)(i.Button,{isPrimary:!0,href:jobus_block_params.jobus_upgrade_url,target:"_blank",style:{marginTop:"0.25rem"},className:"jobus-upgrade-button",children:(0,s.__)("Upgrade Now","jobus")})]})}),document.body)]})},save:function(e){const{job_layout:o}=e.attributes,s=t.useBlockProps.save(),i=`[jobus_job_archive job_layout="${o}"]`;return(0,a.jsx)(l.Fragment,{children:(0,a.jsx)("div",{...s,children:i})})}})})();
//# sourceMappingURL=index.js.map