AMP for WordPress - Version 1.5.2

Version Description

Download this release

Release Info

Developer westonruter
Plugin Icon 128x128 AMP for WordPress
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

amp.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://amp-wp.org
6
  * Author: AMP Project Contributors
7
  * Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
8
- * Version: 1.5.1
9
  * Text Domain: amp
10
  * Domain Path: /languages/
11
  * License: GPLv2 or later
@@ -15,7 +15,7 @@
15
 
16
  define( 'AMP__FILE__', __FILE__ );
17
  define( 'AMP__DIR__', dirname( __FILE__ ) );
18
- define( 'AMP__VERSION', '1.5.1' );
19
 
20
  /**
21
  * Errors encountered while loading the plugin.
5
  * Plugin URI: https://amp-wp.org
6
  * Author: AMP Project Contributors
7
  * Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
8
+ * Version: 1.5.2
9
  * Text Domain: amp
10
  * Domain Path: /languages/
11
  * License: GPLv2 or later
15
 
16
  define( 'AMP__FILE__', __FILE__ );
17
  define( 'AMP__DIR__', dirname( __FILE__ ) );
18
+ define( 'AMP__VERSION', '1.5.2' );
19
 
20
  /**
21
  * Errors encountered while loading the plugin.
assets/js/amp-block-editor.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '287ec0d335447c990dc791e0af2ed4c7');
1
+ <?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => 'bbf906f2003754885823929ea8841cb8');
assets/js/amp-block-editor.js CHANGED
@@ -1,17 +1,17 @@
1
- !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=36)}([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(28)()},function(e,t,a){"use strict";a.d(t,"a",(function(){return S})),a.d(t,"c",(function(){return C})),a.d(t,"b",(function(){return k})),a.d(t,"d",(function(){return A}));var r=a(19),n=a.n(r),i=a(25),o=a.n(i),c=a(20),l=a.n(c),u=a(21),s=a.n(u),d=a(16),m=a.n(d),b=a(22),p=a.n(b),f=a(0),h=(a(18),a(12)),O=(a(5),a(2)),y=a(1),g=a(3),j=a(15),v=a(31),_=a(14),w=a(7),x=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),Object(f.createElement)("path",{className:"inner",d:"M48 33c8.285 0 15 6.716 15 15 0 8.284-6.715 15-15 15-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15zm-1.15 24.098l6.293-10.472a.555.555 0 0 0 .12-.335.569.569 0 0 0-.624-.568l-3.508.004 1.155-6.834-1.159-.005-6.272 10.46s-.125.228-.125.363c0 .314.255.57.569.57l.048-.001 3.49-.005-1.126 6.823h1.14z",fill:"none"}))};x.defaultProps={xmlns:"http://www.w3.org/2000/svg"};var E=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{d:"M41.629 28.161L28.624 49.804h-2.356l2.33-14.102-7.214.009-.1.002c-.65 0-1.176-.526-1.176-1.176 0-.279.259-.751.259-.751L33.329 12.17l2.395.01-2.388 14.123 7.251-.009h.115c.65 0 1.176.525 1.176 1.175 0 .264-.103.495-.25.691v.001zM31 0C13.879 0 0 13.88 0 31c0 17.121 13.879 31 31 31 17.12 0 31-13.879 31-31C62 13.88 48.12 0 31 0z",fill:"#82878c"}))};E.defaultProps={width:"62",height:"62",viewBox:"0 0 62 62",xmlns:"http://www.w3.org/2000/svg"};var P=function(e){function t(){var e,a;n()(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(a=l()(this,(e=s()(t)).call.apply(e,[this].concat(i)))).moveButton=a.moveButton.bind(m()(a)),a.openPreviewWindow=a.openPreviewWindow.bind(m()(a)),a.buttonRef=Object(f.createRef)(),a}return p()(t,e),o()(t,[{key:"componentDidUpdate",value:function(e){var t=this.props.previewLink;t&&!e.previewLink&&this.setPreviewWindowLink(t),this.moveButton()}},{key:"moveButton",value:function(){var e=Object(h.get)(this,["buttonRef","current","parentNode"],!1);if(e&&(!e.previousSibling||!e.previousSibling.classList.contains(w.d))){var t=document.querySelector(".".concat(w.d));Object(h.get)(t,"nextSibling")&&e.parentNode.insertBefore(e,t.nextSibling)}}},{key:"setPreviewWindowLink",value:function(e){var t=this.previewWindow;t&&!t.closed&&(t.location=e)}},{key:"getWindowTarget",value:function(){var e=this.props.postId;return"amp-preview-".concat(e)}},{key:"openPreviewWindow",value:function(e){var t,a;(e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable)?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),t=this.previewWindow.document,a=Object(f.renderToString)(Object(f.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},Object(f.createElement)(O.Icon,{icon:x({viewBox:"0 0 98 98"})}),Object(f.createElement)("p",null,Object(y.__)("Generating AMP preview…","amp")))),a+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 198px;\n\t\t\t\theight: 198px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',t.write(a),t.title=Object(y.__)("Generating AMP preview…","amp"),t.close()):this.setPreviewWindowLink(e.target.href)}},{key:"render",value:function(){var e=this.props,t=e.previewLink,a=e.currentPostLink,r=e.errorMessages,n=e.isEnabled,i=e.isSaveable,o=e.isStandardMode,c=t||a;return n&&!r.length&&!o&&Object(f.createElement)(O.Tooltip,{text:Object(y.__)("Preview AMP","amp")},Object(f.createElement)(O.Button,{className:"amp-editor-post-preview",href:c,label:Object(y.__)("Preview AMP","amp"),isSecondary:!0,disabled:!i,onClick:this.openPreviewWindow,ref:this.buttonRef},E({viewBox:"0 0 62 62",width:18,height:18}),Object(f.createElement)("span",{className:"screen-reader-text"},
2
  /* translators: accessibility text */
3
- Object(y.__)("(opens in a new tab)","amp"))))}}]),t}(f.Component),S=Object(j.compose)([Object(g.withSelect)((function(e,t){var a=t.forcePreviewLink,r=t.forceIsAutosaveable,n=e("core/editor"),i=n.getCurrentPostId,o=n.getCurrentPostAttribute,c=n.getEditedPostAttribute,l=n.isEditedPostSaveable,u=n.isEditedPostAutosaveable,s=n.getEditedPostPreviewLink,d=e("amp/block-editor"),m=d.getAmpSlug,b=d.getErrorMessages,p=d.isStandardMode,f={};f[m()]=1;var h=s(),O=h?Object(v.addQueryArgs)(h,f):void 0;return{postId:i(),currentPostLink:Object(v.addQueryArgs)(o("link"),f),previewLink:void 0!==a?a:O,isSaveable:l(),isAutosaveable:r||u(),isDraft:-1!==["draft","auto-draft"].indexOf(c("status")),isEnabled:Object(_.e)(),errorMessages:b(),isStandardMode:p()}})),Object(g.withDispatch)((function(e){return{autosave:e("core/editor").autosave,savePost:e("core/editor").savePost}}))])(P),C=function(e){var t=e.name,a=e.url;return Object(f.createElement)(O.Placeholder,{label:t},Object(f.createElement)("p",{className:"components-placeholder__error"},a),Object(f.createElement)("p",{className:"components-placeholder__error"},Object(y.__)("Previews for this are unavailable in the editor, sorry!","amp")))},k=function(e){var t=e.attributes,a=e.setAttributes,r=e.ampLayoutOptions,n=t.ampLayout,i=t.height,o=t.width,c=!i&&("fixed"===n||"fixed-height"===n),l=!o&&"fixed"===n;return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(O.SelectControl,{label:Object(y.__)("Layout","amp"),value:n,options:r,onChange:function(e){return a({ampLayout:e})}}),l&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(y.sprintf)(
4
  /* translators: %s is the layout name */
5
- Object(y.__)("Width is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(y.__)("Width (px)","amp"),value:void 0!==o?o:"",onChange:function(e){return a({width:e})}}),c&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(y.sprintf)(
6
  /* translators: %s is the layout name */
7
- Object(y.__)("Height is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(y.__)("Height (px)","amp"),value:i,onChange:function(e){return a({height:e})}}))},I=a(23),T=a(9),M=window.wp,A=function(e,t){var a=t.width,r=t.height;return(function(e){function t(){var e,a;n()(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return"editor-post-featured-image__media-modal"===(a=l()(this,(e=s()(t)).call.apply(e,[this].concat(i)))).props.modalClass&&(a.initFeaturedImage=a.initFeaturedImage.bind(m()(a)),a.initFeaturedImage()),a}return p()(t,e),o()(t,[{key:"initFeaturedImage",value:function(){var e=this,t=Object(I.c)(I.b);this.frame=new t({allowedTypes:this.props.allowedTypes,button:{text:Object(y.__)("Select","amp"),close:!1},states:[new M.media.controller.Library({title:Object(y.__)("Choose image","amp"),library:M.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:a,suggestedHeight:r})]}),M.media.frame=this.frame,this.frame.on("select",this.onSelectImage,this),this.frame.on("close",(function(){e.initFeaturedImage()}),this)}},{key:"onSelectImage",value:function(){var e=this.frame.state().get("selection").first().toJSON(),t=this.props.onSelect,a=e.url,r=e.id,n=e.width,i=e.height;Object(T.d)({url:a,id:r,width:n,height:i,onSelect:t,dispatchImage:function(e){Object(g.dispatch)("core/editor").editPost({featured_media:e})}}),this.frame.close()}}]),t}(e))}},function(e,t,a){"use strict";a.d(t,"e",(function(){return r})),a.d(t,"c",(function(){return n})),a.d(t,"b",(function(){return i})),a.d(t,"a",(function(){return o})),a.d(t,"d",(function(){return c}));var r=["core/paragraph","core/heading","core/code","core/quote","core/subhead"],n=["core/image","core/video"],i=608,o=400,c="editor-post-preview"},function(e,t){e.exports=function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}},function(e,t,a){"use strict";a.d(t,"b",(function(){return o})),a.d(t,"e",(function(){return c})),a.d(t,"c",(function(){return l})),a.d(t,"a",(function(){return u})),a.d(t,"d",(function(){return s}));var r=a(12),n=a(1),i=a(10),o=function(){var e=i.c;return{width:e,height:e*(9/16)}},c=function(e,t,a){if(!e)return a?[Object(n.__)("Selecting a featured image is required.","amp")]:[Object(n.__)("Selecting a featured image is recommended for an optimal user experience.","amp")];var r=[];if(["image/png","image/gif","image/jpeg"].includes(e.mime_type)||r.push(
8
  /* translators: 1: .jpg, 2: .png. 3: .gif */
9
  Object(n.sprintf)(Object(n.__)("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;r.push(
10
  /* translators: 1: minimum width, 2: minimum height. */
11
- Object(n.sprintf)(Object(n.__)("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===r.length?null:r},l=function(e){var t=Object(r.template)("<p>".concat(e,"</p>"),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});return function(e){return t(e)}},u=function(e,t){if(e){var a=Object(r.get)(this,["options","allowedTypes"],null),n=this.get("select");a&&e.get("type")&&!function(e,t){var a=e.get("type"),r=e.get("mime");return!(!t.includes(a)&&!t.includes(r))&&"video"!==a}(e,a)?(this.secondary.set(i.a,new t({mimeType:e.get("mime")})),n&&n.model&&n.model.set("disabled",!0)):(this.secondary.unset(i.a),n&&n.model&&n.model.set("disabled",!1))}},s=function(e){var t=e.url,a=e.id,n=e.width,i=e.height,o=e.onSelect,c=e.dispatchImage,l={};l.url=t,l.thumbnail_url=t,l.timestamp=Object(r.now)(),a&&(l.attachment_id=a),n&&(l.width=n),i&&(l.height=i),o(l),c(a)}},function(e,t,a){"use strict";a.d(t,"d",(function(){return r})),a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return i})),a.d(t,"a",(function(){return o}));var r=6,n=72,i=1200,o="select-file-type-error"},function(e,t){function a(){return e.exports=a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},a.apply(this,arguments)}e.exports=a},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.moment}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"d",(function(){return f})),a.d(t,"b",(function(){return y})),a.d(t,"c",(function(){return g})),a.d(t,"e",(function(){return F})),a.d(t,"f",(function(){return D}));var r=a(8),n=a.n(r),i=a(0),o=(a(5),a(18),a(1)),c=a(2),l=a(4),u=a(3),s=a(7),d=a(10);function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var b=[{value:"nodisplay",label:Object(o.__)("No Display","amp"),notAvailable:["core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]},{value:"fixed",label:Object(o.__)("Fixed","amp"),notAvailable:["core-embed/soundcloud"]},{value:"responsive",label:Object(o.__)("Responsive","amp"),notAvailable:["core-embed/soundcloud"]},{value:"fixed-height",label:Object(o.__)("Fixed Height","amp"),notAvailable:[]},{value:"fill",label:Object(o.__)("Fill","amp"),notAvailable:["core-embed/soundcloud"]},{value:"flex-item",label:Object(o.__)("Flex Item","amp"),notAvailable:["core-embed/soundcloud"]},{value:"intrinsic",label:Object(o.__)("Intrinsic","amp"),notAvailable:["core/video","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]}],p=function(e,t){return"core/shortcode"!==t&&"core/gallery"!==t||(e.attributes||(e.attributes={}),e.attributes.ampCarousel={type:"boolean"},e.attributes.ampLightbox={type:"boolean"}),"core/image"===t&&(e.attributes||(e.attributes={}),e.attributes.ampLightbox={type:"boolean"}),s.e.includes(t)&&(e.attributes||(e.attributes={}),e.attributes.ampFitText={default:!1},e.attributes.minFont={default:d.d,source:"attribute",selector:"amp-fit-text",attribute:"min-font-size"},e.attributes.maxFont={default:d.b,source:"attribute",selector:"amp-fit-text",attribute:"max-font-size"},e.attributes.height={default:"core/image"===t?200:10*Math.ceil(d.b/10),source:"attribute",selector:"amp-fit-text",attribute:"height"}),(0===t.indexOf("core-embed")||s.c.includes(t))&&(e.attributes||(e.attributes={}),e.attributes.ampLayout={type:"string"},e.attributes.ampNoLoading={type:"boolean"}),e},f=function(e,t,a){var r=a.text||"",n="",o={layout:"fixed-height"};if("core/shortcode"===t.name&&A(a)){if(a.ampLightbox||M(a.text||"")&&(r=I(a.text)),a.ampCarousel){if(T(r)&&(r=k(r)),!a.ampLightbox)return a.text!==r?Object(i.createElement)(i.RawHTML,null,r):e}else r=T(a.text||"")?a.text:a.text.replace("[gallery","[gallery amp-carousel=false");if(a.ampLightbox&&!M(r)&&(r=r.replace("[gallery","[gallery amp-lightbox=true")),a.text!==r)return Object(i.createElement)(i.RawHTML,null,r)}else if("core/paragraph"!==t.name||a.ampFitText){if(s.e.includes(t.name)&&a.ampFitText)return a.minFont&&(o["min-font-size"]=a.minFont),a.maxFont&&(o["max-font-size"]=a.maxFont),a.height&&(o.height=a.height),o.children=e,Object(i.createElement)("amp-fit-text",o)}else if((n=h(a.content))!==a.content)return Object(i.cloneElement)(e,{key:"new",value:n});return e},h=function(e){var t=/<amp-fit-text\b[^>]*>(.*?)<\/amp-fit-text>/.exec(e),a=e;return t&&t[1]&&(a=t[1]),a},O=function(e){var t=[{value:"",label:Object(o.__)("Default","amp")}],a=!0,r=!1,n=void 0;try{for(var i,c=b[Symbol.iterator]();!(a=(i=c.next()).done);a=!0){var l=i.value;!l.notAvailable.includes(e)&&t.push({value:l.value,label:l.label})}}catch(e){r=!0,n=e}finally{try{a||null==c.return||c.return()}finally{if(r)throw n}}return t},y=function(e,t,a){var r={};return"core/shortcode"===t.name?e:"amp/"===t.name.substr(0,4)?e:(a.ampLayout&&(r["data-amp-layout"]=a.ampLayout),a.ampNoLoading&&(r["data-amp-noloading"]=a.ampNoLoading),a.ampLightbox&&(r["data-amp-lightbox"]=a.ampLightbox),a.ampCarousel&&(r["data-amp-carousel"]=a.ampCarousel),function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},r,{},e))},g=function(e){return function(t){var a,r=t.attributes,n=r.text,o=r.ampLayout,c=t.setAttributes,l=t.name;if("core/shortcode"===l){if(T(n||"")&&c({text:k(n)}),M(n||"")&&c({text:I(n)}),""===(a=x(t)))return Object(i.createElement)(e,t)}else"core/gallery"===l?a=C(t):"core/image"===l?a=S(t):s.c.includes(l)||0===l.indexOf("core-embed/")?a=j(t):s.e.includes(l)&&(a=w(t));return o&&"nodisplay"===o?[a]:Object(i.createElement)(i.Fragment,null,Object(i.createElement)(e,t),a)}},j=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e))):null},v=function(e){var t=e.name,a=e.attributes.ampLayout,r=e.setAttributes,n=Object(o.__)("AMP Layout","amp");return"core/image"===t&&(n=Object(o.__)("AMP Layout (modifies width/height)","amp")),Object(i.createElement)(c.SelectControl,{label:n,value:a,options:O(t),onChange:function(t){r({ampLayout:t}),"core/image"===e.name&&function(e,t){var a=e.attributes,r=e.setAttributes;switch(t){case"fixed-height":a.height||r({height:s.a}),a.ampLightbox&&r({ampLightbox:!1});break;case"fixed":a.height||r({height:s.a}),a.width||r({width:s.b})}}(e,t)}})},_=function(e){var t=e.attributes.ampNoLoading,a=e.setAttributes,r=Object(o.__)("AMP Noloading","amp");return Object(i.createElement)(c.ToggleControl,{label:r,checked:t,onChange:function(){return a({ampNoLoading:!t})}})},w=function(e){var t=e.isSelected,a=e.attributes,r=e.setAttributes,n=a.ampFitText,u=a.minFont,s=a.maxFont,m=a.height,b=[{name:"small",shortName:Object(o._x)("S","font size","amp"),size:14},{name:"regular",shortName:Object(o._x)("M","font size","amp"),size:16},{name:"large",shortName:Object(o._x)("L","font size","amp"),size:36},{name:"larger",shortName:Object(o._x)("XL","font size","amp"),size:48}];if(!t)return null;var p=Object(o.__)("Automatically fit text to container","amp");return n&&(s=parseInt(s),m=parseInt(m),u=parseInt(u)),Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp"),className:n?"is-amp-fit-text":""},Object(i.createElement)(c.ToggleControl,{label:p,checked:n,onChange:function(){return r({ampFitText:!n})}})),n&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(c.TextControl,{label:Object(o.__)("Height","amp"),value:m,min:1,onChange:function(e){r({height:e})}}),s>m&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The height must be greater than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Minimum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:14,value:u,fontSizes:b,onChange:function(e){e||(e=d.d),parseInt(e)<=s&&r({minFont:e})}})),u>s&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The min font size must less than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Maximum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:48,value:s,fontSizes:b,onChange:function(e){e||(e=d.b),r({maxFont:e,height:Math.max(e,m)})}}))))},x=function(e){var t=e.isSelected;if(!A(e.attributes)||!t)return null;var a=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.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,l=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Add lightbox effect","amp"),checked:a,onChange:function(e){l({ampLightbox:!a}),e&&("fixed-height"===n&&l({ampLayout:"fixed"}),r&&"none"!==r&&l({linkTo:"none"}))}})},P=function(e){var t=e.attributes.ampCarousel,a=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Display as carousel","amp"),checked:t,onChange:function(){return a({ampCarousel:!t})}})},S=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,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)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},t&&Object(i.createElement)(P,e),Object(i.createElement)(E,e)))},k=function(e){return e.replace(" amp-carousel=false","")},I=function(e){return e.replace(" amp-lightbox=true","")},T=function(e){return-1!==e.indexOf("amp-carousel=false")},M=function(e){return-1!==e.indexOf("amp-lightbox=true")},A=function(e){return e.text&&-1!==e.text.indexOf("gallery")},F=function(){var e=Object(u.select)("amp/block-editor"),t=e.getDefaultStatus,a=e.getPossibleStatuses,r=(0,Object(u.select)("core/editor").getEditedPostAttribute)("meta");return r&&r.amp_status&&a().includes(r.amp_status)?"enabled"===r.amp_status:"enabled"===t()},D=function(e){var t=document.querySelector(".".concat(s.d));if(t&&t.nextSibling){var a=document.createElement("div");a.id="amp-wrapper-post-preview",Object(i.render)(Object(i.createElement)(e,null),a),t.parentNode.insertBefore(a,t.nextSibling)}}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){!function(){e.exports=this.React}()},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,a){var r=a(37),n=a(16);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?n(e):t}},function(e,t){function a(t){return e.exports=a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(t)}e.exports=a},function(e,t,a){var r=a(38);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"a",(function(){return p})),a.d(t,"c",(function(){return f}));var r=a(8),n=a.n(r),i=a(12),o=a(1),c=a(9);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var u,s=window.wp,d=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:(u=Object(o.sprintf)(
12
  /* translators: 1: image width in pixels. 2: image height in pixels. 3: required minimum width in pixels. 4: required minimum height in pixels. */
13
  Object(o.__)("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}}"),Object(c.c)(u))}),m=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
