You are on page 1of 5

!function(t,e){"object"==typeof exports&&"object"==typeof module?

module.exports=e():"function"==typeof define&&define.amd?
define([],e):"object"==typeof exports?exports.menuSurface=e():(t.mdc=t.mdc||
{},t.mdc.menuSurface=e())}(this,function(){return i={},o.m=n={0:function(t,e,n)
{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var
i=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!
0,configurable:!0}),Object.defineProperty(o,"strings",{get:function()
{return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"numbers",
{get:function(){return{}},enumerable:!0,configurable:!
0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!
0,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function()
{},o);function o(t){void
0===t&&(t={}),this.adapter_=t}e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use
strict";var i=this&&this.__read||function(t,e){var n="function"==typeof
Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void
0===e||0<e--)&&!(i=r.next()).done;)s.push(i.value)}catch(t)
{o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw
o.error}}return s},o=this&&this.__spread||function(){for(var
t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return
t};Object.defineProperty(e,"__esModule",{value:!0});var
r=n(0),s=(a.attachTo=function(t){return new a(t,new
r.MDCFoundation({}))},a.prototype.initialize=function(){for(var
t=[],e=0;e<arguments.length;e+
+)t[e]=arguments[e]},a.prototype.getDefaultFoundation=function(){throw new
Error("Subclasses must override getDefaultFoundation to return a properly
configured foundation class")},a.prototype.initialSyncWithDOM=function()
{},a.prototype.destroy=function()
{this.foundation_.destroy()},a.prototype.listen=function(t,e,n)
{this.root_.addEventListener(t,e,n)},a.prototype.unlisten=function(t,e,n)
{this.root_.removeEventListener(t,e,n)},a.prototype.emit=function(t,e,n){var i;void
0===n&&(n=!1),"function"==typeof CustomEvent?i=new CustomEvent(t,
{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!
1,e),this.root_.dispatchEvent(i)},a);function a(t,e){for(var
n=[],i=2;i<arguments.length;i++)n[i-
2]=arguments[i];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void
0===e?
this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}e.M
DCComponent=s,e.default=s},138:function(t,n,e){"use strict";function i(t){for(var e
in t)n.hasOwnProperty(e)||(n[e]=t[e])}var o=this&&this.__importStar||function(t)
{if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in
t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return
e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var
r=o(e(22));n.util=r,i(e(31)),i(e(9)),i(e(14))},14:function(t,e,n){"use strict";var
i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||
{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var
n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n()
{this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):
(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function()
{return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n+
+)for(var o in
e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return
t}).apply(this,arguments)},f=this&&this.__values||function(t){var
e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):
{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!
t}}}};Object.defineProperty(e,"__esModule",{value:!0});var
s,a=n(0),O=n(9),u=(s=a.MDCFoundation,o(c,s),Object.defineProperty(c,"cssClasses",
{get:function(){return O.cssClasses},enumerable:!0,configurable:!
0}),Object.defineProperty(c,"strings",{get:function(){return
O.strings},enumerable:!0,configurable:!0}),Object.defineProperty(c,"numbers",
{get:function(){return O.numbers},enumerable:!0,configurable:!
0}),Object.defineProperty(c,"Corner",{get:function(){return O.Corner},enumerable:!
0,configurable:!0}),Object.defineProperty(c,"defaultAdapter",{get:function()
{return{addClass:function(){},removeClass:function(){},hasClass:function(){return!
1},hasAnchor:function(){return!1},isElementInContainer:function(){return!
1},isFocused:function(){return!1},isRtl:function(){return!
1},getInnerDimensions:function()
{return{height:0,width:0}},getAnchorDimensions:function(){return
null},getWindowDimensions:function()
{return{height:0,width:0}},getBodyDimensions:function()
{return{height:0,width:0}},getWindowScroll:function()
{return{x:0,y:0}},setPosition:function(){},setMaxHeight:function()
{},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function()
{},notifyClose:function(){},notifyOpen:function(){}}},enumerable:!0,configurable:!
0}),c.prototype.init=function(){var t=c.cssClasses,e=t.ROOT,n=t.OPEN;if(!
this.adapter_.hasClass(e))throw new Error(e+" class required in root
element.");this.adapter_.hasClass(n)&&(this.isOpen_=!
0)},c.prototype.destroy=function()
{clearTimeout(this.openAnimationEndTimerId_),clearTimeout(this.closeAnimationEndTim
erId_),cancelAnimationFrame(this.animationRequestId_)},c.prototype.setAnchorCorner=
function(t){this.anchorCorner_=t},c.prototype.setAnchorMargin=function(t)
{this.anchorMargin_.top=t.top||0,this.anchorMargin_.right=t.right||
0,this.anchorMargin_.bottom=t.bottom||0,this.anchorMargin_.left=t.left||
0},c.prototype.setIsHoisted=function(t)
{this.isHoistedElement_=t},c.prototype.setFixedPosition=function(t)
{this.isFixedPosition_=t},c.prototype.setAbsolutePosition=function(t,e)
{this.position_.x=this.isFinite_(t)?t:0,this.position_.y=this.isFinite_(e)?
e:0},c.prototype.setQuickOpen=function(t)
{this.isQuickOpen_=t},c.prototype.isOpen=function(){return
this.isOpen_},c.prototype.open=function(){var
t=this;this.adapter_.saveFocus(),this.isQuickOpen_||
this.adapter_.addClass(c.cssClasses.ANIMATING_OPEN),this.animationRequestId_=reques
tAnimationFrame(function()
{t.adapter_.addClass(c.cssClasses.OPEN),t.dimensions_=t.adapter_.getInnerDimensions
(),t.autoPosition_(),t.isQuickOpen_?
t.adapter_.notifyOpen():t.openAnimationEndTimerId_=setTimeout(function()
{t.openAnimationEndTimerId_=0,t.adapter_.removeClass(c.cssClasses.ANIMATING_OPEN),t
.adapter_.notifyOpen()},O.numbers.TRANSITION_OPEN_DURATION)}),this.isOpen_=!
0},c.prototype.close=function(t){var e=this;void 0===t&&(t=!1),this.isQuickOpen_||
this.adapter_.addClass(c.cssClasses.ANIMATING_CLOSED),requestAnimationFrame(functio
n(){e.adapter_.removeClass(c.cssClasses.OPEN),e.isQuickOpen_?
e.adapter_.notifyClose():e.closeAnimationEndTimerId_=setTimeout(function()
{e.closeAnimationEndTimerId_=0,e.adapter_.removeClass(c.cssClasses.ANIMATING_CLOSED
),e.adapter_.notifyClose()},O.numbers.TRANSITION_CLOSE_DURATION)}),this.isOpen_=!
1,t||this.maybeRestoreFocus_()},c.prototype.handleBodyClick=function(t){var
e=t.target;this.adapter_.isElementInContainer(e)||
this.close()},c.prototype.handleKeydown=function(t){var e=t.keyCode;"Escape"!
==t.key&&27!==e||this.close()},c.prototype.autoPosition_=function(){var
t;this.measurements_=this.getAutoLayoutMeasurements_();var
e=this.getOriginCorner_(),n=this.getMenuSurfaceMaxHeight_(e),i=this.hasBit_(e,O.Cor
nerBit.BOTTOM)?"bottom":"top",o=this.hasBit_(e,O.CornerBit.RIGHT)?"right":"left",r=
this.getHorizontalOriginOffset_(e),s=this.getVerticalOriginOffset_(e),a=this.measur
ements_,u=a.anchorSize,c=a.surfaceSize,h=((t={})[o]=r,t[i]=s,t);u.width/
c.width>O.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),
(this.isHoistedElement_||
this.isFixedPosition_)&&this.adjustPositionForHoistedElement_(h),this.adapter_.setT
ransformOrigin(o+" "+i),this.adapter_.setPosition(h),this.adapter_.setMaxHeight(n?
n+"px":"")},c.prototype.getAutoLayoutMeasurements_=function(){var
t=this.adapter_.getAnchorDimensions(),e=this.adapter_.getBodyDimensions(),n=this.ad
apter_.getWindowDimensions(),i=this.adapter_.getWindowScroll();return{anchorSize:t=
t||
{top:this.position_.y,right:this.position_.x,bottom:this.position_.y,left:this.posi
tion_.x,width:0,height:0},bodySize:e,surfaceSize:this.dimensions_,viewportDistance:
{top:t.top,right:n.width-t.right,bottom:n.height-
t.bottom,left:t.left},viewportSize:n,windowScroll:i}},c.prototype.getOriginCorner_=
function(){var
t=O.Corner.TOP_LEFT,e=this.measurements_,n=e.viewportDistance,i=e.anchorSize,o=e.su
rfaceSize,r=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),s=r?
n.top+i.height+this.anchorMargin_.bottom:n.top+this.anchorMargin_.top,a=r?n.bottom-
this.anchorMargin_.bottom:n.bottom+i.height-this.anchorMargin_.top,u=o.height-
s,c=o.height-a;0<c&&u<c&&(t=this.setBit_(t,O.CornerBit.BOTTOM));var
h=this.adapter_.isRtl(),f=this.hasBit_(this.anchorCorner_,O.CornerBit.FLIP_RTL),d=t
his.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT),l=d&&!h||!d&&f&&h,_=l?
n.left+i.width+this.anchorMargin_.right:n.left+this.anchorMargin_.left,p=l?n.right-
this.anchorMargin_.right:n.right+i.width-this.anchorMargin_.left,m=o.width-
_,y=o.width-p;return(m<0&&l&&h||d&&!l&&m<0||
0<y&&m<y)&&(t=this.setBit_(t,O.CornerBit.RIGHT)),t},c.prototype.getMenuSurfaceMaxHe
ight_=function(t){var
e=this.measurements_.viewportDistance,n=0,i=this.hasBit_(t,O.CornerBit.BOTTOM),o=th
is.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),r=c.numbers.MARGIN_TO_EDGE;return
i?(n=e.top+this.anchorMargin_.top-r,o||(n+=this.measurements_.anchorSize.height)):
(n=e.bottom-this.anchorMargin_.bottom+this.measurements_.anchorSize.height-r,o&&(n-
=this.measurements_.anchorSize.height)),n},c.prototype.getHorizontalOriginOffset_=f
unction(t){var
e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.RIGHT),i=this.hasBit_(
this.anchorCorner_,O.CornerBit.RIGHT);if(n){var o=i?e.width-
this.anchorMargin_.left:this.anchorMargin_.right;return this.isHoistedElement_||
this.isFixedPosition_?o-(this.measurements_.viewportSize.width-
this.measurements_.bodySize.width):o}return i?e.width-
this.anchorMargin_.right:this.anchorMargin_.left},c.prototype.getVerticalOriginOffs
et_=function(t){var

e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.BOTTOM),i=this.hasBit_
(this.anchorCorner_,O.CornerBit.BOTTOM);return n?i?e.height-
this.anchorMargin_.top:-this.anchorMargin_.bottom:i?
e.height+this.anchorMargin_.bottom:this.anchorMargin_.top},c.prototype.adjustPositi
onForHoistedElement_=function(t){var
e,n,i=this.measurements_,o=i.windowScroll,r=i.viewportDistance,s=Object.keys(t);try
{for(var a=f(s),u=a.next();!u.done;u=a.next()){var c=u.value,h=t[c]||
0;h+=r[c],this.isFixedPosition_||("top"===c?h+=o.y:"bottom"===c?h-=o.y:"left"===c?
h+=o.x:h-=o.x),t[c]=h}}catch(t){e={error:t}}finally{try{u&&!
u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw
e.error}}},c.prototype.maybeRestoreFocus_=function(){var
t=this.adapter_.isFocused(),e=document.activeElement&&this.adapter_.isElementInCont
ainer(document.activeElement);(t||
e)&&this.adapter_.restoreFocus()},c.prototype.hasBit_=function(t,e){return
Boolean(t&e)},c.prototype.setBit_=function(t,e){return t|
e},c.prototype.isFinite_=function(t){return"number"==typeof
t&&isFinite(t)},c);function c(t){var e=s.call(this,r({},c.defaultAdapter,t))||
this;return e.isOpen_=!1,e.isQuickOpen_=!1,e.isHoistedElement_=!
1,e.isFixedPosition_=!
1,e.openAnimationEndTimerId_=0,e.closeAnimationEndTimerId_=0,e.animationRequestId_=
0,e.anchorCorner_=O.Corner.TOP_START,e.anchorMargin_={top:0,right:0,bottom:0,left:0
},e.position_={x:0,y:0},e}e.MDCMenuSurfaceFoundation=u,e.default=u},22:function(t,e
,n){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!
0}),e.getTransformPropertyName=function(t,e){if(void 0===e&&(e=!1),void 0===i||e)
{var n=t.document.createElement("div");i="transform"in
n.style?"transform":"webkitTransform"}return i}},31:function(t,e,n){"use
strict";var i,o=this&&this.__extends||(i=function(t,e)
{return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e)
{t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})
(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?
Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__importStar||
function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in
t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return
e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var
s,a=n(1),u=n(9),c=n(14),h=r(n(22)),f=(s=a.MDCComponent,o(d,s),d.attachTo=function(t
){return new d(t)},d.prototype.initialSyncWithDOM=function(){var
e=this,t=this.root_.parentElement;this.anchorElement=t&&t.classList.contains(u.cssC
lasses.ANCHOR)?
t:null,this.root_.classList.contains(u.cssClasses.FIXED)&&this.setFixedPosition(!
0),this.handleKeydown_=function(t){return
e.foundation_.handleKeydown(t)},this.handleBodyClick_=function(t){return
e.foundation_.handleBodyClick(t)},this.registerBodyClickListener_=function(){return
document.body.addEventListener("click",e.handleBodyClick_)},this.deregisterBodyClic
kListener_=function(){return
document.body.removeEventListener("click",e.handleBodyClick_)},this.listen("keydown
",this.handleKeydown_),this.listen(u.strings.OPENED_EVENT,this.registerBodyClickLis
tener_),this.listen(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_)},d.pr
ototype.destroy=function()
{this.unlisten("keydown",this.handleKeydown_),this.unlisten(u.strings.OPENED_EVENT,
this.registerBodyClickListener_),this.unlisten(u.strings.CLOSED_EVENT,this.deregist
erBodyClickListener_),s.prototype.destroy.call(this)},d.prototype.isOpen=function()
{return this.foundation_.isOpen()},d.prototype.open=function()
{this.foundation_.open()},d.prototype.close=function(t){void 0===t&&(t=!
1),this.foundation_.close(t)},Object.defineProperty(d.prototype,"quickOpen",
{set:function(t){this.foundation_.setQuickOpen(t)},enumerable:!0,configurable:!
0}),d.prototype.setIsHoisted=function(t)
{this.foundation_.setIsHoisted(t)},d.prototype.setMenuSurfaceAnchorElement=function
(t){this.anchorElement=t},d.prototype.setFixedPosition=function(t){t?
this.root_.classList.add(u.cssClasses.FIXED):this.root_.classList.remove(u.cssClass
es.FIXED),this.foundation_.setFixedPosition(t)},d.prototype.setAbsolutePosition=fun
ction(t,e){this.foundation_.setAbsolutePosition(t,e),this.setIsHoisted(!
0)},d.prototype.setAnchorCorner=function(t)
{this.foundation_.setAnchorCorner(t)},d.prototype.setAnchorMargin=function(t)
{this.foundation_.setAnchorMargin(t)},d.prototype.getDefaultFoundation=function()
{var n=this,t={addClass:function(t){return
n.root_.classList.add(t)},removeClass:function(t){return
n.root_.classList.remove(t)},hasClass:function(t){return
n.root_.classList.contains(t)},hasAnchor:function(){return!!
n.anchorElement},notifyClose:function(){return
n.emit(c.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT,{})},notifyOpen:function()
{return n.emit(c.MDCMenuSurfaceFoundation.strings.OPENED_EVENT,
{})},isElementInContainer:function(t){return n.root_.contains(t)},isRtl:function()
{return"rtl"===getComputedStyle(n.root_).getPropertyValue("direction")},setTransfor
mOrigin:function(t){var e=h.getTransformPropertyName(window)+"-
origin";n.root_.style.setProperty(e,t)},isFocused:function(){return
document.activeElement===n.root_},saveFocus:function()
{n.previousFocus_=document.activeElement},restoreFocus:function()
{n.root_.contains(document.activeElement)&&n.previousFocus_&&n.previousFocus_.focus
&&n.previousFocus_.focus()},getInnerDimensions:function()
{return{width:n.root_.offsetWidth,height:n.root_.offsetHeight}},getAnchorDimensions
:function(){return n.anchorElement?
n.anchorElement.getBoundingClientRect():null},getWindowDimensions:function()
{return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:funct
ion()
{return{width:document.body.clientWidth,height:document.body.clientHeight}},getWind
owScroll:function()
{return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(t)
{n.root_.style.left="left"in t?t.left+"px":"",n.root_.style.right="right"in t?
t.right+"px":"",n.root_.style.top="top"in t?
t.top+"px":"",n.root_.style.bottom="bottom"in t?
t.bottom+"px":""},setMaxHeight:function(t){n.root_.style.maxHeight=t}};return new
c.MDCMenuSurfaceFoundation(t)},d);function d(){return null!
==s&&s.apply(this,arguments)||this}e.MDCMenuSurface=f},9:function(t,e,n){"use
strict";Object.defineProperty(e,"__esModule",{value:!0});e.cssClasses={ANCHOR:"mdc-
menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-
closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--
fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};var
i={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSA
BLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-
disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:di
sabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(",
")};e.strings=i;var
o,r,s,a;e.numbers={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN
_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67},(r=o=o||{})
[r.BOTTOM=1]="BOTTOM",r[r.CENTER=2]="CENTER",r[r.RIGHT=4]="RIGHT",r[r.FLIP_RTL=8]="
FLIP_RTL",e.CornerBit=o,(a=s=s||{})
[a.TOP_LEFT=0]="TOP_LEFT",a[a.TOP_RIGHT=4]="TOP_RIGHT",a[a.BOTTOM_LEFT=1]="BOTTOM_L
EFT",a[a.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",a[a.TOP_START=8]="TOP_START",a[a.TOP_END=12
]="TOP_END",a[a.BOTTOM_START=9]="BOTTOM_START",a[a.BOTTOM_END=13]="BOTTOM_END",e.Co
rner=s}},o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,
{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof
Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,
{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!
0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof
e&&e&&e.__esModule)return e;var
n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!
0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return
e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function()
{return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e)
{return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=138);function o(t)
{if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return
n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i});

You might also like