(()=>{"use strict";const e=window.wp.i18n,s=window.wp.blocks,t=window.wp.blockEditor,r=window.wp.components,o=({attributes:s,setAttributes:o})=>{const{label:l,domain:a,showIcon:c}=s;return React.createElement(t.InspectorControls,null,React.createElement(r.PanelBody,{title:(0,e.__)("Button settings","wp-seopress")},React.createElement(r.TextControl,{label:(0,e.__)("Button label","wp-seopress"),value:l,placeholder:(0,e.__)("Add as a preferred source","wp-seopress"),onChange:e=>o({label:e})}),React.createElement(r.TextControl,{label:(0,e.__)("Domain","wp-seopress"),value:a,help:(0,e.__)("Leave empty to use your site domain. Only domains and subdomains are eligible (e.g. example.com or news.example.com), not subdirectories.","wp-seopress"),onChange:e=>o({domain:e})}),React.createElement(r.ToggleControl,{label:(0,e.__)("Show Google logo","wp-seopress"),checked:c,onChange:e=>o({showIcon:e})})))},l=()=>React.createElement("svg",{className:"seopress-preferred-source__icon",width:"18",height:"18",viewBox:"0 0 48 48","aria-hidden":"true",focusable:"false",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z"}),React.createElement("path",{fill:"#FF3D00",d:"M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z"}),React.createElement("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z"}),React.createElement("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303c-.792 2.237-2.231 4.166-4.087 5.571.001-.001.002-.001.003-.002l6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z"})),a=JSON.parse('{"u2":"wpseopress/preferred-source"}');(0,s.registerBlockType)(a.u2,{title:(0,e.__)("Google Preferred Sources","wp-seopress"),description:(0,e.__)("Display a button inviting visitors to add your site as a preferred source on Google.","wp-seopress"),keywords:[(0,e.__)("google","wp-seopress"),(0,e.__)("preferred source","wp-seopress"),(0,e.__)("top stories","wp-seopress"),(0,e.__)("follow","wp-seopress")],edit:function({attributes:s,setAttributes:r}){const{label:a,domain:c,showIcon:n,siteDomain:p}=s,i=(0,t.useBlockProps)({className:"seopress-preferred-source"}),w=a&&a.trim()?a:(0,e.__)("Add as a preferred source","wp-seopress"),d=function(e){const s=(e||"").trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/.*$/,"");return s?`https://www.google.com/preferences/source?q=${encodeURIComponent(s)}`:"#"}(c||p);return React.createElement("div",i,React.createElement(o,{attributes:s,setAttributes:r}),React.createElement("a",{className:"seopress-preferred-source__link",href:d,onClick:e=>e.preventDefault()},n&&React.createElement(l,null),React.createElement("span",{className:"seopress-preferred-source__label"},w)))},save:()=>null})})();