WordPress/wp-includes/js/dist/keycodes.min.js

2 lines
3.5 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ALT:()=>P,BACKSPACE:()=>d,COMMAND:()=>L,CTRL:()=>j,DELETE:()=>S,DOWN:()=>O,END:()=>g,ENTER:()=>p,ESCAPE:()=>h,F10:()=>b,HOME:()=>w,LEFT:()=>C,PAGEDOWN:()=>A,PAGEUP:()=>m,RIGHT:()=>E,SHIFT:()=>T,SPACE:()=>y,TAB:()=>f,UP:()=>v,ZERO:()=>_,displayShortcut:()=>x,displayShortcutList:()=>Z,isAppleOS:()=>u,isKeyboardEvent:()=>K,modifiers:()=>k,rawShortcut:()=>M,shortcutAriaLabel:()=>D});var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function n(e){return e.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function a(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce((function(e,t){return e.replace(t,r)}),e)}function c(e){return function(e){return e.charAt(0).toUpperCase()+e.substr(1)}(e.toLowerCase())}function l(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var r=t.splitRegexp,c=void 0===r?o:r,l=t.stripRegexp,s=void 0===l?i:l,u=t.transform,d=void 0===u?n:u,f=t.delimiter,p=void 0===f?" ":f,h=a(a(e,c,"$1\0$2"),s,"\0"),y=0,m=h.length;"\0"===h.charAt(y);)y++;for(;"\0"===h.charAt(m-1);)m--;return h.slice(y,m).split("\0").map(d).join(p)}(e,r({delimiter:" ",transform:c},t))}const s=window.wp.i18n;function u(e=null){if(!e){if("undefined"==typeof window)return!1;e=window}const{platform:t}=e.navigator;return-1!==t.indexOf("Mac")||["iPad","iPhone"].includes(t)}const d=8,f=9,p=13,h=27,y=32,m=33,A=34,g=35,w=36,C=37,v=38,E=39,O=40,S=46,b=121,P="alt",j="ctrl",L="meta",T="shift",_=48;function R(e,t){return Object.fromEntries(Object.entries(e).map((([e,r])=>[e,t(r)])))}const k={primary:e=>e()?[L]:[j],primaryShift:e=>e()?[T,L]:[j,T],primaryAlt:e=>e()?[P,L]:[j,P],secondary:e=>e()?[T,P,L]:[j,T,P],access:e=>e()?[j,P]:[T,P],ctrl:()=>[j],alt:()=>[P],ctrlShift:()=>[j,T],shift:()=>[T],shiftAlt:()=>[T,P],undefined:()=>[]},M=R(k,(e=>(t,r=u)=>[...e(r),t.toLowerCase()].join("+"))),Z=R(k,(e=>(t,r=u)=>{const n=r(),o={[P]:n?"⌥":"Alt",[j]:n?"⌃":"Ctrl",[L]:"⌘",[T]:n?"⇧":"Shift"};return[...e(r).reduce(((e,t)=>{var r;const i=null!==(r=o[t])&&void 0!==r?r:t;return n?[...e,i]:[...e,i,"+"]}),[]),l(t,{stripRegexp:/[^A-Z0-9~`,\.\\\-]/gi})]})),x=R(Z,(e=>(t,r=u)=>e(t,r).join(""))),D=R(k,(e=>(t,r=u)=>{const n=r(),o={[T]:"Shift",[L]:n?"Command":"Control",[j]:"Control",[P]:n?"Option":"Alt",",":(0,s.__)("Comma"),".":(0,s.__)("Period"),"`":(0,s.__)("Backtick"),"~":(0,s.__)("Tilde")};return[...e(r),t].map((e=>{var t;return l(null!==(t=o[e])&&void 0!==t?t:e)})).join(n?" ":" + ")}));const K=R(k,(e=>(t,r,n=u)=>{const o=e(n),i=function(e){return[P,j,L,T].filter((t=>e[`${t}Key`]))}(t),a={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=o.filter((e=>!i.includes(e))),l=i.filter((e=>!o.includes(e)));if(c.length>0||l.length>0)return!1;let s=t.key.toLowerCase();return r?(t.altKey&&1===r.length&&(s=String.fromCharCode(t.keyCode).toLowerCase()),t.shiftKey&&1===r.length&&a[t.code]&&(s=a[t.code]),"del"===r&&(r="delete"),s===r.toLowerCase()):o.includes(s)}));(window.wp=window.wp||{}).keycodes=t})();