lu2
Version:
Simple and flexible UI component library based on native HTML and JavaScript
17 lines • 27.8 kB
JavaScript
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
"document"in self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&function(e){"use strict";if("Element"in e){var t="classList",n=e.Element.prototype,r=Object,o=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},i=Array.prototype.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},s=function(e,t){if(""===t)throw new a("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","The token must not contain space characters.");return i.call(e,t)},c=function(e){for(var t=o.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],r=0,i=n.length;r<i;r++)this.push(n[r]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},l=c.prototype=[],u=function(){return new c(this)};if(a.prototype=Error.prototype,l.item=function(e){return this[e]||null},l.contains=function(e){return~s(this,e+"")},l.add=function(){var e,t=arguments,n=0,r=t.length,o=!1;do{e=t[n]+"",~s(this,e)||(this.push(e),o=!0)}while(++n<r);o&&this._updateClassName()},l.remove=function(){var e,t,n=arguments,r=0,o=n.length,i=!1;do{for(e=n[r]+"",t=s(this,e);~t;)this.splice(t,1),i=!0,t=s(this,e)}while(++r<o);i&&this._updateClassName()},l.toggle=function(e,t){var n=this.contains(e),r=n?!0!==t&&"remove":!1!==t&&"add";return r&&this[r](e),!0===t||!1===t?t:!n},l.replace=function(e,t){var n=s(e+"");~n&&(this.splice(n,1,t),this._updateClassName())},l.toString=function(){return this.join(" ")},r.defineProperty){var d={get:u,enumerable:!0,configurable:!0};try{r.defineProperty(n,t,d)}catch(e){void 0!==e.number&&-2146823252!==e.number||(d.enumerable=!1,r.defineProperty(n,t,d))}}else r.prototype.__defineGetter__&&n.__defineGetter__(t,u)}}(self),function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var n,r=arguments.length;for(n=0;n<r;n++)e=arguments[n],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:n.call(this,e)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(e,t){var n=this.toString().split(" "),r=n.indexOf(e+"");1*r&&(n=n.slice(r),this.remove.apply(this,n),this.add(t),this.add.apply(this,n.slice(1)))}),e=null}()),document.documentElement.dataset||Object.defineProperty(HTMLElement.prototype,"dataset",{get:function(){for(var e=this.attributes,t={},n=e.length-1;n>=0;n--)t[e[n].name]=e[n].value;return t},set:function(){}}),window.SVGElementInstance&&(SVGElementInstance.prototype.getAttribute=function(e){if(this.correspondingUseElement)return this.correspondingUseElement.getAttribute(e)}),function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),n=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(n[Symbol.iterator]=function(){return n}),n},r=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},o=function(e){return decodeURIComponent(String(e).replace(/\+/g," "))};(function(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set}catch(e){return!1}})()||function(){var o=function(e){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var t=typeof e;if("undefined"===t);else if("string"===t)""!==e&&this._fromString(e);else if(e instanceof o){var n=this;e.forEach((function(e,t){n.append(t,e)}))}else{if(null===e||"object"!==t)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(e))for(var r=0;r<e.length;r++){var i=e[r];if("[object Array]"!==Object.prototype.toString.call(i)&&2===i.length)throw new TypeError("Expected [string, any] as entry at index "+r+" of URLSearchParams's input");this.append(i[0],i[1])}else if(e instanceof FormData&&e._data)for(var a in e._data)e._data.hasOwnProperty(a)&&this.append(a,e._data[a]);else for(var s in e)e.hasOwnProperty(s)&&this.append(s,e[s])}},i=o.prototype;i.append=function(e,t){e in this._entries?this._entries[e].push(String(t)):this._entries[e]=[String(t)]},i.delete=function(e){delete this._entries[e]},i.get=function(e){return e in this._entries?this._entries[e][0]:null},i.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},i.has=function(e){return e in this._entries},i.set=function(e,t){this._entries[e]=[String(t)]},i.forEach=function(e,t){var n;for(var r in this._entries)if(this._entries.hasOwnProperty(r)){n=this._entries[r];for(var o=0;o<n.length;o++)e.call(t,n[o],r,this)}},i.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),n(e)},i.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),n(e)},i.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),n(e)},t&&(i[Symbol.iterator]=i.entries),i.toString=function(){var e=[];return this.forEach((function(t,n){e.push(r(n)+"="+r(t))})),e.join("&")},e.URLSearchParams=o}();var i=e.URLSearchParams.prototype;"function"!=typeof i.sort&&(i.sort=function(){var e=this,t=[];this.forEach((function(n,r){t.push([r,n]),e._entries||e.delete(r)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var n=0;n<t.length;n++)this.append(t[n][0],t[n][1])}),"function"!=typeof i._fromString&&Object.defineProperty(i,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach((function(e,n){t.push(n)}));for(var n=0;n<t.length;n++)this.delete(t[n])}for(var r,i=(e=e.replace(/^\?/,"")).split("&"),a=0;a<i.length;a++)r=i[a].split("="),this.append(o(r[0]),r.length>1?o(r[1]):"")}})}("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this),function(e){var t,n,r;if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c%20d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||(t=e.URL,r=(n=function(t,n){"string"!=typeof t&&(t=String(t));var r,o=document;if(n&&(void 0===e.location||n!==e.location.href)){(r=(o=document.implementation.createHTMLDocument("")).createElement("base")).href=n,o.head.appendChild(r);try{if(0!==r.href.indexOf(n))throw new Error(r.href)}catch(e){throw new Error("URL unable to set base "+n+" due to "+e)}}var i=o.createElement("a");if(i.href=t,r&&(o.body.appendChild(i),i.href=i.href),":"===i.protocol||!/:/.test(i.href))throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:i});var a=new e.URLSearchParams(this.search),s=!0,c=!0,l=this;["append","delete","set"].forEach((function(e){var t=a[e];a[e]=function(){t.apply(a,arguments),s&&(c=!1,l.search=a.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:a,enumerable:!0});var u=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==u&&(u=this.search,c&&(s=!1,this.searchParams._fromString(this.search),s=!0))}})}).prototype,["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(r,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(r,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(r,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(e){},enumerable:!0},username:{get:function(){return""},set:function(e){},enumerable:!0}}),n.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},n.revokeObjectURL=function(e){return t.revokeObjectURL.apply(t,arguments)},e.URL=n),void 0!==e.location&&!("origin"in e.location)){var o=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:o,enumerable:!0})}catch(t){setInterval((function(){e.location.origin=o()}),100)}}}("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this),
/*
* @preserve FormData polyfill for IE < 10. See https://developer.mozilla.org/en/docs/Web/API/FormData and http://caniuse.com/#search=formdata
*
* @author ShirtlessKirk copyright 2015
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
function(e,t){"use strict";"function"==typeof define&&define.amd?define((function(){return t(e)})):"function"==typeof module&&module.exports?module.exports=t(e):t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this,(function(e){"use strict";var t,n,r,o,i,a=Math;function s(e){return this._data.hasOwnProperty(e)}function c(e){return this._data[e]||null}function l(e){var t,n,r,o,i,a,s,c=this;for(n=0,o=e.length;n<o;n+=1)if((a=(t=e[n]).name||t.id)&&!t.disabled)switch(t.type){case"checkbox":t.checked&&c.append(a,t.value||"on");break;case"image":c.append(a+".x",t.x||0),c.append(a+".y",t.y||0);break;case"radio":t.checked&&c.set(a,t.value);break;case"select-one":-1!==t.selectedIndex&&c.append(a,t.options[t.selectedIndex].value);break;case"select-multiple":for(r=0,i=t.options.length;r<i;r+=1)(s=t.options[r]).selected&&c.append(a,s.value);break;case"file":case"reset":case"submit":break;default:c.append(a,t.value)}}function u(e){var t,n,r=this;if(!(r instanceof u))return new u(e);(!e||e.tagName&&"FORM"===e.tagName)&&(r._boundary=(t=a.random,n=t()*a.pow(10,1+(12*t()|0)),"----------------FormData-"+(t()*n).toString(36)),r._data={},e&&l.call(r,e.children))}for(n in r={append:function(e,t){var n=this;s.call(n,e)||(n._data[e]=[]),n._data[e].push(t)},get:function(e){var t=c.call(this,e);return t?t[0]:null},getAll:c,has:s,set:function(e,t){this._data[e]=[t]},toString:function(){var e,t=this,n=[],r=t._data,o="--";for(e in r)r.hasOwnProperty(e)&&(n.push(o+t._boundary),n.push('Content-Disposition: form-data; name="'+e+'"\r\n'),n.push(r[e]));return n.length?n.join("\r\n")+"\r\n"+o+t._boundary+o:""}},t=u.prototype,r)r.hasOwnProperty(n)&&(t[n]=r[n]);if(t.delete=function(e){delete this._data[e]},e.FormData){if(!(new e.FormData).getAll){var d=e.FormData;e.FormData=function(t){return t&&"FORM"==t.tagName&&"get"==t.method.toLowerCase()?(e.FormData=u,u(t)):(e.FormData=d,d(t))}}}else i=e.XMLHttpRequest.prototype,o=i.send,i.send=function(e){var t=this;return e instanceof u?(t.setRequestHeader("Content-Type","multipart/form-data; boundary="+e._boundary),o.call(t,e.toString())):o.call(t,e||null)},e.FormData=u})),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),function(e){e.hasAttribute=e.hasAttribute||function(e){return!(!this.attributes[e]||!this.attributes[e].specified)}}(Element.prototype),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("before")||Object.defineProperty(e,"before",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.parentNode.insertBefore(t,this)}})})),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("after")||Object.defineProperty(e,"after",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.parentNode.insertBefore(t,this.nextSibling)}})})),function(){var e=function(e){var t=this.parentNode,n=arguments.length,r=+(t&&"object"==typeof e);if(t){for(;n-- >r;)t&&"object"!=typeof arguments[n]&&(arguments[n]=document.createTextNode(arguments[n])),t||!arguments[n].parentNode?t.insertBefore(this.previousSibling,arguments[n]):arguments[n].parentNode.removeChild(arguments[n]);r&&t.replaceChild(this,e)}};Element.prototype.replaceWith||(Element.prototype.replaceWith=e),CharacterData.prototype.replaceWith||(CharacterData.prototype.replaceWith=e),DocumentType.prototype.replaceWith||(CharacterData.prototype.replaceWith=e)}(),[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.appendChild(t)}})})),[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("prepend")||Object.defineProperty(e,"prepend",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.insertBefore(t,this.firstChild)}})})),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})})),
/*! https://mths.be/scrollingelement v1.5.2 by @diegoperini & @mathias | MIT license */
"scrollingElement"in document||function(){function e(e){return window.getComputedStyle?getComputedStyle(e,null):e.currentStyle}var t;function n(e){return"none"!=e.display&&!("collapse"==e.visibility&&/^table-(.+-group|row|column)$/.test(e.display))}var r=function(){if(function(){if(!/^CSS1/.test(document.compatMode))return!1;if(void 0===t){var e=document.createElement("iframe");e.style.height="1px",(document.body||document.documentElement||document).appendChild(e);var n=e.contentWindow.document;n.write('<!DOCTYPE html><div style="height:9999em">x</div>'),n.close(),t=n.documentElement.scrollHeight>n.body.scrollHeight,e.parentNode.removeChild(e)}return t}())return document.documentElement;var r=document.body;return(r=r&&!/body/i.test(r.tagName)?function(e){for(var t,n=e;n=n.nextSibling;)if(1==n.nodeType&&(t=n,window.HTMLBodyElement?t instanceof HTMLBodyElement:/body/i.test(t.tagName)))return n;return null}(r):r)&&function(t){var r=e(t),o=e(document.documentElement);return"visible"!=r.overflow&&"visible"!=o.overflow&&n(r)&&n(o)}(r)?null:r};Object.defineProperty?Object.defineProperty(document,"scrollingElement",{get:r}):document.__defineGetter__?document.__defineGetter__("scrollingElement",r):(document.scrollingElement=r(),document.attachEvent&&document.attachEvent("onpropertychange",(function(){"activeElement"==window.event.propertyName&&(document.scrollingElement=r())})))}(),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e){"use strict";if(null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!==r)for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},writable:!0,configurable:!0}),function(e){"use strict";e.console||(e.console={});for(var t,n,r=e.console,o=function(){},i=["memory"],a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn,timeLog,trace".split(",");t=i.pop();)r[t]||(r[t]={});for(;n=a.pop();)r[n]||(r[n]=o)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this),function(){if("function"==typeof window.CustomEvent)return!1;var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e}(),String.prototype.repeat||(String.prototype.repeat=function(e){"use strict";if(null==this)throw new TypeError("can't convert "+this+" to object");var t=""+this;if((e=+e)!=e&&(e=0),e<0)throw new RangeError("repeat count must be non-negative");if(e==1/0)throw new RangeError("repeat count must be less than infinity");if(e=Math.floor(e),0==t.length||0==e)return"";if(t.length*e>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&e)&&(n+=t),0!=(e>>>=1);)t+=t;return n}),function(){var e=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var n=(new Date).getTime(),r=Math.max(0,16-(n-e)),o=window.setTimeout((function(){t(n+r)}),r);return e=n+r,o}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),void 0===window.getComputedStyle(document.body).resize&&window.HTMLTextAreaElement&&(HTMLTextAreaElement.prototype.setResize=function(){var e=this,t=e.data&&e.data.resize,n=null,r=e.id;r||(r=("r"+Math.random()).replace("0.",""),e.id=r);var o=e.getAttribute("resize");if("string"==typeof o&&"vertical"!=o&&"horizontal"!=o&&(o="both"),"string"==typeof o){if(!t){t=document.createElement("span"),(n=document.createElement("label")).setAttribute("for",r),t.appendChild(n),t.style.position="relative",t.style.verticalAlign=window.getComputedStyle(e).verticalAlign,n.style.position="absolute",n.style.width="17px",n.style.height="17px",n.style.background="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M765.558 510.004a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0zM765.558 821.46a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0zM422.15700000000004 821.46a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0zM422.15700000000004 510.004a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0zM765.558 202.54a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0zM66.77700000000002 821.46a93.65 93.65 0 1 0 191.665 0 93.65 93.65 0 1 0-191.665 0z' fill='%23BFBFBF'/%3E%3C/svg%3E\") no-repeat center",n.style.bottom="0",n.style.right="0",n.style.backgroundSize="12px 12px",e.insertAdjacentElement("afterend",t),e.data=e.data||{},e.data.resize=t;var i={};n.addEventListener("mousedown",(function(t){i.resizing=!0,i.startX=t.pageX,i.startY=t.pageY,i.offsetWidth=e.offsetWidth,i.offsetHeight=e.offsetHeight,t.preventDefault()})),document.addEventListener("mousemove",(function(n){if(i.resizing){n.preventDefault();var r=n.pageX,s=n.pageY,c=r-i.startX,l=s-i.startY,u=i.offsetWidth+c,d=i.offsetHeight+l;u<40&&(u=40),d<40&&(d=40),"both"!=o&&"horizontal"!=o||(e.style.width=u+"px","block"==t.style.display&&(t.style.width=u+"px")),"both"!=o&&"vertical"!=o||(e.style.height=d+"px",/inline/.test(a)&&(t.style.height=d+"px"))}})),document.addEventListener("mouseup",(function(){i.resizing&&(i.resizing=!1)}))}var a=window.getComputedStyle(e).display;"none"==a?t.style.display="none":/inline/.test(a)?(t.style.display="inline-block",t.style.height=e.offsetHeight+"px"):(t.style.display="block",t.style.width=e.offsetWidth+"px")}},HTMLTextAreaElement.prototype.initResize=function(){this.isInitResize||(this.setResize(),this.addEventListener("DOMAttrModified",(function(){this.setResize()}),!1),this.isInitResize=!0)},window.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("textarea[resize]").forEach((function(e){e.initResize()})),document.body.addEventListener("DOMNodeInserted",(function(e){var t=e.target;1==t.nodeType&&(!t.matches("textarea[resize]")||t.data&&t.data.resize||t.initResize())}))}))),!("placeholder"in document.createElement("input"))&&window.HTMLTextAreaElement&&(HTMLTextAreaElement.prototype.setPlaceholder=HTMLInputElement.prototype.setPlaceholder=function(){var e=this,t=e.getAttribute("placeholder");if(t){var n=window.getComputedStyle(e),r=n.fontSize,o=n.fontFamily,i=parseInt(n.lineHeight)||20,a=parseInt(n.paddingLeft)||0,s=parseInt(n.paddingTop)||0,c=e.clientWidth,l=e.offsetHeight;if("none"!=n.display&&0!=c){e.data=e.data||{};var u=e.data.placeholder;if(u||(u=document.createElement("canvas"),e.data.placeholder=u),u.placeholder!=t||u.width!=c){var d=u.getContext("2d");u.width&&d.clearRect(0,0,u.width,u.height),u.placeholder=t,u.width=c,u.height=l,d.fillStyle="#a2a9b6",d.font=[r,o].join(" "),d.textBaseline="top";for(var p=t.split(""),f="",h=c-2*a,m=0;m<p.length;m++){var y=f+p[m];d.measureText(y).width>h&&m>0?(d.fillText(f,a,s),f=p[m],s+=i):f=y}d.fillText(f,a,s);var g=u.toDataURL();e.style.backgroundRepeat="no-repeat",e.style.backgroundImage="url("+g+")"}}}else e.style.backgroundPosition="-2999px -2999px"},HTMLTextAreaElement.prototype.initPlaceholder=HTMLInputElement.prototype.initPlaceholder=function(){this.isInitPlaceholder||(this.setPlaceholder(),this.addEventListener("DOMAttrModified",(function(){this.setPlaceholder()}),!1),this.addEventListener("focus",(function(){this.style.backgroundPosition="-2999px -2999px"})),this.addEventListener("blur",(function(){""==this.value.trim()&&(this.style.backgroundPosition="")})),this.isInitPlaceholder=!0)},window.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("textarea[placeholder], input[placeholder]").forEach((function(e){e.initPlaceholder()})),document.body.addEventListener("DOMNodeInserted",(function(e){var t=e.target;1==t.nodeType&&(!/^textarea|input$/i.test(t.tagName)||!t.matches("[placeholder]")||t.data&&t.data.placeholder||t.initPlaceholder())}))})))
/*
* @preserve FormData polyfill for IE < 10. See https://developer.mozilla.org/en/docs/Web/API/FormData and http://caniuse.com/#search=formdata
*
* @author ShirtlessKirk copyright 2015
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/,function(e,t){"use strict";"function"==typeof define&&define.amd?define((function(){return t(e)})):"function"==typeof module&&module.exports?module.exports=t(e):t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this,(function(e){"use strict";var t,n,r,o,i,a=Math;function s(e){return this._data.hasOwnProperty(e)}function c(e){return this._data[e]||null}function l(e){var t,n,r,o,i,a,s,c=this;for(n=0,o=e.length;n<o;n+=1)if((a=(t=e[n]).name||t.id)&&!t.disabled)switch(t.type){case"checkbox":t.checked&&c.append(a,t.value||"on");break;case"image":c.append(a+".x",t.x||0),c.append(a+".y",t.y||0);break;case"radio":t.checked&&c.set(a,t.value);break;case"select-one":-1!==t.selectedIndex&&c.append(a,t.options[t.selectedIndex].value);break;case"select-multiple":for(r=0,i=t.options.length;r<i;r+=1)(s=t.options[r]).selected&&c.append(a,s.value);break;case"file":case"reset":case"submit":break;default:c.append(a,t.value)}}function u(e){var t,n,r=this;if(!(r instanceof u))return new u(e);(!e||e.tagName&&"FORM"===e.tagName)&&(r._boundary=(t=a.random,n=t()*a.pow(10,1+(12*t()|0)),"----------------FormData-"+(t()*n).toString(36)),r._data={},e&&l.call(r,e.children))}if(!e.FormData){for(n in i=e.XMLHttpRequest.prototype,o=i.send,i.send=function(e){var t=this;return e instanceof u?(t.setRequestHeader("Content-Type","multipart/form-data; boundary="+e._boundary),o.call(t,e.toString())):o.call(t,e||null)},r={append:function(e,t){var n=this;s.call(n,e)||(n._data[e]=[]),n._data[e].push(t)},get:function(e){var t=c.call(this,e);return t?t[0]:null},getAll:c,has:s,set:function(e,t){this._data[e]=[t]},toString:function(){var e,t=this,n=[],r=t._data,o="--";for(e in r)r.hasOwnProperty(e)&&(n.push(o+t._boundary),n.push('Content-Disposition: form-data; name="'+e+'"\r\n'),n.push(r[e]));return n.length?n.join("\r\n")+"\r\n"+o+t._boundary+o:""}},t=u.prototype,r)r.hasOwnProperty(n)&&(t[n]=r[n]);t.delete=function(e){delete this._data[e]},e.FormData=u}})),function(){if(!("position"in document.createElement("progress"))){var e,t;Object.defineProperty?e=function(e,t,n){n.enumerable=!0,n.configurable=!0;try{Object.defineProperty(e,t,n)}catch(r){-2146823252===r.number&&(n.enumerable=!1,Object.defineProperty(e,t,n))}}:"__defineSetter__"in document.body?e=function(e,t,n){e.__defineGetter__(t,n.get),n.set&&e.__defineSetter__(t,n.set)}:(e=function(e,t,n){e[t]=n.get.call(e)},!1);try{[].slice.apply(document.images),t=function(e){return[].slice.apply(e)}}catch(n){t=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=e[r];return t}}for(var n,r=((n=document.createElement("div")).foo="bar","bar"===n.getAttribute("foo")),o=window.ProgressPolyfill={DOMInterface:{max:{get:function(){return parseFloat(this.getAttribute("aria-valuemax"))||1},set:function(e){this.setAttribute("aria-valuemax",e),r||this.setAttribute("max",e),o.redraw(this)}},value:{get:function(){return parseFloat(this.getAttribute("aria-valuenow"))||0},set:function(e){e=Math.min(e,this.max),this.setAttribute("aria-valuenow",e),r||this.setAttribute("value",e),o.redraw(this)}},position:{get:function(){return this.hasAttribute("aria-valuenow")?this.value/this.max:-1}},labels:{get:function(){for(var e=this.parentNode;e&&!/^label$/i.test(e.nodeName);)e=e.parentNode;var n=e?[e]:[];if(this.id&&document.querySelectorAll){var r=t(document.querySelectorAll('label[for="'+this.id+'"]'));r.length&&(n=n.concat(r))}return n}}},redraw:function(e){o.isInited(e)?r||(e.setAttribute("aria-valuemax",parseFloat(e.getAttribute("max"))||1),e.hasAttribute("value")?e.setAttribute("aria-valuenow",parseFloat(e.getAttribute("value"))||0):e.removeAttribute("aria-valuenow")):o.init(e),-1!==e.position&&(e.style.paddingRight=e.offsetWidth*(1-e.position)+"px")},isInited:function(e){return"progressbar"===e.getAttribute("role")},init:function(t){if(!o.isInited(t)){for(var n in t.setAttribute("role","progressbar"),t.setAttribute("aria-valuemin","0"),t.setAttribute("aria-valuemax",parseFloat(t.getAttribute("max"))||1),t.hasAttribute("value")&&t.setAttribute("aria-valuenow",parseFloat(t.getAttribute("value"))||0),o.DOMInterface)e(t,n,{get:o.DOMInterface[n].get,set:o.DOMInterface[n].set});o.redraw(t)}},progresses:document.getElementsByTagName("progress")},i=o.progresses.length-1;i>=0;i--)o.init(o.progresses[i]);document.addEventListener&&(document.addEventListener("DOMAttrModified",(function(e){var t=e.target,n=e.attrName;!/^progress$/i.test(t.nodeName)||"max"!==n&&"value"!==n||o.redraw(t)}),!1),document.addEventListener("DOMNodeInserted",(function(e){var t=e.target;/^progress$/i.test(t.nodeName)&&o.init(t)}),!1))}}();