UNPKG

coco-modal

Version:
1 lines 22.5 kB
"use strict";function _typeof(n){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_typeof(n)}!function(n,o){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(n=n||self,n.coco=o())}(void 0,function(){function n(){var n,o;return["r","webkitR","mozR","msR","O"].forEach(function(e){var t=e+"equestAnimationFrame";t in V&&!o&&(n=V[t],o=!0)}),n}function o(){var n=navigator.userAgent,o=n.indexOf("compatible")>-1&&n.indexOf("MSIE")>-1,e=n.indexOf("Edge")>-1&&!o,t=n.indexOf("Trident")>-1&&n.indexOf("rv:11.0")>-1;if(o){var i=new RegExp("MSIE (\\d+\\.\\d+);");i.test(n);var a=parseFloat(RegExp.$1);return 7==a?7:8==a?8:9==a?9:10==a?10:6}return e?"edge":t?11:100}function e(){return Date.now()}function t(n,o){function t(){e()-i<o?tn(t):!a.stop&&n()}var i=e(),a={stop:!1};return tn(t),a}function i(n){rn.x=n.clientX,rn.y=n.clientY,cn=e()}function a(n,o){var e="ok"==o;n.closeType=o;var t=Object.assign({},n);n.isLoading&&"ok"==o||(n.beforeCloseFn?n.beforeCloseFn.length<2?(n.beforeCloseFn(e),B(n)):2===n.beforeCloseFn.length?(n.beforeCloseFn(e,t),B(n)):n.beforeCloseFn(e,t,function(){B(n)}):B(n))}function r(){d(K,"click",i,!0),d(V,"keydown",function(){ln=e()},!0),d(V,"keyup",function(n){var o=dn.length;if("Escape"===n.code&&o){var e=dn[o-1];e.escClose&&(e.$el?e.close("esc"):a(e,"esc"))}}),d(V,"resize",function(){var n=null;dn.forEach(function(o){n=o.modal,j(n)})})}function c(n,o){var e=n.className||"";if(!l(e,o)){var t=e.split(/\s+/);t.push(o),n.className=t.join(" ")}}function l(n,o){return n.indexOf(o)>-1}function s(n,o){var e=n.className||"";if(l(e,o)){var t=e.split(/\s+/),i=t.indexOf(o);t.splice(i,1),n.className=t.join(" ")}""===n.getAttribute("class")&&n.removeAttribute("class")}function d(n,o,e,t){n.addEventListener(o,e,t)}function f(n,o){return V.getComputedStyle?getComputedStyle(n)[o]:n.currentStyle[o]}function p(){J.scrollHeight>window.CocoMask.offsetHeight&&"hidden"!==f(J,"overflowY")&&u(window.CocoMask.offsetWidth)}function u(n){var o=f(J,"width"),e=J.style.width,t=J.style.overflow,i=J.style.position;nn.position=i,nn.overflow=t,nn.width=e,o=n<parseFloat(o)?o:"calc(100% - ".concat(Q,"px)"),g(J,{position:""===i?"relative":i,overflow:"hidden",width:o})}function m(){g(J,{position:nn.position,overflow:"visible"===nn.overflow?"":nn.overflow,width:nn.width})}function h(){var n=G.createElement("div"),o=G.createElement("div"),e=0,t=0;return n.style.width="1000px",n.style.position="fixed",n.style.top="100%",n.style.overflow="scroll",o.style.width="100%",n.appendChild(o),J.appendChild(n),e=n.offsetWidth,t=o.offsetWidth,N(n),e-t}function g(n,o){for(var e in o)n.style[e]=o[e];""===n.getAttribute("style")&&n.removeAttribute("style")}function b(n){window.CocoMask||(window.CocoMask=sn({class:"coco-modal-mask blur","@click":function(){void 0!==("undefined"==typeof process?"undefined":_typeof(process))&&(N(window.CocoMask),window.CocoMask=null,dn=[],m())}}),n.mask=window.CocoMask,J.appendChild(window.CocoMask))}function w(){var n=dn.length;if(n){var o=dn[n-1]&&dn[n-1];o.inputEl&&o.inputEl.blur(),o.okButtonEl&&o.okButtonEl.blur()}}function v(n){var o=n.wrapper,e=n.modal,t=n.okButtonEl,i=n.destroy,r=n.el,c=n.inputAttrs;if(P(n),_(n),d(o,"scroll",function(t){k(n,o,e)}),c&&W(n),d(t,"keyup",function(o){"Enter"===o.code&&a(n,"ok")}),r){var l=fn[r];if(!l){try{l=void 0===r.tagName?G.querySelector(r):r}catch(n){throw new Error(n)}fn[r]=l}i&&(l=l.cloneNode(!0)),g(l,{display:""}),n.domEl.appendChild(l)}var s=sn({});n.div=s,s.appendChild(o),J.appendChild(s),g(o,{display:"none"}),O(n)}function k(n,o,e){var t=o.scrollLeft-n.scrollLeft,i=o.scrollTop-n.scrollTop,a=n.originX+t,r=n.originY+i,c=a+"px "+r+"px";j(e,c)}function y(n){g(n,{display:""}),g(window.CocoMask,{display:""})}function x(n,o){n?(c(window.CocoMask,"blur"),c(o,"coco-no-shadow")):(window.CocoMask&&s(window.CocoMask,"blur"),o&&s(o,"coco-no-shadow"))}function C(n){dn.push(n)}function E(n,o,e){e=e?"enter":"leave",c(n,o+"-"+e),c(n,o+"-"+e+"-active")}function M(n,o,e){e=e?"enter":"leave",s(n,o+"-"+e),s(n,o+"-"+e+"-active")}function z(n){var o=n.wrapper,e=n.zIndexOfMask,t=n.zIndexOfActiveModal;g(o,{zIndex:t}),g(window.CocoMask,{zIndex:e})}function O(n){var o=n.wrapper,e=n.modal,i=n.blur,a=n.modalContent,r=n.animation,c=n.onMount,l=n.notMount,d=n.fullScreen,f=n.hooks,u=n.inputAttrs;if(o){s(o,"coco-p-e-n"),G||(G=V.document,J=G.body,K=G.documentElement),!n.isOpen&&S(n);var m=en(r)?300:0;n.isOpen=!0,b(n),z(n),x(i,a),w(),C(n),dn.length>1&&R(),y(o),p(),n.scrollTop=o.scrollTop,n.scrollLeft=o.scrollLeft,1===dn.length&&r&&E(window.CocoMask,"fade",!0),u&&(n.inputValue=n.inputEl.value||""),d&&Z(n),F(e,a),H(n),r&&L(n,e),r&&E(e,"zoom",!0),l&&c&&c(n),n.notMount=!1,f&&f.open&&f.open(n),n.rafTimerOpen=t(function(){M(e,"zoom",!0),M(window.CocoMask,"fade",!0),f&&f.opened&&f.opened(n)},m)}}function T(n){an(n.rafTimerOpen),M(n.modal,"zoom",!0),M(window.CocoMask,"fade",!0)}function B(n){var o=n,e=o.wrapper,i=o.modal,a=o.isOpen,r=o.destroy,l=o.div,s=o.animation,d=o.args,f=o.hooks,p=o.$el;if(e){var u=en(s)?200:0;a&&T(n),n.isOpen=!1,c(e,"coco-p-e-n"),I(n,dn),s&&E(i,"zoom"),dn.length||s&&E(window.CocoMask,"fade"),f&&f.close&&f.close(n),n.rafTimerClose=t(function(){if(dn.length>0&&R(),M(i,"zoom"),M(window.CocoMask,"fade"),dn.length||(r?(J.contains(window.CocoMask)&&N(window.CocoMask),window.CocoMask=null):g(window.CocoMask,{display:"none"}),m()),f&&f.closed&&f.closed(n),r&&!p){for(var o in J.contains(l)&&N(l),I({a:n,args:d},un,!0),n)n.hasOwnProperty(o)&&(n[o]=null,delete n[o]);n=null}else g(e,{display:"none"})},u)}}function S(n){var o=n,e=o.modal,t=o.destroy,i=o.$el,a=o.args,r=o.div;if(window.CocoMask&&(an(n.rafTimerClose),dn.length>0&&R(),M(e,"zoom"),M(window.CocoMask,"fade"),dn.length||(t?(J.contains(window.CocoMask)&&N(window.CocoMask),window.CocoMask=null):g(window.CocoMask,{display:"none"}),m()),t&&!i)){for(var c in J.contains(r)&&N(r),I({a:n,args:a},un,!0),n)n.hasOwnProperty(c)&&(n[c]=null,delete n[c]);n=null}}function F(n,o){var e=o.offsetHeight+o.offsetTop>window.CocoMask.offsetHeight;e&&g(n,{paddingBottom:"30px"})}function I(n,o,e){var t=0;return e?o.forEach(function(e,i){e.a===n.a&&(t=i,o.splice(t,1))}):o.forEach(function(e,i){e===n&&(t=i,o.splice(t,1))}),t}function j(n,o){var e=n.style;o=o||"",["t","webkitT","MozT","msT","OT"].forEach(function(n){n+"ransformOrigin"in e&&(e[n+"ransformOrigin"]=o)})}function A(n){var o=n.getBoundingClientRect();return{left:o.left,top:o.top}}function L(n,o){var t=e()-cn<120,i=Math.abs(cn-ln)>=60;if(t&&i){var a=A(o),r=a.left,c=a.top,l=rn.x-r,s=rn.y-c,d=l+"px "+s+"px";n.originX=l,n.originY=s,j(o,d)}else j(o)}function H(n){var o=n.top,e=n.modal,t=n.fullScreen;if("center"===o){var i=window.CocoMask.offsetHeight;o=(i-e.offsetHeight)/2,o=o>=30?o:30,o+="px",g(e,{marginTop:o})}else!t&&g(e,{marginTop:o})}function Z(n){var o=n.bodyEl,e=n.headerEl,t=n.footerEl,i=n.modal,a=n.modalContent,r=0;g(i,{width:"100%",height:"100%",marginTop:"0px",padding:0}),g(a,{borderRadius:0}),r=window.CocoMask.offsetHeight-(e?e.offsetHeight:0)-(t?t.offsetHeight:0)-1+"px",g(o,{height:r})}function R(){var n;dn.forEach(function(o,e){n=o,o=o.wrapper,e===dn.length-1?g(o,{zIndex:n.zIndexOfActiveModal}):g(o,{zIndex:n.zIndexOfModal})})}function _(n){var o=n.headerEl,e=n.footerEl,t=n.inputWrapper,i=n.htmlEl,a=n.html,r=n.okButtonEl,c=n.cancelButtonEl,l=n.okButton,s=n.cancelButton,d=n.header,f=n.footer,p=n.inputAttrs,u=n.closeButton,m=n.closeButtonEl,h=n.el,g=n.domEl;!h&&N(g),!d&&N(o),!f&&N(e),!p&&N(t),!l&&N(r),!s&&N(c),!u&&N(m),!a&&N(i)}function N(n){n.parentNode.removeChild(n)}function P(n){var o=n.modal,e=n.okButtonSpan,t=n.cancelButtonSpan,i=n.okText,a=n.cancelText,r=n.textEl,c=n.text,l=n.htmlEl,s=n.html,d=n.title,f=n.titleSpan,p=n.borderRadius,u=n.okButtonEl,m=n.buttonColor,h=n.top,b=n.width,w=n.errorEl;g(o,{marginTop:h,width:b,borderRadius:p}),g(u,{backgroundColor:m}),n.errorText="",n.setErrorText=function(o){w.innerText=o,n.errorText=o},f.innerText=d,r.innerText=c,l.innerHTML=s,e.innerText=i,t.innerText=a}function W(n){var o=n.inputEl,e=n.inputAttrs;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];o.setAttribute(t,i)}d(o,"input",function(o){n.inputValue=o.target.value}),d(o,"keyup",function(o){"Enter"===o.code&&a(n,"ok")})}function U(n){if(V.CocoConfig)for(var o in X)void 0!==V.CocoConfig[o]&&(X[o]=V.CocoConfig[o]);for(var e in X)X.hasOwnProperty(e)&&void 0===n[e]&&(n[e]=X[e])}function Y(n,o){var e=!0;if(Object.keys(n).length!==Object.keys(o).length)return!1;for(var t in n)if("object"===_typeof(n[t])&&"object"===_typeof(o[t])){if(e=Y(n[t],o[t]),!e)return!1}else if("function"==typeof n[t]&&"function"==typeof o[t]){if(n[t].toString()!=o[t].toString())return!1}else if(n[t]!=o[t])return!1;return e}function $(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t={},i=arguments.length;"object"===_typeof(n)?e=n:(n=n.toString(),"string"==typeof o?e.title=o:"object"===_typeof(o)&&(e=o),e.text=n),arguments.length>1&&"alert"===arguments[i-1]?(e.cancelButton=!1,e.maskClose=!1,e.closeButton=!1):arguments.length>1&&"confirm"===arguments[i-1]&&(e.maskClose=!1,e.closeButton=!1),t=e,e=Object.assign({},e);for(var r=0;r<un.length;r++)if(Y(e,un[r].args))return un[r].a.openModal(),un[r].a;return un.push({args:e,a:t}),t.args=e,t.isLoading=!1,t.notMount=!0,t.isOpen=!0,t.scrollbarWidth=Q,U(t),t.close=function(n){n=n||"closeFunction",a(t,n)},t.openModal=function(){O(t)},t.onClose=function(n){return t.beforeCloseFn=n,t},t.destroyModal=function(){t.destroy=!0},pn(t),v(t),d(t.okButtonEl,"click",function(){a(t,"ok")}),d(t.okButtonEl,"keypress",function(n){n.preventDefault()}),d(t.cancelButtonEl,"click",function(){a(t,"cancel")}),t.showLoading=function(){t.isLoading=!0,c(t.okButtonEl,"coco-is-loading"),t.loadingEl&&(t.loadingEl.style.display="inline-block")},t.hideLoading=function(){t.isLoading=!1,s(t.okButtonEl,"coco-is-loading"),t.loadingEl&&(t.loadingEl.style.display="none")},t}function q(){mn||(G=V.document,J=G.body,K=G.documentElement,D(),Q=h(),mn=!0)}function D(){if(G&&G.head){var n=G.head,o=G.createElement("style"),e='\n@-webkit-keyframes coco-loading {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes coco-loading {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n@-webkit-keyframes cocoFadeIn {\n 0% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes cocoFadeIn {\n 0% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@-webkit-keyframes cocoFadeOut {\n 0% {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@keyframes cocoFadeOut {\n 0% {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@-webkit-keyframes cocoZoomIn {\n 0% {\n transform: scale3d(0.25, 0.25, 0.25);\n opacity: 0;\n }\n to {\n transform: scale3d(1, 1, 1);\n opacity: 1;\n }\n}\n@keyframes cocoZoomIn {\n 0% {\n transform: scale3d(0.25, 0.25, 0.25);\n opacity: 0;\n }\n to {\n transform: scale3d(1, 1, 1);\n opacity: 1;\n }\n}\n@-webkit-keyframes cocoZoomOut {\n 0% {\n transform: scale3d(1, 1, 1);\n opacity: 1;\n }\n to {\n transform: scale3d(0, 0, 0);\n opacity: 0;\n }\n}\n@keyframes cocoZoomOut {\n 0% {\n transform: scale3d(1, 1, 1);\n opacity: 1;\n }\n to {\n transform: scale3d(0, 0, 0);\n opacity: 0;\n }\n}\n[class|="coco"],\n[class|="coco"]::after,\n[class|="coco"]::before {\n box-sizing: border-box;\n outline: 0;\n}\n.coco-modal-mask,\n.coco-modal-wrapper {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.coco-modal-wrapper {\n right: 0;\n bottom: 0;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n z-index: 2020;\n}\n.coco-modal-mask {\n background-color: rgba(0, 0, 0, 0.425);\n z-index: 2008;\n}\n.coco-modal-mask.blur {\n -webkit-backdrop-filter: blur(5px);\n backdrop-filter: blur(5px);\n background-color: rgba(0, 0, 0, 0.5);\n}\n.coco-modal {\n position: relative;\n margin: 0 auto;\n margin-top:15vh;\n top: 0;\n width: 500px;\n transform: translateZ(0);\n line-height: 1.66667;\n list-style: none;\n font-size: 14px;\n}\n.coco-modal-content {\n border-radius: 5px;\n box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.05), 0 0 4px 0 rgba(0, 0, 0, 0.08);\n background-color: #fff;\n}\n.coco-modal-content.coco-no-shadow {\n box-shadow: none;\n}\n.fade-enter,\n.fade-leave {\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-animation-play-state: paused;\n animation-play-state: paused;\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n -webkit-animation-duration: 0.14s;\n animation-duration: 0.14s;\n transition: none;\n pointer-events: none;\n transform: translateZ(0);\n will-change: opacity;\n}\n.fade-enter {\n opacity: 0;\n}\n.fade-leave {\n -webkit-animation-delay: 0.08s;\n animation-delay: 0.08s;\n}\n.fade-enter.fade-enter-active {\n -webkit-animation-name: cocoFadeIn;\n animation-name: cocoFadeIn;\n -webkit-animation-play-state: running;\n animation-play-state: running;\n}\n.fade-leave.fade-leave-active,\n.zoom-enter.zoom-enter-active,\n.zoom-leave.zoom-leave-active {\n -webkit-animation-name: cocoFadeOut;\n animation-name: cocoFadeOut;\n -webkit-animation-play-state: running;\n animation-play-state: running;\n}\n.zoom-enter {\n -webkit-animation-duration: 0.3s;\n animation-duration: 0.3s;\n}\n.zoom-enter,\n.zoom-leave {\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-animation-play-state: paused;\n animation-play-state: paused;\n transition: none;\n pointer-events: none;\n transform: translateZ(0);\n will-change: opacity, transform;\n}\n.zoom-enter {\n -webkit-animation-delay: 0.08s;\n animation-delay: 0.08s;\n opacity: 0;\n -webkit-animation-timing-function: cubic-bezier(0.08, 0.8, 0.18, 1);\n animation-timing-function: cubic-bezier(0.08, 0.8, 0.18, 1);\n}\n.zoom-enter.zoom-enter-active,\n.zoom-leave.zoom-leave-active {\n -webkit-animation-name: cocoZoomIn;\n animation-name: cocoZoomIn;\n}\n.zoom-leave {\n -webkit-animation-duration: 0.28s;\n animation-duration: 0.28s;\n -webkit-animation-timing-function: cubic-bezier(0.52, 0.3, 0.06, 1);\n animation-timing-function: cubic-bezier(0.52, 0.3, 0.06, 1);\n}\n.zoom-leave.zoom-leave-active {\n -webkit-animation-name: cocoZoomOut;\n animation-name: cocoZoomOut;\n}\n\n.coco-modal-close {\n position: absolute;\n width: 26px;\n height: 26px;\n width: 20px;\n height: 20px;\n right: 15px;\n top: 17px;\n z-index: 1;\n cursor: pointer;\n}\n.coco-modal-close:hover::before,\n.coco-modal-close:hover::after {\n background-color: #646464;\n}\n\n.coco-modal-close:active::before,\n.coco-modal-close:active::after {\n background-color: #010000; \n}\n.coco-modal-close::after,\n.coco-modal-close::before {\n content: "";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%) rotate(-45deg) scale(1);\n width: 1px;\n height: 14px;\n background-color: #787878;\n transition: all 0.15s ease-out;\n display: block;\n border-radius: 2px;\n}\n.coco-modal-close::after {\n transform: translate(-50%, -50%) rotate(45deg) scale(1);\n}\n.coco-modal-close:hover::after,\n.coco-modal-close:hover::before {\n background-color: #646464;\n}\n.coco-modal-close:active::after,\n.coco-modal-close:active::before {\n background-color: #010000;\n}\n.coco-modal-body,\n.coco-modal-header {\n position: relative;\n font-size: 18px;\n color: #111;\n text-align: left;\n}\n.coco-modal-body {\n padding: 22px 18px;\n font-size: 14px;\n color: #646466;\n overflow: auto;\n}\n.coco-modal-header {\n height: 60px;\n padding: 0 18px;\n}\n.coco-modal-header::before {\n content: "";\n display: inline-block;\n vertical-align: middle;\n height: 100%;\n}\n.coco-modal-title {\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n vertical-align: middle;\n width: 100%;\n display: inline-block;\n}\n.coco-modal-footer {\n position: relative;\n text-align: right;\n padding: 15px 18px;\n}\n.coco-btn {\n font-size: 14px;\n text-decoration: none;\n padding: 6px 20px;\n white-space: nowrap;\n border-radius: 5px;\n font-weight: 500;\n display: inline-block;\n cursor: pointer;\n border: 0;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n line-height: normal;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.coco-btn.cancel {\n margin-right: 10px;\n color: #525456;\n background-color: transparent;\n font-weight: 500;\n transition: all 0.06s ease-out;\n}\n\n.coco-btn,\n.coco-btn span,\n.coco-loading {\n position: relative;\n}\n.coco-btn.ok {\n background-color: #0077ff;\n color: #fefefe;\n}\n.coco-btn.ok::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n transition: all 0.12s ease-out;\n background-color: transparent;\n}\n.coco-btn.ok:hover::before {\n background-color: rgba(255, 255, 255, 0.08);\n}\n.coco-btn.ok:active::before {\n transition: all 80ms ease-out;\n background-color: rgba(0, 0, 0, 0.2);\n}\n.coco-btn.ok.coco-is-loading::before {\n background-color: transparent;\n}\n.coco-loading {\n width: 14px;\n height: 14px;\n border: 2px solid #fff;\n border-top: 2px solid transparent;\n border-radius: 7px;\n margin-right: 7px;\n display: none;\n -webkit-animation: coco-loading 1s linear infinite;\n animation: coco-loading 1s linear infinite;\n}\n.coco-is-loading {\n cursor: not-allowed;\n}\n.coco-hidden {\n visibility: hidden;\n}\n\n.coco-input {\n margin: 14px 0;\n width: 100%;\n height: 38px;\n border-radius: 5px;\n padding: 6px 15px;\n font-weight: 400;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n color: #212122;\n background-color: #f3f3f3;\n border: 1px solid transparent;\n font-size: 14px;\n box-shadow: 0 0 0 0 rgba(88, 161, 245, 0.2);\n line-height: normal;\n transition: all 0.1s ease-out;\n}\n.coco-input::-webkit-input-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input::-moz-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input:-ms-input-placeholder,\n.coco-input::-ms-input-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input::-webkit-input-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input::-moz-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input:-ms-input-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input::-ms-input-placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input::placeholder {\n line-height: 24px;\n color: #a2a2a3;\n}\n.coco-input:hover {\n background-color: #efefef;\n}\n.coco-input:focus {\n transition: all 0.2s ease;\n background-color: #fff;\n box-shadow: 0 0 0 2px rgba(88, 161, 245, 0.2);\n border-color: rgba(66, 133, 255, 0.5);\n}\n.coco-input:active {\n transition: all 0.1s ease;\n background-color: #fff;\n border-color: #cecece;\n box-shadow: 0 0 0 0 rgba(88, 161, 245, 0.2);\n}\n.coco-error-text {\n font-size: 14px;\n color: #e71e63;\n margin: 5px 10px;\n}\n\n';r(),o.innerHTML=e,n.children.length?n.insertBefore(o,n.children[0]):n.appendChild(o)}}var X={visible:!1,maskClose:!0,header:!0,footer:!0,title:"提示",text:"",width:"",top:"",inputAttrs:!1,escClose:!0,okButton:!0,cancelButton:!0,okText:"确定",cancelText:"取消",closeButton:!0,zIndexOfModal:1995,zIndexOfMask:2008,zIndexOfActiveModal:2020,autoFocusOkButton:!0,autoFocusInput:!0,fullScreen:!1,borderRadius:"",blur:!1,buttonColor:"",hooks:{},destroy:!1,animation:!0,onClose:null},V=window,G=null,J=null,K=null,Q=0,nn={},on=void 0!==V,en=function(n){return o()>9&&n};"function"!=typeof Object.assign&&(Object.assign=function(n){if(null==n)throw new TypeError("Cannot convert undefined or null to object");n=Object(n);for(var o=1;o<arguments.length;o++){var e=arguments[o];if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n});var tn=on?n()?n().bind(V):setTimeout:function(n){return n()},an=function(n){n&&(n.stop=!0)};t=V.requestAnimationFrame?t:V.setTimeout;var rn={},cn=0,ln=0,sn=function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],e=n.el;for(var t in e=G.createElement(n.el||"div"),delete n.el,n)if("is"!==t){if(n.hasOwnProperty(t)){var i=n[t];if("@"===t[0]){var a=t.slice(1);d(e,a,i)}else e.setAttribute(t,i)}}else{var r=n[t];r[0][r[1]]=e}if("object"===_typeof(o))for(var c=0;c<o.length;c++){var l=o[c];e.appendChild(l)}return e},dn=[],fn={},pn=function(n){var o=sn({class:"coco-modal-wrapper",role:"dialog-wrapper",tabindex:"-1","@click":function(e){2===n.notMouseUp&&n.maskClose&&e.target===o&&a(n,"mask"),n.notMouseUp=0},"@mousedown":function(e){n.notMouseUp=0,n.maskClose&&e.target===o&&n.notMouseUp++},"@mouseup":function(e){n.maskClose&&e.target===o&&n.notMouseUp++},is:[n,"wrapper"]},[sn({class:"coco-modal",role:"dialog",is:[n,"modal"]},[sn({class:"coco-modal-content",is:[n,"modalContent"]},[sn({class:"coco-modal-close","@click":function(){a(n,"closeButton")},is:[n,"closeButtonEl"]}),sn({class:"coco-modal-header",is:[n,"headerEl"]},[sn({class:"coco-modal-title",is:[n,"titleEl"]},[sn({el:"span",is:[n,"titleSpan"]})])]),sn({class:"coco-modal-body",is:[n,"bodyEl"]},[sn({el:"span",is:[n,"textEl"]}),sn({is:[n,"htmlEl"]}),sn({class:"coco-input-wrapper",is:[n,"inputWrapper"]},[sn({},[sn({el:"input",class:"coco-input",is:[n,"inputEl"]})])]),sn({},[sn({class:"",is:[n,"domEl"]})]),sn({},[sn({class:"coco-error-text",is:[n,"errorEl"]})])]),sn({class:"coco-modal-footer",is:[n,"footerEl"]},[sn({el:"button",class:"coco-btn cancel",is:[n,"cancelButtonEl"]},[sn({el:"span",is:[n,"cancelButtonSpan"]})]),sn({el:"button",class:"coco-btn ok",is:[n,"okButtonEl"]},[sn({el:"span",class:"coco-loading",style:"display:none",is:[n,"loadingEl"]}),sn({el:"span",is:[n,"okButtonSpan"]})])])])])])},un=[];$.alert=function(n,o,e){return $(n,o,e,"alert")},$.confirm=function(n,o,e){return $(n,o,e,"confirm")},d(V,"DOMContentLoaded",function(){q()});var mn=!1;return $});