!function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=32)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,a){e.exports=a(23)()},function(e,t,a){"use strict";var r=a(0),n=(a(5),a(2)),i=a(1),o=function(e){var t=e.name,a=e.url;return Object(r.createElement)(n.Placeholder,{label:t},Object(r.createElement)("p",{className:"components-placeholder__error"},a),Object(r.createElement)("p",{className:"components-placeholder__error"},Object(i.__)("Previews for this are unavailable in the editor, sorry!","amp")))},l=function(e){var t=e.attributes,a=e.setAttributes,o=e.ampLayoutOptions,l=t.ampLayout,c=t.height,u=t.width,s=!c&&("fixed"===l||"fixed-height"===l),d=!u&&"fixed"===l;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(n.SelectControl,{label:Object(i.__)("Layout","amp"),value:l,options:o,onChange:function(e){return a({ampLayout:e})}}),d&&Object(r.createElement)(n.Notice,{status:"error",isDismissible:!1},Object(i.sprintf)( /* translators: %s is the layout name */ Object(i.__)("Width is required for %s layout","amp"),l)),Object(r.createElement)(n.TextControl,{type:"number",label:Object(i.__)("Width (px)","amp"),value:void 0!==u?u:"",onChange:function(e){return a({width:e})}}),s&&Object(r.createElement)(n.Notice,{status:"error",isDismissible:!1},Object(i.sprintf)( /* translators: %s is the layout name */ Object(i.__)("Height is required for %s layout","amp"),l)),Object(r.createElement)(n.TextControl,{type:"number",label:Object(i.__)("Height (px)","amp"),value:c,onChange:function(e){return a({height:e})}}))};a.d(t,"b",function(){return o}),a.d(t,"a",function(){return l})},function(e,t){function a(){return e.exports=a=Object.assign||function(e){for(var t=1;t",Object(i.cloneElement)(e,{key:"new",value:l})}return o.children=e,Object(i.createElement)("amp-fit-text",o)}}else if((n=f(a.content))!==a.content)return Object(i.cloneElement)(e,{key:"new",value:n});return e},f=function(e){var t=/]*>(.*?)<\/amp-fit-text>/.exec(e),a=e;return t&&t[1]&&(a=t[1]),a},h=function(e){for(var t=[{value:"",label:Object(o.__)("Default","amp")}],a=0,r=m;ad&&Object(i.createElement)(l.Notice,{status:"error",isDismissible:!1},Object(o.__)("The height must be greater than the max font size.","amp")),Object(i.createElement)(l.PanelBody,{title:Object(o.__)("Minimum font size","amp")},Object(i.createElement)(l.FontSizePicker,{fallbackFontSize:14,value:u,fontSizes:m,onChange:function(e){e||(e=6),parseInt(e,10)<=s&&r({minFont:e})}})),u>s&&Object(i.createElement)(l.Notice,{status:"error",isDismissible:!1},Object(o.__)("The min font size must less than the max font size.","amp")),Object(i.createElement)(l.PanelBody,{title:Object(o.__)("Maximum font size","amp")},Object(i.createElement)(l.FontSizePicker,{fallbackFontSize:48,value:s,fontSizes:m,onChange:function(e){e||(e=72),r({maxFont:e,height:Math.max(e,d)})}}))))},x=function(e){var t=e.isSelected;if(!F(e.attributes)||!t)return null;var a=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(c.InspectorControls,null,Object(i.createElement)(l.PanelBody,{title:Object(o.__)("AMP Settings","amp")},a&&Object(i.createElement)(P,e),Object(i.createElement)(E,e)))},E=function(e){var t=e.attributes,a=t.ampLightbox,r=t.linkTo,n=t.ampLayout,c=e.setAttributes;return Object(i.createElement)(l.ToggleControl,{label:Object(o.__)("Add lightbox effect","amp"),checked:a,onChange:function(e){c({ampLightbox:!a}),e&&("fixed-height"===n&&c({ampLayout:"fixed"}),r&&"none"!==r&&c({linkTo:"none"}))}})},P=function(e){var t=e.attributes.ampCarousel,a=e.setAttributes;return Object(i.createElement)(l.ToggleControl,{label:Object(o.__)("Display as carousel","amp"),checked:t,onChange:function(){return a({ampCarousel:!t})}})},w=function(e){return e.isSelected?Object(i.createElement)(c.InspectorControls,null,Object(i.createElement)(l.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(j,e),Object(i.createElement)(_,e),Object(i.createElement)(E,e))):null},C=function(e){if(!e.isSelected)return null;var t=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(c.InspectorControls,null,Object(i.createElement)(l.PanelBody,{title:Object(o.__)("AMP Settings","amp")},t&&Object(i.createElement)(P,e),Object(i.createElement)(E,e)))},S=function(e){return e.replace(" amp-carousel=false","")},I=function(e){return e.replace(" amp-lightbox=true","")},k=function(e){return-1!==e.indexOf("amp-carousel=false")},T=function(e){return-1!==e.indexOf("amp-lightbox=true")},F=function(e){return e.text&&-1!==e.text.indexOf("gallery")},A=function(){var e=Object(u.select)("amp/block-editor"),t=e.getDefaultStatus,a=e.getPossibleStatuses,r=Object(u.select)("core/editor").getEditedPostAttribute;if("amp_story"===r("type"))return!0;var n=r("meta");return n&&n.amp_status&&a().includes(n.amp_status)?"enabled"===n.amp_status:"enabled"===t()}},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t,a){"use strict";a.d(t,"a",function(){return n}),a.d(t,"b",function(){return i});a(30);var r=a(1),n=(a(4),function(){return{width:1200,height:675}}),i=function(e,t,a){if(!e)return a?[Object(r.__)("Selecting a featured image is required.","amp")]:[Object(r.__)("Selecting a featured image is recommended for an optimal user experience.","amp")];var n=[];if(["image/png","image/gif","image/jpeg"].includes(e.mime_type)||n.push( /* translators: 1: .jpg, 2: .png. 3: .gif */ Object(r.sprintf)(Object(r.__)("The featured image must be in %1$s, %2$s, or %3$s format.","amp"),".jpg",".png",".gif")),!function(e,t){if(!e||!e.width||!e.height)return!1;var a=t.width,r=t.height;return e.width>=a&&e.height>=r}(e.media_details,t)){var i=t.width,o=t.height;n.push( /* translators: 1: minimum width, 2: minimum height. */ Object(r.sprintf)(Object(r.__)("The featured image should have a size of at least %1$s by %2$s pixels.","amp"),Math.ceil(i),Math.ceil(o)))}return 0===n.length?null:n}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,a){"use strict";var r,n,i=a(0),o=(a(5),a(2)),l=a(17),c=a(3),u=a(1),s=a(13),d=Object(c.withSelect)(function(e){var t=e("core/editor").getCurrentPost(),a=e("core/editor").getEditedPostAttribute("featured_media"),r=t.featured_media||a;return{featuredMedia:r?e("core").getMedia(r):null}})(function(e){var t=e.featuredMedia,a=e.dimensions,r=e.required,n=Object(s.b)(t,a,r);return n?Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.PluginPrePublishPanel,{title:Object(u.__)("Featured Image","amp"),initialOpen:"true"},Object(i.createElement)(o.Notice,{status:r?"warning":"notice",isDismissible:!1},n.map(function(e,t){return Object(i.createElement)("p",{key:"error-".concat(t)},e)})))):null}),m=a(14),b=Object(m.createHigherOrderComponent)(function(e){return function(t){var a=t.media,r=Object(s.b)(a,Object(s.a)(),!1);return r?Object(i.createElement)(i.Fragment,null,Object(i.createElement)(o.Notice,{status:"notice",isDismissible:!1},r.map(function(e,t){return Object(i.createElement)("p",{key:"error-".concat(t)},e)})),Object(i.createElement)(e,t)):Object(i.createElement)(e,t)}},"withFeaturedImageNotice"),p=a(18),f=a.n(p),h=a(19),y=a.n(h),O=a(20),g=a.n(O),j=a(21),_=a.n(j),v=a(27),x=a.n(v),E=a(22),P=a.n(E),w=a(10),C=window.wp,S=C.media.View.extend({className:"notice notice-warning notice-alt inline",template:(r=Object(u.sprintf)( /* translators: 1: image width in pixels. 2: image height in pixels. 3: required minimum width in pixels. 4: required minimum height in pixels. */ Object(u.__)("The selected image is too small (%1$s by %2$s pixels). It should have a size of at least %3$s by %4$s pixels.","amp"),"{{width}}","{{height}}","{{minWidth}}","{{minHeight}}"),n=Object(w.template)("

".concat(r,"

"),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g}),function(e){return n(e)})}),I=C.media.view.Toolbar.Select.extend({refresh:function(){C.media.view.Toolbar.Select.prototype.refresh.call(this);var e=this.controller.state(),t=e.get("selection").models[0],a=e.collection.get("library").get("suggestedWidth"),r=e.collection.get("library").get("suggestedHeight");!t||t.get("width")>=a&&t.get("height")>=r?this.secondary.unset("select-error"):this.secondary.set("select-error",new S({minWidth:a,minHeight:r,width:t.get("width"),height:t.get("height")}))}}),k=C.media.view.MediaFrame.Select.extend({createSelectToolbar:function(e,t){(t=t||this.options.button||{}).controller=this,e.view=new I(t)}}),T=window.wp,F=T.media.controller.Cropper.extend({doCrop:function(e){var t=e.get("cropDetails"),a=this.imgSelect.getOptions();return Math.abs(t.width-a.minWidth)<10&&(t.width=a.minWidth),Math.abs(t.height-a.minHeight)<10&&(t.height=a.minHeight),t.dst_width=t.width,t.dst_height=t.height,T.ajax.post("crop-image",{nonce:e.get("nonces").edit,id:e.get("id"),context:"featured-image",cropDetails:t})}}),A=window.wp,L=function(e,t){var a=t.width,r=t.height;return function(e){function t(){var e;return f()(this,t),(e=g()(this,_()(t).apply(this,arguments))).props.modalClass&&"editor-post-featured-image__media-modal"===e.props.modalClass&&(e.init=e.init.bind(x()(e)),e.init()),e}return P()(t,e),y()(t,[{key:"init",value:function(){var e=this;this.frame=new k({button:{text:Object(u.__)("Select","amp"),close:!1},states:[new A.media.controller.Library({title:Object(u.__)("Choose image","amp"),library:A.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:a,suggestedHeight:r}),new F({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),A.media.frame=this.frame,this.frame.on("select",this.onSelectImage,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this),this.frame.on("close",function(){e.init()},this)}},{key:"calculateImageSelectOptions",value:function(e,t){var n=e.get("width"),i=e.get("height"),o=parseInt(a,10),l=parseInt(r,10),c=o/l,u=o,s=l;t.set("canSkipCrop",!0),n/i>c?o=(l=i)*c:l=(o=n)/c;var d=(n-o)/2,m=(i-l)/2;return{aspectRatio:o+":"+l,handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:n,imageHeight:i,minWidth:u>o?o:u,minHeight:s>l?l:s,x1:d,y1:m,x2:o+d,y2:l+m}}},{key:"onSelectImage",value:function(){var e=this.frame.state().get("selection").first().toJSON();a===e.width&&r===e.height?(this.setImageFromURL(e.url,e.id,e.width,e.height),this.frame.close()):this.frame.setState("cropper")}},{key:"doAllowCrop",value:function(e){return e.width&&e.height&&e.width>=a&&e.height>=r}},{key:"mustBeCropped",value:function(e,t,a,r){return!(e===a&&t===r||a<=e)}},{key:"onCropped",value:function(e){var t=e.url,a=e.id,r=e.width,n=e.height;this.setImageFromURL(t,a,r,n)}},{key:"onSkippedCrop",value:function(e){var t=e.get("url"),a=e.get("width"),r=e.get("height");this.setImageFromURL(t,e.id,a,r)}},{key:"setImageFromURL",value:function(e,t,a,r){var n={},i=this.props.onSelect;n.url=e,n.thumbnail_url=e,n.timestamp=Object(w.now)(),t&&(n.attachment_id=t),a&&(n.width=a),r&&(n.height=r),i(n),Object(c.dispatch)("core/editor").editPost({featured_media:t})}}]),t}(e)};a.d(t,"a",function(){return d}),a.d(t,"c",function(){return b}),a.d(t,"b",function(){return L})},function(e,t){e.exports=ampBlockEditor},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function a(e,t){for(var a=0;a