| Current File : /home/digitaw/www/wp-content/plugins/wordpress-popup/inc/providers/gutenberg/js/embeds-block.min.js |
!function(){function e(t){return(e="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})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function o(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?r(t):n}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var i=wp.blocks,l=i.registerBlockType,c=i.createBlock,d=wp.element,u=d.createElement,p=d.Component,_=d.RawHTML,m=wp.shortcode,h=m.string,b=m.next,f=u("svg",{class:"dashicon",viewBox:"0 0 24 24",width:20,height:20,xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true",role:"img"},u("path",{d:"M.857 20.571h22.286c.232 0 .433.085.603.255.17.17.254.37.254.603v1.714a.824.824 0 0 1-.254.603.824.824 0 0 1-.603.254H.857a.824.824 0 0 1-.603-.254.824.824 0 0 1-.254-.603v-1.714c0-.233.085-.433.254-.603.17-.17.371-.255.603-.255zM1.714 6.857h20.572c.482 0 .888.165 1.218.496.33.33.496.736.496 1.218v6.858c0 .482-.165.888-.496 1.218-.33.33-.736.496-1.218.496H1.714c-.482 0-.888-.165-1.218-.496A1.657 1.657 0 0 1 0 15.43V8.57c0-.482.165-.888.496-1.218.33-.33.736-.496 1.218-.496zm19.429 2.286c-.482 0-.889.165-1.219.495-.33.33-.495.737-.495 1.22 0 .481.165.888.495 1.218.33.33.737.495 1.219.495.482 0 .888-.165 1.219-.495.33-.33.495-.737.495-1.219 0-.482-.165-.888-.495-1.219a1.657 1.657 0 0 0-1.22-.495zM.857 0h22.286c.232 0 .433.085.603.254.17.17.254.371.254.603v1.714a.824.824 0 0 1-.254.603.824.824 0 0 1-.603.255H.857a.824.824 0 0 1-.603-.255A.824.824 0 0 1 0 2.571V.857C0 .625.085.424.254.254.424.084.625 0 .857 0z"})),y=function(e){function i(){var e;return t(this,i),(e=o(this,s(i).apply(this,arguments))).update_id=e.update_id.bind(r(r(e))),e.update_css_class=e.update_css_class.bind(r(r(e))),e.preview=e.preview.bind(r(r(e))),e.state={loading:!1,markup:""},e}var l,c;return 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&&a(e,t)}(i,e),l=i,(c=[{key:"update_id",value:function(e){this.props.setAttributes({id:e})}},{key:"update_module_id",value:function(e){this.props.setAttributes({module_id:e})}},{key:"update_css_class",value:function(e){this.props.setAttributes({css_class:e})}},{key:"preview",value:function(e){var t=this,n=e.id,o=e.type;if(!this.state.loading){this.setState({loading:!0});var s="";if(n){var a=void 0===o?"":"&type="+o;s=ajaxurl+"?action=hustle_render_module&_wpnonce="+hustle_embed_data.nonce+"&shortcode_id="+n+a,window.fetch(s).then((function(e){return e.json()})).then((function(e){if(e.success){var o=e.data.html,s=e.data.style,a=e.data.data;t.setState({markup:o+s,loading:!1});var r=jQuery(".hustle_module_id_"+a.module_id);HUI.maybeRenderRecaptcha(r),HUI.nonSharingSimulation(r),n||t.update_id(a.shortcode_id),t.update_module_id(a.module_id)}})).catch((function(e){console.log(e)}))}}}},{key:"componentDidMount",value:function(){var e=this.props.attributes;e.id&&this.preview(e)}},{key:"componentDidUpdate",value:function(e){var t=this.props.attributes,n=t.id;e.attributes.id!==n&&(n?this.preview(t):this.setState({markup:""}))}},{key:"open_settings",value:function(e){var t=hustle_embed_data.admin_url+"?page=hustle_embedded&id="+e;window.open(t)}},{key:"render",value:function(){var e=this,t=this.state,n=t.loading,o=t.markup,s=this.props,a=s.attributes,r=s.isSelected,i=a.module_id,l=a.id,c=a.css_class,d=hustle_embed_data.modules,p=[r&&u(wp.editor.InspectorControls,{key:"inspector"},u(wp.components.PanelBody,{title:hustle_embed_data.l10n.module,initialOpen:!0},u(wp.components.PanelRow,null,u(wp.components.SelectControl,{label:hustle_embed_data.l10n.name,value:l,options:d,onChange:this.update_id}))),u(wp.components.PanelBody,{title:hustle_embed_data.l10n.advanced,initialOpen:!0},u(wp.components.PanelRow,null,u(wp.components.TextControl,{label:hustle_embed_data.l10n.additional_css_classes,value:c,onChange:this.update_css_class})))),u(wp.editor.BlockControls,null,!!l&&u(wp.components.Toolbar,null,u(wp.components.IconButton,{className:"components-toolbar__control",label:hustle_embed_data.l10n.customize_module,icon:"edit",onClick:function(t){return e.open_settings(i)}})))];return n?[p,u("div",{key:"loading",className:"wp-block-embed is-loading"},u(wp.components.Spinner,null),u("span",null,hustle_embed_data.l10n.rendering))]:o?[p,u(_,null,o)]:[p,u(wp.components.Placeholder,{key:"placeholder",className:"wp-block-embed",instructions:hustle_embed_data.l10n.block_description,icon:f,label:hustle_embed_data.l10n.block_name},u("form",null,u("select",{value:l,onChange:function(t){return e.update_id(t.target.value)}},d.map((function(e){return u("option",{key:e.value,value:e.value},e.label)})))))]}}])&&n(l.prototype,c),i}(p);l("hustle/embedded",{title:hustle_embed_data.l10n.block_name,description:hustle_embed_data.l10n.block_description,icon:f,category:"hustle",keywords:["Hustle",hustle_embed_data.l10n.block_name],attributes:{module_id:{type:"string"},id:{type:"string"},type:{type:"string"},css_class:{type:"string"}},supports:{customClassName:!1,className:!1,html:!1},transforms:{to:[{type:"block",blocks:["core/shortcode"],transform:function(e){var t=e.id,n=e.css_class,o={tag:hustle_popup_trigger_data.shortcode_tag,attrs:{id:t||"",type:"embedded",css_class:n||""},type:"single"},s=h(o);return c("core/shortcode",{text:s})}}],from:[{type:"shortcode",tag:["wd_hustle_cc"],attributes:{id:{type:"string",shortcode:function(e){return e.named.id}},type:{type:"string",shortcode:function(e){return e.named.type}}}},{type:"block",blocks:["core/shortcode"],isMatch:function(e){var t=e.text,n=b("wd_hustle",t);if(void 0===n&&void 0===(n=b("wd_hustle_cc",t)))return!1;var o=n.shortcode;return"embedded"===o.attrs.named.type||"wd_hustle_cc"===o.attrs.tag},transform:function(e){var t=e.text,n=b("wd_hustle",t).shortcode;"undefined"===n&&(n=b("wd_hustle_cc",t));var o=n.attrs.named,s=o.id,a=o.type,r=o.css_class;return c("hustle/embedded",{id:s,css_class:r,type:a})}}]},edit:y,save:function(){return null}})}();