uninspected
Version:
util.inspect replacement based on Unexpected's output and type system
82 lines • 292 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("os")):"function"==typeof define&&define.amd?define(["os"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).uninspected=e(t.os)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),r=function(t){this.text=t},i=function(t,e,n,i,o){void 0===o&&(o={});var s="expected",a=t.clone();e&&e.call(a,a);var u=t.clone();if("function"==typeof i)i.call(u,u);else if(i.length>0){var c=!1;i.forEach((function(t,e){var n=t&&"object"==typeof t&&t instanceof r;e>0&&(n||c||u.text(","),u.sp()),n?u.error(t.text):t.call(u,u),c=n}))}var l=a.size(),f=u.size(),p=s.length+l.width+f.width+n.length,h=Math.max(l.height,f.height);if("omitSubject"in t&&t.omitSubject===o.subject){var d=/^(not )?to (.*)/.exec(n);d?(t.error("should "),d[1]&&t.error("not "),n=d[2]):n="expected: "+n}else o.compact&&o.compactSubject&&(l.height>1||l.width>(o.compactWidth||35))?(t.error("expected").sp(),o.compactSubject.call(t,t),t.sp()):(t.error(s),l.height>1?t.nl():t.sp(),t.append(a),l.height>1||1===h&&p>t.preferredWidth?t.nl():t.sp());return t.error(n),f.height>1?t.nl():f.width>0&&t.sp(),t.append(u),t},o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}var u=s,c=a;function l(t){if(u===setTimeout)return setTimeout(t,0);if((u===s||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}"function"==typeof o.setTimeout&&(u=setTimeout),"function"==typeof o.clearTimeout&&(c=clearTimeout);var f,p=[],h=!1,d=-1;function g(){h&&f&&(h=!1,f.length?p=f.concat(p):d=-1,p.length&&y())}function y(){if(!h){var t=l(g);h=!0;for(var e=p.length;e;){for(f=p,p=[];++d<e;)f&&f[d].run();d=-1,e=p.length}f=null,h=!1,function(t){if(c===clearTimeout)return clearTimeout(t);if((c===a||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(t);try{c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}(t)}}function v(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new m(t,e)),1!==p.length||h||l(y)}function m(t,e){this.fun=t,this.array=e}m.prototype.run=function(){this.fun.apply(null,this.array)};function b(){}var _=b,w=b,x=b,E=b,A=b,F=b,k=b;var j=o.performance||{},C=j.now||j.mozNow||j.msNow||j.oNow||j.webkitNow||function(){return(new Date).getTime()};var S=new Date;var T={nextTick:v,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:_,addListener:w,once:x,off:E,removeListener:A,removeAllListeners:F,emit:k,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*C.call(j),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-S)/1e3}},O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function P(t,e){return t(e={exports:{}},e.exports),e.exports}var D={intersects:function(t,e){return t.start<e.end&&e.start<t.end||t.start===e.start},intersectsWithSome:function(t,e){return t.some((function(t){return D.intersects(e,t)}))}},R=function(t,e){var n=e.start-t.start;return 0!==n?n:t.end-t.start-(e.end-e.start)},M=D.intersectsWithSome,B=P((function(t){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array,n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r=t.exports={objectIs:Object.is||function(t,e){return 0===t&&0===e?1/t==1/e:t!=t?e!=e:t===e},checkObjectEqualityUsingType:function(t,e,n,r){if(t===e)return!0;if(e.constructor!==t.constructor)return!1;var i=n.getKeys(t).filter((function(e){return void 0!==n.valueForKey(t,e)})),o=n.getKeys(e).filter((function(t){return void 0!==n.valueForKey(e,t)}));if(i.length!==o.length)return!1;i.sort(n.keyComparator),o.sort(n.keyComparator);for(var s=0;s<i.length;s+=1)if(i[s]!==o[s])return!1;for(var a=0;a<i.length;a+=1){var u=i[a];if(!r(n.valueForKey(t,u),n.valueForKey(e,u)))return!1}return!0},duplicateArrayLikeUsingType:function(t,e){var n=e.getKeys(t),i=n.length;if(!e.numericalPropertiesOnly){for(var o=0,s=n.length-1;s>-1;s-=1){var a=n[s];if("symbol"!=typeof a&&r.numericalRegExp.test(a))break;o+=1}i-=o}var u=new Array(i);return n.forEach((function(n,r){r>=i&&!e.hasKey(t,n)||(u[n]=e.hasKey(t,n)?e.valueForKey(t,n):void 0)})),u},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isPromise:function(t){return t&&"function"==typeof t.then},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},isError:function(t){return"object"==typeof t&&("[object Error]"===Object.prototype.toString.call(t)||t instanceof Error)},extend:function(t){for(var e=arguments,n=function(n){var r=e[n];r&&Object.keys(r).forEach((function(e){t[e]=r[e]}))},r=1;r<arguments.length;r+=1)n(r);return t},findFirst:function(t,e){for(var n=0;n<t.length;n+=1)if(e(t[n]))return t[n];return null},leftPad:function(t,e,n){for(void 0===n&&(n=" ");t.length<e;)t=n+t;return t},escapeRegExpMetaChars:function(t){return t.replace(/[[\]{}()*+?.\\^$|]/g,"\\$&")},escapeChar:function(t){if("\t"===t)return"\\t";if("\r"===t)return"\\r";var e=t.charCodeAt(0),n=e.toString(16).toUpperCase();return e<256?"\\x"+r.leftPad(n,2,"0"):"\\u"+r.leftPad(n,4,"0")},getFunctionName:function(t){if("string"==typeof t.name)return t.name;var e=Function.prototype.toString.call(t).match(/function ([^(]+)/);return e?e[1]:t===Object?"Object":t===Function?"Function":""},wrapConstructorNameAroundOutput:function(t,e){var n=e.constructor,i=n&&n!==Object&&r.getFunctionName(n);return i&&"Object"!==i?t.clone().text(i+"(").append(t).text(")"):t},setPrototypeOfOrExtend:e?n:function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},uniqueStringsAndSymbols:function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];"function"==typeof e[0]&&(t=e[0]);var r={},i=[];function o(e){Array.isArray(e)?e.forEach(o):Object.prototype.hasOwnProperty.call(r,e)||t&&!t(e)||(r[e]=!0,i.push(e))}for(var s=t?1:0;s<e.length;s+=1)o(e[s]);return i},uniqueNonNumericalStringsAndSymbols:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return r.uniqueStringsAndSymbols((function(t){return"symbol"==typeof t||!r.numericalRegExp.test(t)}),Array.prototype.slice.call(t))},forwardFlags:function(t,e){return t.replace(/\[(!?)([^\]]+)\] ?/g,(function(t,n,r){return Boolean(e[r])!==Boolean(n)?r+" ":""})).trim()},numericalRegExp:/^(?:0|[1-9][0-9]*)$/,packArrows:function(t){var e={};t.forEach((function(t,n){"moveSource"===t.type?(t.changeIndex=n,(e[t.actualIndex]=e[t.actualIndex]||{}).source=t):"moveTarget"===t.type&&(t.changeIndex=n,(e[t.actualIndex]=e[t.actualIndex]||{}).target=t)}));var n=Object.keys(e);if(n.length>0){var r=[];n.sort((function(t,n){return Math.abs(e[n].source.changeIndex-e[n].target.changeIndex)-Math.abs(e[t].source.changeIndex-e[t].target.changeIndex)})).forEach((function(t,n,i){var o=e[t],s=Math.min(o.source.changeIndex,o.target.changeIndex),a=Math.max(o.source.changeIndex,o.target.changeIndex);r.push({start:s,end:a,direction:o.source.changeIndex<o.target.changeIndex?"down":"up"})}));for(var i=function(t,e){if(e=e||{},!Array.isArray(t))throw new Error("The interval packer requires an array of objects with start and end properties.");if(0===t.length)return[];var n;t.forEach((function(t){if("object"!=typeof t||"number"!=typeof t.start||"number"!=typeof t.end||t.end<=t.start)throw new Error("Intervals must be objects with integer properties start and end where start < end.")})),t=[].concat(t).sort(R);for(var r=[],i=-1/0;t.length>0;){var o=t.pop();i<=o.start&&(n=[[]],r.push(n));for(var s=0;s<n.length&&M(n[s],o);)s+=1;(n[s]=n[s]||[]).push(o),i=Math.max(i,o.end)}return e.groupPartitions?r:r.reduce((function(t,e){return e.forEach((function(e,n){return t[n]=t[n]||[],Array.prototype.push.apply(t[n],e),t})),t}),[])}(r);i.length>3;)i.shift().forEach((function(e){var n=e.direction,r=e.start,i=e.end;t["up"===n?r:i].type="insert",t["up"===n?i:r].type="remove"}));return i}},truncateSubjectStringForBegin:function(t,e){var n=e.length+25;if(t.length<=n)return null;var r=t.indexOf(" ",e.length+1);return r>-1&&r<n?t.substring(0,r):t.substring(0,n)},truncateSubjectStringForEnd:function(t,e){var n=t.length-e.length-25;if(n<=0)return null;var r=t.lastIndexOf(" ",e.length+1);return r>-1&&r>=n?t.substring(r+1,t.length):t.substring(n,t.length)},getEnv:function(t){if("object"==typeof Deno)try{return Deno.env()[t]}catch(t){}else if("object"==typeof T&&T.env)return T.env[t]}}}));B.objectIs,B.checkObjectEqualityUsingType,B.duplicateArrayLikeUsingType,B.isArray,B.isPromise,B.isRegExp,B.isError,B.extend,B.findFirst,B.leftPad,B.escapeRegExpMetaChars,B.escapeChar,B.getFunctionName,B.wrapConstructorNameAroundOutput,B.setPrototypeOfOrExtend,B.uniqueStringsAndSymbols,B.uniqueNonNumericalStringsAndSymbols,B.forwardFlags,B.numericalRegExp,B.packArrows,B.truncateSubjectStringForBegin,B.truncateSubjectStringForEnd,B.getEnv;for(var I={extend:function(t){for(var e=1;e<arguments.length;e+=1){var n=arguments[e];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},calculateOutputEntrySize:function(t){if(t.size)return t.size;var e;switch(t.style){case"text":e={width:String(t.args.content).length,height:1};break;case"block":e=I.calculateSize(t.args);break;case"raw":var n=t.args;e={width:n.width,height:n.height};break;default:e={width:0,height:0}}return t.size=e,e},calculateLineSize:function(t){var e={height:1,width:0};return t.forEach((function(t){var n=I.calculateOutputEntrySize(t);e.width+=n.width,e.height=Math.max(n.height,e.height)})),e},calculateSize:function(t){var e={height:0,width:0};return t.forEach((function(t){var n=I.calculateLineSize(t);e.height+=n.height,e.width=Math.max(e.width,n.width)})),e},arrayEquals:function(t,e){if(t===e)return!0;if(!t||t.length!==e.length)return!1;for(var n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0},escapeRegExp:function(t){return t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},findFirst:function(t,e,n){for(var r=n||null,i=0;i<t.length;i+=1)if(e.call(r,t[i],i,t))return t[i];return null},getFunctionName:function(t){if("string"==typeof t.name)return t.name;var e=Function.prototype.toString.call(t).match(/function ([^\(]+)/);return e?e[1]:t===Object?"Object":t===Function?"Function":void 0}},L=I,N=256,z=[""],U=1;U<=N;U+=1)z[U]=z[U-1]+" ";var q=function(t,e){if(e<0)return"";var n="";if(" "===t){if(e<=N)return z[e];for(var r=z[256],i=Math.floor(e/N),o=0;o<i;o+=1)n+=r;n+=z[e%N]}else for(var s=0;s<e;s+=1)n+=t;return n},$=/^(?:bg)?#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,H={bold:"font-weight: bold",dim:"opacity: 0.7",italic:"font-style: italic",underline:"text-decoration: underline",inverse:"-webkit-filter: invert(%100); filter: invert(100%)",hidden:"visibility: hidden",strikeThrough:"text-decoration: line-through",black:"color: black",red:"color: red",green:"color: green",yellow:"color: yellow",blue:"color: blue",magenta:"color: magenta",cyan:"color: cyan",white:"color: white",gray:"color: gray",bgBlack:"background-color: black",bgRed:"background-color: red",bgGreen:"background-color: green",bgYellow:"background-color: yellow",bgBlue:"background-color: blue",bgMagenta:"background-color: magenta",bgCyan:"background-color: cyan",bgWhite:"background-color: white"};Object.keys(H).forEach((function(t){H[t.toLowerCase()]=H[t]}));var K,W=H,Y=!(void 0===T||!T.versions||!T.versions.node),V=function(){if("undefined"!=typeof Deno){var t={};try{t=Deno.env()}catch(t){}return{argv:Deno.args,color:Deno.noColor?0:1,env:t,runtime:"deno"}}if(Y){var e;try{e=n.default}catch(t){return{argv:[],env:{},runtime:"browser"}}return{argv:T.argv,env:T.env,runtime:"node",getNodeRelease:e.release}}return{argv:[],env:{},runtime:"browser"}}(),J=function(t,e){e=e||V.argv;var n=0===t.indexOf("-")?"":1===t.length?"-":"--",r=e.indexOf(n+t),i=e.indexOf("--");return-1!==r&&(-1===i||r<i)},Q=V.env;function G(t){var e=function(t){if(0===K)return 0;if(J("color=16m")||J("color=full")||J("color=truecolor"))return 3;if(J("color=256"))return 2;if(t&&!t.isTTY&&void 0===K)return 0;var e=K||0;if("dumb"===Q.TERM)return e;if("node"===V.runtime&&"win32"===T.platform){var n=V.getNodeRelease().split(".");return Number(T.versions.node.split(".")[0])>=8&&Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((function(t){return t in Q}))||"codeship"===Q.CI_NAME?1:e;if("TEAMCITY_VERSION"in Q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Q.TEAMCITY_VERSION)?1:0;if("truecolor"===Q.COLORTERM)return 3;if("TERM_PROGRAM"in Q){var r=parseInt((Q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Q.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Q.TERM)||"COLORTERM"in Q?1:e}(t);return function(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}(e)}J("no-color")||J("no-colors")||J("color=false")||J("color=never")?K=0:J("color")||J("colors")||J("color=true")||J("color=always")?K=1:"deno"===V.runtime&&(K=V.color),"FORCE_COLOR"in Q&&(K="true"===Q.FORCE_COLOR?1:"false"===Q.FORCE_COLOR?0:0===Q.FORCE_COLOR.length?1:Math.min(parseInt(Q.FORCE_COLOR,10),3));var Z=void 0===T?0:G(T.stdout);void 0===T||G(T.stderr);function X(t){if(0===t.length)return[[]];if(!function(t){return t.some((function(t){return"block"===t.style||"text"===t.style&&-1!==String(t.args.content).indexOf("\n")}))}(t))return[t];var e=[],n=[],r=0;return t.forEach((function(t,i){var o=function(t){switch(t.style){case"text":return String(t.args.content).split("\n").map((function(e){return""===e?[]:[{style:"text",args:{content:e,styles:t.args.styles},themes:t.themes}]}));case"block":return tt(t.args);default:return[]}}(t),s=o.map((function(t){return L.calculateLineSize(t).width})),a=Math.max.apply(null,s);o.forEach((function(i,o){var a,u,c=e[o];if(c||(e[o]=c=[],n[o]=0),i.length){var l=r-n[o];c.push((a=l,u=t.themes,{style:"text",args:{content:q(" ",a),styles:[]},themes:u})),Array.prototype.push.apply(c,i),n[o]=r+s[o]}})),r+=a}),this),e}function tt(t){var e=[];return t.forEach((function(t){X(t).forEach((function(t){e.push(t)}))})),e}var et=tt;function nt(){}nt.prototype.format="text",nt.prototype.serialize=function(t){return(t=et(t)).map(this.serializeLine,this).join("\n")},nt.prototype.serializeLine=function(t){return t.map((function(t){return this[t.style]?String(this[t.style](t.args,t.themes)):""}),this).join("")},nt.prototype.text=function(t){return String(t.content)},nt.prototype.block=function(t){return this.serialize(t)},nt.prototype.raw=function(t){return String(t.content(this))};var rt=nt,it=function(t,e){if(1===e.length){for(var n=0,r=[],i=e[0],o=t.styles||{};"string"==typeof i&&o[i];)if(i=o[i],(n+=1)>100){var s=r.indexOf(i);if(r.push(i),-1!==s)throw new Error("Your theme contains a loop: "+r.slice(s).join(" -> "))}return Array.isArray(i)?i:[i]}return e};function ot(){}ot.prototype.format="html",ot.prototype.serialize=function(t){return'<div style="font-family: monospace; white-space: nowrap">'+this.serializeLines(t)+"</div>"},ot.prototype.serializeLines=function(t){return t.map((function(t){return"<div>"+(this.serializeLine(t).join("")||" ")+"</div>"}),this).join("")},ot.prototype.serializeLine=function(t){return t.map((function(t){return this[t.style]?this[t.style](t.args,t.themes):""}),this)},ot.prototype.block=function(t){return'<div style="display: inline-block; vertical-align: top">'+this.serializeLines(t)+"</div>"},ot.prototype.text=function(t,e){var n=String(t.content);if(""===n)return"";n=n.replace(/&/g,"&").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var r=it(e.html||{},t.styles);if(r.length>0){for(var i=[],o=0;o<r.length;o+=1){var s=r[o];$.test(s)?"bg"===s.substring(0,2)?i.push("background-color: "+s.substring(2)):i.push("color: "+s):W[s]&&i.push(W[s])}i.length>0&&(n='<span style="'+i.join("; ")+'">'+n+"</span>")}return n},ot.prototype.raw=function(t){return String(t.content(this))};var st=ot,at=function(t,e){var n=t.L,r=t.a,i=t.b,o=e.L,s=e.a,a=e.b,u=ut(ct(r,2)+ct(i,2)),c=ut(ct(s,2)+ct(a,2)),l=(u+c)/2,f=.5*(1-ut(ct(l,7)/(ct(l,7)+ct(25,7)))),p=(1+f)*r,h=(1+f)*s,d=ut(ct(p,2)+ct(i,2)),g=ut(ct(h,2)+ct(a,2)),y=function(t,e){if(0==t&&0==e)return 0;var n=ft(t,e)*(180/gt);return n>=0?n:n+360},v=y(i,p),m=y(a,h),b=o-n,_=g-d,w=function(t,e,n,r){if(t*e==0)return 0;if(ht(r-n)<=180)return r-n;if(r-n>180)return r-n-360;if(r-n<-180)return r-n+360;throw new Error}(u,c,v,m),x=2*ut(d*g)*pt(yt(w)/2),E=(n+o)/2,A=(d+g)/2,F=function(t,e,n,r){if(t*e==0)return n+r;if(ht(n-r)<=180)return(n+r)/2;if(ht(n-r)>180&&n+r<360)return(n+r+360)/2;if(ht(n-r)>180&&n+r>=360)return(n+r-360)/2;throw new Error}(u,c,v,m),k=1-.17*lt(yt(F-30))+.24*lt(yt(2*F))+.32*lt(yt(3*F+6))-.2*lt(yt(4*F-63)),j=30*dt(-ct((F-275)/25,2)),C=ut(ct(A,7)/(ct(A,7)+ct(25,7))),S=1+.015*ct(E-50,2)/ut(20+ct(E-50,2)),T=1+.045*A,O=1+.015*A*k,P=-2*C*pt(yt(2*j));return ut(ct(b/(1*S),2)+ct(_/(1*T),2)+ct(x/(1*O),2)+P*(_/(1*T))*(x/(1*O)))},ut=Math.sqrt,ct=Math.pow,lt=Math.cos,ft=Math.atan2,pt=Math.sin,ht=Math.abs,dt=Math.exp,gt=Math.PI;
/**
* @author Markus Ekholm
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org >
* @license Copyright (c) 2012-2015, Markus Ekholm
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function yt(t){return t*(gt/180)}var vt={ciede2000:at},mt=function(t){return function(t){var e=100,n=108.883,r=95.047,i=t.Y/e,o=t.Z/n,s=t.X/r;s=s>.008856?bt(s,1/3):7.787*s+16/116;i=i>.008856?bt(i,1/3):7.787*i+16/116;o=o>.008856?bt(o,1/3):7.787*o+16/116;return{L:116*i-16,a:500*(s-i),b:200*(i-o)}}(function(t){var e=t.R/255,n=t.G/255,r=t.B/255;e>.04045?e=bt((e+.055)/1.055,2.4):e/=12.92;n>.04045?n=bt((n+.055)/1.055,2.4):n/=12.92;r>.04045?r=bt((r+.055)/1.055,2.4):r/=12.92;return{X:.4124*(e*=100)+.3576*(n*=100)+.1805*(r*=100),Y:.2126*e+.7152*n+.0722*r,Z:.0193*e+.1192*n+.9505*r}}(t))},bt=Math.pow;
/**
* @author Markus Ekholm
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org >
* @license Copyright (c) 2012-2015, Markus Ekholm
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/var _t={rgb_to_lab:mt},wt=function(t,e,n){var r={};n=n||"closest";for(var i=0;i<t.length;i+=1){for(var o=t[i],s=void 0,a=void 0,u=0;u<e.length;u+=1){var c=e[u],l=Et(o,c);null==s||"closest"===n&&l<a?(s=c,a=l):"furthest"===n&&l>a&&(s=c,a=l)}r[xt(o)]=s}return r};
/**
* @author Markus Ekholm
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org >
* @license Copyright (c) 2012-2015, Markus Ekholm
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function xt(t){return"R"+t.R+"B"+t.B+"G"+t.G}function Et(t,e){return t=_t.rgb_to_lab(t),e=_t.rgb_to_lab(e),vt.ciede2000(t,e)}var At={map_palette:wt,palette_map_key:xt},Ft=P((function(t){var e=t.exports={};e.diff=vt.ciede2000,e.rgb_to_lab=_t.rgb_to_lab,e.map_palette=At.map_palette,e.palette_map_key=At.palette_map_key,e.closest=function(t,n){var r=e.palette_map_key(t);return e.map_palette([t],n,"closest")[r]},e.furthest=function(t,n){var r=e.palette_map_key(t);return e.map_palette([t],n,"furthest")[r]}})),kt=P((function(t){var e=t.exports={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};e.colors.grey=e.colors.gray,Object.keys(e).forEach((function(t){var n=e[t];Object.keys(n).forEach((function(t){var r=n[t];e[t]=n[t]={open:"["+r[0]+"m",close:"["+r[1]+"m"}})),Object.defineProperty(e,t,{value:n,enumerable:!1})}))}));kt.modifiers,kt.colors,kt.bgColors;var jt=0,Ct=L.extend({},kt);function St(){}Object.keys(Ct).forEach((function(t){Ct[t.toLowerCase()]=Ct[t]})),St.prototype=new rt,St.prototype.format="ansi";var Tt={16:{"#000000":"black","#ff0000":"red","#00ff00":"green","#ffff00":"yellow","#0000ff":"blue","#ff00ff":"magenta","#00ffff":"cyan","#ffffff":"white","#808080":"gray"},256:{}},Ot={};function Pt(t){t.length<6&&(t=t.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"$1$1$2$2$3$3"));var e=t.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);if(e)return{R:parseInt(e[1],16),G:parseInt(e[2],16),B:parseInt(e[3],16)}}function Dt(t){var e=(65536*Math.round(t.R)+256*Math.round(t.G)+Math.round(t.B)).toString(16);return"#"+"00000".substr(0,6-e.length)+e}Ot[16]=Object.keys(Tt[16]).map(Pt),Ot.bg16=Object.keys(Tt[16]).filter((function(t){return"#808080"!==t})).map(Pt),Ot[256]=[].concat(Ot[16]);var Rt=16;function Mt(t){Ot[256].push(t),Tt[256][Dt(t)]=Rt,Rt+=1}for(var Bt=0;Bt<6;Bt+=1)for(var It=0;It<6;It+=1)for(var Lt=0;Lt<6;Lt+=1)Mt({R:Math.round(256*Bt/6),G:Math.round(256*It/6),B:Math.round(256*Lt/6)});[8,18,28,38,48,58,68,78,88,96,102,118,128,138,148,158,168,178,188,198,208,218,228,238].forEach((function(t){Mt({R:t,G:t,B:t})})),St.prototype.text=function(t,e){var n=String(t.content);if(""===n)return"";var r,i=it(e.ansi||{},t.styles);if(i.length>0)for(var o=i.length-1;o>=0;o-=1){var s=i[o];if(Ct[s])n=Ct[s].open+n+Ct[s].close;else if($.test(s)){var a=s,u="bg"===s.substring(0,2),c=u?s.substring(2):s,l=Dt(Ft.closest(Pt(c),Ot[u?"bg16":16])),f=Tt[16][l],p=Dt(Ft.closest(Pt(c),Ot[256])),h=Tt[256][p];s=u?"bg"+((r=f).substring(0,1).toUpperCase()+r.substring(1)):f;var d=Ct[s].open,g=Ct[s].close;l!==p&&(d+="["+(u?48:38)+";5;"+h+"m"),jt<1024&&(Ct[a]={open:d,close:g},jt+=1),n=d+n+g}}return n};var Nt=St;function zt(){}zt.prototype.format="coloredConsole",zt.prototype.serialize=function(t){var e="",n=[];return this.serializeLines(et(t)).forEach((function(t){t&&(e+=t[0],t.length>1&&n.push(t[1]))})),[e].concat(n)},zt.prototype.serializeLines=function(t){var e=[];return t.forEach((function(t,n){n>0&&e.push(["%c\n ",""]),Array.prototype.push.apply(e,this.serializeLine(t))}),this),e},zt.prototype.serializeLine=function(t){var e=[];return t.forEach((function(t){this[t.style]&&e.push(this[t.style](t.args,t.themes))}),this),e},zt.prototype.block=function(t){return this.serializeLines(t)},zt.prototype.text=function(t,e){var n=String(t.content);if(""===n)return"";var r=it(e.coloredConsole||{},t.styles),i=["%c"+n.replace(/%/g,"%%")],o=[];if(r.length>0)for(var s=0;s<r.length;s+=1){var a=r[s];$.test(a)?"bg"===a.substring(0,2)?o.push("background-color: "+a.substring(2)):o.push("color: "+a):W[a]&&o.push(W[a])}return i.push(o.join("; ")),i},zt.prototype.raw=function(t){return String(t.content(this))};var Ut=zt,qt=P((function(t,e){var n=L.extend,r=["bold","dim","italic","underline","inverse","hidden","strikeThrough","black","red","green","yellow","blue","magenta","cyan","white","gray","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite"];function i(t){if(!(this instanceof i))return new i(t);"string"==typeof(t=t||{})&&(t={format:t});var e="indentationWidth"in t?t.indentationWidth:2;this.indentationWidth=Math.max(e,0),this.indentationLevel=0,this.output=[[]],this.styles=Object.create(null),this.installedPlugins=[],this._themes={},Object.keys(i.serializers).forEach((function(t){this._themes[t]={styles:{}}}),this),this.preferredWidth=80,t.format&&(this.format=t.format)}function o(t,e){return!(!t||!e||"text"!==t.style||"text"!==e.style)&&(L.arrayEquals(t.args.styles,e.args.styles)&&t.themes===e.themes)}function s(t){if(0===t.length)return t;for(var e=[t[0]],n=1;n<t.length;n+=1){var r=e[e.length-1],i=t[n];"text"===i.style&&""===i.args.content||(o(r,i)?e[e.length-1]={style:r.style,args:{content:r.args.content+i.args.content,styles:r.args.styles},themes:r.themes}:e.push(i))}return e}function a(t){return t&&"object"==typeof t&&"number"==typeof t.width&&"number"==typeof t.height&&("function"==typeof t.content||"string"==typeof t.content)}function u(t,e){var n=t[t.length-1].slice(),r=t.slice(0,-1),i=n[n.length-1];return i&&"block"===i.style?(n[n.length-1]={style:"block",args:u(i.args,e),themes:e._themes},r[t.length-1]=n):(Array.prototype.push.apply(n,e.output[0]),r[t.length-1]=s(n),r.push.apply(r,e.output.slice(1))),r}function c(t,e,n,r){var i=t;return e.forEach((function(e,o){o>0&&i.nl(),e.forEach((function(e,o){if("block"===e.style)return i.output[i.output.length-1].push({style:"block",args:c(t.clone(),e.args,n,r),themes:e.themes});if("text"!==e.style)return i.output[i.output.length-1].push(e);var s;n.global&&(n.lastIndex=0);for(var a=!0,u=0,l=e.args.content,f=e.args.styles;null!==(s=n.exec(l))&&(n.global||a);)u<s.index&&i.text.apply(i,[l.substring(u,s.index)].concat(f)),r.apply(i,[f].concat(s)),a=!1,u=s.index+s[0].length;0===u?(0===i.output.length?i.output[0]=[]:i.output[i.output.length-1]).push(e):u<l.length&&i.text.apply(i,[l.substring(u,l.length)].concat(f))}),this)}),this),i.output.map(s)}"string"!=typeof e.nodeName&&Z?i.defaultFormat="ansi":"undefined"!=typeof window&&void 0!==window.navigator?window._phantom||window.mochaPhantomJS||window.__karma__&&window.__karma__.config.captureConsole?i.defaultFormat="ansi":i.defaultFormat="html":i.defaultFormat="text",i.prototype.newline=i.prototype.nl=function(t){if(void 0===t&&(t=1),0===t)return this;for(var e=0;e<t;e+=1)this.output.push([]);return this},i.serializers={},[rt,st,Nt,Ut].forEach((function(t){i.serializers[t.prototype.format]=t})),i.prototype.write=function(t){if(this.styles[t.style])return this.styles[t.style].apply(this,t.args),this;var e=this.output[this.output.length-1],n=e[e.length-1];return o(n,t)?e[e.length-1]={style:n.style,args:{content:n.args.content+t.args.content,styles:n.args.styles},themes:this._themes}:e.push(t),this},i.prototype.indentLines=function(){return this.indentationLevel+=1,this},i.prototype.indent=i.prototype.i=function(){for(var t=0;t<this.indentationLevel;t+=1)this.space(this.indentationWidth);return this},i.prototype.outdentLines=function(){return this.indentationLevel=Math.max(0,this.indentationLevel-1),this},i.prototype.addStyle=function(t,e,n){if(!1===this[t]||(this.hasOwnProperty(t)||i.prototype[t])&&!Object.prototype.hasOwnProperty.call(this.styles,t)&&-1===r.indexOf(t))throw new Error('"'+t+'" style cannot be defined, it clashes with a built-in attribute');if((this.hasOwnProperty(t)||-1!==r.indexOf(t))&&("function"===typeof this[t]&&!n))throw new Error('"'+t+'" style is already defined, set 3rd arg (allowRedefinition) to true to define it anyway');return this._stylesHaveNotBeenClonedYet&&(this.styles=Object.create(this.styles),this._stylesHaveNotBeenClonedYet=!1),this.styles[t]=e,this[t]=function(){return e.apply(this,arguments),this},this},i.prototype.toString=function(t){if(t&&this.format&&t!==this.format)throw new Error("A pen with format: "+this.format+" cannot be serialized to: "+t);return"auto"===(t=this.format||t||"text")&&(t=i.defaultFormat),this._themes[t],(new i.serializers[t]).serialize(this.output)},i.prototype.text=function(){var t=arguments[0];if(""===t)return this;for(var e=new Array(arguments.length-1),n=1;n<arguments.length;n+=1)e[n-1]=arguments[n];if(-1!==(t=String(t)).indexOf("\n")){var r=t.split(/\n/);return r.forEach((function(t,n){t.length&&this.write({style:"text",args:{content:t,styles:e},themes:this._themes}),n<r.length-1&&this.nl()}),this),this}return this.write({style:"text",args:{content:t,styles:e},themes:this._themes})},i.prototype.removeFormatting=function(){var t=this.clone();return this.output.forEach((function(e,n){t.output[n]=s(e.map((function(t){return"text"===t.style?{style:"text",args:{content:t.args.content,styles:[]},themes:t.themes}:t})))})),t.indentationLevel=this.indentationLevel,t},i.prototype.getContentFromArguments=function(t){var e;if(t[0].isMagicPen)return this.ensureCompatibleFormat(t[0].format),t[0];if("function"==typeof t[0])return e=this.clone(),t[0].call(e,e),e;if("string"==typeof t[0]&&1===t.length)return(e=this.clone()).text(t[0]),e;if("string"==typeof t[0])return(e=this.clone())[t[0]].apply(e,Array.prototype.slice.call(t,1)),e;throw new Error("Requires the arguments to be:\na pen or\na callback appending content to a pen or\na style and arguments for that style or\njust a string.")},i.prototype.isMultiline=function(){return this.output.length>1||this.size().height>1},i.prototype.isAtStartOfLine=function(){return 0===this.output.length||0===this.output[this.output.length-1].length},i.prototype.isBlock=function(){return 1===this.output.length&&1===this.output[0].length&&"block"===this.output[0][0].style},i.prototype.ensureCompatibleFormat=function(t){if(t&&this.format&&t!==this.format)throw new Error("This pen is only compatible with the format: "+this.format)},i.prototype.block=function(){var t=this.getContentFromArguments(arguments),e=t.output.map((function(t){return[].concat(t)}));return this.write({style:"block",args:e,themes:this._themes})},i.prototype.alt=function(t){var e=this.format;if(!e)throw new Error("The alt method is only supported on a pen where the format has already been set");var n=t[e];return void 0===n?t.fallback?this.append(t.fallback):this:"string"==typeof n||a(n)?this.raw(n):this.append(n)},i.prototype.raw=function(t){if(!this.format)throw new Error("The raw method is only supported on a pen where the format has already been set");if("string"==typeof t)return this.write({style:"raw",args:{height:0,width:0,content:function(){return t}},themes:this._themes});if(a(t)){if("string"==typeof t.content){var e=(t=n({},t)).content;t.content=function(){return e}}return this.write({style:"raw",args:t,themes:this._themes})}throw new Error("Raw "+this.format+" content needs to adhere to one of the following forms:\na string of raw content\na function returning a string of raw content or\nan object with the following form { width: <number>, height: <number>, content: <string function() {}|string> }")},i.prototype.amend=function(){var t=this.getContentFromArguments(arguments);return t.isEmpty()||(this.output=u(this.output,t)),this},i.prototype.append=function(){var t=this.getContentFromArguments(arguments);if(t.isEmpty())return this;var e=this.output[this.output.length-1];return Array.prototype.push.apply(e,t.output[0]),this.output[this.output.length-1]=s(e),this.output.push.apply(this.output,t.output.slice(1)),this},i.prototype.prependLinesWith=function(){var t=this.getContentFromArguments(arguments);if(t.isEmpty())return this;if(t.output.length>1)throw new Error("PrependLinesWith only supports a pen with single line content");var e=this.size().height,n=this.clone();return n.block((function(){for(var n=0;n<e;n+=1)n>0&&this.nl(),this.append(t)})),n.block(this),this.output=n.output,this},i.prototype.space=i.prototype.sp=function(t){return 0===t?this:(void 0===t&&(t=1),this.text(q(" ",t)))},r.forEach((function(t){i.prototype[t]=i.prototype[t.toLowerCase()]=function(e){return this.text(e,t)}})),i.prototype.clone=function(t){function e(){}this.isEmpty()||this.ensureCompatibleFormat(t),e.prototype=this;var n=new e;return n.styles=this.styles,n._stylesHaveNotBeenClonedYet=!0,n.indentationLevel=0,n.output=[[]],n.installedPlugins=[],n._themes=this._themes,n._themesHaveNotBeenClonedYet=!0,n.format=t||this.format,n.parent=this,n},i.prototype.isMagicPen=!0,i.prototype.size=function(){return L.calculateSize(this.output)},i.prototype.use=function(t){var e=L.findFirst(this.installedPlugins,(function(e){if(e===t)return!0;if("function"==typeof t&&"function"==typeof e){var n=L.getFunctionName(t);return""!==n&&n===L.getFunctionName(e)}return e.name===t.name}));if(e){if(e===t||void 0!==t.version&&t.version===e.version)return this;throw new Error("Another instance of the plugin '"+t.name+"' is already installed"+(void 0!==e.version?" (version "+e.version+(void 0!==t.version?", trying to install "+t.version:"")+")":"")+". Please check your node_modules folder for unmet peerDependencies.")}if("function"!=typeof t&&("object"!=typeof t||"function"!=typeof t.installInto)||void 0!==t.name&&"string"!=typeof t.name||void 0!==t.dependencies&&!Array.isArray(t.dependencies))throw new Error("Plugins must be functions or adhere to the following interface\n{\n name: <an optional plugin name>,\n version: <an optional semver version string>,\n dependencies: <an optional list of dependencies>,\n installInto: <a function that will update the given magicpen instance>\n}");if(t.dependencies){var n=this,r=[];do{r.push(n),n=n.parent}while(n);var i=t.dependencies.filter((function(t){return!r.some((function(e){return e.installedPlugins.some((function(e){return e.name===t}))}))}));if(1===i.length)throw new Error(t.name+" requires plugin "+i[0]);if(i.length>1)throw new Error(t.name+" requires plugins "+i.slice(0,-1).join(", ")+" and "+i[i.length-1])}return this.installedPlugins.push(t),"function"==typeof t?t(this):t.installInto(this),this},i.prototype.installPlugin=i.prototype.use,i.prototype.isEmpty=function(){return 1===this.output.length&&0===this.output[0].length},i.prototype.replaceText=function(t,e){if(this.isEmpty())return this;if("string"==typeof t&&(t=new RegExp(L.escapeRegExp(t),"g")),"string"==typeof e){var n=e;e=function(t,e){var r=[n].concat(t);this.text.apply(this,r)}}return 1===arguments.length&&(e=t,t=/.*/),this.output=c(this.clone(),this.output,t,e),this},i.prototype.theme=function(t){if(!(t=t||this.format))throw new Error("Could not detect which format you want to retrieve theme information for. Set the format of the pen or provide it as an argument to the theme method.");return this._themes[t]},i.prototype.installTheme=function(t,e){var r=this;if(1===arguments.length&&(e=t,t=Object.keys(i.serializers)),"string"==typeof t&&(t=[t]),"object"!=typeof e||!Array.isArray(t)||t.some((function(t){return"string"!=typeof t})))throw new Error("Themes must be installed the following way:\nInstall theme for all formats: pen.installTheme({ comment: 'gray' })\nInstall theme for a specific format: pen.installTheme('ansi', { comment: 'gray' }) or\nInstall theme for a list of formats: pen.installTheme(['ansi', 'html'], { comment: 'gray' })");if(e.styles&&"object"==typeof e.styles||(e={styles:e}),r._themesHaveNotBeenClonedYet){var o={};Object.keys(r._themes).forEach((function(t){o[t]=Object.create(r._themes[t])})),r._themes=o,r._themesHaveNotBeenClonedYet=!1}return Object.keys(e.styles).forEach((function(t){if($.test(t)||W[t])throw new Error("Invalid theme key: '"+t+"' you can't map build styles.");r[t]||r.addStyle(t,(function(e){this.text(e,t)}))})),t.forEach((function(t){var i=r._themes[t]||{styles:{}},o=n({},i,e);o.styles=n({},i.styles,e.styles),r._themes[t]=o})),this},t.exports=i}));var $t=function(t,e,n){if(t===e)return 0;if(n="number"==typeof n?n:1/0,t.length>e.length){var r=t;t=e,e=r}for(var i=t.length,o=e.length;i>0&&t.charCodeAt(~-i)===e.charCodeAt(~-o);)i--,o--;if(0===i)return o<n?o:n;for(var s=0;s<i&&t.charCodeAt(s)===e.charCodeAt(s);)s++;if(o-=s,0===(i-=s))return o<n?o:n;var a=o-i;if((n=o<n?o:n)<a)return n;for(var u=2+((i<n?i:n)>>1),c=a+2*u+2,l=new Array(c),f=new Array(c),p=0;p<c;p++)l[p]=-1,f[p]=-1;for(var h=new Array(i),d=new Array(o),g=(p=0,s);p<i;p++,g++)h[p]=t.charCodeAt(g),d[p]=e.charCodeAt(g);for(;p<o;)d[p++]=e.charCodeAt(g++);p=0;var y=a+u,v=y<<1;do{var m,b;r=l;l=f,f=r;var _,w,x=-1;++p<=u?(m=1-p,_=p-2):_=l[u+(m=p-(u<<1)+1)],p<=y?(w=p,f[u+p]=-1):w=v-p;for(var E=m,A=m+u;E<w;E++,A++){for(b=x,g=(g=(g=(x=_)+1)<b?b:g)<(_=l[A+1])+1?_+1:g;g<i&&g+E<o&&h[g]===d[g+E];)g++;f[A]=g}}while(f[y]<i&&p<=n);return p-1},Ht=P((function(t){var e=function(){return void 0===this}();if(e)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:e,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var n={}.hasOwnProperty,r={}.toString,i={}.constructor.prototype,o=function(t){var e=[];for(var r in t)n.call(t,r)&&e.push(r);return e};t.exports={isArray:function(t){try{return"[object Array]"===r.call(t)}catch(t){return!1}},keys:o,names:o,defineProperty:function(t,e,n){return t[e]=n.value,t},getDescriptor:function(t,e){return{value:t[e]}},freeze:function(t){return t},getPrototypeOf:function(t){try{return Object(t).constructor.prototype}catch(t){return i}},isES5:e,propertyIsWritable:function(){return!0}}}}));Ht.freeze,Ht.defineProperty,Ht.getDescriptor,Ht.keys,Ht.names,Ht.getPrototypeOf,Ht.isArray,Ht.isES5,Ht.propertyIsWritable;var Kt,Wt="undefined"==typeof navigator,Yt=function(){try{var t={};return Ht.defineProperty(t,"f",{get:function(){return 3}}),3===t.f}catch(t){return!1}}(),Vt={e:{}};function Jt(){try{var t=Kt;return Kt=null,t.apply(this,arguments)}catch(t){return Vt.e=t,Vt}}function Qt(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function Gt(t,e,n){if(Qt(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return Ht.defineProperty(t,e,r),t}var Zt=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(Ht.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(t){return r}for(var s=0;s<o.length;++s){var a=o[s];if(!i[a]){i[a]=!0;var u=Object.getOwnPropertyDescriptor(t,a);null!=u&&null==u.get&&null==u.set&&r.push(a)}}t=Ht.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var s=0;s<t.length;++s)if(r.call(t[s],o))continue t;i.push(o)}return i}}(),Xt=/this\s*\.\s*\S+\s*=/;var te=/^[a-z$_][a-z$_0-9]*$/i;function ee(t){try{return t+""}catch(t){return"[no string representation]"}}function ne(t){return t instanceof Error&&Ht.propertyIsWritable(t,"stack")}var re="stack"in new Error?function(t){return ne(t)?t:new Error(ee(t))}:function(t){if(ne(t))return t;try{throw new Error(ee(t))}catch(t){return t}};function ie(t){return{}.toString.call(t)}var oe={isClass:function(t){try{if("function"==typeof t){var e=Ht.names(t.prototype),n=Ht.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=Xt.test(t+"")&&Ht.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return te.test(t)},inheritedDataKeys:Zt,getDataPropertyOrDefault:function(t,e,n){if(!Ht.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0},thrower:function(t){throw t},isArray:Ht.isArray,haveGetters:Yt,notEnumerableProp:Gt,isPrimitive:Qt,isObject:function(t){return!Qt(t)},canEvaluate:Wt,errorObj:Vt,tryCatch:function(t){return Kt=t,Jt},inherits:function(t,e){var n={}.hasOwnProperty;function r(){for(var r in this.constructor=t,this.constructor$=e,e.prototype)n.call(e.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=e.prototype[r])}return r.prototype=e.prototype,t.prototype=new r,t.prototype},withAppended:function(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;n<r;++n)i[n]=t[n];return i[n]=e,i},maybeWrapAsError:function(t){return Qt(t)?new Error(ee(t)):t},toFastProperties:function(t){return t},filledRange:function(t,e,n){for(var r=new Array(t),i=0;i<t;++i)r[i]=e+i+n;return r},toString:ee,canAttachTrace:ne,ensureErrorObject:re,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{Gt(t,"isOperational",!0)}catch(t){}},classString:ie,copyDescriptors:function(t,e,n){for(var r=Ht.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{Ht.defineProperty(e,o,Ht.getDescriptor(t,o))}catch(t){}}},hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:void 0!==T&&"[object process]"===ie(T).toLowerCase()};oe.isRecentNode=oe.isNode&&function(){var t=T.versions.node.split(".").map(Number);return 0===t[0]&&t[1]>10||t[0]>0}(),oe.isNode&&oe.toFastProperties(T);try{throw new Error}catch(t){oe.lastLineError=t}var se,ae=oe;if(ae.isNode&&"undefined"==typeof MutationObserver){var ue=O.setImmediate,ce=v;se=ae.isRecentNode?function(t){ue.call(O,t)}:function(t){ce.call(T,t)}}else"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?se="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}:(se=function(t){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}}).isStatic=!0;var le=se;function fe(t){this._capacity=t,this._length=0,this._front=0}fe.prototype._willBeOverCapacity=function(t){return this._capacity<t},fe.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1),this[this._front+e&this._capacity-1]=t,this._length=e+1},fe.prototype._unshiftOne=function(t){var e=this._capacity;this._checkCapacity(this.length()+1);var n=(this._front-1&e-1^e)-e;this[n]=t,this._front=n,this._length=this.length()+1},fe.prototype.unshift=function(t,e,n){this._unshiftOne(n),this._unshiftOne(e),this._unshiftOne(t)},fe.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},fe.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},fe.prototype.length=function(){return this._length},fe.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},fe.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t,function(t,e,n,r,i){for(var o=0;o<i;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)};var pe,he=fe;try{throw new Error}catch(t){pe=t}var de=le;function ge(){this._isTickUsed=!1,this._lateQueue=new he(16),this._normalQueue=new he(16),this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=de.isStatic?de(this.drainQueues):de}function ye(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function ve(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function me(t){this._normalQueue._pushOne(t),this._queueTick()}ge.prototype.disableTrampolineIfNecessary=function(){ae.hasDevTools&&(this._trampolineEnabled=!1)},ge.prototype.enableTrampoline=function(){this._trampolineEnabled||(this._trampolineEnabled=!0,this._schedule=function(t){setTimeout(t,0)})},ge.prototype.haveItemsQueued=function(){return this._normalQueue.length()>0},ge.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout((function(){t(e)}),0);else try{this._schedule((function(){t(e)}))}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},ae.hasDevTools?(de.isStatic&&(de=function(t){setTimeout(t,0)}),ge.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?ye.call(this,t,e,n):this._schedule((function(){setTimeout((function(){t.call(e,n)}),100)}))},ge.prototype.invoke=function(t,e,n){this._trampolineEnabled?ve.call(this,t,e,n):this._schedule((function(){t.call(e,n)}))},ge.prototype.settlePromises=function(t){this._trampolineEnabled?me.call(this,t):this._schedule((function(){t._settlePromises()}))}):(ge.prototype.invokeLater=ye,ge.prototype.invoke=ve,ge.prototype.settlePromises=me),ge.prototype.invokeFirst=function(t,e,n){this._normalQueue.unshift(t,e,n),this._queueTick()},ge.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},ge.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},ge.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},ge.prototype._reset=function(){this._isTickUsed=!1};var be=new ge,_e=pe;be.firstLineError=_e;var we,xe,Ee=Ht.freeze,Ae=ae.inherits,Fe=ae.notEnumerableProp;function ke(t,e){function n(r){if(!(this instanceof n))return new n(r);Fe(this,"message","string"==typeof r?r:e),Fe(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return Ae(n,Error),n}var je=ke("Warning","warning"),Ce=ke("CancellationError","cancellation error"),Se=ke("TimeoutError","timeout error"),Te=ke("AggregateError","aggregate error");try{we=TypeError,xe=RangeError}catch(t){we=ke("TypeError","type error"),xe=ke("RangeError","range error")}for(var Oe="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),Pe=0;Pe<Oe.length;++Pe)"function"=