14
  /* translators: 1: the selected file type. */
15
  Object(o.__)("The selected file mime type, %1$s, is not allowed.","amp"),"{{mimeType}}");return Object(c.c)(e)}()}),b=(s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
16
  /* translators: 1: the recommended max MB per second for videos. 2: the actual MB per second of the video. */
17
- Object(o.__)("A video size of less than %1$s MB per second is recommended. The selected video is %2$s MB per second.","amp"),"{{maxVideoMegabytesPerSecond}}","{{actualVideoMegabytesPerSecond}}");return Object(c.c)(e)}()}),s.media.view.Toolbar.Select.extend({refresh:function(){s.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||"image"!==t.get("type")||!t.get("width")||t.get("width")>=a&&t.get("height")>=r?this.secondary.unset("select-error"):this.secondary.set("select-error",new d({minWidth:a,minHeight:r,width:t.get("width"),height:t.get("height")})),c.a.call(this,t,m)}})),p=s.media.view.Toolbar.Select.extend({refresh:function(){s.media.view.Toolbar.Select.prototype.refresh.call(this);var e=this.controller.state().get("selection").models[0];c.a.call(this,e,m)}}),f=function(e){return s.media.view.MediaFrame.Select.extend({createSelectToolbar:function(t,a){(a=a||this.options.button||{}).controller=this,a=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},a,{allowedTypes:Object(i.get)(this,["options","allowedTypes"],null)}),t.view=new e(a)}})}},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){function a(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"b",(function(){return d}));var r=a(0),n=(a(5),a(2)),i=a(24),o=a(3),c=a(1),l=a(9),u=Object(o.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,o=e.required,u=Object(l.e)(t,a,o);return u?Object(r.createElement)(i.PluginPrePublishPanel,{title:Object(c.__)("Featured Image","amp"),initialOpen:"true"},Object(r.createElement)(n.Notice,{status:o?"warning":"notice",isDismissible:!1},u.map((function(e,t){return Object(r.createElement)("p",{key:"error-".concat(t)},e)})))):null})),s=a(15),d=Object(s.createHigherOrderComponent)((function(e){return function(t){var a=t.media,i=Object(l.e)(a,Object(l.b)(),!1);return i?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(n.Notice,{status:"notice",isDismissible:!1},i.map((function(e,t){return Object(r.createElement)("p",{key:"error-".concat(t)},e)}))),Object(r.createElement)(e,t)):Object(r.createElement)(e,t)}}),"withFeaturedImageNotice");a(19),a(20),a(21),a(16),a(22),a(8),a(12),a(23),window.wp},function(e,t){e.exports=ampBlockEditor},function(e,t,a){"use strict";var r=a(29);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,a,n,i,o){if(o!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var a={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return a.PropTypes=a,a}},function(e,t,a){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,a){"use strict";var r={};a.r(r),a.d(r,"hasThemeSupport",(function(){return c})),a.d(r,"isStandardMode",(function(){return l})),a.d(r,"getDefaultStatus",(function(){return u})),a.d(r,"getPossibleStatuses",(function(){return s})),a.d(r,"getErrorMessages",(function(){return d})),a.d(r,"getAmpSlug",(function(){return m}));var n=a(8),i=a.n(n),o=a(3);function c(e){return Boolean(e.hasThemeSupport)}function l(e){return Boolean(e.isStandardMode)}function u(e){return e.defaultStatus}function s(e){return e.possibleStatuses}function d(e){return e.errorMessages}function m(e){return e.ampSlug}function b(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}Object(o.registerStore)("amp/block-editor",{reducer:function(e){return e},selectors:r,initialState:function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?b(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):b(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},window.ampBlockEditor)})},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.domReady}()},,function(e,t,a){"use strict";a.r(t);var r=a(17),n=a(32),i=a(33),o=a(3),c=a(34),l=a.n(c),u=a(26),s=a(9),d=a(6),m=a(14),b=(a(30),Object(o.select)("amp/block-editor").isStandardMode),p=a(39);p.keys().forEach((function(e){var t=p(e),a=t.name,r=t.render,i=t.icon;Object(n.registerPlugin)(a,{icon:i,render:r})})),Object(r.addFilter)("blocks.registerBlockType","ampEditorBlocks/addAttributes",m.a),Object(r.addFilter)("blocks.getSaveElement","ampEditorBlocks/filterSave",m.d),Object(r.addFilter)("editor.BlockEdit","ampEditorBlocks/filterEdit",m.c,20),Object(r.addFilter)("blocks.getSaveContent.extraProps","ampEditorBlocks/addExtraAttributes",m.b),Object(r.addFilter)("editor.PostFeaturedImage","ampEditorBlocks/withFeaturedImageNotice",u.b),Object(r.addFilter)("editor.MediaUpload","ampEditorBlocks/withMediaLibraryNotice",(function(e){return Object(d.d)(e,Object(s.b)())}));var f=["amp/amp-brid-player","amp/amp-ima-video","amp/amp-jwplayer","amp/amp-mathml","amp/amp-o2-player","amp/amp-ooyala-player","amp/amp-reach-player","amp/amp-springboard-player","amp/amp-timeago"],h=a(42);h.keys().forEach((function(e){var t=h(e),a=t.name,r=t.settings;b()&&f.includes(a)&&Object(i.registerBlockType)(a,r)})),l()((function(){Object(m.f)(d.a)}))},function(e,t){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?e.exports=r=function(e){return a(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)},r(t)}e.exports=r},function(e,t){function a(t,r){return e.exports=a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(t,r)}e.exports=a},function(e,t,a){var r={"./amp-toggle.js":40,"./pre-publish-panel.js":41};function n(e){var t=i(e);return a(t)}function i(e){if(!a.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}n.keys=function(){return Object.keys(r)},n.resolve=i,e.exports=n,n.id=39},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return d})),a.d(t,"icon",(function(){return m})),a.d(t,"render",(function(){return b}));var r=a(0),n=a(27),i=(a(5),a(1)),o=a(2),c=a(3),l=a(24),u=a(15),s=a(14);var d="amp",m="hidden",b=Object(u.compose)(Object(c.withSelect)((function(){return{isEnabled:Object(s.e)()}})),Object(c.withDispatch)((function(e){return{onChange:function(t){var a=t?"enabled":"disabled";e("core/editor").editPost({meta:{amp_status:a}})}}})),u.withInstanceId)((function(e){var t=e.isEnabled,a=e.onChange;return Object(r.createElement)(l.PluginPostStatusInfo,null,!n.errorMessages.length&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("label",{htmlFor:"amp-enabled"},Object(i.__)("Enable AMP","amp")),Object(r.createElement)(o.FormToggle,{checked:t,onChange:function(){return a(!t)},id:"amp-enabled"})),Boolean(n.errorMessages.length)&&Object(r.createElement)(o.Notice,{status:"warning",isDismissible:!1},n.errorMessages.map((function(e,t){return Object(r.createElement)(r.RawHTML,{key:t},e)}))))}))},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return o})),a.d(t,"render",(function(){return c}));var r=a(0),n=a(26),i=a(9),o="amp-post-featured-image-pre-publish-panel",c=function(){return Object(r.createElement)(n.a,{dimensions:Object(i.b)(),required:!1})}},function(e,t,a){var r={"./amp-brid-player/index.js":48,"./amp-ima-video/index.js":49,"./amp-jwplayer/index.js":50,"./amp-mathml/index.js":51,"./amp-o2-player/index.js":52,"./amp-ooyala-player/index.js":53,"./amp-reach-player/index.js":54,"./amp-springboard-player/index.js":55,"./amp-timeago/index.js":56};function n(e){var t=i(e);return a(t)}function i(e){if(!a.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}n.keys=function(){return Object.keys(r)},n.resolve=i,e.exports=n,n.id=42},,,,,,function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.autoPlay,s=t.dataPartner,d=t.dataPlayer,m=t.dataVideo,b=t.dataPlaylist,p=t.dataOutstream,f=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],h=!1;return s&&d&&(m||b||p)&&(h="http://cdn.brid.tv/live/partners/".concat(s)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Brid Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Partner ID (required)","amp"),value:s,onChange:function(e){return a({dataPartner:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:d,onChange:function(e){return a({dataPlayer:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video ID (one of video / playlist / outstream ID is required)","amp"),value:m,onChange:function(e){return a({dataVideo:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Outstream unit ID (one of video / playlist / outstream ID is required)","amp"),value:p,onChange:function(e){return a({dataOutstream:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID (one of video / playlist / outstream ID is required)","amp"),value:b,onChange:function(e){return a({dataPlaylist:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Autoplay","amp"),checked:n,onChange:function(){return a({autoPlay:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:f})))),h&&Object(o.createElement)(u.c,{name:Object(r.__)("Brid Player","amp"),url:h}),!h&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Brid Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataPlayer,r=t.dataOutstream,n=t.dataPartner,i=t.ampLayout,c=t.width,l=t.height,u=t.dataVideo,s=t.autoPlay,d=t.dataPlaylist,m={layout:i,height:l,"data-player":a,"data-partner":n};return"fixed-height"!==i&&c&&(m.width=c),d&&(m["data-playlist"]=d),u&&(m["data-video"]=u),r&&(m["data-outstream"]=r),s&&(m.autoplay=s),Object(o.createElement)("amp-brid-player",m)},m="amp/amp-brid-player",b={title:Object(r.__)("AMP Brid Player","amp"),description:Object(r.__)("Displays the Brid Player used in Brid.tv Video Platform.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{autoPlay:{type:"boolean"},dataPartner:{source:"attribute",selector:"amp-brid-player",attribute:"data-partner"},dataPlayer:{source:"attribute",selector:"amp-brid-player",attribute:"data-player"},dataVideo:{source:"attribute",selector:"amp-brid-player",attribute:"data-video"},dataPlaylist:{source:"attribute",selector:"amp-brid-player",attribute:"data-playlist"},dataOutstream:{source:"attribute",selector:"amp-brid-player",attribute:"data-outstream"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-brid-player",attribute:"layout"},width:{type:"number",default:600},height:{default:400,source:"attribute",selector:"amp-brid-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataDelayAdRequest,s=t.dataTag,d=t.dataSrc,m=t.dataPoster,b=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")}],p=!1;return s&&d&&(p=!0),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("IMA Video Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL for your VAST ad document (required)","amp"),value:s,onChange:function(e){return a({dataTag:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL of your video content (required)","amp"),value:d,onChange:function(e){return a({dataSrc:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL to preview image","amp"),value:m,onChange:function(e){return a({dataPoster:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Delay Ad Request","amp"),checked:n,onChange:function(){return a({dataDelayAdRequest:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:b})))),p&&Object(o.createElement)(u.c,{name:Object(r.__)("IMA Video","amp"),url:d}),!p&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("IMA Video","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.width,r=t.dataSrc,n=t.ampLayout,i=t.dataTag,c=t.dataDelayAdRequest,l=t.height,u=t.dataPoster,s={layout:n,height:l,width:a,"data-tag":i,"data-src":r};return u&&(s["data-poster"]=u),c&&(s["data-delay-ad-request"]=c),Object(o.createElement)("amp-ima-video",s)},m="amp/amp-ima-video",b={title:Object(r.__)("AMP IMA Video","amp"),description:Object(r.__)("Embeds a video player for instream video ads that are integrated with the IMA SDK","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataDelayAdRequest:{default:!1,source:"attribute",selector:"amp-ima-video",attribute:"data-delay-ad-request"},dataTag:{source:"attribute",selector:"amp-ima-video",attribute:"data-tag"},dataSrc:{source:"attribute",selector:"amp-ima-video",attribute:"data-src"},dataPoster:{source:"attribute",selector:"amp-ima-video",attribute:"data-poster"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-ima-video",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-ima-video",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-ima-video",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataPlayerId,s=t.dataMediaId,d=t.dataPlaylistId,m=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],b=!1;return n&&(s||d)&&(b=d?"https://content.jwplatform.com/players/".concat(d,"-").concat(n):"https://content.jwplatform.com/players/".concat(s,"-").concat(n)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("JW Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:n,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Media ID (required if playlist ID not set)","amp"),value:s,onChange:function(e){return a({dataMediaId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID (required if media ID not set)","amp"),value:d,onChange:function(e){return a({dataPlaylistId:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:m})))),b&&Object(o.createElement)(u.c,{name:Object(r.__)("JW Player","amp"),url:b}),!b&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("JW Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.width,r=t.height,n=t.ampLayout,i=t.dataPlaylistId,c=t.dataPlayerId,l=t.dataMediaId,u={layout:n,height:r,"data-player-id":c};return"fixed-height"!==n&&a&&(u.width=a),i&&(u["data-playlist-id"]=i),l&&(u["data-media-id"]=l),Object(o.createElement)("amp-jwplayer",u)},m="amp/amp-jwplayer",b={title:Object(r.__)("AMP JW Player","amp"),description:Object(r.__)("Displays a cloud-hosted JW Player.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataPlayerId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-player-id"},dataMediaId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-media-id"},dataPlaylistId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-playlist-id"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-jwplayer",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-jwplayer",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-jwplayer",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return l})),a.d(t,"settings",(function(){return u}));var r=a(1),n=a(0),i=(a(5),a(4)),o=function(e){var t=e.attributes,a=e.setAttributes,o=t.dataFormula;return Object(n.createElement)(i.PlainText,{value:o,placeholder:Object(r.__)("Insert formula","amp"),onChange:function(e){return a({dataFormula:e})}})},c=function(e){var t={"data-formula":e.attributes.dataFormula,layout:"container"};return Object(n.createElement)("amp-mathml",t)},l="amp/amp-mathml",u={title:Object(r.__)("AMP MathML","amp"),category:"common",icon:"welcome-learn-more",keywords:[Object(r.__)("Mathematical formula","amp"),Object(r.__)("Scientific content ","amp")],attributes:{dataFormula:{source:"attribute",selector:"amp-mathml",attribute:"data-formula"}},edit:o,save:c}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.autoPlay,s=t.dataPid,d=t.dataVid,m=t.dataBcid,b=t.dataBid,p=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],f=!1;return s&&(m||d)&&(f="https://delivery.vidible.tv/htmlembed/pid=".concat(s,"/")),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("O2 Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:s,onChange:function(e){return a({dataPid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Buyer Company ID (either buyer or video ID is required)","amp"),value:m,onChange:function(e){return a({dataBcid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video ID (either buyer or video ID is required)","amp"),value:d,onChange:function(e){return a({dataVid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID","amp"),value:b,onChange:function(e){return a({dataBid:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Autoplay","amp"),checked:n,onChange:function(){return a({autoPlay:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:p})))),f&&Object(o.createElement)(u.c,{name:Object(r.__)("O2 Player","amp"),url:f}),!f&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("O2 Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataPid,r=t.width,n=t.height,i=t.ampLayout,c=t.dataBid,l=t.autoPlay,u=t.dataBcid,s=t.dataVid,d={layout:i,height:n,"data-pid":a};return"fixed-height"!==i&&r&&(d.width=r),l||(d["data-macros"]="m.playback=click"),s?d["data-vid"]=s:u&&(d["data-bcid"]=u),c&&(d["data-bid"]=c),Object(o.createElement)("amp-o2-player",d)},m="amp/amp-o2-player",b={title:Object(r.__)("AMP O2 Player","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("AOL O2Player","amp")],attributes:{dataPid:{source:"attribute",selector:"amp-o2-player",attribute:"data-pid"},dataVid:{source:"attribute",selector:"amp-o2-player",attribute:"data-vid"},dataBcid:{source:"attribute",selector:"amp-o2-player",attribute:"data-bcid"},dataBid:{source:"attribute",selector:"amp-o2-player",attribute:"data-bid"},autoPlay:{default:!1},ampLayout:{default:"responsive",source:"attribute",selector:"amp-o2-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-o2-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-o2-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataEmbedCode,s=t.dataPlayerId,d=t.dataPcode,m=t.dataPlayerVersion,b=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],p=!1;return n&&s&&d&&(p="http://cf.c.ooyala.com/".concat(n)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Ooyala Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video embed code (required)","amp"),value:n,onChange:function(e){return a({dataEmbedCode:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:s,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Provider code for the account (required)","amp"),value:d,onChange:function(e){return a({dataPcode:e})}}),Object(o.createElement)(l.SelectControl,{label:Object(r.__)("Player version","amp"),value:m,options:[{value:"v3",label:Object(r.__)("V3","amp")},{value:"v4",label:Object(r.__)("V4","amp")}],onChange:function(e){return a({dataPlayerVersion:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:b})))),p&&Object(o.createElement)(u.c,{name:Object(r.__)("Ooyala Player","amp"),url:p}),!p&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Ooyala Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataEmbedCode,r=t.dataPlayerId,n=t.dataPcode,i=t.dataPlayerVersion,c=t.ampLayout,l=t.height,u=t.width,s={layout:c,height:l,"data-embedcode":a,"data-playerid":r,"data-pcode":n,"data-playerversion":i};return"fixed-height"!==c&&u&&(s.width=u),Object(o.createElement)("amp-ooyala-player",s)},m="amp/amp-ooyala-player",b={title:Object(r.__)("AMP Ooyala Player","amp"),description:Object(r.__)("Displays an Ooyala video.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("Ooyala video","amp")],attributes:{dataEmbedCode:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-embedcode"},dataPlayerId:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-playerid"},dataPcode:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-pcode"},dataPlayerVersion:{default:"v3",source:"attribute",selector:"amp-ooyala-player",attribute:"data-playerversion"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-ooyala-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-ooyala-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-ooyala-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataEmbedId,s=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],d=!1;return n&&(d="https://media-cdn.beachfrontreach.com/acct_1/video/"),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Reach Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Embed ID (required)","amp"),value:n,onChange:function(e){return a({dataEmbedId:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:s})))),d&&Object(o.createElement)(u.c,{name:Object(r.__)("Reach Player","amp"),url:d}),!d&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Reach Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add Reach player embed ID to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataEmbedId,r=t.ampLayout,n=t.height,i=t.width,c={layout:r,height:n,"data-embed-id":a};return"fixed-height"!==r&&i&&(c.width=i),Object(o.createElement)("amp-reach-player",c)},m="amp/amp-reach-player",b={title:Object(r.__)("AMP Reach Player","amp"),description:Object(r.__)("Displays the Reach Player configured in the Beachfront Reach platform.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("Beachfront Reach video","amp")],attributes:{dataEmbedId:{source:"attribute",selector:"amp-reach-player",attribute:"data-embed-id"},ampLayout:{default:"fixed-height",source:"attribute",selector:"amp-reach-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-reach-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-reach-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataSiteId,s=t.dataPlayerId,d=t.dataContentId,m=t.dataDomain,b=t.dataMode,p=t.dataItems,f=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],h=!1;return n&&d&&m&&b&&p&&(h="https://cms.springboardplatform.com/embed_iframe/"),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Springboard Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Site ID (required)","amp"),value:n,onChange:function(e){return a({dataSiteId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Content ID (required)","amp"),value:d,onChange:function(e){return a({dataContentId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID","amp"),value:s,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Springboard partner domain","amp"),value:m,onChange:function(e){return a({dataDomain:e})}}),Object(o.createElement)(l.SelectControl,{label:Object(r.__)("Mode (required)","amp"),value:b,options:[{value:"video",label:Object(r.__)("Video","amp")},{value:"playlist",label:Object(r.__)("Playlist","amp")}],onChange:function(e){return a({dataMode:e})}}),Object(o.createElement)(l.TextControl,{type:"number",label:Object(r.__)("Number of video is playlist (required)","amp"),value:p,onChange:function(e){return a({dataItems:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:f})))),h&&Object(o.createElement)(u.c,{name:Object(r.__)("Springboard Player","amp"),url:h}),!h&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Springboard Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataSiteId,r=t.dataPlayerId,n=t.dataContentId,i=t.dataDomain,c=t.dataMode,l=t.dataItems,u=t.ampLayout,s=t.height,d=t.width,m={layout:u,height:s,"data-site-id":a,"data-mode":c,"data-content-id":n,"data-player-id":r,"data-domain":i,"data-items":l};return"fixed-height"!==u&&d&&(m.width=t.width),Object(o.createElement)("amp-springboard-player",m)},m="amp/amp-springboard-player",b={title:Object(r.__)("AMP Springboard Player","amp"),description:Object(r.__)("Displays the Springboard Player used in the Springboard Video Platform","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataSiteId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-site-id"},dataContentId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-content-id"},dataPlayerId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-player-id"},dataDomain:{source:"attribute",selector:"amp-springboard-player",attribute:"data-domain"},dataMode:{default:"video",source:"attribute",selector:"amp-springboard-player",attribute:"data-mode"},dataItems:{default:1,source:"attribute",selector:"amp-springboard-player",attribute:"data-items"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-springboard-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-springboard-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-springboard-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return p})),a.d(t,"settings",(function(){return f}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=a(13),l=a.n(c),u=(a(5),a(4)),s=a(2),d=a(6),m=function(e){var t,a=e.attributes,n=e.setAttributes,c=a.align,m=a.cutoff,b=a.dateTime;b?t=m&&parseInt(m)<Math.abs(l()(b).diff(l()(),"seconds"))?l()(b).format("dddd D MMMM HH:mm"):l()(b).fromNow():(t=l()(Date.now()).fromNow(),n({dateTime:l()(l()(),l.a.ISO_8601,!0).format()}));var p=[{value:"",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")}];return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(u.InspectorControls,null,Object(o.createElement)(s.PanelBody,{title:Object(r.__)("AMP Timeago Settings","amp")},Object(o.createElement)(s.DateTimePicker,{locale:"en",currentDate:b||l()(),onChange:function(e){return n({dateTime:l()(e,l.a.ISO_8601,!0).format()})}}),Object(o.createElement)(d.b,i()({},e,{ampLayoutOptions:p})),Object(o.createElement)(s.TextControl,{type:"number",className:"blocks-amp-timeout__cutoff",label:Object(r.__)("Cutoff (seconds)","amp"),value:void 0!==m?m:"",onChange:function(e){return n({cutoff:e})}}))),Object(o.createElement)(u.BlockControls,null,Object(o.createElement)(u.BlockAlignmentToolbar,{value:c,onChange:function(e){n({align:e})},controls:["left","center","right"]})),Object(o.createElement)("time",{dateTime:b},t))},b=function(e){var t=e.attributes,a=t.ampLayout,r=t.width,n=t.height,i=t.align,c=t.cutoff,u={layout:"responsive",className:"align"+(i||"none"),datetime:t.dateTime,locale:"en"};if(c&&(u.cutoff=c),a)switch(a){case"fixed-height":n&&(u.height=n,u.layout=a);break;case"fixed":n&&r&&(u.height=n,u.width=r,u.layout=a)}return Object(o.createElement)("amp-timeago",u,l()(t.dateTime).format("dddd D MMMM HH:mm"))},p="amp/amp-timeago",f={title:Object(r.__)("AMP Timeago","amp"),category:"common",icon:"backup",keywords:[Object(r.__)("Time difference","amp"),Object(r.__)("Time ago","amp"),Object(r.__)("Date","amp")],attributes:{align:{type:"string"},cutoff:{source:"attribute",selector:"amp-timeago",attribute:"cutoff"},dateTime:{source:"attribute",selector:"amp-timeago",attribute:"datetime"},ampLayout:{default:"fixed-height",source:"attribute",selector:"amp-timeago",attribute:"layout"},width:{source:"attribute",selector:"amp-timeago",attribute:"width"},height:{default:20,source:"attribute",selector:"amp-timeago",attribute:"height"}},getEditWrapperProps:function(e){var t=e.align;if("left"===t||"right"===t||"center"===t)return{"data-align":t}},edit:m,save:b}}]);
1
+ !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=36)}([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(28)()},function(e,t,a){"use strict";a.d(t,"a",(function(){return S})),a.d(t,"c",(function(){return C})),a.d(t,"b",(function(){return I})),a.d(t,"d",(function(){return B}));var r=a(19),n=a.n(r),i=a(25),o=a.n(i),c=a(20),l=a.n(c),u=a(21),s=a.n(u),d=a(16),m=a.n(d),b=a(22),p=a.n(b),f=a(0),h=(a(18),a(12)),O=(a(5),a(2)),g=a(1),y=a(3),j=a(15),v=a(31),_=a(14),w=a(7),P=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),Object(f.createElement)("path",{className:"inner",d:"M48 33c8.285 0 15 6.716 15 15 0 8.284-6.715 15-15 15-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15zm-1.15 24.098l6.293-10.472a.555.555 0 0 0 .12-.335.569.569 0 0 0-.624-.568l-3.508.004 1.155-6.834-1.159-.005-6.272 10.46s-.125.228-.125.363c0 .314.255.57.569.57l.048-.001 3.49-.005-1.126 6.823h1.14z",fill:"none"}))};P.defaultProps={xmlns:"http://www.w3.org/2000/svg"};var x=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{d:"M41.629 28.161L28.624 49.804h-2.356l2.33-14.102-7.214.009-.1.002c-.65 0-1.176-.526-1.176-1.176 0-.279.259-.751.259-.751L33.329 12.17l2.395.01-2.388 14.123 7.251-.009h.115c.65 0 1.176.525 1.176 1.175 0 .264-.103.495-.25.691v.001zM31 0C13.879 0 0 13.88 0 31c0 17.121 13.879 31 31 31 17.12 0 31-13.879 31-31C62 13.88 48.12 0 31 0z",fill:"#82878c"}))};x.defaultProps={width:"62",height:"62",viewBox:"0 0 62 62",xmlns:"http://www.w3.org/2000/svg"};var E=function(e){function t(){var e,a;n()(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(a=l()(this,(e=s()(t)).call.apply(e,[this].concat(i)))).moveButton=a.moveButton.bind(m()(a)),a.openPreviewWindow=a.openPreviewWindow.bind(m()(a)),a.buttonRef=Object(f.createRef)(),a}return p()(t,e),o()(t,[{key:"componentDidUpdate",value:function(e){var t=this.props.previewLink;t&&!e.previewLink&&this.setPreviewWindowLink(t),this.moveButton()}},{key:"moveButton",value:function(){var e=Object(h.get)(this,["buttonRef","current","parentNode"],!1);if(e&&(!e.previousSibling||!e.previousSibling.classList.contains(w.d))){var t=document.querySelector(".".concat(w.d));Object(h.get)(t,"nextSibling")&&e.parentNode.insertBefore(e,t.nextSibling)}}},{key:"setPreviewWindowLink",value:function(e){var t=this.previewWindow;t&&!t.closed&&(t.location=e)}},{key:"getWindowTarget",value:function(){var e=this.props.postId;return"amp-preview-".concat(e)}},{key:"openPreviewWindow",value:function(e){var t,a;(e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable)?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),t=this.previewWindow.document,a=Object(f.renderToString)(Object(f.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},Object(f.createElement)(O.Icon,{icon:P({viewBox:"0 0 98 98"})}),Object(f.createElement)("p",null,Object(g.__)("Generating AMP preview…","amp")))),a+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 198px;\n\t\t\t\theight: 198px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',t.write(a),t.title=Object(g.__)("Generating AMP preview…","amp"),t.close()):this.setPreviewWindowLink(e.target.href)}},{key:"render",value:function(){var e=this.props,t=e.previewLink,a=e.currentPostLink,r=e.errorMessages,n=e.isEnabled,i=e.isSaveable,o=e.isStandardMode,c=t||a;return n&&!r.length&&!o&&Object(f.createElement)(O.Tooltip,{text:Object(g.__)("Preview AMP","amp")},Object(f.createElement)(O.Button,{className:"amp-editor-post-preview",href:c,label:Object(g.__)("Preview AMP","amp"),isSecondary:!0,disabled:!i,onClick:this.openPreviewWindow,ref:this.buttonRef},x({viewBox:"0 0 62 62",width:18,height:18}),Object(f.createElement)("span",{className:"screen-reader-text"},
2
  /* translators: accessibility text */
3
+ Object(g.__)("(opens in a new tab)","amp"))))}}]),t}(f.Component),S=Object(j.compose)([Object(y.withSelect)((function(e,t){var a=t.forcePreviewLink,r=t.forceIsAutosaveable,n=e("core/editor"),i=n.getCurrentPostId,o=n.getCurrentPostAttribute,c=n.getEditedPostAttribute,l=n.isEditedPostSaveable,u=n.isEditedPostAutosaveable,s=n.getEditedPostPreviewLink,d=e("amp/block-editor"),m=d.getAmpSlug,b=d.getErrorMessages,p=d.isStandardMode,f={};f[m()]=1;var h=s(),O=h?Object(v.addQueryArgs)(h,f):void 0;return{postId:i(),currentPostLink:Object(v.addQueryArgs)(o("link"),f),previewLink:void 0!==a?a:O,isSaveable:l(),isAutosaveable:r||u(),isDraft:-1!==["draft","auto-draft"].indexOf(c("status")),isEnabled:Object(_.e)(),errorMessages:b(),isStandardMode:p()}})),Object(y.withDispatch)((function(e){return{autosave:e("core/editor").autosave,savePost:e("core/editor").savePost}}))])(E),C=function(e){var t=e.name,a=e.url;return Object(f.createElement)(O.Placeholder,{label:t},Object(f.createElement)("p",{className:"components-placeholder__error"},a),Object(f.createElement)("p",{className:"components-placeholder__error"},Object(g.__)("Previews for this are unavailable in the editor, sorry!","amp")))},I=function(e){var t=e.attributes,a=e.setAttributes,r=e.ampLayoutOptions,n=t.ampLayout,i=t.height,o=t.width,c=!i&&("fixed"===n||"fixed-height"===n),l=!o&&"fixed"===n;return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(O.SelectControl,{label:Object(g.__)("Layout","amp"),value:n,options:r,onChange:function(e){return a({ampLayout:e})}}),l&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(g.sprintf)(
4
  /* translators: %s is the layout name */
5
+ Object(g.__)("Width is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(g.__)("Width (px)","amp"),value:void 0!==o?o:"",onChange:function(e){return a({width:e})}}),c&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(g.sprintf)(
6
  /* translators: %s is the layout name */
7
+ Object(g.__)("Height is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(g.__)("Height (px)","amp"),value:i,onChange:function(e){return a({height:e})}}))},k=a(8),T=a.n(k),M=a(23),A=a(9);function D(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function F(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?D(Object(a),!0).forEach((function(t){T()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):D(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var L=window.wp,B=function(e,t){var a=t.width,r=t.height;return(function(e){function t(){var e,a;n()(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return"editor-post-featured-image__media-modal"===(a=l()(this,(e=s()(t)).call.apply(e,[this].concat(i)))).props.modalClass&&(a.initFeaturedImage=a.initFeaturedImage.bind(m()(a)),a.initFeaturedImage()),a}return p()(t,e),o()(t,[{key:"initFeaturedImage",value:function(){var e=Object(M.c)(M.b),t=L.media.controller.FeaturedImage.extend({defaults:F({},L.media.controller.FeaturedImage.prototype.defaults,{date:!1,filterable:!1,suggestedWidth:a,suggestedHeight:r})});this.frame=new e({allowedTypes:this.props.allowedTypes,state:"featured-image",states:[new t,new L.media.controller.EditImage]}),this.frame.on("toolbar:create:featured-image",(function(e){this.createSelectToolbar(e,{text:L.media.view.l10n.setFeaturedImage,state:this.options.state})}),this.frame),this.frame.on("open",this.onOpen),this.frame.state("featured-image").on("select",this.onSelectImage,this),L.media.frame=this.frame}},{key:"onOpen",value:function(){var e=this.frame.content.get();if(e&&e.collection){var t=e.collection;t.toArray().forEach((function(e){return e.trigger("destroy",e)})),t.mirroring._hasMore=!0,t.more()}}},{key:"onSelectImage",value:function(){var e=this.frame.state("featured-image").get("selection").first().toJSON(),t=this.props.onSelect,a=e.url,r=e.id,n=e.width,i=e.height;Object(A.d)({url:a,id:r,width:n,height:i,onSelect:t,dispatchImage:function(e){Object(y.dispatch)("core/editor").editPost({featured_media:e})}}),L.media.view.settings.post.featuredImageId&&L.media.featuredImage.set(e?e.id:-1)}}]),t}(e))}},function(e,t,a){"use strict";a.d(t,"e",(function(){return r})),a.d(t,"c",(function(){return n})),a.d(t,"b",(function(){return i})),a.d(t,"a",(function(){return o})),a.d(t,"d",(function(){return c}));var r=["core/paragraph","core/heading","core/code","core/quote","core/subhead"],n=["core/image","core/video"],i=608,o=400,c="editor-post-preview"},function(e,t){e.exports=function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}},function(e,t,a){"use strict";a.d(t,"b",(function(){return o})),a.d(t,"e",(function(){return c})),a.d(t,"c",(function(){return l})),a.d(t,"a",(function(){return u})),a.d(t,"d",(function(){return s}));var r=a(12),n=a(1),i=a(10),o=function(){var e=i.c;return{width:e,height:e*(9/16)}},c=function(e,t,a){if(!e)return a?[Object(n.__)("Selecting a featured image is required.","amp")]:[Object(n.__)("Selecting a featured image is recommended for an optimal user experience.","amp")];var r=[];if(["image/png","image/gif","image/jpeg"].includes(e.mime_type)||r.push(
8
  /* translators: 1: .jpg, 2: .png. 3: .gif */
9
  Object(n.sprintf)(Object(n.__)("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;r.push(
10
  /* translators: 1: minimum width, 2: minimum height. */
11
+ Object(n.sprintf)(Object(n.__)("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===r.length?null:r},l=function(e){var t=Object(r.template)("<p>".concat(e,"</p>"),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});return function(e){return t(e)}},u=function(e,t){if(e){var a=Object(r.get)(this,["options","allowedTypes"],null),n=this.get("select");a&&e.get("type")&&!function(e,t){var a=e.get("type"),r=e.get("mime");return!(!t.includes(a)&&!t.includes(r))&&"video"!==a}(e,a)?(this.secondary.set(i.a,new t({mimeType:e.get("mime")})),n&&n.model&&n.model.set("disabled",!0)):(this.secondary.unset(i.a),n&&n.model&&n.model.set("disabled",!1))}},s=function(e){var t=e.url,a=e.id,n=e.width,i=e.height,o=e.onSelect,c=e.dispatchImage,l={};l.url=t,l.thumbnail_url=t,l.timestamp=Object(r.now)(),a&&(l.attachment_id=a),n&&(l.width=n),i&&(l.height=i),o(l),c(a)}},function(e,t,a){"use strict";a.d(t,"d",(function(){return r})),a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return i})),a.d(t,"a",(function(){return o}));var r=6,n=72,i=1200,o="select-file-type-error"},function(e,t){function a(){return e.exports=a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},a.apply(this,arguments)}e.exports=a},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.moment}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"d",(function(){return f})),a.d(t,"b",(function(){return g})),a.d(t,"c",(function(){return y})),a.d(t,"e",(function(){return D})),a.d(t,"f",(function(){return F}));var r=a(8),n=a.n(r),i=a(0),o=(a(5),a(18),a(1)),c=a(2),l=a(4),u=a(3),s=a(7),d=a(10);function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var b=[{value:"nodisplay",label:Object(o.__)("No Display","amp"),notAvailable:["core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]},{value:"fixed",label:Object(o.__)("Fixed","amp"),notAvailable:["core-embed/soundcloud"]},{value:"responsive",label:Object(o.__)("Responsive","amp"),notAvailable:["core-embed/soundcloud"]},{value:"fixed-height",label:Object(o.__)("Fixed Height","amp"),notAvailable:[]},{value:"fill",label:Object(o.__)("Fill","amp"),notAvailable:["core-embed/soundcloud"]},{value:"flex-item",label:Object(o.__)("Flex Item","amp"),notAvailable:["core-embed/soundcloud"]},{value:"intrinsic",label:Object(o.__)("Intrinsic","amp"),notAvailable:["core/video","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]}],p=function(e,t){return"core/shortcode"!==t&&"core/gallery"!==t||(e.attributes||(e.attributes={}),e.attributes.ampCarousel={type:"boolean"},e.attributes.ampLightbox={type:"boolean"}),"core/image"===t&&(e.attributes||(e.attributes={}),e.attributes.ampLightbox={type:"boolean"}),s.e.includes(t)&&(e.attributes||(e.attributes={}),e.attributes.ampFitText={default:!1},e.attributes.minFont={default:d.d,source:"attribute",selector:"amp-fit-text",attribute:"min-font-size"},e.attributes.maxFont={default:d.b,source:"attribute",selector:"amp-fit-text",attribute:"max-font-size"},e.attributes.height={default:"core/image"===t?200:10*Math.ceil(d.b/10),source:"attribute",selector:"amp-fit-text",attribute:"height"}),(0===t.indexOf("core-embed")||s.c.includes(t))&&(e.attributes||(e.attributes={}),e.attributes.ampLayout={type:"string"},e.attributes.ampNoLoading={type:"boolean"}),e},f=function(e,t,a){var r=a.text||"",n="",o={layout:"fixed-height"};if("core/shortcode"===t.name&&A(a)){if(a.ampLightbox||M(a.text||"")&&(r=k(a.text)),a.ampCarousel){if(T(r)&&(r=I(r)),!a.ampLightbox)return a.text!==r?Object(i.createElement)(i.RawHTML,null,r):e}else r=T(a.text||"")?a.text:a.text.replace("[gallery","[gallery amp-carousel=false");if(a.ampLightbox&&!M(r)&&(r=r.replace("[gallery","[gallery amp-lightbox=true")),a.text!==r)return Object(i.createElement)(i.RawHTML,null,r)}else if("core/paragraph"!==t.name||a.ampFitText){if(s.e.includes(t.name)&&a.ampFitText)return a.minFont&&(o["min-font-size"]=a.minFont),a.maxFont&&(o["max-font-size"]=a.maxFont),a.height&&(o.height=a.height),o.children=e,Object(i.createElement)("amp-fit-text",o)}else if((n=h(a.content))!==a.content)return Object(i.cloneElement)(e,{key:"new",value:n});return e},h=function(e){var t=/<amp-fit-text\b[^>]*>(.*?)<\/amp-fit-text>/.exec(e),a=e;return t&&t[1]&&(a=t[1]),a},O=function(e){var t=[{value:"",label:Object(o.__)("Default","amp")}],a=!0,r=!1,n=void 0;try{for(var i,c=b[Symbol.iterator]();!(a=(i=c.next()).done);a=!0){var l=i.value;!l.notAvailable.includes(e)&&t.push({value:l.value,label:l.label})}}catch(e){r=!0,n=e}finally{try{a||null==c.return||c.return()}finally{if(r)throw n}}return t},g=function(e,t,a){var r={};return"core/shortcode"===t.name?e:"amp/"===t.name.substr(0,4)?e:(a.ampLayout&&(r["data-amp-layout"]=a.ampLayout),a.ampNoLoading&&(r["data-amp-noloading"]=a.ampNoLoading),a.ampLightbox&&(r["data-amp-lightbox"]=a.ampLightbox),a.ampCarousel&&(r["data-amp-carousel"]=a.ampCarousel),function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},r,{},e))},y=function(e){return function(t){var a,r=t.attributes,n=r.text,o=r.ampLayout,c=t.setAttributes,l=t.name;if("core/shortcode"===l){if(T(n||"")&&c({text:I(n)}),M(n||"")&&c({text:k(n)}),""===(a=P(t)))return Object(i.createElement)(e,t)}else"core/gallery"===l?a=C(t):"core/image"===l?a=S(t):s.c.includes(l)||0===l.indexOf("core-embed/")?a=j(t):s.e.includes(l)&&(a=w(t));return o&&"nodisplay"===o?[a]:Object(i.createElement)(i.Fragment,null,Object(i.createElement)(e,t),a)}},j=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e))):null},v=function(e){var t=e.name,a=e.attributes.ampLayout,r=e.setAttributes,n=Object(o.__)("AMP Layout","amp");return"core/image"===t&&(n=Object(o.__)("AMP Layout (modifies width/height)","amp")),Object(i.createElement)(c.SelectControl,{label:n,value:a,options:O(t),onChange:function(t){r({ampLayout:t}),"core/image"===e.name&&function(e,t){var a=e.attributes,r=e.setAttributes;switch(t){case"fixed-height":a.height||r({height:s.a}),a.ampLightbox&&r({ampLightbox:!1});break;case"fixed":a.height||r({height:s.a}),a.width||r({width:s.b})}}(e,t)}})},_=function(e){var t=e.attributes.ampNoLoading,a=e.setAttributes,r=Object(o.__)("AMP Noloading","amp");return Object(i.createElement)(c.ToggleControl,{label:r,checked:t,onChange:function(){return a({ampNoLoading:!t})}})},w=function(e){var t=e.isSelected,a=e.attributes,r=e.setAttributes,n=a.ampFitText,u=a.minFont,s=a.maxFont,m=a.height,b=[{name:"small",shortName:Object(o._x)("S","font size","amp"),size:14},{name:"regular",shortName:Object(o._x)("M","font size","amp"),size:16},{name:"large",shortName:Object(o._x)("L","font size","amp"),size:36},{name:"larger",shortName:Object(o._x)("XL","font size","amp"),size:48}];if(!t)return null;var p=Object(o.__)("Automatically fit text to container","amp");return n&&(s=parseInt(s),m=parseInt(m),u=parseInt(u)),Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp"),className:n?"is-amp-fit-text":""},Object(i.createElement)(c.ToggleControl,{label:p,checked:n,onChange:function(){return r({ampFitText:!n})}})),n&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(c.TextControl,{label:Object(o.__)("Height","amp"),value:m,min:1,onChange:function(e){r({height:e})}}),s>m&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The height must be greater than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Minimum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:14,value:u,fontSizes:b,onChange:function(e){e||(e=d.d),parseInt(e)<=s&&r({minFont:e})}})),u>s&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The min font size must less than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Maximum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:48,value:s,fontSizes:b,onChange:function(e){e||(e=d.b),r({maxFont:e,height:Math.max(e,m)})}}))))},P=function(e){var t=e.isSelected;if(!A(e.attributes)||!t)return null;var a=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},a&&Object(i.createElement)(E,e),Object(i.createElement)(x,e)))},x=function(e){var t=e.attributes,a=t.ampLightbox,r=t.linkTo,n=t.ampLayout,l=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Add lightbox effect","amp"),checked:a,onChange:function(e){l({ampLightbox:!a}),e&&("fixed-height"===n&&l({ampLayout:"fixed"}),r&&"none"!==r&&l({linkTo:"none"}))}})},E=function(e){var t=e.attributes.ampCarousel,a=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Display as carousel","amp"),checked:t,onChange:function(){return a({ampCarousel:!t})}})},S=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e),Object(i.createElement)(x,e))):null},C=function(e){if(!e.isSelected)return null;var t=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},t&&Object(i.createElement)(E,e),Object(i.createElement)(x,e)))},I=function(e){return e.replace(" amp-carousel=false","")},k=function(e){return e.replace(" amp-lightbox=true","")},T=function(e){return-1!==e.indexOf("amp-carousel=false")},M=function(e){return-1!==e.indexOf("amp-lightbox=true")},A=function(e){return e.text&&-1!==e.text.indexOf("gallery")},D=function(){var e=Object(u.select)("amp/block-editor"),t=e.getDefaultStatus,a=e.getPossibleStatuses,r=(0,Object(u.select)("core/editor").getEditedPostAttribute)("meta");return r&&r.amp_status&&a().includes(r.amp_status)?"enabled"===r.amp_status:"enabled"===t()},F=function(e){var t=document.querySelector(".".concat(s.d));if(t&&t.nextSibling){var a=document.createElement("div");a.id="amp-wrapper-post-preview",Object(i.render)(Object(i.createElement)(e,null),a),t.parentNode.insertBefore(a,t.nextSibling)}}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){!function(){e.exports=this.React}()},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,a){var r=a(37),n=a(16);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?n(e):t}},function(e,t){function a(t){return e.exports=a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(t)}e.exports=a},function(e,t,a){var r=a(38);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"a",(function(){return p})),a.d(t,"c",(function(){return f}));var r=a(8),n=a.n(r),i=a(12),o=a(1),c=a(9);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var u,s=window.wp,d=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:(u=Object(o.sprintf)(
12
  /* translators: 1: image width in pixels. 2: image height in pixels. 3: required minimum width in pixels. 4: required minimum height in pixels. */
13
  Object(o.__)("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}}"),Object(c.c)(u))}),m=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
