!function(e){function t(t){for(var r,o,c=t[0],i=t[1],u=t[2],p=0,g=[];p<c.length;p++)o=c[p],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&g.push(a[o][0]),a[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(s&&s(t);g.length;)g.shift()();return l.push.apply(l,u||[]),n()}function n(){for(var e,t=0;t<l.length;t++){for(var n=l[t],r=!0,c=1;c<n.length;c++){var i=n[c];0!==a[i]&&(r=!1)}r&&(l.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},a={23:0},l=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var c=window.webpackWPML=window.webpackWPML||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var u=0;u<c.length;u++)t(c[u]);var s=i;l.push([1299,0]),n()}({1299:function(e,t,n){"use strict";n.r(t);var r=n(9),a=n.n(r),l=n(30),o=n.n(l),c=n(13),i=n.n(c);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){i()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=wp.hooks.addFilter,g=wp.compose.createHigherOrderComponent,d=wp.blockEditor.InspectorControls,f=wp.components,b=f.PanelBody,v=f.SelectControl,m=f.Button,_=wp.i18n.__,y=wp.blocks.createBlock,w=wp.data,h=w.dispatch,O=w.select,k=[{label:_("All"),value:"all"}],j=O("core/block-editor"),P=j.getBlockRootClientId,E=j.getBlockName,B=j.getBlock,R=(j.getBlocks,j.getBlockIndex),I=h("core/block-editor"),C=I.removeBlock,S=I.insertBlock,x=g((function(e){var t=[];return t.push({label:k[0].label,value:k[0].value}),t.push.apply(t,o()(Object.entries(wpml_active_and_selected_languages.active_languages).map((function(e){var t=a()(e,2),n=(t[0],t[1]);return{label:n.native_name,value:n.code}})))),function(n){var r=n.attributes.wpml_language;return void 0!==n.attributes.__internalWidgetId&&"core/legacy-widget"===n.name&&(k[0].value=wpml_active_and_selected_languages.legacy_widgets_languages[n.attributes.__internalWidgetId]),React.createElement(React.Fragment,null,React.createElement(e,n),React.createElement(d,null,React.createElement(b,{title:_("Display on language","sitepress"),initialOpen:!0},D(n)?React.createElement(T,{clientId:n.clientId}):React.createElement(v,{value:r||k[0].value,options:t,onChange:function(e){if(n.setAttributes({wpml_language:e}),void 0!==n.attributes.__internalWidgetId&&"core/legacy-widget"===n.name){var r=t.find((function(t){return t.value===e}));void 0!==r&&M(n.attributes.__internalWidgetId,r)}}}))))}}),"languageControls"),D=function(e){var t=P(e.clientId),n="core/widget-area"===(t?E(t):null);return"core/html"===e.name&&n},T=function(e){var t=e.clientId,n=P(t),r=B(t),a=R(t);return React.createElement(React.Fragment,null,React.createElement("p",null,_("To display this Custom HTML block in a specific language, first place it inside a Group block.","sitepress")),React.createElement(m,{variant:"primary",onClick:function(){if(a<0)console.error("Block not found.");else{var e=y("core/group",{},[r]);C(t),S(e,a,n)}}},_("Place inside Group block","sitepress")))},M=function(e,t){var n=new FormData;n.append("action","wpml_change_selected_language_for_legacy_widget"),n.append("id",e),n.append("selected_language_value",t.value),n.append("nonce",wpml_active_and_selected_languages.nonce),fetch(ajaxurl,{method:"POST",body:n}).then((function(e){if(!e.ok)throw new Error("Changing selected language for legacy widgets action has failed!.")}))};p("blocks.registerBlockType","sitepress-multilingual-cms/attribute/wpml_language",(function(e){return e.attributes=s(s({},e.attributes),{},{wpml_language:{type:"string"}}),e})),p("editor.BlockEdit","sitepress-multilingual-cms/language-controls",x)}});