mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 14:48:07 +02:00
Props ellatrix, peterwilsoncc, get_dave, mcsf, talldanwp, youknowriad, desrosj. Built from https://develop.svn.wordpress.org/trunk@51426 git-svn-id: http://core.svn.wordpress.org/trunk@51037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
/*! This file is auto-generated */
|
||
this.wp=this.wp||{},this.wp.dom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="2sUP")}({"2sUP":function(t,e,n){"use strict";n.r(e),n.d(e,"focus",(function(){return rt})),n.d(e,"computeCaretRect",(function(){return C})),n.d(e,"documentHasTextSelection",(function(){return w})),n.d(e,"documentHasUncollapsedSelection",(function(){return T})),n.d(e,"documentHasSelection",(function(){return S})),n.d(e,"getRectangleFromRange",(function(){return N})),n.d(e,"getScrollContainer",(function(){return R})),n.d(e,"getOffsetParent",(function(){return x})),n.d(e,"isEntirelySelected",(function(){return D})),n.d(e,"isHorizontalEdge",(function(){return H})),n.d(e,"isNumberInput",(function(){return O})),n.d(e,"isTextField",(function(){return v})),n.d(e,"isVerticalEdge",(function(){return _})),n.d(e,"placeCaretAtHorizontalEdge",(function(){return F})),n.d(e,"placeCaretAtVerticalEdge",(function(){return B})),n.d(e,"replace",(function(){return k})),n.d(e,"remove",(function(){return z})),n.d(e,"insertAfter",(function(){return U})),n.d(e,"unwrap",(function(){return q})),n.d(e,"replaceTag",(function(){return X})),n.d(e,"wrap",(function(){return Y})),n.d(e,"__unstableStripHTML",(function(){return W})),n.d(e,"isEmpty",(function(){return G})),n.d(e,"removeInvalidHTML",(function(){return tt})),n.d(e,"isRTL",(function(){return M})),n.d(e,"safeHTML",(function(){return et})),n.d(e,"getPhrasingContentSchema",(function(){return K})),n.d(e,"isPhrasingContent",(function(){return Q})),n.d(e,"isTextContent",(function(){return Z})),n.d(e,"getFilesFromDataTransfer",(function(){return nt}));var r={};n.r(r),n.d(r,"find",(function(){return c}));var o={};n.r(o),n.d(o,"isTabbableIndex",(function(){return l})),n.d(o,"find",(function(){return h})),n.d(o,"findPrevious",(function(){return b})),n.d(o,"findNext",(function(){return g}));const i=["[tabindex]","a[href]","button:not([disabled])",'input:not([type="hidden"]):not([disabled])',"select:not([disabled])","textarea:not([disabled])","iframe","object","embed","area[href]","[contenteditable]:not([contenteditable=false])"].join(",");function u(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function c(t){const e=t.querySelectorAll(i);return Array.from(e).filter(t=>{if(!u(t)||function(t){return"iframe"===t.nodeName.toLowerCase()&&"-1"===t.getAttribute("tabindex")}(t))return!1;const{nodeName:e}=t;return"AREA"!==e||function(t){const e=t.closest("map[name]");if(!e)return!1;const n=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!n&&u(n)}(t)})}var a=n("YLtl");function s(t){const e=t.getAttribute("tabindex");return null===e?0:parseInt(e,10)}function l(t){return-1!==s(t)}function d(t,e){return{element:t,index:e}}function f(t){return t.element}function m(t,e){const n=s(t.element),r=s(e.element);return n===r?t.index-e.index:n-r}function p(t){return t.filter(l).map(d).sort(m).map(f).reduce(function(){const t={};return function(e,n){const{nodeName:r,type:o,checked:i,name:u}=n;if("INPUT"!==r||"radio"!==o||!u)return e.concat(n);const c=t.hasOwnProperty(u);if(!(i||!c))return e;if(c){const n=t[u];e=Object(a.without)(e,n)}return t[u]=n,e.concat(n)}}(),[])}function h(t){return p(c(t))}function b(t){const e=c(t.ownerDocument.body),n=e.indexOf(t);return e.length=n,Object(a.last)(p(e))}function g(t){const e=c(t.ownerDocument.body),n=e.indexOf(t),r=e.slice(n+1).filter(e=>!t.contains(e));return Object(a.first)(p(r))}function y(t,e){0}function N(t){if(!t.collapsed){const e=Array.from(t.getClientRects());if(1===e.length)return e[0];const n=e.filter(({width:t})=>t>1);if(0===n.length)return t.getBoundingClientRect();if(1===n.length)return n[0];let{top:r,bottom:o,left:i,right:u}=n[0];for(const{top:t,bottom:e,left:c,right:a}of n)t<r&&(r=t),e>o&&(o=e),c<i&&(i=c),a>u&&(u=a);return new window.DOMRect(i,r,u-i,o-r)}const{startContainer:e}=t,{ownerDocument:n}=e;if("BR"===e.nodeName){const{parentNode:r}=e;y();const o=Array.from(r.childNodes).indexOf(e);y(),(t=n.createRange()).setStart(r,o),t.setEnd(r,o)}let r=t.getClientRects()[0];if(!r){y();const e=n.createTextNode("");(t=t.cloneRange()).insertNode(e),r=t.getClientRects()[0],y(e.parentNode),e.parentNode.removeChild(e)}return r}function C(t){const e=t.getSelection();y();const n=e.rangeCount?e.getRangeAt(0):null;return n?N(n):null}function w(t){y(t.defaultView);const e=t.defaultView.getSelection();y();const n=e.rangeCount?e.getRangeAt(0):null;return!!n&&!n.collapsed}function E(t){return!!t&&"INPUT"===t.nodeName}function v(t){return E(t)&&t.type&&!["button","checkbox","hidden","file","radio","image","range","reset","submit","number"].includes(t.type)||"TEXTAREA"===t.nodeName||"true"===t.contentEditable}function O(t){return E(t)&&"number"===t.type&&!!t.valueAsNumber}function T(t){return w(t)||!!t.activeElement&&function(t){if(!v(t)&&!O(t))return!1;try{const{selectionStart:e,selectionEnd:n}=t;return null!==e&&e!==n}catch(t){return!1}}(t.activeElement)}function S(t){return!!t.activeElement&&(v(t.activeElement)||O(t.activeElement)||w(t))}function A(t){return y(t.ownerDocument.defaultView),t.ownerDocument.defaultView.getComputedStyle(t)}function R(t){if(t){if(t.scrollHeight>t.clientHeight){const{overflowY:e}=A(t);if(/(auto|scroll)/.test(e))return t}return R(t.parentNode)}}function x(t){let e;for(;(e=t.parentNode)&&e.nodeType!==e.ELEMENT_NODE;);return e?"static"!==A(e).position?e:e.offsetParent:null}function P(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName}function D(t){if(P(t))return 0===t.selectionStart&&t.value.length===t.selectionEnd;if(!t.isContentEditable)return!0;const{ownerDocument:e}=t,{defaultView:n}=e;y();const r=n.getSelection();y();const o=r.rangeCount?r.getRangeAt(0):null;if(!o)return!0;const{startContainer:i,endContainer:u,startOffset:c,endOffset:a}=o;if(i===t&&u===t&&0===c&&a===t.childNodes.length)return!0;t.lastChild;y();const s=u.nodeType===u.TEXT_NODE?u.data.length:u.childNodes.length;return L(i,t,"firstChild")&&L(u,t,"lastChild")&&0===c&&a===s}function L(t,e,n){let r=e;do{if(t===r)return!0;r=r[n]}while(r);return!1}function M(t){return"rtl"===A(t).direction}function j(t,e,n,r){const o=r.style.zIndex,i=r.style.position,{position:u="static"}=A(r);"static"===u&&(r.style.position="relative"),r.style.zIndex="10000";const c=function(t,e,n){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e,n);if(!t.caretPositionFromPoint)return null;const r=t.caretPositionFromPoint(e,n);if(!r)return null;const o=t.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}(t,e,n);return r.style.zIndex=o,r.style.position=i,c}function I(t,e,n=!1){if(P(t))return t.selectionStart===t.selectionEnd&&(e?0===t.selectionStart:t.value.length===t.selectionStart);if(!t.isContentEditable)return!0;const{ownerDocument:r}=t,{defaultView:o}=r;y();const i=o.getSelection();if(!i||!i.rangeCount)return!1;const u=i.getRangeAt(0),c=u.cloneRange(),a=function(t){const{anchorNode:e,focusNode:n,anchorOffset:r,focusOffset:o}=t;y(),y();const i=e.compareDocumentPosition(n);return!(i&e.DOCUMENT_POSITION_PRECEDING)&&(!!(i&e.DOCUMENT_POSITION_FOLLOWING)||(0!==i||r<=o))}(i),s=i.isCollapsed;s||c.collapse(!a);const l=N(c),d=N(u);if(!l||!d)return!1;const f=function(t){const e=Array.from(t.getClientRects());if(!e.length)return;const n=Math.min(...e.map(({top:t})=>t));return Math.max(...e.map(({bottom:t})=>t))-n}(u);if(!s&&f&&f>l.height&&a===e)return!1;const m=M(t)?!e:e,p=t.getBoundingClientRect(),h=j(r,m?p.left+1:p.right-1,e?p.top+1:p.bottom-1,t);if(!h)return!1;const b=N(h);if(!b)return!1;const g=e?"top":"bottom",C=m?"left":"right",w=b[g]-d[g],E=b[C]-l[C],v=Math.abs(w)<=1,O=Math.abs(E)<=1;return n?v:v&&O}function H(t,e){return I(t,e)}function _(t,e){return I(t,e,!0)}function V(t,e){const{ownerDocument:n}=t,r=M(t)?!e:e,o=t.getBoundingClientRect();return j(n,e?o.right-1:o.left+1,r?o.bottom-1:o.top+1,t)}function F(t,e){if(!t)return;if(t.focus(),P(t)){if("number"!=typeof t.selectionStart)return;return void(e?(t.selectionStart=t.value.length,t.selectionEnd=t.value.length):(t.selectionStart=0,t.selectionEnd=0))}if(!t.isContentEditable)return;let n=V(t,e);if(!(n&&n.startContainer&&t.contains(n.startContainer)||(t.scrollIntoView(e),n=V(t,e),n&&n.startContainer&&t.contains(n.startContainer))))return;const{ownerDocument:r}=t,{defaultView:o}=r;y();const i=o.getSelection();y(),i.removeAllRanges(),i.addRange(n)}function B(t,e,n,r=!0){if(!t)return;if(!n||!t.isContentEditable)return void F(t,e);t.focus();const o=n.height/2,i=t.getBoundingClientRect(),u=n.left,c=e?i.bottom-o:i.top+o,{ownerDocument:a}=t,{defaultView:s}=a,l=j(a,u,c,t);if(!l||!t.contains(l.startContainer))return!r||l&&l.startContainer&&l.startContainer.contains(t)?void F(t,e):(t.scrollIntoView(e),void B(t,e,n,!1));y();const d=s.getSelection();y(),d.removeAllRanges(),d.addRange(l)}function U(t,e){y(e.parentNode),e.parentNode.insertBefore(t,e.nextSibling)}function z(t){y(t.parentNode),t.parentNode.removeChild(t)}function k(t,e){y(t.parentNode),U(e,t.parentNode),z(t)}function q(t){const e=t.parentNode;for(y();t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function X(t,e){const n=t.ownerDocument.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return y(t.parentNode),t.parentNode.replaceChild(n,t),n}function Y(t,e){y(e.parentNode),e.parentNode.insertBefore(t,e),t.appendChild(e)}function W(t){return(new window.DOMParser).parseFromString(t,"text/html").body.textContent||""}function G(t){switch(t.nodeType){case t.TEXT_NODE:return/^[ \f\n\r\t\v\u00a0]*$/.test(t.nodeValue||"");case t.ELEMENT_NODE:return!t.hasAttributes()&&(!t.hasChildNodes()||Array.from(t.childNodes).every(G));default:return!0}}const $={strong:{},em:{},s:{},del:{},ins:{},a:{attributes:["href","target","rel"]},code:{},abbr:{attributes:["title"]},sub:{},sup:{},br:{},small:{},q:{attributes:["cite"]},dfn:{attributes:["title"]},data:{attributes:["value"]},time:{attributes:["datetime"]},var:{},samp:{},kbd:{},i:{},b:{},u:{},mark:{},ruby:{},rt:{},rp:{},bdi:{attributes:["dir"]},bdo:{attributes:["dir"]},wbr:{},"#text":{}};Object(a.without)(Object.keys($),"#text","br").forEach(t=>{$[t].children=Object(a.omit)($,t)});const J={...$,audio:{attributes:["src","preload","autoplay","mediagroup","loop","muted"]},canvas:{attributes:["width","height"]},embed:{attributes:["src","type","width","height"]},img:{attributes:["alt","src","srcset","usemap","ismap","width","height"]},object:{attributes:["data","type","name","usemap","form","width","height"]},video:{attributes:["src","poster","preload","autoplay","mediagroup","loop","muted","controls","width","height"]}};function K(t){return"paste"!==t?J:Object(a.omit)({...J,ins:{children:J.ins.children},del:{children:J.del.children}},["u","abbr","data","time","wbr","bdi","bdo"])}function Q(t){const e=t.nodeName.toLowerCase();return K().hasOwnProperty(e)||"span"===e}function Z(t){const e=t.nodeName.toLowerCase();return $.hasOwnProperty(e)||"span"===e}function tt(t,e,n){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t,function t(e,n,r,o){Array.from(e).forEach(e=>{var i,u;const c=e.nodeName.toLowerCase();if(r.hasOwnProperty(c)&&(!r[c].isMatch||null!==(i=(u=r[c]).isMatch)&&void 0!==i&&i.call(u,e))){if(function(t){return!!t&&t.nodeType===t.ELEMENT_NODE}(e)){const{attributes:i=[],classes:u=[],children:s,require:l=[],allowEmpty:d}=r[c];if(s&&!d&&G(e))return void z(e);if(e.hasAttributes()&&(Array.from(e.attributes).forEach(({name:t})=>{"class"===t||Object(a.includes)(i,t)||e.removeAttribute(t)}),e.classList&&e.classList.length)){const t=u.map(t=>"string"==typeof t?e=>e===t:t instanceof RegExp?e=>t.test(e):a.noop);Array.from(e.classList).forEach(n=>{t.some(t=>t(n))||e.classList.remove(n)}),e.classList.length||e.removeAttribute("class")}if(e.hasChildNodes()){if("*"===s)return;if(s)l.length&&!e.querySelector(l.join(","))?(t(e.childNodes,n,r,o),q(e)):e.parentNode&&"BODY"===e.parentNode.nodeName&&Q(e)?(t(e.childNodes,n,r,o),Array.from(e.childNodes).some(t=>!Q(t))&&q(e)):t(e.childNodes,n,s,o);else for(;e.firstChild;)z(e.firstChild)}}}else t(e.childNodes,n,r,o),o&&!Q(e)&&e.nextElementSibling&&U(n.createElement("br"),e),q(e)})}(r.body.childNodes,r,e,n),r.body.innerHTML}function et(t){const{body:e}=document.implementation.createHTMLDocument("");e.innerHTML=t;const n=e.getElementsByTagName("*");let r=n.length;for(;r--;){const t=n[r];if("SCRIPT"===t.tagName)z(t);else{let e=t.attributes.length;for(;e--;){const{name:n}=t.attributes[e];n.startsWith("on")&&t.removeAttribute(n)}}}return e.innerHTML}function nt(t){const e=Array.from(t.files);return Array.from(t.items).forEach(t=>{const n=t.getAsFile();n&&!e.find(({name:t,type:e,size:r})=>t===n.name&&e===n.type&&r===n.size)&&e.push(n)}),e}const rt={focusable:r,tabbable:o}},YLtl:function(t,e){t.exports=window.lodash}}); |