/home/techb158/balacoffee.com/wp-content/plugins/polylang-pro-1/js/build
Edit: /home/techb158/balacoffee.com/wp-content/plugins/polylang-pro-1/js/build/sidebar.js (118170B)
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 184:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 991:
/***/ ((module) => {
module.exports = (function() { return this["lodash"]; }());
/***/ }),
/***/ 514:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["apiFetch"]; }());
/***/ }),
/***/ 893:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["components"]; }());
/***/ }),
/***/ 576:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["compose"]; }());
/***/ }),
/***/ 15:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["data"]; }());
/***/ }),
/***/ 197:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["editPost"]; }());
/***/ }),
/***/ 353:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["editSite"]; }());
/***/ }),
/***/ 293:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["element"]; }());
/***/ }),
/***/ 638:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["htmlEntities"]; }());
/***/ }),
/***/ 122:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["i18n"]; }());
/***/ }),
/***/ 19:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["keycodes"]; }());
/***/ }),
/***/ 571:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["plugins"]; }());
/***/ }),
/***/ 776:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["primitives"]; }());
/***/ }),
/***/ 470:
/***/ ((module) => {
module.exports = (function() { return this["wp"]["url"]; }());
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(293);
// EXTERNAL MODULE: external {"this":["wp","plugins"]}
var external_this_wp_plugins_ = __webpack_require__(571);
// EXTERNAL MODULE: external {"this":["wp","data"]}
var external_this_wp_data_ = __webpack_require__(15);
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(991);
// EXTERNAL MODULE: external {"this":["wp","editPost"]}
var external_this_wp_editPost_ = __webpack_require__(197);
// EXTERNAL MODULE: external {"this":["wp","editSite"]}
var external_this_wp_editSite_ = __webpack_require__(353);
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external_this_wp_i18n_ = __webpack_require__(122);
// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
var external_this_wp_apiFetch_ = __webpack_require__(514);
var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
// EXTERNAL MODULE: external {"this":["wp","url"]}
var external_this_wp_url_ = __webpack_require__(470);
// EXTERNAL MODULE: external {"this":["wp","components"]}
var external_this_wp_components_ = __webpack_require__(893);
// EXTERNAL MODULE: external {"this":["wp","compose"]}
var external_this_wp_compose_ = __webpack_require__(576);
;// CONCATENATED MODULE: ./modules/block-editor/js/sidebar/components/confirmation-modal/index.js
/**
* Wordpress dependencies
*
* @package Polylang-Pro
*/
class ConfirmationModal extends external_this_wp_element_.Component {
constructor() {
super(...arguments);
this.confirmButton = (0,external_this_wp_element_.createRef)();
}
componentDidMount() {
this.confirmButton.current.focus();
}
render() {
const {
idPrefix,
title,
updateState,
handleChange,
children
} = this.props;
return (0,external_this_wp_element_.createElement)(external_this_wp_components_.Modal, {
title: title,
className: "confirmBox",
onRequestClose: updateState,
shouldCloseOnEsc: false,
shouldCloseOnClickOutside: false,
focusOnMount: false
}, children, (0,external_this_wp_element_.createElement)(external_this_wp_components_.ButtonGroup, {
className: "buttons"
}, (0,external_this_wp_element_.createElement)(external_this_wp_components_.Button, {
id: `${idPrefix}_confirm`,
ref: this.confirmButton,
isPrimary: true,
onClick: event => {
handleChange(event);
updateState();
}
}, (0,external_this_wp_i18n_.__)('OK', 'polylang-pro')), (0,external_this_wp_element_.createElement)(external_this_wp_components_.Button, {
id: `${idPrefix}_cancel`,
isSecondary: true,
onClick: () => updateState()
}, (0,external_this_wp_i18n_.__)('Cancel', 'polylang-pro'))));
}
}
/**
* Control the execution of a component's function with a confirmation modal.
*
* @param {string} idPrefix Used to identify the modal's buttons. {@see ConfirmationModal.render()}
* @param {React.Component} ModalContent Component which contains the content displayed in the confirmation modal.
* @param {handleChangeCallback} handleChangeCallback Action triggered when we valid the confirmation modal by clicking the confirmation button.
*
* @return {Function} Higher-order component.
*/
const withConfirmation = function (idPrefix, ModalContent, handleChangeCallback) {
return (0,external_this_wp_compose_.createHigherOrderComponent)(
/**
* @function Higher-Order Component
*
* @param {React.Component} WrappedComponent The component which needs a confirmation to change to its new value.
* @param {string} WrappedComponent.labelConfirmationModal Used for both WrappedComponent and ConfirmationModal titles.
* @param {WrappedComponent.getChangeValueCallback} WrappedComponent.getChangeValue
* @param {WrappedComponent.bypassConfirmationCallback} WrappedComponent.bypassConfirmation
* @return {WPComponent}
*/
WrappedComponent => {
class enhanceComponent extends external_this_wp_element_.Component {
constructor() {
super(...arguments);
this.state = {
isOpen: false,
changeValue: null
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
let changeValue = WrappedComponent.getChangeValue(event);
// Process specific case for the template part deletion confirmation.
const currentPost = this.props.currentPost;
if (!(0,external_lodash_.isNil)(currentPost)) {
changeValue = {
templateId: changeValue,
currentPost: currentPost
};
}
if (!(0,external_lodash_.isUndefined)(WrappedComponent.bypassConfirmation) && WrappedComponent.bypassConfirmation(this.props.translationData)) {
handleChangeCallback(changeValue);
} else {
this.setState({
isOpen: true,
changeValue: changeValue
});
}
}
render() {
var _this$props$translati;
// isDefaultLang property is only available in translationData which comes from template post type.
const isDefaultLang = (_this$props$translati = this.props.translationData) === null || _this$props$translati === void 0 ? void 0 : _this$props$translati.is_default_lang;
const passThroughProps = this.props;
const wrappedComponentProps = Object.assign({}, {
...passThroughProps
}, {
handleChange: this.handleChange
});
return (0,external_this_wp_element_.createElement)(external_this_wp_element_.Fragment, null, (0,external_this_wp_element_.createElement)(WrappedComponent, wrappedComponentProps), this.state.isOpen && (0,external_this_wp_element_.createElement)(ConfirmationModal, {
title: WrappedComponent.labelConfirmationModal,
idPrefix: idPrefix,
handleChange: () => handleChangeCallback(this.state.changeValue),
updateState: () => this.setState({
isOpen: false,
changeValue: null
})
}, (0,external_this_wp_element_.createElement)(ModalContent, !(0,external_lodash_.isNil)(isDefaultLang) ? {
isDefaultLang: isDefaultLang
} : {})));
}
}
;
enhanceComponent.bypassConfirmation = WrappedComponent.bypassConfirmation;
enhanceComponent.getChangeValue = WrappedComponent.getChangeValue;
return enhanceComponent;
}, 'withConfirmation');
};
/**
* Callback to trigger the action to change the value in the Component wrapped by the withConfirmation HOC.
*
* @callback handleChangeCallback
* @param {string|Object} changeValue The value computed by {@see WrappedComponent.getChangeValueCallback} and could be completed by the withConfirmation HOC handleChange function.
*/
/**
* Callback to retrieve the value to change from the Component wrapped by the withConfirmation HOC.
*
* @callback WrappedComponent.getChangeValueCallback
* @param {Event} event A DOM triggered by the wrapped component.
*/
/**
* Optional callback to check whether the Component wrapped by the withConfirmation HOC need to open the confirmation modal or not.
*
* @callback WrappedComponent.bypassConfirmationCallback
* @param {Object} [translationData] A entry which represents the translation of the current post in a language {@see PLL_REST_Post::get_translations_table()}.
*/
/* harmony default export */ const confirmation_modal = (withConfirmation);
;// CONCATENATED MODULE: ./modules/block-editor/js/sidebar/settings.js
/**
* Module Constants
*
* @package Polylang-Pro
*/
const MODULE_KEY = 'pll/metabox';
const MODULE_CORE_EDITOR_KEY = 'core/editor';
const MODULE_SITE_EDITOR_KEY = 'core/edit-site';
const settings_MODULE_POST_EDITOR_KEY = 'core/edit-post';
const MODULE_CORE_KEY = 'core';
const DEFAULT_STATE = {
languages: [],
selectedLanguage: {},
translatedPosts: {},
fromPost: null,
currentTemplatePart: {}
};
const UNTRANSLATABLE_POST_TYPE = ['wp_template'];
const TEMPLATE_PART_SLUG_SEPARATOR = '___'; // Its value must be synchronized with its equivalent in PHP @see PLL_FSE_Template_Slug::SEPARATOR
const TEMPLATE_PART_SLUG_CHECK_LANGUAGE_PATTERN = '[a-z_-]+'; // Its value must be synchronized with it equivalent in PHP @see PLL_FSE_Template_Slug::SEPARATOR
;// CONCATENATED MODULE: ./modules/block-editor/js/sidebar/utils.js
/**
* WordPress Dependencies
*
* @package Polylang-Pro
*/
/**
* Internal dependencies
*/
/**
* Converts array of object to a map.
*
* @param {array} array Array to convert.
* @param {*} key The key in the object used as key to build the map.
* @returns {Map}
*/
function convertArrayToMap(array, key) {
const map = new Map();
array.reduce(function (accumulator, currentValue) {
accumulator.set(currentValue[key], currentValue);
return accumulator;
}, map);
return map;
}
/**
* Converts map to an associative array.
*
* @param {Map} map The map to convert.
* @returns {Object}
*/
function convertMapToObject(map) {
const object = {};
map.forEach(function (value, key, map) {
const obj = this;
this[key] = (0,external_lodash_.isBoolean)(value) ? value.toString() : value;
}, object);
return object;
}
/**
* Checks whether the current screen is block-based post type editor.
*
* @returns {boolean} True if block editor for post type; false otherwise.
*/
function isPostTypeBlockEditor() {
return !!document.getElementById('editor');
}
/**
* Checks whether the current screen is the block-based widgets editor.
*
* @returns {boolean} True if we are in the widgets block editor; false otherwise.
*/
function isWidgetsBlockEditor() {
return !!document.getElementById('widgets-editor');
}
/**
* Checks whether the current screen is the customizer widgets editor.
*
* @returns {boolean} True if we are in the customizer widgets editor; false otherwise.
*/
function isWidgetsCustomizerEditor() {
return !!document.getElementById('customize-controls');
}
/**
* Checks whether the current screen is the site editor.
* Takes in account if Gutenberg is activated.
*
* @returns {boolean} True if site editor screen, false otherwise.
*/
function isSiteBlockEditor() {
return !!(document.getElementById('site-editor') || document.getElementById('edit-site-editor'));
}
/**
* Returns the post type URL for REST API calls or undefined if the user hasn't the rights.
*
* @param {string} name The post type name.
* @returns {string|undefined}
*/
function getPostsUrl(name) {
const postTypes = (0,external_this_wp_data_.select)('core').getEntitiesByKind('postType');
const postType = (0,external_lodash_.find)(postTypes, {
name
});
return postType === null || postType === void 0 ? void 0 : postType.baseURL;
}
/**
* Gets all query string parameters and convert them in a URLSearchParams object.
*
* @returns {Object}
*/
function getSearchParams() {
// Variable window.location.search is just read for creating and returning a URLSearchParams object to be able to manipulate it more easily.
if (!(0,external_lodash_.isEmpty)(window.location.search)) {
// phpcs:ignore WordPressVIPMinimum.JS.Window.location
return new URLSearchParams(window.location.search); // phpcs:ignore WordPressVIPMinimum.JS.Window.location
} else {
return null;
}
}
/**
* Gets selected language.
*
* @param {string} lang The post language code.
* @returns {Object} The selected language.
*/
function getSelectedLanguage(lang) {
const languages = (0,external_this_wp_data_.select)(MODULE_KEY).getLanguages();
// Pick up this language as selected in languages list
return languages.get(lang);
}
/**
* Gets the default language.
*
* @returns {Object} The default Language.
*/
function getDefaultLanguage() {
const languages = (0,external_this_wp_data_.select)(MODULE_KEY).getLanguages();
return Array.from(languages.values()).find(lang => lang.is_default_lang);
}
/**
* Checks if the given language is the default one.
*
* @param {string} lang The language code to compare with.
* @returns {boolean} True if the given language is the default one.
*/
function isDefaultLanguage(lang) {
return lang === getDefaultLanguage().slug;
}
/**
* Gets translated posts.
*
* @param {Object} translations The translated posts object with language codes as keys and ids as values.
* @param {Object.
} translations_table The translations table data with language codes as keys and data object as values.
* @returns {Map}
*/
function getTranslatedPosts(translations, translations_table, lang) {
const translationsTable = getTranslationsTable(translations_table, lang);
const fromPost = (0,external_this_wp_data_.select)(MODULE_KEY).getFromPost();
let translatedPosts = new Map(Object.entries([]));
if (!(0,external_lodash_.isUndefined)(translations)) {
translatedPosts = new Map(Object.entries(translations));
}
// If we come from another post for creating a new one, we have to update translated posts from the original post
// to be able to update translations attribute of the post
if (!(0,external_lodash_.isNil)(fromPost) && !(0,external_lodash_.isNil)(fromPost.id)) {
translationsTable.forEach((translationData, lang) => {
if (!(0,external_lodash_.isNil)(translationData.translated_post) && !(0,external_lodash_.isNil)(translationData.translated_post.id)) {
translatedPosts.set(lang, translationData.translated_post.id);
}
});
}
return translatedPosts;
}
/**
* Gets synchronized posts.
*
* @param {Object.} pll_sync_post The synchronized posts object with language codes as keys and boolean values to say if the post is synchronized or not.
* @returns {Map}
*/
function getSynchronizedPosts(pll_sync_post) {
let synchronizedPosts = new Map(Object.entries([]));
if (!(0,external_lodash_.isUndefined)(pll_sync_post)) {
synchronizedPosts = new Map(Object.entries(pll_sync_post));
}
return synchronizedPosts;
}
/**
* Gets translations table.
*
* @param {Object.} translationsTableDatas The translations table data object with language codes as keys and data object as values.
* @param {string} lang The language code.
* @returns {Map}
*/
function getTranslationsTable(translationsTableDatas, lang) {
let translationsTable = new Map(Object.entries([]));
// get translations table datas from post
if (!(0,external_lodash_.isUndefined)(translationsTableDatas)) {
// Build translations table map with language slug as key
translationsTable = new Map(Object.entries(translationsTableDatas));
}
return translationsTable;
}
/**
* Checks if the given request is for saving.
*
* @param {Object} options The initial request.
* @returns {Boolean} True if the request is for saving.
*/
function isSaveRequest(options) {
// If data is defined we are in a PUT or POST request method otherwise a GET request method
// Test options.method property isn't efficient because most of REST request which use fetch API doesn't pass this property.
// So, test options.data is necessary to know if the REST request is to save datas.
// However test if options.data is undefined isn't sufficient because some REST request pass a null value as the ServerSideRender Gutenberg component.
if (!isNil(options.data)) {
return true;
} else {
return false;
}
}
/**
* Adds `is_block_editor` parameter to the request in a block editor context.
*
* @param {Object} options The initial request.
*/
function addIsBlockEditorToRequest(options) {
options.path = addQueryArgs(options.path, {
is_block_editor: true
});
}
/**
* Checks if the given request concerns the current post type.
*
* Useful when saving a reusable block contained in another post type.
* Indeed a reusable block is also a post, but its saving request doesn't concern the post currently edited.
* As we don't know the language of the reusable block when the user triggers the reusable block saving action,
* we need to pass the current post language to be sure that the reusable block will have a language.
*
* @see https://github.com/polylang/polylang/issues/437 - Reusable block has no language when it's saved from another post type editing.
*
* @param {Object} options the initial request
* @returns {boolean} True if the request concerns the current post.
*/
function isCurrentPostRequest(options) {
// Saving translation data is needed only for all post types.
// It's done by verifying options.path matches with one of baseURL of all post types
// and compare current post id with this sent in the request.
// List of post type baseURLs.
const postTypeURLs = map(select('core').getEntitiesByKind('postType'), property('baseURL'));
// Id from the post currently edited.
const postId = select('core/editor').getCurrentPostId();
// Id from the REST request.
// options.data never isNil here because it's already verified before in isSaveRequest() function.
const id = options.data.id;
// Return true
// if REST request baseURL matches with one of the known post type baseURLs
// and the id from the post currently edited corresponds on the id passed to the REST request
// Return false otherwise
return -1 !== postTypeURLs.findIndex(function (element) {
return new RegExp(`${escapeRegExp(element)}`).test(options.path);
}) && postId === id;
}
/**
* Checks if the given REST request is for the creation of a new template part translation.
*
* @param {Object} options The initial request.
* @returns {Boolean} True if the request concerns a template part translation creation.
*/
function isTemplatePartTranslationCreationRequest(options) {
return 'POST' === options.method && options.path.match(/^\/wp\/v2\/template-parts(?:\/|\?|$)/) && !isNil(options.data.from_post) && !isNil(options.data.lang);
}
/**
* Checks if the given REST request is for the creation of a new template part.
*
* @param {Object} options The initial request.
* @returns {Boolean} True if the request concerns a template part creation.
*/
function isNewTemplatePartCreationRequest(options) {
return 'POST' === options.method && options.path.match(/^\/wp\/v2\/template-parts(?:\/|\?|$)/) && isNil(options.data.from_post) && isNil(options.data.lang);
}
/**
* Adds language as query string parameter to the given request.
*
* @param {Object} options The initial request.
* @param {string} currentLanguage The language code to add to the request.
*/
function addLanguageToRequest(options, currentLanguage) {
const hasLangArg = hasQueryArg(options.path, 'lang');
const filterLang = isUndefined(options.filterLang) || options.filterLang;
if (filterLang && !hasLangArg) {
options.path = addQueryArgs(options.path, {
lang: currentLanguage
});
}
}
/**
* Adds `include_untranslated` parameter to the request.
*
* @param {Object} options The initial request.
* @returns {void}
*/
function addIncludeUntranslatedParam(options) {
options.path = addQueryArgs(options.path, {
include_untranslated: true
});
}
/**
* Use addIncludeUntranslatedParam if the given page is a template part page.
* Or if the template editing mode is enabled inside post editing.
*
* @param {Object} options The initial request.
* @returns {void}
*/
function maybeRequireIncludeUntranslatedTemplate(options) {
var _select;
const params = new URL(document.location).searchParams;
const postType = params.get('postType');
const postId = params.get('postId');
const isEditingTemplate = (_select = select(MODULE_POST_EDITOR_KEY)) === null || _select === void 0 ? void 0 : _select.isEditingTemplate();
if ("wp_template_part" === postType && !isNil(postId) || isEditingTemplate) {
addIncludeUntranslatedParam(options);
}
}
/**
* Returns true if the given post is a template part, false otherwise.
*
* @param {Object} post A post object.
* @returns {boolean} Whether it is a template part or not.
*/
function isTemplatePart(post) {
return 'wp_template_part' === post.type;
}
/**
* Returns the current post type considering the Site Editor or Post Editor.
*
* @returns {string} The current post type.
*/
function getCurrentPostType() {
if (isSiteBlockEditor()) {
return (0,external_this_wp_data_.select)(MODULE_SITE_EDITOR_KEY).getEditedPostType();
}
return (0,external_this_wp_data_.select)(MODULE_CORE_EDITOR_KEY).getCurrentPostType();
}
/**
* Gets the default language from a translations table.
*
* @param {Object} translationsTable The translations table data with language codes as keys and data object as values.
* @returns {Object} The default language.
*/
function getDefaultLangFromTable(translationsTable) {
let defaultLang = {};
translationsTable.forEach(translation => {
if (translation.is_default_lang) {
defaultLang = translation.lang;
}
});
return defaultLang;
}
/**
* Returns a regular expression ready to use to perform search and replace.
*
* @returns {RegExp} The regular expression.
*/
function getLangSlugRegex() {
let languageCheckPattern = TEMPLATE_PART_SLUG_CHECK_LANGUAGE_PATTERN;
const languages = (0,external_this_wp_data_.select)(MODULE_KEY).getLanguages();
const languageSlugs = Array.from(languages.keys());
if (!(0,external_lodash_.isEmpty)(languageSlugs)) {
languageCheckPattern = languageSlugs.join('|');
}
return new RegExp(`${TEMPLATE_PART_SLUG_SEPARATOR}(?:${languageCheckPattern})$`);
}
// EXTERNAL MODULE: external {"this":["wp","primitives"]}
var external_this_wp_primitives_ = __webpack_require__(776);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/duplication.js
/**
* Duplication icon - admin-page Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const duplication = isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M6 15v-13h10v13h-10zM5 16h8v2h-10v-13h2v11z"
})) : 'admin-page';
/* harmony default export */ const library_duplication = (duplication);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/pencil.js
/**
* Pencil icon - edit Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const pencil_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const pencil = pencil_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M13.89 3.39l2.71 2.72c0.46 0.46 0.42 1.24 0.030 1.64l-8.010 8.020-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.030c0.39-0.39 1.22-0.39 1.68 0.070zM11.16 6.18l-5.59 5.61 1.11 1.11 5.54-5.65zM8.19 14.41l5.58-5.6-1.070-1.080-5.59 5.6z"
})) : 'edit';
/* harmony default export */ const library_pencil = (pencil);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/plus.js
/**
* Plus icon - plus Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const plus_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const plus = plus_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M17 7v3h-5v5h-3v-5h-5v-3h5v-5h3v5h5z"
})) : 'plus';
/* harmony default export */ const library_plus = (plus);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/synchronization.js
/**
* Synchronization icon - controls-repeat Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const synchronization_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const synchronization = synchronization_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M5 7v3l-2 1.5v-6.5h11v-2l4 3.010-4 2.99v-2h-9zM15 13v-3l2-1.5v6.5h-11v2l-4-3.010 4-2.99v2h9z"
})) : 'controls-repeat';
/* harmony default export */ const library_synchronization = (synchronization);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/translation.js
/**
* Translation icon - translation Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const translation_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const translation = translation_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M11 7H9.49c-.63 0-1.25.3-1.59.7L7 5H4.13l-2.39 7h1.69l.74-2H7v4H2c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h7c1.1 0 2 .9 2 2v2zM6.51 9H4.49l1-2.93zM10 8h7c1.1 0 2 .9 2 2v7c0 1.1-.9 2-2 2h-7c-1.1 0-2-.9-2-2v-7c0-1.1.9-2 2-2zm7.25 5v-1.08h-3.17V9.75h-1.16v2.17H9.75V13h1.28c.11.85.56 1.85 1.28 2.62-.87.36-1.89.62-2.31.62-.01.02.22.97.2 1.46.84 0 2.21-.5 3.28-1.15 1.09.65 2.48 1.15 3.34 1.15-.02-.49.2-1.44.2-1.46-.43 0-1.49-.27-2.38-.63.7-.77 1.14-1.77 1.25-2.61h1.36zm-3.81 1.93c-.5-.46-.85-1.13-1.01-1.93h2.09c-.17.8-.51 1.47-1 1.93l-.04.03s-.03-.02-.04-.03z"
})) : 'translation';
/* harmony default export */ const library_translation = (translation);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/trash.js
/**
* Trash icon - trash Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const trash_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const trash = trash_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"
})) : 'trash';
/* harmony default export */ const library_trash = (trash);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/star.js
/**
* Star icon - star-filled Dashicon.
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
const star_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const star = star_isPrimitivesComponents ? (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.SVG, {
width: "20",
height: "20",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_this_wp_element_.createElement)(external_this_wp_primitives_.Path, {
d: "m10 1 3 6 6 .75-4.12 4.62L16 19l-6-3-6 3 1.13-6.63L1 7.75 7 7z"
})) : 'star-filled';
/* harmony default export */ const library_star = (star);
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/library/submenu.js
/**
* Submenu icon
*
* @package Polylang-Pro
*/
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
const submenu_isPrimitivesComponents = !(0,external_lodash_.isUndefined)(wp.primitives);
const SubmenuIcon = () => submenu_isPrimitivesComponents ? createElement(SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none"
}, createElement(Path, {
d: "M1.50002 4L6.00002 8L10.5 4",
strokeWidth: "1.5"
})) : 'submenu';
/* harmony default export */ const submenu = ((/* unused pure expression or super */ null && (SubmenuIcon)));
;// CONCATENATED MODULE: ./modules/block-editor/js/icons/index.js
/**
* Icons library
*
* @package Polylang-Pro
*/
;// CONCATENATED MODULE: ./modules/block-editor/js/components/language-flag.js
/**
* @package Polylang-Pro
*/
/**
* External dependencies.
*/
/**
* Internal dependencies.
*/
/**
* Display a flag icon for a given language.
*
* @since 3.1
* @since 3.2 Now its own component.
*
* @param {Object} A language object.
*
* @return {Object}
*/
function LanguageFlag(_ref) {
let {
language
} = _ref;
return !(0,external_lodash_.isNil)(language) ? !(0,external_lodash_.isEmpty)(language.flag_url) ? (0,external_this_wp_element_.createElement)("span", {
className: "pll-select-flag"
}, (0,external_this_wp_element_.createElement)("img", {
src: language.flag_url,
alt: language.name,
title: language.name,
className: "flag"
})) : (0,external_this_wp_element_.createElement)("abbr", null, language.slug, (0,external_this_wp_element_.createElement)("span", {
className: "screen-reader-text"
}, language.name)) : (0,external_this_wp_element_.createElement)("span", {
className: "pll-translation-icon"
}, library_translation);
}
/* harmony default export */ const language_flag = (LanguageFlag);
;// CONCATENATED MODULE: ./modules/block-editor/js/components/language-dropdown.js
/**
* @package Polylang-Pro
*/
// External dependencies
/**
* Displays a dropdown to select a language.
*
* @since 3.1
*
* @param {Function} handleChange Callback to be executed when language changes.
* @param {mixed} children Child components to be used as select options.
* @param {Object} selectedLanguage An object representing a Polylang Language. Default to null.
* @param {string} Default value to be selected if the selected language is not provided. Default to an empty string.
*
* @return {Object} A dropdown selector for languages.
*/
function LanguageDropdown(_ref) {
let {
handleChange,
children,
selectedLanguage = null,
defaultValue = ''
} = _ref;
const selectedLanguageSlug = selectedLanguage !== null && selectedLanguage !== void 0 && selectedLanguage.slug ? selectedLanguage.slug : defaultValue;
return (0,external_this_wp_element_.createElement)("div", {
id: "select-post-language"
}, (0,external_this_wp_element_.createElement)(language_flag, {
language: selectedLanguage
}), children && (0,external_this_wp_element_.createElement)("select", {
value: selectedLanguageSlug,
onChange: event => handleChange(event),
id: "pll_post_lang_choice",
name: "pll_post_lang_choice",
className: "post_lang_choice"
}, children));
}
/**
* Map languages objects as options for a