urbit/web/landscape/js/index-min.js

1 line
1021 KiB
JavaScript
Raw Normal View History

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define("index",t):t()}(0,function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}function a(e){return e&&e.default||e}var i=n(function(e){!function(t,r,n){if(t){for(var a,i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},o={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},s={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},l={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u=1;u<20;++u)i[111+u]="f"+u;for(u=0;u<=9;++u)i[u+96]=u.toString();m.prototype.bind=function(e,t,r){return e=e instanceof Array?e:[e],this._bindMultiple.call(this,e,t,r),this},m.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},m.prototype.trigger=function(e,t){return this._directMap[e+":"+t]&&this._directMap[e+":"+t]({},e),this},m.prototype.reset=function(){return this._callbacks={},this._directMap={},this},m.prototype.stopCallback=function(e,t){return!((" "+t.className+" ").indexOf(" mousetrap ")>-1)&&(!function e(t,n){return null!==t&&t!==r&&(t===n||e(t.parentNode,n))}(t,this.target)&&("INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable))},m.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},m.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);a=null},m.init=function(){var e=m(r);for(var t in e)"_"!==t.charAt(0)&&(m[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},m.init(),t.Mousetrap=m,e.exports&&(e.exports=m)}function c(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r)}function f(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:o[e.which]?o[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function h(e,t,r){return r||(r=function(){if(!a)for(var e in a={},i)e>95&&e<112||i.hasOwnProperty(e)&&(a[i[e]]=e);return a}()[e]?"keydown":"keypress"),"keypress"==r&&t.length&&(r="keydown"),r}function p(e,t){var r,n,a,i=[];for(r=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),a=0;a<r.length;++a)n=r[a],l[n]&&(n=l[n]),t&&"keypress"!=t&&s[n]&&(n=s[n],i.push("shift")),d(n)&&i.push(n);return{key:n,modifiers:i,action:t=h(n,i,t)}}function m(e){var t=this;if(e=e||r,!(t instanceof m))return new m(e);t.target=e,t._callbacks={},t._directMap={};var n,a={},i=!1,o=!1,s=!1;function l(e){e=e||{};var t,r=!1;for(t in a)e[t]?r=!0:a[t]=0;r||(s=!1)}function u(e,r,n,i,o,s){var l,u,c,f,h=[],p=n.type;if(!t._callbacks[e])return[];for("keyup"==p&&d(e)&&(r=[e]),l=0;l<t._callbacks[e].length;++l)if(u=t._callbacks[e][l],(i||!u.seq||a[u.seq]==u.level)&&p==u.action&&("keypress"==p&&!n.metaKey&&!n.ctrlKey||(c=r,f=u.modifiers,c.sort().join(",")===f.sort().join(",")))){var m=!i&&u.combo==o,b=i&&u.seq==i&&u.level==s;(m||b)&&t._callbacks[e].splice(l,1),h.push(u)}return h}function h(e,r,n,a){t.stopCallback(r,r.target||r.srcElement,n,a)||!1===e(r,n)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(r),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(r))}function b(e){"number"!=typeof e.which&&(e.which=e.keyCode);var r=f(e);r&&("keyup"!=e.type||i!==r?t.han