Files
tysweld.com/wp-content/plugins/polylang-pro/js/build/block-editor-plugin.min.js
2025-02-24 22:33:42 +01:00

1 line
4.0 KiB
JavaScript

(()=>{var t={419:t=>{t.exports=function(){return this.lodash}()},631:t=>{t.exports=function(){return this.wp.apiFetch}()},987:t=>{t.exports=function(){return this.wp.data}()},172:t=>{t.exports=function(){return this.wp.url}()}},e={};function n(s){var r=e[s];if(void 0!==r)return r.exports;var a=e[s]={exports:{}};return t[s](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);(()=>{"use strict";var t=n(631),e=n.n(t),s=n(987),r=n(419),a=n(172);const o="pll/metabox",i="core/editor",p="core/edit-site";function l(){const t=(0,s.select)(o).getLanguages();return Array.from(t.values()).find((t=>t.is_default))}function d(t,e){const n=(0,a.hasQueryArg)(t.path,"lang");((0,r.isUndefined)(t.filterLang)||t.filterLang)&&!n&&(t.path=(0,a.addQueryArgs)(t.path,{lang:e}))}function u(t){const e=new URL(document.location).searchParams,n=e.get("postType"),o=e.get("postId"),i=(0,s.select)("core/edit-post")?.isEditingTemplate();("wp_template_part"===n&&!(0,r.isNil)(o)||i)&&function(t){t.path=(0,a.addQueryArgs)(t.path,{include_untranslated:!0})}(t)}function c(){return document.getElementById("site-editor")||document.getElementById("edit-site-editor")?(0,s.select)(p).getEditedPostType():(0,s.select)(i).getCurrentPostType()}const g=()=>{const t=(()=>{const t=(0,s.select)(p);if(!t)return null;const e={postId:t.getEditedPostId(),postType:t.getEditedPostType()};if(t.hasOwnProperty("getEditedPostContext")){const n=t.getEditedPostContext();return n?.postType&&n?.postId?n:e}return e})();return null===t?null:(0,s.select)("core").getEntityRecord("postType",t.postType,t.postId)},f=(t,e,n)=>{const s=t.path.split("?")[0].replace(/^\/+|\/+$/g,"");return Object.values(e).find((t=>s===t))?n(t):t};e().use(((t,e)=>void 0!==t.url||"undefined"==typeof pllFilteredRoutes?e(t):e(f(t,pllFilteredRoutes,y))));const y=t=>{const e=_();if(function(t){return!(0,r.isNil)(t.data)}(t))return function(t){return"POST"===t.method&&t.path.match(/^\/wp\/v2\/template-parts(?:\/|\?|$)/)&&(0,r.isNil)(t.data.from_post)&&(0,r.isNil)(t.data.lang)}(t)&&d(t,l()?.slug),function(t){const e=(0,r.map)((0,s.select)("core").getEntitiesByKind("postType"),(0,r.property)("baseURL")),n=(0,s.select)("core/editor").getCurrentPostId(),a=t.data.id;return-1!==e.findIndex((function(e){return new RegExp(`${(0,r.escapeRegExp)(e)}`).test(t.path)}))&&n===a}(t)||function(t){return"POST"===t.method&&t.path.match(/^\/wp\/v2\/template-parts(?:\/|\?|$)/)&&!(0,r.isNil)(t.data.from_post)&&!(0,r.isNil)(t.data.lang)}(t)||d(t,e),function(t,e){const n=function(t){const e=(0,s.select)("core").getEntitiesByKind("postType"),n=(0,r.find)(e,{name:t});return n?.baseURL}("wp_template_part");if((0,r.isUndefined)(n))return;const a=new RegExp((0,r.escapeRegExp)(n));if("POST"==t.method&&a.test(t.path)){if(!(0,s.select)(o).getLanguages().get(e).is_default){const n="___"+e;t.data.slug+=n}}}(t,e),t;"wp_template"===c()&&d(t,l()?.slug);return new RegExp(/^\/wp\/v2\/template-parts\/?(?:\?.*)?$/).test(t.path)&&u(t),d(t,e),t};function _(){if((0,r.isUndefined)((0,s.select)(i)))return pll_block_editor_plugin_settings.lang.slug;const t=(0,s.select)(i).getEditedPostAttribute("lang");if(!(0,r.isUndefined)(t)&&t)return t;const e=new URL(document.location).searchParams,n=e.get("postType"),a=e.get("postId");if("wp_template_part"===n&&(0,r.isNil)(a))return pll_block_editor_plugin_settings.lang=l(),pll_block_editor_plugin_settings.lang.slug;const o=g(),p=o?.lang;return!(0,r.isUndefined)(p)&&p?p:pll_block_editor_plugin_settings.lang.slug}"undefined"!=typeof jQuery&&jQuery((function(t){t.ajaxPrefilter((function(t,e,n){if(-1!=t.url.indexOf(ajaxurl)||-1!=ajaxurl.indexOf(t.url)){const s=_(),r={lang:s};function a(){const e="lang="+s;if(void 0===t.data||""===t.data.trim())t.data=e;else try{t.data=JSON.stringify(Object.assign(JSON.parse(t.data),r))}catch(n){t.data=t.data+"&"+e}}t.processData||void 0===t.data||"string"==typeof t.data?a():t.data=Object.assign(t.data||{},r)}}))}))})(),this["polylang-pro"]={}})();