2021-05-26 20:17:06 -04:00
|
|
|
this.wp=this.wp||{},this.wp.serverSideRender=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="4dqW")}({"1ZqX":function(e,t){e.exports=window.wp.data},"4dqW":function(e,t,r){"use strict";r.r(t);var n=r("wx14"),o=r("GRId"),c=r("1ZqX"),u=r("NMb1"),l=r.n(u),s=r("YLtl"),i=r("K9lf"),a=r("l3Sj"),d=r("ywyh"),p=r.n(d),f=r("Mmq9"),b=r("tI+e"),w=r("HSyU");function O({className:e}){return Object(o.createElement)(b.Placeholder,{className:e},Object(a.__)("Block rendered as empty."))}function j({response:e,className:t}){const r=Object(a.sprintf)(Object(a.__)("Error loading block: %s"),e.errorMsg);return Object(o.createElement)(b.Placeholder,{className:t},r)}function m({className:e}){return Object(o.createElement)(b.Placeholder,{className:e},Object(o.createElement)(b.Spinner,null))}function y(e){const{attributes:t,block:r,className:c,httpMethod:u="GET",urlQueryArgs:l,EmptyResponsePlaceholder:a=O,ErrorResponsePlaceholder:d=j,LoadingResponsePlaceholder:b=m}=e,y=Object(o.useRef)(!0),h=Object(o.useRef)(),[S,v]=Object(o.useState)(null),x=Object(i.usePrevious)(e);function g(){if(!y.current)return;null!==S&&v(null);const e=t&&Object(w.__experimentalSanitizeBlockAttributes)(r,t),n="POST"===u,o=function(e,t=null,r={}){return Object(f.addQueryArgs)("/wp/v2/block-renderer/"+e,{context:"edit",...null!==t?{attributes:t}:{},...r})}(r,n?null:null!=e?e:null,l),c=n?{attributes:null!=e?e:null}:null,s=h.current=p()({path:o,data:c,method:n?"POST":"GET"}).then(e=>{y.current&&s===h.current&&e&&v(e.rendered)}).catch(e=>{y.current&&s===h.current&&v({error:!0,errorMsg:e.message})});return s}const E=Object(i.useDebounce)(g,500);return Object(o.useEffect)(()=>()=>{y.current=!1},[]),Object(o.useEffect)(()=>{void 0===x?g():Object(s.isEqual)(x,e)||E()}),""===S?Object(o.createElement)(a,e):S?S.error?Object(o.createElement)(d,Object(n.a)({response:S},e)):Object(o.createElement)(o.RawHTML,{className:c},S):Object(o.createElement)(b,e)}const h={},S=Object(c.withSelect)(e=>{const t=e("core/editor");if(t){const e=t.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return h})(({urlQueryArgs:e=h,currentPostId:t,...r})=>{const c=Object(o.useMemo)(()=>t?{post_id:t,...e}:e,[t,e]);return Object(o.createElement)(y,Object(n.a)({urlQueryArgs:c},r))});window&&window.wp&&window.wp.components&&(window.wp.components.ServerSideRender=Object(o.forwardRef)((e,t)=>(l()("wp.components.ServerSideRender",{since:"5.3",alternative:"wp.serverSideRender"}),Object(o.createElement)(S,Object(n.a)({},e,{ref:t})))));t.default=S},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},K9lf:function(e,t){e.exports=window.wp.compose},Mmq9:function(e,t){e.exports=window.wp.url},NMb1:function(e,t){e.exports=window.wp.deprecated},YLtl:function(e,t){e.exports=window.lodash},l3Sj:function(e,t){e.exports=window.wp.i18n},"tI+e":function(e,t){e.exports=window.wp.components},wx14:function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},ywyh:function(e,t){e.exports=window.wp.apiFetch}}).default;
|