14
  /* translators: 1: the selected file type. */
15
  Object(o.__)("The selected file mime type, %1$s, is not allowed.","amp"),"{{mimeType}}");return Object(c.c)(e)}()}),b=(s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
16
  /* translators: 1: the recommended max MB per second for videos. 2: the actual MB per second of the video. */
17
+ Object(o.__)("A video size of less than %1$s MB per second is recommended. The selected video is %2$s MB per second.","amp"),"{{maxVideoMegabytesPerSecond}}","{{actualVideoMegabytesPerSecond}}");return Object(c.c)(e)}()}),s.media.view.Toolbar.Select.extend({refresh:function(){s.media.view.Toolbar.Select.prototype.refresh.call(this);var e=this.controller.state(),t=e.get("selection").models[0],a=e.collection.get("featured-image").get("suggestedWidth"),r=e.collection.get("featured-image").get("suggestedHeight");!t||"image"!==t.get("type")||!t.get("width")||t.get("width")>=a&&t.get("height")>=r?this.secondary.unset("select-error"):this.secondary.set("select-error",new d({minWidth:a,minHeight:r,width:t.get("width"),height:t.get("height")})),c.a.call(this,t,m)}})),p=s.media.view.Toolbar.Select.extend({refresh:function(){s.media.view.Toolbar.Select.prototype.refresh.call(this);var e=this.controller.state().get("selection").models[0];c.a.call(this,e,m)}}),f=function(e){return s.media.view.MediaFrame.Select.extend({createSelectToolbar:function(t,a){(a=a||this.options.button||{}).controller=this,a=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},a,{allowedTypes:Object(i.get)(this,["options","allowedTypes"],null)}),t.view=new e(a)}})}},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){function a(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"b",(function(){return d}));var r=a(0),n=(a(5),a(2)),i=a(24),o=a(3),c=a(1),l=a(9),u=Object(o.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,o=e.required,u=Object(l.e)(t,a,o);return u?Object(r.createElement)(i.PluginPrePublishPanel,{title:Object(c.__)("Featured Image","amp"),initialOpen:"true"},Object(r.createElement)(n.Notice,{status:o?"warning":"notice",isDismissible:!1},u.map((function(e,t){return Object(r.createElement)("p",{key:"error-".concat(t)},e)})))):null})),s=a(15),d=Object(s.createHigherOrderComponent)((function(e){return function(t){var a=t.media,i=Object(l.e)(a,Object(l.b)(),!1);return i?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(n.Notice,{status:"notice",isDismissible:!1},i.map((function(e,t){return Object(r.createElement)("p",{key:"error-".concat(t)},e)}))),Object(r.createElement)(e,t)):Object(r.createElement)(e,t)}}),"withFeaturedImageNotice");a(19),a(20),a(21),a(16),a(22),a(8),a(12),a(23),window.wp},function(e,t){e.exports=ampBlockEditor},function(e,t,a){"use strict";var r=a(29);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,a,n,i,o){if(o!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var a={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return a.PropTypes=a,a}},function(e,t,a){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,a){"use strict";var r={};a.r(r),a.d(r,"hasThemeSupport",(function(){return c})),a.d(r,"isStandardMode",(function(){return l})),a.d(r,"getDefaultStatus",(function(){return u})),a.d(r,"getPossibleStatuses",(function(){return s})),a.d(r,"getErrorMessages",(function(){return d})),a.d(r,"getAmpSlug",(function(){return m}));var n=a(8),i=a.n(n),o=a(3);function c(e){return Boolean(e.hasThemeSupport)}function l(e){return Boolean(e.isStandardMode)}function u(e){return e.defaultStatus}function s(e){return e.possibleStatuses}function d(e){return e.errorMessages}function m(e){return e.ampSlug}function b(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}Object(o.registerStore)("amp/block-editor",{reducer:function(e){return e},selectors:r,initialState:function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?b(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):b(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},window.ampBlockEditor)})},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.domReady}()},,function(e,t,a){"use strict";a.r(t);var r=a(17),n=a(32),i=a(33),o=a(3),c=a(34),l=a.n(c),u=a(26),s=a(9),d=a(6),m=a(14),b=(a(30),Object(o.select)("amp/block-editor").isStandardMode),p=a(39);p.keys().forEach((function(e){var t=p(e),a=t.name,r=t.render,i=t.icon;Object(n.registerPlugin)(a,{icon:i,render:r})})),Object(r.addFilter)("blocks.registerBlockType","ampEditorBlocks/addAttributes",m.a),Object(r.addFilter)("blocks.getSaveElement","ampEditorBlocks/filterSave",m.d),Object(r.addFilter)("editor.BlockEdit","ampEditorBlocks/filterEdit",m.c,20),Object(r.addFilter)("blocks.getSaveContent.extraProps","ampEditorBlocks/addExtraAttributes",m.b),Object(r.addFilter)("editor.PostFeaturedImage","ampEditorBlocks/withFeaturedImageNotice",u.b),Object(r.addFilter)("editor.MediaUpload","ampEditorBlocks/withMediaLibraryNotice",(function(e){return Object(d.d)(e,Object(s.b)())}));var f=["amp/amp-brid-player","amp/amp-ima-video","amp/amp-jwplayer","amp/amp-mathml","amp/amp-o2-player","amp/amp-ooyala-player","amp/amp-reach-player","amp/amp-springboard-player","amp/amp-timeago"],h=a(42);h.keys().forEach((function(e){var t=h(e),a=t.name,r=t.settings;b()&&f.includes(a)&&Object(i.registerBlockType)(a,r)})),l()((function(){Object(m.f)(d.a)}))},function(e,t){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?e.exports=r=function(e){return a(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)},r(t)}e.exports=r},function(e,t){function a(t,r){return e.exports=a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(t,r)}e.exports=a},function(e,t,a){var r={"./amp-toggle.js":40,"./pre-publish-panel.js":41};function n(e){var t=i(e);return a(t)}function i(e){if(!a.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}n.keys=function(){return Object.keys(r)},n.resolve=i,e.exports=n,n.id=39},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return d})),a.d(t,"icon",(function(){return m})),a.d(t,"render",(function(){return b}));var r=a(0),n=a(27),i=(a(5),a(1)),o=a(2),c=a(3),l=a(24),u=a(15),s=a(14);var d="amp",m="hidden",b=Object(u.compose)(Object(c.withSelect)((function(){return{isEnabled:Object(s.e)()}})),Object(c.withDispatch)((function(e){return{onChange:function(t){var a=t?"enabled":"disabled";e("core/editor").editPost({meta:{amp_status:a}})}}})),u.withInstanceId)((function(e){var t=e.isEnabled,a=e.onChange;return Object(r.createElement)(l.PluginPostStatusInfo,null,!n.errorMessages.length&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("label",{htmlFor:"amp-enabled"},Object(i.__)("Enable AMP","amp")),Object(r.createElement)(o.FormToggle,{checked:t,onChange:function(){return a(!t)},id:"amp-enabled"})),Boolean(n.errorMessages.length)&&Object(r.createElement)(o.Notice,{status:"warning",isDismissible:!1},n.errorMessages.map((function(e,t){return Object(r.createElement)(r.RawHTML,{key:t},e)}))))}))},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return o})),a.d(t,"render",(function(){return c}));var r=a(0),n=a(26),i=a(9),o="amp-post-featured-image-pre-publish-panel",c=function(){return Object(r.createElement)(n.a,{dimensions:Object(i.b)(),required:!1})}},function(e,t,a){var r={"./amp-brid-player/index.js":48,"./amp-ima-video/index.js":49,"./amp-jwplayer/index.js":50,"./amp-mathml/index.js":51,"./amp-o2-player/index.js":52,"./amp-ooyala-player/index.js":53,"./amp-reach-player/index.js":54,"./amp-springboard-player/index.js":55,"./amp-timeago/index.js":56};function n(e){var t=i(e);return a(t)}function i(e){if(!a.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}n.keys=function(){return Object.keys(r)},n.resolve=i,e.exports=n,n.id=42},,,,,,function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.autoPlay,s=t.dataPartner,d=t.dataPlayer,m=t.dataVideo,b=t.dataPlaylist,p=t.dataOutstream,f=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],h=!1;return s&&d&&(m||b||p)&&(h="http://cdn.brid.tv/live/partners/".concat(s)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Brid Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Partner ID (required)","amp"),value:s,onChange:function(e){return a({dataPartner:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:d,onChange:function(e){return a({dataPlayer:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video ID (one of video / playlist / outstream ID is required)","amp"),value:m,onChange:function(e){return a({dataVideo:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Outstream unit ID (one of video / playlist / outstream ID is required)","amp"),value:p,onChange:function(e){return a({dataOutstream:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID (one of video / playlist / outstream ID is required)","amp"),value:b,onChange:function(e){return a({dataPlaylist:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Autoplay","amp"),checked:n,onChange:function(){return a({autoPlay:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:f})))),h&&Object(o.createElement)(u.c,{name:Object(r.__)("Brid Player","amp"),url:h}),!h&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Brid Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataPlayer,r=t.dataOutstream,n=t.dataPartner,i=t.ampLayout,c=t.width,l=t.height,u=t.dataVideo,s=t.autoPlay,d=t.dataPlaylist,m={layout:i,height:l,"data-player":a,"data-partner":n};return"fixed-height"!==i&&c&&(m.width=c),d&&(m["data-playlist"]=d),u&&(m["data-video"]=u),r&&(m["data-outstream"]=r),s&&(m.autoplay=s),Object(o.createElement)("amp-brid-player",m)},m="amp/amp-brid-player",b={title:Object(r.__)("AMP Brid Player","amp"),description:Object(r.__)("Displays the Brid Player used in Brid.tv Video Platform.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{autoPlay:{type:"boolean"},dataPartner:{source:"attribute",selector:"amp-brid-player",attribute:"data-partner"},dataPlayer:{source:"attribute",selector:"amp-brid-player",attribute:"data-player"},dataVideo:{source:"attribute",selector:"amp-brid-player",attribute:"data-video"},dataPlaylist:{source:"attribute",selector:"amp-brid-player",attribute:"data-playlist"},dataOutstream:{source:"attribute",selector:"amp-brid-player",attribute:"data-outstream"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-brid-player",attribute:"layout"},width:{type:"number",default:600},height:{default:400,source:"attribute",selector:"amp-brid-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataDelayAdRequest,s=t.dataTag,d=t.dataSrc,m=t.dataPoster,b=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")}],p=!1;return s&&d&&(p=!0),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("IMA Video Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL for your VAST ad document (required)","amp"),value:s,onChange:function(e){return a({dataTag:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL of your video content (required)","amp"),value:d,onChange:function(e){return a({dataSrc:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("HTTPS URL to preview image","amp"),value:m,onChange:function(e){return a({dataPoster:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Delay Ad Request","amp"),checked:n,onChange:function(){return a({dataDelayAdRequest:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:b})))),p&&Object(o.createElement)(u.c,{name:Object(r.__)("IMA Video","amp"),url:d}),!p&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("IMA Video","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.width,r=t.dataSrc,n=t.ampLayout,i=t.dataTag,c=t.dataDelayAdRequest,l=t.height,u=t.dataPoster,s={layout:n,height:l,width:a,"data-tag":i,"data-src":r};return u&&(s["data-poster"]=u),c&&(s["data-delay-ad-request"]=c),Object(o.createElement)("amp-ima-video",s)},m="amp/amp-ima-video",b={title:Object(r.__)("AMP IMA Video","amp"),description:Object(r.__)("Embeds a video player for instream video ads that are integrated with the IMA SDK","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataDelayAdRequest:{default:!1,source:"attribute",selector:"amp-ima-video",attribute:"data-delay-ad-request"},dataTag:{source:"attribute",selector:"amp-ima-video",attribute:"data-tag"},dataSrc:{source:"attribute",selector:"amp-ima-video",attribute:"data-src"},dataPoster:{source:"attribute",selector:"amp-ima-video",attribute:"data-poster"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-ima-video",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-ima-video",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-ima-video",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataPlayerId,s=t.dataMediaId,d=t.dataPlaylistId,m=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],b=!1;return n&&(s||d)&&(b=d?"https://content.jwplatform.com/players/".concat(d,"-").concat(n):"https://content.jwplatform.com/players/".concat(s,"-").concat(n)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("JW Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:n,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Media ID (required if playlist ID not set)","amp"),value:s,onChange:function(e){return a({dataMediaId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID (required if media ID not set)","amp"),value:d,onChange:function(e){return a({dataPlaylistId:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:m})))),b&&Object(o.createElement)(u.c,{name:Object(r.__)("JW Player","amp"),url:b}),!b&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("JW Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.width,r=t.height,n=t.ampLayout,i=t.dataPlaylistId,c=t.dataPlayerId,l=t.dataMediaId,u={layout:n,height:r,"data-player-id":c};return"fixed-height"!==n&&a&&(u.width=a),i&&(u["data-playlist-id"]=i),l&&(u["data-media-id"]=l),Object(o.createElement)("amp-jwplayer",u)},m="amp/amp-jwplayer",b={title:Object(r.__)("AMP JW Player","amp"),description:Object(r.__)("Displays a cloud-hosted JW Player.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataPlayerId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-player-id"},dataMediaId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-media-id"},dataPlaylistId:{source:"attribute",selector:"amp-jwplayer",attribute:"data-playlist-id"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-jwplayer",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-jwplayer",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-jwplayer",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return l})),a.d(t,"settings",(function(){return u}));var r=a(1),n=a(0),i=(a(5),a(4)),o=function(e){var t=e.attributes,a=e.setAttributes,o=t.dataFormula;return Object(n.createElement)(i.PlainText,{value:o,placeholder:Object(r.__)("Insert formula","amp"),onChange:function(e){return a({dataFormula:e})}})},c=function(e){var t={"data-formula":e.attributes.dataFormula,layout:"container"};return Object(n.createElement)("amp-mathml",t)},l="amp/amp-mathml",u={title:Object(r.__)("AMP MathML","amp"),category:"common",icon:"welcome-learn-more",keywords:[Object(r.__)("Mathematical formula","amp"),Object(r.__)("Scientific content ","amp")],attributes:{dataFormula:{source:"attribute",selector:"amp-mathml",attribute:"data-formula"}},edit:o,save:c}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.autoPlay,s=t.dataPid,d=t.dataVid,m=t.dataBcid,b=t.dataBid,p=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")},{value:"nodisplay",label:Object(r.__)("No Display","amp")}],f=!1;return s&&(m||d)&&(f="https://delivery.vidible.tv/htmlembed/pid=".concat(s,"/")),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("O2 Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:s,onChange:function(e){return a({dataPid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Buyer Company ID (either buyer or video ID is required)","amp"),value:m,onChange:function(e){return a({dataBcid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video ID (either buyer or video ID is required)","amp"),value:d,onChange:function(e){return a({dataVid:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Playlist ID","amp"),value:b,onChange:function(e){return a({dataBid:e})}}),Object(o.createElement)(l.ToggleControl,{label:Object(r.__)("Autoplay","amp"),checked:n,onChange:function(){return a({autoPlay:!n})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:p})))),f&&Object(o.createElement)(u.c,{name:Object(r.__)("O2 Player","amp"),url:f}),!f&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("O2 Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataPid,r=t.width,n=t.height,i=t.ampLayout,c=t.dataBid,l=t.autoPlay,u=t.dataBcid,s=t.dataVid,d={layout:i,height:n,"data-pid":a};return"fixed-height"!==i&&r&&(d.width=r),l||(d["data-macros"]="m.playback=click"),s?d["data-vid"]=s:u&&(d["data-bcid"]=u),c&&(d["data-bid"]=c),Object(o.createElement)("amp-o2-player",d)},m="amp/amp-o2-player",b={title:Object(r.__)("AMP O2 Player","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("AOL O2Player","amp")],attributes:{dataPid:{source:"attribute",selector:"amp-o2-player",attribute:"data-pid"},dataVid:{source:"attribute",selector:"amp-o2-player",attribute:"data-vid"},dataBcid:{source:"attribute",selector:"amp-o2-player",attribute:"data-bcid"},dataBid:{source:"attribute",selector:"amp-o2-player",attribute:"data-bid"},autoPlay:{default:!1},ampLayout:{default:"responsive",source:"attribute",selector:"amp-o2-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-o2-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-o2-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataEmbedCode,s=t.dataPlayerId,d=t.dataPcode,m=t.dataPlayerVersion,b=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],p=!1;return n&&s&&d&&(p="http://cf.c.ooyala.com/".concat(n)),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Ooyala Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Video embed code (required)","amp"),value:n,onChange:function(e){return a({dataEmbedCode:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID (required)","amp"),value:s,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Provider code for the account (required)","amp"),value:d,onChange:function(e){return a({dataPcode:e})}}),Object(o.createElement)(l.SelectControl,{label:Object(r.__)("Player version","amp"),value:m,options:[{value:"v3",label:Object(r.__)("V3","amp")},{value:"v4",label:Object(r.__)("V4","amp")}],onChange:function(e){return a({dataPlayerVersion:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:b})))),p&&Object(o.createElement)(u.c,{name:Object(r.__)("Ooyala Player","amp"),url:p}),!p&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Ooyala Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataEmbedCode,r=t.dataPlayerId,n=t.dataPcode,i=t.dataPlayerVersion,c=t.ampLayout,l=t.height,u=t.width,s={layout:c,height:l,"data-embedcode":a,"data-playerid":r,"data-pcode":n,"data-playerversion":i};return"fixed-height"!==c&&u&&(s.width=u),Object(o.createElement)("amp-ooyala-player",s)},m="amp/amp-ooyala-player",b={title:Object(r.__)("AMP Ooyala Player","amp"),description:Object(r.__)("Displays an Ooyala video.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("Ooyala video","amp")],attributes:{dataEmbedCode:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-embedcode"},dataPlayerId:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-playerid"},dataPcode:{source:"attribute",selector:"amp-ooyala-player",attribute:"data-pcode"},dataPlayerVersion:{default:"v3",source:"attribute",selector:"amp-ooyala-player",attribute:"data-playerversion"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-ooyala-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-ooyala-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-ooyala-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataEmbedId,s=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],d=!1;return n&&(d="https://media-cdn.beachfrontreach.com/acct_1/video/"),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Reach Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Embed ID (required)","amp"),value:n,onChange:function(e){return a({dataEmbedId:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:s})))),d&&Object(o.createElement)(u.c,{name:Object(r.__)("Reach Player","amp"),url:d}),!d&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Reach Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add Reach player embed ID to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataEmbedId,r=t.ampLayout,n=t.height,i=t.width,c={layout:r,height:n,"data-embed-id":a};return"fixed-height"!==r&&i&&(c.width=i),Object(o.createElement)("amp-reach-player",c)},m="amp/amp-reach-player",b={title:Object(r.__)("AMP Reach Player","amp"),description:Object(r.__)("Displays the Reach Player configured in the Beachfront Reach platform.","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp"),Object(r.__)("Beachfront Reach video","amp")],attributes:{dataEmbedId:{source:"attribute",selector:"amp-reach-player",attribute:"data-embed-id"},ampLayout:{default:"fixed-height",source:"attribute",selector:"amp-reach-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-reach-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-reach-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return m})),a.d(t,"settings",(function(){return b}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=(a(5),a(4)),l=a(2),u=a(6),s=function(e){var t=e.attributes,a=e.setAttributes,n=t.dataSiteId,s=t.dataPlayerId,d=t.dataContentId,m=t.dataDomain,b=t.dataMode,p=t.dataItems,f=[{value:"responsive",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fill",label:Object(r.__)("Fill","amp")},{value:"flex-item",label:Object(r.__)("Flex-item","amp")}],h=!1;return n&&d&&m&&b&&p&&(h="https://cms.springboardplatform.com/embed_iframe/"),Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.InspectorControls,null,Object(o.createElement)(l.PanelBody,{title:Object(r.__)("Springboard Player Settings","amp")},Object(o.createElement)(l.TextControl,{label:Object(r.__)("Site ID (required)","amp"),value:n,onChange:function(e){return a({dataSiteId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Content ID (required)","amp"),value:d,onChange:function(e){return a({dataContentId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Player ID","amp"),value:s,onChange:function(e){return a({dataPlayerId:e})}}),Object(o.createElement)(l.TextControl,{label:Object(r.__)("Springboard partner domain","amp"),value:m,onChange:function(e){return a({dataDomain:e})}}),Object(o.createElement)(l.SelectControl,{label:Object(r.__)("Mode (required)","amp"),value:b,options:[{value:"video",label:Object(r.__)("Video","amp")},{value:"playlist",label:Object(r.__)("Playlist","amp")}],onChange:function(e){return a({dataMode:e})}}),Object(o.createElement)(l.TextControl,{type:"number",label:Object(r.__)("Number of video is playlist (required)","amp"),value:p,onChange:function(e){return a({dataItems:e})}}),Object(o.createElement)(u.b,i()({},e,{ampLayoutOptions:f})))),h&&Object(o.createElement)(u.c,{name:Object(r.__)("Springboard Player","amp"),url:h}),!h&&Object(o.createElement)(l.Placeholder,{label:Object(r.__)("Springboard Player","amp")},Object(o.createElement)("p",null,Object(r.__)("Add required data to use the block.","amp"))))},d=function(e){var t=e.attributes,a=t.dataSiteId,r=t.dataPlayerId,n=t.dataContentId,i=t.dataDomain,c=t.dataMode,l=t.dataItems,u=t.ampLayout,s=t.height,d=t.width,m={layout:u,height:s,"data-site-id":a,"data-mode":c,"data-content-id":n,"data-player-id":r,"data-domain":i,"data-items":l};return"fixed-height"!==u&&d&&(m.width=t.width),Object(o.createElement)("amp-springboard-player",m)},m="amp/amp-springboard-player",b={title:Object(r.__)("AMP Springboard Player","amp"),description:Object(r.__)("Displays the Springboard Player used in the Springboard Video Platform","amp"),category:"embed",icon:"embed-generic",keywords:[Object(r.__)("Embed","amp")],attributes:{dataSiteId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-site-id"},dataContentId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-content-id"},dataPlayerId:{source:"attribute",selector:"amp-springboard-player",attribute:"data-player-id"},dataDomain:{source:"attribute",selector:"amp-springboard-player",attribute:"data-domain"},dataMode:{default:"video",source:"attribute",selector:"amp-springboard-player",attribute:"data-mode"},dataItems:{default:1,source:"attribute",selector:"amp-springboard-player",attribute:"data-items"},ampLayout:{default:"responsive",source:"attribute",selector:"amp-springboard-player",attribute:"layout"},width:{default:600,source:"attribute",selector:"amp-springboard-player",attribute:"width"},height:{default:400,source:"attribute",selector:"amp-springboard-player",attribute:"height"}},edit:s,save:d}},function(e,t,a){"use strict";a.r(t),a.d(t,"name",(function(){return p})),a.d(t,"settings",(function(){return f}));var r=a(1),n=a(11),i=a.n(n),o=a(0),c=a(13),l=a.n(c),u=(a(5),a(4)),s=a(2),d=a(6),m=function(e){var t,a=e.attributes,n=e.setAttributes,c=a.align,m=a.cutoff,b=a.dateTime;b?t=m&&parseInt(m)<Math.abs(l()(b).diff(l()(),"seconds"))?l()(b).format("dddd D MMMM HH:mm"):l()(b).fromNow():(t=l()(Date.now()).fromNow(),n({dateTime:l()(l()(),l.a.ISO_8601,!0).format()}));var p=[{value:"",label:Object(r.__)("Responsive","amp")},{value:"fixed",label:Object(r.__)("Fixed","amp")},{value:"fixed-height",label:Object(r.__)("Fixed Height","amp")}];return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(u.InspectorControls,null,Object(o.createElement)(s.PanelBody,{title:Object(r.__)("AMP Timeago Settings","amp")},Object(o.createElement)(s.DateTimePicker,{locale:"en",currentDate:b||l()(),onChange:function(e){return n({dateTime:l()(e,l.a.ISO_8601,!0).format()})}}),Object(o.createElement)(d.b,i()({},e,{ampLayoutOptions:p})),Object(o.createElement)(s.TextControl,{type:"number",className:"blocks-amp-timeout__cutoff",label:Object(r.__)("Cutoff (seconds)","amp"),value:void 0!==m?m:"",onChange:function(e){return n({cutoff:e})}}))),Object(o.createElement)(u.BlockControls,null,Object(o.createElement)(u.BlockAlignmentToolbar,{value:c,onChange:function(e){n({align:e})},controls:["left","center","right"]})),Object(o.createElement)("time",{dateTime:b},t))},b=function(e){var t=e.attributes,a=t.ampLayout,r=t.width,n=t.height,i=t.align,c=t.cutoff,u={layout:"responsive",className:"align"+(i||"none"),datetime:t.dateTime,locale:"en"};if(c&&(u.cutoff=c),a)switch(a){case"fixed-height":n&&(u.height=n,u.layout=a);break;case"fixed":n&&r&&(u.height=n,u.width=r,u.layout=a)}return Object(o.createElement)("amp-timeago",u,l()(t.dateTime).format("dddd D MMMM HH:mm"))},p="amp/amp-timeago",f={title:Object(r.__)("AMP Timeago","amp"),category:"common",icon:"backup",keywords:[Object(r.__)("Time difference","amp"),Object(r.__)("Time ago","amp"),Object(r.__)("Date","amp")],attributes:{align:{type:"string"},cutoff:{source:"attribute",selector:"amp-timeago",attribute:"cutoff"},dateTime:{source:"attribute",selector:"amp-timeago",attribute:"datetime"},ampLayout:{default:"fixed-height",source:"attribute",selector:"amp-timeago",attribute:"layout"},width:{source:"attribute",selector:"amp-timeago",attribute:"width"},height:{default:20,source:"attribute",selector:"amp-timeago",attribute:"height"}},getEditWrapperProps:function(e){var t=e.align;if("left"===t||"right"===t||"center"===t)return{"data-align":t}},edit:m,save:b}}]);
includes/embeds/class-amp-youtube-embed-handler.php CHANGED
@@ -12,9 +12,22 @@
12
  */
13
  class AMP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
14
 
15
- // Only handling single videos. Playlists are handled elsewhere.
 
 
 
 
 
 
 
16
  const URL_PATTERN = '#https?://(?:www\.)?(?:youtube.com/(?:v/|e/|embed/|watch[/\#?])|youtu\.be/).*#i';
17
- const RATIO = 0.5625;
 
 
 
 
 
 
18
 
19
  /**
20
  * Default width.
@@ -69,11 +82,6 @@ class AMP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
69
  * @return string Embed.
70
  */
71
  public function filter_embed_oembed_html( $cache, $url ) {
72
- $host = wp_parse_url( $url, PHP_URL_HOST );
73
- if ( ! in_array( $host, [ 'youtu.be', 'youtube.com', 'www.youtube.com' ], true ) ) {
74
- return $cache;
75
- }
76
-
77
  $id = $this->get_video_id_from_url( $url );
78
  if ( ! $id ) {
79
  return $cache;
@@ -171,11 +179,55 @@ class AMP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
171
  * Determine the video ID from the URL.
172
  *
173
  * @param string $url URL.
174
- * @return integer|false Video ID, or false if none could be retrieved.
175
  */
176
  private function get_video_id_from_url( $url ) {
177
- if ( preg_match( '/(?:watch\?v=|embed\/|youtu.be\/)(?P<id>\w*)/', $url, $match ) ) {
178
- return $match['id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
 
181
  return false;
@@ -195,15 +247,11 @@ class AMP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
195
  if ( ! isset( $attr['src'] ) ) {
196
  return $html;
197
  }
198
- $src = $attr['src'];
199
- $youtube_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
200
- if ( 1 !== preg_match( $youtube_pattern, $src ) ) {
201
  return $html;
202
  }
203
 
204
- $url = ltrim( $src, '=' );
205
- $video_id = $this->get_video_id_from_url( $url );
206
-
207
- return $this->render( compact( 'video_id' ), $url );
208
  }
209
  }
12
  */
13
  class AMP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
14
 
15
+ /**
16
+ * URL pattern to match YouTube videos.
17
+ *
18
+ * Only handling single videos. Playlists are handled elsewhere.
19
+ *
20
+ * @deprecated No longer used.
21
+ * @var string
22
+ */
23
  const URL_PATTERN = '#https?://(?:www\.)?(?:youtube.com/(?:v/|e/|embed/|watch[/\#?])|youtu\.be/).*#i';
24
+
25
+ /**
26
+ * Ratio for calculating the default height from the content width.
27
+ *
28
+ * @param float
29
+ */
30
+ const RATIO = 0.5625;
31
 
32
  /**
33
  * Default width.
82
  * @return string Embed.
83
  */
84
  public function filter_embed_oembed_html( $cache, $url ) {
 
 
 
 
 
85
  $id = $this->get_video_id_from_url( $url );
86
  if ( ! $id ) {
87
  return $cache;
179
  * Determine the video ID from the URL.
180
  *
181
  * @param string $url URL.
182
+ * @return int|false Video ID, or false if none could be retrieved.
183
  */
184
  private function get_video_id_from_url( $url ) {
185
+ $parsed_url = wp_parse_url( $url );
186
+
187
+ if ( ! isset( $parsed_url['host'] ) ) {
188
+ return false;
189
+ }
190
+
191
+ $domain = implode( '.', array_slice( explode( '.', $parsed_url['host'] ), -2 ) );
192
+ if ( ! in_array( $domain, [ 'youtu.be', 'youtube.com', 'youtube-nocookie.com' ], true ) ) {
193
+ return false;
194
+ }
195
+
196
+ if ( ! isset( $parsed_url['path'] ) ) {
197
+ return false;
198
+ }
199
+
200
+ $segments = explode( '/', trim( $parsed_url['path'], '/' ) );
201
+
202
+ $query_vars = [];
203
+ if ( isset( $parsed_url['query'] ) ) {
204
+ wp_parse_str( $parsed_url['query'], $query_vars );
205
+
206
+ // Handle video ID in v query param, e.g. <https://www.youtube.com/watch?v=XOY3ZUO6P0k>.
207
+ // Support is also included for other query params which don't appear to be supported by YouTube anymore.
208
+ if ( isset( $query_vars['v'] ) ) {
209
+ return $query_vars['v'];
210
+ } elseif ( isset( $query_vars['vi'] ) ) {
211
+ return $query_vars['vi'];
212
+ }
213
+ }
214
+
215
+ if ( empty( $segments[0] ) ) {
216
+ return false;
217
+ }
218
+
219
+ // For shortened URLs like <http://youtu.be/XOY3ZUO6P0k>, the slug is the first path segment.
220
+ if ( 'youtu.be' === $parsed_url['host'] ) {
221
+ return $segments[0];
222
+ }
223
+
224
+ // For non-shortened URLs, the video ID is in the second path segment. For example:
225
+ // * https://www.youtube.com/watch/XOY3ZUO6P0k
226
+ // * https://www.youtube.com/embed/XOY3ZUO6P0k
227
+ // Other top-level segments indicate non-video URLs. There are examples of URLs having segments including
228
+ // 'v', 'vi', and 'e' but these do not work anymore. In any case, they are added here for completeness.
229
+ if ( ! empty( $segments[1] ) && in_array( $segments[0], [ 'embed', 'watch', 'v', 'vi', 'e' ], true ) ) {
230
+ return $segments[1];
231
  }
232
 
233
  return false;
247
  if ( ! isset( $attr['src'] ) ) {
248
  return $html;
249
  }
250
+ $video_id = $this->get_video_id_from_url( $attr['src'] );
251
+ if ( ! $video_id ) {
 
252
  return $html;
253
  }
254
 
255
+ return $this->render( compact( 'video_id' ), $attr['src'] );
 
 
 
256
  }
257
  }
includes/sanitizers/class-amp-meta-sanitizer.php CHANGED
@@ -34,6 +34,7 @@ class AMP_Meta_Sanitizer extends AMP_Base_Sanitizer {
34
  * Tags array keys.
35
  */
36
  const TAG_CHARSET = 'charset';
 
37
  const TAG_VIEWPORT = 'viewport';
38
  const TAG_AMP_SCRIPT_SRC = 'amp_script_src';
39
  const TAG_OTHER = 'other';
@@ -54,6 +55,7 @@ class AMP_Meta_Sanitizer extends AMP_Base_Sanitizer {
54
  */
55
  protected $meta_tags = [
56
  self::TAG_CHARSET => [],
 
57
  self::TAG_VIEWPORT => [],
58
  self::TAG_AMP_SCRIPT_SRC => [],
59
  self::TAG_OTHER => [],
@@ -66,19 +68,41 @@ class AMP_Meta_Sanitizer extends AMP_Base_Sanitizer {
66
  */
67
  const AMP_VIEWPORT = 'width=device-width';
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Sanitize.
71
  */
72
  public function sanitize() {
73
- $meta_elements = $this->dom->getElementsByTagName( static::$tag );
74
-
75
- // Remove all nodes for easy reordering later on.
76
- $meta_elements = array_map(
77
- static function ( $element ) {
78
- return $element->parentNode->removeChild( $element );
79
- },
80
- iterator_to_array( $meta_elements, false )
81
- );
82
 
83
  foreach ( $meta_elements as $meta_element ) {
84
 
@@ -96,13 +120,19 @@ class AMP_Meta_Sanitizer extends AMP_Base_Sanitizer {
96
  * @var DOMElement $meta_element
97
  */
98
  if ( $meta_element->hasAttribute( Attribute::CHARSET ) ) {
99
- $this->meta_tags[ self::TAG_CHARSET ][] = $meta_element;
 
 
100
  } elseif ( Attribute::VIEWPORT === $meta_element->getAttribute( Attribute::NAME ) ) {
101
- $this->meta_tags[ self::TAG_VIEWPORT ][] = $meta_element;
102
  } elseif ( Attribute::AMP_SCRIPT_SRC === $meta_element->getAttribute( Attribute::NAME ) ) {
103
- $this->meta_tags[ self::TAG_AMP_SCRIPT_SRC ][] = $meta_element;
104
- } else {
105
- $this->meta_tags[ self::TAG_OTHER ][] = $meta_element;
 
 
 
 
106
  }
107
  }
108
 
34
  * Tags array keys.
35
  */
36
  const TAG_CHARSET = 'charset';
37
+ const TAG_HTTP_EQUIV = 'http-equiv';
38
  const TAG_VIEWPORT = 'viewport';
39
  const TAG_AMP_SCRIPT_SRC = 'amp_script_src';
40
  const TAG_OTHER = 'other';
55
  */
56
  protected $meta_tags = [
57
  self::TAG_CHARSET => [],
58
+ self::TAG_HTTP_EQUIV => [],
59
  self::TAG_VIEWPORT => [],
60
  self::TAG_AMP_SCRIPT_SRC => [],
61
  self::TAG_OTHER => [],
68
  */
69
  const AMP_VIEWPORT = 'width=device-width';
70
 
71
+ /**
72
+ * Spec name for the tag spec for meta elements that are allowed in the body.
73
+ *
74
+ * @since 1.5.2
75
+ * @var string
76
+ */
77
+ const BODY_ANCESTOR_META_TAG_SPEC_NAME = 'meta name= and content=';
78
+
79
+ /**
80
+ * Get tag spec for meta tags which are allowed in the body.
81
+ *
82
+ * @since 1.5.2
83
+ * @return string Deny pattern.
84
+ */
85
+ private function get_body_meta_tag_name_attribute_deny_pattern() {
86
+ static $pattern = null;
87
+ if ( null === $pattern ) {
88
+ $tag_spec = current(
89
+ array_filter(
90
+ AMP_Allowed_Tags_Generated::get_allowed_tag( 'meta' ),
91
+ static function ( $spec ) {
92
+ return isset( $spec['tag_spec']['spec_name'] ) && self::BODY_ANCESTOR_META_TAG_SPEC_NAME === $spec['tag_spec']['spec_name'];
93
+ }
94
+ )
95
+ );
96
+ $pattern = '/' . $tag_spec['attr_spec_list']['name']['blacklisted_value_regex'] . '/';
97
+ }
98
+ return $pattern;
99
+ }
100
+
101
  /**
102
  * Sanitize.
103
  */
104
  public function sanitize() {
105
+ $meta_elements = iterator_to_array( $this->dom->getElementsByTagName( static::$tag ), false );
 
 
 
 
 
 
 
 
106
 
107
  foreach ( $meta_elements as $meta_element ) {
108
 
120
  * @var DOMElement $meta_element
121
  */
122
  if ( $meta_element->hasAttribute( Attribute::CHARSET ) ) {
123
+ $this->meta_tags[ self::TAG_CHARSET ][] = $meta_element->parentNode->removeChild( $meta_element );
124
+ } elseif ( $meta_element->hasAttribute( Attribute::HTTP_EQUIV ) ) {
125
+ $this->meta_tags[ self::TAG_HTTP_EQUIV ][] = $meta_element->parentNode->removeChild( $meta_element );
126
  } elseif ( Attribute::VIEWPORT === $meta_element->getAttribute( Attribute::NAME ) ) {
127
+ $this->meta_tags[ self::TAG_VIEWPORT ][] = $meta_element->parentNode->removeChild( $meta_element );
128
  } elseif ( Attribute::AMP_SCRIPT_SRC === $meta_element->getAttribute( Attribute::NAME ) ) {
129
+ $this->meta_tags[ self::TAG_AMP_SCRIPT_SRC ][] = $meta_element->parentNode->removeChild( $meta_element );
130
+ } elseif (
131
+ $meta_element->hasAttribute( 'name' )
132
+ &&
133
+ preg_match( $this->get_body_meta_tag_name_attribute_deny_pattern(), $meta_element->getAttribute( 'name' ) )
134
+ ) {
135
+ $this->meta_tags[ self::TAG_OTHER ][] = $meta_element->parentNode->removeChild( $meta_element );
136
  }
137
  }
138
 
includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php CHANGED
@@ -338,6 +338,7 @@ class AMP_Tag_And_Attribute_Sanitizer extends AMP_Base_Sanitizer {
338
  // ancestor nodes in AMP_Tag_And_Attribute_Sanitizer::remove_node().
339
  $this_child = $element->firstChild;
340
  while ( $this_child && $element->parentNode ) {
 
341
  $next_child = $this_child->nextSibling;
342
  if ( $this_child instanceof DOMElement ) {
343
  $result = $this->sanitize_element( $this_child );
@@ -350,7 +351,13 @@ class AMP_Tag_And_Attribute_Sanitizer extends AMP_Base_Sanitizer {
350
  } elseif ( $this_child instanceof DOMProcessingInstruction ) {
351
  $this->remove_invalid_child( $this_child, [ 'code' => self::DISALLOWED_PROCESSING_INSTRUCTION ] );
352
  }
353
- $this_child = $next_child;
 
 
 
 
 
 
354
  }
355
 
356
  // If the element is still in the tree, process it.
338
  // ancestor nodes in AMP_Tag_And_Attribute_Sanitizer::remove_node().
339
  $this_child = $element->firstChild;
340
  while ( $this_child && $element->parentNode ) {
341
+ $prev_child = $this_child->previousSibling;
342
  $next_child = $this_child->nextSibling;
343
  if ( $this_child instanceof DOMElement ) {
344
  $result = $this->sanitize_element( $this_child );
351
  } elseif ( $this_child instanceof DOMProcessingInstruction ) {
352
  $this->remove_invalid_child( $this_child, [ 'code' => self::DISALLOWED_PROCESSING_INSTRUCTION ] );
353
  }
354
+
355
+ if ( ! $this_child->parentNode ) {
356
+ // Handle case where this child is replaced with children.
357
+ $this_child = $prev_child ? $prev_child->nextSibling : $element->firstChild;
358
+ } else {
359
+ $this_child = $next_child;
360
+ }
361
  }
362
 
363
  // If the element is still in the tree, process it.
includes/validation/class-amp-validation-error-taxonomy.php CHANGED
@@ -3344,6 +3344,10 @@ class AMP_Validation_Error_Taxonomy {
3344
  return __( 'Invalid attribute', 'amp' );
3345
  case 'required_attr_value':
3346
  return __( 'Required attribute value', 'amp' );
 
 
 
 
3347
  default:
3348
  return $key;
3349
  }
3344
  return __( 'Invalid attribute', 'amp' );
3345
  case 'required_attr_value':
3346
  return __( 'Required attribute value', 'amp' );
3347
+ case 'url':
3348
+ return __( 'URL', 'amp' );
3349
+ case 'message':
3350
+ return __( 'Message', 'amp' );
3351
  default:
3352
  return $key;
3353
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: google, xwp, automattic, westonruter, albertomedina, schlessera, s
3
  Tags: amp, mobile, optimization, accelerated mobile pages, framework, components, blocks, performance, ux, seo, official
4
  Requires at least: 4.9
5
  Tested up to: 5.4
6
- Stable tag: 1.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
3
  Tags: amp, mobile, optimization, accelerated mobile pages, framework, components, blocks, performance, ux, seo, official
4
  Requires at least: 4.9
5
  Tested up to: 5.4
6
+ Stable tag: 1.5.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
src/Admin/SiteHealth.php CHANGED
@@ -354,6 +354,11 @@ final class SiteHealth {
354
  'value' => MonitorCssTransientCaching::query_css_transient_count(),
355
  'private' => false,
356
  ],
 
 
 
 
 
357
  ],
358
  ],
359
  ]
354
  'value' => MonitorCssTransientCaching::query_css_transient_count(),
355
  'private' => false,
356
  ],
357
+ 'amp_css_transient_caching_time_series' => [
358
+ 'label' => esc_html__( 'Calculated time series for monitoring the stylesheet caching', 'amp' ),
359
+ 'value' => MonitorCssTransientCaching::get_time_series(),
360
+ 'private' => false,
361
+ ],
362
  ],
363
  ],
364
  ]
src/BackgroundTask/MonitorCssTransientCaching.php CHANGED
@@ -39,9 +39,11 @@ final class MonitorCssTransientCaching extends CronBasedBackgroundTask {
39
  /**
40
  * Default threshold to use for problem detection in number of transients per day.
41
  *
 
 
42
  * @var float
43
  */
44
- const DEFAULT_THRESHOLD = 50.0;
45
 
46
  /**
47
  * Sampling range in days to calculate the moving average from.
@@ -50,6 +52,16 @@ final class MonitorCssTransientCaching extends CronBasedBackgroundTask {
50
  */
51
  const DEFAULT_SAMPLING_RANGE = 14;
52
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * Get the interval to use for the event.
55
  *
@@ -97,7 +109,7 @@ final class MonitorCssTransientCaching extends CronBasedBackgroundTask {
97
  }
98
 
99
  $date_string = $date->format( 'Ymd' );
100
- $time_series = $this->get_time_series();
101
 
102
  $time_series[ $date_string ] = $transient_count;
103
  ksort( $time_series );
@@ -143,12 +155,24 @@ final class MonitorCssTransientCaching extends CronBasedBackgroundTask {
143
  );
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  /**
147
  * Get the time series stored in the WordPress options table.
148
  *
149
  * @return int[] Time series with the count of transients per day.
150
  */
151
- private function get_time_series() {
152
  return (array) get_option( self::TIME_SERIES_OPTION_KEY, [] );
153
  }
154
 
39
  /**
40
  * Default threshold to use for problem detection in number of transients per day.
41
  *
42
+ * This is set high to avoid false positives and only trigger on high-traffic sites that exhibit serious problems.
43
+ *
44
  * @var float
45
  */
46
+ const DEFAULT_THRESHOLD = 5000.0;
47
 
48
  /**
49
  * Sampling range in days to calculate the moving average from.
52
  */
53
  const DEFAULT_SAMPLING_RANGE = 14;
54
 
55
+ /**
56
+ * Register the service with the system.
57
+ *
58
+ * @return void
59
+ */
60
+ public function register() {
61
+ add_action( 'amp_plugin_update', [ $this, 'handle_plugin_update' ] );
62
+ parent::register();
63
+ }
64
+
65
  /**
66
  * Get the interval to use for the event.
67
  *
109
  }
110
 
111
  $date_string = $date->format( 'Ymd' );
112
+ $time_series = self::get_time_series();
113
 
114
  $time_series[ $date_string ] = $transient_count;
115
  ksort( $time_series );
155
  );
156
  }
157
 
158
+ /**
159
+ * Handle update to plugin.
160
+ *
161
+ * @param string $old_version Old version.
162
+ */
163
+ public function handle_plugin_update( $old_version ) {
164
+ // Reset the disabling of the CSS caching subsystem when updating from versions 1.5.0 or 1.5.1.
165
+ if ( version_compare( $old_version, '1.5.0', '>=' ) && version_compare( $old_version, '1.5.2', '<' ) ) {
166
+ AMP_Options_Manager::update_option( Option::DISABLE_CSS_TRANSIENT_CACHING, false );
167
+ }
168
+ }
169
+
170
  /**
171
  * Get the time series stored in the WordPress options table.
172
  *
173
  * @return int[] Time series with the count of transients per day.
174
  */
175
+ public static function get_time_series() {
176
  return (array) get_option( self::TIME_SERIES_OPTION_KEY, [] );
177
  }
178
 
src/RemoteRequest/CachedData.php DELETED
@@ -1,71 +0,0 @@
1
- <?php
2
- /**
3
- * Class CachedData.
4
- *
5
- * @package AmpProject\AmpWP
6
- */
7
-
8
- namespace AmpProject\AmpWP\RemoteRequest;
9
-
10
- use DateTimeImmutable;
11
- use DateTimeInterface;
12
-
13
- /**
14
- * Serializable object that represents cached data together with its expiry time.
15
- *
16
- * @package AmpProject\AmpWP
17
- */
18
- final class CachedData {
19
-
20
- /**
21
- * Cached value.
22
- *
23
- * @var mixed
24
- */
25
- private $value;
26
-
27
- /**
28
- * Expiry time of the cached value.
29
- *
30
- * @var DateTimeInterface
31
- */
32
- private $expiry;
33
-
34
- /**
35
- * Instantiate a CachedData object.
36
- *
37
- * @param mixed $value Cached value.
38
- * @param DateTimeInterface $expiry Expiry of the cached value.
39
- */
40
- public function __construct( $value, DateTimeInterface $expiry ) {
41
- $this->value = $value;
42
- $this->expiry = $expiry;
43
- }
44
-
45
- /**
46
- * Get the cache value.
47
- *
48
- * @return mixed Cached value.
49
- */
50
- public function get_value() {
51
- return $this->value;
52
- }
53
-
54
- /**
55
- * Get the expiry of the cached value.
56
- *
57
- * @return DateTimeInterface Expiry of the cached value.
58
- */
59
- public function get_expiry() {
60
- return $this->expiry;
61
- }
62
-
63
- /**
64
- * Check whether the cached value is expired.
65
- *
66
- * @return bool Whether the cached value is expired.
67
- */
68
- public function is_expired() {
69
- return new DateTimeImmutable( 'now' ) > $this->expiry;
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/RemoteRequest/CachedRemoteGetRequest.php CHANGED
@@ -7,6 +7,7 @@
7
 
8
  namespace AmpProject\AmpWP\RemoteRequest;
9
 
 
10
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
11
  use AmpProject\RemoteGetRequest;
12
  use AmpProject\RemoteRequest\RemoteGetRequestResponse;
@@ -101,24 +102,23 @@ final class CachedRemoteGetRequest implements RemoteGetRequest {
101
  *
102
  * @param string $url URL to get.
103
  * @return Response Response for the executed request.
104
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
105
  */
106
  public function get( $url ) {
107
- $cache_key = self::TRANSIENT_PREFIX . md5( __CLASS__ . $url );
108
- $cached_data = get_transient( $cache_key );
109
- $headers = [];
110
- $status = null;
111
 
112
- if ( false !== $cached_data ) {
113
  if ( PHP_MAJOR_VERSION >= 7 ) {
114
- $cached_data = unserialize( $cached_data, [ CachedData::class, DateTimeImmutable::class ] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize,PHPCompatibility.FunctionUse.NewFunctionParameters.unserialize_optionsFound
115
  } else {
116
  // PHP 5.6 does not provide the second $options argument yet.
117
- $cached_data = unserialize( $cached_data ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
118
  }
119
  }
120
 
121
- if ( false === $cached_data || $cached_data->is_expired() ) {
122
  try {
123
  $response = $this->remote_request->get( $url );
124
  $status = $response->getStatusCode();
@@ -131,12 +131,16 @@ final class CachedRemoteGetRequest implements RemoteGetRequest {
131
  $body = $exception->getMessage();
132
  }
133
 
134
- $cached_data = new CachedData( $body, $expiry );
135
 
136
- set_transient( $cache_key, serialize( $cached_data ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
137
  }
138
 
139
- return new RemoteGetRequestResponse( $cached_data->get_value(), $headers, $status );
 
 
 
 
140
  }
141
 
142
  /**
7
 
8
  namespace AmpProject\AmpWP\RemoteRequest;
9
 
10
+ use AmpProject\Exception\FailedToGetCachedResponse;
11
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
12
  use AmpProject\RemoteGetRequest;
13
  use AmpProject\RemoteRequest\RemoteGetRequestResponse;
102
  *
103
  * @param string $url URL to get.
104
  * @return Response Response for the executed request.
105
+ * @throws FailedToGetCachedResponse If retrieving the contents from the URL failed.
106
  */
107
  public function get( $url ) {
108
+ $cache_key = self::TRANSIENT_PREFIX . md5( __CLASS__ . $url );
109
+ $cached_response = get_transient( $cache_key );
110
+ $headers = [];
 
111
 
112
+ if ( false !== $cached_response ) {
113
  if ( PHP_MAJOR_VERSION >= 7 ) {
114
+ $cached_response = unserialize( $cached_response, [ CachedResponse::class, DateTimeImmutable::class ] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize,PHPCompatibility.FunctionUse.NewFunctionParameters.unserialize_optionsFound
115
  } else {
116
  // PHP 5.6 does not provide the second $options argument yet.
117
+ $cached_response = unserialize( $cached_response ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
118
  }
119
  }
120
 
121
+ if ( ! $cached_response instanceof CachedResponse || $cached_response->is_expired() ) {
122
  try {
123
  $response = $this->remote_request->get( $url );
124
  $status = $response->getStatusCode();
131
  $body = $exception->getMessage();
132
  }
133
 
134
+ $cached_response = new CachedResponse( $body, $headers, $status, $expiry );
135
 
136
+ set_transient( $cache_key, serialize( $cached_response ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
137
  }
138
 
139
+ if ( ! $cached_response->is_valid() ) {
140
+ throw new FailedToGetCachedResponse( $url );
141
+ }
142
+
143
+ return new RemoteGetRequestResponse( $cached_response->get_body(), $cached_response->get_headers(), $cached_response->get_status_code() );
144
  }
145
 
146
  /**
src/RemoteRequest/CachedResponse.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CachedResponse.
4
+ *
5
+ * @package AmpProject\AmpWP
6
+ */
7
+
8
+ namespace AmpProject\AmpWP\RemoteRequest;
9
+
10
+ use DateTimeImmutable;
11
+ use DateTimeInterface;
12
+
13
+ /**
14
+ * Serializable object that represents a cached response together with its expiry time.
15
+ *
16
+ * @package AmpProject\AmpWP
17
+ */
18
+ final class CachedResponse {
19
+
20
+ /**
21
+ * Cached body.
22
+ *
23
+ * @var string
24
+ */
25
+ private $body;
26
+
27
+ /**
28
+ * Cached headers.
29
+ *
30
+ * @var array
31
+ */
32
+ private $headers;
33
+
34
+ /**
35
+ * Cached status code.
36
+ *
37
+ * @var int
38
+ */
39
+ private $status_code;
40
+
41
+ /**
42
+ * Expiry time of the cached value.
43
+ *
44
+ * @var DateTimeInterface
45
+ */
46
+ private $expiry;
47
+
48
+ /**
49
+ * Instantiate a CachedResponse object.
50
+ *
51
+ * @param string $body Cached body.
52
+ * @param string[] $headers Associative array of cached headers.
53
+ * @param int $status_code Cached status code.
54
+ * @param DateTimeInterface $expiry Expiry of the cached value.
55
+ */
56
+ public function __construct( $body, $headers, $status_code, DateTimeInterface $expiry ) {
57
+ $this->body = (string) $body;
58
+ $this->headers = (array) $headers;
59
+ $this->status_code = (int) $status_code;
60
+ $this->expiry = $expiry;
61
+ }
62
+
63
+ /**
64
+ * Get the cached body.
65
+ *
66
+ * @return string Cached body.
67
+ */
68
+ public function get_body() {
69
+ return $this->body;
70
+ }
71
+
72
+ /**
73
+ * Get the cached headers.
74
+ *
75
+ * @return string[] Cached headers.
76
+ */
77
+ public function get_headers() {
78
+ return $this->headers;
79
+ }
80
+
81
+ /**
82
+ * Get the cached status code.
83
+ *
84
+ * @return int Cached status code.
85
+ */
86
+ public function get_status_code() {
87
+ return $this->status_code;
88
+ }
89
+
90
+ /**
91
+ * Determine the validity of the cached response.
92
+ *
93
+ * @return bool Whether the cached response is valid.
94
+ */
95
+ public function is_valid() {
96
+ // Values are already typed, so we just control the status code for validity.
97
+ return $this->status_code > 100 && $this->status_code <= 599;
98
+ }
99
+
100
+ /**
101
+ * Get the expiry of the cached value.
102
+ *
103
+ * @return DateTimeInterface Expiry of the cached value.
104
+ */
105
+ public function get_expiry() {
106
+ return $this->expiry;
107
+ }
108
+
109
+ /**
110
+ * Check whether the cached value is expired.
111
+ *
112
+ * @return bool Whether the cached value is expired.
113
+ */
114
+ public function is_expired() {
115
+ return new DateTimeImmutable( 'now' ) > $this->expiry;
116
+ }
117
+ }
vendor/ampproject/common/src/Dom/Document.php CHANGED
@@ -897,7 +897,7 @@ final class Document extends DOMDocument
897
  private function secureMustacheScriptTemplates($html)
898
  {
899
  return preg_replace(
900
- '#<script(\s[^>]*?template=(["\']?)amp-mustache\2[^>]*)>(.*?)</script\s*?>#i',
901
  '<tmp-script$1>$3</tmp-script>',
902
  $html
903
  );
897
  private function secureMustacheScriptTemplates($html)
898
  {
899
  return preg_replace(
900
+ '#<script(\s[^>]*?template=(["\']?)amp-mustache\2[^>]*)>(.*?)</script\s*?>#is',
901
  '<tmp-script$1>$3</tmp-script>',
902
  $html
903
  );
vendor/ampproject/common/src/Exception/FailedRemoteRequest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace AmpProject\Exception;
4
+
5
+ /**
6
+ * Marker interface to enable consumers to catch all exceptions for failed remote requests.
7
+ *
8
+ * @package ampproject/common
9
+ */
10
+ interface FailedRemoteRequest extends AmpException
11
+ {
12
+
13
+ }
vendor/ampproject/common/src/Exception/FailedToGetCachedResponse.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace AmpProject\Exception;
4
+
5
+ use RuntimeException;
6
+
7
+ /**
8
+ * Exception thrown when a cached remote response could not be retrieved.
9
+ *
10
+ * @package ampproject/common
11
+ */
12
+ final class FailedToGetCachedResponse extends RuntimeException implements FailedRemoteRequest
13
+ {
14
+
15
+ /**
16
+ * Instantiate a FailedToGetCachedResponseData exception for a URL if the cached response data could not be retrieved.
17
+ *
18
+ * @param string $url URL that failed to be fetched.
19
+ * @return self
20
+ */
21
+ public static function withUrl($url)
22
+ {
23
+ $message = "Failed to retrieve the cached response for the URL '{$url}'.";
24
+
25
+ return new self($message);
26
+ }
27
+ }
vendor/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php CHANGED
@@ -10,7 +10,7 @@ use RuntimeException;
10
  *
11
  * @package ampproject/common
12
  */
13
- final class FailedToGetFromRemoteUrl extends RuntimeException implements AmpException
14
  {
15
 
16
  /**
10
  *
11
  * @package ampproject/common
12
  */
13
+ final class FailedToGetFromRemoteUrl extends RuntimeException implements FailedRemoteRequest
14
  {
15
 
16
  /**
vendor/ampproject/common/src/RemoteGetRequest.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace AmpProject;
4
 
5
- use AmpProject\Exception\FailedToGetFromRemoteUrl;
6
 
7
  /**
8
  * Interface for abstracting away the transport that is being used for making remote requests.
@@ -19,7 +19,7 @@ interface RemoteGetRequest
19
  *
20
  * @param string $url URL to get.
21
  * @return Response Response for the executed request.
22
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
23
  */
24
  public function get($url);
25
  }
2
 
3
  namespace AmpProject;
4
 
5
+ use AmpProject\Exception\FailedRemoteRequest;
6
 
7
  /**
8
  * Interface for abstracting away the transport that is being used for making remote requests.
19
  *
20
  * @param string $url URL to get.
21
  * @return Response Response for the executed request.
22
+ * @throws FailedRemoteRequest If retrieving the contents from the URL failed.
23
  */
24
  public function get($url);
25
  }
vendor/ampproject/common/src/RemoteRequest/CurlRemoteGetRequest.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
 
5
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
@@ -92,7 +93,7 @@ final class CurlRemoteGetRequest implements RemoteGetRequest
92
  *
93
  * @param string $url URL to get.
94
  * @return Response Response for the executed request.
95
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
96
  */
97
  public function get($url)
98
  {
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
+ use AmpProject\Exception\FailedRemoteRequest;
6
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
7
  use AmpProject\RemoteGetRequest;
8
  use AmpProject\Response;
93
  *
94
  * @param string $url URL to get.
95
  * @return Response Response for the executed request.
96
+ * @throws FailedRemoteRequest If retrieving the contents from the URL failed.
97
  */
98
  public function get($url)
99
  {
vendor/ampproject/common/src/RemoteRequest/FallbackRemoteGetRequest.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
- use AmpProject\Exception\FailedToGetFromRemoteUrl;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
8
  use Exception;
@@ -55,7 +55,7 @@ final class FallbackRemoteGetRequest implements RemoteGetRequest
55
  *
56
  * @param string $url URL to get.
57
  * @return Response Response for the executed request.
58
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
59
  */
60
  public function get($url)
61
  {
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
+ use AmpProject\Exception\FailedRemoteRequest;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
8
  use Exception;
55
  *
56
  * @param string $url URL to get.
57
  * @return Response Response for the executed request.
58
+ * @throws FailedRemoteRequest If retrieving the contents from the URL failed.
59
  */
60
  public function get($url)
61
  {
vendor/ampproject/common/src/RemoteRequest/FilesystemRemoteGetRequest.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
 
5
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
@@ -40,7 +41,7 @@ final class FilesystemRemoteGetRequest implements RemoteGetRequest
40
  *
41
  * @param string $url URL to get.
42
  * @return Response Response for the executed request.
43
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
44
  */
45
  public function get($url)
46
  {
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
+ use AmpProject\Exception\FailedRemoteRequest;
6
  use AmpProject\Exception\FailedToGetFromRemoteUrl;
7
  use AmpProject\RemoteGetRequest;
8
  use AmpProject\Response;
41
  *
42
  * @param string $url URL to get.
43
  * @return Response Response for the executed request.
44
+ * @throws FailedRemoteRequest If retrieving the contents from the URL failed.
45
  */
46
  public function get($url)
47
  {
vendor/ampproject/common/src/RemoteRequest/StubbedRemoteGetRequest.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
- use AmpProject\Exception\FailedToGetFromRemoteUrl;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
8
  use LogicException;
@@ -37,7 +37,7 @@ final class StubbedRemoteGetRequest implements RemoteGetRequest
37
  *
38
  * @param string $url URL to get.
39
  * @return Response Response for the executed request.
40
- * @throws FailedToGetFromRemoteUrl If retrieving the contents from the URL failed.
41
  */
42
  public function get($url)
43
  {
2
 
3
  namespace AmpProject\RemoteRequest;
4
 
5
+ use AmpProject\Exception\FailedRemoteRequest;
6
  use AmpProject\RemoteGetRequest;
7
  use AmpProject\Response;
8
  use LogicException;
37
  *
38
  * @param string $url URL to get.
39
  * @return Response Response for the executed request.
40
+ * @throws FailedRemoteRequest If retrieving the contents from the URL failed.
41
  */
42
  public function get($url)
43
  {
vendor/ampproject/optimizer/src/Transformer/ServerSideRendering.php CHANGED
@@ -526,7 +526,15 @@ final class ServerSideRendering implements Transformer
526
  $sizer_img->setAttribute(Attribute::ARIA_HIDDEN, 'true');
527
  $sizer_img->setAttribute(Attribute::CLASS_, Amp::INTRINSIC_SIZER_ELEMENT);
528
  $sizer_img->setAttribute(Attribute::ROLE, 'presentation');
529
- $sizer_img->setAttribute(Attribute::SRC, "data:image/svg+xml;charset=utf-8,<svg height=&quot;{$height->getNumeral()}&quot; width=&quot;{$width->getNumeral()}&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;/>");
 
 
 
 
 
 
 
 
530
 
531
  $sizer->appendChild($sizer_img);
532
 
526
  $sizer_img->setAttribute(Attribute::ARIA_HIDDEN, 'true');
527
  $sizer_img->setAttribute(Attribute::CLASS_, Amp::INTRINSIC_SIZER_ELEMENT);
528
  $sizer_img->setAttribute(Attribute::ROLE, 'presentation');
529
+
530
+ // Temporarily cast decimal dimensions to integers. Can be reverted when/if the AMP Validator allows decimals.
531
+ // Note that the floor value is used because two elements with width=99.5 in a container 199px-wide will not fit
532
+ // on the same line if rounding is used.
533
+ // @todo Revisit after <https://github.com/ampproject/amphtml/issues/27528>.
534
+ $height_int = (int) $height->getNumeral();
535
+ $width_int = (int) $width->getNumeral();
536
+
537
+ $sizer_img->setAttribute(Attribute::SRC, "data:image/svg+xml;charset=utf-8,<svg height=&quot;{$height_int}&quot; width=&quot;{$width_int}&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;/>");
538
 
539
  $sizer->appendChild($sizer_img);
540
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0c4a9bc9296b6e3c5b3991f4494de9ef::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -101,8 +101,8 @@ return array(
101
  'AmpProject\\AmpWP\\HasActivation' => $baseDir . '/src/HasActivation.php',
102
  'AmpProject\\AmpWP\\HasDeactivation' => $baseDir . '/src/HasDeactivation.php',
103
  'AmpProject\\AmpWP\\Option' => $baseDir . '/src/Option.php',
104
- 'AmpProject\\AmpWP\\RemoteRequest\\CachedData' => $baseDir . '/src/RemoteRequest/CachedData.php',
105
  'AmpProject\\AmpWP\\RemoteRequest\\CachedRemoteGetRequest' => $baseDir . '/src/RemoteRequest/CachedRemoteGetRequest.php',
 
106
  'AmpProject\\AmpWP\\RemoteRequest\\WpHttpRemoteGetRequest' => $baseDir . '/src/RemoteRequest/WpHttpRemoteGetRequest.php',
107
  'AmpProject\\AmpWP\\Service' => $baseDir . '/src/Service.php',
108
  'AmpProject\\AmpWP\\Services' => $baseDir . '/src/Services.php',
@@ -113,6 +113,8 @@ return array(
113
  'AmpProject\\DevMode' => $vendorDir . '/ampproject/common/src/DevMode.php',
114
  'AmpProject\\Dom\\Document' => $vendorDir . '/ampproject/common/src/Dom/Document.php',
115
  'AmpProject\\Exception\\AmpException' => $vendorDir . '/ampproject/common/src/Exception/AmpException.php',
 
 
116
  'AmpProject\\Exception\\FailedToGetFromRemoteUrl' => $vendorDir . '/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php',
117
  'AmpProject\\Extension' => $vendorDir . '/ampproject/common/src/Extension.php',
118
  'AmpProject\\Fonts' => $vendorDir . '/ampproject/common/src/Fonts.php',
101
  'AmpProject\\AmpWP\\HasActivation' => $baseDir . '/src/HasActivation.php',
102
  'AmpProject\\AmpWP\\HasDeactivation' => $baseDir . '/src/HasDeactivation.php',
103
  'AmpProject\\AmpWP\\Option' => $baseDir . '/src/Option.php',
 
104
  'AmpProject\\AmpWP\\RemoteRequest\\CachedRemoteGetRequest' => $baseDir . '/src/RemoteRequest/CachedRemoteGetRequest.php',
105
+ 'AmpProject\\AmpWP\\RemoteRequest\\CachedResponse' => $baseDir . '/src/RemoteRequest/CachedResponse.php',
106
  'AmpProject\\AmpWP\\RemoteRequest\\WpHttpRemoteGetRequest' => $baseDir . '/src/RemoteRequest/WpHttpRemoteGetRequest.php',
107
  'AmpProject\\AmpWP\\Service' => $baseDir . '/src/Service.php',
108
  'AmpProject\\AmpWP\\Services' => $baseDir . '/src/Services.php',
113
  'AmpProject\\DevMode' => $vendorDir . '/ampproject/common/src/DevMode.php',
114
  'AmpProject\\Dom\\Document' => $vendorDir . '/ampproject/common/src/Dom/Document.php',
115
  'AmpProject\\Exception\\AmpException' => $vendorDir . '/ampproject/common/src/Exception/AmpException.php',
116
+ 'AmpProject\\Exception\\FailedRemoteRequest' => $vendorDir . '/ampproject/common/src/Exception/FailedRemoteRequest.php',
117
+ 'AmpProject\\Exception\\FailedToGetCachedResponse' => $vendorDir . '/ampproject/common/src/Exception/FailedToGetCachedResponse.php',
118
  'AmpProject\\Exception\\FailedToGetFromRemoteUrl' => $vendorDir . '/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php',
119
  'AmpProject\\Extension' => $vendorDir . '/ampproject/common/src/Extension.php',
120
  'AmpProject\\Fonts' => $vendorDir . '/ampproject/common/src/Fonts.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit20f0c5143d9e0b410d96fea3786c662b
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire20f0c5143d9e0b410d96fea3786c662b($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire20f0c5143d9e0b410d96fea3786c662b($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0c4a9bc9296b6e3c5b3991f4494de9ef
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit0c4a9bc9296b6e3c5b3991f4494de9ef', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit0c4a9bc9296b6e3c5b3991f4494de9ef', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire0c4a9bc9296b6e3c5b3991f4494de9ef($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire0c4a9bc9296b6e3c5b3991f4494de9ef($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b
8
  {
9
  public static $files = array (
10
  '6f5653f9af3eab04254ad2c7f20515c8' => __DIR__ . '/../..' . '/back-compat/back-compat.php',
@@ -151,8 +151,8 @@ class ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b
151
  'AmpProject\\AmpWP\\HasActivation' => __DIR__ . '/../..' . '/src/HasActivation.php',
152
  'AmpProject\\AmpWP\\HasDeactivation' => __DIR__ . '/../..' . '/src/HasDeactivation.php',
153
  'AmpProject\\AmpWP\\Option' => __DIR__ . '/../..' . '/src/Option.php',
154
- 'AmpProject\\AmpWP\\RemoteRequest\\CachedData' => __DIR__ . '/../..' . '/src/RemoteRequest/CachedData.php',
155
  'AmpProject\\AmpWP\\RemoteRequest\\CachedRemoteGetRequest' => __DIR__ . '/../..' . '/src/RemoteRequest/CachedRemoteGetRequest.php',
 
156
  'AmpProject\\AmpWP\\RemoteRequest\\WpHttpRemoteGetRequest' => __DIR__ . '/../..' . '/src/RemoteRequest/WpHttpRemoteGetRequest.php',
157
  'AmpProject\\AmpWP\\Service' => __DIR__ . '/../..' . '/src/Service.php',
158
  'AmpProject\\AmpWP\\Services' => __DIR__ . '/../..' . '/src/Services.php',
@@ -163,6 +163,8 @@ class ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b
163
  'AmpProject\\DevMode' => __DIR__ . '/..' . '/ampproject/common/src/DevMode.php',
164
  'AmpProject\\Dom\\Document' => __DIR__ . '/..' . '/ampproject/common/src/Dom/Document.php',
165
  'AmpProject\\Exception\\AmpException' => __DIR__ . '/..' . '/ampproject/common/src/Exception/AmpException.php',
 
 
166
  'AmpProject\\Exception\\FailedToGetFromRemoteUrl' => __DIR__ . '/..' . '/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php',
167
  'AmpProject\\Extension' => __DIR__ . '/..' . '/ampproject/common/src/Extension.php',
168
  'AmpProject\\Fonts' => __DIR__ . '/..' . '/ampproject/common/src/Fonts.php',
@@ -253,10 +255,10 @@ class ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b
253
  public static function getInitializer(ClassLoader $loader)
254
  {
255
  return \Closure::bind(function () use ($loader) {
256
- $loader->prefixLengthsPsr4 = ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::$prefixLengthsPsr4;
257
- $loader->prefixDirsPsr4 = ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::$prefixDirsPsr4;
258
- $loader->prefixesPsr0 = ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::$prefixesPsr0;
259
- $loader->classMap = ComposerStaticInit20f0c5143d9e0b410d96fea3786c662b::$classMap;
260
 
261
  }, null, ClassLoader::class);
262
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef
8
  {
9
  public static $files = array (
10
  '6f5653f9af3eab04254ad2c7f20515c8' => __DIR__ . '/../..' . '/back-compat/back-compat.php',
151
  'AmpProject\\AmpWP\\HasActivation' => __DIR__ . '/../..' . '/src/HasActivation.php',
152
  'AmpProject\\AmpWP\\HasDeactivation' => __DIR__ . '/../..' . '/src/HasDeactivation.php',
153
  'AmpProject\\AmpWP\\Option' => __DIR__ . '/../..' . '/src/Option.php',
 
154
  'AmpProject\\AmpWP\\RemoteRequest\\CachedRemoteGetRequest' => __DIR__ . '/../..' . '/src/RemoteRequest/CachedRemoteGetRequest.php',
155
+ 'AmpProject\\AmpWP\\RemoteRequest\\CachedResponse' => __DIR__ . '/../..' . '/src/RemoteRequest/CachedResponse.php',
156
  'AmpProject\\AmpWP\\RemoteRequest\\WpHttpRemoteGetRequest' => __DIR__ . '/../..' . '/src/RemoteRequest/WpHttpRemoteGetRequest.php',
157
  'AmpProject\\AmpWP\\Service' => __DIR__ . '/../..' . '/src/Service.php',
158
  'AmpProject\\AmpWP\\Services' => __DIR__ . '/../..' . '/src/Services.php',
163
  'AmpProject\\DevMode' => __DIR__ . '/..' . '/ampproject/common/src/DevMode.php',
164
  'AmpProject\\Dom\\Document' => __DIR__ . '/..' . '/ampproject/common/src/Dom/Document.php',
165
  'AmpProject\\Exception\\AmpException' => __DIR__ . '/..' . '/ampproject/common/src/Exception/AmpException.php',
166
+ 'AmpProject\\Exception\\FailedRemoteRequest' => __DIR__ . '/..' . '/ampproject/common/src/Exception/FailedRemoteRequest.php',
167
+ 'AmpProject\\Exception\\FailedToGetCachedResponse' => __DIR__ . '/..' . '/ampproject/common/src/Exception/FailedToGetCachedResponse.php',
168
  'AmpProject\\Exception\\FailedToGetFromRemoteUrl' => __DIR__ . '/..' . '/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php',
169
  'AmpProject\\Extension' => __DIR__ . '/..' . '/ampproject/common/src/Extension.php',
170
  'AmpProject\\Fonts' => __DIR__ . '/..' . '/ampproject/common/src/Fonts.php',
255
  public static function getInitializer(ClassLoader $loader)
256
  {
257
  return \Closure::bind(function () use ($loader) {
258
+ $loader->prefixLengthsPsr4 = ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::$prefixLengthsPsr4;
259
+ $loader->prefixDirsPsr4 = ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::$prefixDirsPsr4;
260
+ $loader->prefixesPsr0 = ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::$prefixesPsr0;
261
+ $loader->classMap = ComposerStaticInit0c4a9bc9296b6e3c5b3991f4494de9ef::$classMap;
262
 
263
  }, null, ClassLoader::class);
264
  }