WordPress/wp-includes/js/dist/undo-manager.min.js

2 lines
1.6 KiB
JavaScript

/*! This file is auto-generated */
(()=>{"use strict";var e={923:e=>{e.exports=window.wp.isShallowEqual}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{createUndoManager:()=>s});var r=n(923),i=n.n(r);function a(e,t){const n={...e};return Object.entries(t).forEach((([e,t])=>{n[e]?n[e]={...n[e],to:t.to}:n[e]=t})),n}const d=(e,t)=>{const n=e?.findIndex((({id:e})=>"string"==typeof e?e===t.id:i()(e,t.id))),o=[...e];return-1!==n?o[n]={id:t.id,changes:a(o[n].changes,t.changes)}:o.push(t),o};function s(){let e=[],t=[],n=0;const o=()=>{e=e.slice(0,n||void 0),n=0},r=()=>{var n;const o=0===e.length?0:e.length-1;let r=null!==(n=e[o])&&void 0!==n?n:[];t.forEach((e=>{r=d(r,e)})),t=[],e[o]=r};return{addRecord(n,a=!1){const s=!n||(e=>!e.filter((({changes:e})=>Object.values(e).some((({from:e,to:t})=>"function"!=typeof e&&"function"!=typeof t&&!i()(e,t))))).length)(n);if(a){if(s)return;n.forEach((e=>{t=d(t,e)}))}else{if(o(),t.length&&r(),s)return;e.push(n)}},undo(){t.length&&(o(),r());const i=e[e.length-1+n];if(i)return n-=1,i},redo(){const t=e[e.length+n];if(t)return n+=1,t},hasUndo:()=>!!e[e.length-1+n],hasRedo:()=>!!e[e.length+n]}}(window.wp=window.wp||{}).undoManager=o})();